From 1554eca68c5122fac52e3d6eb3456d2dc58d17ef Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Sun, 17 Feb 2013 07:21:43 -0800 Subject: [PATCH 01/11] node github authentication branch for github console tutorial --- .gitignore | 10 ++++++++++ .idea/codeStyleSettings.xml | 13 +++++++++++++ .idea/encodings.xml | 5 +++++ .idea/josh.js-pages.iml | 9 +++++++++ .idea/libraries/sass_stdlib.xml | 8 ++++++++ .idea/misc.xml | 8 ++++++++ .idea/modules.xml | 9 +++++++++ .idea/scopes/scope_settings.xml | 5 +++++ .idea/vcs.xml | 7 +++++++ 9 files changed, 74 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/codeStyleSettings.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/josh.js-pages.iml create mode 100644 .idea/libraries/sass_stdlib.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..377d367 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.project +src/config.js +*~ +output/* +*.diff +output-min/* +__* +.#* +config/ +.idea/ diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..d63a15e --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..7c62b52 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/josh.js-pages.iml b/.idea/josh.js-pages.iml new file mode 100644 index 0000000..3b09ca3 --- /dev/null +++ b/.idea/josh.js-pages.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/libraries/sass_stdlib.xml b/.idea/libraries/sass_stdlib.xml new file mode 100644 index 0000000..8962a7d --- /dev/null +++ b/.idea/libraries/sass_stdlib.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5cf522e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,8 @@ + + + + jar:file:\C:\Program Files (x86)\JetBrains\WebStorm 5.0.2\lib\webide.jar!\resources\html5-schema\html5.rnc + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..798cf33 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..0d5175c --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..ab55cf1 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + From 80b8ee5d3e3f32cef031cf14a0e356ce669b7361 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Sat, 16 Feb 2013 15:29:21 -0800 Subject: [PATCH 02/11] setting up node dependencies --- .gitignore | 5 +- node_modules/.bin/express | 1 + node_modules/.bin/jade | 1 + node_modules/connect/.npmignore | 12 + node_modules/connect/.travis.yml | 5 + node_modules/connect/LICENSE | 24 + node_modules/connect/index.js | 4 + node_modules/connect/lib-cov/cache.js | 68 + node_modules/connect/lib-cov/connect.js | 93 + node_modules/connect/lib-cov/index.js | 6 + .../connect/lib-cov/middleware/basicAuth.js | 128 + .../connect/lib-cov/middleware/bodyParser.js | 43 + .../connect/lib-cov/middleware/compress.js | 159 + .../lib-cov/middleware/cookieParser.js | 70 + .../lib-cov/middleware/cookieSession.js | 132 + .../connect/lib-cov/middleware/csrf.js | 51 + .../connect/lib-cov/middleware/directory.js | 256 + .../lib-cov/middleware/errorHandler.js | 104 + .../connect/lib-cov/middleware/favicon.js | 60 + .../connect/lib-cov/middleware/json.js | 117 + .../connect/lib-cov/middleware/limit.js | 63 + .../connect/lib-cov/middleware/logger.js | 312 + .../lib-cov/middleware/methodOverride.js | 42 + .../connect/lib-cov/middleware/multipart.js | 183 + .../connect/lib-cov/middleware/query.js | 27 + .../lib-cov/middleware/responseTime.js | 39 + .../connect/lib-cov/middleware/session.js | 321 + .../lib-cov/middleware/session/cookie.js | 65 + .../lib-cov/middleware/session/memory.js | 128 + .../lib-cov/middleware/session/session.js | 108 + .../lib-cov/middleware/session/store.js | 90 + .../connect/lib-cov/middleware/static.js | 92 + .../connect/lib-cov/middleware/staticCache.js | 276 + .../connect/lib-cov/middleware/timeout.js | 66 + .../connect/lib-cov/middleware/urlencoded.js | 98 + .../connect/lib-cov/middleware/vhost.js | 59 + node_modules/connect/lib-cov/patch.js | 85 + node_modules/connect/lib-cov/proto.js | 285 + .../connect/lib-cov/public/directory.html | 75 + .../connect/lib-cov/public/error.html | 13 + .../connect/lib-cov/public/favicon.ico | Bin 0 -> 1406 bytes .../connect/lib-cov/public/icons/page.png | Bin 0 -> 635 bytes .../connect/lib-cov/public/icons/page_add.png | Bin 0 -> 739 bytes .../lib-cov/public/icons/page_attach.png | Bin 0 -> 794 bytes .../lib-cov/public/icons/page_code.png | Bin 0 -> 818 bytes .../lib-cov/public/icons/page_copy.png | Bin 0 -> 663 bytes .../lib-cov/public/icons/page_delete.png | Bin 0 -> 740 bytes .../lib-cov/public/icons/page_edit.png | Bin 0 -> 807 bytes .../lib-cov/public/icons/page_error.png | Bin 0 -> 793 bytes .../lib-cov/public/icons/page_excel.png | Bin 0 -> 817 bytes .../lib-cov/public/icons/page_find.png | Bin 0 -> 879 bytes .../lib-cov/public/icons/page_gear.png | Bin 0 -> 833 bytes .../connect/lib-cov/public/icons/page_go.png | Bin 0 -> 779 bytes .../lib-cov/public/icons/page_green.png | Bin 0 -> 621 bytes .../connect/lib-cov/public/icons/page_key.png | Bin 0 -> 801 bytes .../lib-cov/public/icons/page_lightning.png | Bin 0 -> 839 bytes .../lib-cov/public/icons/page_link.png | Bin 0 -> 830 bytes .../lib-cov/public/icons/page_paintbrush.png | Bin 0 -> 813 bytes .../lib-cov/public/icons/page_paste.png | Bin 0 -> 703 bytes .../connect/lib-cov/public/icons/page_red.png | Bin 0 -> 641 bytes .../lib-cov/public/icons/page_refresh.png | Bin 0 -> 858 bytes .../lib-cov/public/icons/page_save.png | Bin 0 -> 774 bytes .../lib-cov/public/icons/page_white.png | Bin 0 -> 294 bytes .../public/icons/page_white_acrobat.png | Bin 0 -> 591 bytes .../public/icons/page_white_actionscript.png | Bin 0 -> 664 bytes .../lib-cov/public/icons/page_white_add.png | Bin 0 -> 512 bytes .../lib-cov/public/icons/page_white_c.png | Bin 0 -> 587 bytes .../public/icons/page_white_camera.png | Bin 0 -> 656 bytes .../lib-cov/public/icons/page_white_cd.png | Bin 0 -> 666 bytes .../lib-cov/public/icons/page_white_code.png | Bin 0 -> 603 bytes .../public/icons/page_white_code_red.png | Bin 0 -> 587 bytes .../public/icons/page_white_coldfusion.png | Bin 0 -> 592 bytes .../public/icons/page_white_compressed.png | Bin 0 -> 724 bytes .../lib-cov/public/icons/page_white_copy.png | Bin 0 -> 309 bytes .../public/icons/page_white_cplusplus.png | Bin 0 -> 621 bytes .../public/icons/page_white_csharp.png | Bin 0 -> 700 bytes .../lib-cov/public/icons/page_white_cup.png | Bin 0 -> 639 bytes .../public/icons/page_white_database.png | Bin 0 -> 579 bytes .../public/icons/page_white_delete.png | Bin 0 -> 536 bytes .../lib-cov/public/icons/page_white_dvd.png | Bin 0 -> 638 bytes .../lib-cov/public/icons/page_white_edit.png | Bin 0 -> 618 bytes .../lib-cov/public/icons/page_white_error.png | Bin 0 -> 623 bytes .../lib-cov/public/icons/page_white_excel.png | Bin 0 -> 663 bytes .../lib-cov/public/icons/page_white_find.png | Bin 0 -> 676 bytes .../lib-cov/public/icons/page_white_flash.png | Bin 0 -> 582 bytes .../public/icons/page_white_freehand.png | Bin 0 -> 639 bytes .../lib-cov/public/icons/page_white_gear.png | Bin 0 -> 402 bytes .../lib-cov/public/icons/page_white_get.png | Bin 0 -> 516 bytes .../lib-cov/public/icons/page_white_go.png | Bin 0 -> 612 bytes .../lib-cov/public/icons/page_white_h.png | Bin 0 -> 603 bytes .../public/icons/page_white_horizontal.png | Bin 0 -> 296 bytes .../lib-cov/public/icons/page_white_key.png | Bin 0 -> 616 bytes .../public/icons/page_white_lightning.png | Bin 0 -> 669 bytes .../lib-cov/public/icons/page_white_link.png | Bin 0 -> 614 bytes .../public/icons/page_white_magnify.png | Bin 0 -> 554 bytes .../lib-cov/public/icons/page_white_medal.png | Bin 0 -> 706 bytes .../public/icons/page_white_office.png | Bin 0 -> 779 bytes .../lib-cov/public/icons/page_white_paint.png | Bin 0 -> 688 bytes .../public/icons/page_white_paintbrush.png | Bin 0 -> 618 bytes .../lib-cov/public/icons/page_white_paste.png | Bin 0 -> 620 bytes .../lib-cov/public/icons/page_white_php.png | Bin 0 -> 538 bytes .../public/icons/page_white_picture.png | Bin 0 -> 650 bytes .../public/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes .../lib-cov/public/icons/page_white_put.png | Bin 0 -> 523 bytes .../lib-cov/public/icons/page_white_ruby.png | Bin 0 -> 626 bytes .../lib-cov/public/icons/page_white_stack.png | Bin 0 -> 317 bytes .../lib-cov/public/icons/page_white_star.png | Bin 0 -> 565 bytes .../public/icons/page_white_swoosh.png | Bin 0 -> 634 bytes .../lib-cov/public/icons/page_white_text.png | Bin 0 -> 342 bytes .../public/icons/page_white_text_width.png | Bin 0 -> 315 bytes .../lib-cov/public/icons/page_white_tux.png | Bin 0 -> 668 bytes .../public/icons/page_white_vector.png | Bin 0 -> 644 bytes .../public/icons/page_white_visualstudio.png | Bin 0 -> 702 bytes .../lib-cov/public/icons/page_white_width.png | Bin 0 -> 309 bytes .../lib-cov/public/icons/page_white_word.png | Bin 0 -> 651 bytes .../lib-cov/public/icons/page_white_world.png | Bin 0 -> 734 bytes .../public/icons/page_white_wrench.png | Bin 0 -> 613 bytes .../lib-cov/public/icons/page_white_zip.png | Bin 0 -> 386 bytes .../lib-cov/public/icons/page_word.png | Bin 0 -> 777 bytes .../lib-cov/public/icons/page_world.png | Bin 0 -> 903 bytes node_modules/connect/lib-cov/public/style.css | 141 + node_modules/connect/lib-cov/utils.js | 282 + node_modules/connect/lib/cache.js | 81 + node_modules/connect/lib/connect.js | 93 + node_modules/connect/lib/index.js | 50 + .../connect/lib/middleware/basicAuth.js | 103 + .../connect/lib/middleware/bodyParser.js | 61 + .../connect/lib/middleware/compress.js | 147 + .../connect/lib/middleware/cookieParser.js | 62 + .../connect/lib/middleware/cookieSession.js | 115 + node_modules/connect/lib/middleware/csrf.js | 73 + .../connect/lib/middleware/directory.js | 228 + .../connect/lib/middleware/errorHandler.js | 86 + .../connect/lib/middleware/favicon.js | 81 + node_modules/connect/lib/middleware/json.js | 86 + node_modules/connect/lib/middleware/limit.js | 55 + node_modules/connect/lib/middleware/logger.js | 339 + .../connect/lib/middleware/methodOverride.js | 40 + .../connect/lib/middleware/multipart.js | 133 + node_modules/connect/lib/middleware/query.js | 46 + .../connect/lib/middleware/responseTime.js | 32 + .../connect/lib/middleware/session.js | 352 + .../connect/lib/middleware/session/cookie.js | 128 + .../connect/lib/middleware/session/memory.js | 129 + .../connect/lib/middleware/session/session.js | 116 + .../connect/lib/middleware/session/store.js | 84 + node_modules/connect/lib/middleware/static.js | 94 + .../connect/lib/middleware/staticCache.js | 231 + .../connect/lib/middleware/timeout.js | 56 + .../connect/lib/middleware/urlencoded.js | 78 + node_modules/connect/lib/middleware/vhost.js | 40 + node_modules/connect/lib/patch.js | 79 + node_modules/connect/lib/proto.js | 239 + .../connect/lib/public/directory.html | 81 + node_modules/connect/lib/public/error.html | 14 + node_modules/connect/lib/public/favicon.ico | Bin 0 -> 1406 bytes .../connect/lib/public/icons/page.png | Bin 0 -> 635 bytes .../connect/lib/public/icons/page_add.png | Bin 0 -> 739 bytes .../connect/lib/public/icons/page_attach.png | Bin 0 -> 794 bytes .../connect/lib/public/icons/page_code.png | Bin 0 -> 818 bytes .../connect/lib/public/icons/page_copy.png | Bin 0 -> 663 bytes .../connect/lib/public/icons/page_delete.png | Bin 0 -> 740 bytes .../connect/lib/public/icons/page_edit.png | Bin 0 -> 807 bytes .../connect/lib/public/icons/page_error.png | Bin 0 -> 793 bytes .../connect/lib/public/icons/page_excel.png | Bin 0 -> 817 bytes .../connect/lib/public/icons/page_find.png | Bin 0 -> 879 bytes .../connect/lib/public/icons/page_gear.png | Bin 0 -> 833 bytes .../connect/lib/public/icons/page_go.png | Bin 0 -> 779 bytes .../connect/lib/public/icons/page_green.png | Bin 0 -> 621 bytes .../connect/lib/public/icons/page_key.png | Bin 0 -> 801 bytes .../lib/public/icons/page_lightning.png | Bin 0 -> 839 bytes .../connect/lib/public/icons/page_link.png | Bin 0 -> 830 bytes .../lib/public/icons/page_paintbrush.png | Bin 0 -> 813 bytes .../connect/lib/public/icons/page_paste.png | Bin 0 -> 703 bytes .../connect/lib/public/icons/page_red.png | Bin 0 -> 641 bytes .../connect/lib/public/icons/page_refresh.png | Bin 0 -> 858 bytes .../connect/lib/public/icons/page_save.png | Bin 0 -> 774 bytes .../connect/lib/public/icons/page_white.png | Bin 0 -> 294 bytes .../lib/public/icons/page_white_acrobat.png | Bin 0 -> 591 bytes .../public/icons/page_white_actionscript.png | Bin 0 -> 664 bytes .../lib/public/icons/page_white_add.png | Bin 0 -> 512 bytes .../connect/lib/public/icons/page_white_c.png | Bin 0 -> 587 bytes .../lib/public/icons/page_white_camera.png | Bin 0 -> 656 bytes .../lib/public/icons/page_white_cd.png | Bin 0 -> 666 bytes .../lib/public/icons/page_white_code.png | Bin 0 -> 603 bytes .../lib/public/icons/page_white_code_red.png | Bin 0 -> 587 bytes .../public/icons/page_white_coldfusion.png | Bin 0 -> 592 bytes .../public/icons/page_white_compressed.png | Bin 0 -> 724 bytes .../lib/public/icons/page_white_copy.png | Bin 0 -> 309 bytes .../lib/public/icons/page_white_cplusplus.png | Bin 0 -> 621 bytes .../lib/public/icons/page_white_csharp.png | Bin 0 -> 700 bytes .../lib/public/icons/page_white_cup.png | Bin 0 -> 639 bytes .../lib/public/icons/page_white_database.png | Bin 0 -> 579 bytes .../lib/public/icons/page_white_delete.png | Bin 0 -> 536 bytes .../lib/public/icons/page_white_dvd.png | Bin 0 -> 638 bytes .../lib/public/icons/page_white_edit.png | Bin 0 -> 618 bytes .../lib/public/icons/page_white_error.png | Bin 0 -> 623 bytes .../lib/public/icons/page_white_excel.png | Bin 0 -> 663 bytes .../lib/public/icons/page_white_find.png | Bin 0 -> 676 bytes .../lib/public/icons/page_white_flash.png | Bin 0 -> 582 bytes .../lib/public/icons/page_white_freehand.png | Bin 0 -> 639 bytes .../lib/public/icons/page_white_gear.png | Bin 0 -> 402 bytes .../lib/public/icons/page_white_get.png | Bin 0 -> 516 bytes .../lib/public/icons/page_white_go.png | Bin 0 -> 612 bytes .../connect/lib/public/icons/page_white_h.png | Bin 0 -> 603 bytes .../public/icons/page_white_horizontal.png | Bin 0 -> 296 bytes .../lib/public/icons/page_white_key.png | Bin 0 -> 616 bytes .../lib/public/icons/page_white_lightning.png | Bin 0 -> 669 bytes .../lib/public/icons/page_white_link.png | Bin 0 -> 614 bytes .../lib/public/icons/page_white_magnify.png | Bin 0 -> 554 bytes .../lib/public/icons/page_white_medal.png | Bin 0 -> 706 bytes .../lib/public/icons/page_white_office.png | Bin 0 -> 779 bytes .../lib/public/icons/page_white_paint.png | Bin 0 -> 688 bytes .../public/icons/page_white_paintbrush.png | Bin 0 -> 618 bytes .../lib/public/icons/page_white_paste.png | Bin 0 -> 620 bytes .../lib/public/icons/page_white_php.png | Bin 0 -> 538 bytes .../lib/public/icons/page_white_picture.png | Bin 0 -> 650 bytes .../public/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes .../lib/public/icons/page_white_put.png | Bin 0 -> 523 bytes .../lib/public/icons/page_white_ruby.png | Bin 0 -> 626 bytes .../lib/public/icons/page_white_stack.png | Bin 0 -> 317 bytes .../lib/public/icons/page_white_star.png | Bin 0 -> 565 bytes .../lib/public/icons/page_white_swoosh.png | Bin 0 -> 634 bytes .../lib/public/icons/page_white_text.png | Bin 0 -> 342 bytes .../public/icons/page_white_text_width.png | Bin 0 -> 315 bytes .../lib/public/icons/page_white_tux.png | Bin 0 -> 668 bytes .../lib/public/icons/page_white_vector.png | Bin 0 -> 644 bytes .../public/icons/page_white_visualstudio.png | Bin 0 -> 702 bytes .../lib/public/icons/page_white_width.png | Bin 0 -> 309 bytes .../lib/public/icons/page_white_word.png | Bin 0 -> 651 bytes .../lib/public/icons/page_white_world.png | Bin 0 -> 734 bytes .../lib/public/icons/page_white_wrench.png | Bin 0 -> 613 bytes .../lib/public/icons/page_white_zip.png | Bin 0 -> 386 bytes .../connect/lib/public/icons/page_word.png | Bin 0 -> 777 bytes .../connect/lib/public/icons/page_world.png | Bin 0 -> 903 bytes node_modules/connect/lib/public/style.css | 141 + node_modules/connect/lib/utils.js | 370 + .../node_modules/buffer-crc32/.npmignore | 1 + .../node_modules/buffer-crc32/.travis.yml | 8 + .../node_modules/buffer-crc32/README.md | 33 + .../node_modules/buffer-crc32/index.js | 84 + .../node_modules/buffer-crc32/package.json | 23 + .../buffer-crc32/tests/crc.test.js | 52 + .../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 | 17 + .../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 | 13 + .../connect/node_modules/cookie/.npmignore | 1 + .../connect/node_modules/cookie/.travis.yml | 4 + .../connect/node_modules/cookie/README.md | 44 + .../connect/node_modules/cookie/index.js | 61 + .../connect/node_modules/cookie/package.json | 26 + .../node_modules/cookie/test/mocha.opts | 1 + .../connect/node_modules/cookie/test/parse.js | 28 + .../node_modules/cookie/test/serialize.js | 59 + .../connect/node_modules/debug/.npmignore | 4 + .../connect/node_modules/debug/History.md | 62 + .../connect/node_modules/debug/Readme.md | 115 + .../connect/node_modules/debug/component.json | 9 + .../connect/node_modules/debug/debug.js | 124 + .../connect/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 + .../connect/node_modules/debug/index.js | 5 + .../connect/node_modules/debug/lib/debug.js | 134 + .../connect/node_modules/debug/package.json | 19 + .../node_modules/formidable/.npmignore | 4 + .../node_modules/formidable/.travis.yml | 4 + .../connect/node_modules/formidable/Makefile | 14 + .../connect/node_modules/formidable/Readme.md | 311 + .../connect/node_modules/formidable/TODO | 3 + .../benchmark/bench-multipart-parser.js | 70 + .../node_modules/formidable/example/post.js | 43 + .../node_modules/formidable/example/upload.js | 48 + .../connect/node_modules/formidable/index.js | 1 + .../node_modules/formidable/lib/file.js | 73 + .../formidable/lib/incoming_form.js | 384 + .../node_modules/formidable/lib/index.js | 3 + .../formidable/lib/multipart_parser.js | 312 + .../formidable/lib/querystring_parser.js | 25 + .../node_modules/formidable/lib/util.js | 6 + .../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 | 23 + .../node_modules/formidable/test/common.js | 19 + .../test/fixture/file/funkyfilename.txt | 1 + .../formidable/test/fixture/file/plain.txt | 1 + .../http/special-chars-in-filename/info.md | 3 + .../formidable/test/fixture/js/no-filename.js | 3 + .../fixture/js/special-chars-in-filename.js | 21 + .../formidable/test/fixture/multipart.js | 72 + .../test/integration/test-fixtures.js | 89 + .../formidable/test/legacy/common.js | 24 + .../integration/test-multipart-parser.js | 80 + .../test/legacy/simple/test-file.js | 104 + .../test/legacy/simple/test-incoming-form.js | 727 ++ .../legacy/simple/test-multipart-parser.js | 50 + .../legacy/simple/test-querystring-parser.js | 45 + .../legacy/system/test-multi-video-upload.js | 75 + .../node_modules/formidable/test/run.js | 2 + .../test/unit/test-incoming-form.js | 63 + .../node_modules/formidable/tool/record.js | 47 + .../connect/node_modules/fresh/.npmignore | 1 + .../connect/node_modules/fresh/Makefile | 7 + .../connect/node_modules/fresh/Readme.md | 32 + .../connect/node_modules/fresh/index.js | 49 + .../connect/node_modules/fresh/package.json | 12 + .../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 | 13 + .../connect/node_modules/qs/.gitmodules | 6 + .../connect/node_modules/qs/.npmignore | 1 + .../connect/node_modules/qs/.travis.yml | 4 + .../connect/node_modules/qs/History.md | 83 + node_modules/connect/node_modules/qs/Makefile | 12 + .../connect/node_modules/qs/Readme.md | 58 + .../connect/node_modules/qs/benchmark.js | 17 + .../connect/node_modules/qs/component.json | 6 + .../connect/node_modules/qs/examples.js | 51 + node_modules/connect/node_modules/qs/index.js | 2 + .../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 | 22 + .../connect/node_modules/qs/querystring.js | 254 + .../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 ++++++++ .../node_modules/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 + .../connect/node_modules/send/.npmignore | 4 + .../connect/node_modules/send/History.md | 25 + .../connect/node_modules/send/Makefile | 8 + .../connect/node_modules/send/Readme.md | 123 + .../connect/node_modules/send/index.js | 2 + .../connect/node_modules/send/lib/send.js | 473 + .../connect/node_modules/send/lib/utils.js | 47 + .../send/node_modules/mime/LICENSE | 19 + .../send/node_modules/mime/README.md | 63 + .../send/node_modules/mime/mime.js | 104 + .../send/node_modules/mime/package.json | 22 + .../send/node_modules/mime/test.js | 55 + .../send/node_modules/mime/types/mime.types | 1510 +++ .../send/node_modules/mime/types/node.types | 65 + .../send/node_modules/range-parser/.npmignore | 1 + .../send/node_modules/range-parser/History.md | 15 + .../send/node_modules/range-parser/Makefile | 7 + .../send/node_modules/range-parser/Readme.md | 28 + .../send/node_modules/range-parser/index.js | 49 + .../node_modules/range-parser/package.json | 12 + .../connect/node_modules/send/package.json | 23 + node_modules/connect/package.json | 34 + node_modules/connect/test.js | 7 + node_modules/express/.npmignore | 9 + node_modules/express/.travis.yml | 4 + node_modules/express/History.md | 1091 ++ node_modules/express/LICENSE | 22 + node_modules/express/Makefile | 33 + node_modules/express/Readme.md | 179 + node_modules/express/bin/express | 422 + node_modules/express/client.js | 25 + node_modules/express/index.js | 4 + node_modules/express/lib/application.js | 534 + node_modules/express/lib/express.js | 92 + node_modules/express/lib/middleware.js | 33 + node_modules/express/lib/request.js | 493 + node_modules/express/lib/response.js | 754 ++ node_modules/express/lib/router/index.js | 273 + node_modules/express/lib/router/route.js | 72 + node_modules/express/lib/utils.js | 282 + node_modules/express/lib/view.js | 76 + .../node_modules/buffer-crc32/.npmignore | 1 + .../node_modules/buffer-crc32/.travis.yml | 8 + .../node_modules/buffer-crc32/README.md | 33 + .../node_modules/buffer-crc32/index.js | 84 + .../node_modules/buffer-crc32/package.json | 23 + .../buffer-crc32/tests/crc.test.js | 52 + .../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 | 13 + .../express/node_modules/connect/.npmignore | 12 + .../express/node_modules/connect/.travis.yml | 5 + .../express/node_modules/connect/LICENSE | 24 + .../express/node_modules/connect/index.js | 4 + .../node_modules/connect/lib-cov/cache.js | 68 + .../node_modules/connect/lib-cov/connect.js | 93 + .../node_modules/connect/lib-cov/index.js | 6 + .../connect/lib-cov/middleware/basicAuth.js | 128 + .../connect/lib-cov/middleware/bodyParser.js | 43 + .../connect/lib-cov/middleware/compress.js | 159 + .../lib-cov/middleware/cookieParser.js | 70 + .../lib-cov/middleware/cookieSession.js | 132 + .../connect/lib-cov/middleware/csrf.js | 51 + .../connect/lib-cov/middleware/directory.js | 256 + .../lib-cov/middleware/errorHandler.js | 104 + .../connect/lib-cov/middleware/favicon.js | 60 + .../connect/lib-cov/middleware/json.js | 117 + .../connect/lib-cov/middleware/limit.js | 63 + .../connect/lib-cov/middleware/logger.js | 312 + .../lib-cov/middleware/methodOverride.js | 42 + .../connect/lib-cov/middleware/multipart.js | 183 + .../connect/lib-cov/middleware/query.js | 27 + .../lib-cov/middleware/responseTime.js | 39 + .../connect/lib-cov/middleware/session.js | 321 + .../lib-cov/middleware/session/cookie.js | 65 + .../lib-cov/middleware/session/memory.js | 128 + .../lib-cov/middleware/session/session.js | 108 + .../lib-cov/middleware/session/store.js | 90 + .../connect/lib-cov/middleware/static.js | 92 + .../connect/lib-cov/middleware/staticCache.js | 276 + .../connect/lib-cov/middleware/timeout.js | 66 + .../connect/lib-cov/middleware/urlencoded.js | 98 + .../connect/lib-cov/middleware/vhost.js | 59 + .../node_modules/connect/lib-cov/patch.js | 85 + .../node_modules/connect/lib-cov/proto.js | 285 + .../connect/lib-cov/public/directory.html | 75 + .../connect/lib-cov/public/error.html | 13 + .../connect/lib-cov/public/favicon.ico | Bin 0 -> 1406 bytes .../connect/lib-cov/public/icons/page.png | Bin 0 -> 635 bytes .../connect/lib-cov/public/icons/page_add.png | Bin 0 -> 739 bytes .../lib-cov/public/icons/page_attach.png | Bin 0 -> 794 bytes .../lib-cov/public/icons/page_code.png | Bin 0 -> 818 bytes .../lib-cov/public/icons/page_copy.png | Bin 0 -> 663 bytes .../lib-cov/public/icons/page_delete.png | Bin 0 -> 740 bytes .../lib-cov/public/icons/page_edit.png | Bin 0 -> 807 bytes .../lib-cov/public/icons/page_error.png | Bin 0 -> 793 bytes .../lib-cov/public/icons/page_excel.png | Bin 0 -> 817 bytes .../lib-cov/public/icons/page_find.png | Bin 0 -> 879 bytes .../lib-cov/public/icons/page_gear.png | Bin 0 -> 833 bytes .../connect/lib-cov/public/icons/page_go.png | Bin 0 -> 779 bytes .../lib-cov/public/icons/page_green.png | Bin 0 -> 621 bytes .../connect/lib-cov/public/icons/page_key.png | Bin 0 -> 801 bytes .../lib-cov/public/icons/page_lightning.png | Bin 0 -> 839 bytes .../lib-cov/public/icons/page_link.png | Bin 0 -> 830 bytes .../lib-cov/public/icons/page_paintbrush.png | Bin 0 -> 813 bytes .../lib-cov/public/icons/page_paste.png | Bin 0 -> 703 bytes .../connect/lib-cov/public/icons/page_red.png | Bin 0 -> 641 bytes .../lib-cov/public/icons/page_refresh.png | Bin 0 -> 858 bytes .../lib-cov/public/icons/page_save.png | Bin 0 -> 774 bytes .../lib-cov/public/icons/page_white.png | Bin 0 -> 294 bytes .../public/icons/page_white_acrobat.png | Bin 0 -> 591 bytes .../public/icons/page_white_actionscript.png | Bin 0 -> 664 bytes .../lib-cov/public/icons/page_white_add.png | Bin 0 -> 512 bytes .../lib-cov/public/icons/page_white_c.png | Bin 0 -> 587 bytes .../public/icons/page_white_camera.png | Bin 0 -> 656 bytes .../lib-cov/public/icons/page_white_cd.png | Bin 0 -> 666 bytes .../lib-cov/public/icons/page_white_code.png | Bin 0 -> 603 bytes .../public/icons/page_white_code_red.png | Bin 0 -> 587 bytes .../public/icons/page_white_coldfusion.png | Bin 0 -> 592 bytes .../public/icons/page_white_compressed.png | Bin 0 -> 724 bytes .../lib-cov/public/icons/page_white_copy.png | Bin 0 -> 309 bytes .../public/icons/page_white_cplusplus.png | Bin 0 -> 621 bytes .../public/icons/page_white_csharp.png | Bin 0 -> 700 bytes .../lib-cov/public/icons/page_white_cup.png | Bin 0 -> 639 bytes .../public/icons/page_white_database.png | Bin 0 -> 579 bytes .../public/icons/page_white_delete.png | Bin 0 -> 536 bytes .../lib-cov/public/icons/page_white_dvd.png | Bin 0 -> 638 bytes .../lib-cov/public/icons/page_white_edit.png | Bin 0 -> 618 bytes .../lib-cov/public/icons/page_white_error.png | Bin 0 -> 623 bytes .../lib-cov/public/icons/page_white_excel.png | Bin 0 -> 663 bytes .../lib-cov/public/icons/page_white_find.png | Bin 0 -> 676 bytes .../lib-cov/public/icons/page_white_flash.png | Bin 0 -> 582 bytes .../public/icons/page_white_freehand.png | Bin 0 -> 639 bytes .../lib-cov/public/icons/page_white_gear.png | Bin 0 -> 402 bytes .../lib-cov/public/icons/page_white_get.png | Bin 0 -> 516 bytes .../lib-cov/public/icons/page_white_go.png | Bin 0 -> 612 bytes .../lib-cov/public/icons/page_white_h.png | Bin 0 -> 603 bytes .../public/icons/page_white_horizontal.png | Bin 0 -> 296 bytes .../lib-cov/public/icons/page_white_key.png | Bin 0 -> 616 bytes .../public/icons/page_white_lightning.png | Bin 0 -> 669 bytes .../lib-cov/public/icons/page_white_link.png | Bin 0 -> 614 bytes .../public/icons/page_white_magnify.png | Bin 0 -> 554 bytes .../lib-cov/public/icons/page_white_medal.png | Bin 0 -> 706 bytes .../public/icons/page_white_office.png | Bin 0 -> 779 bytes .../lib-cov/public/icons/page_white_paint.png | Bin 0 -> 688 bytes .../public/icons/page_white_paintbrush.png | Bin 0 -> 618 bytes .../lib-cov/public/icons/page_white_paste.png | Bin 0 -> 620 bytes .../lib-cov/public/icons/page_white_php.png | Bin 0 -> 538 bytes .../public/icons/page_white_picture.png | Bin 0 -> 650 bytes .../public/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes .../lib-cov/public/icons/page_white_put.png | Bin 0 -> 523 bytes .../lib-cov/public/icons/page_white_ruby.png | Bin 0 -> 626 bytes .../lib-cov/public/icons/page_white_stack.png | Bin 0 -> 317 bytes .../lib-cov/public/icons/page_white_star.png | Bin 0 -> 565 bytes .../public/icons/page_white_swoosh.png | Bin 0 -> 634 bytes .../lib-cov/public/icons/page_white_text.png | Bin 0 -> 342 bytes .../public/icons/page_white_text_width.png | Bin 0 -> 315 bytes .../lib-cov/public/icons/page_white_tux.png | Bin 0 -> 668 bytes .../public/icons/page_white_vector.png | Bin 0 -> 644 bytes .../public/icons/page_white_visualstudio.png | Bin 0 -> 702 bytes .../lib-cov/public/icons/page_white_width.png | Bin 0 -> 309 bytes .../lib-cov/public/icons/page_white_word.png | Bin 0 -> 651 bytes .../lib-cov/public/icons/page_white_world.png | Bin 0 -> 734 bytes .../public/icons/page_white_wrench.png | Bin 0 -> 613 bytes .../lib-cov/public/icons/page_white_zip.png | Bin 0 -> 386 bytes .../lib-cov/public/icons/page_word.png | Bin 0 -> 777 bytes .../lib-cov/public/icons/page_world.png | Bin 0 -> 903 bytes .../connect/lib-cov/public/style.css | 141 + .../node_modules/connect/lib-cov/utils.js | 282 + .../express/node_modules/connect/lib/cache.js | 81 + .../node_modules/connect/lib/connect.js | 93 + .../express/node_modules/connect/lib/index.js | 50 + .../connect/lib/middleware/basicAuth.js | 103 + .../connect/lib/middleware/bodyParser.js | 61 + .../connect/lib/middleware/compress.js | 147 + .../connect/lib/middleware/cookieParser.js | 62 + .../connect/lib/middleware/cookieSession.js | 115 + .../connect/lib/middleware/csrf.js | 73 + .../connect/lib/middleware/directory.js | 228 + .../connect/lib/middleware/errorHandler.js | 86 + .../connect/lib/middleware/favicon.js | 81 + .../connect/lib/middleware/json.js | 86 + .../connect/lib/middleware/limit.js | 55 + .../connect/lib/middleware/logger.js | 339 + .../connect/lib/middleware/methodOverride.js | 40 + .../connect/lib/middleware/multipart.js | 133 + .../connect/lib/middleware/query.js | 46 + .../connect/lib/middleware/responseTime.js | 32 + .../connect/lib/middleware/session.js | 352 + .../connect/lib/middleware/session/cookie.js | 128 + .../connect/lib/middleware/session/memory.js | 129 + .../connect/lib/middleware/session/session.js | 116 + .../connect/lib/middleware/session/store.js | 84 + .../connect/lib/middleware/static.js | 94 + .../connect/lib/middleware/staticCache.js | 231 + .../connect/lib/middleware/timeout.js | 56 + .../connect/lib/middleware/urlencoded.js | 78 + .../connect/lib/middleware/vhost.js | 40 + .../express/node_modules/connect/lib/patch.js | 79 + .../express/node_modules/connect/lib/proto.js | 239 + .../connect/lib/public/directory.html | 81 + .../connect/lib/public/error.html | 14 + .../connect/lib/public/favicon.ico | Bin 0 -> 1406 bytes .../connect/lib/public/icons/page.png | Bin 0 -> 635 bytes .../connect/lib/public/icons/page_add.png | Bin 0 -> 739 bytes .../connect/lib/public/icons/page_attach.png | Bin 0 -> 794 bytes .../connect/lib/public/icons/page_code.png | Bin 0 -> 818 bytes .../connect/lib/public/icons/page_copy.png | Bin 0 -> 663 bytes .../connect/lib/public/icons/page_delete.png | Bin 0 -> 740 bytes .../connect/lib/public/icons/page_edit.png | Bin 0 -> 807 bytes .../connect/lib/public/icons/page_error.png | Bin 0 -> 793 bytes .../connect/lib/public/icons/page_excel.png | Bin 0 -> 817 bytes .../connect/lib/public/icons/page_find.png | Bin 0 -> 879 bytes .../connect/lib/public/icons/page_gear.png | Bin 0 -> 833 bytes .../connect/lib/public/icons/page_go.png | Bin 0 -> 779 bytes .../connect/lib/public/icons/page_green.png | Bin 0 -> 621 bytes .../connect/lib/public/icons/page_key.png | Bin 0 -> 801 bytes .../lib/public/icons/page_lightning.png | Bin 0 -> 839 bytes .../connect/lib/public/icons/page_link.png | Bin 0 -> 830 bytes .../lib/public/icons/page_paintbrush.png | Bin 0 -> 813 bytes .../connect/lib/public/icons/page_paste.png | Bin 0 -> 703 bytes .../connect/lib/public/icons/page_red.png | Bin 0 -> 641 bytes .../connect/lib/public/icons/page_refresh.png | Bin 0 -> 858 bytes .../connect/lib/public/icons/page_save.png | Bin 0 -> 774 bytes .../connect/lib/public/icons/page_white.png | Bin 0 -> 294 bytes .../lib/public/icons/page_white_acrobat.png | Bin 0 -> 591 bytes .../public/icons/page_white_actionscript.png | Bin 0 -> 664 bytes .../lib/public/icons/page_white_add.png | Bin 0 -> 512 bytes .../connect/lib/public/icons/page_white_c.png | Bin 0 -> 587 bytes .../lib/public/icons/page_white_camera.png | Bin 0 -> 656 bytes .../lib/public/icons/page_white_cd.png | Bin 0 -> 666 bytes .../lib/public/icons/page_white_code.png | Bin 0 -> 603 bytes .../lib/public/icons/page_white_code_red.png | Bin 0 -> 587 bytes .../public/icons/page_white_coldfusion.png | Bin 0 -> 592 bytes .../public/icons/page_white_compressed.png | Bin 0 -> 724 bytes .../lib/public/icons/page_white_copy.png | Bin 0 -> 309 bytes .../lib/public/icons/page_white_cplusplus.png | Bin 0 -> 621 bytes .../lib/public/icons/page_white_csharp.png | Bin 0 -> 700 bytes .../lib/public/icons/page_white_cup.png | Bin 0 -> 639 bytes .../lib/public/icons/page_white_database.png | Bin 0 -> 579 bytes .../lib/public/icons/page_white_delete.png | Bin 0 -> 536 bytes .../lib/public/icons/page_white_dvd.png | Bin 0 -> 638 bytes .../lib/public/icons/page_white_edit.png | Bin 0 -> 618 bytes .../lib/public/icons/page_white_error.png | Bin 0 -> 623 bytes .../lib/public/icons/page_white_excel.png | Bin 0 -> 663 bytes .../lib/public/icons/page_white_find.png | Bin 0 -> 676 bytes .../lib/public/icons/page_white_flash.png | Bin 0 -> 582 bytes .../lib/public/icons/page_white_freehand.png | Bin 0 -> 639 bytes .../lib/public/icons/page_white_gear.png | Bin 0 -> 402 bytes .../lib/public/icons/page_white_get.png | Bin 0 -> 516 bytes .../lib/public/icons/page_white_go.png | Bin 0 -> 612 bytes .../connect/lib/public/icons/page_white_h.png | Bin 0 -> 603 bytes .../public/icons/page_white_horizontal.png | Bin 0 -> 296 bytes .../lib/public/icons/page_white_key.png | Bin 0 -> 616 bytes .../lib/public/icons/page_white_lightning.png | Bin 0 -> 669 bytes .../lib/public/icons/page_white_link.png | Bin 0 -> 614 bytes .../lib/public/icons/page_white_magnify.png | Bin 0 -> 554 bytes .../lib/public/icons/page_white_medal.png | Bin 0 -> 706 bytes .../lib/public/icons/page_white_office.png | Bin 0 -> 779 bytes .../lib/public/icons/page_white_paint.png | Bin 0 -> 688 bytes .../public/icons/page_white_paintbrush.png | Bin 0 -> 618 bytes .../lib/public/icons/page_white_paste.png | Bin 0 -> 620 bytes .../lib/public/icons/page_white_php.png | Bin 0 -> 538 bytes .../lib/public/icons/page_white_picture.png | Bin 0 -> 650 bytes .../public/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes .../lib/public/icons/page_white_put.png | Bin 0 -> 523 bytes .../lib/public/icons/page_white_ruby.png | Bin 0 -> 626 bytes .../lib/public/icons/page_white_stack.png | Bin 0 -> 317 bytes .../lib/public/icons/page_white_star.png | Bin 0 -> 565 bytes .../lib/public/icons/page_white_swoosh.png | Bin 0 -> 634 bytes .../lib/public/icons/page_white_text.png | Bin 0 -> 342 bytes .../public/icons/page_white_text_width.png | Bin 0 -> 315 bytes .../lib/public/icons/page_white_tux.png | Bin 0 -> 668 bytes .../lib/public/icons/page_white_vector.png | Bin 0 -> 644 bytes .../public/icons/page_white_visualstudio.png | Bin 0 -> 702 bytes .../lib/public/icons/page_white_width.png | Bin 0 -> 309 bytes .../lib/public/icons/page_white_word.png | Bin 0 -> 651 bytes .../lib/public/icons/page_white_world.png | Bin 0 -> 734 bytes .../lib/public/icons/page_white_wrench.png | Bin 0 -> 613 bytes .../lib/public/icons/page_white_zip.png | Bin 0 -> 386 bytes .../connect/lib/public/icons/page_word.png | Bin 0 -> 777 bytes .../connect/lib/public/icons/page_world.png | Bin 0 -> 903 bytes .../node_modules/connect/lib/public/style.css | 141 + .../express/node_modules/connect/lib/utils.js | 370 + .../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 | 17 + .../node_modules/formidable/.npmignore | 4 + .../node_modules/formidable/.travis.yml | 4 + .../connect/node_modules/formidable/Makefile | 14 + .../connect/node_modules/formidable/Readme.md | 311 + .../connect/node_modules/formidable/TODO | 3 + .../benchmark/bench-multipart-parser.js | 70 + .../node_modules/formidable/example/post.js | 43 + .../node_modules/formidable/example/upload.js | 48 + .../connect/node_modules/formidable/index.js | 1 + .../node_modules/formidable/lib/file.js | 73 + .../formidable/lib/incoming_form.js | 384 + .../node_modules/formidable/lib/index.js | 3 + .../formidable/lib/multipart_parser.js | 312 + .../formidable/lib/querystring_parser.js | 25 + .../node_modules/formidable/lib/util.js | 6 + .../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 | 23 + .../node_modules/formidable/test/common.js | 19 + .../test/fixture/file/funkyfilename.txt | 1 + .../formidable/test/fixture/file/plain.txt | 1 + .../http/special-chars-in-filename/info.md | 3 + .../formidable/test/fixture/js/no-filename.js | 3 + .../fixture/js/special-chars-in-filename.js | 21 + .../formidable/test/fixture/multipart.js | 72 + .../test/integration/test-fixtures.js | 89 + .../formidable/test/legacy/common.js | 24 + .../integration/test-multipart-parser.js | 80 + .../test/legacy/simple/test-file.js | 104 + .../test/legacy/simple/test-incoming-form.js | 727 ++ .../legacy/simple/test-multipart-parser.js | 50 + .../legacy/simple/test-querystring-parser.js | 45 + .../legacy/system/test-multi-video-upload.js | 75 + .../node_modules/formidable/test/run.js | 2 + .../test/unit/test-incoming-form.js | 63 + .../node_modules/formidable/tool/record.js | 47 + .../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 | 13 + .../connect/node_modules/qs/.gitmodules | 6 + .../connect/node_modules/qs/.npmignore | 1 + .../connect/node_modules/qs/.travis.yml | 4 + .../connect/node_modules/qs/History.md | 83 + .../connect/node_modules/qs/Makefile | 12 + .../connect/node_modules/qs/Readme.md | 58 + .../connect/node_modules/qs/benchmark.js | 17 + .../connect/node_modules/qs/component.json | 6 + .../connect/node_modules/qs/examples.js | 51 + .../connect/node_modules/qs/index.js | 2 + .../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 | 22 + .../connect/node_modules/qs/querystring.js | 254 + .../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 ++++++++ .../node_modules/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 | 34 + .../express/node_modules/connect/test.js | 7 + .../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 | 13 + .../express/node_modules/cookie/.npmignore | 1 + .../express/node_modules/cookie/.travis.yml | 4 + .../express/node_modules/cookie/README.md | 44 + .../express/node_modules/cookie/index.js | 61 + .../express/node_modules/cookie/package.json | 26 + .../node_modules/cookie/test/mocha.opts | 1 + .../express/node_modules/cookie/test/parse.js | 28 + .../node_modules/cookie/test/serialize.js | 59 + .../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 | 19 + .../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 | 12 + .../express/node_modules/methods/index.js | 26 + .../express/node_modules/methods/package.json | 15 + .../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 | 23 + .../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/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 | 12 + .../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 | 19 + .../send/node_modules/mime/README.md | 63 + .../send/node_modules/mime/mime.js | 104 + .../send/node_modules/mime/package.json | 22 + .../send/node_modules/mime/test.js | 55 + .../send/node_modules/mime/types/mime.types | 1510 +++ .../send/node_modules/mime/types/node.types | 65 + .../express/node_modules/send/package.json | 23 + node_modules/express/package.json | 56 + node_modules/express/test.js | 14 + node_modules/jade/.npmignore | 14 + node_modules/jade/LICENSE | 22 + node_modules/jade/Readme.md | 1298 +++ node_modules/jade/Readme_zh-cn.md | 921 ++ node_modules/jade/bin/jade | 168 + node_modules/jade/index.js | 4 + node_modules/jade/jade.js | 3654 +++++++ node_modules/jade/jade.md | 510 + node_modules/jade/jade.min.js | 2 + node_modules/jade/lib/compiler.js | 655 ++ node_modules/jade/lib/doctypes.js | 18 + node_modules/jade/lib/filters.js | 105 + node_modules/jade/lib/inline-tags.js | 28 + node_modules/jade/lib/jade.js | 253 + node_modules/jade/lib/lexer.js | 775 ++ node_modules/jade/lib/nodes/attrs.js | 77 + node_modules/jade/lib/nodes/block-comment.js | 33 + node_modules/jade/lib/nodes/block.js | 122 + node_modules/jade/lib/nodes/case.js | 43 + node_modules/jade/lib/nodes/code.js | 35 + node_modules/jade/lib/nodes/comment.js | 32 + node_modules/jade/lib/nodes/doctype.js | 29 + node_modules/jade/lib/nodes/each.js | 35 + node_modules/jade/lib/nodes/filter.js | 34 + node_modules/jade/lib/nodes/index.js | 20 + node_modules/jade/lib/nodes/literal.js | 32 + node_modules/jade/lib/nodes/mixin.js | 36 + node_modules/jade/lib/nodes/node.js | 25 + node_modules/jade/lib/nodes/tag.js | 95 + node_modules/jade/lib/nodes/text.js | 36 + node_modules/jade/lib/parser.js | 699 ++ node_modules/jade/lib/runtime.js | 174 + node_modules/jade/lib/self-closing.js | 19 + node_modules/jade/lib/utils.js | 68 + node_modules/jade/node_modules/.bin/cake | 1 + node_modules/jade/node_modules/.bin/coffee | 1 + .../node_modules/coffee-script/.npmignore | 11 + .../jade/node_modules/coffee-script/CNAME | 1 + .../coffee-script/CONTRIBUTING.md | 9 + .../jade/node_modules/coffee-script/LICENSE | 22 + .../jade/node_modules/coffee-script/README | 51 + .../jade/node_modules/coffee-script/Rakefile | 78 + .../jade/node_modules/coffee-script/bin/cake | 7 + .../node_modules/coffee-script/bin/coffee | 7 + .../coffee-script/extras/jsl.conf | 44 + .../lib/coffee-script/browser.js | 92 + .../coffee-script/lib/coffee-script/cake.js | 113 + .../lib/coffee-script/coffee-script.js | 171 + .../lib/coffee-script/command.js | 502 + .../lib/coffee-script/grammar.js | 606 ++ .../lib/coffee-script/helpers.js | 88 + .../coffee-script/lib/coffee-script/index.js | 11 + .../coffee-script/lib/coffee-script/lexer.js | 788 ++ .../coffee-script/lib/coffee-script/nodes.js | 2971 ++++++ .../lib/coffee-script/optparse.js | 138 + .../coffee-script/lib/coffee-script/parser.js | 683 ++ .../coffee-script/lib/coffee-script/repl.js | 276 + .../lib/coffee-script/rewriter.js | 349 + .../coffee-script/lib/coffee-script/scope.js | 146 + .../node_modules/coffee-script/package.json | 35 + .../jade/node_modules/commander/.npmignore | 4 + .../jade/node_modules/commander/.travis.yml | 4 + .../jade/node_modules/commander/History.md | 107 + .../jade/node_modules/commander/Makefile | 7 + .../jade/node_modules/commander/Readme.md | 262 + .../jade/node_modules/commander/index.js | 2 + .../node_modules/commander/lib/commander.js | 1026 ++ .../jade/node_modules/commander/package.json | 13 + .../jade/node_modules/mkdirp/.npmignore | 2 + .../jade/node_modules/mkdirp/.travis.yml | 4 + node_modules/jade/node_modules/mkdirp/LICENSE | 21 + .../jade/node_modules/mkdirp/README.markdown | 61 + .../jade/node_modules/mkdirp/examples/pow.js | 6 + .../jade/node_modules/mkdirp/index.js | 82 + .../jade/node_modules/mkdirp/package.json | 23 + .../jade/node_modules/mkdirp/test/chmod.js | 38 + .../jade/node_modules/mkdirp/test/clobber.js | 37 + .../jade/node_modules/mkdirp/test/mkdirp.js | 28 + .../jade/node_modules/mkdirp/test/perm.js | 32 + .../node_modules/mkdirp/test/perm_sync.js | 39 + .../jade/node_modules/mkdirp/test/race.js | 41 + .../jade/node_modules/mkdirp/test/rel.js | 32 + .../jade/node_modules/mkdirp/test/return.js | 25 + .../node_modules/mkdirp/test/return_sync.js | 24 + .../jade/node_modules/mkdirp/test/root.js | 18 + .../jade/node_modules/mkdirp/test/sync.js | 32 + .../jade/node_modules/mkdirp/test/umask.js | 28 + .../node_modules/mkdirp/test/umask_sync.js | 32 + node_modules/jade/package.json | 34 + node_modules/jade/runtime.js | 179 + node_modules/jade/runtime.min.js | 1 + node_modules/jade/testing/index.html | 5 + node_modules/jade/testing/index.jade | 4 + node_modules/jade/testing/layout.html | 1 + node_modules/jade/testing/layout.jade | 6 + node_modules/jade/testing/mobile.html | 0 node_modules/jade/testing/mobile.jade | 0 .../jade/testing/nested/something.html | 1 + .../jade/testing/nested/something.jade | 1 + node_modules/jade/testing/some.js | 4 + node_modules/jade/testing/test.md | 5 + node_modules/passport-github/.npmignore | 8 + node_modules/passport-github/.travis.yml | 4 + node_modules/passport-github/LICENSE | 20 + .../passport-github/examples/login/app.js | 122 + .../examples/login/package.json | 10 + .../examples/login/views/account.ejs | 4 + .../examples/login/views/index.ejs | 5 + .../examples/login/views/layout.ejs | 21 + .../examples/login/views/login.ejs | 1 + .../lib/passport-github/index.js | 15 + .../lib/passport-github/strategy.js | 106 + .../node_modules/passport-oauth/.travis.yml | 5 + .../node_modules/passport-oauth/LICENSE | 20 + .../node_modules/passport-oauth/README.md | 89 + .../errors/internaloautherror.js | 46 + .../lib/passport-oauth/index.js | 20 + .../lib/passport-oauth/strategies/oauth.js | 299 + .../lib/passport-oauth/strategies/oauth2.js | 246 + .../lib/passport-oauth/strategies/utils.js | 46 + .../node_modules/oauth/.gitignore | 1 + .../passport-oauth/node_modules/oauth/LICENSE | 8 + .../node_modules/oauth/Makefile | 7 + .../node_modules/oauth/Readme.md | 91 + .../oauth/examples/express-gdata/server.js | 168 + .../express-gdata/views/google_calendars.ejs | 21 + .../express-gdata/views/google_contacts.ejs | 24 + .../examples/express-gdata/views/layout.ejs | 9 + .../oauth/examples/term.ie.oauth-HMAC-SHA1.js | 31 + .../node_modules/oauth/index.js | 3 + .../node_modules/oauth/lib/_utils.js | 4 + .../node_modules/oauth/lib/oauth.js | 550 + .../node_modules/oauth/lib/oauth2.js | 161 + .../node_modules/oauth/lib/sha1.js | 334 + .../node_modules/oauth/package.json | 19 + .../node_modules/oauth/tests/oauth.js | 792 ++ .../node_modules/oauth/tests/oauth2.js | 67 + .../node_modules/oauth/tests/sha1.js | 13 + .../node_modules/passport-oauth/package.json | 35 + .../node_modules/pkginfo/.gitignore | 2 + .../node_modules/pkginfo/README.md | 85 + .../node_modules/pkginfo/docs/docco.css | 194 + .../node_modules/pkginfo/docs/pkginfo.html | 101 + .../pkginfo/examples/all-properties.js | 19 + .../pkginfo/examples/array-argument.js | 20 + .../pkginfo/examples/multiple-properties.js | 19 + .../pkginfo/examples/object-argument.js | 22 + .../pkginfo/examples/package.json | 10 + .../pkginfo/examples/single-property.js | 19 + .../node_modules/pkginfo/lib/pkginfo.js | 132 + .../node_modules/pkginfo/package.json | 17 + .../node_modules/pkginfo/test/pkginfo-test.js | 69 + node_modules/passport-github/package.json | 30 + node_modules/passport/.npmignore | 8 + node_modules/passport/.travis.yml | 5 + node_modules/passport/LICENSE | 20 + .../lib/passport/context/http/actions.js | 93 + .../lib/passport/context/http/context.js | 17 + .../passport/lib/passport/http/request.js | 91 + node_modules/passport/lib/passport/index.js | 412 + .../lib/passport/middleware/authenticate.js | 253 + .../lib/passport/middleware/initialize.js | 71 + .../lib/passport/strategies/session.js | 60 + .../passport/lib/passport/strategy.js | 33 + .../passport/node_modules/pkginfo/.gitignore | 2 + .../passport/node_modules/pkginfo/README.md | 85 + .../node_modules/pkginfo/docs/docco.css | 194 + .../node_modules/pkginfo/docs/pkginfo.html | 101 + .../pkginfo/examples/all-properties.js | 19 + .../pkginfo/examples/array-argument.js | 20 + .../pkginfo/examples/multiple-properties.js | 19 + .../pkginfo/examples/object-argument.js | 22 + .../pkginfo/examples/package.json | 10 + .../pkginfo/examples/single-property.js | 19 + .../node_modules/pkginfo/lib/pkginfo.js | 132 + .../node_modules/pkginfo/package.json | 17 + .../node_modules/pkginfo/test/pkginfo-test.js | 69 + node_modules/passport/package.json | 30 + src/app.js | 2 + 986 files changed, 95794 insertions(+), 1 deletion(-) create mode 120000 node_modules/.bin/express create mode 120000 node_modules/.bin/jade create mode 100644 node_modules/connect/.npmignore create mode 100644 node_modules/connect/.travis.yml create mode 100644 node_modules/connect/LICENSE create mode 100644 node_modules/connect/index.js create mode 100644 node_modules/connect/lib-cov/cache.js create mode 100644 node_modules/connect/lib-cov/connect.js create mode 100644 node_modules/connect/lib-cov/index.js create mode 100644 node_modules/connect/lib-cov/middleware/basicAuth.js create mode 100644 node_modules/connect/lib-cov/middleware/bodyParser.js create mode 100644 node_modules/connect/lib-cov/middleware/compress.js create mode 100644 node_modules/connect/lib-cov/middleware/cookieParser.js create mode 100644 node_modules/connect/lib-cov/middleware/cookieSession.js create mode 100644 node_modules/connect/lib-cov/middleware/csrf.js create mode 100644 node_modules/connect/lib-cov/middleware/directory.js create mode 100644 node_modules/connect/lib-cov/middleware/errorHandler.js create mode 100644 node_modules/connect/lib-cov/middleware/favicon.js create mode 100644 node_modules/connect/lib-cov/middleware/json.js create mode 100644 node_modules/connect/lib-cov/middleware/limit.js create mode 100644 node_modules/connect/lib-cov/middleware/logger.js create mode 100644 node_modules/connect/lib-cov/middleware/methodOverride.js create mode 100644 node_modules/connect/lib-cov/middleware/multipart.js create mode 100644 node_modules/connect/lib-cov/middleware/query.js create mode 100644 node_modules/connect/lib-cov/middleware/responseTime.js create mode 100644 node_modules/connect/lib-cov/middleware/session.js create mode 100644 node_modules/connect/lib-cov/middleware/session/cookie.js create mode 100644 node_modules/connect/lib-cov/middleware/session/memory.js create mode 100644 node_modules/connect/lib-cov/middleware/session/session.js create mode 100644 node_modules/connect/lib-cov/middleware/session/store.js create mode 100644 node_modules/connect/lib-cov/middleware/static.js create mode 100644 node_modules/connect/lib-cov/middleware/staticCache.js create mode 100644 node_modules/connect/lib-cov/middleware/timeout.js create mode 100644 node_modules/connect/lib-cov/middleware/urlencoded.js create mode 100644 node_modules/connect/lib-cov/middleware/vhost.js create mode 100644 node_modules/connect/lib-cov/patch.js create mode 100644 node_modules/connect/lib-cov/proto.js create mode 100644 node_modules/connect/lib-cov/public/directory.html create mode 100644 node_modules/connect/lib-cov/public/error.html create mode 100644 node_modules/connect/lib-cov/public/favicon.ico create mode 100644 node_modules/connect/lib-cov/public/icons/page.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_add.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_attach.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_code.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_copy.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_delete.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_edit.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_error.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_excel.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_find.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_gear.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_go.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_green.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_key.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_lightning.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_link.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_paintbrush.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_paste.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_red.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_refresh.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_save.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_acrobat.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_actionscript.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_add.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_c.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_camera.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_cd.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_code.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_code_red.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_compressed.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_copy.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_cplusplus.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_csharp.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_cup.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_database.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_delete.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_dvd.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_edit.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_error.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_excel.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_find.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_flash.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_freehand.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_gear.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_get.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_go.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_h.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_horizontal.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_key.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_lightning.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_link.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_magnify.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_medal.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_office.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_paint.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_paintbrush.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_paste.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_php.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_picture.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_put.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_ruby.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_stack.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_star.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_swoosh.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_text.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_text_width.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_tux.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_vector.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_visualstudio.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_width.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_word.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_world.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_wrench.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_white_zip.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_word.png create mode 100644 node_modules/connect/lib-cov/public/icons/page_world.png create mode 100644 node_modules/connect/lib-cov/public/style.css create mode 100644 node_modules/connect/lib-cov/utils.js create mode 100644 node_modules/connect/lib/cache.js create mode 100644 node_modules/connect/lib/connect.js create mode 100644 node_modules/connect/lib/index.js create mode 100644 node_modules/connect/lib/middleware/basicAuth.js create mode 100644 node_modules/connect/lib/middleware/bodyParser.js create mode 100644 node_modules/connect/lib/middleware/compress.js create mode 100644 node_modules/connect/lib/middleware/cookieParser.js create mode 100644 node_modules/connect/lib/middleware/cookieSession.js create mode 100644 node_modules/connect/lib/middleware/csrf.js create mode 100644 node_modules/connect/lib/middleware/directory.js create mode 100644 node_modules/connect/lib/middleware/errorHandler.js create mode 100644 node_modules/connect/lib/middleware/favicon.js create mode 100644 node_modules/connect/lib/middleware/json.js create mode 100644 node_modules/connect/lib/middleware/limit.js create mode 100644 node_modules/connect/lib/middleware/logger.js create mode 100644 node_modules/connect/lib/middleware/methodOverride.js create mode 100644 node_modules/connect/lib/middleware/multipart.js create mode 100644 node_modules/connect/lib/middleware/query.js create mode 100644 node_modules/connect/lib/middleware/responseTime.js create mode 100644 node_modules/connect/lib/middleware/session.js create mode 100644 node_modules/connect/lib/middleware/session/cookie.js create mode 100644 node_modules/connect/lib/middleware/session/memory.js create mode 100644 node_modules/connect/lib/middleware/session/session.js create mode 100644 node_modules/connect/lib/middleware/session/store.js create mode 100644 node_modules/connect/lib/middleware/static.js create mode 100644 node_modules/connect/lib/middleware/staticCache.js create mode 100644 node_modules/connect/lib/middleware/timeout.js create mode 100644 node_modules/connect/lib/middleware/urlencoded.js create mode 100644 node_modules/connect/lib/middleware/vhost.js create mode 100644 node_modules/connect/lib/patch.js create mode 100644 node_modules/connect/lib/proto.js create mode 100644 node_modules/connect/lib/public/directory.html create mode 100644 node_modules/connect/lib/public/error.html create mode 100644 node_modules/connect/lib/public/favicon.ico create mode 100644 node_modules/connect/lib/public/icons/page.png create mode 100644 node_modules/connect/lib/public/icons/page_add.png create mode 100644 node_modules/connect/lib/public/icons/page_attach.png create mode 100644 node_modules/connect/lib/public/icons/page_code.png create mode 100644 node_modules/connect/lib/public/icons/page_copy.png create mode 100644 node_modules/connect/lib/public/icons/page_delete.png create mode 100644 node_modules/connect/lib/public/icons/page_edit.png create mode 100644 node_modules/connect/lib/public/icons/page_error.png create mode 100644 node_modules/connect/lib/public/icons/page_excel.png create mode 100644 node_modules/connect/lib/public/icons/page_find.png create mode 100644 node_modules/connect/lib/public/icons/page_gear.png create mode 100644 node_modules/connect/lib/public/icons/page_go.png create mode 100644 node_modules/connect/lib/public/icons/page_green.png create mode 100644 node_modules/connect/lib/public/icons/page_key.png create mode 100644 node_modules/connect/lib/public/icons/page_lightning.png create mode 100644 node_modules/connect/lib/public/icons/page_link.png create mode 100644 node_modules/connect/lib/public/icons/page_paintbrush.png create mode 100644 node_modules/connect/lib/public/icons/page_paste.png create mode 100644 node_modules/connect/lib/public/icons/page_red.png create mode 100644 node_modules/connect/lib/public/icons/page_refresh.png create mode 100644 node_modules/connect/lib/public/icons/page_save.png create mode 100644 node_modules/connect/lib/public/icons/page_white.png create mode 100644 node_modules/connect/lib/public/icons/page_white_acrobat.png create mode 100644 node_modules/connect/lib/public/icons/page_white_actionscript.png create mode 100644 node_modules/connect/lib/public/icons/page_white_add.png create mode 100644 node_modules/connect/lib/public/icons/page_white_c.png create mode 100644 node_modules/connect/lib/public/icons/page_white_camera.png create mode 100644 node_modules/connect/lib/public/icons/page_white_cd.png create mode 100644 node_modules/connect/lib/public/icons/page_white_code.png create mode 100644 node_modules/connect/lib/public/icons/page_white_code_red.png create mode 100644 node_modules/connect/lib/public/icons/page_white_coldfusion.png create mode 100644 node_modules/connect/lib/public/icons/page_white_compressed.png create mode 100644 node_modules/connect/lib/public/icons/page_white_copy.png create mode 100644 node_modules/connect/lib/public/icons/page_white_cplusplus.png create mode 100644 node_modules/connect/lib/public/icons/page_white_csharp.png create mode 100644 node_modules/connect/lib/public/icons/page_white_cup.png create mode 100644 node_modules/connect/lib/public/icons/page_white_database.png create mode 100644 node_modules/connect/lib/public/icons/page_white_delete.png create mode 100644 node_modules/connect/lib/public/icons/page_white_dvd.png create mode 100644 node_modules/connect/lib/public/icons/page_white_edit.png create mode 100644 node_modules/connect/lib/public/icons/page_white_error.png create mode 100644 node_modules/connect/lib/public/icons/page_white_excel.png create mode 100644 node_modules/connect/lib/public/icons/page_white_find.png create mode 100644 node_modules/connect/lib/public/icons/page_white_flash.png create mode 100644 node_modules/connect/lib/public/icons/page_white_freehand.png create mode 100644 node_modules/connect/lib/public/icons/page_white_gear.png create mode 100644 node_modules/connect/lib/public/icons/page_white_get.png create mode 100644 node_modules/connect/lib/public/icons/page_white_go.png create mode 100644 node_modules/connect/lib/public/icons/page_white_h.png create mode 100644 node_modules/connect/lib/public/icons/page_white_horizontal.png create mode 100644 node_modules/connect/lib/public/icons/page_white_key.png create mode 100644 node_modules/connect/lib/public/icons/page_white_lightning.png create mode 100644 node_modules/connect/lib/public/icons/page_white_link.png create mode 100644 node_modules/connect/lib/public/icons/page_white_magnify.png create mode 100644 node_modules/connect/lib/public/icons/page_white_medal.png create mode 100644 node_modules/connect/lib/public/icons/page_white_office.png create mode 100644 node_modules/connect/lib/public/icons/page_white_paint.png create mode 100644 node_modules/connect/lib/public/icons/page_white_paintbrush.png create mode 100644 node_modules/connect/lib/public/icons/page_white_paste.png create mode 100644 node_modules/connect/lib/public/icons/page_white_php.png create mode 100644 node_modules/connect/lib/public/icons/page_white_picture.png create mode 100644 node_modules/connect/lib/public/icons/page_white_powerpoint.png create mode 100644 node_modules/connect/lib/public/icons/page_white_put.png create mode 100644 node_modules/connect/lib/public/icons/page_white_ruby.png create mode 100644 node_modules/connect/lib/public/icons/page_white_stack.png create mode 100644 node_modules/connect/lib/public/icons/page_white_star.png create mode 100644 node_modules/connect/lib/public/icons/page_white_swoosh.png create mode 100644 node_modules/connect/lib/public/icons/page_white_text.png create mode 100644 node_modules/connect/lib/public/icons/page_white_text_width.png create mode 100644 node_modules/connect/lib/public/icons/page_white_tux.png create mode 100644 node_modules/connect/lib/public/icons/page_white_vector.png create mode 100644 node_modules/connect/lib/public/icons/page_white_visualstudio.png create mode 100644 node_modules/connect/lib/public/icons/page_white_width.png create mode 100644 node_modules/connect/lib/public/icons/page_white_word.png create mode 100644 node_modules/connect/lib/public/icons/page_white_world.png create mode 100644 node_modules/connect/lib/public/icons/page_white_wrench.png create mode 100644 node_modules/connect/lib/public/icons/page_white_zip.png create mode 100644 node_modules/connect/lib/public/icons/page_word.png create mode 100644 node_modules/connect/lib/public/icons/page_world.png create mode 100644 node_modules/connect/lib/public/style.css create mode 100644 node_modules/connect/lib/utils.js create mode 100644 node_modules/connect/node_modules/buffer-crc32/.npmignore create mode 100644 node_modules/connect/node_modules/buffer-crc32/.travis.yml create mode 100644 node_modules/connect/node_modules/buffer-crc32/README.md create mode 100644 node_modules/connect/node_modules/buffer-crc32/index.js create mode 100644 node_modules/connect/node_modules/buffer-crc32/package.json create mode 100644 node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js create mode 100644 node_modules/connect/node_modules/bytes/.npmignore create mode 100644 node_modules/connect/node_modules/bytes/History.md create mode 100644 node_modules/connect/node_modules/bytes/Makefile create mode 100644 node_modules/connect/node_modules/bytes/Readme.md create mode 100644 node_modules/connect/node_modules/bytes/component.json create mode 100644 node_modules/connect/node_modules/bytes/index.js create mode 100644 node_modules/connect/node_modules/bytes/package.json create mode 100644 node_modules/connect/node_modules/cookie-signature/.npmignore create mode 100644 node_modules/connect/node_modules/cookie-signature/History.md create mode 100644 node_modules/connect/node_modules/cookie-signature/Makefile create mode 100644 node_modules/connect/node_modules/cookie-signature/Readme.md create mode 100644 node_modules/connect/node_modules/cookie-signature/index.js create mode 100644 node_modules/connect/node_modules/cookie-signature/package.json create mode 100644 node_modules/connect/node_modules/cookie/.npmignore create mode 100644 node_modules/connect/node_modules/cookie/.travis.yml create mode 100644 node_modules/connect/node_modules/cookie/README.md create mode 100644 node_modules/connect/node_modules/cookie/index.js create mode 100644 node_modules/connect/node_modules/cookie/package.json create mode 100644 node_modules/connect/node_modules/cookie/test/mocha.opts create mode 100644 node_modules/connect/node_modules/cookie/test/parse.js create mode 100644 node_modules/connect/node_modules/cookie/test/serialize.js create mode 100644 node_modules/connect/node_modules/debug/.npmignore create mode 100644 node_modules/connect/node_modules/debug/History.md create mode 100644 node_modules/connect/node_modules/debug/Readme.md create mode 100644 node_modules/connect/node_modules/debug/component.json create mode 100644 node_modules/connect/node_modules/debug/debug.js create mode 100644 node_modules/connect/node_modules/debug/example/app.js create mode 100644 node_modules/connect/node_modules/debug/example/browser.html create mode 100644 node_modules/connect/node_modules/debug/example/wildcards.js create mode 100644 node_modules/connect/node_modules/debug/example/worker.js create mode 100644 node_modules/connect/node_modules/debug/index.js create mode 100644 node_modules/connect/node_modules/debug/lib/debug.js create mode 100644 node_modules/connect/node_modules/debug/package.json create mode 100644 node_modules/connect/node_modules/formidable/.npmignore create mode 100644 node_modules/connect/node_modules/formidable/.travis.yml create mode 100644 node_modules/connect/node_modules/formidable/Makefile create mode 100644 node_modules/connect/node_modules/formidable/Readme.md create mode 100644 node_modules/connect/node_modules/formidable/TODO create mode 100644 node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js create mode 100644 node_modules/connect/node_modules/formidable/example/post.js create mode 100644 node_modules/connect/node_modules/formidable/example/upload.js create mode 100644 node_modules/connect/node_modules/formidable/index.js create mode 100644 node_modules/connect/node_modules/formidable/lib/file.js create mode 100644 node_modules/connect/node_modules/formidable/lib/incoming_form.js create mode 100644 node_modules/connect/node_modules/formidable/lib/index.js create mode 100644 node_modules/connect/node_modules/formidable/lib/multipart_parser.js create mode 100644 node_modules/connect/node_modules/formidable/lib/querystring_parser.js create mode 100644 node_modules/connect/node_modules/formidable/lib/util.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/Makefile create mode 100644 node_modules/connect/node_modules/formidable/node-gently/Readme.md create mode 100644 node_modules/connect/node_modules/formidable/node-gently/example/dog.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/index.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/package.json create mode 100644 node_modules/connect/node_modules/formidable/node-gently/test/common.js create mode 100644 node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js create mode 100644 node_modules/connect/node_modules/formidable/package.json create mode 100644 node_modules/connect/node_modules/formidable/test/common.js create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js create mode 100644 node_modules/connect/node_modules/formidable/test/fixture/multipart.js create mode 100644 node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/common.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js create mode 100644 node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js create mode 100755 node_modules/connect/node_modules/formidable/test/run.js create mode 100644 node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js create mode 100644 node_modules/connect/node_modules/formidable/tool/record.js create mode 100644 node_modules/connect/node_modules/fresh/.npmignore create mode 100644 node_modules/connect/node_modules/fresh/Makefile create mode 100644 node_modules/connect/node_modules/fresh/Readme.md create mode 100644 node_modules/connect/node_modules/fresh/index.js create mode 100644 node_modules/connect/node_modules/fresh/package.json create mode 100644 node_modules/connect/node_modules/pause/.npmignore create mode 100644 node_modules/connect/node_modules/pause/History.md create mode 100644 node_modules/connect/node_modules/pause/Makefile create mode 100644 node_modules/connect/node_modules/pause/Readme.md create mode 100644 node_modules/connect/node_modules/pause/index.js create mode 100644 node_modules/connect/node_modules/pause/package.json create mode 100644 node_modules/connect/node_modules/qs/.gitmodules create mode 100644 node_modules/connect/node_modules/qs/.npmignore create mode 100644 node_modules/connect/node_modules/qs/.travis.yml create mode 100644 node_modules/connect/node_modules/qs/History.md create mode 100644 node_modules/connect/node_modules/qs/Makefile create mode 100644 node_modules/connect/node_modules/qs/Readme.md create mode 100644 node_modules/connect/node_modules/qs/benchmark.js create mode 100644 node_modules/connect/node_modules/qs/component.json create mode 100644 node_modules/connect/node_modules/qs/examples.js create mode 100644 node_modules/connect/node_modules/qs/index.js create mode 100644 node_modules/connect/node_modules/qs/lib/head.js create mode 100644 node_modules/connect/node_modules/qs/lib/querystring.js create mode 100644 node_modules/connect/node_modules/qs/lib/tail.js create mode 100644 node_modules/connect/node_modules/qs/package.json create mode 100644 node_modules/connect/node_modules/qs/querystring.js create mode 100644 node_modules/connect/node_modules/qs/test/browser/expect.js create mode 100644 node_modules/connect/node_modules/qs/test/browser/index.html create mode 100644 node_modules/connect/node_modules/qs/test/browser/jquery.js create mode 100644 node_modules/connect/node_modules/qs/test/browser/mocha.css create mode 100644 node_modules/connect/node_modules/qs/test/browser/mocha.js create mode 100644 node_modules/connect/node_modules/qs/test/browser/qs.css create mode 100644 node_modules/connect/node_modules/qs/test/browser/qs.js create mode 100644 node_modules/connect/node_modules/qs/test/parse.js create mode 100644 node_modules/connect/node_modules/qs/test/stringify.js create mode 100644 node_modules/connect/node_modules/send/.npmignore create mode 100644 node_modules/connect/node_modules/send/History.md create mode 100644 node_modules/connect/node_modules/send/Makefile create mode 100644 node_modules/connect/node_modules/send/Readme.md create mode 100644 node_modules/connect/node_modules/send/index.js create mode 100644 node_modules/connect/node_modules/send/lib/send.js create mode 100644 node_modules/connect/node_modules/send/lib/utils.js create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/LICENSE create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/README.md create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/mime.js create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/package.json create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/test.js create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/types/mime.types create mode 100644 node_modules/connect/node_modules/send/node_modules/mime/types/node.types create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/.npmignore create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/History.md create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/Makefile create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/Readme.md create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/index.js create mode 100644 node_modules/connect/node_modules/send/node_modules/range-parser/package.json create mode 100644 node_modules/connect/node_modules/send/package.json create mode 100644 node_modules/connect/package.json create mode 100644 node_modules/connect/test.js create mode 100644 node_modules/express/.npmignore create mode 100644 node_modules/express/.travis.yml create mode 100644 node_modules/express/History.md create mode 100644 node_modules/express/LICENSE create mode 100644 node_modules/express/Makefile create mode 100644 node_modules/express/Readme.md create mode 100755 node_modules/express/bin/express create mode 100644 node_modules/express/client.js create mode 100644 node_modules/express/index.js create mode 100644 node_modules/express/lib/application.js create mode 100644 node_modules/express/lib/express.js create mode 100644 node_modules/express/lib/middleware.js create mode 100644 node_modules/express/lib/request.js create mode 100644 node_modules/express/lib/response.js create mode 100644 node_modules/express/lib/router/index.js create mode 100644 node_modules/express/lib/router/route.js create mode 100644 node_modules/express/lib/utils.js create mode 100644 node_modules/express/lib/view.js create mode 100644 node_modules/express/node_modules/buffer-crc32/.npmignore create mode 100644 node_modules/express/node_modules/buffer-crc32/.travis.yml create mode 100644 node_modules/express/node_modules/buffer-crc32/README.md create mode 100644 node_modules/express/node_modules/buffer-crc32/index.js create mode 100644 node_modules/express/node_modules/buffer-crc32/package.json create mode 100644 node_modules/express/node_modules/buffer-crc32/tests/crc.test.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/.npmignore create mode 100644 node_modules/express/node_modules/connect/.travis.yml create mode 100644 node_modules/express/node_modules/connect/LICENSE create mode 100644 node_modules/express/node_modules/connect/index.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/cache.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/connect.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/index.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/basicAuth.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/bodyParser.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/compress.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/cookieParser.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/cookieSession.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/csrf.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/directory.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/errorHandler.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/favicon.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/json.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/limit.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/logger.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/methodOverride.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/multipart.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/query.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/responseTime.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/session.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/session/cookie.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/session/memory.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/session/session.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/session/store.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/static.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/staticCache.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/timeout.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/urlencoded.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/middleware/vhost.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/patch.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/proto.js create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/directory.html create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/error.html create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/favicon.ico create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_add.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_attach.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_code.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_copy.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_delete.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_edit.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_error.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_excel.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_find.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_gear.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_go.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_green.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_key.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_lightning.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_link.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_paintbrush.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_paste.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_red.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_refresh.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_save.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_acrobat.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_actionscript.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_add.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_c.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_camera.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_cd.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code_red.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_compressed.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_copy.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_cplusplus.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_csharp.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_cup.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_database.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_delete.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_dvd.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_edit.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_error.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_excel.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_find.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_flash.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_freehand.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_gear.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_get.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_go.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_h.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_horizontal.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_key.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_lightning.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_link.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_magnify.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_medal.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_office.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_paint.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_paintbrush.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_paste.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_php.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_picture.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_put.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_ruby.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_stack.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_star.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_swoosh.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_text.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_text_width.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_tux.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_vector.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_visualstudio.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_width.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_word.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_world.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_wrench.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_zip.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_word.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/icons/page_world.png create mode 100644 node_modules/express/node_modules/connect/lib-cov/public/style.css create mode 100644 node_modules/express/node_modules/connect/lib-cov/utils.js create mode 100644 node_modules/express/node_modules/connect/lib/cache.js create mode 100644 node_modules/express/node_modules/connect/lib/connect.js create mode 100644 node_modules/express/node_modules/connect/lib/index.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/basicAuth.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/bodyParser.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/cookieParser.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/csrf.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/directory.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/errorHandler.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/favicon.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/limit.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/logger.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/methodOverride.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/multipart.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/query.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/responseTime.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/session.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/session/cookie.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/session/memory.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/session/session.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/session/store.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/static.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/staticCache.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 create mode 100644 node_modules/express/node_modules/connect/lib/middleware/vhost.js create mode 100644 node_modules/express/node_modules/connect/lib/patch.js create mode 100644 node_modules/express/node_modules/connect/lib/proto.js create mode 100644 node_modules/express/node_modules/connect/lib/public/directory.html create mode 100644 node_modules/express/node_modules/connect/lib/public/error.html create mode 100644 node_modules/express/node_modules/connect/lib/public/favicon.ico create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_add.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_attach.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_code.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_copy.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_delete.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_edit.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_error.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_excel.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_find.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_gear.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_go.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_green.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_key.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_link.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_paste.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_red.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_save.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_word.png create mode 100644 node_modules/express/node_modules/connect/lib/public/icons/page_world.png create mode 100644 node_modules/express/node_modules/connect/lib/public/style.css create mode 100644 node_modules/express/node_modules/connect/lib/utils.js 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 create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/.npmignore create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/Makefile create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/Readme.md create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/TODO create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/example/post.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js 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 create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/package.json create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/common.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js create mode 100755 node_modules/express/node_modules/connect/node_modules/formidable/test/run.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js 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 create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/.gitmodules create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/.npmignore create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/.travis.yml create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/History.md create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/Makefile create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/Readme.md create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/benchmark.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/component.json create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/examples.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/index.js 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 create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/querystring.js 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 create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/qs.css 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/connect/package.json create mode 100644 node_modules/express/node_modules/connect/test.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/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 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 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 create mode 100644 node_modules/express/node_modules/send/node_modules/mime/LICENSE create mode 100644 node_modules/express/node_modules/send/node_modules/mime/README.md 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 create mode 100644 node_modules/express/node_modules/send/node_modules/mime/test.js create mode 100644 node_modules/express/node_modules/send/node_modules/mime/types/mime.types create mode 100644 node_modules/express/node_modules/send/node_modules/mime/types/node.types create mode 100644 node_modules/express/node_modules/send/package.json create mode 100644 node_modules/express/package.json create mode 100644 node_modules/express/test.js create mode 100644 node_modules/jade/.npmignore create mode 100644 node_modules/jade/LICENSE create mode 100644 node_modules/jade/Readme.md create mode 100644 node_modules/jade/Readme_zh-cn.md create mode 100755 node_modules/jade/bin/jade create mode 100644 node_modules/jade/index.js create mode 100644 node_modules/jade/jade.js create mode 100644 node_modules/jade/jade.md create mode 100644 node_modules/jade/jade.min.js create mode 100644 node_modules/jade/lib/compiler.js create mode 100644 node_modules/jade/lib/doctypes.js create mode 100644 node_modules/jade/lib/filters.js create mode 100644 node_modules/jade/lib/inline-tags.js create mode 100644 node_modules/jade/lib/jade.js create mode 100644 node_modules/jade/lib/lexer.js create mode 100644 node_modules/jade/lib/nodes/attrs.js create mode 100644 node_modules/jade/lib/nodes/block-comment.js create mode 100644 node_modules/jade/lib/nodes/block.js create mode 100644 node_modules/jade/lib/nodes/case.js create mode 100644 node_modules/jade/lib/nodes/code.js create mode 100644 node_modules/jade/lib/nodes/comment.js create mode 100644 node_modules/jade/lib/nodes/doctype.js create mode 100644 node_modules/jade/lib/nodes/each.js create mode 100644 node_modules/jade/lib/nodes/filter.js create mode 100644 node_modules/jade/lib/nodes/index.js create mode 100644 node_modules/jade/lib/nodes/literal.js create mode 100644 node_modules/jade/lib/nodes/mixin.js create mode 100644 node_modules/jade/lib/nodes/node.js create mode 100644 node_modules/jade/lib/nodes/tag.js create mode 100644 node_modules/jade/lib/nodes/text.js create mode 100644 node_modules/jade/lib/parser.js create mode 100644 node_modules/jade/lib/runtime.js create mode 100644 node_modules/jade/lib/self-closing.js create mode 100644 node_modules/jade/lib/utils.js create mode 120000 node_modules/jade/node_modules/.bin/cake create mode 120000 node_modules/jade/node_modules/.bin/coffee create mode 100644 node_modules/jade/node_modules/coffee-script/.npmignore create mode 100644 node_modules/jade/node_modules/coffee-script/CNAME create mode 100644 node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md create mode 100644 node_modules/jade/node_modules/coffee-script/LICENSE create mode 100644 node_modules/jade/node_modules/coffee-script/README create mode 100644 node_modules/jade/node_modules/coffee-script/Rakefile create mode 100755 node_modules/jade/node_modules/coffee-script/bin/cake create mode 100755 node_modules/jade/node_modules/coffee-script/bin/coffee create mode 100644 node_modules/jade/node_modules/coffee-script/extras/jsl.conf create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js create mode 100755 node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js create mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js create mode 100644 node_modules/jade/node_modules/coffee-script/package.json create mode 100644 node_modules/jade/node_modules/commander/.npmignore create mode 100644 node_modules/jade/node_modules/commander/.travis.yml create mode 100644 node_modules/jade/node_modules/commander/History.md create mode 100644 node_modules/jade/node_modules/commander/Makefile create mode 100644 node_modules/jade/node_modules/commander/Readme.md create mode 100644 node_modules/jade/node_modules/commander/index.js create mode 100644 node_modules/jade/node_modules/commander/lib/commander.js create mode 100644 node_modules/jade/node_modules/commander/package.json create mode 100644 node_modules/jade/node_modules/mkdirp/.npmignore create mode 100644 node_modules/jade/node_modules/mkdirp/.travis.yml create mode 100644 node_modules/jade/node_modules/mkdirp/LICENSE create mode 100644 node_modules/jade/node_modules/mkdirp/README.markdown create mode 100644 node_modules/jade/node_modules/mkdirp/examples/pow.js create mode 100644 node_modules/jade/node_modules/mkdirp/index.js create mode 100644 node_modules/jade/node_modules/mkdirp/package.json create mode 100644 node_modules/jade/node_modules/mkdirp/test/chmod.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/clobber.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/mkdirp.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/perm.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/perm_sync.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/race.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/rel.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/return.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/return_sync.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/root.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/sync.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/umask.js create mode 100644 node_modules/jade/node_modules/mkdirp/test/umask_sync.js create mode 100644 node_modules/jade/package.json create mode 100644 node_modules/jade/runtime.js create mode 100644 node_modules/jade/runtime.min.js create mode 100644 node_modules/jade/testing/index.html create mode 100644 node_modules/jade/testing/index.jade create mode 100644 node_modules/jade/testing/layout.html create mode 100644 node_modules/jade/testing/layout.jade create mode 100644 node_modules/jade/testing/mobile.html create mode 100644 node_modules/jade/testing/mobile.jade create mode 100644 node_modules/jade/testing/nested/something.html create mode 100644 node_modules/jade/testing/nested/something.jade create mode 100644 node_modules/jade/testing/some.js create mode 100644 node_modules/jade/testing/test.md create mode 100644 node_modules/passport-github/.npmignore create mode 100644 node_modules/passport-github/.travis.yml create mode 100644 node_modules/passport-github/LICENSE create mode 100644 node_modules/passport-github/examples/login/app.js create mode 100644 node_modules/passport-github/examples/login/package.json create mode 100644 node_modules/passport-github/examples/login/views/account.ejs create mode 100644 node_modules/passport-github/examples/login/views/index.ejs create mode 100644 node_modules/passport-github/examples/login/views/layout.ejs create mode 100644 node_modules/passport-github/examples/login/views/login.ejs create mode 100644 node_modules/passport-github/lib/passport-github/index.js create mode 100644 node_modules/passport-github/lib/passport-github/strategy.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/.travis.yml create mode 100644 node_modules/passport-github/node_modules/passport-oauth/LICENSE create mode 100644 node_modules/passport-github/node_modules/passport-oauth/README.md create mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js create mode 100644 node_modules/passport-github/node_modules/passport-oauth/package.json create mode 100644 node_modules/passport-github/node_modules/pkginfo/.gitignore create mode 100644 node_modules/passport-github/node_modules/pkginfo/README.md create mode 100644 node_modules/passport-github/node_modules/pkginfo/docs/docco.css create mode 100644 node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/package.json create mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/single-property.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js create mode 100644 node_modules/passport-github/node_modules/pkginfo/package.json create mode 100644 node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js create mode 100644 node_modules/passport-github/package.json create mode 100644 node_modules/passport/.npmignore create mode 100644 node_modules/passport/.travis.yml create mode 100644 node_modules/passport/LICENSE create mode 100644 node_modules/passport/lib/passport/context/http/actions.js create mode 100644 node_modules/passport/lib/passport/context/http/context.js create mode 100644 node_modules/passport/lib/passport/http/request.js create mode 100644 node_modules/passport/lib/passport/index.js create mode 100644 node_modules/passport/lib/passport/middleware/authenticate.js create mode 100644 node_modules/passport/lib/passport/middleware/initialize.js create mode 100644 node_modules/passport/lib/passport/strategies/session.js create mode 100644 node_modules/passport/lib/passport/strategy.js create mode 100644 node_modules/passport/node_modules/pkginfo/.gitignore create mode 100644 node_modules/passport/node_modules/pkginfo/README.md create mode 100644 node_modules/passport/node_modules/pkginfo/docs/docco.css create mode 100644 node_modules/passport/node_modules/pkginfo/docs/pkginfo.html create mode 100644 node_modules/passport/node_modules/pkginfo/examples/all-properties.js create mode 100644 node_modules/passport/node_modules/pkginfo/examples/array-argument.js create mode 100644 node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js create mode 100644 node_modules/passport/node_modules/pkginfo/examples/object-argument.js create mode 100644 node_modules/passport/node_modules/pkginfo/examples/package.json create mode 100644 node_modules/passport/node_modules/pkginfo/examples/single-property.js create mode 100644 node_modules/passport/node_modules/pkginfo/lib/pkginfo.js create mode 100644 node_modules/passport/node_modules/pkginfo/package.json create mode 100644 node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js create mode 100644 node_modules/passport/package.json create mode 100644 src/app.js diff --git a/.gitignore b/.gitignore index 377d367..f83e9dd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ output-min/* __* .#* config/ -.idea/ +.idea/workspace.xml +.idea/tasks.xml +.DS_Store + diff --git a/node_modules/.bin/express b/node_modules/.bin/express new file mode 120000 index 0000000..b741d99 --- /dev/null +++ b/node_modules/.bin/express @@ -0,0 +1 @@ +../express/bin/express \ No newline at end of file diff --git a/node_modules/.bin/jade b/node_modules/.bin/jade new file mode 120000 index 0000000..571fae7 --- /dev/null +++ b/node_modules/.bin/jade @@ -0,0 +1 @@ +../jade/bin/jade \ No newline at end of file diff --git a/node_modules/connect/.npmignore b/node_modules/connect/.npmignore new file mode 100644 index 0000000..9046dde --- /dev/null +++ b/node_modules/connect/.npmignore @@ -0,0 +1,12 @@ +*.markdown +*.md +.git* +Makefile +benchmarks/ +docs/ +examples/ +install.sh +support/ +test/ +.DS_Store +coverage.html diff --git a/node_modules/connect/.travis.yml b/node_modules/connect/.travis.yml new file mode 100644 index 0000000..3aeb3c5 --- /dev/null +++ b/node_modules/connect/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.9 \ No newline at end of file diff --git a/node_modules/connect/LICENSE b/node_modules/connect/LICENSE new file mode 100644 index 0000000..0c5d22d --- /dev/null +++ b/node_modules/connect/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2010 Sencha Inc. +Copyright (c) 2011 LearnBoost +Copyright (c) 2011 TJ Holowaychuk + +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/connect/index.js b/node_modules/connect/index.js new file mode 100644 index 0000000..23240ee --- /dev/null +++ b/node_modules/connect/index.js @@ -0,0 +1,4 @@ + +module.exports = process.env.CONNECT_COV + ? require('./lib-cov/connect') + : require('./lib/connect'); \ No newline at end of file diff --git a/node_modules/connect/lib-cov/cache.js b/node_modules/connect/lib-cov/cache.js new file mode 100644 index 0000000..af6cd2f --- /dev/null +++ b/node_modules/connect/lib-cov/cache.js @@ -0,0 +1,68 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['cache.js']) { + _$jscoverage['cache.js'] = []; + _$jscoverage['cache.js'][12] = 0; + _$jscoverage['cache.js'][21] = 0; + _$jscoverage['cache.js'][22] = 0; + _$jscoverage['cache.js'][23] = 0; + _$jscoverage['cache.js'][24] = 0; + _$jscoverage['cache.js'][35] = 0; + _$jscoverage['cache.js'][36] = 0; + _$jscoverage['cache.js'][37] = 0; + _$jscoverage['cache.js'][47] = 0; + _$jscoverage['cache.js'][48] = 0; + _$jscoverage['cache.js'][59] = 0; + _$jscoverage['cache.js'][60] = 0; + _$jscoverage['cache.js'][71] = 0; + _$jscoverage['cache.js'][73] = 0; + _$jscoverage['cache.js'][76] = 0; + _$jscoverage['cache.js'][78] = 0; + _$jscoverage['cache.js'][79] = 0; + _$jscoverage['cache.js'][80] = 0; +} +_$jscoverage['cache.js'][12]++; +module.exports = Cache; +_$jscoverage['cache.js'][21]++; +function Cache(limit) { + _$jscoverage['cache.js'][22]++; + this.store = {}; + _$jscoverage['cache.js'][23]++; + this.keys = []; + _$jscoverage['cache.js'][24]++; + this.limit = limit; +} +_$jscoverage['cache.js'][35]++; +Cache.prototype.touch = (function (key, i) { + _$jscoverage['cache.js'][36]++; + this.keys.splice(i, 1); + _$jscoverage['cache.js'][37]++; + this.keys.push(key); +}); +_$jscoverage['cache.js'][47]++; +Cache.prototype.remove = (function (key) { + _$jscoverage['cache.js'][48]++; + delete this.store[key]; +}); +_$jscoverage['cache.js'][59]++; +Cache.prototype.get = (function (key) { + _$jscoverage['cache.js'][60]++; + return this.store[key]; +}); +_$jscoverage['cache.js'][71]++; +Cache.prototype.add = (function (key) { + _$jscoverage['cache.js'][73]++; + var len = this.keys.push(key); + _$jscoverage['cache.js'][76]++; + if (len > this.limit) { + _$jscoverage['cache.js'][76]++; + this.remove(this.keys.shift()); + } + _$jscoverage['cache.js'][78]++; + var arr = this.store[key] = []; + _$jscoverage['cache.js'][79]++; + arr.createdAt = new Date(); + _$jscoverage['cache.js'][80]++; + return arr; +}); +_$jscoverage['cache.js'].source = ["","/*!"," * Connect - Cache"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Expose `Cache`."," */","","module.exports = Cache;","","/**"," * LRU cache store."," *"," * @param {Number} limit"," * @api private"," */","","function Cache(limit) {"," this.store = {};"," this.keys = [];"," this.limit = limit;","}","","/**"," * Touch `key`, promoting the object."," *"," * @param {String} key"," * @param {Number} i"," * @api private"," */","","Cache.prototype.touch = function(key, i){"," this.keys.splice(i,1);"," this.keys.push(key);","};","","/**"," * Remove `key`."," *"," * @param {String} key"," * @api private"," */","","Cache.prototype.remove = function(key){"," delete this.store[key];","};","","/**"," * Get the object stored for `key`."," *"," * @param {String} key"," * @return {Array}"," * @api private"," */","","Cache.prototype.get = function(key){"," return this.store[key];","};","","/**"," * Add a cache `key`."," *"," * @param {String} key"," * @return {Array}"," * @api private"," */","","Cache.prototype.add = function(key){"," // initialize store"," var len = this.keys.push(key);",""," // limit reached, invalidate LRU"," if (len > this.limit) this.remove(this.keys.shift());",""," var arr = this.store[key] = [];"," arr.createdAt = new Date;"," return arr;","};"]; diff --git a/node_modules/connect/lib-cov/connect.js b/node_modules/connect/lib-cov/connect.js new file mode 100644 index 0000000..f811bb8 --- /dev/null +++ b/node_modules/connect/lib-cov/connect.js @@ -0,0 +1,93 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['connect.js']) { + _$jscoverage['connect.js'] = []; + _$jscoverage['connect.js'][13] = 0; + _$jscoverage['connect.js'][22] = 0; + _$jscoverage['connect.js'][26] = 0; + _$jscoverage['connect.js'][32] = 0; + _$jscoverage['connect.js'][38] = 0; + _$jscoverage['connect.js'][44] = 0; + _$jscoverage['connect.js'][50] = 0; + _$jscoverage['connect.js'][56] = 0; + _$jscoverage['connect.js'][65] = 0; + _$jscoverage['connect.js'][66] = 0; + _$jscoverage['connect.js'][67] = 0; + _$jscoverage['connect.js'][68] = 0; + _$jscoverage['connect.js'][69] = 0; + _$jscoverage['connect.js'][70] = 0; + _$jscoverage['connect.js'][71] = 0; + _$jscoverage['connect.js'][72] = 0; + _$jscoverage['connect.js'][74] = 0; + _$jscoverage['connect.js'][75] = 0; + _$jscoverage['connect.js'][81] = 0; + _$jscoverage['connect.js'][87] = 0; + _$jscoverage['connect.js'][88] = 0; + _$jscoverage['connect.js'][89] = 0; + _$jscoverage['connect.js'][90] = 0; + _$jscoverage['connect.js'][91] = 0; + _$jscoverage['connect.js'][92] = 0; +} +_$jscoverage['connect.js'][13]++; +var EventEmitter = require("events").EventEmitter, proto = require("./proto"), utils = require("./utils"), path = require("path"), basename = path.basename, fs = require("fs"); +_$jscoverage['connect.js'][22]++; +require("./patch"); +_$jscoverage['connect.js'][26]++; +exports = module.exports = createServer; +_$jscoverage['connect.js'][32]++; +exports.version = "2.6.1"; +_$jscoverage['connect.js'][38]++; +exports.mime = require("./middleware/static").mime; +_$jscoverage['connect.js'][44]++; +exports.proto = proto; +_$jscoverage['connect.js'][50]++; +exports.middleware = {}; +_$jscoverage['connect.js'][56]++; +exports.utils = utils; +_$jscoverage['connect.js'][65]++; +function createServer() { + _$jscoverage['connect.js'][66]++; + function app(req, res) { + _$jscoverage['connect.js'][66]++; + app.handle(req, res); +} + _$jscoverage['connect.js'][67]++; + utils.merge(app, proto); + _$jscoverage['connect.js'][68]++; + utils.merge(app, EventEmitter.prototype); + _$jscoverage['connect.js'][69]++; + app.route = "/"; + _$jscoverage['connect.js'][70]++; + app.stack = []; + _$jscoverage['connect.js'][71]++; + for (var i = 0; i < arguments.length; ++i) { + _$jscoverage['connect.js'][72]++; + app.use(arguments[i]); +} + _$jscoverage['connect.js'][74]++; + return app; +} +_$jscoverage['connect.js'][75]++; +; +_$jscoverage['connect.js'][81]++; +createServer.createServer = createServer; +_$jscoverage['connect.js'][87]++; +fs.readdirSync(__dirname + "/middleware").forEach((function (filename) { + _$jscoverage['connect.js'][88]++; + if (! /\.js$/.test(filename)) { + _$jscoverage['connect.js'][88]++; + return; + } + _$jscoverage['connect.js'][89]++; + var name = basename(filename, ".js"); + _$jscoverage['connect.js'][90]++; + function load() { + _$jscoverage['connect.js'][90]++; + return require("./middleware/" + name); +} + _$jscoverage['connect.js'][91]++; + exports.middleware.__defineGetter__(name, load); + _$jscoverage['connect.js'][92]++; + exports.__defineGetter__(name, load); +})); +_$jscoverage['connect.js'].source = ["","/*!"," * Connect"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var EventEmitter = require('events').EventEmitter"," , proto = require('./proto')"," , utils = require('./utils')"," , path = require('path')"," , basename = path.basename"," , fs = require('fs');","","// node patches","","require('./patch');","","// expose createServer() as the module","","exports = module.exports = createServer;","","/**"," * Framework version."," */","","exports.version = '2.6.1';","","/**"," * Expose mime module."," */","","exports.mime = require('./middleware/static').mime;","","/**"," * Expose the prototype."," */","","exports.proto = proto;","","/**"," * Auto-load middleware getters."," */","","exports.middleware = {};","","/**"," * Expose utilities."," */","","exports.utils = utils;","","/**"," * Create a new connect server."," *"," * @return {Function}"," * @api public"," */","","function createServer() {"," function app(req, res){ app.handle(req, res); }"," utils.merge(app, proto);"," utils.merge(app, EventEmitter.prototype);"," app.route = '/';"," app.stack = [];"," for (var i = 0; i < arguments.length; ++i) {"," app.use(arguments[i]);"," }"," return app;","};","","/**"," * Support old `.createServer()` method."," */","","createServer.createServer = createServer;","","/**"," * Auto-load bundled middleware with getters."," */","","fs.readdirSync(__dirname + '/middleware').forEach(function(filename){"," if (!/\\.js$/.test(filename)) return;"," var name = basename(filename, '.js');"," function load(){ return require('./middleware/' + name); }"," exports.middleware.__defineGetter__(name, load);"," exports.__defineGetter__(name, load);","});"]; diff --git a/node_modules/connect/lib-cov/index.js b/node_modules/connect/lib-cov/index.js new file mode 100644 index 0000000..e6bb1c7 --- /dev/null +++ b/node_modules/connect/lib-cov/index.js @@ -0,0 +1,6 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['index.js']) { + _$jscoverage['index.js'] = []; +} +_$jscoverage['index.js'].source = ["","/**"," * Connect is a middleware framework for node,"," * shipping with over 18 bundled middleware and a rich selection of"," * 3rd-party middleware."," *"," * var app = connect()"," * .use(connect.logger('dev'))"," * .use(connect.static('public'))"," * .use(function(req, res){"," * res.end('hello world\\n');"," * })"," * .listen(3000);"," * "," * Installation:"," * "," * $ npm install connect"," *"," * Middleware:"," *"," * - [logger](logger.html) request logger with custom format support"," * - [csrf](csrf.html) Cross-site request forgery protection"," * - [compress](compress.html) Gzip compression middleware"," * - [basicAuth](basicAuth.html) basic http authentication"," * - [bodyParser](bodyParser.html) extensible request body parser"," * - [json](json.html) application/json parser"," * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser"," * - [multipart](multipart.html) multipart/form-data parser"," * - [timeout](timeout.html) request timeouts"," * - [cookieParser](cookieParser.html) cookie parser"," * - [session](session.html) session management support with bundled MemoryStore"," * - [cookieSession](cookieSession.html) cookie-based session support"," * - [methodOverride](methodOverride.html) faux HTTP method support"," * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time"," * - [staticCache](staticCache.html) memory cache layer for the static() middleware"," * - [static](static.html) streaming static file server supporting `Range` and more"," * - [directory](directory.html) directory listing middleware"," * - [vhost](vhost.html) virtual host sub-domain mapping middleware"," * - [favicon](favicon.html) efficient favicon server (with default icon)"," * - [limit](limit.html) limit the bytesize of request bodies"," * - [query](query.html) automatic querystring parser, populating `req.query`"," * - [errorHandler](errorHandler.html) flexible error handler"," *"," * Links:"," * "," * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware"," * - GitHub [repository](http://github.com/senchalabs/connect)"," * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md)"," * "," */"]; diff --git a/node_modules/connect/lib-cov/middleware/basicAuth.js b/node_modules/connect/lib-cov/middleware/basicAuth.js new file mode 100644 index 0000000..c9e7d63 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/basicAuth.js @@ -0,0 +1,128 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/basicAuth.js']) { + _$jscoverage['middleware/basicAuth.js'] = []; + _$jscoverage['middleware/basicAuth.js'][13] = 0; + _$jscoverage['middleware/basicAuth.js'][48] = 0; + _$jscoverage['middleware/basicAuth.js'][49] = 0; + _$jscoverage['middleware/basicAuth.js'][52] = 0; + _$jscoverage['middleware/basicAuth.js'][53] = 0; + _$jscoverage['middleware/basicAuth.js'][54] = 0; + _$jscoverage['middleware/basicAuth.js'][55] = 0; + _$jscoverage['middleware/basicAuth.js'][56] = 0; + _$jscoverage['middleware/basicAuth.js'][57] = 0; + _$jscoverage['middleware/basicAuth.js'][58] = 0; + _$jscoverage['middleware/basicAuth.js'][62] = 0; + _$jscoverage['middleware/basicAuth.js'][64] = 0; + _$jscoverage['middleware/basicAuth.js'][65] = 0; + _$jscoverage['middleware/basicAuth.js'][67] = 0; + _$jscoverage['middleware/basicAuth.js'][68] = 0; + _$jscoverage['middleware/basicAuth.js'][70] = 0; + _$jscoverage['middleware/basicAuth.js'][72] = 0; + _$jscoverage['middleware/basicAuth.js'][74] = 0; + _$jscoverage['middleware/basicAuth.js'][78] = 0; + _$jscoverage['middleware/basicAuth.js'][80] = 0; + _$jscoverage['middleware/basicAuth.js'][84] = 0; + _$jscoverage['middleware/basicAuth.js'][85] = 0; + _$jscoverage['middleware/basicAuth.js'][86] = 0; + _$jscoverage['middleware/basicAuth.js'][87] = 0; + _$jscoverage['middleware/basicAuth.js'][88] = 0; + _$jscoverage['middleware/basicAuth.js'][89] = 0; + _$jscoverage['middleware/basicAuth.js'][90] = 0; + _$jscoverage['middleware/basicAuth.js'][94] = 0; + _$jscoverage['middleware/basicAuth.js'][95] = 0; + _$jscoverage['middleware/basicAuth.js'][96] = 0; + _$jscoverage['middleware/basicAuth.js'][98] = 0; +} +_$jscoverage['middleware/basicAuth.js'][13]++; +var utils = require("../utils"), unauthorized = utils.unauthorized; +_$jscoverage['middleware/basicAuth.js'][48]++; +module.exports = (function basicAuth(callback, realm) { + _$jscoverage['middleware/basicAuth.js'][49]++; + var username, password; + _$jscoverage['middleware/basicAuth.js'][52]++; + if ("string" == typeof callback) { + _$jscoverage['middleware/basicAuth.js'][53]++; + username = callback; + _$jscoverage['middleware/basicAuth.js'][54]++; + password = realm; + _$jscoverage['middleware/basicAuth.js'][55]++; + if ("string" != typeof password) { + _$jscoverage['middleware/basicAuth.js'][55]++; + throw new Error("password argument required"); + } + _$jscoverage['middleware/basicAuth.js'][56]++; + realm = arguments[2]; + _$jscoverage['middleware/basicAuth.js'][57]++; + callback = (function (user, pass) { + _$jscoverage['middleware/basicAuth.js'][58]++; + return user == username && pass == password; +}); + } + _$jscoverage['middleware/basicAuth.js'][62]++; + realm = realm || "Authorization Required"; + _$jscoverage['middleware/basicAuth.js'][64]++; + return (function (req, res, next) { + _$jscoverage['middleware/basicAuth.js'][65]++; + var authorization = req.headers.authorization; + _$jscoverage['middleware/basicAuth.js'][67]++; + if (req.user) { + _$jscoverage['middleware/basicAuth.js'][67]++; + return next(); + } + _$jscoverage['middleware/basicAuth.js'][68]++; + if (! authorization) { + _$jscoverage['middleware/basicAuth.js'][68]++; + return unauthorized(res, realm); + } + _$jscoverage['middleware/basicAuth.js'][70]++; + var parts = authorization.split(" "); + _$jscoverage['middleware/basicAuth.js'][72]++; + if (parts.length !== 2) { + _$jscoverage['middleware/basicAuth.js'][72]++; + return next(utils.error(400)); + } + _$jscoverage['middleware/basicAuth.js'][74]++; + var scheme = parts[0], credentials = new Buffer(parts[1], "base64").toString(), index = credentials.indexOf(":"); + _$jscoverage['middleware/basicAuth.js'][78]++; + if ("Basic" != scheme || index < 0) { + _$jscoverage['middleware/basicAuth.js'][78]++; + return next(utils.error(400)); + } + _$jscoverage['middleware/basicAuth.js'][80]++; + var user = credentials.slice(0, index), pass = credentials.slice(index + 1); + _$jscoverage['middleware/basicAuth.js'][84]++; + if (callback.length >= 3) { + _$jscoverage['middleware/basicAuth.js'][85]++; + var pause = utils.pause(req); + _$jscoverage['middleware/basicAuth.js'][86]++; + callback(user, pass, (function (err, user) { + _$jscoverage['middleware/basicAuth.js'][87]++; + if (err || ! user) { + _$jscoverage['middleware/basicAuth.js'][87]++; + return unauthorized(res, realm); + } + _$jscoverage['middleware/basicAuth.js'][88]++; + req.user = req.remoteUser = user; + _$jscoverage['middleware/basicAuth.js'][89]++; + next(); + _$jscoverage['middleware/basicAuth.js'][90]++; + pause.resume(); +})); + } + else { + _$jscoverage['middleware/basicAuth.js'][94]++; + if (callback(user, pass)) { + _$jscoverage['middleware/basicAuth.js'][95]++; + req.user = req.remoteUser = user; + _$jscoverage['middleware/basicAuth.js'][96]++; + next(); + } + else { + _$jscoverage['middleware/basicAuth.js'][98]++; + unauthorized(res, realm); + } + } +}); +}); +_$jscoverage['middleware/basicAuth.js'].source = ["","/*!"," * Connect - basicAuth"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils')"," , unauthorized = utils.unauthorized;","","/**"," * Basic Auth:"," *"," * Enfore basic authentication by providing a `callback(user, pass)`,"," * which must return `true` in order to gain access. Alternatively an async"," * method is provided as well, invoking `callback(user, pass, callback)`. Populates"," * `req.user`. The final alternative is simply passing username / password"," * strings."," *"," * Simple username and password"," *"," * connect(connect.basicAuth('username', 'password'));"," *"," * Callback verification"," *"," * connect()"," * .use(connect.basicAuth(function(user, pass){"," * return 'tj' == user & 'wahoo' == pass;"," * }))"," *"," * Async callback verification, accepting `fn(err, user)`."," *"," * connect()"," * .use(connect.basicAuth(function(user, pass, fn){"," * User.authenticate({ user: user, pass: pass }, fn);"," * }))"," *"," * @param {Function|String} callback or username"," * @param {String} realm"," * @api public"," */","","module.exports = function basicAuth(callback, realm) {"," var username, password;",""," // user / pass strings"," if ('string' == typeof callback) {"," username = callback;"," password = realm;"," if ('string' != typeof password) throw new Error('password argument required');"," realm = arguments[2];"," callback = function(user, pass){"," return user == username && pass == password;"," }"," }",""," realm = realm || 'Authorization Required';",""," return function(req, res, next) {"," var authorization = req.headers.authorization;",""," if (req.user) return next();"," if (!authorization) return unauthorized(res, realm);",""," var parts = authorization.split(' ');",""," if (parts.length !== 2) return next(utils.error(400));",""," var scheme = parts[0]"," , credentials = new Buffer(parts[1], 'base64').toString()"," , index = credentials.indexOf(':');",""," if ('Basic' != scheme || index < 0) return next(utils.error(400));"," "," var user = credentials.slice(0, index)"," , pass = credentials.slice(index + 1);",""," // async"," if (callback.length >= 3) {"," var pause = utils.pause(req);"," callback(user, pass, function(err, user){"," if (err || !user) return unauthorized(res, realm);"," req.user = req.remoteUser = user;"," next();"," pause.resume();"," });"," // sync"," } else {"," if (callback(user, pass)) {"," req.user = req.remoteUser = user;"," next();"," } else {"," unauthorized(res, realm);"," }"," }"," }","};",""]; diff --git a/node_modules/connect/lib-cov/middleware/bodyParser.js b/node_modules/connect/lib-cov/middleware/bodyParser.js new file mode 100644 index 0000000..a108b97 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/bodyParser.js @@ -0,0 +1,43 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/bodyParser.js']) { + _$jscoverage['middleware/bodyParser.js'] = []; + _$jscoverage['middleware/bodyParser.js'][13] = 0; + _$jscoverage['middleware/bodyParser.js'][47] = 0; + _$jscoverage['middleware/bodyParser.js'][48] = 0; + _$jscoverage['middleware/bodyParser.js'][52] = 0; + _$jscoverage['middleware/bodyParser.js'][53] = 0; + _$jscoverage['middleware/bodyParser.js'][54] = 0; + _$jscoverage['middleware/bodyParser.js'][55] = 0; + _$jscoverage['middleware/bodyParser.js'][56] = 0; + _$jscoverage['middleware/bodyParser.js'][57] = 0; +} +_$jscoverage['middleware/bodyParser.js'][13]++; +var multipart = require("./multipart"), urlencoded = require("./urlencoded"), json = require("./json"); +_$jscoverage['middleware/bodyParser.js'][47]++; +exports = module.exports = (function bodyParser(options) { + _$jscoverage['middleware/bodyParser.js'][48]++; + var _urlencoded = urlencoded(options), _multipart = multipart(options), _json = json(options); + _$jscoverage['middleware/bodyParser.js'][52]++; + return (function bodyParser(req, res, next) { + _$jscoverage['middleware/bodyParser.js'][53]++; + _json(req, res, (function (err) { + _$jscoverage['middleware/bodyParser.js'][54]++; + if (err) { + _$jscoverage['middleware/bodyParser.js'][54]++; + return next(err); + } + _$jscoverage['middleware/bodyParser.js'][55]++; + _urlencoded(req, res, (function (err) { + _$jscoverage['middleware/bodyParser.js'][56]++; + if (err) { + _$jscoverage['middleware/bodyParser.js'][56]++; + return next(err); + } + _$jscoverage['middleware/bodyParser.js'][57]++; + _multipart(req, res, next); +})); +})); +}); +}); +_$jscoverage['middleware/bodyParser.js'].source = ["","/*!"," * Connect - bodyParser"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var multipart = require('./multipart')"," , urlencoded = require('./urlencoded')"," , json = require('./json');","","/**"," * Body parser:"," * "," * Parse request bodies, supports _application/json_,"," * _application/x-www-form-urlencoded_, and _multipart/form-data_."," *"," * This is equivalent to: "," *"," * app.use(connect.json());"," * app.use(connect.urlencoded());"," * app.use(connect.multipart());"," *"," * Examples:"," *"," * connect()"," * .use(connect.bodyParser())"," * .use(function(req, res) {"," * res.end('viewing user ' + req.body.user.name);"," * });"," *"," * $ curl -d 'user[name]=tj' http://local/"," * $ curl -d '{\"user\":{\"name\":\"tj\"}}' -H \"Content-Type: application/json\" http://local/"," *"," * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info."," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function bodyParser(options){"," var _urlencoded = urlencoded(options)"," , _multipart = multipart(options)"," , _json = json(options);",""," return function bodyParser(req, res, next) {"," _json(req, res, function(err){"," if (err) return next(err);"," _urlencoded(req, res, function(err){"," if (err) return next(err);"," _multipart(req, res, next);"," });"," });"," }","};"]; diff --git a/node_modules/connect/lib-cov/middleware/compress.js b/node_modules/connect/lib-cov/middleware/compress.js new file mode 100644 index 0000000..aebd5f1 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/compress.js @@ -0,0 +1,159 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/compress.js']) { + _$jscoverage['middleware/compress.js'] = []; + _$jscoverage['middleware/compress.js'][12] = 0; + _$jscoverage['middleware/compress.js'][18] = 0; + _$jscoverage['middleware/compress.js'][27] = 0; + _$jscoverage['middleware/compress.js'][28] = 0; + _$jscoverage['middleware/compress.js'][61] = 0; + _$jscoverage['middleware/compress.js'][62] = 0; + _$jscoverage['middleware/compress.js'][63] = 0; + _$jscoverage['middleware/compress.js'][66] = 0; + _$jscoverage['middleware/compress.js'][67] = 0; + _$jscoverage['middleware/compress.js'][74] = 0; + _$jscoverage['middleware/compress.js'][78] = 0; + _$jscoverage['middleware/compress.js'][79] = 0; + _$jscoverage['middleware/compress.js'][80] = 0; + _$jscoverage['middleware/compress.js'][85] = 0; + _$jscoverage['middleware/compress.js'][86] = 0; + _$jscoverage['middleware/compress.js'][87] = 0; + _$jscoverage['middleware/compress.js'][92] = 0; + _$jscoverage['middleware/compress.js'][93] = 0; + _$jscoverage['middleware/compress.js'][96] = 0; + _$jscoverage['middleware/compress.js'][99] = 0; + _$jscoverage['middleware/compress.js'][102] = 0; + _$jscoverage['middleware/compress.js'][105] = 0; + _$jscoverage['middleware/compress.js'][108] = 0; + _$jscoverage['middleware/compress.js'][111] = 0; + _$jscoverage['middleware/compress.js'][112] = 0; + _$jscoverage['middleware/compress.js'][113] = 0; + _$jscoverage['middleware/compress.js'][114] = 0; + _$jscoverage['middleware/compress.js'][115] = 0; + _$jscoverage['middleware/compress.js'][121] = 0; + _$jscoverage['middleware/compress.js'][124] = 0; + _$jscoverage['middleware/compress.js'][127] = 0; + _$jscoverage['middleware/compress.js'][128] = 0; + _$jscoverage['middleware/compress.js'][132] = 0; + _$jscoverage['middleware/compress.js'][133] = 0; + _$jscoverage['middleware/compress.js'][136] = 0; + _$jscoverage['middleware/compress.js'][137] = 0; + _$jscoverage['middleware/compress.js'][140] = 0; + _$jscoverage['middleware/compress.js'][141] = 0; + _$jscoverage['middleware/compress.js'][145] = 0; +} +_$jscoverage['middleware/compress.js'][12]++; +var zlib = require("zlib"); +_$jscoverage['middleware/compress.js'][18]++; +exports.methods = {gzip: zlib.createGzip, deflate: zlib.createDeflate}; +_$jscoverage['middleware/compress.js'][27]++; +exports.filter = (function (req, res) { + _$jscoverage['middleware/compress.js'][28]++; + return /json|text|javascript/.test(res.getHeader("Content-Type")); +}); +_$jscoverage['middleware/compress.js'][61]++; +module.exports = (function compress(options) { + _$jscoverage['middleware/compress.js'][62]++; + options = options || {}; + _$jscoverage['middleware/compress.js'][63]++; + var names = Object.keys(exports.methods), filter = options.filter || exports.filter; + _$jscoverage['middleware/compress.js'][66]++; + return (function (req, res, next) { + _$jscoverage['middleware/compress.js'][67]++; + var accept = req.headers["accept-encoding"], write = res.write, end = res.end, stream, method; + _$jscoverage['middleware/compress.js'][74]++; + res.setHeader("Vary", "Accept-Encoding"); + _$jscoverage['middleware/compress.js'][78]++; + res.write = (function (chunk, encoding) { + _$jscoverage['middleware/compress.js'][79]++; + if (! this.headerSent) { + _$jscoverage['middleware/compress.js'][79]++; + this._implicitHeader(); + } + _$jscoverage['middleware/compress.js'][80]++; + return stream? stream.write(new Buffer(chunk, encoding)): write.call(res, chunk, encoding); +}); + _$jscoverage['middleware/compress.js'][85]++; + res.end = (function (chunk, encoding) { + _$jscoverage['middleware/compress.js'][86]++; + if (chunk) { + _$jscoverage['middleware/compress.js'][86]++; + this.write(chunk, encoding); + } + _$jscoverage['middleware/compress.js'][87]++; + return stream? stream.end(): end.call(res); +}); + _$jscoverage['middleware/compress.js'][92]++; + res.on("header", (function () { + _$jscoverage['middleware/compress.js'][93]++; + var encoding = res.getHeader("Content-Encoding") || "identity"; + _$jscoverage['middleware/compress.js'][96]++; + if ("identity" != encoding) { + _$jscoverage['middleware/compress.js'][96]++; + return; + } + _$jscoverage['middleware/compress.js'][99]++; + if (! filter(req, res)) { + _$jscoverage['middleware/compress.js'][99]++; + return; + } + _$jscoverage['middleware/compress.js'][102]++; + if (! accept) { + _$jscoverage['middleware/compress.js'][102]++; + return; + } + _$jscoverage['middleware/compress.js'][105]++; + if ("HEAD" == req.method) { + _$jscoverage['middleware/compress.js'][105]++; + return; + } + _$jscoverage['middleware/compress.js'][108]++; + if ("*" == accept.trim()) { + _$jscoverage['middleware/compress.js'][108]++; + method = "gzip"; + } + _$jscoverage['middleware/compress.js'][111]++; + if (! method) { + _$jscoverage['middleware/compress.js'][112]++; + for (var i = 0, len = names.length; i < len; ++i) { + _$jscoverage['middleware/compress.js'][113]++; + if (~ accept.indexOf(names[i])) { + _$jscoverage['middleware/compress.js'][114]++; + method = names[i]; + _$jscoverage['middleware/compress.js'][115]++; + break; + } +} + } + _$jscoverage['middleware/compress.js'][121]++; + if (! method) { + _$jscoverage['middleware/compress.js'][121]++; + return; + } + _$jscoverage['middleware/compress.js'][124]++; + stream = exports.methods[method](options); + _$jscoverage['middleware/compress.js'][127]++; + res.setHeader("Content-Encoding", method); + _$jscoverage['middleware/compress.js'][128]++; + res.removeHeader("Content-Length"); + _$jscoverage['middleware/compress.js'][132]++; + stream.on("data", (function (chunk) { + _$jscoverage['middleware/compress.js'][133]++; + write.call(res, chunk); +})); + _$jscoverage['middleware/compress.js'][136]++; + stream.on("end", (function () { + _$jscoverage['middleware/compress.js'][137]++; + end.call(res); +})); + _$jscoverage['middleware/compress.js'][140]++; + stream.on("drain", (function () { + _$jscoverage['middleware/compress.js'][141]++; + res.emit("drain"); +})); +})); + _$jscoverage['middleware/compress.js'][145]++; + next(); +}); +}); +_$jscoverage['middleware/compress.js'].source = ["/*!"," * Connect - compress"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var zlib = require('zlib');","","/**"," * Supported content-encoding methods."," */","","exports.methods = {"," gzip: zlib.createGzip"," , deflate: zlib.createDeflate","};","","/**"," * Default filter function."," */","","exports.filter = function(req, res){"," return /json|text|javascript/.test(res.getHeader('Content-Type'));","};","","/**"," * Compress:"," *"," * Compress response data with gzip/deflate."," *"," * Filter:"," *"," * A `filter` callback function may be passed to"," * replace the default logic of:"," *"," * exports.filter = function(req, res){"," * return /json|text|javascript/.test(res.getHeader('Content-Type'));"," * };"," *"," * Options:"," *"," * All remaining options are passed to the gzip/deflate"," * creation functions. Consult node's docs for additional details."," *"," * - `chunkSize` (default: 16*1024)"," * - `windowBits`"," * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression"," * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more"," * - `strategy`: compression strategy"," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","module.exports = function compress(options) {"," options = options || {};"," var names = Object.keys(exports.methods)"," , filter = options.filter || exports.filter;",""," return function(req, res, next){"," var accept = req.headers['accept-encoding']"," , write = res.write"," , end = res.end"," , stream"," , method;",""," // vary"," res.setHeader('Vary', 'Accept-Encoding');",""," // proxy",""," res.write = function(chunk, encoding){"," if (!this.headerSent) this._implicitHeader();"," return stream"," ? stream.write(new Buffer(chunk, encoding))"," : write.call(res, chunk, encoding);"," };",""," res.end = function(chunk, encoding){"," if (chunk) this.write(chunk, encoding);"," return stream"," ? stream.end()"," : end.call(res);"," };",""," res.on('header', function(){"," var encoding = res.getHeader('Content-Encoding') || 'identity';",""," // already encoded"," if ('identity' != encoding) return; ",""," // default request filter"," if (!filter(req, res)) return;",""," // SHOULD use identity"," if (!accept) return;",""," // head"," if ('HEAD' == req.method) return;",""," // default to gzip"," if ('*' == accept.trim()) method = 'gzip';",""," // compression method"," if (!method) {"," for (var i = 0, len = names.length; i < len; ++i) {"," if (~accept.indexOf(names[i])) {"," method = names[i];"," break;"," }"," }"," }",""," // compression method"," if (!method) return;",""," // compression stream"," stream = exports.methods[method](options);",""," // header fields"," res.setHeader('Content-Encoding', method);"," res.removeHeader('Content-Length');",""," // compression",""," stream.on('data', function(chunk){"," write.call(res, chunk);"," });",""," stream.on('end', function(){"," end.call(res);"," });",""," stream.on('drain', function() {"," res.emit('drain');"," });"," });",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/cookieParser.js b/node_modules/connect/lib-cov/middleware/cookieParser.js new file mode 100644 index 0000000..7f462d1 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/cookieParser.js @@ -0,0 +1,70 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/cookieParser.js']) { + _$jscoverage['middleware/cookieParser.js'] = []; + _$jscoverage['middleware/cookieParser.js'][13] = 0; + _$jscoverage['middleware/cookieParser.js'][38] = 0; + _$jscoverage['middleware/cookieParser.js'][39] = 0; + _$jscoverage['middleware/cookieParser.js'][40] = 0; + _$jscoverage['middleware/cookieParser.js'][41] = 0; + _$jscoverage['middleware/cookieParser.js'][43] = 0; + _$jscoverage['middleware/cookieParser.js'][44] = 0; + _$jscoverage['middleware/cookieParser.js'][45] = 0; + _$jscoverage['middleware/cookieParser.js'][47] = 0; + _$jscoverage['middleware/cookieParser.js'][48] = 0; + _$jscoverage['middleware/cookieParser.js'][49] = 0; + _$jscoverage['middleware/cookieParser.js'][50] = 0; + _$jscoverage['middleware/cookieParser.js'][51] = 0; + _$jscoverage['middleware/cookieParser.js'][52] = 0; + _$jscoverage['middleware/cookieParser.js'][54] = 0; + _$jscoverage['middleware/cookieParser.js'][56] = 0; + _$jscoverage['middleware/cookieParser.js'][57] = 0; + _$jscoverage['middleware/cookieParser.js'][60] = 0; +} +_$jscoverage['middleware/cookieParser.js'][13]++; +var utils = require("./../utils"), cookie = require("cookie"); +_$jscoverage['middleware/cookieParser.js'][38]++; +module.exports = (function cookieParser(secret) { + _$jscoverage['middleware/cookieParser.js'][39]++; + return (function cookieParser(req, res, next) { + _$jscoverage['middleware/cookieParser.js'][40]++; + if (req.cookies) { + _$jscoverage['middleware/cookieParser.js'][40]++; + return next(); + } + _$jscoverage['middleware/cookieParser.js'][41]++; + var cookies = req.headers.cookie; + _$jscoverage['middleware/cookieParser.js'][43]++; + req.secret = secret; + _$jscoverage['middleware/cookieParser.js'][44]++; + req.cookies = {}; + _$jscoverage['middleware/cookieParser.js'][45]++; + req.signedCookies = {}; + _$jscoverage['middleware/cookieParser.js'][47]++; + if (cookies) { + _$jscoverage['middleware/cookieParser.js'][48]++; + try { + _$jscoverage['middleware/cookieParser.js'][49]++; + req.cookies = cookie.parse(cookies); + _$jscoverage['middleware/cookieParser.js'][50]++; + if (secret) { + _$jscoverage['middleware/cookieParser.js'][51]++; + req.signedCookies = utils.parseSignedCookies(req.cookies, secret); + _$jscoverage['middleware/cookieParser.js'][52]++; + req.signedCookies = utils.parseJSONCookies(req.signedCookies); + } + _$jscoverage['middleware/cookieParser.js'][54]++; + req.cookies = utils.parseJSONCookies(req.cookies); + } + catch (err) { + _$jscoverage['middleware/cookieParser.js'][56]++; + err.status = 400; + _$jscoverage['middleware/cookieParser.js'][57]++; + return next(err); + } + } + _$jscoverage['middleware/cookieParser.js'][60]++; + next(); +}); +}); +_$jscoverage['middleware/cookieParser.js'].source = ["","/*!"," * Connect - cookieParser"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('./../utils')"," , cookie = require('cookie');","","/**"," * Cookie parser:"," *"," * Parse _Cookie_ header and populate `req.cookies`"," * with an object keyed by the cookie names. Optionally"," * you may enabled signed cookie support by passing"," * a `secret` string, which assigns `req.secret` so"," * it may be used by other middleware."," *"," * Examples:"," *"," * connect()"," * .use(connect.cookieParser('optional secret string'))"," * .use(function(req, res, next){"," * res.end(JSON.stringify(req.cookies));"," * })"," *"," * @param {String} secret"," * @return {Function}"," * @api public"," */","","module.exports = function cookieParser(secret){"," return function cookieParser(req, res, next) {"," if (req.cookies) return next();"," var cookies = req.headers.cookie;",""," req.secret = secret;"," req.cookies = {};"," req.signedCookies = {};",""," if (cookies) {"," try {"," req.cookies = cookie.parse(cookies);"," if (secret) {"," req.signedCookies = utils.parseSignedCookies(req.cookies, secret);"," req.signedCookies = utils.parseJSONCookies(req.signedCookies);"," }"," req.cookies = utils.parseJSONCookies(req.cookies);"," } catch (err) {"," err.status = 400;"," return next(err);"," }"," }"," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/cookieSession.js b/node_modules/connect/lib-cov/middleware/cookieSession.js new file mode 100644 index 0000000..e54fa47 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/cookieSession.js @@ -0,0 +1,132 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/cookieSession.js']) { + _$jscoverage['middleware/cookieSession.js'] = []; + _$jscoverage['middleware/cookieSession.js'][12] = 0; + _$jscoverage['middleware/cookieSession.js'][46] = 0; + _$jscoverage['middleware/cookieSession.js'][48] = 0; + _$jscoverage['middleware/cookieSession.js'][49] = 0; + _$jscoverage['middleware/cookieSession.js'][52] = 0; + _$jscoverage['middleware/cookieSession.js'][55] = 0; + _$jscoverage['middleware/cookieSession.js'][56] = 0; + _$jscoverage['middleware/cookieSession.js'][59] = 0; + _$jscoverage['middleware/cookieSession.js'][60] = 0; + _$jscoverage['middleware/cookieSession.js'][63] = 0; + _$jscoverage['middleware/cookieSession.js'][66] = 0; + _$jscoverage['middleware/cookieSession.js'][67] = 0; + _$jscoverage['middleware/cookieSession.js'][70] = 0; + _$jscoverage['middleware/cookieSession.js'][71] = 0; + _$jscoverage['middleware/cookieSession.js'][72] = 0; + _$jscoverage['middleware/cookieSession.js'][73] = 0; + _$jscoverage['middleware/cookieSession.js'][74] = 0; + _$jscoverage['middleware/cookieSession.js'][75] = 0; + _$jscoverage['middleware/cookieSession.js'][80] = 0; + _$jscoverage['middleware/cookieSession.js'][82] = 0; + _$jscoverage['middleware/cookieSession.js'][83] = 0; + _$jscoverage['middleware/cookieSession.js'][84] = 0; + _$jscoverage['middleware/cookieSession.js'][85] = 0; + _$jscoverage['middleware/cookieSession.js'][86] = 0; + _$jscoverage['middleware/cookieSession.js'][89] = 0; + _$jscoverage['middleware/cookieSession.js'][92] = 0; + _$jscoverage['middleware/cookieSession.js'][97] = 0; + _$jscoverage['middleware/cookieSession.js'][100] = 0; + _$jscoverage['middleware/cookieSession.js'][101] = 0; + _$jscoverage['middleware/cookieSession.js'][104] = 0; + _$jscoverage['middleware/cookieSession.js'][107] = 0; + _$jscoverage['middleware/cookieSession.js'][108] = 0; + _$jscoverage['middleware/cookieSession.js'][109] = 0; + _$jscoverage['middleware/cookieSession.js'][110] = 0; + _$jscoverage['middleware/cookieSession.js'][113] = 0; +} +_$jscoverage['middleware/cookieSession.js'][12]++; +var utils = require("./../utils"), Cookie = require("./session/cookie"), debug = require("debug")("connect:cookieSession"), signature = require("cookie-signature"), crc16 = require("crc").crc16; +_$jscoverage['middleware/cookieSession.js'][46]++; +module.exports = (function cookieSession(options) { + _$jscoverage['middleware/cookieSession.js'][48]++; + options = options || {}; + _$jscoverage['middleware/cookieSession.js'][49]++; + var key = options.key || "connect.sess", trustProxy = options.proxy; + _$jscoverage['middleware/cookieSession.js'][52]++; + return (function cookieSession(req, res, next) { + _$jscoverage['middleware/cookieSession.js'][55]++; + var secret = options.secret || req.secret; + _$jscoverage['middleware/cookieSession.js'][56]++; + if (! secret) { + _$jscoverage['middleware/cookieSession.js'][56]++; + throw new Error("`secret` option required for cookie sessions"); + } + _$jscoverage['middleware/cookieSession.js'][59]++; + req.session = {}; + _$jscoverage['middleware/cookieSession.js'][60]++; + var cookie = req.session.cookie = new Cookie(options.cookie); + _$jscoverage['middleware/cookieSession.js'][63]++; + if (0 != req.originalUrl.indexOf(cookie.path)) { + _$jscoverage['middleware/cookieSession.js'][63]++; + return next(); + } + _$jscoverage['middleware/cookieSession.js'][66]++; + if (! options.secret && req.secret) { + _$jscoverage['middleware/cookieSession.js'][67]++; + req.session = req.signedCookies[key] || {}; + } + else { + _$jscoverage['middleware/cookieSession.js'][70]++; + var rawCookie = req.cookies[key]; + _$jscoverage['middleware/cookieSession.js'][71]++; + if (rawCookie) { + _$jscoverage['middleware/cookieSession.js'][72]++; + var unsigned = utils.parseSignedCookie(rawCookie, secret); + _$jscoverage['middleware/cookieSession.js'][73]++; + if (unsigned) { + _$jscoverage['middleware/cookieSession.js'][74]++; + var originalHash = crc16(unsigned); + _$jscoverage['middleware/cookieSession.js'][75]++; + req.session = utils.parseJSONCookie(unsigned) || {}; + } + } + } + _$jscoverage['middleware/cookieSession.js'][80]++; + res.on("header", (function () { + _$jscoverage['middleware/cookieSession.js'][82]++; + if (! req.session) { + _$jscoverage['middleware/cookieSession.js'][83]++; + debug("clear session"); + _$jscoverage['middleware/cookieSession.js'][84]++; + cookie.expires = new Date(0); + _$jscoverage['middleware/cookieSession.js'][85]++; + res.setHeader("Set-Cookie", cookie.serialize(key, "")); + _$jscoverage['middleware/cookieSession.js'][86]++; + return; + } + _$jscoverage['middleware/cookieSession.js'][89]++; + delete req.session.cookie; + _$jscoverage['middleware/cookieSession.js'][92]++; + var proto = (req.headers["x-forwarded-proto"] || "").toLowerCase(), tls = req.connection.encrypted || (trustProxy && "https" == proto), secured = cookie.secure && tls; + _$jscoverage['middleware/cookieSession.js'][97]++; + if (cookie.secure && ! secured) { + _$jscoverage['middleware/cookieSession.js'][97]++; + return debug("not secured"); + } + _$jscoverage['middleware/cookieSession.js'][100]++; + debug("serializing %j", req.session); + _$jscoverage['middleware/cookieSession.js'][101]++; + var val = "j:" + JSON.stringify(req.session); + _$jscoverage['middleware/cookieSession.js'][104]++; + if (originalHash == crc16(val)) { + _$jscoverage['middleware/cookieSession.js'][104]++; + return debug("unmodified session"); + } + _$jscoverage['middleware/cookieSession.js'][107]++; + val = "s:" + signature.sign(val, secret); + _$jscoverage['middleware/cookieSession.js'][108]++; + val = cookie.serialize(key, val); + _$jscoverage['middleware/cookieSession.js'][109]++; + debug("set-cookie %j", cookie); + _$jscoverage['middleware/cookieSession.js'][110]++; + res.setHeader("Set-Cookie", val); +})); + _$jscoverage['middleware/cookieSession.js'][113]++; + next(); +}); +}); +_$jscoverage['middleware/cookieSession.js'].source = ["","/*!"," * Connect - cookieSession"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('./../utils')"," , Cookie = require('./session/cookie')"," , debug = require('debug')('connect:cookieSession')"," , signature = require('cookie-signature')"," , crc16 = require('crc').crc16;","","/**"," * Cookie Session:"," *"," * Cookie session middleware."," *"," * var app = connect();"," * app.use(connect.cookieParser());"," * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));"," *"," * Options:"," *"," * - `key` cookie name defaulting to `connect.sess`"," * - `secret` prevents cookie tampering"," * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`"," * - `proxy` trust the reverse proxy when setting secure cookies (via \"x-forwarded-proto\")"," *"," * Clearing sessions:"," *"," * To clear the session simply set its value to `null`,"," * `cookieSession()` will then respond with a 1970 Set-Cookie."," *"," * req.session = null;"," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","module.exports = function cookieSession(options){"," // TODO: utilize Session/Cookie to unify API"," options = options || {};"," var key = options.key || 'connect.sess'"," , trustProxy = options.proxy;",""," return function cookieSession(req, res, next) {",""," // req.secret is for backwards compatibility"," var secret = options.secret || req.secret;"," if (!secret) throw new Error('`secret` option required for cookie sessions');",""," // default session"," req.session = {};"," var cookie = req.session.cookie = new Cookie(options.cookie);",""," // pathname mismatch"," if (0 != req.originalUrl.indexOf(cookie.path)) return next();",""," // cookieParser secret"," if (!options.secret && req.secret) {"," req.session = req.signedCookies[key] || {};"," } else {"," // TODO: refactor"," var rawCookie = req.cookies[key];"," if (rawCookie) {"," var unsigned = utils.parseSignedCookie(rawCookie, secret);"," if (unsigned) {"," var originalHash = crc16(unsigned);"," req.session = utils.parseJSONCookie(unsigned) || {};"," }"," }"," }",""," res.on('header', function(){"," // removed"," if (!req.session) {"," debug('clear session');"," cookie.expires = new Date(0);"," res.setHeader('Set-Cookie', cookie.serialize(key, ''));"," return;"," }",""," delete req.session.cookie;",""," // check security"," var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()"," , tls = req.connection.encrypted || (trustProxy && 'https' == proto)"," , secured = cookie.secure && tls;",""," // only send secure cookies via https"," if (cookie.secure && !secured) return debug('not secured');",""," // serialize"," debug('serializing %j', req.session);"," var val = 'j:' + JSON.stringify(req.session);",""," // compare hashes, no need to set-cookie if unchanged"," if (originalHash == crc16(val)) return debug('unmodified session');",""," // set-cookie"," val = 's:' + signature.sign(val, secret);"," val = cookie.serialize(key, val);"," debug('set-cookie %j', cookie);"," res.setHeader('Set-Cookie', val);"," });",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/csrf.js b/node_modules/connect/lib-cov/middleware/csrf.js new file mode 100644 index 0000000..f3919ed --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/csrf.js @@ -0,0 +1,51 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/csrf.js']) { + _$jscoverage['middleware/csrf.js'] = []; + _$jscoverage['middleware/csrf.js'][11] = 0; + _$jscoverage['middleware/csrf.js'][39] = 0; + _$jscoverage['middleware/csrf.js'][40] = 0; + _$jscoverage['middleware/csrf.js'][41] = 0; + _$jscoverage['middleware/csrf.js'][43] = 0; + _$jscoverage['middleware/csrf.js'][45] = 0; + _$jscoverage['middleware/csrf.js'][48] = 0; + _$jscoverage['middleware/csrf.js'][51] = 0; + _$jscoverage['middleware/csrf.js'][54] = 0; + _$jscoverage['middleware/csrf.js'][56] = 0; + _$jscoverage['middleware/csrf.js'][69] = 0; + _$jscoverage['middleware/csrf.js'][70] = 0; +} +_$jscoverage['middleware/csrf.js'][11]++; +var utils = require("../utils"); +_$jscoverage['middleware/csrf.js'][39]++; +module.exports = (function csrf(options) { + _$jscoverage['middleware/csrf.js'][40]++; + options = options || {}; + _$jscoverage['middleware/csrf.js'][41]++; + var value = options.value || defaultValue; + _$jscoverage['middleware/csrf.js'][43]++; + return (function (req, res, next) { + _$jscoverage['middleware/csrf.js'][45]++; + var token = req.session._csrf || (req.session._csrf = utils.uid(24)); + _$jscoverage['middleware/csrf.js'][48]++; + if ("GET" == req.method || "HEAD" == req.method || "OPTIONS" == req.method) { + _$jscoverage['middleware/csrf.js'][48]++; + return next(); + } + _$jscoverage['middleware/csrf.js'][51]++; + var val = value(req); + _$jscoverage['middleware/csrf.js'][54]++; + if (val != token) { + _$jscoverage['middleware/csrf.js'][54]++; + return next(utils.error(403)); + } + _$jscoverage['middleware/csrf.js'][56]++; + next(); +}); +}); +_$jscoverage['middleware/csrf.js'][69]++; +function defaultValue(req) { + _$jscoverage['middleware/csrf.js'][70]++; + return (req.body && req.body._csrf) || (req.query && req.query._csrf) || req.headers["x-csrf-token"]; +} +_$jscoverage['middleware/csrf.js'].source = ["/*!"," * Connect - csrf"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils');","","/**"," * Anti CSRF:"," *"," * CRSF protection middleware."," *"," * By default this middleware generates a token named \"_csrf\""," * which should be added to requests which mutate"," * state, within a hidden form field, query-string etc. This"," * token is validated against the visitor's `req.session._csrf`"," * property."," *"," * The default `value` function checks `req.body` generated"," * by the `bodyParser()` middleware, `req.query` generated"," * by `query()`, and the \"X-CSRF-Token\" header field."," *"," * This middleware requires session support, thus should be added"," * somewhere _below_ `session()` and `cookieParser()`."," *"," * Options:"," *"," * - `value` a function accepting the request, returning the token "," *"," * @param {Object} options"," * @api public"," */","","module.exports = function csrf(options) {"," options = options || {};"," var value = options.value || defaultValue;",""," return function(req, res, next){"," // generate CSRF token"," var token = req.session._csrf || (req.session._csrf = utils.uid(24));",""," // ignore these methods"," if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();",""," // determine value"," var val = value(req);",""," // check"," if (val != token) return next(utils.error(403));"," "," next();"," }","};","","/**"," * Default value function, checking the `req.body`"," * and `req.query` for the CSRF token."," *"," * @param {IncomingMessage} req"," * @return {String}"," * @api private"," */","","function defaultValue(req) {"," return (req.body && req.body._csrf)"," || (req.query && req.query._csrf)"," || (req.headers['x-csrf-token']);","}"]; diff --git a/node_modules/connect/lib-cov/middleware/directory.js b/node_modules/connect/lib-cov/middleware/directory.js new file mode 100644 index 0000000..bc86b60 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/directory.js @@ -0,0 +1,256 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/directory.js']) { + _$jscoverage['middleware/directory.js'] = []; + _$jscoverage['middleware/directory.js'][17] = 0; + _$jscoverage['middleware/directory.js'][29] = 0; + _$jscoverage['middleware/directory.js'][48] = 0; + _$jscoverage['middleware/directory.js'][49] = 0; + _$jscoverage['middleware/directory.js'][52] = 0; + _$jscoverage['middleware/directory.js'][53] = 0; + _$jscoverage['middleware/directory.js'][58] = 0; + _$jscoverage['middleware/directory.js'][59] = 0; + _$jscoverage['middleware/directory.js'][61] = 0; + _$jscoverage['middleware/directory.js'][70] = 0; + _$jscoverage['middleware/directory.js'][73] = 0; + _$jscoverage['middleware/directory.js'][76] = 0; + _$jscoverage['middleware/directory.js'][77] = 0; + _$jscoverage['middleware/directory.js'][81] = 0; + _$jscoverage['middleware/directory.js'][84] = 0; + _$jscoverage['middleware/directory.js'][85] = 0; + _$jscoverage['middleware/directory.js'][86] = 0; + _$jscoverage['middleware/directory.js'][87] = 0; + _$jscoverage['middleware/directory.js'][88] = 0; + _$jscoverage['middleware/directory.js'][91] = 0; + _$jscoverage['middleware/directory.js'][92] = 0; + _$jscoverage['middleware/directory.js'][93] = 0; + _$jscoverage['middleware/directory.js'][94] = 0; + _$jscoverage['middleware/directory.js'][99] = 0; + _$jscoverage['middleware/directory.js'][109] = 0; + _$jscoverage['middleware/directory.js'][110] = 0; + _$jscoverage['middleware/directory.js'][111] = 0; + _$jscoverage['middleware/directory.js'][112] = 0; + _$jscoverage['middleware/directory.js'][113] = 0; + _$jscoverage['middleware/directory.js'][114] = 0; + _$jscoverage['middleware/directory.js'][115] = 0; + _$jscoverage['middleware/directory.js'][120] = 0; + _$jscoverage['middleware/directory.js'][121] = 0; + _$jscoverage['middleware/directory.js'][122] = 0; + _$jscoverage['middleware/directory.js'][131] = 0; + _$jscoverage['middleware/directory.js'][132] = 0; + _$jscoverage['middleware/directory.js'][133] = 0; + _$jscoverage['middleware/directory.js'][134] = 0; + _$jscoverage['middleware/directory.js'][135] = 0; + _$jscoverage['middleware/directory.js'][142] = 0; + _$jscoverage['middleware/directory.js'][143] = 0; + _$jscoverage['middleware/directory.js'][144] = 0; + _$jscoverage['middleware/directory.js'][145] = 0; + _$jscoverage['middleware/directory.js'][146] = 0; + _$jscoverage['middleware/directory.js'][153] = 0; + _$jscoverage['middleware/directory.js'][154] = 0; + _$jscoverage['middleware/directory.js'][155] = 0; + _$jscoverage['middleware/directory.js'][156] = 0; + _$jscoverage['middleware/directory.js'][157] = 0; + _$jscoverage['middleware/directory.js'][165] = 0; + _$jscoverage['middleware/directory.js'][166] = 0; + _$jscoverage['middleware/directory.js'][167] = 0; + _$jscoverage['middleware/directory.js'][170] = 0; + _$jscoverage['middleware/directory.js'][171] = 0; + _$jscoverage['middleware/directory.js'][172] = 0; + _$jscoverage['middleware/directory.js'][173] = 0; + _$jscoverage['middleware/directory.js'][176] = 0; + _$jscoverage['middleware/directory.js'][194] = 0; + _$jscoverage['middleware/directory.js'][195] = 0; + _$jscoverage['middleware/directory.js'][196] = 0; + _$jscoverage['middleware/directory.js'][208] = 0; + _$jscoverage['middleware/directory.js'][209] = 0; + _$jscoverage['middleware/directory.js'][210] = 0; + _$jscoverage['middleware/directory.js'][218] = 0; +} +_$jscoverage['middleware/directory.js'][17]++; +var fs = require("fs"), parse = require("url").parse, utils = require("../utils"), path = require("path"), normalize = path.normalize, extname = path.extname, join = path.join; +_$jscoverage['middleware/directory.js'][29]++; +var cache = {}; +_$jscoverage['middleware/directory.js'][48]++; +exports = module.exports = (function directory(root, options) { + _$jscoverage['middleware/directory.js'][49]++; + options = options || {}; + _$jscoverage['middleware/directory.js'][52]++; + if (! root) { + _$jscoverage['middleware/directory.js'][52]++; + throw new Error("directory() root path required"); + } + _$jscoverage['middleware/directory.js'][53]++; + var hidden = options.hidden, icons = options.icons, filter = options.filter, root = normalize(root); + _$jscoverage['middleware/directory.js'][58]++; + return (function directory(req, res, next) { + _$jscoverage['middleware/directory.js'][59]++; + if ("GET" != req.method && "HEAD" != req.method) { + _$jscoverage['middleware/directory.js'][59]++; + return next(); + } + _$jscoverage['middleware/directory.js'][61]++; + var accept = req.headers.accept || "text/plain", url = parse(req.url), dir = decodeURIComponent(url.pathname), path = normalize(join(root, dir)), originalUrl = parse(req.originalUrl), originalDir = decodeURIComponent(originalUrl.pathname), showUp = path != root && path != root + "/"; + _$jscoverage['middleware/directory.js'][70]++; + if (~ path.indexOf("\u0000")) { + _$jscoverage['middleware/directory.js'][70]++; + return next(utils.error(400)); + } + _$jscoverage['middleware/directory.js'][73]++; + if (0 != path.indexOf(root)) { + _$jscoverage['middleware/directory.js'][73]++; + return next(utils.error(403)); + } + _$jscoverage['middleware/directory.js'][76]++; + fs.stat(path, (function (err, stat) { + _$jscoverage['middleware/directory.js'][77]++; + if (err) { + _$jscoverage['middleware/directory.js'][77]++; + return "ENOENT" == err.code? next(): next(err); + } + _$jscoverage['middleware/directory.js'][81]++; + if (! stat.isDirectory()) { + _$jscoverage['middleware/directory.js'][81]++; + return next(); + } + _$jscoverage['middleware/directory.js'][84]++; + fs.readdir(path, (function (err, files) { + _$jscoverage['middleware/directory.js'][85]++; + if (err) { + _$jscoverage['middleware/directory.js'][85]++; + return next(err); + } + _$jscoverage['middleware/directory.js'][86]++; + if (! hidden) { + _$jscoverage['middleware/directory.js'][86]++; + files = removeHidden(files); + } + _$jscoverage['middleware/directory.js'][87]++; + if (filter) { + _$jscoverage['middleware/directory.js'][87]++; + files = files.filter(filter); + } + _$jscoverage['middleware/directory.js'][88]++; + files.sort(); + _$jscoverage['middleware/directory.js'][91]++; + for (var key in exports) { + _$jscoverage['middleware/directory.js'][92]++; + if (~ accept.indexOf(key) || ~ accept.indexOf("*/*")) { + _$jscoverage['middleware/directory.js'][93]++; + exports[key](req, res, files, next, originalDir, showUp, icons); + _$jscoverage['middleware/directory.js'][94]++; + return; + } +} + _$jscoverage['middleware/directory.js'][99]++; + next(utils.error(406)); +})); +})); +}); +}); +_$jscoverage['middleware/directory.js'][109]++; +exports.html = (function (req, res, files, next, dir, showUp, icons) { + _$jscoverage['middleware/directory.js'][110]++; + fs.readFile(__dirname + "/../public/directory.html", "utf8", (function (err, str) { + _$jscoverage['middleware/directory.js'][111]++; + if (err) { + _$jscoverage['middleware/directory.js'][111]++; + return next(err); + } + _$jscoverage['middleware/directory.js'][112]++; + fs.readFile(__dirname + "/../public/style.css", "utf8", (function (err, style) { + _$jscoverage['middleware/directory.js'][113]++; + if (err) { + _$jscoverage['middleware/directory.js'][113]++; + return next(err); + } + _$jscoverage['middleware/directory.js'][114]++; + if (showUp) { + _$jscoverage['middleware/directory.js'][114]++; + files.unshift(".."); + } + _$jscoverage['middleware/directory.js'][115]++; + str = str.replace("{style}", style).replace("{files}", html(files, dir, icons)).replace("{directory}", dir).replace("{linked-path}", htmlPath(dir)); + _$jscoverage['middleware/directory.js'][120]++; + res.setHeader("Content-Type", "text/html"); + _$jscoverage['middleware/directory.js'][121]++; + res.setHeader("Content-Length", str.length); + _$jscoverage['middleware/directory.js'][122]++; + res.end(str); +})); +})); +}); +_$jscoverage['middleware/directory.js'][131]++; +exports.json = (function (req, res, files) { + _$jscoverage['middleware/directory.js'][132]++; + files = JSON.stringify(files); + _$jscoverage['middleware/directory.js'][133]++; + res.setHeader("Content-Type", "application/json"); + _$jscoverage['middleware/directory.js'][134]++; + res.setHeader("Content-Length", files.length); + _$jscoverage['middleware/directory.js'][135]++; + res.end(files); +}); +_$jscoverage['middleware/directory.js'][142]++; +exports.plain = (function (req, res, files) { + _$jscoverage['middleware/directory.js'][143]++; + files = files.join("\n") + "\n"; + _$jscoverage['middleware/directory.js'][144]++; + res.setHeader("Content-Type", "text/plain"); + _$jscoverage['middleware/directory.js'][145]++; + res.setHeader("Content-Length", files.length); + _$jscoverage['middleware/directory.js'][146]++; + res.end(files); +}); +_$jscoverage['middleware/directory.js'][153]++; +function htmlPath(dir) { + _$jscoverage['middleware/directory.js'][154]++; + var curr = []; + _$jscoverage['middleware/directory.js'][155]++; + return dir.split("/").map((function (part) { + _$jscoverage['middleware/directory.js'][156]++; + curr.push(part); + _$jscoverage['middleware/directory.js'][157]++; + return "" + part + ""; +})).join(" / "); +} +_$jscoverage['middleware/directory.js'][165]++; +function html(files, dir, useIcons) { + _$jscoverage['middleware/directory.js'][166]++; + return ""; +} +_$jscoverage['middleware/directory.js'][194]++; +function load(icon) { + _$jscoverage['middleware/directory.js'][195]++; + if (cache[icon]) { + _$jscoverage['middleware/directory.js'][195]++; + return cache[icon]; + } + _$jscoverage['middleware/directory.js'][196]++; + return cache[icon] = fs.readFileSync(__dirname + "/../public/icons/" + icon, "base64"); +} +_$jscoverage['middleware/directory.js'][208]++; +function removeHidden(files) { + _$jscoverage['middleware/directory.js'][209]++; + return files.filter((function (file) { + _$jscoverage['middleware/directory.js'][210]++; + return "." != file[0]; +})); +} +_$jscoverage['middleware/directory.js'][218]++; +var icons = {".js": "page_white_code_red.png", ".c": "page_white_c.png", ".h": "page_white_h.png", ".cc": "page_white_cplusplus.png", ".php": "page_white_php.png", ".rb": "page_white_ruby.png", ".cpp": "page_white_cplusplus.png", ".swf": "page_white_flash.png", ".pdf": "page_white_acrobat.png", "default": "page_white.png"}; +_$jscoverage['middleware/directory.js'].source = ["","/*!"," * Connect - directory"," * Copyright(c) 2011 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","// TODO: icon / style for directories","// TODO: arrow key navigation","// TODO: make icons extensible","","/**"," * Module dependencies."," */","","var fs = require('fs')"," , parse = require('url').parse"," , utils = require('../utils')"," , path = require('path')"," , normalize = path.normalize"," , extname = path.extname"," , join = path.join;","","/*!"," * Icon cache."," */","","var cache = {};","","/**"," * Directory:"," *"," * Serve directory listings with the given `root` path."," *"," * Options:"," *"," * - `hidden` display hidden (dot) files. Defaults to false."," * - `icons` display icons. Defaults to false."," * - `filter` Apply this filter function to files. Defaults to false."," *"," * @param {String} root"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function directory(root, options){"," options = options || {};",""," // root required"," if (!root) throw new Error('directory() root path required');"," var hidden = options.hidden"," , icons = options.icons"," , filter = options.filter"," , root = normalize(root);",""," return function directory(req, res, next) {"," if ('GET' != req.method && 'HEAD' != req.method) return next();",""," var accept = req.headers.accept || 'text/plain'"," , url = parse(req.url)"," , dir = decodeURIComponent(url.pathname)"," , path = normalize(join(root, dir))"," , originalUrl = parse(req.originalUrl)"," , originalDir = decodeURIComponent(originalUrl.pathname)"," , showUp = path != root && path != root + '/';",""," // null byte(s), bad request"," if (~path.indexOf('\\0')) return next(utils.error(400));",""," // malicious path, forbidden"," if (0 != path.indexOf(root)) return next(utils.error(403));",""," // check if we have a directory"," fs.stat(path, function(err, stat){"," if (err) return 'ENOENT' == err.code"," ? next()"," : next(err);",""," if (!stat.isDirectory()) return next();",""," // fetch files"," fs.readdir(path, function(err, files){"," if (err) return next(err);"," if (!hidden) files = removeHidden(files);"," if (filter) files = files.filter(filter);"," files.sort();",""," // content-negotiation"," for (var key in exports) {"," if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {"," exports[key](req, res, files, next, originalDir, showUp, icons);"," return;"," }"," }",""," // not acceptable"," next(utils.error(406));"," });"," });"," };","};","","/**"," * Respond with text/html."," */","","exports.html = function(req, res, files, next, dir, showUp, icons){"," fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){"," if (err) return next(err);"," fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){"," if (err) return next(err);"," if (showUp) files.unshift('..');"," str = str"," .replace('{style}', style)"," .replace('{files}', html(files, dir, icons))"," .replace('{directory}', dir)"," .replace('{linked-path}', htmlPath(dir));"," res.setHeader('Content-Type', 'text/html');"," res.setHeader('Content-Length', str.length);"," res.end(str);"," });"," });","};","","/**"," * Respond with application/json."," */","","exports.json = function(req, res, files){"," files = JSON.stringify(files);"," res.setHeader('Content-Type', 'application/json');"," res.setHeader('Content-Length', files.length);"," res.end(files);","};","","/**"," * Respond with text/plain."," */","","exports.plain = function(req, res, files){"," files = files.join('\\n') + '\\n';"," res.setHeader('Content-Type', 'text/plain');"," res.setHeader('Content-Length', files.length);"," res.end(files);","};","","/**"," * Map html `dir`, returning a linked path."," */","","function htmlPath(dir) {"," var curr = [];"," return dir.split('/').map(function(part){"," curr.push(part);"," return '<a href=\"' + curr.join('/') + '\">' + part + '</a>';"," }).join(' / ');","}","","/**"," * Map html `files`, returning an html unordered list."," */","","function html(files, dir, useIcons) {"," return '<ul id=\"files\">' + files.map(function(file){"," var icon = ''"," , classes = [];",""," if (useIcons && '..' != file) {"," icon = icons[extname(file)] || icons.default;"," icon = '<img src=\"data:image/png;base64,' + load(icon) + '\" />';"," classes.push('icon');"," }",""," return '<li><a href=\"'"," + join(dir, file)"," + '\" class=\"'"," + classes.join(' ') + '\"'"," + ' title=\"' + file + '\">'"," + icon + file + '</a></li>';",""," }).join('\\n') + '</ul>';","}","","/**"," * Load and cache the given `icon`."," *"," * @param {String} icon"," * @return {String}"," * @api private"," */","","function load(icon) {"," if (cache[icon]) return cache[icon];"," return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');","}","","/**"," * Filter \"hidden\" `files`, aka files"," * beginning with a `.`."," *"," * @param {Array} files"," * @return {Array}"," * @api private"," */","","function removeHidden(files) {"," return files.filter(function(file){"," return '.' != file[0];"," });","}","","/**"," * Icon map."," */","","var icons = {"," '.js': 'page_white_code_red.png'"," , '.c': 'page_white_c.png'"," , '.h': 'page_white_h.png'"," , '.cc': 'page_white_cplusplus.png'"," , '.php': 'page_white_php.png'"," , '.rb': 'page_white_ruby.png'"," , '.cpp': 'page_white_cplusplus.png'"," , '.swf': 'page_white_flash.png'"," , '.pdf': 'page_white_acrobat.png'"," , 'default': 'page_white.png'","};"]; diff --git a/node_modules/connect/lib-cov/middleware/errorHandler.js b/node_modules/connect/lib-cov/middleware/errorHandler.js new file mode 100644 index 0000000..9a87bfa --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/errorHandler.js @@ -0,0 +1,104 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/errorHandler.js']) { + _$jscoverage['middleware/errorHandler.js'] = []; + _$jscoverage['middleware/errorHandler.js'][12] = 0; + _$jscoverage['middleware/errorHandler.js'][17] = 0; + _$jscoverage['middleware/errorHandler.js'][44] = 0; + _$jscoverage['middleware/errorHandler.js'][45] = 0; + _$jscoverage['middleware/errorHandler.js'][46] = 0; + _$jscoverage['middleware/errorHandler.js'][47] = 0; + _$jscoverage['middleware/errorHandler.js'][48] = 0; + _$jscoverage['middleware/errorHandler.js'][49] = 0; + _$jscoverage['middleware/errorHandler.js'][51] = 0; + _$jscoverage['middleware/errorHandler.js'][52] = 0; + _$jscoverage['middleware/errorHandler.js'][53] = 0; + _$jscoverage['middleware/errorHandler.js'][54] = 0; + _$jscoverage['middleware/errorHandler.js'][56] = 0; + _$jscoverage['middleware/errorHandler.js'][57] = 0; + _$jscoverage['middleware/errorHandler.js'][63] = 0; + _$jscoverage['middleware/errorHandler.js'][64] = 0; + _$jscoverage['middleware/errorHandler.js'][68] = 0; + _$jscoverage['middleware/errorHandler.js'][69] = 0; + _$jscoverage['middleware/errorHandler.js'][70] = 0; + _$jscoverage['middleware/errorHandler.js'][71] = 0; + _$jscoverage['middleware/errorHandler.js'][72] = 0; + _$jscoverage['middleware/errorHandler.js'][73] = 0; + _$jscoverage['middleware/errorHandler.js'][76] = 0; + _$jscoverage['middleware/errorHandler.js'][77] = 0; + _$jscoverage['middleware/errorHandler.js'][86] = 0; +} +_$jscoverage['middleware/errorHandler.js'][12]++; +var utils = require("../utils"), fs = require("fs"); +_$jscoverage['middleware/errorHandler.js'][17]++; +var env = process.env.NODE_ENV || "development"; +_$jscoverage['middleware/errorHandler.js'][44]++; +exports = module.exports = (function errorHandler() { + _$jscoverage['middleware/errorHandler.js'][45]++; + return (function errorHandler(err, req, res, next) { + _$jscoverage['middleware/errorHandler.js'][46]++; + if (err.status) { + _$jscoverage['middleware/errorHandler.js'][46]++; + res.statusCode = err.status; + } + _$jscoverage['middleware/errorHandler.js'][47]++; + if (res.statusCode < 400) { + _$jscoverage['middleware/errorHandler.js'][47]++; + res.statusCode = 500; + } + _$jscoverage['middleware/errorHandler.js'][48]++; + if ("test" != env) { + _$jscoverage['middleware/errorHandler.js'][48]++; + console.error(err.stack); + } + _$jscoverage['middleware/errorHandler.js'][49]++; + var accept = req.headers.accept || ""; + _$jscoverage['middleware/errorHandler.js'][51]++; + if (~ accept.indexOf("html")) { + _$jscoverage['middleware/errorHandler.js'][52]++; + fs.readFile(__dirname + "/../public/style.css", "utf8", (function (e, style) { + _$jscoverage['middleware/errorHandler.js'][53]++; + fs.readFile(__dirname + "/../public/error.html", "utf8", (function (e, html) { + _$jscoverage['middleware/errorHandler.js'][54]++; + var stack = (err.stack || "").split("\n").slice(1).map((function (v) { + _$jscoverage['middleware/errorHandler.js'][56]++; + return "
  • " + v + "
  • "; +})).join(""); + _$jscoverage['middleware/errorHandler.js'][57]++; + html = html.replace("{style}", style).replace("{stack}", stack).replace("{title}", exports.title).replace("{statusCode}", res.statusCode).replace(/\{error\}/g, utils.escape(err.toString())); + _$jscoverage['middleware/errorHandler.js'][63]++; + res.setHeader("Content-Type", "text/html; charset=utf-8"); + _$jscoverage['middleware/errorHandler.js'][64]++; + res.end(html); +})); +})); + } + else { + _$jscoverage['middleware/errorHandler.js'][68]++; + if (~ accept.indexOf("json")) { + _$jscoverage['middleware/errorHandler.js'][69]++; + var error = {message: err.message, stack: err.stack}; + _$jscoverage['middleware/errorHandler.js'][70]++; + for (var prop in err) { + _$jscoverage['middleware/errorHandler.js'][70]++; + error[prop] = err[prop]; +} + _$jscoverage['middleware/errorHandler.js'][71]++; + var json = JSON.stringify({error: error}); + _$jscoverage['middleware/errorHandler.js'][72]++; + res.setHeader("Content-Type", "application/json"); + _$jscoverage['middleware/errorHandler.js'][73]++; + res.end(json); + } + else { + _$jscoverage['middleware/errorHandler.js'][76]++; + res.writeHead(res.statusCode, {"Content-Type": "text/plain"}); + _$jscoverage['middleware/errorHandler.js'][77]++; + res.end(err.stack); + } + } +}); +}); +_$jscoverage['middleware/errorHandler.js'][86]++; +exports.title = "Connect"; +_$jscoverage['middleware/errorHandler.js'].source = ["/*!"," * Connect - errorHandler"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils')"," , fs = require('fs');","","// environment","","var env = process.env.NODE_ENV || 'development';","","/**"," * Error handler:"," *"," * Development error handler, providing stack traces"," * and error message responses for requests accepting text, html,"," * or json."," *"," * Text:"," *"," * By default, and when _text/plain_ is accepted a simple stack trace"," * or error message will be returned."," *"," * JSON:"," *"," * When _application/json_ is accepted, connect will respond with"," * an object in the form of `{ \"error\": error }`."," *"," * HTML:"," *"," * When accepted connect will output a nice html stack trace."," *"," * @return {Function}"," * @api public"," */","","exports = module.exports = function errorHandler(){"," return function errorHandler(err, req, res, next){"," if (err.status) res.statusCode = err.status;"," if (res.statusCode < 400) res.statusCode = 500;"," if ('test' != env) console.error(err.stack);"," var accept = req.headers.accept || '';"," // html"," if (~accept.indexOf('html')) {"," fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){"," fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){"," var stack = (err.stack || '')"," .split('\\n').slice(1)"," .map(function(v){ return '<li>' + v + '</li>'; }).join('');"," html = html"," .replace('{style}', style)"," .replace('{stack}', stack)"," .replace('{title}', exports.title)"," .replace('{statusCode}', res.statusCode)"," .replace(/\\{error\\}/g, utils.escape(err.toString()));"," res.setHeader('Content-Type', 'text/html; charset=utf-8');"," res.end(html);"," });"," });"," // json"," } else if (~accept.indexOf('json')) {"," var error = { message: err.message, stack: err.stack };"," for (var prop in err) error[prop] = err[prop];"," var json = JSON.stringify({ error: error });"," res.setHeader('Content-Type', 'application/json');"," res.end(json);"," // plain text"," } else {"," res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });"," res.end(err.stack);"," }"," };","};","","/**"," * Template title, framework authors may override this value."," */","","exports.title = 'Connect';"]; diff --git a/node_modules/connect/lib-cov/middleware/favicon.js b/node_modules/connect/lib-cov/middleware/favicon.js new file mode 100644 index 0000000..6228079 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/favicon.js @@ -0,0 +1,60 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/favicon.js']) { + _$jscoverage['middleware/favicon.js'] = []; + _$jscoverage['middleware/favicon.js'][13] = 0; + _$jscoverage['middleware/favicon.js'][50] = 0; + _$jscoverage['middleware/favicon.js'][51] = 0; + _$jscoverage['middleware/favicon.js'][56] = 0; + _$jscoverage['middleware/favicon.js'][57] = 0; + _$jscoverage['middleware/favicon.js'][58] = 0; + _$jscoverage['middleware/favicon.js'][59] = 0; + _$jscoverage['middleware/favicon.js'][60] = 0; + _$jscoverage['middleware/favicon.js'][62] = 0; + _$jscoverage['middleware/favicon.js'][63] = 0; + _$jscoverage['middleware/favicon.js'][64] = 0; + _$jscoverage['middleware/favicon.js'][73] = 0; + _$jscoverage['middleware/favicon.js'][74] = 0; + _$jscoverage['middleware/favicon.js'][78] = 0; +} +_$jscoverage['middleware/favicon.js'][13]++; +var fs = require("fs"), utils = require("../utils"); +_$jscoverage['middleware/favicon.js'][50]++; +module.exports = (function favicon(path, options) { + _$jscoverage['middleware/favicon.js'][51]++; + var options = options || {}, path = path || __dirname + "/../public/favicon.ico", maxAge = options.maxAge || 86400000, icon; + _$jscoverage['middleware/favicon.js'][56]++; + return (function favicon(req, res, next) { + _$jscoverage['middleware/favicon.js'][57]++; + if ("/favicon.ico" == req.url) { + _$jscoverage['middleware/favicon.js'][58]++; + if (icon) { + _$jscoverage['middleware/favicon.js'][59]++; + res.writeHead(200, icon.headers); + _$jscoverage['middleware/favicon.js'][60]++; + res.end(icon.body); + } + else { + _$jscoverage['middleware/favicon.js'][62]++; + fs.readFile(path, (function (err, buf) { + _$jscoverage['middleware/favicon.js'][63]++; + if (err) { + _$jscoverage['middleware/favicon.js'][63]++; + return next(err); + } + _$jscoverage['middleware/favicon.js'][64]++; + icon = {headers: {"Content-Type": "image/x-icon", "Content-Length": buf.length, "ETag": "\"" + utils.md5(buf) + "\"", "Cache-Control": "public, max-age=" + (maxAge / 1000)}, body: buf}; + _$jscoverage['middleware/favicon.js'][73]++; + res.writeHead(200, icon.headers); + _$jscoverage['middleware/favicon.js'][74]++; + res.end(icon.body); +})); + } + } + else { + _$jscoverage['middleware/favicon.js'][78]++; + next(); + } +}); +}); +_$jscoverage['middleware/favicon.js'].source = ["","/*!"," * Connect - favicon"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var fs = require('fs')"," , utils = require('../utils');","","/**"," * Favicon:"," *"," * By default serves the connect favicon, or the favicon"," * located by the given `path`."," *"," * Options:"," *"," * - `maxAge` cache-control max-age directive, defaulting to 1 day"," *"," * Examples:"," *"," * Serve default favicon:"," *"," * connect()"," * .use(connect.favicon())"," *"," * Serve favicon before logging for brevity:"," *"," * connect()"," * .use(connect.favicon())"," * .use(connect.logger('dev'))"," *"," * Serve custom favicon:"," *"," * connect()"," * .use(connect.favicon('public/favicon.ico))"," *"," * @param {String} path"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","module.exports = function favicon(path, options){"," var options = options || {}"," , path = path || __dirname + '/../public/favicon.ico'"," , maxAge = options.maxAge || 86400000"," , icon; // favicon cache",""," return function favicon(req, res, next){"," if ('/favicon.ico' == req.url) {"," if (icon) {"," res.writeHead(200, icon.headers);"," res.end(icon.body);"," } else {"," fs.readFile(path, function(err, buf){"," if (err) return next(err);"," icon = {"," headers: {"," 'Content-Type': 'image/x-icon'"," , 'Content-Length': buf.length"," , 'ETag': '\"' + utils.md5(buf) + '\"'"," , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)"," },"," body: buf"," };"," res.writeHead(200, icon.headers);"," res.end(icon.body);"," });"," }"," } else {"," next();"," }"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/json.js b/node_modules/connect/lib-cov/middleware/json.js new file mode 100644 index 0000000..87236cf --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/json.js @@ -0,0 +1,117 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/json.js']) { + _$jscoverage['middleware/json.js'] = []; + _$jscoverage['middleware/json.js'][13] = 0; + _$jscoverage['middleware/json.js'][20] = 0; + _$jscoverage['middleware/json.js'][21] = 0; + _$jscoverage['middleware/json.js'][41] = 0; + _$jscoverage['middleware/json.js'][42] = 0; + _$jscoverage['middleware/json.js'][45] = 0; + _$jscoverage['middleware/json.js'][49] = 0; + _$jscoverage['middleware/json.js'][50] = 0; + _$jscoverage['middleware/json.js'][51] = 0; + _$jscoverage['middleware/json.js'][53] = 0; + _$jscoverage['middleware/json.js'][56] = 0; + _$jscoverage['middleware/json.js'][59] = 0; + _$jscoverage['middleware/json.js'][62] = 0; + _$jscoverage['middleware/json.js'][63] = 0; + _$jscoverage['middleware/json.js'][64] = 0; + _$jscoverage['middleware/json.js'][65] = 0; + _$jscoverage['middleware/json.js'][66] = 0; + _$jscoverage['middleware/json.js'][67] = 0; + _$jscoverage['middleware/json.js'][68] = 0; + _$jscoverage['middleware/json.js'][70] = 0; + _$jscoverage['middleware/json.js'][71] = 0; + _$jscoverage['middleware/json.js'][74] = 0; + _$jscoverage['middleware/json.js'][75] = 0; + _$jscoverage['middleware/json.js'][76] = 0; + _$jscoverage['middleware/json.js'][77] = 0; + _$jscoverage['middleware/json.js'][79] = 0; + _$jscoverage['middleware/json.js'][80] = 0; + _$jscoverage['middleware/json.js'][81] = 0; +} +_$jscoverage['middleware/json.js'][13]++; +var utils = require("../utils"), _limit = require("./limit"); +_$jscoverage['middleware/json.js'][20]++; +function noop(req, res, next) { + _$jscoverage['middleware/json.js'][21]++; + next(); +} +_$jscoverage['middleware/json.js'][41]++; +exports = module.exports = (function (options) { + _$jscoverage['middleware/json.js'][42]++; + var options = options || {}, strict = options.strict !== false; + _$jscoverage['middleware/json.js'][45]++; + var limit = options.limit? _limit(options.limit): noop; + _$jscoverage['middleware/json.js'][49]++; + return (function json(req, res, next) { + _$jscoverage['middleware/json.js'][50]++; + if (req._body) { + _$jscoverage['middleware/json.js'][50]++; + return next(); + } + _$jscoverage['middleware/json.js'][51]++; + req.body = req.body || {}; + _$jscoverage['middleware/json.js'][53]++; + if (! utils.hasBody(req)) { + _$jscoverage['middleware/json.js'][53]++; + return next(); + } + _$jscoverage['middleware/json.js'][56]++; + if ("application/json" != utils.mime(req)) { + _$jscoverage['middleware/json.js'][56]++; + return next(); + } + _$jscoverage['middleware/json.js'][59]++; + req._body = true; + _$jscoverage['middleware/json.js'][62]++; + limit(req, res, (function (err) { + _$jscoverage['middleware/json.js'][63]++; + if (err) { + _$jscoverage['middleware/json.js'][63]++; + return next(err); + } + _$jscoverage['middleware/json.js'][64]++; + var buf = ""; + _$jscoverage['middleware/json.js'][65]++; + req.setEncoding("utf8"); + _$jscoverage['middleware/json.js'][66]++; + req.on("data", (function (chunk) { + _$jscoverage['middleware/json.js'][66]++; + buf += chunk; +})); + _$jscoverage['middleware/json.js'][67]++; + req.on("end", (function () { + _$jscoverage['middleware/json.js'][68]++; + var first = buf.trim()[0]; + _$jscoverage['middleware/json.js'][70]++; + if (0 == buf.length) { + _$jscoverage['middleware/json.js'][71]++; + return next(utils.error(400, "invalid json, empty body")); + } + _$jscoverage['middleware/json.js'][74]++; + if (strict && "{" != first && "[" != first) { + _$jscoverage['middleware/json.js'][74]++; + return next(utils.error(400, "invalid json")); + } + _$jscoverage['middleware/json.js'][75]++; + try { + _$jscoverage['middleware/json.js'][76]++; + req.body = JSON.parse(buf, options.reviver); + _$jscoverage['middleware/json.js'][77]++; + next(); + } + catch (err) { + _$jscoverage['middleware/json.js'][79]++; + err.body = buf; + _$jscoverage['middleware/json.js'][80]++; + err.status = 400; + _$jscoverage['middleware/json.js'][81]++; + next(err); + } +})); +})); +}); +}); +_$jscoverage['middleware/json.js'].source = ["","/*!"," * Connect - json"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils')"," , _limit = require('./limit');","","/**"," * noop middleware."," */","","function noop(req, res, next) {"," next();","}","","/**"," * JSON:"," *"," * Parse JSON request bodies, providing the"," * parsed object as `req.body`."," *"," * Options:"," *"," * - `strict` when `false` anything `JSON.parse()` accepts will be parsed"," * - `reviver` used as the second \"reviver\" argument for JSON.parse"," * - `limit` byte limit disabled by default"," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function(options){"," var options = options || {}"," , strict = options.strict !== false;",""," var limit = options.limit"," ? _limit(options.limit)"," : noop;",""," return function json(req, res, next) {"," if (req._body) return next();"," req.body = req.body || {};",""," if (!utils.hasBody(req)) return next();",""," // check Content-Type"," if ('application/json' != utils.mime(req)) return next();",""," // flag as parsed"," req._body = true;",""," // parse"," limit(req, res, function(err){"," if (err) return next(err);"," var buf = '';"," req.setEncoding('utf8');"," req.on('data', function(chunk){ buf += chunk });"," req.on('end', function(){"," var first = buf.trim()[0];",""," if (0 == buf.length) {"," return next(utils.error(400, 'invalid json, empty body'));"," }"," "," if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json'));"," try {"," req.body = JSON.parse(buf, options.reviver);"," next();"," } catch (err){"," err.body = buf;"," err.status = 400;"," next(err);"," }"," });"," });"," }","};"]; diff --git a/node_modules/connect/lib-cov/middleware/limit.js b/node_modules/connect/lib-cov/middleware/limit.js new file mode 100644 index 0000000..fa8ea34 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/limit.js @@ -0,0 +1,63 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/limit.js']) { + _$jscoverage['middleware/limit.js'] = []; + _$jscoverage['middleware/limit.js'][12] = 0; + _$jscoverage['middleware/limit.js'][31] = 0; + _$jscoverage['middleware/limit.js'][32] = 0; + _$jscoverage['middleware/limit.js'][33] = 0; + _$jscoverage['middleware/limit.js'][34] = 0; + _$jscoverage['middleware/limit.js'][35] = 0; + _$jscoverage['middleware/limit.js'][41] = 0; + _$jscoverage['middleware/limit.js'][42] = 0; + _$jscoverage['middleware/limit.js'][45] = 0; + _$jscoverage['middleware/limit.js'][48] = 0; + _$jscoverage['middleware/limit.js'][49] = 0; + _$jscoverage['middleware/limit.js'][50] = 0; + _$jscoverage['middleware/limit.js'][53] = 0; +} +_$jscoverage['middleware/limit.js'][12]++; +var utils = require("../utils"); +_$jscoverage['middleware/limit.js'][31]++; +module.exports = (function limit(bytes) { + _$jscoverage['middleware/limit.js'][32]++; + if ("string" == typeof bytes) { + _$jscoverage['middleware/limit.js'][32]++; + bytes = utils.parseBytes(bytes); + } + _$jscoverage['middleware/limit.js'][33]++; + if ("number" != typeof bytes) { + _$jscoverage['middleware/limit.js'][33]++; + throw new Error("limit() bytes required"); + } + _$jscoverage['middleware/limit.js'][34]++; + return (function limit(req, res, next) { + _$jscoverage['middleware/limit.js'][35]++; + var received = 0, len = req.headers["content-length"]? parseInt(req.headers["content-length"], 10): null; + _$jscoverage['middleware/limit.js'][41]++; + if (req._limit) { + _$jscoverage['middleware/limit.js'][41]++; + return next(); + } + _$jscoverage['middleware/limit.js'][42]++; + req._limit = true; + _$jscoverage['middleware/limit.js'][45]++; + if (len && len > bytes) { + _$jscoverage['middleware/limit.js'][45]++; + return next(utils.error(413)); + } + _$jscoverage['middleware/limit.js'][48]++; + req.on("data", (function (chunk) { + _$jscoverage['middleware/limit.js'][49]++; + received += chunk.length; + _$jscoverage['middleware/limit.js'][50]++; + if (received > bytes) { + _$jscoverage['middleware/limit.js'][50]++; + req.destroy(); + } +})); + _$jscoverage['middleware/limit.js'][53]++; + next(); +}); +}); +_$jscoverage['middleware/limit.js'].source = ["","/*!"," * Connect - limit"," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils');","","/**"," * Limit:"," *"," * Limit request bodies to the given size in `bytes`."," *"," * A string representation of the bytesize may also be passed,"," * for example \"5mb\", \"200kb\", \"1gb\", etc."," *"," * connect()"," * .use(connect.limit('5.5mb'))"," * .use(handleImageUpload)"," *"," * @param {Number|String} bytes"," * @return {Function}"," * @api public"," */","","module.exports = function limit(bytes){"," if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);"," if ('number' != typeof bytes) throw new Error('limit() bytes required');"," return function limit(req, res, next){"," var received = 0"," , len = req.headers['content-length']"," ? parseInt(req.headers['content-length'], 10)"," : null;",""," // self-awareness"," if (req._limit) return next();"," req._limit = true;",""," // limit by content-length"," if (len && len > bytes) return next(utils.error(413));",""," // limit"," req.on('data', function(chunk){"," received += chunk.length;"," if (received > bytes) req.destroy();"," });",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/logger.js b/node_modules/connect/lib-cov/middleware/logger.js new file mode 100644 index 0000000..75c7a00 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/logger.js @@ -0,0 +1,312 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/logger.js']) { + _$jscoverage['middleware/logger.js'] = []; + _$jscoverage['middleware/logger.js'][12] = 0; + _$jscoverage['middleware/logger.js'][18] = 0; + _$jscoverage['middleware/logger.js'][24] = 0; + _$jscoverage['middleware/logger.js'][90] = 0; + _$jscoverage['middleware/logger.js'][91] = 0; + _$jscoverage['middleware/logger.js'][92] = 0; + _$jscoverage['middleware/logger.js'][93] = 0; + _$jscoverage['middleware/logger.js'][94] = 0; + _$jscoverage['middleware/logger.js'][96] = 0; + _$jscoverage['middleware/logger.js'][100] = 0; + _$jscoverage['middleware/logger.js'][103] = 0; + _$jscoverage['middleware/logger.js'][106] = 0; + _$jscoverage['middleware/logger.js'][109] = 0; + _$jscoverage['middleware/logger.js'][113] = 0; + _$jscoverage['middleware/logger.js'][114] = 0; + _$jscoverage['middleware/logger.js'][120] = 0; + _$jscoverage['middleware/logger.js'][121] = 0; + _$jscoverage['middleware/logger.js'][122] = 0; + _$jscoverage['middleware/logger.js'][123] = 0; + _$jscoverage['middleware/logger.js'][128] = 0; + _$jscoverage['middleware/logger.js'][130] = 0; + _$jscoverage['middleware/logger.js'][135] = 0; + _$jscoverage['middleware/logger.js'][136] = 0; + _$jscoverage['middleware/logger.js'][139] = 0; + _$jscoverage['middleware/logger.js'][140] = 0; + _$jscoverage['middleware/logger.js'][141] = 0; + _$jscoverage['middleware/logger.js'][142] = 0; + _$jscoverage['middleware/logger.js'][145] = 0; + _$jscoverage['middleware/logger.js'][146] = 0; + _$jscoverage['middleware/logger.js'][147] = 0; + _$jscoverage['middleware/logger.js'][148] = 0; + _$jscoverage['middleware/logger.js'][149] = 0; + _$jscoverage['middleware/logger.js'][150] = 0; + _$jscoverage['middleware/logger.js'][151] = 0; + _$jscoverage['middleware/logger.js'][156] = 0; + _$jscoverage['middleware/logger.js'][168] = 0; + _$jscoverage['middleware/logger.js'][169] = 0; + _$jscoverage['middleware/logger.js'][170] = 0; + _$jscoverage['middleware/logger.js'][171] = 0; + _$jscoverage['middleware/logger.js'][173] = 0; + _$jscoverage['middleware/logger.js'][174] = 0; + _$jscoverage['middleware/logger.js'][186] = 0; + _$jscoverage['middleware/logger.js'][187] = 0; + _$jscoverage['middleware/logger.js'][188] = 0; + _$jscoverage['middleware/logger.js'][200] = 0; + _$jscoverage['middleware/logger.js'][201] = 0; + _$jscoverage['middleware/logger.js'][202] = 0; + _$jscoverage['middleware/logger.js'][209] = 0; + _$jscoverage['middleware/logger.js'][215] = 0; + _$jscoverage['middleware/logger.js'][221] = 0; + _$jscoverage['middleware/logger.js'][227] = 0; + _$jscoverage['middleware/logger.js'][228] = 0; + _$jscoverage['middleware/logger.js'][232] = 0; + _$jscoverage['middleware/logger.js'][233] = 0; + _$jscoverage['middleware/logger.js'][234] = 0; + _$jscoverage['middleware/logger.js'][236] = 0; + _$jscoverage['middleware/logger.js'][240] = 0; + _$jscoverage['middleware/logger.js'][253] = 0; + _$jscoverage['middleware/logger.js'][254] = 0; + _$jscoverage['middleware/logger.js'][261] = 0; + _$jscoverage['middleware/logger.js'][262] = 0; + _$jscoverage['middleware/logger.js'][269] = 0; + _$jscoverage['middleware/logger.js'][270] = 0; + _$jscoverage['middleware/logger.js'][277] = 0; + _$jscoverage['middleware/logger.js'][278] = 0; + _$jscoverage['middleware/logger.js'][285] = 0; + _$jscoverage['middleware/logger.js'][286] = 0; + _$jscoverage['middleware/logger.js'][293] = 0; + _$jscoverage['middleware/logger.js'][294] = 0; + _$jscoverage['middleware/logger.js'][301] = 0; + _$jscoverage['middleware/logger.js'][302] = 0; + _$jscoverage['middleware/logger.js'][303] = 0; + _$jscoverage['middleware/logger.js'][304] = 0; + _$jscoverage['middleware/logger.js'][305] = 0; + _$jscoverage['middleware/logger.js'][312] = 0; + _$jscoverage['middleware/logger.js'][313] = 0; + _$jscoverage['middleware/logger.js'][320] = 0; + _$jscoverage['middleware/logger.js'][321] = 0; + _$jscoverage['middleware/logger.js'][328] = 0; + _$jscoverage['middleware/logger.js'][329] = 0; + _$jscoverage['middleware/logger.js'][336] = 0; + _$jscoverage['middleware/logger.js'][337] = 0; +} +_$jscoverage['middleware/logger.js'][12]++; +var bytes = require("bytes"); +_$jscoverage['middleware/logger.js'][18]++; +var buf = []; +_$jscoverage['middleware/logger.js'][24]++; +var defaultBufferDuration = 1000; +_$jscoverage['middleware/logger.js'][90]++; +exports = module.exports = (function logger(options) { + _$jscoverage['middleware/logger.js'][91]++; + if ("object" == typeof options) { + _$jscoverage['middleware/logger.js'][92]++; + options = options || {}; + } + else { + _$jscoverage['middleware/logger.js'][93]++; + if (options) { + _$jscoverage['middleware/logger.js'][94]++; + options = {format: options}; + } + else { + _$jscoverage['middleware/logger.js'][96]++; + options = {}; + } + } + _$jscoverage['middleware/logger.js'][100]++; + var immediate = options.immediate; + _$jscoverage['middleware/logger.js'][103]++; + var fmt = exports[options.format] || options.format || exports["default"]; + _$jscoverage['middleware/logger.js'][106]++; + if ("function" != typeof fmt) { + _$jscoverage['middleware/logger.js'][106]++; + fmt = compile(fmt); + } + _$jscoverage['middleware/logger.js'][109]++; + var stream = options.stream || process.stdout, buffer = options.buffer; + _$jscoverage['middleware/logger.js'][113]++; + if (buffer) { + _$jscoverage['middleware/logger.js'][114]++; + var realStream = stream, interval = "number" == typeof buffer? buffer: defaultBufferDuration; + _$jscoverage['middleware/logger.js'][120]++; + setInterval((function () { + _$jscoverage['middleware/logger.js'][121]++; + if (buf.length) { + _$jscoverage['middleware/logger.js'][122]++; + realStream.write(buf.join("")); + _$jscoverage['middleware/logger.js'][123]++; + buf.length = 0; + } +}), interval); + _$jscoverage['middleware/logger.js'][128]++; + stream = {write: (function (str) { + _$jscoverage['middleware/logger.js'][130]++; + buf.push(str); +})}; + } + _$jscoverage['middleware/logger.js'][135]++; + return (function logger(req, res, next) { + _$jscoverage['middleware/logger.js'][136]++; + req._startTime = new Date(); + _$jscoverage['middleware/logger.js'][139]++; + if (immediate) { + _$jscoverage['middleware/logger.js'][140]++; + var line = fmt(exports, req, res); + _$jscoverage['middleware/logger.js'][141]++; + if (null == line) { + _$jscoverage['middleware/logger.js'][141]++; + return; + } + _$jscoverage['middleware/logger.js'][142]++; + stream.write(line + "\n"); + } + else { + _$jscoverage['middleware/logger.js'][145]++; + var end = res.end; + _$jscoverage['middleware/logger.js'][146]++; + res.end = (function (chunk, encoding) { + _$jscoverage['middleware/logger.js'][147]++; + res.end = end; + _$jscoverage['middleware/logger.js'][148]++; + res.end(chunk, encoding); + _$jscoverage['middleware/logger.js'][149]++; + var line = fmt(exports, req, res); + _$jscoverage['middleware/logger.js'][150]++; + if (null == line) { + _$jscoverage['middleware/logger.js'][150]++; + return; + } + _$jscoverage['middleware/logger.js'][151]++; + stream.write(line + "\n"); +}); + } + _$jscoverage['middleware/logger.js'][156]++; + next(); +}); +}); +_$jscoverage['middleware/logger.js'][168]++; +function compile(fmt) { + _$jscoverage['middleware/logger.js'][169]++; + fmt = fmt.replace(/"/g, "\\\""); + _$jscoverage['middleware/logger.js'][170]++; + var js = " return \"" + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, (function (_, name, arg) { + _$jscoverage['middleware/logger.js'][171]++; + return "\"\n + (tokens[\"" + name + "\"](req, res, \"" + arg + "\") || \"-\") + \""; +})) + "\";"; + _$jscoverage['middleware/logger.js'][173]++; + return new Function("tokens, req, res", js); +} +_$jscoverage['middleware/logger.js'][174]++; +; +_$jscoverage['middleware/logger.js'][186]++; +exports.token = (function (name, fn) { + _$jscoverage['middleware/logger.js'][187]++; + exports[name] = fn; + _$jscoverage['middleware/logger.js'][188]++; + return this; +}); +_$jscoverage['middleware/logger.js'][200]++; +exports.format = (function (name, str) { + _$jscoverage['middleware/logger.js'][201]++; + exports[name] = str; + _$jscoverage['middleware/logger.js'][202]++; + return this; +}); +_$jscoverage['middleware/logger.js'][209]++; +exports.format("default", ":remote-addr - - [:date] \":method :url HTTP/:http-version\" :status :res[content-length] \":referrer\" \":user-agent\""); +_$jscoverage['middleware/logger.js'][215]++; +exports.format("short", ":remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms"); +_$jscoverage['middleware/logger.js'][221]++; +exports.format("tiny", ":method :url :status :res[content-length] - :response-time ms"); +_$jscoverage['middleware/logger.js'][227]++; +exports.format("dev", (function (tokens, req, res) { + _$jscoverage['middleware/logger.js'][228]++; + var status = res.statusCode, len = parseInt(res.getHeader("Content-Length"), 10), color = 32; + _$jscoverage['middleware/logger.js'][232]++; + if (status >= 500) { + _$jscoverage['middleware/logger.js'][232]++; + color = 31; + } + else { + _$jscoverage['middleware/logger.js'][233]++; + if (status >= 400) { + _$jscoverage['middleware/logger.js'][233]++; + color = 33; + } + else { + _$jscoverage['middleware/logger.js'][234]++; + if (status >= 300) { + _$jscoverage['middleware/logger.js'][234]++; + color = 36; + } + } + } + _$jscoverage['middleware/logger.js'][236]++; + len = isNaN(len)? "": len = " - " + bytes(len); + _$jscoverage['middleware/logger.js'][240]++; + return "\u001b[90m" + req.method + " " + req.originalUrl + " " + "\u001b[" + color + "m" + res.statusCode + " \u001b[90m" + (new Date() - req._startTime) + "ms" + len + "\u001b[0m"; +})); +_$jscoverage['middleware/logger.js'][253]++; +exports.token("url", (function (req) { + _$jscoverage['middleware/logger.js'][254]++; + return req.originalUrl || req.url; +})); +_$jscoverage['middleware/logger.js'][261]++; +exports.token("method", (function (req) { + _$jscoverage['middleware/logger.js'][262]++; + return req.method; +})); +_$jscoverage['middleware/logger.js'][269]++; +exports.token("response-time", (function (req) { + _$jscoverage['middleware/logger.js'][270]++; + return new Date() - req._startTime; +})); +_$jscoverage['middleware/logger.js'][277]++; +exports.token("date", (function () { + _$jscoverage['middleware/logger.js'][278]++; + return new Date().toUTCString(); +})); +_$jscoverage['middleware/logger.js'][285]++; +exports.token("status", (function (req, res) { + _$jscoverage['middleware/logger.js'][286]++; + return res.statusCode; +})); +_$jscoverage['middleware/logger.js'][293]++; +exports.token("referrer", (function (req) { + _$jscoverage['middleware/logger.js'][294]++; + return req.headers.referer || req.headers.referrer; +})); +_$jscoverage['middleware/logger.js'][301]++; +exports.token("remote-addr", (function (req) { + _$jscoverage['middleware/logger.js'][302]++; + if (req.ip) { + _$jscoverage['middleware/logger.js'][302]++; + return req.ip; + } + _$jscoverage['middleware/logger.js'][303]++; + var sock = req.socket; + _$jscoverage['middleware/logger.js'][304]++; + if (sock.socket) { + _$jscoverage['middleware/logger.js'][304]++; + return sock.socket.remoteAddress; + } + _$jscoverage['middleware/logger.js'][305]++; + return sock.remoteAddress; +})); +_$jscoverage['middleware/logger.js'][312]++; +exports.token("http-version", (function (req) { + _$jscoverage['middleware/logger.js'][313]++; + return req.httpVersionMajor + "." + req.httpVersionMinor; +})); +_$jscoverage['middleware/logger.js'][320]++; +exports.token("user-agent", (function (req) { + _$jscoverage['middleware/logger.js'][321]++; + return req.headers["user-agent"]; +})); +_$jscoverage['middleware/logger.js'][328]++; +exports.token("req", (function (req, res, field) { + _$jscoverage['middleware/logger.js'][329]++; + return req.headers[field.toLowerCase()]; +})); +_$jscoverage['middleware/logger.js'][336]++; +exports.token("res", (function (req, res, field) { + _$jscoverage['middleware/logger.js'][337]++; + return (res._headers || {})[field.toLowerCase()]; +})); +_$jscoverage['middleware/logger.js'].source = ["/*!"," * Connect - logger"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var bytes = require('bytes');","","/*!"," * Log buffer."," */","","var buf = [];","","/*!"," * Default log buffer duration."," */","","var defaultBufferDuration = 1000;","","/**"," * Logger:"," *"," * Log requests with the given `options` or a `format` string."," *"," * Options:"," *"," * - `format` Format string, see below for tokens"," * - `stream` Output stream, defaults to _stdout_"," * - `buffer` Buffer duration, defaults to 1000ms when _true_"," * - `immediate` Write log line on request instead of response (for response times)"," *"," * Tokens:"," *"," * - `:req[header]` ex: `:req[Accept]`"," * - `:res[header]` ex: `:res[Content-Length]`"," * - `:http-version`"," * - `:response-time`"," * - `:remote-addr`"," * - `:date`"," * - `:method`"," * - `:url`"," * - `:referrer`"," * - `:user-agent`"," * - `:status`"," *"," * Formats:"," *"," * Pre-defined formats that ship with connect:"," *"," * - `default` ':remote-addr - - [:date] \":method :url HTTP/:http-version\" :status :res[content-length] \":referrer\" \":user-agent\"'"," * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'"," * - `tiny` ':method :url :status :res[content-length] - :response-time ms'"," * - `dev` concise output colored by response status for development use"," *"," * Examples:"," *"," * connect.logger() // default"," * connect.logger('short')"," * connect.logger('tiny')"," * connect.logger({ immediate: true, format: 'dev' })"," * connect.logger(':method :url - :referrer')"," * connect.logger(':req[content-type] -> :res[content-type]')"," * connect.logger(function(tokens, req, res){ return 'some format string' })"," *"," * Defining Tokens:"," *"," * To define a token, simply invoke `connect.logger.token()` with the"," * name and a callback function. The value returned is then available"," * as \":type\" in this case."," *"," * connect.logger.token('type', function(req, res){ return req.headers['content-type']; })"," *"," * Defining Formats:"," *"," * All default formats are defined this way, however it's public API as well:"," *"," * connect.logger.format('name', 'string or function')"," *"," * @param {String|Function|Object} format or options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function logger(options) {"," if ('object' == typeof options) {"," options = options || {};"," } else if (options) {"," options = { format: options };"," } else {"," options = {};"," }",""," // output on request instead of response"," var immediate = options.immediate;",""," // format name"," var fmt = exports[options.format] || options.format || exports.default;",""," // compile format"," if ('function' != typeof fmt) fmt = compile(fmt);",""," // options"," var stream = options.stream || process.stdout"," , buffer = options.buffer;",""," // buffering support"," if (buffer) {"," var realStream = stream"," , interval = 'number' == typeof buffer"," ? buffer"," : defaultBufferDuration;",""," // flush interval"," setInterval(function(){"," if (buf.length) {"," realStream.write(buf.join(''));"," buf.length = 0;"," }"," }, interval); ",""," // swap the stream"," stream = {"," write: function(str){"," buf.push(str);"," }"," };"," }",""," return function logger(req, res, next) {"," req._startTime = new Date;",""," // immediate"," if (immediate) {"," var line = fmt(exports, req, res);"," if (null == line) return;"," stream.write(line + '\\n');"," // proxy end to output logging"," } else {"," var end = res.end;"," res.end = function(chunk, encoding){"," res.end = end;"," res.end(chunk, encoding);"," var line = fmt(exports, req, res);"," if (null == line) return;"," stream.write(line + '\\n');"," };"," }","",""," next();"," };","};","","/**"," * Compile `fmt` into a function."," *"," * @param {String} fmt"," * @return {Function}"," * @api private"," */","","function compile(fmt) {"," fmt = fmt.replace(/\"/g, '\\\\\"');"," var js = ' return \"' + fmt.replace(/:([-\\w]{2,})(?:\\[([^\\]]+)\\])?/g, function(_, name, arg){"," return '\"\\n + (tokens[\"' + name + '\"](req, res, \"' + arg + '\") || \"-\") + \"';"," }) + '\";'"," return new Function('tokens, req, res', js);","};","","/**"," * Define a token function with the given `name`,"," * and callback `fn(req, res)`."," *"," * @param {String} name"," * @param {Function} fn"," * @return {Object} exports for chaining"," * @api public"," */","","exports.token = function(name, fn) {"," exports[name] = fn;"," return this;","};","","/**"," * Define a `fmt` with the given `name`."," *"," * @param {String} name"," * @param {String|Function} fmt"," * @return {Object} exports for chaining"," * @api public"," */","","exports.format = function(name, str){"," exports[name] = str;"," return this;","};","","/**"," * Default format."," */","","exports.format('default', ':remote-addr - - [:date] \":method :url HTTP/:http-version\" :status :res[content-length] \":referrer\" \":user-agent\"');","","/**"," * Short format."," */","","exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');","","/**"," * Tiny format."," */","","exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');","","/**"," * dev (colored)"," */","","exports.format('dev', function(tokens, req, res){"," var status = res.statusCode"," , len = parseInt(res.getHeader('Content-Length'), 10)"," , color = 32;",""," if (status >= 500) color = 31"," else if (status >= 400) color = 33"," else if (status >= 300) color = 36;",""," len = isNaN(len)"," ? ''"," : len = ' - ' + bytes(len);",""," return '\\033[90m' + req.method"," + ' ' + req.originalUrl + ' '"," + '\\033[' + color + 'm' + res.statusCode"," + ' \\033[90m'"," + (new Date - req._startTime)"," + 'ms' + len"," + '\\033[0m';","});","","/**"," * request url"," */","","exports.token('url', function(req){"," return req.originalUrl || req.url;","});","","/**"," * request method"," */","","exports.token('method', function(req){"," return req.method;","});","","/**"," * response time in milliseconds"," */","","exports.token('response-time', function(req){"," return new Date - req._startTime;","});","","/**"," * UTC date"," */","","exports.token('date', function(){"," return new Date().toUTCString();","});","","/**"," * response status code"," */","","exports.token('status', function(req, res){"," return res.statusCode;","});","","/**"," * normalized referrer"," */","","exports.token('referrer', function(req){"," return req.headers['referer'] || req.headers['referrer'];","});","","/**"," * remote address"," */","","exports.token('remote-addr', function(req){"," if (req.ip) return req.ip;"," var sock = req.socket;"," if (sock.socket) return sock.socket.remoteAddress;"," return sock.remoteAddress;","});","","/**"," * HTTP version"," */","","exports.token('http-version', function(req){"," return req.httpVersionMajor + '.' + req.httpVersionMinor;","});","","/**"," * UA string"," */","","exports.token('user-agent', function(req){"," return req.headers['user-agent'];","});","","/**"," * request header"," */","","exports.token('req', function(req, res, field){"," return req.headers[field.toLowerCase()];","});","","/**"," * response header"," */","","exports.token('res', function(req, res, field){"," return (res._headers || {})[field.toLowerCase()];","});",""]; diff --git a/node_modules/connect/lib-cov/middleware/methodOverride.js b/node_modules/connect/lib-cov/middleware/methodOverride.js new file mode 100644 index 0000000..0a9118c --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/methodOverride.js @@ -0,0 +1,42 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/methodOverride.js']) { + _$jscoverage['middleware/methodOverride.js'] = []; + _$jscoverage['middleware/methodOverride.js'][23] = 0; + _$jscoverage['middleware/methodOverride.js'][24] = 0; + _$jscoverage['middleware/methodOverride.js'][25] = 0; + _$jscoverage['middleware/methodOverride.js'][26] = 0; + _$jscoverage['middleware/methodOverride.js'][29] = 0; + _$jscoverage['middleware/methodOverride.js'][30] = 0; + _$jscoverage['middleware/methodOverride.js'][31] = 0; + _$jscoverage['middleware/methodOverride.js'][33] = 0; + _$jscoverage['middleware/methodOverride.js'][34] = 0; + _$jscoverage['middleware/methodOverride.js'][37] = 0; +} +_$jscoverage['middleware/methodOverride.js'][23]++; +module.exports = (function methodOverride(key) { + _$jscoverage['middleware/methodOverride.js'][24]++; + key = key || "_method"; + _$jscoverage['middleware/methodOverride.js'][25]++; + return (function methodOverride(req, res, next) { + _$jscoverage['middleware/methodOverride.js'][26]++; + req.originalMethod = req.originalMethod || req.method; + _$jscoverage['middleware/methodOverride.js'][29]++; + if (req.body && key in req.body) { + _$jscoverage['middleware/methodOverride.js'][30]++; + req.method = req.body[key].toUpperCase(); + _$jscoverage['middleware/methodOverride.js'][31]++; + delete req.body[key]; + } + else { + _$jscoverage['middleware/methodOverride.js'][33]++; + if (req.headers["x-http-method-override"]) { + _$jscoverage['middleware/methodOverride.js'][34]++; + req.method = req.headers["x-http-method-override"].toUpperCase(); + } + } + _$jscoverage['middleware/methodOverride.js'][37]++; + next(); +}); +}); +_$jscoverage['middleware/methodOverride.js'].source = ["","/*!"," * Connect - methodOverride"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Method Override:"," * "," * Provides faux HTTP method support."," * "," * Pass an optional `key` to use when checking for"," * a method override, othewise defaults to _\\_method_."," * The original method is available via `req.originalMethod`."," *"," * @param {String} key"," * @return {Function}"," * @api public"," */","","module.exports = function methodOverride(key){"," key = key || \"_method\";"," return function methodOverride(req, res, next) {"," req.originalMethod = req.originalMethod || req.method;",""," // req.body"," if (req.body && key in req.body) {"," req.method = req.body[key].toUpperCase();"," delete req.body[key];"," // check X-HTTP-Method-Override"," } else if (req.headers['x-http-method-override']) {"," req.method = req.headers['x-http-method-override'].toUpperCase();"," }"," "," next();"," };","};",""]; diff --git a/node_modules/connect/lib-cov/middleware/multipart.js b/node_modules/connect/lib-cov/middleware/multipart.js new file mode 100644 index 0000000..dfcde09 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/multipart.js @@ -0,0 +1,183 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/multipart.js']) { + _$jscoverage['middleware/multipart.js'] = []; + _$jscoverage['middleware/multipart.js'][12] = 0; + _$jscoverage['middleware/multipart.js'][21] = 0; + _$jscoverage['middleware/multipart.js'][22] = 0; + _$jscoverage['middleware/multipart.js'][52] = 0; + _$jscoverage['middleware/multipart.js'][53] = 0; + _$jscoverage['middleware/multipart.js'][55] = 0; + _$jscoverage['middleware/multipart.js'][59] = 0; + _$jscoverage['middleware/multipart.js'][60] = 0; + _$jscoverage['middleware/multipart.js'][61] = 0; + _$jscoverage['middleware/multipart.js'][62] = 0; + _$jscoverage['middleware/multipart.js'][64] = 0; + _$jscoverage['middleware/multipart.js'][67] = 0; + _$jscoverage['middleware/multipart.js'][70] = 0; + _$jscoverage['middleware/multipart.js'][73] = 0; + _$jscoverage['middleware/multipart.js'][76] = 0; + _$jscoverage['middleware/multipart.js'][77] = 0; + _$jscoverage['middleware/multipart.js'][79] = 0; + _$jscoverage['middleware/multipart.js'][84] = 0; + _$jscoverage['middleware/multipart.js'][85] = 0; + _$jscoverage['middleware/multipart.js'][88] = 0; + _$jscoverage['middleware/multipart.js'][89] = 0; + _$jscoverage['middleware/multipart.js'][90] = 0; + _$jscoverage['middleware/multipart.js'][91] = 0; + _$jscoverage['middleware/multipart.js'][92] = 0; + _$jscoverage['middleware/multipart.js'][94] = 0; + _$jscoverage['middleware/multipart.js'][98] = 0; + _$jscoverage['middleware/multipart.js'][99] = 0; + _$jscoverage['middleware/multipart.js'][102] = 0; + _$jscoverage['middleware/multipart.js'][103] = 0; + _$jscoverage['middleware/multipart.js'][106] = 0; + _$jscoverage['middleware/multipart.js'][107] = 0; + _$jscoverage['middleware/multipart.js'][108] = 0; + _$jscoverage['middleware/multipart.js'][109] = 0; + _$jscoverage['middleware/multipart.js'][111] = 0; + _$jscoverage['middleware/multipart.js'][114] = 0; + _$jscoverage['middleware/multipart.js'][115] = 0; + _$jscoverage['middleware/multipart.js'][116] = 0; + _$jscoverage['middleware/multipart.js'][117] = 0; + _$jscoverage['middleware/multipart.js'][118] = 0; + _$jscoverage['middleware/multipart.js'][119] = 0; + _$jscoverage['middleware/multipart.js'][121] = 0; + _$jscoverage['middleware/multipart.js'][125] = 0; + _$jscoverage['middleware/multipart.js'][127] = 0; + _$jscoverage['middleware/multipart.js'][128] = 0; + _$jscoverage['middleware/multipart.js'][129] = 0; +} +_$jscoverage['middleware/multipart.js'][12]++; +var formidable = require("formidable"), _limit = require("./limit"), utils = require("../utils"), qs = require("qs"); +_$jscoverage['middleware/multipart.js'][21]++; +function noop(req, res, next) { + _$jscoverage['middleware/multipart.js'][22]++; + next(); +} +_$jscoverage['middleware/multipart.js'][52]++; +exports = module.exports = (function (options) { + _$jscoverage['middleware/multipart.js'][53]++; + options = options || {}; + _$jscoverage['middleware/multipart.js'][55]++; + var limit = options.limit? _limit(options.limit): noop; + _$jscoverage['middleware/multipart.js'][59]++; + return (function multipart(req, res, next) { + _$jscoverage['middleware/multipart.js'][60]++; + if (req._body) { + _$jscoverage['middleware/multipart.js'][60]++; + return next(); + } + _$jscoverage['middleware/multipart.js'][61]++; + req.body = req.body || {}; + _$jscoverage['middleware/multipart.js'][62]++; + req.files = req.files || {}; + _$jscoverage['middleware/multipart.js'][64]++; + if (! utils.hasBody(req)) { + _$jscoverage['middleware/multipart.js'][64]++; + return next(); + } + _$jscoverage['middleware/multipart.js'][67]++; + if ("GET" == req.method || "HEAD" == req.method) { + _$jscoverage['middleware/multipart.js'][67]++; + return next(); + } + _$jscoverage['middleware/multipart.js'][70]++; + if ("multipart/form-data" != utils.mime(req)) { + _$jscoverage['middleware/multipart.js'][70]++; + return next(); + } + _$jscoverage['middleware/multipart.js'][73]++; + req._body = true; + _$jscoverage['middleware/multipart.js'][76]++; + limit(req, res, (function (err) { + _$jscoverage['middleware/multipart.js'][77]++; + if (err) { + _$jscoverage['middleware/multipart.js'][77]++; + return next(err); + } + _$jscoverage['middleware/multipart.js'][79]++; + var form = new formidable.IncomingForm(), data = {}, files = {}, done; + _$jscoverage['middleware/multipart.js'][84]++; + Object.keys(options).forEach((function (key) { + _$jscoverage['middleware/multipart.js'][85]++; + form[key] = options[key]; +})); + _$jscoverage['middleware/multipart.js'][88]++; + function ondata(name, val, data) { + _$jscoverage['middleware/multipart.js'][89]++; + if (Array.isArray(data[name])) { + _$jscoverage['middleware/multipart.js'][90]++; + data[name].push(val); + } + else { + _$jscoverage['middleware/multipart.js'][91]++; + if (data[name]) { + _$jscoverage['middleware/multipart.js'][92]++; + data[name] = [data[name], val]; + } + else { + _$jscoverage['middleware/multipart.js'][94]++; + data[name] = val; + } + } +} + _$jscoverage['middleware/multipart.js'][98]++; + form.on("field", (function (name, val) { + _$jscoverage['middleware/multipart.js'][99]++; + ondata(name, val, data); +})); + _$jscoverage['middleware/multipart.js'][102]++; + form.on("file", (function (name, val) { + _$jscoverage['middleware/multipart.js'][103]++; + ondata(name, val, files); +})); + _$jscoverage['middleware/multipart.js'][106]++; + form.on("error", (function (err) { + _$jscoverage['middleware/multipart.js'][107]++; + if (! options.defer) { + _$jscoverage['middleware/multipart.js'][108]++; + err.status = 400; + _$jscoverage['middleware/multipart.js'][109]++; + next(err); + } + _$jscoverage['middleware/multipart.js'][111]++; + done = true; +})); + _$jscoverage['middleware/multipart.js'][114]++; + form.on("end", (function () { + _$jscoverage['middleware/multipart.js'][115]++; + if (done) { + _$jscoverage['middleware/multipart.js'][115]++; + return; + } + _$jscoverage['middleware/multipart.js'][116]++; + try { + _$jscoverage['middleware/multipart.js'][117]++; + req.body = qs.parse(data); + _$jscoverage['middleware/multipart.js'][118]++; + req.files = qs.parse(files); + _$jscoverage['middleware/multipart.js'][119]++; + if (! options.defer) { + _$jscoverage['middleware/multipart.js'][119]++; + next(); + } + } + catch (err) { + _$jscoverage['middleware/multipart.js'][121]++; + form.emit("error", err); + } +})); + _$jscoverage['middleware/multipart.js'][125]++; + form.parse(req); + _$jscoverage['middleware/multipart.js'][127]++; + if (options.defer) { + _$jscoverage['middleware/multipart.js'][128]++; + req.form = form; + _$jscoverage['middleware/multipart.js'][129]++; + next(); + } +})); +}); +}); +_$jscoverage['middleware/multipart.js'].source = ["/*!"," * Connect - multipart"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var formidable = require('formidable')"," , _limit = require('./limit')"," , utils = require('../utils')"," , qs = require('qs');","","/**"," * noop middleware."," */","","function noop(req, res, next) {"," next();","}","","/**"," * Multipart:"," * "," * Parse multipart/form-data request bodies,"," * providing the parsed object as `req.body`"," * and `req.files`."," *"," * Configuration:"," *"," * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s"," * `IncomingForm` object, allowing you to configure the upload directory,"," * size limits, etc. For example if you wish to change the upload dir do the following."," *"," * app.use(connect.multipart({ uploadDir: path }));"," *"," * Options:"," *"," * - `limit` byte limit defaulting to none"," * - `defer` defers processing and exposes the Formidable form object as `req.form`."," * `next()` is called without waiting for the form's \"end\" event."," * This option is useful if you need to bind to the \"progress\" event, for example."," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function(options){"," options = options || {};",""," var limit = options.limit"," ? _limit(options.limit)"," : noop;",""," return function multipart(req, res, next) {"," if (req._body) return next();"," req.body = req.body || {};"," req.files = req.files || {};",""," if (!utils.hasBody(req)) return next();",""," // ignore GET"," if ('GET' == req.method || 'HEAD' == req.method) return next();",""," // check Content-Type"," if ('multipart/form-data' != utils.mime(req)) return next();",""," // flag as parsed"," req._body = true;",""," // parse"," limit(req, res, function(err){"," if (err) return next(err);",""," var form = new formidable.IncomingForm"," , data = {}"," , files = {}"," , done;",""," Object.keys(options).forEach(function(key){"," form[key] = options[key];"," });",""," function ondata(name, val, data){"," if (Array.isArray(data[name])) {"," data[name].push(val);"," } else if (data[name]) {"," data[name] = [data[name], val];"," } else {"," data[name] = val;"," }"," }",""," form.on('field', function(name, val){"," ondata(name, val, data);"," });",""," form.on('file', function(name, val){"," ondata(name, val, files);"," });",""," form.on('error', function(err){"," if (!options.defer) {"," err.status = 400;"," next(err);"," }"," done = true;"," });",""," form.on('end', function(){"," if (done) return;"," try {"," req.body = qs.parse(data);"," req.files = qs.parse(files);"," if (!options.defer) next();"," } catch (err) {"," form.emit('error', err);"," }"," });",""," form.parse(req);",""," if (options.defer) {"," req.form = form;"," next();"," }"," });"," }","};"]; diff --git a/node_modules/connect/lib-cov/middleware/query.js b/node_modules/connect/lib-cov/middleware/query.js new file mode 100644 index 0000000..bd27ff6 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/query.js @@ -0,0 +1,27 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/query.js']) { + _$jscoverage['middleware/query.js'] = []; + _$jscoverage['middleware/query.js'][12] = 0; + _$jscoverage['middleware/query.js'][36] = 0; + _$jscoverage['middleware/query.js'][37] = 0; + _$jscoverage['middleware/query.js'][38] = 0; + _$jscoverage['middleware/query.js'][39] = 0; + _$jscoverage['middleware/query.js'][44] = 0; +} +_$jscoverage['middleware/query.js'][12]++; +var qs = require("qs"), parse = require("../utils").parseUrl; +_$jscoverage['middleware/query.js'][36]++; +module.exports = (function query(options) { + _$jscoverage['middleware/query.js'][37]++; + return (function query(req, res, next) { + _$jscoverage['middleware/query.js'][38]++; + if (! req.query) { + _$jscoverage['middleware/query.js'][39]++; + req.query = ~ req.url.indexOf("?")? qs.parse(parse(req).query, options): {}; + } + _$jscoverage['middleware/query.js'][44]++; + next(); +}); +}); +_$jscoverage['middleware/query.js'].source = ["/*!"," * Connect - query"," * Copyright(c) 2011 TJ Holowaychuk"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var qs = require('qs')"," , parse = require('../utils').parseUrl;","","/**"," * Query:"," *"," * Automatically parse the query-string when available,"," * populating the `req.query` object."," *"," * Examples:"," *"," * connect()"," * .use(connect.query())"," * .use(function(req, res){"," * res.end(JSON.stringify(req.query));"," * });"," *"," * The `options` passed are provided to qs.parse function."," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","module.exports = function query(options){"," return function query(req, res, next){"," if (!req.query) {"," req.query = ~req.url.indexOf('?')"," ? qs.parse(parse(req).query, options)"," : {};"," }",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/responseTime.js b/node_modules/connect/lib-cov/middleware/responseTime.js new file mode 100644 index 0000000..954e040 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/responseTime.js @@ -0,0 +1,39 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/responseTime.js']) { + _$jscoverage['middleware/responseTime.js'] = []; + _$jscoverage['middleware/responseTime.js'][18] = 0; + _$jscoverage['middleware/responseTime.js'][19] = 0; + _$jscoverage['middleware/responseTime.js'][20] = 0; + _$jscoverage['middleware/responseTime.js'][22] = 0; + _$jscoverage['middleware/responseTime.js'][23] = 0; + _$jscoverage['middleware/responseTime.js'][25] = 0; + _$jscoverage['middleware/responseTime.js'][26] = 0; + _$jscoverage['middleware/responseTime.js'][27] = 0; + _$jscoverage['middleware/responseTime.js'][30] = 0; +} +_$jscoverage['middleware/responseTime.js'][18]++; +module.exports = (function responseTime() { + _$jscoverage['middleware/responseTime.js'][19]++; + return (function (req, res, next) { + _$jscoverage['middleware/responseTime.js'][20]++; + var start = new Date(); + _$jscoverage['middleware/responseTime.js'][22]++; + if (res._responseTime) { + _$jscoverage['middleware/responseTime.js'][22]++; + return next(); + } + _$jscoverage['middleware/responseTime.js'][23]++; + res._responseTime = true; + _$jscoverage['middleware/responseTime.js'][25]++; + res.on("header", (function () { + _$jscoverage['middleware/responseTime.js'][26]++; + var duration = new Date() - start; + _$jscoverage['middleware/responseTime.js'][27]++; + res.setHeader("X-Response-Time", duration + "ms"); +})); + _$jscoverage['middleware/responseTime.js'][30]++; + next(); +}); +}); +_$jscoverage['middleware/responseTime.js'].source = ["","/*!"," * Connect - responseTime"," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Reponse time:"," *"," * Adds the `X-Response-Time` header displaying the response"," * duration in milliseconds."," *"," * @return {Function}"," * @api public"," */","","module.exports = function responseTime(){"," return function(req, res, next){"," var start = new Date;",""," if (res._responseTime) return next();"," res._responseTime = true;",""," res.on('header', function(){"," var duration = new Date - start;"," res.setHeader('X-Response-Time', duration + 'ms');"," });",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/session.js b/node_modules/connect/lib-cov/middleware/session.js new file mode 100644 index 0000000..5ff99f8 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/session.js @@ -0,0 +1,321 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/session.js']) { + _$jscoverage['middleware/session.js'] = []; + _$jscoverage['middleware/session.js'][13] = 0; + _$jscoverage['middleware/session.js'][25] = 0; + _$jscoverage['middleware/session.js'][31] = 0; + _$jscoverage['middleware/session.js'][37] = 0; + _$jscoverage['middleware/session.js'][38] = 0; + _$jscoverage['middleware/session.js'][39] = 0; + _$jscoverage['middleware/session.js'][40] = 0; + _$jscoverage['middleware/session.js'][46] = 0; + _$jscoverage['middleware/session.js'][188] = 0; + _$jscoverage['middleware/session.js'][189] = 0; + _$jscoverage['middleware/session.js'][198] = 0; + _$jscoverage['middleware/session.js'][199] = 0; + _$jscoverage['middleware/session.js'][203] = 0; + _$jscoverage['middleware/session.js'][204] = 0; + _$jscoverage['middleware/session.js'][205] = 0; + _$jscoverage['middleware/session.js'][206] = 0; + _$jscoverage['middleware/session.js'][209] = 0; + _$jscoverage['middleware/session.js'][210] = 0; + _$jscoverage['middleware/session.js'][212] = 0; + _$jscoverage['middleware/session.js'][214] = 0; + _$jscoverage['middleware/session.js'][218] = 0; + _$jscoverage['middleware/session.js'][221] = 0; + _$jscoverage['middleware/session.js'][225] = 0; + _$jscoverage['middleware/session.js'][228] = 0; + _$jscoverage['middleware/session.js'][231] = 0; + _$jscoverage['middleware/session.js'][235] = 0; + _$jscoverage['middleware/session.js'][238] = 0; + _$jscoverage['middleware/session.js'][241] = 0; + _$jscoverage['middleware/session.js'][243] = 0; + _$jscoverage['middleware/session.js'][244] = 0; + _$jscoverage['middleware/session.js'][248] = 0; + _$jscoverage['middleware/session.js'][249] = 0; + _$jscoverage['middleware/session.js'][250] = 0; + _$jscoverage['middleware/session.js'][257] = 0; + _$jscoverage['middleware/session.js'][260] = 0; + _$jscoverage['middleware/session.js'][261] = 0; + _$jscoverage['middleware/session.js'][263] = 0; + _$jscoverage['middleware/session.js'][264] = 0; + _$jscoverage['middleware/session.js'][267] = 0; + _$jscoverage['middleware/session.js'][268] = 0; + _$jscoverage['middleware/session.js'][269] = 0; + _$jscoverage['middleware/session.js'][270] = 0; + _$jscoverage['middleware/session.js'][274] = 0; + _$jscoverage['middleware/session.js'][275] = 0; + _$jscoverage['middleware/session.js'][276] = 0; + _$jscoverage['middleware/session.js'][277] = 0; + _$jscoverage['middleware/session.js'][278] = 0; + _$jscoverage['middleware/session.js'][279] = 0; + _$jscoverage['middleware/session.js'][280] = 0; + _$jscoverage['middleware/session.js'][281] = 0; + _$jscoverage['middleware/session.js'][282] = 0; + _$jscoverage['middleware/session.js'][287] = 0; + _$jscoverage['middleware/session.js'][288] = 0; + _$jscoverage['middleware/session.js'][292] = 0; + _$jscoverage['middleware/session.js'][295] = 0; + _$jscoverage['middleware/session.js'][296] = 0; + _$jscoverage['middleware/session.js'][297] = 0; + _$jscoverage['middleware/session.js'][298] = 0; + _$jscoverage['middleware/session.js'][299] = 0; + _$jscoverage['middleware/session.js'][303] = 0; + _$jscoverage['middleware/session.js'][304] = 0; + _$jscoverage['middleware/session.js'][305] = 0; + _$jscoverage['middleware/session.js'][307] = 0; + _$jscoverage['middleware/session.js'][308] = 0; + _$jscoverage['middleware/session.js'][309] = 0; + _$jscoverage['middleware/session.js'][310] = 0; + _$jscoverage['middleware/session.js'][314] = 0; + _$jscoverage['middleware/session.js'][315] = 0; + _$jscoverage['middleware/session.js'][316] = 0; + _$jscoverage['middleware/session.js'][317] = 0; + _$jscoverage['middleware/session.js'][318] = 0; + _$jscoverage['middleware/session.js'][320] = 0; + _$jscoverage['middleware/session.js'][323] = 0; + _$jscoverage['middleware/session.js'][324] = 0; + _$jscoverage['middleware/session.js'][325] = 0; + _$jscoverage['middleware/session.js'][326] = 0; + _$jscoverage['middleware/session.js'][329] = 0; + _$jscoverage['middleware/session.js'][330] = 0; + _$jscoverage['middleware/session.js'][331] = 0; + _$jscoverage['middleware/session.js'][332] = 0; + _$jscoverage['middleware/session.js'][333] = 0; + _$jscoverage['middleware/session.js'][337] = 0; + _$jscoverage['middleware/session.js'][348] = 0; + _$jscoverage['middleware/session.js'][349] = 0; + _$jscoverage['middleware/session.js'][350] = 0; +} +_$jscoverage['middleware/session.js'][13]++; +var Session = require("./session/session"), debug = require("debug")("connect:session"), MemoryStore = require("./session/memory"), signature = require("cookie-signature"), Cookie = require("./session/cookie"), Store = require("./session/store"), utils = require("./../utils"), parse = utils.parseUrl, crc16 = require("crc").crc16; +_$jscoverage['middleware/session.js'][25]++; +var env = process.env.NODE_ENV; +_$jscoverage['middleware/session.js'][31]++; +exports = module.exports = session; +_$jscoverage['middleware/session.js'][37]++; +exports.Store = Store; +_$jscoverage['middleware/session.js'][38]++; +exports.Cookie = Cookie; +_$jscoverage['middleware/session.js'][39]++; +exports.Session = Session; +_$jscoverage['middleware/session.js'][40]++; +exports.MemoryStore = MemoryStore; +_$jscoverage['middleware/session.js'][46]++; +var warning = "Warning: connection.session() MemoryStore is not\ndesigned for a production environment, as it will leak\nmemory, and will not scale past a single process."; +_$jscoverage['middleware/session.js'][188]++; +function session(options) { + _$jscoverage['middleware/session.js'][189]++; + var options = options || {}, key = options.key || "connect.sid", store = options.store || new MemoryStore(), cookie = options.cookie || {}, trustProxy = options.proxy, storeReady = true; + _$jscoverage['middleware/session.js'][198]++; + if ("production" == env && store instanceof MemoryStore) { + _$jscoverage['middleware/session.js'][199]++; + console.warn(warning); + } + _$jscoverage['middleware/session.js'][203]++; + store.generate = (function (req) { + _$jscoverage['middleware/session.js'][204]++; + req.sessionID = utils.uid(24); + _$jscoverage['middleware/session.js'][205]++; + req.session = new Session(req); + _$jscoverage['middleware/session.js'][206]++; + req.session.cookie = new Cookie(cookie); +}); + _$jscoverage['middleware/session.js'][209]++; + store.on("disconnect", (function () { + _$jscoverage['middleware/session.js'][209]++; + storeReady = false; +})); + _$jscoverage['middleware/session.js'][210]++; + store.on("connect", (function () { + _$jscoverage['middleware/session.js'][210]++; + storeReady = true; +})); + _$jscoverage['middleware/session.js'][212]++; + return (function session(req, res, next) { + _$jscoverage['middleware/session.js'][214]++; + if (req.session) { + _$jscoverage['middleware/session.js'][214]++; + return next(); + } + _$jscoverage['middleware/session.js'][218]++; + if (! storeReady) { + _$jscoverage['middleware/session.js'][218]++; + return debug("store is disconnected"), next(); + } + _$jscoverage['middleware/session.js'][221]++; + if (0 != req.originalUrl.indexOf(cookie.path || "/")) { + _$jscoverage['middleware/session.js'][221]++; + return next(); + } + _$jscoverage['middleware/session.js'][225]++; + var secret = options.secret || req.secret; + _$jscoverage['middleware/session.js'][228]++; + if (! secret) { + _$jscoverage['middleware/session.js'][228]++; + throw new Error("`secret` option required for sessions"); + } + _$jscoverage['middleware/session.js'][231]++; + var originalHash, originalId; + _$jscoverage['middleware/session.js'][235]++; + req.sessionStore = store; + _$jscoverage['middleware/session.js'][238]++; + var rawCookie = req.cookies[key]; + _$jscoverage['middleware/session.js'][241]++; + var unsignedCookie = req.signedCookies[key]; + _$jscoverage['middleware/session.js'][243]++; + if (! unsignedCookie && rawCookie) { + _$jscoverage['middleware/session.js'][244]++; + unsignedCookie = utils.parseSignedCookie(rawCookie, secret); + } + _$jscoverage['middleware/session.js'][248]++; + res.on("header", (function () { + _$jscoverage['middleware/session.js'][249]++; + if (! req.session) { + _$jscoverage['middleware/session.js'][249]++; + return; + } + _$jscoverage['middleware/session.js'][250]++; + var cookie = req.session.cookie, proto = (req.headers["x-forwarded-proto"] || "").toLowerCase(), tls = req.connection.encrypted || (trustProxy && "https" == proto), secured = cookie.secure && tls, isNew = unsignedCookie != req.sessionID; + _$jscoverage['middleware/session.js'][257]++; + if (cookie.secure && ! secured) { + _$jscoverage['middleware/session.js'][257]++; + return debug("not secured"); + } + _$jscoverage['middleware/session.js'][260]++; + if (null == cookie.expires) { + _$jscoverage['middleware/session.js'][261]++; + if (! isNew) { + _$jscoverage['middleware/session.js'][261]++; + return debug("already set browser-session cookie"); + } + } + else { + _$jscoverage['middleware/session.js'][263]++; + if (originalHash == hash(req.session) && originalId == req.session.id) { + _$jscoverage['middleware/session.js'][264]++; + return debug("unmodified session"); + } + } + _$jscoverage['middleware/session.js'][267]++; + var val = "s:" + signature.sign(req.sessionID, secret); + _$jscoverage['middleware/session.js'][268]++; + val = cookie.serialize(key, val); + _$jscoverage['middleware/session.js'][269]++; + debug("set-cookie %s", val); + _$jscoverage['middleware/session.js'][270]++; + res.setHeader("Set-Cookie", val); +})); + _$jscoverage['middleware/session.js'][274]++; + var end = res.end; + _$jscoverage['middleware/session.js'][275]++; + res.end = (function (data, encoding) { + _$jscoverage['middleware/session.js'][276]++; + res.end = end; + _$jscoverage['middleware/session.js'][277]++; + if (! req.session) { + _$jscoverage['middleware/session.js'][277]++; + return res.end(data, encoding); + } + _$jscoverage['middleware/session.js'][278]++; + debug("saving"); + _$jscoverage['middleware/session.js'][279]++; + req.session.resetMaxAge(); + _$jscoverage['middleware/session.js'][280]++; + req.session.save((function () { + _$jscoverage['middleware/session.js'][281]++; + debug("saved"); + _$jscoverage['middleware/session.js'][282]++; + res.end(data, encoding); +})); +}); + _$jscoverage['middleware/session.js'][287]++; + function generate() { + _$jscoverage['middleware/session.js'][288]++; + store.generate(req); +} + _$jscoverage['middleware/session.js'][292]++; + req.sessionID = unsignedCookie; + _$jscoverage['middleware/session.js'][295]++; + if (! req.sessionID) { + _$jscoverage['middleware/session.js'][296]++; + debug("no SID sent, generating session"); + _$jscoverage['middleware/session.js'][297]++; + generate(); + _$jscoverage['middleware/session.js'][298]++; + next(); + _$jscoverage['middleware/session.js'][299]++; + return; + } + _$jscoverage['middleware/session.js'][303]++; + var pause = utils.pause(req); + _$jscoverage['middleware/session.js'][304]++; + debug("fetching %s", req.sessionID); + _$jscoverage['middleware/session.js'][305]++; + store.get(req.sessionID, (function (err, sess) { + _$jscoverage['middleware/session.js'][307]++; + var _next = next; + _$jscoverage['middleware/session.js'][308]++; + next = (function (err) { + _$jscoverage['middleware/session.js'][309]++; + _next(err); + _$jscoverage['middleware/session.js'][310]++; + pause.resume(); +}); + _$jscoverage['middleware/session.js'][314]++; + if (err) { + _$jscoverage['middleware/session.js'][315]++; + debug("error"); + _$jscoverage['middleware/session.js'][316]++; + if ("ENOENT" == err.code) { + _$jscoverage['middleware/session.js'][317]++; + generate(); + _$jscoverage['middleware/session.js'][318]++; + next(); + } + else { + _$jscoverage['middleware/session.js'][320]++; + next(err); + } + } + else { + _$jscoverage['middleware/session.js'][323]++; + if (! sess) { + _$jscoverage['middleware/session.js'][324]++; + debug("no session found"); + _$jscoverage['middleware/session.js'][325]++; + generate(); + _$jscoverage['middleware/session.js'][326]++; + next(); + } + else { + _$jscoverage['middleware/session.js'][329]++; + debug("session found"); + _$jscoverage['middleware/session.js'][330]++; + store.createSession(req, sess); + _$jscoverage['middleware/session.js'][331]++; + originalId = req.sessionID; + _$jscoverage['middleware/session.js'][332]++; + originalHash = hash(sess); + _$jscoverage['middleware/session.js'][333]++; + next(); + } + } +})); +}); +} +_$jscoverage['middleware/session.js'][337]++; +; +_$jscoverage['middleware/session.js'][348]++; +function hash(sess) { + _$jscoverage['middleware/session.js'][349]++; + return crc16(JSON.stringify(sess, (function (key, val) { + _$jscoverage['middleware/session.js'][350]++; + if ("cookie" != key) { + _$jscoverage['middleware/session.js'][350]++; + return val; + } +}))); +} +_$jscoverage['middleware/session.js'].source = ["","/*!"," * Connect - session"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var Session = require('./session/session')"," , debug = require('debug')('connect:session')"," , MemoryStore = require('./session/memory')"," , signature = require('cookie-signature')"," , Cookie = require('./session/cookie')"," , Store = require('./session/store')"," , utils = require('./../utils')"," , parse = utils.parseUrl"," , crc16 = require('crc').crc16;","","// environment","","var env = process.env.NODE_ENV;","","/**"," * Expose the middleware."," */","","exports = module.exports = session;","","/**"," * Expose constructors."," */","","exports.Store = Store;","exports.Cookie = Cookie;","exports.Session = Session;","exports.MemoryStore = MemoryStore;","","/**"," * Warning message for `MemoryStore` usage in production."," */","","var warning = 'Warning: connection.session() MemoryStore is not\\n'"," + 'designed for a production environment, as it will leak\\n'"," + 'memory, and will not scale past a single process.';","","/**"," * Session:"," * "," * Setup session store with the given `options`."," *"," * Session data is _not_ saved in the cookie itself, however"," * cookies are used, so we must use the [cookieParser()](cookieParser.html)"," * middleware _before_ `session()`."," *"," * Examples:"," *"," * connect()"," * .use(connect.cookieParser())"," * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))"," *"," * Options:"," *"," * - `key` cookie name defaulting to `connect.sid`"," * - `store` session store instance"," * - `secret` session cookie is signed with this secret to prevent tampering"," * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`"," * - `proxy` trust the reverse proxy when setting secure cookies (via \"x-forwarded-proto\")"," *"," * Cookie option:"," *"," * By default `cookie.maxAge` is `null`, meaning no \"expires\" parameter is set"," * so the cookie becomes a browser-session cookie. When the user closes the "," * browser the cookie (and session) will be removed."," *"," * ## req.session"," *"," * To store or access session data, simply use the request property `req.session`,"," * which is (generally) serialized as JSON by the store, so nested objects "," * are typically fine. For example below is a user-specific view counter:"," *"," * connect()"," * .use(connect.favicon())"," * .use(connect.cookieParser())"," * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))"," * .use(function(req, res, next){"," * var sess = req.session;"," * if (sess.views) {"," * res.setHeader('Content-Type', 'text/html');"," * res.write('<p>views: ' + sess.views + '</p>');"," * res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');"," * res.end();"," * sess.views++;"," * } else {"," * sess.views = 1;"," * res.end('welcome to the session demo. refresh!');"," * }"," * }"," * )).listen(3000);"," *"," * ## Session#regenerate()"," *"," * To regenerate the session simply invoke the method, once complete"," * a new SID and `Session` instance will be initialized at `req.session`."," *"," * req.session.regenerate(function(err){"," * // will have a new session here"," * });"," *"," * ## Session#destroy()"," *"," * Destroys the session, removing `req.session`, will be re-generated next request."," *"," * req.session.destroy(function(err){"," * // cannot access session here"," * });"," * "," * ## Session#reload()"," *"," * Reloads the session data."," *"," * req.session.reload(function(err){"," * // session updated"," * });"," *"," * ## Session#save()"," *"," * Save the session."," *"," * req.session.save(function(err){"," * // session saved"," * });"," *"," * ## Session#touch()"," *"," * Updates the `.maxAge` property. Typically this is"," * not necessary to call, as the session middleware does this for you."," *"," * ## Session#cookie"," *"," * Each session has a unique cookie object accompany it. This allows"," * you to alter the session cookie per visitor. For example we can"," * set `req.session.cookie.expires` to `false` to enable the cookie"," * to remain for only the duration of the user-agent."," *"," * ## Session#maxAge"," *"," * Alternatively `req.session.cookie.maxAge` will return the time"," * remaining in milliseconds, which we may also re-assign a new value"," * to adjust the `.expires` property appropriately. The following"," * are essentially equivalent"," *"," * var hour = 3600000;"," * req.session.cookie.expires = new Date(Date.now() + hour);"," * req.session.cookie.maxAge = hour;"," *"," * For example when `maxAge` is set to `60000` (one minute), and 30 seconds"," * has elapsed it will return `30000` until the current request has completed,"," * at which time `req.session.touch()` is called to reset `req.session.maxAge`"," * to its original value."," *"," * req.session.cookie.maxAge;"," * // => 30000"," *"," * Session Store Implementation:"," *"," * Every session store _must_ implement the following methods"," *"," * - `.get(sid, callback)`"," * - `.set(sid, session, callback)`"," * - `.destroy(sid, callback)`"," *"," * Recommended methods include, but are not limited to:"," *"," * - `.length(callback)`"," * - `.clear(callback)`"," *"," * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo."," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","function session(options){"," var options = options || {}"," , key = options.key || 'connect.sid'"," , store = options.store || new MemoryStore"," , cookie = options.cookie || {}"," , trustProxy = options.proxy"," , storeReady = true;",""," // notify user that this store is not"," // meant for a production environment"," if ('production' == env && store instanceof MemoryStore) {"," console.warn(warning);"," }",""," // generates the new session"," store.generate = function(req){"," req.sessionID = utils.uid(24);"," req.session = new Session(req);"," req.session.cookie = new Cookie(cookie);"," };",""," store.on('disconnect', function(){ storeReady = false; });"," store.on('connect', function(){ storeReady = true; });",""," return function session(req, res, next) {"," // self-awareness"," if (req.session) return next();",""," // Handle connection as if there is no session if"," // the store has temporarily disconnected etc"," if (!storeReady) return debug('store is disconnected'), next();",""," // pathname mismatch"," if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next();",""," // backwards compatibility for signed cookies"," // req.secret is passed from the cookie parser middleware"," var secret = options.secret || req.secret;",""," // ensure secret is available or bail"," if (!secret) throw new Error('`secret` option required for sessions');",""," // parse url"," var originalHash"," , originalId;",""," // expose store"," req.sessionStore = store;",""," // grab the session cookie value and check the signature"," var rawCookie = req.cookies[key];",""," // get signedCookies for backwards compat with signed cookies"," var unsignedCookie = req.signedCookies[key];",""," if (!unsignedCookie && rawCookie) {"," unsignedCookie = utils.parseSignedCookie(rawCookie, secret);"," }",""," // set-cookie"," res.on('header', function(){"," if (!req.session) return;"," var cookie = req.session.cookie"," , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()"," , tls = req.connection.encrypted || (trustProxy && 'https' == proto)"," , secured = cookie.secure && tls"," , isNew = unsignedCookie != req.sessionID;",""," // only send secure cookies via https"," if (cookie.secure && !secured) return debug('not secured');",""," // browser-session length cookie"," if (null == cookie.expires) {"," if (!isNew) return debug('already set browser-session cookie');"," // compare hashes and ids"," } else if (originalHash == hash(req.session) && originalId == req.session.id) {"," return debug('unmodified session');"," }",""," var val = 's:' + signature.sign(req.sessionID, secret);"," val = cookie.serialize(key, val);"," debug('set-cookie %s', val);"," res.setHeader('Set-Cookie', val);"," });",""," // proxy end() to commit the session"," var end = res.end;"," res.end = function(data, encoding){"," res.end = end;"," if (!req.session) return res.end(data, encoding);"," debug('saving');"," req.session.resetMaxAge();"," req.session.save(function(){"," debug('saved');"," res.end(data, encoding);"," });"," };",""," // generate the session"," function generate() {"," store.generate(req);"," }",""," // get the sessionID from the cookie"," req.sessionID = unsignedCookie;",""," // generate a session if the browser doesn't send a sessionID"," if (!req.sessionID) {"," debug('no SID sent, generating session');"," generate();"," next();"," return;"," }",""," // generate the session object"," var pause = utils.pause(req);"," debug('fetching %s', req.sessionID);"," store.get(req.sessionID, function(err, sess){"," // proxy to resume() events"," var _next = next;"," next = function(err){"," _next(err);"," pause.resume();"," };",""," // error handling"," if (err) {"," debug('error');"," if ('ENOENT' == err.code) {"," generate();"," next();"," } else {"," next(err);"," }"," // no session"," } else if (!sess) {"," debug('no session found');"," generate();"," next();"," // populate req.session"," } else {"," debug('session found');"," store.createSession(req, sess);"," originalId = req.sessionID;"," originalHash = hash(sess);"," next();"," }"," });"," };","};","","/**"," * Hash the given `sess` object omitting changes"," * to `.cookie`."," *"," * @param {Object} sess"," * @return {String}"," * @api private"," */","","function hash(sess) {"," return crc16(JSON.stringify(sess, function(key, val){"," if ('cookie' != key) return val;"," }));","}"]; diff --git a/node_modules/connect/lib-cov/middleware/session/cookie.js b/node_modules/connect/lib-cov/middleware/session/cookie.js new file mode 100644 index 0000000..279afe5 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/session/cookie.js @@ -0,0 +1,65 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/session/cookie.js']) { + _$jscoverage['middleware/session/cookie.js'] = []; + _$jscoverage['middleware/session/cookie.js'][13] = 0; + _$jscoverage['middleware/session/cookie.js'][24] = 0; + _$jscoverage['middleware/session/cookie.js'][25] = 0; + _$jscoverage['middleware/session/cookie.js'][26] = 0; + _$jscoverage['middleware/session/cookie.js'][27] = 0; + _$jscoverage['middleware/session/cookie.js'][28] = 0; + _$jscoverage['middleware/session/cookie.js'][29] = 0; + _$jscoverage['middleware/session/cookie.js'][38] = 0; + _$jscoverage['middleware/session/cookie.js'][48] = 0; + _$jscoverage['middleware/session/cookie.js'][49] = 0; + _$jscoverage['middleware/session/cookie.js'][60] = 0; + _$jscoverage['middleware/session/cookie.js'][71] = 0; + _$jscoverage['middleware/session/cookie.js'][84] = 0; + _$jscoverage['middleware/session/cookie.js'][97] = 0; + _$jscoverage['middleware/session/cookie.js'][115] = 0; + _$jscoverage['middleware/session/cookie.js'][126] = 0; +} +_$jscoverage['middleware/session/cookie.js'][13]++; +var utils = require("../../utils"), cookie = require("cookie"); +_$jscoverage['middleware/session/cookie.js'][24]++; +var Cookie = module.exports = (function Cookie(options) { + _$jscoverage['middleware/session/cookie.js'][25]++; + this.path = "/"; + _$jscoverage['middleware/session/cookie.js'][26]++; + this.maxAge = null; + _$jscoverage['middleware/session/cookie.js'][27]++; + this.httpOnly = true; + _$jscoverage['middleware/session/cookie.js'][28]++; + if (options) { + _$jscoverage['middleware/session/cookie.js'][28]++; + utils.merge(this, options); + } + _$jscoverage['middleware/session/cookie.js'][29]++; + this.originalMaxAge = undefined == this.originalMaxAge? this.maxAge: this.originalMaxAge; +}); +_$jscoverage['middleware/session/cookie.js'][38]++; +Cookie.prototype = {set expires (date) { + _$jscoverage['middleware/session/cookie.js'][48]++; + this._expires = date; + _$jscoverage['middleware/session/cookie.js'][49]++; + this.originalMaxAge = this.maxAge; +}, get expires () { + _$jscoverage['middleware/session/cookie.js'][60]++; + return this._expires; +}, set maxAge (ms) { + _$jscoverage['middleware/session/cookie.js'][71]++; + this.expires = "number" == typeof ms? new Date(Date.now() + ms): ms; +}, get maxAge () { + _$jscoverage['middleware/session/cookie.js'][84]++; + return this.expires instanceof Date? this.expires.valueOf() - Date.now(): this.expires; +}, get data () { + _$jscoverage['middleware/session/cookie.js'][97]++; + return ({originalMaxAge: this.originalMaxAge, expires: this._expires, secure: this.secure, httpOnly: this.httpOnly, domain: this.domain, path: this.path}); +}, serialize: (function (name, val) { + _$jscoverage['middleware/session/cookie.js'][115]++; + return cookie.serialize(name, val, this.data); +}), toJSON: (function () { + _$jscoverage['middleware/session/cookie.js'][126]++; + return this.data; +})}; +_$jscoverage['middleware/session/cookie.js'].source = ["","/*!"," * Connect - session - Cookie"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../../utils')"," , cookie = require('cookie');","","/**"," * Initialize a new `Cookie` with the given `options`."," *"," * @param {IncomingMessage} req"," * @param {Object} options"," * @api private"," */","","var Cookie = module.exports = function Cookie(options) {"," this.path = '/';"," this.maxAge = null;"," this.httpOnly = true;"," if (options) utils.merge(this, options);"," this.originalMaxAge = undefined == this.originalMaxAge"," ? this.maxAge"," : this.originalMaxAge;","};","","/*!"," * Prototype."," */","","Cookie.prototype = {",""," /**"," * Set expires `date`."," *"," * @param {Date} date"," * @api public"," */"," "," set expires(date) {"," this._expires = date;"," this.originalMaxAge = this.maxAge;"," },",""," /**"," * Get expires `date`."," *"," * @return {Date}"," * @api public"," */",""," get expires() {"," return this._expires;"," },"," "," /**"," * Set expires via max-age in `ms`."," *"," * @param {Number} ms"," * @api public"," */"," "," set maxAge(ms) {"," this.expires = 'number' == typeof ms"," ? new Date(Date.now() + ms)"," : ms;"," },",""," /**"," * Get expires max-age in `ms`."," *"," * @return {Number}"," * @api public"," */",""," get maxAge() {"," return this.expires instanceof Date"," ? this.expires.valueOf() - Date.now()"," : this.expires;"," },",""," /**"," * Return cookie data object."," *"," * @return {Object}"," * @api private"," */",""," get data() {"," return {"," originalMaxAge: this.originalMaxAge"," , expires: this._expires"," , secure: this.secure"," , httpOnly: this.httpOnly"," , domain: this.domain"," , path: this.path"," }"," },",""," /**"," * Return a serialized cookie string."," *"," * @return {String}"," * @api public"," */",""," serialize: function(name, val){"," return cookie.serialize(name, val, this.data);"," },",""," /**"," * Return JSON representation of this cookie."," *"," * @return {Object}"," * @api private"," */"," "," toJSON: function(){"," return this.data;"," }","};"]; diff --git a/node_modules/connect/lib-cov/middleware/session/memory.js b/node_modules/connect/lib-cov/middleware/session/memory.js new file mode 100644 index 0000000..f140187 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/session/memory.js @@ -0,0 +1,128 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/session/memory.js']) { + _$jscoverage['middleware/session/memory.js'] = []; + _$jscoverage['middleware/session/memory.js'][13] = 0; + _$jscoverage['middleware/session/memory.js'][21] = 0; + _$jscoverage['middleware/session/memory.js'][22] = 0; + _$jscoverage['middleware/session/memory.js'][29] = 0; + _$jscoverage['middleware/session/memory.js'][39] = 0; + _$jscoverage['middleware/session/memory.js'][40] = 0; + _$jscoverage['middleware/session/memory.js'][41] = 0; + _$jscoverage['middleware/session/memory.js'][42] = 0; + _$jscoverage['middleware/session/memory.js'][44] = 0; + _$jscoverage['middleware/session/memory.js'][45] = 0; + _$jscoverage['middleware/session/memory.js'][46] = 0; + _$jscoverage['middleware/session/memory.js'][49] = 0; + _$jscoverage['middleware/session/memory.js'][50] = 0; + _$jscoverage['middleware/session/memory.js'][52] = 0; + _$jscoverage['middleware/session/memory.js'][55] = 0; + _$jscoverage['middleware/session/memory.js'][69] = 0; + _$jscoverage['middleware/session/memory.js'][70] = 0; + _$jscoverage['middleware/session/memory.js'][71] = 0; + _$jscoverage['middleware/session/memory.js'][72] = 0; + _$jscoverage['middleware/session/memory.js'][73] = 0; + _$jscoverage['middleware/session/memory.js'][84] = 0; + _$jscoverage['middleware/session/memory.js'][85] = 0; + _$jscoverage['middleware/session/memory.js'][86] = 0; + _$jscoverage['middleware/session/memory.js'][87] = 0; + _$jscoverage['middleware/session/memory.js'][88] = 0; + _$jscoverage['middleware/session/memory.js'][99] = 0; + _$jscoverage['middleware/session/memory.js'][100] = 0; + _$jscoverage['middleware/session/memory.js'][102] = 0; + _$jscoverage['middleware/session/memory.js'][103] = 0; + _$jscoverage['middleware/session/memory.js'][105] = 0; + _$jscoverage['middleware/session/memory.js'][115] = 0; + _$jscoverage['middleware/session/memory.js'][116] = 0; + _$jscoverage['middleware/session/memory.js'][117] = 0; + _$jscoverage['middleware/session/memory.js'][127] = 0; + _$jscoverage['middleware/session/memory.js'][128] = 0; +} +_$jscoverage['middleware/session/memory.js'][13]++; +var Store = require("./store"); +_$jscoverage['middleware/session/memory.js'][21]++; +var MemoryStore = module.exports = (function MemoryStore() { + _$jscoverage['middleware/session/memory.js'][22]++; + this.sessions = {}; +}); +_$jscoverage['middleware/session/memory.js'][29]++; +MemoryStore.prototype.__proto__ = Store.prototype; +_$jscoverage['middleware/session/memory.js'][39]++; +MemoryStore.prototype.get = (function (sid, fn) { + _$jscoverage['middleware/session/memory.js'][40]++; + var self = this; + _$jscoverage['middleware/session/memory.js'][41]++; + process.nextTick((function () { + _$jscoverage['middleware/session/memory.js'][42]++; + var expires, sess = self.sessions[sid]; + _$jscoverage['middleware/session/memory.js'][44]++; + if (sess) { + _$jscoverage['middleware/session/memory.js'][45]++; + sess = JSON.parse(sess); + _$jscoverage['middleware/session/memory.js'][46]++; + expires = "string" == typeof sess.cookie.expires? new Date(sess.cookie.expires): sess.cookie.expires; + _$jscoverage['middleware/session/memory.js'][49]++; + if (! expires || new Date() < expires) { + _$jscoverage['middleware/session/memory.js'][50]++; + fn(null, sess); + } + else { + _$jscoverage['middleware/session/memory.js'][52]++; + self.destroy(sid, fn); + } + } + else { + _$jscoverage['middleware/session/memory.js'][55]++; + fn(); + } +})); +}); +_$jscoverage['middleware/session/memory.js'][69]++; +MemoryStore.prototype.set = (function (sid, sess, fn) { + _$jscoverage['middleware/session/memory.js'][70]++; + var self = this; + _$jscoverage['middleware/session/memory.js'][71]++; + process.nextTick((function () { + _$jscoverage['middleware/session/memory.js'][72]++; + self.sessions[sid] = JSON.stringify(sess); + _$jscoverage['middleware/session/memory.js'][73]++; + fn && fn(); +})); +}); +_$jscoverage['middleware/session/memory.js'][84]++; +MemoryStore.prototype.destroy = (function (sid, fn) { + _$jscoverage['middleware/session/memory.js'][85]++; + var self = this; + _$jscoverage['middleware/session/memory.js'][86]++; + process.nextTick((function () { + _$jscoverage['middleware/session/memory.js'][87]++; + delete self.sessions[sid]; + _$jscoverage['middleware/session/memory.js'][88]++; + fn && fn(); +})); +}); +_$jscoverage['middleware/session/memory.js'][99]++; +MemoryStore.prototype.all = (function (fn) { + _$jscoverage['middleware/session/memory.js'][100]++; + var arr = [], keys = Object.keys(this.sessions); + _$jscoverage['middleware/session/memory.js'][102]++; + for (var i = 0, len = keys.length; i < len; ++i) { + _$jscoverage['middleware/session/memory.js'][103]++; + arr.push(this.sessions[keys[i]]); +} + _$jscoverage['middleware/session/memory.js'][105]++; + fn(null, arr); +}); +_$jscoverage['middleware/session/memory.js'][115]++; +MemoryStore.prototype.clear = (function (fn) { + _$jscoverage['middleware/session/memory.js'][116]++; + this.sessions = {}; + _$jscoverage['middleware/session/memory.js'][117]++; + fn && fn(); +}); +_$jscoverage['middleware/session/memory.js'][127]++; +MemoryStore.prototype.length = (function (fn) { + _$jscoverage['middleware/session/memory.js'][128]++; + fn(null, Object.keys(this.sessions).length); +}); +_$jscoverage['middleware/session/memory.js'].source = ["","/*!"," * Connect - session - MemoryStore"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var Store = require('./store');","","/**"," * Initialize a new `MemoryStore`."," *"," * @api public"," */","","var MemoryStore = module.exports = function MemoryStore() {"," this.sessions = {};","};","","/**"," * Inherit from `Store.prototype`."," */","","MemoryStore.prototype.__proto__ = Store.prototype;","","/**"," * Attempt to fetch session by the given `sid`."," *"," * @param {String} sid"," * @param {Function} fn"," * @api public"," */","","MemoryStore.prototype.get = function(sid, fn){"," var self = this;"," process.nextTick(function(){"," var expires"," , sess = self.sessions[sid];"," if (sess) {"," sess = JSON.parse(sess);"," expires = 'string' == typeof sess.cookie.expires"," ? new Date(sess.cookie.expires)"," : sess.cookie.expires;"," if (!expires || new Date < expires) {"," fn(null, sess);"," } else {"," self.destroy(sid, fn);"," }"," } else {"," fn();"," }"," });","};","","/**"," * Commit the given `sess` object associated with the given `sid`."," *"," * @param {String} sid"," * @param {Session} sess"," * @param {Function} fn"," * @api public"," */","","MemoryStore.prototype.set = function(sid, sess, fn){"," var self = this;"," process.nextTick(function(){"," self.sessions[sid] = JSON.stringify(sess);"," fn && fn();"," });","};","","/**"," * Destroy the session associated with the given `sid`."," *"," * @param {String} sid"," * @api public"," */","","MemoryStore.prototype.destroy = function(sid, fn){"," var self = this;"," process.nextTick(function(){"," delete self.sessions[sid];"," fn && fn();"," });","};","","/**"," * Invoke the given callback `fn` with all active sessions."," *"," * @param {Function} fn"," * @api public"," */","","MemoryStore.prototype.all = function(fn){"," var arr = []"," , keys = Object.keys(this.sessions);"," for (var i = 0, len = keys.length; i < len; ++i) {"," arr.push(this.sessions[keys[i]]);"," }"," fn(null, arr);","};","","/**"," * Clear all sessions."," *"," * @param {Function} fn"," * @api public"," */","","MemoryStore.prototype.clear = function(fn){"," this.sessions = {};"," fn && fn();","};","","/**"," * Fetch number of sessions."," *"," * @param {Function} fn"," * @api public"," */","","MemoryStore.prototype.length = function(fn){"," fn(null, Object.keys(this.sessions).length);","};"]; diff --git a/node_modules/connect/lib-cov/middleware/session/session.js b/node_modules/connect/lib-cov/middleware/session/session.js new file mode 100644 index 0000000..73e85e0 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/session/session.js @@ -0,0 +1,108 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/session/session.js']) { + _$jscoverage['middleware/session/session.js'] = []; + _$jscoverage['middleware/session/session.js'][13] = 0; + _$jscoverage['middleware/session/session.js'][23] = 0; + _$jscoverage['middleware/session/session.js'][24] = 0; + _$jscoverage['middleware/session/session.js'][25] = 0; + _$jscoverage['middleware/session/session.js'][26] = 0; + _$jscoverage['middleware/session/session.js'][38] = 0; + _$jscoverage['middleware/session/session.js'][39] = 0; + _$jscoverage['middleware/session/session.js'][49] = 0; + _$jscoverage['middleware/session/session.js'][50] = 0; + _$jscoverage['middleware/session/session.js'][51] = 0; + _$jscoverage['middleware/session/session.js'][62] = 0; + _$jscoverage['middleware/session/session.js'][63] = 0; + _$jscoverage['middleware/session/session.js'][64] = 0; + _$jscoverage['middleware/session/session.js'][79] = 0; + _$jscoverage['middleware/session/session.js'][80] = 0; + _$jscoverage['middleware/session/session.js'][82] = 0; + _$jscoverage['middleware/session/session.js'][83] = 0; + _$jscoverage['middleware/session/session.js'][84] = 0; + _$jscoverage['middleware/session/session.js'][85] = 0; + _$jscoverage['middleware/session/session.js'][86] = 0; + _$jscoverage['middleware/session/session.js'][88] = 0; + _$jscoverage['middleware/session/session.js'][99] = 0; + _$jscoverage['middleware/session/session.js'][100] = 0; + _$jscoverage['middleware/session/session.js'][101] = 0; + _$jscoverage['middleware/session/session.js'][102] = 0; + _$jscoverage['middleware/session/session.js'][113] = 0; + _$jscoverage['middleware/session/session.js'][114] = 0; + _$jscoverage['middleware/session/session.js'][115] = 0; +} +_$jscoverage['middleware/session/session.js'][13]++; +var utils = require("../../utils"); +_$jscoverage['middleware/session/session.js'][23]++; +var Session = module.exports = (function Session(req, data) { + _$jscoverage['middleware/session/session.js'][24]++; + Object.defineProperty(this, "req", {value: req}); + _$jscoverage['middleware/session/session.js'][25]++; + Object.defineProperty(this, "id", {value: req.sessionID}); + _$jscoverage['middleware/session/session.js'][26]++; + if ("object" == typeof data) { + _$jscoverage['middleware/session/session.js'][26]++; + utils.merge(this, data); + } +}); +_$jscoverage['middleware/session/session.js'][38]++; +Session.prototype.touch = (function () { + _$jscoverage['middleware/session/session.js'][39]++; + return this.resetMaxAge(); +}); +_$jscoverage['middleware/session/session.js'][49]++; +Session.prototype.resetMaxAge = (function () { + _$jscoverage['middleware/session/session.js'][50]++; + this.cookie.maxAge = this.cookie.originalMaxAge; + _$jscoverage['middleware/session/session.js'][51]++; + return this; +}); +_$jscoverage['middleware/session/session.js'][62]++; +Session.prototype.save = (function (fn) { + _$jscoverage['middleware/session/session.js'][63]++; + this.req.sessionStore.set(this.id, this, fn || (function () { +})); + _$jscoverage['middleware/session/session.js'][64]++; + return this; +}); +_$jscoverage['middleware/session/session.js'][79]++; +Session.prototype.reload = (function (fn) { + _$jscoverage['middleware/session/session.js'][80]++; + var req = this.req, store = this.req.sessionStore; + _$jscoverage['middleware/session/session.js'][82]++; + store.get(this.id, (function (err, sess) { + _$jscoverage['middleware/session/session.js'][83]++; + if (err) { + _$jscoverage['middleware/session/session.js'][83]++; + return fn(err); + } + _$jscoverage['middleware/session/session.js'][84]++; + if (! sess) { + _$jscoverage['middleware/session/session.js'][84]++; + return fn(new Error("failed to load session")); + } + _$jscoverage['middleware/session/session.js'][85]++; + store.createSession(req, sess); + _$jscoverage['middleware/session/session.js'][86]++; + fn(); +})); + _$jscoverage['middleware/session/session.js'][88]++; + return this; +}); +_$jscoverage['middleware/session/session.js'][99]++; +Session.prototype.destroy = (function (fn) { + _$jscoverage['middleware/session/session.js'][100]++; + delete this.req.session; + _$jscoverage['middleware/session/session.js'][101]++; + this.req.sessionStore.destroy(this.id, fn); + _$jscoverage['middleware/session/session.js'][102]++; + return this; +}); +_$jscoverage['middleware/session/session.js'][113]++; +Session.prototype.regenerate = (function (fn) { + _$jscoverage['middleware/session/session.js'][114]++; + this.req.sessionStore.regenerate(this.req, fn); + _$jscoverage['middleware/session/session.js'][115]++; + return this; +}); +_$jscoverage['middleware/session/session.js'].source = ["","/*!"," * Connect - session - Session"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../../utils');","","/**"," * Create a new `Session` with the given request and `data`."," *"," * @param {IncomingRequest} req"," * @param {Object} data"," * @api private"," */","","var Session = module.exports = function Session(req, data) {"," Object.defineProperty(this, 'req', { value: req });"," Object.defineProperty(this, 'id', { value: req.sessionID });"," if ('object' == typeof data) utils.merge(this, data);","};","","/**"," * Update reset `.cookie.maxAge` to prevent"," * the cookie from expiring when the"," * session is still active."," *"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.touch = function(){"," return this.resetMaxAge();","};","","/**"," * Reset `.maxAge` to `.originalMaxAge`."," *"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.resetMaxAge = function(){"," this.cookie.maxAge = this.cookie.originalMaxAge;"," return this;","};","","/**"," * Save the session data with optional callback `fn(err)`."," *"," * @param {Function} fn"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.save = function(fn){"," this.req.sessionStore.set(this.id, this, fn || function(){});"," return this;","};","","/**"," * Re-loads the session data _without_ altering"," * the maxAge properties. Invokes the callback `fn(err)`,"," * after which time if no exception has occurred the"," * `req.session` property will be a new `Session` object,"," * although representing the same session."," *"," * @param {Function} fn"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.reload = function(fn){"," var req = this.req"," , store = this.req.sessionStore;"," store.get(this.id, function(err, sess){"," if (err) return fn(err);"," if (!sess) return fn(new Error('failed to load session'));"," store.createSession(req, sess);"," fn();"," });"," return this;","};","","/**"," * Destroy `this` session."," *"," * @param {Function} fn"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.destroy = function(fn){"," delete this.req.session;"," this.req.sessionStore.destroy(this.id, fn);"," return this;","};","","/**"," * Regenerate this request's session."," *"," * @param {Function} fn"," * @return {Session} for chaining"," * @api public"," */","","Session.prototype.regenerate = function(fn){"," this.req.sessionStore.regenerate(this.req, fn);"," return this;","};"]; diff --git a/node_modules/connect/lib-cov/middleware/session/store.js b/node_modules/connect/lib-cov/middleware/session/store.js new file mode 100644 index 0000000..2d79aa2 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/session/store.js @@ -0,0 +1,90 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/session/store.js']) { + _$jscoverage['middleware/session/store.js'] = []; + _$jscoverage['middleware/session/store.js'][13] = 0; + _$jscoverage['middleware/session/store.js'][23] = 0; + _$jscoverage['middleware/session/store.js'][29] = 0; + _$jscoverage['middleware/session/store.js'][39] = 0; + _$jscoverage['middleware/session/store.js'][40] = 0; + _$jscoverage['middleware/session/store.js'][41] = 0; + _$jscoverage['middleware/session/store.js'][42] = 0; + _$jscoverage['middleware/session/store.js'][43] = 0; + _$jscoverage['middleware/session/store.js'][56] = 0; + _$jscoverage['middleware/session/store.js'][57] = 0; + _$jscoverage['middleware/session/store.js'][58] = 0; + _$jscoverage['middleware/session/store.js'][59] = 0; + _$jscoverage['middleware/session/store.js'][60] = 0; + _$jscoverage['middleware/session/store.js'][61] = 0; + _$jscoverage['middleware/session/store.js'][62] = 0; + _$jscoverage['middleware/session/store.js'][63] = 0; + _$jscoverage['middleware/session/store.js'][76] = 0; + _$jscoverage['middleware/session/store.js'][77] = 0; + _$jscoverage['middleware/session/store.js'][79] = 0; + _$jscoverage['middleware/session/store.js'][80] = 0; + _$jscoverage['middleware/session/store.js'][81] = 0; + _$jscoverage['middleware/session/store.js'][82] = 0; + _$jscoverage['middleware/session/store.js'][83] = 0; +} +_$jscoverage['middleware/session/store.js'][13]++; +var EventEmitter = require("events").EventEmitter, Session = require("./session"), Cookie = require("./cookie"); +_$jscoverage['middleware/session/store.js'][23]++; +var Store = module.exports = (function Store(options) { +}); +_$jscoverage['middleware/session/store.js'][29]++; +Store.prototype.__proto__ = EventEmitter.prototype; +_$jscoverage['middleware/session/store.js'][39]++; +Store.prototype.regenerate = (function (req, fn) { + _$jscoverage['middleware/session/store.js'][40]++; + var self = this; + _$jscoverage['middleware/session/store.js'][41]++; + this.destroy(req.sessionID, (function (err) { + _$jscoverage['middleware/session/store.js'][42]++; + self.generate(req); + _$jscoverage['middleware/session/store.js'][43]++; + fn(err); +})); +}); +_$jscoverage['middleware/session/store.js'][56]++; +Store.prototype.load = (function (sid, fn) { + _$jscoverage['middleware/session/store.js'][57]++; + var self = this; + _$jscoverage['middleware/session/store.js'][58]++; + this.get(sid, (function (err, sess) { + _$jscoverage['middleware/session/store.js'][59]++; + if (err) { + _$jscoverage['middleware/session/store.js'][59]++; + return fn(err); + } + _$jscoverage['middleware/session/store.js'][60]++; + if (! sess) { + _$jscoverage['middleware/session/store.js'][60]++; + return fn(); + } + _$jscoverage['middleware/session/store.js'][61]++; + var req = {sessionID: sid, sessionStore: self}; + _$jscoverage['middleware/session/store.js'][62]++; + sess = self.createSession(req, sess); + _$jscoverage['middleware/session/store.js'][63]++; + fn(null, sess); +})); +}); +_$jscoverage['middleware/session/store.js'][76]++; +Store.prototype.createSession = (function (req, sess) { + _$jscoverage['middleware/session/store.js'][77]++; + var expires = sess.cookie.expires, orig = sess.cookie.originalMaxAge; + _$jscoverage['middleware/session/store.js'][79]++; + sess.cookie = new Cookie(sess.cookie); + _$jscoverage['middleware/session/store.js'][80]++; + if ("string" == typeof expires) { + _$jscoverage['middleware/session/store.js'][80]++; + sess.cookie.expires = new Date(expires); + } + _$jscoverage['middleware/session/store.js'][81]++; + sess.cookie.originalMaxAge = orig; + _$jscoverage['middleware/session/store.js'][82]++; + req.session = new Session(req, sess); + _$jscoverage['middleware/session/store.js'][83]++; + return req.session; +}); +_$jscoverage['middleware/session/store.js'].source = ["","/*!"," * Connect - session - Store"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var EventEmitter = require('events').EventEmitter"," , Session = require('./session')"," , Cookie = require('./cookie');","","/**"," * Initialize abstract `Store`."," *"," * @api private"," */","","var Store = module.exports = function Store(options){};","","/**"," * Inherit from `EventEmitter.prototype`."," */","","Store.prototype.__proto__ = EventEmitter.prototype;","","/**"," * Re-generate the given requests's session."," *"," * @param {IncomingRequest} req"," * @return {Function} fn"," * @api public"," */","","Store.prototype.regenerate = function(req, fn){"," var self = this;"," this.destroy(req.sessionID, function(err){"," self.generate(req);"," fn(err);"," });","};","","/**"," * Load a `Session` instance via the given `sid`"," * and invoke the callback `fn(err, sess)`."," *"," * @param {String} sid"," * @param {Function} fn"," * @api public"," */","","Store.prototype.load = function(sid, fn){"," var self = this;"," this.get(sid, function(err, sess){"," if (err) return fn(err);"," if (!sess) return fn();"," var req = { sessionID: sid, sessionStore: self };"," sess = self.createSession(req, sess);"," fn(null, sess);"," });","};","","/**"," * Create session from JSON `sess` data."," *"," * @param {IncomingRequest} req"," * @param {Object} sess"," * @return {Session}"," * @api private"," */","","Store.prototype.createSession = function(req, sess){"," var expires = sess.cookie.expires"," , orig = sess.cookie.originalMaxAge;"," sess.cookie = new Cookie(sess.cookie);"," if ('string' == typeof expires) sess.cookie.expires = new Date(expires);"," sess.cookie.originalMaxAge = orig;"," req.session = new Session(req, sess);"," return req.session;","};"]; diff --git a/node_modules/connect/lib-cov/middleware/static.js b/node_modules/connect/lib-cov/middleware/static.js new file mode 100644 index 0000000..c52b1c0 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/static.js @@ -0,0 +1,92 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/static.js']) { + _$jscoverage['middleware/static.js'] = []; + _$jscoverage['middleware/static.js'][13] = 0; + _$jscoverage['middleware/static.js'][45] = 0; + _$jscoverage['middleware/static.js'][46] = 0; + _$jscoverage['middleware/static.js'][49] = 0; + _$jscoverage['middleware/static.js'][52] = 0; + _$jscoverage['middleware/static.js'][54] = 0; + _$jscoverage['middleware/static.js'][55] = 0; + _$jscoverage['middleware/static.js'][56] = 0; + _$jscoverage['middleware/static.js'][57] = 0; + _$jscoverage['middleware/static.js'][59] = 0; + _$jscoverage['middleware/static.js'][60] = 0; + _$jscoverage['middleware/static.js'][61] = 0; + _$jscoverage['middleware/static.js'][64] = 0; + _$jscoverage['middleware/static.js'][65] = 0; + _$jscoverage['middleware/static.js'][66] = 0; + _$jscoverage['middleware/static.js'][67] = 0; + _$jscoverage['middleware/static.js'][68] = 0; + _$jscoverage['middleware/static.js'][69] = 0; + _$jscoverage['middleware/static.js'][72] = 0; + _$jscoverage['middleware/static.js'][73] = 0; + _$jscoverage['middleware/static.js'][74] = 0; + _$jscoverage['middleware/static.js'][77] = 0; + _$jscoverage['middleware/static.js'][94] = 0; +} +_$jscoverage['middleware/static.js'][13]++; +var send = require("send"), utils = require("../utils"), parse = utils.parseUrl, url = require("url"); +_$jscoverage['middleware/static.js'][45]++; +exports = module.exports = (function static(root, options) { + _$jscoverage['middleware/static.js'][46]++; + options = options || {}; + _$jscoverage['middleware/static.js'][49]++; + if (! root) { + _$jscoverage['middleware/static.js'][49]++; + throw new Error("static() root path required"); + } + _$jscoverage['middleware/static.js'][52]++; + var redirect = false !== options.redirect; + _$jscoverage['middleware/static.js'][54]++; + return (function static(req, res, next) { + _$jscoverage['middleware/static.js'][55]++; + if ("GET" != req.method && "HEAD" != req.method) { + _$jscoverage['middleware/static.js'][55]++; + return next(); + } + _$jscoverage['middleware/static.js'][56]++; + var path = parse(req).pathname; + _$jscoverage['middleware/static.js'][57]++; + var pause = utils.pause(req); + _$jscoverage['middleware/static.js'][59]++; + function resume() { + _$jscoverage['middleware/static.js'][60]++; + next(); + _$jscoverage['middleware/static.js'][61]++; + pause.resume(); +} + _$jscoverage['middleware/static.js'][64]++; + function directory() { + _$jscoverage['middleware/static.js'][65]++; + if (! redirect) { + _$jscoverage['middleware/static.js'][65]++; + return resume(); + } + _$jscoverage['middleware/static.js'][66]++; + var pathname = url.parse(req.originalUrl).pathname; + _$jscoverage['middleware/static.js'][67]++; + res.statusCode = 301; + _$jscoverage['middleware/static.js'][68]++; + res.setHeader("Location", pathname + "/"); + _$jscoverage['middleware/static.js'][69]++; + res.end("Redirecting to " + utils.escape(pathname) + "/"); +} + _$jscoverage['middleware/static.js'][72]++; + function error(err) { + _$jscoverage['middleware/static.js'][73]++; + if (404 == err.status) { + _$jscoverage['middleware/static.js'][73]++; + return resume(); + } + _$jscoverage['middleware/static.js'][74]++; + next(err); +} + _$jscoverage['middleware/static.js'][77]++; + send(req, path).maxage(options.maxAge || 0).root(root).hidden(options.hidden).on("error", error).on("directory", directory).pipe(res); +}); +}); +_$jscoverage['middleware/static.js'][94]++; +exports.mime = send.mime; +_$jscoverage['middleware/static.js'].source = ["","/*!"," * Connect - static"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var send = require('send')"," , utils = require('../utils')"," , parse = utils.parseUrl"," , url = require('url');","","/**"," * Static:"," *"," * Static file server with the given `root` path."," *"," * Examples:"," *"," * var oneDay = 86400000;"," *"," * connect()"," * .use(connect.static(__dirname + '/public'))"," *"," * connect()"," * .use(connect.static(__dirname + '/public', { maxAge: oneDay }))"," *"," * Options:"," *"," * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0"," * - `hidden` Allow transfer of hidden files. defaults to false"," * - `redirect` Redirect to trailing \"/\" when the pathname is a dir. defaults to true"," *"," * @param {String} root"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function static(root, options){"," options = options || {};",""," // root required"," if (!root) throw new Error('static() root path required');",""," // default redirect"," var redirect = false !== options.redirect;",""," return function static(req, res, next) {"," if ('GET' != req.method && 'HEAD' != req.method) return next();"," var path = parse(req).pathname;"," var pause = utils.pause(req);",""," function resume() {"," next();"," pause.resume();"," }",""," function directory() {"," if (!redirect) return resume();"," var pathname = url.parse(req.originalUrl).pathname;"," res.statusCode = 301;"," res.setHeader('Location', pathname + '/');"," res.end('Redirecting to ' + utils.escape(pathname) + '/');"," }",""," function error(err) {"," if (404 == err.status) return resume();"," next(err);"," }",""," send(req, path)"," .maxage(options.maxAge || 0)"," .root(root)"," .hidden(options.hidden)"," .on('error', error)"," .on('directory', directory)"," .pipe(res);"," };","};","","/**"," * Expose mime module."," * "," * If you wish to extend the mime table use this"," * reference to the \"mime\" module in the npm registry."," */","","exports.mime = send.mime;"]; diff --git a/node_modules/connect/lib-cov/middleware/staticCache.js b/node_modules/connect/lib-cov/middleware/staticCache.js new file mode 100644 index 0000000..e8c2940 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/staticCache.js @@ -0,0 +1,276 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/staticCache.js']) { + _$jscoverage['middleware/staticCache.js'] = []; + _$jscoverage['middleware/staticCache.js'][12] = 0; + _$jscoverage['middleware/staticCache.js'][51] = 0; + _$jscoverage['middleware/staticCache.js'][52] = 0; + _$jscoverage['middleware/staticCache.js'][56] = 0; + _$jscoverage['middleware/staticCache.js'][57] = 0; + _$jscoverage['middleware/staticCache.js'][59] = 0; + _$jscoverage['middleware/staticCache.js'][60] = 0; + _$jscoverage['middleware/staticCache.js'][68] = 0; + _$jscoverage['middleware/staticCache.js'][69] = 0; + _$jscoverage['middleware/staticCache.js'][75] = 0; + _$jscoverage['middleware/staticCache.js'][78] = 0; + _$jscoverage['middleware/staticCache.js'][81] = 0; + _$jscoverage['middleware/staticCache.js'][84] = 0; + _$jscoverage['middleware/staticCache.js'][88] = 0; + _$jscoverage['middleware/staticCache.js'][91] = 0; + _$jscoverage['middleware/staticCache.js'][94] = 0; + _$jscoverage['middleware/staticCache.js'][95] = 0; + _$jscoverage['middleware/staticCache.js'][96] = 0; + _$jscoverage['middleware/staticCache.js'][97] = 0; + _$jscoverage['middleware/staticCache.js'][99] = 0; + _$jscoverage['middleware/staticCache.js'][104] = 0; + _$jscoverage['middleware/staticCache.js'][107] = 0; + _$jscoverage['middleware/staticCache.js'][110] = 0; + _$jscoverage['middleware/staticCache.js'][111] = 0; + _$jscoverage['middleware/staticCache.js'][115] = 0; + _$jscoverage['middleware/staticCache.js'][116] = 0; + _$jscoverage['middleware/staticCache.js'][117] = 0; + _$jscoverage['middleware/staticCache.js'][118] = 0; + _$jscoverage['middleware/staticCache.js'][119] = 0; + _$jscoverage['middleware/staticCache.js'][120] = 0; + _$jscoverage['middleware/staticCache.js'][124] = 0; + _$jscoverage['middleware/staticCache.js'][125] = 0; + _$jscoverage['middleware/staticCache.js'][126] = 0; + _$jscoverage['middleware/staticCache.js'][127] = 0; + _$jscoverage['middleware/staticCache.js'][128] = 0; + _$jscoverage['middleware/staticCache.js'][129] = 0; + _$jscoverage['middleware/staticCache.js'][131] = 0; + _$jscoverage['middleware/staticCache.js'][132] = 0; + _$jscoverage['middleware/staticCache.js'][135] = 0; + _$jscoverage['middleware/staticCache.js'][151] = 0; + _$jscoverage['middleware/staticCache.js'][152] = 0; + _$jscoverage['middleware/staticCache.js'][156] = 0; + _$jscoverage['middleware/staticCache.js'][158] = 0; + _$jscoverage['middleware/staticCache.js'][160] = 0; + _$jscoverage['middleware/staticCache.js'][161] = 0; + _$jscoverage['middleware/staticCache.js'][162] = 0; + _$jscoverage['middleware/staticCache.js'][164] = 0; + _$jscoverage['middleware/staticCache.js'][165] = 0; + _$jscoverage['middleware/staticCache.js'][166] = 0; + _$jscoverage['middleware/staticCache.js'][167] = 0; + _$jscoverage['middleware/staticCache.js'][169] = 0; + _$jscoverage['middleware/staticCache.js'][171] = 0; + _$jscoverage['middleware/staticCache.js'][172] = 0; + _$jscoverage['middleware/staticCache.js'][173] = 0; + _$jscoverage['middleware/staticCache.js'][174] = 0; + _$jscoverage['middleware/staticCache.js'][175] = 0; + _$jscoverage['middleware/staticCache.js'][178] = 0; + _$jscoverage['middleware/staticCache.js'][181] = 0; + _$jscoverage['middleware/staticCache.js'][183] = 0; + _$jscoverage['middleware/staticCache.js'][186] = 0; + _$jscoverage['middleware/staticCache.js'][187] = 0; + _$jscoverage['middleware/staticCache.js'][200] = 0; + _$jscoverage['middleware/staticCache.js'][201] = 0; + _$jscoverage['middleware/staticCache.js'][206] = 0; + _$jscoverage['middleware/staticCache.js'][208] = 0; + _$jscoverage['middleware/staticCache.js'][210] = 0; + _$jscoverage['middleware/staticCache.js'][212] = 0; + _$jscoverage['middleware/staticCache.js'][214] = 0; + _$jscoverage['middleware/staticCache.js'][216] = 0; + _$jscoverage['middleware/staticCache.js'][229] = 0; + _$jscoverage['middleware/staticCache.js'][230] = 0; +} +_$jscoverage['middleware/staticCache.js'][12]++; +var utils = require("../utils"), Cache = require("../cache"), fresh = require("fresh"); +_$jscoverage['middleware/staticCache.js'][51]++; +module.exports = (function staticCache(options) { + _$jscoverage['middleware/staticCache.js'][52]++; + var options = options || {}, cache = new Cache(options.maxObjects || 128), maxlen = options.maxLength || 262144; + _$jscoverage['middleware/staticCache.js'][56]++; + console.warn("connect.staticCache() is deprecated and will be removed in 3.0"); + _$jscoverage['middleware/staticCache.js'][57]++; + console.warn("use varnish or similar reverse proxy caches."); + _$jscoverage['middleware/staticCache.js'][59]++; + return (function staticCache(req, res, next) { + _$jscoverage['middleware/staticCache.js'][60]++; + var key = cacheKey(req), ranges = req.headers.range, hasCookies = req.headers.cookie, hit = cache.get(key); + _$jscoverage['middleware/staticCache.js'][68]++; + req.on("static", (function (stream) { + _$jscoverage['middleware/staticCache.js'][69]++; + var headers = res._headers, cc = utils.parseCacheControl(headers["cache-control"] || ""), contentLength = headers["content-length"], hit; + _$jscoverage['middleware/staticCache.js'][75]++; + if (headers["set-cookie"]) { + _$jscoverage['middleware/staticCache.js'][75]++; + return hasCookies = true; + } + _$jscoverage['middleware/staticCache.js'][78]++; + if (hasCookies) { + _$jscoverage['middleware/staticCache.js'][78]++; + return; + } + _$jscoverage['middleware/staticCache.js'][81]++; + if (! contentLength || contentLength > maxlen) { + _$jscoverage['middleware/staticCache.js'][81]++; + return; + } + _$jscoverage['middleware/staticCache.js'][84]++; + if (headers["content-range"]) { + _$jscoverage['middleware/staticCache.js'][84]++; + return; + } + _$jscoverage['middleware/staticCache.js'][88]++; + if (cc["no-cache"] || cc["no-store"] || cc["private"] || cc["must-revalidate"]) { + _$jscoverage['middleware/staticCache.js'][91]++; + return; + } + _$jscoverage['middleware/staticCache.js'][94]++; + if (hit = cache.get(key)) { + _$jscoverage['middleware/staticCache.js'][95]++; + if (headers.etag == hit[0].etag) { + _$jscoverage['middleware/staticCache.js'][96]++; + hit[0].date = new Date(); + _$jscoverage['middleware/staticCache.js'][97]++; + return; + } + else { + _$jscoverage['middleware/staticCache.js'][99]++; + cache.remove(key); + } + } + _$jscoverage['middleware/staticCache.js'][104]++; + if (null == stream) { + _$jscoverage['middleware/staticCache.js'][104]++; + return; + } + _$jscoverage['middleware/staticCache.js'][107]++; + var arr = []; + _$jscoverage['middleware/staticCache.js'][110]++; + stream.on("data", (function (chunk) { + _$jscoverage['middleware/staticCache.js'][111]++; + arr.push(chunk); +})); + _$jscoverage['middleware/staticCache.js'][115]++; + stream.on("end", (function () { + _$jscoverage['middleware/staticCache.js'][116]++; + var cacheEntry = cache.add(key); + _$jscoverage['middleware/staticCache.js'][117]++; + delete headers["x-cache"]; + _$jscoverage['middleware/staticCache.js'][118]++; + cacheEntry.push(200); + _$jscoverage['middleware/staticCache.js'][119]++; + cacheEntry.push(headers); + _$jscoverage['middleware/staticCache.js'][120]++; + cacheEntry.push.apply(cacheEntry, arr); +})); +})); + _$jscoverage['middleware/staticCache.js'][124]++; + if (req.method == "GET" || req.method == "HEAD") { + _$jscoverage['middleware/staticCache.js'][125]++; + if (ranges) { + _$jscoverage['middleware/staticCache.js'][126]++; + next(); + } + else { + _$jscoverage['middleware/staticCache.js'][127]++; + if (! hasCookies && hit && ! mustRevalidate(req, hit)) { + _$jscoverage['middleware/staticCache.js'][128]++; + res.setHeader("X-Cache", "HIT"); + _$jscoverage['middleware/staticCache.js'][129]++; + respondFromCache(req, res, hit); + } + else { + _$jscoverage['middleware/staticCache.js'][131]++; + res.setHeader("X-Cache", "MISS"); + _$jscoverage['middleware/staticCache.js'][132]++; + next(); + } + } + } + else { + _$jscoverage['middleware/staticCache.js'][135]++; + next(); + } +}); +}); +_$jscoverage['middleware/staticCache.js'][151]++; +function respondFromCache(req, res, cacheEntry) { + _$jscoverage['middleware/staticCache.js'][152]++; + var status = cacheEntry[0], headers = utils.merge({}, cacheEntry[1]), content = cacheEntry.slice(2); + _$jscoverage['middleware/staticCache.js'][156]++; + headers.age = (new Date() - new Date(headers.date)) / 1000 || 0; + _$jscoverage['middleware/staticCache.js'][158]++; + switch (req.method) { + case "HEAD": + _$jscoverage['middleware/staticCache.js'][160]++; + res.writeHead(status, headers); + _$jscoverage['middleware/staticCache.js'][161]++; + res.end(); + _$jscoverage['middleware/staticCache.js'][162]++; + break; + case "GET": + _$jscoverage['middleware/staticCache.js'][164]++; + if (utils.conditionalGET(req) && fresh(req.headers, headers)) { + _$jscoverage['middleware/staticCache.js'][165]++; + headers["content-length"] = 0; + _$jscoverage['middleware/staticCache.js'][166]++; + res.writeHead(304, headers); + _$jscoverage['middleware/staticCache.js'][167]++; + res.end(); + } + else { + _$jscoverage['middleware/staticCache.js'][169]++; + res.writeHead(status, headers); + _$jscoverage['middleware/staticCache.js'][171]++; + function write() { + _$jscoverage['middleware/staticCache.js'][172]++; + while (content.length) { + _$jscoverage['middleware/staticCache.js'][173]++; + if (false === res.write(content.shift())) { + _$jscoverage['middleware/staticCache.js'][174]++; + res.once("drain", write); + _$jscoverage['middleware/staticCache.js'][175]++; + return; + } +} + _$jscoverage['middleware/staticCache.js'][178]++; + res.end(); +} + _$jscoverage['middleware/staticCache.js'][181]++; + write(); + } + _$jscoverage['middleware/staticCache.js'][183]++; + break; + default: + _$jscoverage['middleware/staticCache.js'][186]++; + res.writeHead(500, ""); + _$jscoverage['middleware/staticCache.js'][187]++; + res.end(); + } +} +_$jscoverage['middleware/staticCache.js'][200]++; +function mustRevalidate(req, cacheEntry) { + _$jscoverage['middleware/staticCache.js'][201]++; + var cacheHeaders = cacheEntry[1], reqCC = utils.parseCacheControl(req.headers["cache-control"] || ""), cacheCC = utils.parseCacheControl(cacheHeaders["cache-control"] || ""), cacheAge = (new Date() - new Date(cacheHeaders.date)) / 1000 || 0; + _$jscoverage['middleware/staticCache.js'][206]++; + if (cacheCC["no-cache"] || cacheCC["must-revalidate"] || cacheCC["proxy-revalidate"]) { + _$jscoverage['middleware/staticCache.js'][208]++; + return true; + } + _$jscoverage['middleware/staticCache.js'][210]++; + if (reqCC["no-cache"]) { + _$jscoverage['middleware/staticCache.js'][210]++; + return true; + } + _$jscoverage['middleware/staticCache.js'][212]++; + if (null != reqCC["max-age"]) { + _$jscoverage['middleware/staticCache.js'][212]++; + return reqCC["max-age"] < cacheAge; + } + _$jscoverage['middleware/staticCache.js'][214]++; + if (null != cacheCC["max-age"]) { + _$jscoverage['middleware/staticCache.js'][214]++; + return cacheCC["max-age"] < cacheAge; + } + _$jscoverage['middleware/staticCache.js'][216]++; + return false; +} +_$jscoverage['middleware/staticCache.js'][229]++; +function cacheKey(req) { + _$jscoverage['middleware/staticCache.js'][230]++; + return utils.parseUrl(req).path; +} +_$jscoverage['middleware/staticCache.js'].source = ["","/*!"," * Connect - staticCache"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils')"," , Cache = require('../cache')"," , fresh = require('fresh');","","/**"," * Static cache:"," *"," * Enables a memory cache layer on top of"," * the `static()` middleware, serving popular"," * static files."," *"," * By default a maximum of 128 objects are"," * held in cache, with a max of 256k each,"," * totalling ~32mb."," *"," * A Least-Recently-Used (LRU) cache algo"," * is implemented through the `Cache` object,"," * simply rotating cache objects as they are"," * hit. This means that increasingly popular"," * objects maintain their positions while"," * others get shoved out of the stack and"," * garbage collected."," *"," * Benchmarks:"," *"," * static(): 2700 rps"," * node-static: 5300 rps"," * static() + staticCache(): 7500 rps"," *"," * Options:"," *"," * - `maxObjects` max cache objects [128]"," * - `maxLength` max cache object length 256kb"," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","module.exports = function staticCache(options){"," var options = options || {}"," , cache = new Cache(options.maxObjects || 128)"," , maxlen = options.maxLength || 1024 * 256;",""," console.warn('connect.staticCache() is deprecated and will be removed in 3.0');"," console.warn('use varnish or similar reverse proxy caches.');",""," return function staticCache(req, res, next){"," var key = cacheKey(req)"," , ranges = req.headers.range"," , hasCookies = req.headers.cookie"," , hit = cache.get(key);",""," // cache static"," // TODO: change from staticCache() -> cache()"," // and make this work for any request"," req.on('static', function(stream){"," var headers = res._headers"," , cc = utils.parseCacheControl(headers['cache-control'] || '')"," , contentLength = headers['content-length']"," , hit;",""," // dont cache set-cookie responses"," if (headers['set-cookie']) return hasCookies = true;",""," // dont cache when cookies are present"," if (hasCookies) return;",""," // ignore larger files"," if (!contentLength || contentLength > maxlen) return;",""," // don't cache partial files"," if (headers['content-range']) return;",""," // dont cache items we shouldn't be"," // TODO: real support for must-revalidate / no-cache"," if ( cc['no-cache']"," || cc['no-store']"," || cc['private']"," || cc['must-revalidate']) return;",""," // if already in cache then validate"," if (hit = cache.get(key)){"," if (headers.etag == hit[0].etag) {"," hit[0].date = new Date;"," return;"," } else {"," cache.remove(key);"," }"," }",""," // validation notifiactions don't contain a steam"," if (null == stream) return;",""," // add the cache object"," var arr = [];",""," // store the chunks"," stream.on('data', function(chunk){"," arr.push(chunk);"," });",""," // flag it as complete"," stream.on('end', function(){"," var cacheEntry = cache.add(key);"," delete headers['x-cache']; // Clean up (TODO: others)"," cacheEntry.push(200);"," cacheEntry.push(headers);"," cacheEntry.push.apply(cacheEntry, arr);"," });"," });",""," if (req.method == 'GET' || req.method == 'HEAD') {"," if (ranges) {"," next();"," } else if (!hasCookies && hit && !mustRevalidate(req, hit)) {"," res.setHeader('X-Cache', 'HIT');"," respondFromCache(req, res, hit);"," } else {"," res.setHeader('X-Cache', 'MISS');"," next();"," }"," } else {"," next();"," }"," }","};","","/**"," * Respond with the provided cached value."," * TODO: Assume 200 code, that's iffy."," *"," * @param {Object} req"," * @param {Object} res"," * @param {Object} cacheEntry"," * @return {String}"," * @api private"," */","","function respondFromCache(req, res, cacheEntry) {"," var status = cacheEntry[0]"," , headers = utils.merge({}, cacheEntry[1])"," , content = cacheEntry.slice(2);",""," headers.age = (new Date - new Date(headers.date)) / 1000 || 0;",""," switch (req.method) {"," case 'HEAD':"," res.writeHead(status, headers);"," res.end();"," break;"," case 'GET':"," if (utils.conditionalGET(req) && fresh(req.headers, headers)) {"," headers['content-length'] = 0;"," res.writeHead(304, headers);"," res.end();"," } else {"," res.writeHead(status, headers);",""," function write() {"," while (content.length) {"," if (false === res.write(content.shift())) {"," res.once('drain', write);"," return;"," }"," }"," res.end();"," }",""," write();"," }"," break;"," default:"," // This should never happen."," res.writeHead(500, '');"," res.end();"," }","}","","/**"," * Determine whether or not a cached value must be revalidated."," *"," * @param {Object} req"," * @param {Object} cacheEntry"," * @return {String}"," * @api private"," */","","function mustRevalidate(req, cacheEntry) {"," var cacheHeaders = cacheEntry[1]"," , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '')"," , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '')"," , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0;",""," if ( cacheCC['no-cache']"," || cacheCC['must-revalidate']"," || cacheCC['proxy-revalidate']) return true;",""," if (reqCC['no-cache']) return true;",""," if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge;",""," if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge;",""," return false;","}","","/**"," * The key to use in the cache. For now, this is the URL path and query."," *"," * 'http://example.com/?key=value' -> '/?key=value'"," *"," * @param {Object} req"," * @return {String}"," * @api private"," */","","function cacheKey(req) {"," return utils.parseUrl(req).path;","}"]; diff --git a/node_modules/connect/lib-cov/middleware/timeout.js b/node_modules/connect/lib-cov/middleware/timeout.js new file mode 100644 index 0000000..de0e573 --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/timeout.js @@ -0,0 +1,66 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/timeout.js']) { + _$jscoverage['middleware/timeout.js'] = []; + _$jscoverage['middleware/timeout.js'][12] = 0; + _$jscoverage['middleware/timeout.js'][30] = 0; + _$jscoverage['middleware/timeout.js'][31] = 0; + _$jscoverage['middleware/timeout.js'][33] = 0; + _$jscoverage['middleware/timeout.js'][34] = 0; + _$jscoverage['middleware/timeout.js'][35] = 0; + _$jscoverage['middleware/timeout.js'][38] = 0; + _$jscoverage['middleware/timeout.js'][39] = 0; + _$jscoverage['middleware/timeout.js'][40] = 0; + _$jscoverage['middleware/timeout.js'][41] = 0; + _$jscoverage['middleware/timeout.js'][42] = 0; + _$jscoverage['middleware/timeout.js'][43] = 0; + _$jscoverage['middleware/timeout.js'][46] = 0; + _$jscoverage['middleware/timeout.js'][47] = 0; + _$jscoverage['middleware/timeout.js'][50] = 0; + _$jscoverage['middleware/timeout.js'][51] = 0; + _$jscoverage['middleware/timeout.js'][54] = 0; +} +_$jscoverage['middleware/timeout.js'][12]++; +var debug = require("debug")("connect:timeout"); +_$jscoverage['middleware/timeout.js'][30]++; +module.exports = (function timeout(ms) { + _$jscoverage['middleware/timeout.js'][31]++; + ms = ms || 5000; + _$jscoverage['middleware/timeout.js'][33]++; + return (function (req, res, next) { + _$jscoverage['middleware/timeout.js'][34]++; + var id = setTimeout((function () { + _$jscoverage['middleware/timeout.js'][35]++; + req.emit("timeout", ms); +}), ms); + _$jscoverage['middleware/timeout.js'][38]++; + req.on("timeout", (function () { + _$jscoverage['middleware/timeout.js'][39]++; + if (req.headerSent) { + _$jscoverage['middleware/timeout.js'][39]++; + return debug("response started, cannot timeout"); + } + _$jscoverage['middleware/timeout.js'][40]++; + var err = new Error("Request timeout"); + _$jscoverage['middleware/timeout.js'][41]++; + err.timeout = ms; + _$jscoverage['middleware/timeout.js'][42]++; + err.status = 408; + _$jscoverage['middleware/timeout.js'][43]++; + next(err); +})); + _$jscoverage['middleware/timeout.js'][46]++; + req.clearTimeout = (function () { + _$jscoverage['middleware/timeout.js'][47]++; + clearTimeout(id); +}); + _$jscoverage['middleware/timeout.js'][50]++; + res.on("header", (function () { + _$jscoverage['middleware/timeout.js'][51]++; + clearTimeout(id); +})); + _$jscoverage['middleware/timeout.js'][54]++; + next(); +}); +}); +_$jscoverage['middleware/timeout.js'].source = ["","/*!"," * Connect - timeout"," * Ported from https://github.com/LearnBoost/connect-timeout"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var debug = require('debug')('connect:timeout');","","/**"," * Timeout:"," *"," * Times out the request in `ms`, defaulting to `5000`. The"," * method `req.clearTimeout()` is added to revert this behaviour"," * programmatically within your application's middleware, routes, etc."," *"," * The timeout error is passed to `next()` so that you may customize"," * the response behaviour. This error has the `.timeout` property as"," * well as `.status == 408`."," *"," * @param {Number} ms"," * @return {Function}"," * @api public"," */","","module.exports = function timeout(ms) {"," ms = ms || 5000;",""," return function(req, res, next) {"," var id = setTimeout(function(){"," req.emit('timeout', ms);"," }, ms);",""," req.on('timeout', function(){"," if (req.headerSent) return debug('response started, cannot timeout');"," var err = new Error('Request timeout');"," err.timeout = ms;"," err.status = 408;"," next(err);"," });",""," req.clearTimeout = function(){"," clearTimeout(id);"," };",""," res.on('header', function(){"," clearTimeout(id);"," });",""," next();"," };","};"]; diff --git a/node_modules/connect/lib-cov/middleware/urlencoded.js b/node_modules/connect/lib-cov/middleware/urlencoded.js new file mode 100644 index 0000000..c8dbcef --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/urlencoded.js @@ -0,0 +1,98 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/urlencoded.js']) { + _$jscoverage['middleware/urlencoded.js'] = []; + _$jscoverage['middleware/urlencoded.js'][13] = 0; + _$jscoverage['middleware/urlencoded.js'][21] = 0; + _$jscoverage['middleware/urlencoded.js'][22] = 0; + _$jscoverage['middleware/urlencoded.js'][40] = 0; + _$jscoverage['middleware/urlencoded.js'][41] = 0; + _$jscoverage['middleware/urlencoded.js'][43] = 0; + _$jscoverage['middleware/urlencoded.js'][47] = 0; + _$jscoverage['middleware/urlencoded.js'][48] = 0; + _$jscoverage['middleware/urlencoded.js'][49] = 0; + _$jscoverage['middleware/urlencoded.js'][51] = 0; + _$jscoverage['middleware/urlencoded.js'][54] = 0; + _$jscoverage['middleware/urlencoded.js'][57] = 0; + _$jscoverage['middleware/urlencoded.js'][60] = 0; + _$jscoverage['middleware/urlencoded.js'][61] = 0; + _$jscoverage['middleware/urlencoded.js'][62] = 0; + _$jscoverage['middleware/urlencoded.js'][63] = 0; + _$jscoverage['middleware/urlencoded.js'][64] = 0; + _$jscoverage['middleware/urlencoded.js'][65] = 0; + _$jscoverage['middleware/urlencoded.js'][66] = 0; + _$jscoverage['middleware/urlencoded.js'][67] = 0; + _$jscoverage['middleware/urlencoded.js'][70] = 0; + _$jscoverage['middleware/urlencoded.js'][72] = 0; + _$jscoverage['middleware/urlencoded.js'][73] = 0; +} +_$jscoverage['middleware/urlencoded.js'][13]++; +var utils = require("../utils"), _limit = require("./limit"), qs = require("qs"); +_$jscoverage['middleware/urlencoded.js'][21]++; +function noop(req, res, next) { + _$jscoverage['middleware/urlencoded.js'][22]++; + next(); +} +_$jscoverage['middleware/urlencoded.js'][40]++; +exports = module.exports = (function (options) { + _$jscoverage['middleware/urlencoded.js'][41]++; + options = options || {}; + _$jscoverage['middleware/urlencoded.js'][43]++; + var limit = options.limit? _limit(options.limit): noop; + _$jscoverage['middleware/urlencoded.js'][47]++; + return (function urlencoded(req, res, next) { + _$jscoverage['middleware/urlencoded.js'][48]++; + if (req._body) { + _$jscoverage['middleware/urlencoded.js'][48]++; + return next(); + } + _$jscoverage['middleware/urlencoded.js'][49]++; + req.body = req.body || {}; + _$jscoverage['middleware/urlencoded.js'][51]++; + if (! utils.hasBody(req)) { + _$jscoverage['middleware/urlencoded.js'][51]++; + return next(); + } + _$jscoverage['middleware/urlencoded.js'][54]++; + if ("application/x-www-form-urlencoded" != utils.mime(req)) { + _$jscoverage['middleware/urlencoded.js'][54]++; + return next(); + } + _$jscoverage['middleware/urlencoded.js'][57]++; + req._body = true; + _$jscoverage['middleware/urlencoded.js'][60]++; + limit(req, res, (function (err) { + _$jscoverage['middleware/urlencoded.js'][61]++; + if (err) { + _$jscoverage['middleware/urlencoded.js'][61]++; + return next(err); + } + _$jscoverage['middleware/urlencoded.js'][62]++; + var buf = ""; + _$jscoverage['middleware/urlencoded.js'][63]++; + req.setEncoding("utf8"); + _$jscoverage['middleware/urlencoded.js'][64]++; + req.on("data", (function (chunk) { + _$jscoverage['middleware/urlencoded.js'][64]++; + buf += chunk; +})); + _$jscoverage['middleware/urlencoded.js'][65]++; + req.on("end", (function () { + _$jscoverage['middleware/urlencoded.js'][66]++; + try { + _$jscoverage['middleware/urlencoded.js'][67]++; + req.body = buf.length? qs.parse(buf, options): {}; + _$jscoverage['middleware/urlencoded.js'][70]++; + next(); + } + catch (err) { + _$jscoverage['middleware/urlencoded.js'][72]++; + err.body = buf; + _$jscoverage['middleware/urlencoded.js'][73]++; + next(err); + } +})); +})); +}); +}); +_$jscoverage['middleware/urlencoded.js'].source = ["","/*!"," * Connect - urlencoded"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var utils = require('../utils')"," , _limit = require('./limit')"," , qs = require('qs');","","/**"," * noop middleware."," */","","function noop(req, res, next) {"," next();","}","","/**"," * Urlencoded:"," * "," * Parse x-ww-form-urlencoded request bodies,"," * providing the parsed object as `req.body`."," *"," * Options:"," *"," * - `limit` byte limit disabled by default"," *"," * @param {Object} options"," * @return {Function}"," * @api public"," */","","exports = module.exports = function(options){"," options = options || {};",""," var limit = options.limit"," ? _limit(options.limit)"," : noop;",""," return function urlencoded(req, res, next) {"," if (req._body) return next();"," req.body = req.body || {};",""," if (!utils.hasBody(req)) return next();",""," // check Content-Type"," if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();",""," // flag as parsed"," req._body = true;",""," // parse"," limit(req, res, function(err){"," if (err) return next(err);"," var buf = '';"," req.setEncoding('utf8');"," req.on('data', function(chunk){ buf += chunk });"," req.on('end', function(){"," try {"," req.body = buf.length"," ? qs.parse(buf, options)"," : {};"," next();"," } catch (err){"," err.body = buf;"," next(err);"," }"," });"," });"," }","};"]; diff --git a/node_modules/connect/lib-cov/middleware/vhost.js b/node_modules/connect/lib-cov/middleware/vhost.js new file mode 100644 index 0000000..b069e5c --- /dev/null +++ b/node_modules/connect/lib-cov/middleware/vhost.js @@ -0,0 +1,59 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['middleware/vhost.js']) { + _$jscoverage['middleware/vhost.js'] = []; + _$jscoverage['middleware/vhost.js'][28] = 0; + _$jscoverage['middleware/vhost.js'][29] = 0; + _$jscoverage['middleware/vhost.js'][30] = 0; + _$jscoverage['middleware/vhost.js'][31] = 0; + _$jscoverage['middleware/vhost.js'][32] = 0; + _$jscoverage['middleware/vhost.js'][33] = 0; + _$jscoverage['middleware/vhost.js'][34] = 0; + _$jscoverage['middleware/vhost.js'][35] = 0; + _$jscoverage['middleware/vhost.js'][36] = 0; + _$jscoverage['middleware/vhost.js'][37] = 0; + _$jscoverage['middleware/vhost.js'][38] = 0; +} +_$jscoverage['middleware/vhost.js'][28]++; +module.exports = (function vhost(hostname, server) { + _$jscoverage['middleware/vhost.js'][29]++; + if (! hostname) { + _$jscoverage['middleware/vhost.js'][29]++; + throw new Error("vhost hostname required"); + } + _$jscoverage['middleware/vhost.js'][30]++; + if (! server) { + _$jscoverage['middleware/vhost.js'][30]++; + throw new Error("vhost server required"); + } + _$jscoverage['middleware/vhost.js'][31]++; + var regexp = new RegExp("^" + hostname.replace(/[*]/g, "(.*?)") + "$", "i"); + _$jscoverage['middleware/vhost.js'][32]++; + if (server.onvhost) { + _$jscoverage['middleware/vhost.js'][32]++; + server.onvhost(hostname); + } + _$jscoverage['middleware/vhost.js'][33]++; + return (function vhost(req, res, next) { + _$jscoverage['middleware/vhost.js'][34]++; + if (! req.headers.host) { + _$jscoverage['middleware/vhost.js'][34]++; + return next(); + } + _$jscoverage['middleware/vhost.js'][35]++; + var host = req.headers.host.split(":")[0]; + _$jscoverage['middleware/vhost.js'][36]++; + if (! regexp.test(host)) { + _$jscoverage['middleware/vhost.js'][36]++; + return next(); + } + _$jscoverage['middleware/vhost.js'][37]++; + if ("function" == typeof server) { + _$jscoverage['middleware/vhost.js'][37]++; + return server(req, res, next); + } + _$jscoverage['middleware/vhost.js'][38]++; + server.emit("request", req, res); +}); +}); +_$jscoverage['middleware/vhost.js'].source = ["","/*!"," * Connect - vhost"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Vhost:"," * "," * Setup vhost for the given `hostname` and `server`."," *"," * connect()"," * .use(connect.vhost('foo.com', fooApp))"," * .use(connect.vhost('bar.com', barApp))"," * .use(connect.vhost('*.com', mainApp))"," *"," * The `server` may be a Connect server or"," * a regular Node `http.Server`. "," *"," * @param {String} hostname"," * @param {Server} server"," * @return {Function}"," * @api public"," */","","module.exports = function vhost(hostname, server){"," if (!hostname) throw new Error('vhost hostname required');"," if (!server) throw new Error('vhost server required');"," var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i');"," if (server.onvhost) server.onvhost(hostname);"," return function vhost(req, res, next){"," if (!req.headers.host) return next();"," var host = req.headers.host.split(':')[0];"," if (!regexp.test(host)) return next();"," if ('function' == typeof server) return server(req, res, next);"," server.emit('request', req, res);"," };","};"]; diff --git a/node_modules/connect/lib-cov/patch.js b/node_modules/connect/lib-cov/patch.js new file mode 100644 index 0000000..7d59643 --- /dev/null +++ b/node_modules/connect/lib-cov/patch.js @@ -0,0 +1,85 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['patch.js']) { + _$jscoverage['patch.js'] = []; + _$jscoverage['patch.js'][12] = 0; + _$jscoverage['patch.js'][20] = 0; + _$jscoverage['patch.js'][30] = 0; + _$jscoverage['patch.js'][31] = 0; + _$jscoverage['patch.js'][43] = 0; + _$jscoverage['patch.js'][44] = 0; + _$jscoverage['patch.js'][48] = 0; + _$jscoverage['patch.js'][49] = 0; + _$jscoverage['patch.js'][50] = 0; + _$jscoverage['patch.js'][55] = 0; + _$jscoverage['patch.js'][56] = 0; + _$jscoverage['patch.js'][59] = 0; + _$jscoverage['patch.js'][66] = 0; + _$jscoverage['patch.js'][67] = 0; + _$jscoverage['patch.js'][68] = 0; + _$jscoverage['patch.js'][69] = 0; + _$jscoverage['patch.js'][72] = 0; + _$jscoverage['patch.js'][73] = 0; + _$jscoverage['patch.js'][74] = 0; + _$jscoverage['patch.js'][75] = 0; + _$jscoverage['patch.js'][78] = 0; +} +_$jscoverage['patch.js'][12]++; +var http = require("http"), res = http.ServerResponse.prototype, setHeader = res.setHeader, _renderHeaders = res._renderHeaders, writeHead = res.writeHead; +_$jscoverage['patch.js'][20]++; +if (! res._hasConnectPatch) { + _$jscoverage['patch.js'][30]++; + res.__defineGetter__("headerSent", (function () { + _$jscoverage['patch.js'][31]++; + return this._header; +})); + _$jscoverage['patch.js'][43]++; + res.setHeader = (function (field, val) { + _$jscoverage['patch.js'][44]++; + var key = field.toLowerCase(), prev; + _$jscoverage['patch.js'][48]++; + if (this._headers && "set-cookie" == key) { + _$jscoverage['patch.js'][49]++; + if (prev = this.getHeader(field)) { + _$jscoverage['patch.js'][50]++; + val = Array.isArray(prev)? prev.concat(val): [prev, val]; + } + } + else { + _$jscoverage['patch.js'][55]++; + if ("content-type" == key && this.charset) { + _$jscoverage['patch.js'][56]++; + val += "; charset=" + this.charset; + } + } + _$jscoverage['patch.js'][59]++; + return setHeader.call(this, field, val); +}); + _$jscoverage['patch.js'][66]++; + res._renderHeaders = (function () { + _$jscoverage['patch.js'][67]++; + if (! this._emittedHeader) { + _$jscoverage['patch.js'][67]++; + this.emit("header"); + } + _$jscoverage['patch.js'][68]++; + this._emittedHeader = true; + _$jscoverage['patch.js'][69]++; + return _renderHeaders.call(this); +}); + _$jscoverage['patch.js'][72]++; + res.writeHead = (function () { + _$jscoverage['patch.js'][73]++; + if (! this._emittedHeader) { + _$jscoverage['patch.js'][73]++; + this.emit("header"); + } + _$jscoverage['patch.js'][74]++; + this._emittedHeader = true; + _$jscoverage['patch.js'][75]++; + return writeHead.apply(this, arguments); +}); + _$jscoverage['patch.js'][78]++; + res._hasConnectPatch = true; +} +_$jscoverage['patch.js'].source = ["","/*!"," * Connect"," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , res = http.ServerResponse.prototype"," , setHeader = res.setHeader"," , _renderHeaders = res._renderHeaders"," , writeHead = res.writeHead;","","// apply only once","","if (!res._hasConnectPatch) {",""," /**"," * Provide a public \"header sent\" flag"," * until node does."," *"," * @return {Boolean}"," * @api public"," */",""," res.__defineGetter__('headerSent', function(){"," return this._header;"," });",""," /**"," * Set header `field` to `val`, special-casing"," * the `Set-Cookie` field for multiple support."," *"," * @param {String} field"," * @param {String} val"," * @api public"," */",""," res.setHeader = function(field, val){"," var key = field.toLowerCase()"," , prev;",""," // special-case Set-Cookie"," if (this._headers && 'set-cookie' == key) {"," if (prev = this.getHeader(field)) {"," val = Array.isArray(prev)"," ? prev.concat(val)"," : [prev, val];"," }"," // charset"," } else if ('content-type' == key && this.charset) {"," val += '; charset=' + this.charset;"," }",""," return setHeader.call(this, field, val);"," };",""," /**"," * Proxy to emit \"header\" event."," */",""," res._renderHeaders = function(){"," if (!this._emittedHeader) this.emit('header');"," this._emittedHeader = true;"," return _renderHeaders.call(this);"," };",""," res.writeHead = function(){"," if (!this._emittedHeader) this.emit('header');"," this._emittedHeader = true;"," return writeHead.apply(this, arguments);"," };",""," res._hasConnectPatch = true;","}"]; diff --git a/node_modules/connect/lib-cov/proto.js b/node_modules/connect/lib-cov/proto.js new file mode 100644 index 0000000..e8ecb99 --- /dev/null +++ b/node_modules/connect/lib-cov/proto.js @@ -0,0 +1,285 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['proto.js']) { + _$jscoverage['proto.js'] = []; + _$jscoverage['proto.js'][13] = 0; + _$jscoverage['proto.js'][19] = 0; + _$jscoverage['proto.js'][23] = 0; + _$jscoverage['proto.js'][62] = 0; + _$jscoverage['proto.js'][64] = 0; + _$jscoverage['proto.js'][65] = 0; + _$jscoverage['proto.js'][66] = 0; + _$jscoverage['proto.js'][70] = 0; + _$jscoverage['proto.js'][71] = 0; + _$jscoverage['proto.js'][72] = 0; + _$jscoverage['proto.js'][73] = 0; + _$jscoverage['proto.js'][74] = 0; + _$jscoverage['proto.js'][79] = 0; + _$jscoverage['proto.js'][80] = 0; + _$jscoverage['proto.js'][84] = 0; + _$jscoverage['proto.js'][85] = 0; + _$jscoverage['proto.js'][89] = 0; + _$jscoverage['proto.js'][90] = 0; + _$jscoverage['proto.js'][92] = 0; + _$jscoverage['proto.js'][102] = 0; + _$jscoverage['proto.js'][103] = 0; + _$jscoverage['proto.js'][109] = 0; + _$jscoverage['proto.js'][110] = 0; + _$jscoverage['proto.js'][112] = 0; + _$jscoverage['proto.js'][113] = 0; + _$jscoverage['proto.js'][114] = 0; + _$jscoverage['proto.js'][117] = 0; + _$jscoverage['proto.js'][118] = 0; + _$jscoverage['proto.js'][119] = 0; + _$jscoverage['proto.js'][122] = 0; + _$jscoverage['proto.js'][125] = 0; + _$jscoverage['proto.js'][127] = 0; + _$jscoverage['proto.js'][130] = 0; + _$jscoverage['proto.js'][132] = 0; + _$jscoverage['proto.js'][133] = 0; + _$jscoverage['proto.js'][136] = 0; + _$jscoverage['proto.js'][139] = 0; + _$jscoverage['proto.js'][144] = 0; + _$jscoverage['proto.js'][145] = 0; + _$jscoverage['proto.js'][146] = 0; + _$jscoverage['proto.js'][147] = 0; + _$jscoverage['proto.js'][148] = 0; + _$jscoverage['proto.js'][149] = 0; + _$jscoverage['proto.js'][151] = 0; + _$jscoverage['proto.js'][152] = 0; + _$jscoverage['proto.js'][153] = 0; + _$jscoverage['proto.js'][154] = 0; + _$jscoverage['proto.js'][155] = 0; + _$jscoverage['proto.js'][157] = 0; + _$jscoverage['proto.js'][160] = 0; + _$jscoverage['proto.js'][161] = 0; + _$jscoverage['proto.js'][162] = 0; + _$jscoverage['proto.js'][165] = 0; + _$jscoverage['proto.js'][167] = 0; + _$jscoverage['proto.js'][168] = 0; + _$jscoverage['proto.js'][172] = 0; + _$jscoverage['proto.js'][173] = 0; + _$jscoverage['proto.js'][176] = 0; + _$jscoverage['proto.js'][177] = 0; + _$jscoverage['proto.js'][178] = 0; + _$jscoverage['proto.js'][181] = 0; + _$jscoverage['proto.js'][182] = 0; + _$jscoverage['proto.js'][183] = 0; + _$jscoverage['proto.js'][184] = 0; + _$jscoverage['proto.js'][185] = 0; + _$jscoverage['proto.js'][187] = 0; + _$jscoverage['proto.js'][189] = 0; + _$jscoverage['proto.js'][190] = 0; + _$jscoverage['proto.js'][192] = 0; + _$jscoverage['proto.js'][195] = 0; + _$jscoverage['proto.js'][198] = 0; + _$jscoverage['proto.js'][227] = 0; + _$jscoverage['proto.js'][228] = 0; + _$jscoverage['proto.js'][229] = 0; +} +_$jscoverage['proto.js'][13]++; +var http = require("http"), utils = require("./utils"), debug = require("debug")("connect:dispatcher"); +_$jscoverage['proto.js'][19]++; +var app = module.exports = {}; +_$jscoverage['proto.js'][23]++; +var env = process.env.NODE_ENV || "development"; +_$jscoverage['proto.js'][62]++; +app.use = (function (route, fn) { + _$jscoverage['proto.js'][64]++; + if ("string" != typeof route) { + _$jscoverage['proto.js'][65]++; + fn = route; + _$jscoverage['proto.js'][66]++; + route = "/"; + } + _$jscoverage['proto.js'][70]++; + if ("function" == typeof fn.handle) { + _$jscoverage['proto.js'][71]++; + var server = fn; + _$jscoverage['proto.js'][72]++; + fn.route = route; + _$jscoverage['proto.js'][73]++; + fn = (function (req, res, next) { + _$jscoverage['proto.js'][74]++; + server.handle(req, res, next); +}); + } + _$jscoverage['proto.js'][79]++; + if (fn instanceof http.Server) { + _$jscoverage['proto.js'][80]++; + fn = fn.listeners("request")[0]; + } + _$jscoverage['proto.js'][84]++; + if ("/" == route[route.length - 1]) { + _$jscoverage['proto.js'][85]++; + route = route.slice(0, -1); + } + _$jscoverage['proto.js'][89]++; + debug("use %s %s", route || "/", fn.name || "anonymous"); + _$jscoverage['proto.js'][90]++; + this.stack.push({route: route, handle: fn}); + _$jscoverage['proto.js'][92]++; + return this; +}); +_$jscoverage['proto.js'][102]++; +app.handle = (function (req, res, out) { + _$jscoverage['proto.js'][103]++; + var stack = this.stack, fqdn = ~ req.url.indexOf("://"), removed = "", slashAdded = false, index = 0; + _$jscoverage['proto.js'][109]++; + function next(err) { + _$jscoverage['proto.js'][110]++; + var layer, path, status, c; + _$jscoverage['proto.js'][112]++; + if (slashAdded) { + _$jscoverage['proto.js'][113]++; + req.url = req.url.substr(1); + _$jscoverage['proto.js'][114]++; + slashAdded = false; + } + _$jscoverage['proto.js'][117]++; + req.url = removed + req.url; + _$jscoverage['proto.js'][118]++; + req.originalUrl = req.originalUrl || req.url; + _$jscoverage['proto.js'][119]++; + removed = ""; + _$jscoverage['proto.js'][122]++; + layer = stack[index++]; + _$jscoverage['proto.js'][125]++; + if (! layer || res.headerSent) { + _$jscoverage['proto.js'][127]++; + if (out) { + _$jscoverage['proto.js'][127]++; + return out(err); + } + _$jscoverage['proto.js'][130]++; + if (err) { + _$jscoverage['proto.js'][132]++; + if (res.statusCode < 400) { + _$jscoverage['proto.js'][132]++; + res.statusCode = 500; + } + _$jscoverage['proto.js'][133]++; + debug("default %s", res.statusCode); + _$jscoverage['proto.js'][136]++; + if (err.status) { + _$jscoverage['proto.js'][136]++; + res.statusCode = err.status; + } + _$jscoverage['proto.js'][139]++; + var msg = "production" == env? http.STATUS_CODES[res.statusCode]: err.stack || err.toString(); + _$jscoverage['proto.js'][144]++; + if ("test" != env) { + _$jscoverage['proto.js'][144]++; + console.error(err.stack || err.toString()); + } + _$jscoverage['proto.js'][145]++; + if (res.headerSent) { + _$jscoverage['proto.js'][145]++; + return req.socket.destroy(); + } + _$jscoverage['proto.js'][146]++; + res.setHeader("Content-Type", "text/plain"); + _$jscoverage['proto.js'][147]++; + res.setHeader("Content-Length", Buffer.byteLength(msg)); + _$jscoverage['proto.js'][148]++; + if ("HEAD" == req.method) { + _$jscoverage['proto.js'][148]++; + return res.end(); + } + _$jscoverage['proto.js'][149]++; + res.end(msg); + } + else { + _$jscoverage['proto.js'][151]++; + debug("default 404"); + _$jscoverage['proto.js'][152]++; + res.statusCode = 404; + _$jscoverage['proto.js'][153]++; + res.setHeader("Content-Type", "text/plain"); + _$jscoverage['proto.js'][154]++; + if ("HEAD" == req.method) { + _$jscoverage['proto.js'][154]++; + return res.end(); + } + _$jscoverage['proto.js'][155]++; + res.end("Cannot " + req.method + " " + utils.escape(req.originalUrl)); + } + _$jscoverage['proto.js'][157]++; + return; + } + _$jscoverage['proto.js'][160]++; + try { + _$jscoverage['proto.js'][161]++; + path = utils.parseUrl(req).pathname; + _$jscoverage['proto.js'][162]++; + if (undefined == path) { + _$jscoverage['proto.js'][162]++; + path = "/"; + } + _$jscoverage['proto.js'][165]++; + if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) { + _$jscoverage['proto.js'][165]++; + return next(err); + } + _$jscoverage['proto.js'][167]++; + c = path[layer.route.length]; + _$jscoverage['proto.js'][168]++; + if (c && "/" != c && "." != c) { + _$jscoverage['proto.js'][168]++; + return next(err); + } + _$jscoverage['proto.js'][172]++; + removed = layer.route; + _$jscoverage['proto.js'][173]++; + req.url = req.url.substr(removed.length); + _$jscoverage['proto.js'][176]++; + if (! fqdn && "/" != req.url[0]) { + _$jscoverage['proto.js'][177]++; + req.url = "/" + req.url; + _$jscoverage['proto.js'][178]++; + slashAdded = true; + } + _$jscoverage['proto.js'][181]++; + debug("%s", layer.handle.name || "anonymous"); + _$jscoverage['proto.js'][182]++; + var arity = layer.handle.length; + _$jscoverage['proto.js'][183]++; + if (err) { + _$jscoverage['proto.js'][184]++; + if (arity === 4) { + _$jscoverage['proto.js'][185]++; + layer.handle(err, req, res, next); + } + else { + _$jscoverage['proto.js'][187]++; + next(err); + } + } + else { + _$jscoverage['proto.js'][189]++; + if (arity < 4) { + _$jscoverage['proto.js'][190]++; + layer.handle(req, res, next); + } + else { + _$jscoverage['proto.js'][192]++; + next(); + } + } + } + catch (e) { + _$jscoverage['proto.js'][195]++; + next(e); + } +} + _$jscoverage['proto.js'][198]++; + next(); +}); +_$jscoverage['proto.js'][227]++; +app.listen = (function () { + _$jscoverage['proto.js'][228]++; + var server = http.createServer(this); + _$jscoverage['proto.js'][229]++; + return server.listen.apply(server, arguments); +}); +_$jscoverage['proto.js'].source = ["","/*!"," * Connect - HTTPServer"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , utils = require('./utils')"," , debug = require('debug')('connect:dispatcher');","","// prototype","","var app = module.exports = {};","","// environment","","var env = process.env.NODE_ENV || 'development';","","/**"," * Utilize the given middleware `handle` to the given `route`,"," * defaulting to _/_. This \"route\" is the mount-point for the"," * middleware, when given a value other than _/_ the middleware"," * is only effective when that segment is present in the request's"," * pathname."," *"," * For example if we were to mount a function at _/admin_, it would"," * be invoked on _/admin_, and _/admin/settings_, however it would"," * not be invoked for _/_, or _/posts_."," *"," * Examples:"," *"," * var app = connect();"," * app.use(connect.favicon());"," * app.use(connect.logger());"," * app.use(connect.static(__dirname + '/public'));"," *"," * If we wanted to prefix static files with _/public_, we could"," * \"mount\" the `static()` middleware:"," *"," * app.use('/public', connect.static(__dirname + '/public'));"," *"," * This api is chainable, so the following is valid:"," *"," * connect()"," * .use(connect.favicon())"," * .use(connect.logger())"," * .use(connect.static(__dirname + '/public'))"," * .listen(3000);"," *"," * @param {String|Function|Server} route, callback or server"," * @param {Function|Server} callback or server"," * @return {Server} for chaining"," * @api public"," */","","app.use = function(route, fn){"," // default route to '/'"," if ('string' != typeof route) {"," fn = route;"," route = '/';"," }",""," // wrap sub-apps"," if ('function' == typeof fn.handle) {"," var server = fn;"," fn.route = route;"," fn = function(req, res, next){"," server.handle(req, res, next);"," };"," }",""," // wrap vanilla http.Servers"," if (fn instanceof http.Server) {"," fn = fn.listeners('request')[0];"," }",""," // strip trailing slash"," if ('/' == route[route.length - 1]) {"," route = route.slice(0, -1);"," }",""," // add the middleware"," debug('use %s %s', route || '/', fn.name || 'anonymous');"," this.stack.push({ route: route, handle: fn });",""," return this;","};","","/**"," * Handle server requests, punting them down"," * the middleware stack."," *"," * @api private"," */","","app.handle = function(req, res, out) {"," var stack = this.stack"," , fqdn = ~req.url.indexOf('://')"," , removed = ''"," , slashAdded = false"," , index = 0;",""," function next(err) {"," var layer, path, status, c;",""," if (slashAdded) {"," req.url = req.url.substr(1);"," slashAdded = false;"," }",""," req.url = removed + req.url;"," req.originalUrl = req.originalUrl || req.url;"," removed = '';",""," // next callback"," layer = stack[index++];",""," // all done"," if (!layer || res.headerSent) {"," // delegate to parent"," if (out) return out(err);",""," // unhandled error"," if (err) {"," // default to 500"," if (res.statusCode < 400) res.statusCode = 500;"," debug('default %s', res.statusCode);",""," // respect err.status"," if (err.status) res.statusCode = err.status;",""," // production gets a basic error message"," var msg = 'production' == env"," ? http.STATUS_CODES[res.statusCode]"," : err.stack || err.toString();",""," // log to stderr in a non-test env"," if ('test' != env) console.error(err.stack || err.toString());"," if (res.headerSent) return req.socket.destroy();"," res.setHeader('Content-Type', 'text/plain');"," res.setHeader('Content-Length', Buffer.byteLength(msg));"," if ('HEAD' == req.method) return res.end();"," res.end(msg);"," } else {"," debug('default 404');"," res.statusCode = 404;"," res.setHeader('Content-Type', 'text/plain');"," if ('HEAD' == req.method) return res.end();"," res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl));"," }"," return;"," }",""," try {"," path = utils.parseUrl(req).pathname;"," if (undefined == path) path = '/';",""," // skip this layer if the route doesn't match."," if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);",""," c = path[layer.route.length];"," if (c && '/' != c && '.' != c) return next(err);",""," // Call the layer handler"," // Trim off the part of the url that matches the route"," removed = layer.route;"," req.url = req.url.substr(removed.length);",""," // Ensure leading slash"," if (!fqdn && '/' != req.url[0]) {"," req.url = '/' + req.url;"," slashAdded = true;"," }",""," debug('%s', layer.handle.name || 'anonymous');"," var arity = layer.handle.length;"," if (err) {"," if (arity === 4) {"," layer.handle(err, req, res, next);"," } else {"," next(err);"," }"," } else if (arity < 4) {"," layer.handle(req, res, next);"," } else {"," next();"," }"," } catch (e) {"," next(e);"," }"," }"," next();","};","","/**"," * Listen for connections."," *"," * This method takes the same arguments"," * as node's `http.Server#listen()`. "," *"," * HTTP and HTTPS:"," *"," * If you run your application both as HTTP"," * and HTTPS you may wrap them individually,"," * since your Connect \"server\" is really just"," * a JavaScript `Function`."," *"," * var connect = require('connect')"," * , http = require('http')"," * , https = require('https');"," * "," * var app = connect();"," * "," * http.createServer(app).listen(80);"," * https.createServer(options, app).listen(443);"," *"," * @return {http.Server}"," * @api public"," */","","app.listen = function(){"," var server = http.createServer(this);"," return server.listen.apply(server, arguments);","};"]; diff --git a/node_modules/connect/lib-cov/public/directory.html b/node_modules/connect/lib-cov/public/directory.html new file mode 100644 index 0000000..15164bb --- /dev/null +++ b/node_modules/connect/lib-cov/public/directory.html @@ -0,0 +1,75 @@ + + + listing directory {directory} + + + + + +
    +

    {linked-path}

    + {files} +
    + + \ No newline at end of file diff --git a/node_modules/connect/lib-cov/public/error.html b/node_modules/connect/lib-cov/public/error.html new file mode 100644 index 0000000..c5ae73a --- /dev/null +++ b/node_modules/connect/lib-cov/public/error.html @@ -0,0 +1,13 @@ + + + {error} + + + +
    +

    {title}

    +

    {statusCode} {error}

    +
      {stack}
    +
    + + diff --git a/node_modules/connect/lib-cov/public/favicon.ico b/node_modules/connect/lib-cov/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..895fc96a76b68b4924f1c51d022e1b82fa0f461f GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&}i&OouUjIY8@C}uZw4x5z5N2 zvEG^C^vXtt_xtJ?p3O32c(KTx;lsgZhW%5M85Sf}k-mf`L80)|7ga~M{a znlL=>m1Q`#uoPkbC~GtXMnhnDh5$DU1D6mx+;2QAKt3ZQFH}H~1y~00GcqzVg9QXw z_<%(a7y$V|wJgF=E>MgE#Aid|14}IyCM5MhEnxFF;pTzOK(>#80puP=gnOXwAd33` mpMe2}f66m3eB@_fcnmb^7!b1nO#opK8zcsj1F30)+jEP);68^d)m`eN0o>(5%D`Q(1;j>g@G;xlf`0VBQ`PFY?6)!N&f?*K}$p; zB!U=NBn{eB8${1}&-2_L*HuZp@ZP1@clS@cHp)4iM1ewzw59vko7eMM{e9z|%NNdX z0V;`?KKSzTCvTm5bc{L^CIKLUxc2X{i{ISz$8Sgf{q)1nXTP{`{s?9mQ$4&hPiKC- zY8q7(Y1Xu5iCf33=O4Vy(+|zQ?rW#gkKB0f%}?+6{G*qT22|DQB-73`YzA{N4W^=s zq0kQYcbtFfz zLz)H<&|z(Y4kBG67=JY6c|L1R-#TR>fC$3^Y%QEnYO1xHsf)+GU`3F<{J0kR(;pbF3)zyg$H+idfnl-wl5Wkh!vUH z4Z32YP=l_}1rZd1W_D&^$A($A+&a0e&P?xx0!ctY2}*<#p+qPVN*B(YzvAWXa*%bzq z7Fz41LKILT(GWohi9|LgIzSZBhb*Zf6R6O}WYQ4GOi&71s9lmll0x6;8&ILOl$j(c z0Z1T(6Tg09{?wd{moFHNN6PS?$|e>1MxSJ(0Z7o2)J-Zv|>acY@f`(Y@g7GwsEj5NLQo+q|HsxQ5}XSX_d@*^A9ZT9=A{W~j+$GyI1 zc4oqTHx@1FlRjw4XWyPN5i2~l_F3@aBk!0yu^aoRDvXy}8@HCjUVQUsuSH4$T5|r< zzZOn^?Wfa6y|Q($Hx4{ws+)wX6-HP4zo!S?4KJ@7PG@G3G{CjXs(p*kIrj6rHs7_y z+=<-=Q62s9FuWa^X~WKgJIAAZJR&XBB002ovPDHLkV1jCMPILeO literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_attach.png b/node_modules/connect/lib-cov/public/icons/page_attach.png new file mode 100644 index 0000000000000000000000000000000000000000..89ee2da0753040d1ba0a3487473a715a8fe89322 GIT binary patch literal 794 zcmV+#1LgdQP)i_t#ewV_0K6;=bl;e_Jt7$~$sQ)q$+ia<4Ec+jeaGt9oWH@O|2`W6&O0t!k{B9sUvLWxkCaPsd9W(`fa z;j-|^ZI^2XnzhgZWYRW-kP&J>DWPo`%;JaBX}or79k=+Jo@h%4Eo72tqev+cB?PjP zO<|ByL#>Tehyq$jR74O$B9WDW1`tK`LzYyL3A9iAcRxLkJ`I)n}v%Od-3H>j$OTBtk>(k-9o?8PqI=0 zB&f-+KOXVnjyKJlf4iHOtnuiE_4+ZVJ$dHjU<^o^YCjQ-wt^!;rPpBv(@pFO{9rdw98 z_s@3+yta93oyfL>7AD5}r=|`zS3Gm$_|(iSl8XBd9k%=91J0j2=ivT5cJ18ZmDjh{ z$-RMd{jQ#X79#Sc literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_code.png b/node_modules/connect/lib-cov/public/icons/page_code.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ea90419d950f9e69d977a1f5847456d96a5f0b GIT binary patch literal 818 zcmV-21I_%2P)@LCln44|RX7Ti z0HI3&7jPq){odH{?_{%nYVq_;n_c4WbUpvU(&Cvnj!vq|kVC-vpF6vp^;;e0mm6HW z+WPzA`AZ|;pPp$&dNjzrc??4rt`k%Q1l*u-BPD0MQ}Fbm8jnsyezNt7+u{23>t7Em zJtETY?ja9KrVs^!LJ$xEMF3-bAZO;-IQJavE60KA7fO$VY_%N)R6s>g5mW>fL4&aR z*EVgKKTBXm!=L?S0?xM zYqL@C$|EDF2q*3zWW7;PDZ}SK*IE8;i!3U62=qn80C&*I1Le7WwNP5EcX;_oh2dJn zf#HgBe4@r$GcjHjmj2vAfT%(YN?}kK=(*+1*DkNNc1H5R++vfBMhACi<5uFUU+N4+ z<&U*CPmWi}REa7C6-t>2im1CWv5Jkefxa6>)dEj-CAW wWa{_}BJ!}~75?MkfaCnj>Dn=~vkLS70Pk`;z)@TQj{pDw07*qoM6N<$f@imYHUIzs literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_copy.png b/node_modules/connect/lib-cov/public/icons/page_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..195dc6d6c365d298e466026b37c1959d96119ea7 GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6Z z(>-WZK@^7J_sq=QY_e{46@P+~LNG}sRzZsxQHvCsN*h5ir6^j7pq-$xu$N#V1gx}9 zClV7;5)7zih-s3DB)G=7|99>ji@So7-P24n=VQ(@GctDX!^_@$bj%oviY6e4Dh;od zooe%Wvs8LEKQ&&bL&@bwi=STIAI@!-gB2jC5+?y?VR~VkrNxam-`6*8&po|RZ5LpS zNKdJ%c4bTX`XjKsnecf%W>1%6WT?pKNdLLq{=(f(Col?P1+oq@R>)W(n=x!|*BIIh z6DJGw_w`)u6yN|vAhMteYK5#b%r5^v+VCFl1IGssaclZZMS{vs-LJ2$)n7DAr6==K z<29#%AXsBsDoO}SBaXR#_Ap!JKx)(1)3O2pj0_dYWz5By*X74fRT01$Fk%P_RzOMDtV?GU{nsYq#K8iy zb6qzLYDj`_f5$BwC*WE(t0m#xYJ*=jC2|HQYHh=pf#QG7oowi`h!L!{DB$8|qY{~X zu8@sU1tWq;n$XThR0%;45mdqXM892|{CJ@0DS*}>?ami06Q_^tvM~Y3K(_-`#m!8f z8f!QIrH4y#61;0Ym0cCoLl8{IPombPHtnn7%SbTdI&G-d>ZQo!_wBMF9nzX!g8HVY xYTJPGciz9XMh3w2fmZ(7v{)r*QZD48?mrio{~IaoqP z|1Ep}yDQG09bP~E^Dk?@JiKQJ z6-pO(3~IOP)IYisL6D6;oAEd;E%zR}{U$rMRNuD6nQV7nesKS>)yLo7JuDCrD>Abi zbj3uW23?^GA}9jQ{M^8v?ejL?HaT7AX5WPZNkBmfN`w-jL?{tT7ykZt$%Yln?p_m~ z-?>&d(LD(jAd}h=LPltPQbO$*Wbyl@G-_k5jXbb#qffHY03>M1jfEqoPJQ6Mr=Byp=^jfzePZV1 zLjCmNi31hdIJHa%e;5g=1(`u3BRzfeExY%=VCu{loOr{`%2hUR*x>tL^W_TTaj);0 zpPR6CUD1+0>4TQ6zVfH3TQ;%l6#(_%yspK@3gcmG#Q4!WCPyLU93nMKk7E2pcA=l45({2jNho>sdF*A~bA zxX?-cp~y_z_kFf+yqu3m#QiB}03?Z&9vvR5TNgj<)($Vm)xq5G>|o2sFMag&6aNF+ WAT1?sQBYt20000iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_error.png b/node_modules/connect/lib-cov/public/icons/page_error.png new file mode 100644 index 0000000000000000000000000000000000000000..f07f449a44ff2761bfc7b752db3d08d0e1238b02 GIT binary patch literal 793 zcmV+!1LpjRP)lHwhvrAu0-@MQwt}+5~MQTtu}C0%;W( z1<{R?aHBz*g;pk%AyQVBR_Zu5m~;ES_vxI-O!vIF|H*|T{l`n#garr?$RMk>)?Y48 z(ZF2yTneKb};DNWF+jK)IF`6_IfJ{i|F3o%Q+l&4_HGBD|ACE8na_6>L z=s{^>-C(a7J$6=8A_%h5W!1K6dcL!D?XX+Ndk)oei?UundDpX_E&1Y&`)3P8#Ny0s z2Ag7_&ZPhyGj%)g&S6V2LNun1;iBQm#Fwlfv zgyESZR$X}2P;=RW!2zid1r$hBL{K7>2qi*f7>pT1=RdT3@-anEoH{ z={KFOO;Dh#bV*jaN>}M>RZqQd`S=6O9C3KpI~I>l%QFYfo;jqQYe5fcn`)+)zMm6P z4X&L(>gnN0!%J4^rhX->?$S5bY<=GEU%jc!KLL8sww-Eg;h z`H-yBHa)yfojYT}&G*GFc$<(Yja_q=lZvj66DC^O5%$B)|Z(CeD=n`|eM04SP; z>-=-l+xdJjA~vR6^xB#o{ehf~tSM`iwaQv$O<8NIHA}W_WOw*~ XD^gE}t;YAo00000NkvXXu0mjfl6ZQ> literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_excel.png b/node_modules/connect/lib-cov/public/icons/page_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9 GIT binary patch literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_find.png b/node_modules/connect/lib-cov/public/icons/page_find.png new file mode 100644 index 0000000000000000000000000000000000000000..2f193889f7ea091c292acdd684c595dcb206b5c4 GIT binary patch literal 879 zcmV-#1CacQP)@+1&aazfGU7ezSm^v zpACwO+tu0su66!(dT=`e05DeeCnCFJW(8|RKtKa{4LGONnx2V85A4m%PEQ?MEtR-esdM$pB-`H542D0)N2zSC6Imf)4L8?>%ZrW+H>xCKi$unm zvGZq-*Q%Aahx;C*=l+K%-?>XB)6TB$-L$r*`RUvlA`xP1NG2?)ge8@TQ4EN|Jks0u zcDg;oFC#-#R`YbWB`D?Q`1#y7l$LXhjSLf8AvQuB84}i#j0^!#g{VE#(K7h@5pFHy zSenl=@XBEdxp`h2Ji>CR%=qXJ7!e|?paKet-~;#ok#jETyeB(5&Bkhp;!+;51~G=) zH?L7xmDUu_h+a$+xuWom;AWW!mS$%%+436Rjc@}y?l1134kgD0AOf$OmjOR zstUlshZk$ZC!bAyIg{Y29z#&@3SJ;6D4+_eFume9^#TmMccC5u0J!ZCTnO6m$lnD| z5JeFHf`Xs~1vP>RLKI1GKDY<~pjr2&bi(fX;6Nj-ss@Ds0CcoO0H{JsEQkm{q03skAA);_bv3q{k31qwVo&s-q`Z?_e+j^w(WL? zl+uETs5+~xBU2};OqEE9ETLGwsMGe1%iTRNue)9}|0~E4B*@5#oRXZ9oRXZ9TqRep zPrGZuoOON4n@=uPbyP1y4G=+HktC6l(gZoFD>@_lXDrN?wo+zozGt3P=Qh+3L7+}q z2!WK7geXLnO3Vw;o12Skp%_E#+N#9;DDWP?Q-VS3B$v~Ha)dDzWn0zG~O(^_1!n0HYp-( z+;wPIdoFgQlpYV!10V>5@a)1LyGBMvoa}miyp(bxbMTM-FYNyx;V@TfYddyT00000 LNkvXXu0mjf90!wr literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_go.png b/node_modules/connect/lib-cov/public/icons/page_go.png new file mode 100644 index 0000000000000000000000000000000000000000..80fe1ed0cc75fbb67e9398ae686641f8fb287238 GIT binary patch literal 779 zcmV+m1N8ifP)JNR2Ufr z!Apo%Wf%b9=l#x^8AolrB&K9H?Pg_|78WA8(M3toqE%3B#7*srcF`i*xhupr27%Nr ziguah1+mN)U5GNmyEfQ3-e%_i&-vb-Co#(>FJ+EhQEwjRYVQ(&UYy{U@%vbY||>@4x=B^vIqabI?L* z;-S&DS^V3-ni4^fl|HMkOEbgX)(390>A}|VIypb5Xee4g;7ck zwKh^A3Mi1Mh@eC$5lV!}Fw%sP623U`g3pd_Hr5sunLvTskx4}&Gm%Q6L}(l4x}jCe z*81q1_4-O*ffi~_nMslo?EQ8t*&Ec(pzEw$vc}pKn_Qp0>D7Jr>ATNC3w@9f|Y+U&+)#!t7l&wKp+nP{PQsb+fb=Yf!Fu&5j8vpRj{FT>jD z>d>$sx;A&+`n$HcF}&sYKSyR;=(=9tvvOj@hUG;~4qTYk^_@E=?$*^_pVh_bGnOt~ z;pEw)j{SK$XVc;qy181rT655gW9NG{(yeablViIL>cDI_ux8m>Pp{tY$J0lgo4#ax za?j0EA3s0S!f>{~ykN9h_RhM&g3K(E`q(dE(Rd49+%xMeR9{qlWnmd{s#(SQ>PmFtSQqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_key.png b/node_modules/connect/lib-cov/public/icons/page_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d6626cb09eb11a298b90a8a27b0d8eab41f49a82 GIT binary patch literal 801 zcmV++1K#|JP)$lC4gU2-`f*>nhR-;k6IP7e>YO!0^w)WK%3$w02v-#>5Ep64PCP| zJihT#O|N+nT7XR2h7dAB?UEAOhJF^mol1i`QtQB`HSY}RE7=r! z)zaVIHr5?>v2Gz&fdYw&2ug$!p+txby(aWZ7(4QT)l2`jX7eMQ{>)lG6ev(fWKxmH zOr%mM5$6B%u~qGtCf40#`mbGj3s!n+^%wnJ&#rl>g<4Z)lB5J6f!?|AP275)Zswr* z%T}4~{;_(?waU!#?JabbF3Cy-kf0{R{z}6$e=5yMQKt3BPcl2>zoTPMqMwF;3!_n|>sT?~bK_-2O_m+o>GJ6h zt=+g$4n7y%1qVJI7*5Yw(hqM=JusY{d}*?U(Oj*gT655eZ>Ksn(qrd7v3}DX1}C>` z+X+8@+4-pVq_fxG zlU}~Ye!0+%>J+pPk+0wV{GM$QaYM?5ux)w2z59=S&H2+K?;gH$bZGzL&g5>G ft+noNiyiPkP9r@8gT|RZ00000NkvXXu0mjfuqTIu literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_lightning.png b/node_modules/connect/lib-cov/public/icons/page_lightning.png new file mode 100644 index 0000000000000000000000000000000000000000..7e568703d6432c530224e443771a04fc1e2e59c6 GIT binary patch literal 839 zcmV-N1GxN&P)73{`^;G#xwAtHz%LU)4b zqTRU=ve1RNa3QT=ZM7C`iJ~QFQ*9t7<~pX$d^7W%^M8FFCkcQj-~0ZRTBCB(J0^iD z-~e!d9LR`f3#|=(>$bPvx_D-~2jC%pJ=n_e_OK zeJ_2b-KdDDh@@UlzBSMC;EPygH_MwjWBnPGQegihBV73D?-x9PlHL9A=(Vg=8^d<4 z<9r=UkxuIm)*CO=9e###7PztDxUv}e?$0)rQicmYhV`pQ%S!g@;K(?TVfhM#E?bM| z=B0gfb6h@a8bf5FVT-SV~6}?X}9lK@@Yynoty&1zdZP@?RfODsl=2XzzU% zS8gIN43How+9%bK2S@Xbc`O>`z5`%^;pXGy8^4f>9^3!Sp@|O&)m;dOa3q6d;4P-l zca|=H_{G&m?D_+&-}r{u-J$5T=(X4R&)q|O^gN8cgv;s#@5sEPT5_Z)oFo9Ac>l+I zc4ng5zHpps|9)<_Rw>5bKzE(M1j)dFWI_%OH$BJSz0?T+02W0)_a>#vFqb!*d|5wB zzBUN|M&ty51O@=i?kiDrjQ{{}e|^rU?OS|RdxxP1p5mAw36cX72#`R6UsoeCQFI~! z0ATITp!vfeYyQ?Dr=^5BAshfEa0nB~JG?nUa2Aur006MC*<9`)86SPS(W^`H2n+xi ztOWohsFfVfVWrI7PSKW}BmkyPoj(-|J?ES|BGd-}fIxr{00@ANnO*ZR`#)pee4I5T Rmm>fG002ovPDHLkV1i|Hc$okI literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_link.png b/node_modules/connect/lib-cov/public/icons/page_link.png new file mode 100644 index 0000000000000000000000000000000000000000..312eab0914ab59271384686255d1be913a6b3add GIT binary patch literal 830 zcmV-E1Ht@>P)VWgGzD=Y79#JI$lhEn`|2MpRa?Bt#-nSD~P0P(mbVe{KrOBoKnSsk>m|ML{6l zBosu@om4j#WzNLRAk+{k1JRvL(MfE&vvbb->v>W{*z*1_uMP}0cIRX*?mz+wk%*#O z%0D-+$B*g1nRkvI+_3E8Pr1NC6@5M&4vWaLCnNlr;lNlr4i91z&)eBGqL{L{GNu;Fof}GS9{gM5BJuH;2QWk8yuOZdB3pGR#s8bd~ zAmt<>3Q=YH$t5YJ5;7@+8Uh6=ktBgY6#6Pa%2F?h910?U8cLT43KAj$Z1*==ra&gILO{WkHfs(--F=bly9l~${z@AT>V$oat!YAD@M zBE0v_F{`g#^wOSP-u~!wvlmXdd*uqFqoZ0^{&nEMDU+=!>({S0wrQhFmoB}Yq1)~0 z^{A)L8Xjzdr(W4_exYO6u3a{4*kIeXZMJUR>Q=ksjW_p!rAwDKYUs90>6Q|C>56o@ zbrSq^Xk7Gq#>dAsn@un`Hz$?w$;Ss`%jV7L%9ShgHFV~C)6M>B`Tp%|nqPc&G*A3| z)Qe+}vT4-x^t1~XE@(6wR;^lPWMo9n*~E!cy~)YRsT2{`?fqeIw-e7N@mOA%UcCIq z_kH(_EK7|>pM*1Wt2^DaDAp|cvp*@(ZZDKpYkKC^?97(`0sb&XTXy7N#sB~S07*qo IM6N<$f;YmCWB>pF literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_paintbrush.png b/node_modules/connect/lib-cov/public/icons/page_paintbrush.png new file mode 100644 index 0000000000000000000000000000000000000000..246a2f0b426faa0c7f5ba009e32b1deaf88d1288 GIT binary patch literal 813 zcmV+|1JeA7P)otxGRZMDZ!_a~nK|b_-`n%VosaL{KDuPV10`(1LIen8kX2Xff$3BE zah#djvFGJ&eE^89Pk*-O^+&d>FC~^GjRYVQ(uuPJyS|-v?9lxA-+tM5>1Qu*n+Ir1 z6KhA>X4$XDH6?-|E5oe1E?pQ5-M;2xw_ex!x}I2+b=}mPFW$U%^;o(Zg*LP!K^1kP%8ynsD^= z1y^6xD1#GLjO{VLdh@0GKY7;d$+NGukV)GRLPn^=q=dF%B#XaJrNP`0E6=}e&Gj3d zKJbQre*WXt!60_DnIzgMQc6S#fvjXxsE1v7;T;njHkdy2miIqAS(nX~o%cO+q+b#h z5tIleLWvL=dQE8OC#{%y*Tnku&K`Tuub&_ELI0t_ea{@3f>Jv&sYqld(%}3_GY3Dm z;O{3*Y?v^A`a|D;^qrM=ykI)U6QHd%WhO~VF!SGjGn0GOZrc3mGZudNl9{Q#X5&-F zuGwVReFLBjE5jr!!^-5*L%!I%PkYH#Hs5rMrEBl^)9)9XTD;xjHFxVZMc3~Dw6#k$ z(-S}RE$bgMHv6Z`mS5|u$$78sp4G-8b@lVkl`HtEv+MGn!F&bKcHPi$$oP_;=BrPf z$(~b3&p3CsuQxhoV$%jIR;`lB-s7FDX)xCTXuJ7ZyIQk96uIR=HBt%-P?N*bp`)EF zq14c}QM+O70NTOa@V~_)&GMZ$^cQDlkyOCa(H3Mf+6xhCuZh`VSN{cQBl5Ys9{cp( rh`2H3A^=GuC6HjQ*7|*0>;m{7QlnX3z3MSD00000NkvXXu0mjfR5FYo literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_paste.png b/node_modules/connect/lib-cov/public/icons/page_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..968f073fdddc1cc0f0800b1ac4001cd9a55f053d GIT binary patch literal 703 zcmV;w0zmzVP)AVs!l4K}n~L(tL`6d4Up4iSWnZ3Qg~4n+_J zDGk-qQdogO5JUtO-d5pRp7Nd7_r1^a|M&Zq%mn9Oe((|e0sw%Ur!K7T1pojj=U#f? zQM`qbQrM^DPkwa?DK_be^~z<~RgSMIa<`xP_4P7gg2jCwJ{9^k!fsU=#Ti|%I3p;>90Qd+7|~0h&mIklA#nb>ATL2+v$&u)OBgB z;nsHb)I&QRKeX40H~~cIZxCd}5C} z=79lXoXK%6YlyLtsV$~bSm?Upq|DJh#{|*a7XMm`4QJWZ>s6nL2R1|&J z0VPEwJ9?!n`o5PKAjc->P1Gi8BY*%!5&FVp=#)$mMJYul1Jton}gujiUf??eOy!x&!tsjxy;=Q3_DdcXx=a^OBhW0N~`A@4xB0a*%F? l+@c^sQA%W+?pa#c`9H5UNfS6T{e=Jk002ovPDHLkV1grvM=byV literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_red.png b/node_modules/connect/lib-cov/public/icons/page_red.png new file mode 100644 index 0000000000000000000000000000000000000000..0b18247da5850f3c2486373a3e179acd2772e8aa GIT binary patch literal 641 zcmV-{0)G98P);68^@7JE5sw#jpE*579S@TLkU(6yap1yN*Zuy>-hV%Q_v4Ar&!63c8OBr(ZRhFu z_kWs36-AmgZCT>x!RqM;Zu9tqvoHI~k@UmYo_g(*J3c%2{N8}7I+|qKPQzv}7t>%W zsu&9G)UmCzkDYSw{fBnuW4j;1fKV_nicw`$8C6D=F_qu`zUiK$2Oc?5UVY+D(`I@R zW`KlwqLftWHH3Z2_XVNfKn>VgT~k=@- z+N>c>0|@A_HbI9Jn`v0~7cfIF(TS69zaomDS1QtgvaBBfGEPLHccO2~3jc>n^6}^HAEh-2#VxC7YYcDXv!L9X= z-R*SOUvIs;n`8(LxP4~^2|JsiN^hq6cU}5dn4v1~Kl{eT7pm&f$PoY`hyVe%y8G*S bxB&kH@RuR86sIAS00000NkvXXu0mjfZBi!% literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_refresh.png b/node_modules/connect/lib-cov/public/icons/page_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..cf347c7d4685128a4a447abb9fb8e939417644f4 GIT binary patch literal 858 zcmV-g1Eu_lP)`6pHR2Ufr z!EI=jWf;Km|8+n2IrHqe<9xxFVk)&(Nh?w$Xk`TAyvb=#e=0aySC z00NkRDM597_LiNIJ2M^qhuTvB004REvvU8@of{r?P8tmo3;+Pk0F0@*jAMhdOkS&1 zhJPPfQa;pP0|4+Yk%#j>X}o-s#EF1_DMV93FsfPP`G*>Ks>L&)Q}w2g%slu0kBfW1 z+*$*0BC^oTl6>OGIq(9BgG4|C90Dk-N_mPazGrQ7uHZ|>BLD!-KmZ)z1e^#?1Sf(M z!6m}K(^b|i%$TcA5bC}r$tAA?0C)g1@CgWliJ;NAk&ZF+-w#}$`-3nZ32C6IVKrHp zr+(!L2hRfF&AsTw>_@ z1y23;E%Oz}?q^Q2d($ayO;-sON2t7$w(Z|o0Pw1YnSp^}0PI+I5HnDNsFCA?oorkG z5sUIGIq=FSyxcj+xlhkm0en=52Bx3@02o12gdAU$_i?v6iyFMuc7P9#zQ-Hf; zVuV$t9P5`m)F2w1?t6{<8%wk{w-PP#Sj#%1MbsjrSI6n;D_@8q9`~W98dNQf$j=iI z6~hpgww&be%X_HI50Hhx@W==u4TLPB;ei-J-1}G8wH}|{i#Lk-WZAyfv}k4y0|fvU zZTy^$u6L>2nWo(NDSV2@MRD}JQ4(c%G%=dG@_vxH?>gcH#*Ue2HC}9sapf8X?R$Z;XEnm&g zW99mh)5jNw008mK8)r^`_{yH0rNn%u1|SpC(tjf#om=+r#lh+?Kb>DVb9`|C0Bvbv zN3U(>f4-tAC1hosRoA7p(b(hL*V}(j>ug<`&U)|l$6o$)!>PBQ9RQSwn9asj2p*|xhU*R^vq?*Twb0t!lm5}`yW5lRy-U0ZYK?8to!;o!r!XeOE$ z0HB3T+6EEoI4PlR=wonwqJ+TvCoWh&$?CAPVYcU= zD{DS0?AkOtb@-hh^ZLq~FMjxYf19X?pa_YqtgZGvv2TaxcF#KT?O%=_*a-kW_;N|D zakkWsOe!)HsT5WRBiC+p;N-c>0Qwy(1D2MDBC595oXSiR07)sKNk-%9*rDBOO^HUD zZW#;)R&EZpqha<(HK$(tZYU#V29<@0qCXgU{gXeGpc_|pTqQD-WO|}%yKZbeX7k*H z2W~CK$v8NBAq~czrc5A(v51g0Wma7`G8}f=ZcuAiYYxZan@gP(;Ku66M6?bquGiHe z3Q0ya)%Lvk@kLixZfZyU@#UFbv+>pYhcj8TRKSr_sWG8i^X~UA**LvbD3(_Lba3xm ziYcpup*A9qJ$?AA=Og05lndxfwr`!C+O~h|B~4 z01q8H`StcY);%&mId7_+)76ovRpeNWRp&4M?#jx@|E-)x%P*A6t^fc407*qoM6N<$ Ef@ddc(f|Me literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white.png b/node_modules/connect/lib-cov/public/icons/page_white.png new file mode 100644 index 0000000000000000000000000000000000000000..8b8b1ca0000bc8fa8d0379926736029f8fabe364 GIT binary patch literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_acrobat.png b/node_modules/connect/lib-cov/public/icons/page_white_acrobat.png new file mode 100644 index 0000000000000000000000000000000000000000..8f8095e46fa4965700afe1f9d065d8a37b101676 GIT binary patch literal 591 zcmV-V0~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_actionscript.png b/node_modules/connect/lib-cov/public/icons/page_white_actionscript.png new file mode 100644 index 0000000000000000000000000000000000000000..159b24075191fc259cfd80c797a1b0d74c168422 GIT binary patch literal 664 zcmV;J0%!e+P)7Z7t2}reCh0o`+ zAlt$F2tW%oO@m<=(B8a-_VgLl#~yUMUDWG!0qFPppd^03e+x1WpkO1NhIaKD2A)-@ z=Py8(Wi%R%JtYZG#sTKH@6Z+&!S3Edf8jFJJNKuva#KJQD3X^7;H^fd2di znEN&c58aUG>`>P{Vqq$kLb+TP{?I!d4(|o59X_%|nVEZq2Rk60n7072SWJ{64CV?3 zgS!EB=eYxwQ>P2&$}(iT6UMvuFgHHIEdNA29!EBtg=v~X!DxxEH~}L2zn|52%xalaq@DTdhh{EVwv0IaQ=!?daer zTKp4I`l8SDt;d{8Q`5Ko;BXUi&oAG1l4}59P-{|^S(Rmord5s6qsh<&m@Ab^wqCD) zHyRD}lKLDzpYN&@q5&*47mGzGiqcXpmqR9#K|CH8kXS4RNs`(iEF%HjP%f8ItyaZK z6$%Apvsok(2>~dTO5jTZfq;N?0ch4l01f$k9?4{~Youl-#x{UDMr#AFIkz@SDwPtQ z$gQ^$2|*(Ps9LQiav_8o8Ne<=Zx1*M*syo80sEO1tB%>5 zfdHB`1z+!R@?ghPRKmL)hWEvZE$=*54ose*0JiUNTM_)cMDXhxEKg(?-pD=y<)L4J zT0dSyD0&NhJ$^_8Ko9uom%-ZM4BTM{Tw$9qyPj=-9W;N(Wi@3*-Q4pq`Gcp}^vvNr zyd&PsmG>fpCSZz?K}UIEd;HGgG%0MG>ymxKPwy{>wy(m*Atq7)0000~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU7Lxm88-p zDk^c;sHj}OKUc4lGZU}6umlGVNAJx0%sKDOFwQx|V2pVvxhYKe|L9TNk!~md3BVrm zYPDL8Hk*yU-ER3~LGwJ7N`0ZV&nOhBI{~~A;@ND*=kxg?#^W&`4u`zk?Mg_e)8XlK z`T#M+OaR1!<#Nf_>$S`xrqd}OjYhoJ>q)?3vEX8pY&I()ERjfjrXM$k7e+-Qs3Ihj zNyOuEQ2EGYG7ro!o6VOBQEwuV2z)*tR8>WxP{616FY)p1Pn1d}#9}cxolZC$4n(6- z35hJq0;FlHC{ zp*iF(lgUK(E`($(s9pJ8Kn?(M734H_63WHtf}6SQQ_MXEP!#0|&@>J8dL5TfG&tBw z#tYn{TCGZvAr>cca%YYn^!t73tg8OOJ2FvJ(`YpCyVZi*?Ur+1uUA$hAg8-aK)c;e zQ<)!XwHh|n&ND=$@^)>aF-`~n}#*WMkD*M|f8r$i*z7+W! qF|A!t*4fE(R`<_YIkN&?Jng?3oQ|aAqClPi0000t>5xmo{nArfL4CJwMMm+N`pQ3p^Le$?rMud6Rbxz!-yG7bz2z$^USP5(;udf(gfQ zG~f68y^)EvcNWp#bUoDt2=h+^%o-?-|mo~iieWqLNP<0m@2PTB7ftyb= z@H`K$>v9Pr5X`L|rw&CEN2(9SB7A2SE;d|j9@*F}sd(@*2l|P*fWfK>1drZUrtUA7 zNXO~pKn1cjf~~TLbje1g>EPPzN2GH#UIBxJ{}S9=E`{zs-w#hO?vcH+hJxroI5v?j zD!4lP0WXq8zUx3RAP@|Gq$}6wXCjFLZY^YSWBxN9#&g)ro$%5}aYn#y=tJ_aIT%4d z5d4u`rlp!};XGmbZkJE*kYJoi&N0pd*yxY{0${xD;;Q1h^8f$<07*qoM6N<$f(}t7 Ae*gdg literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_code.png b/node_modules/connect/lib-cov/public/icons/page_white_code.png new file mode 100644 index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615 GIT binary patch literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_code_red.png b/node_modules/connect/lib-cov/public/icons/page_white_code_red.png new file mode 100644 index 0000000000000000000000000000000000000000..87a69145075afd8f8fd8b391c5da1249ec8b2889 GIT binary patch literal 587 zcmV-R0<`^!P)LWh{^|hy<@Q*xw+qo|KpY<+vaXbbW{L4q( zTsjXEJvb}e%bgb=o%W0h?4u1;^bWTqH8}5Th002ovPDHLkV1nrS0P+9; literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png b/node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png new file mode 100644 index 0000000000000000000000000000000000000000..c66011fb0fbdcbf210483d676b7131542a0e282b GIT binary patch literal 592 zcmV-W0k7R5;6x zlV4BMP#DI+Z{WQcKZBTk0lfkj5F$ztWhP#lcuyb@0@rA^#Kpu5KLA&Rgc}o#aSmis zrZC__xY^&#cI&!!{c|4Q_tcec*#b>|Y15wPcY2=o3;-Bl=(t4;6Ok*pL)-{*A;GX^ zS(@WGp6j~k1wBVR9)BB_gar`}HyRBXh7nM!)u5^>N~MyN6bc0-5{W?44iB<`2biXb zR;wk?jIQg@G!5l)SqhrXCU}x$GU-dY1sra}0uCq@153FUULT=jNwSk}0WBjKz}Jdu z<5gB*<^XtpAmp3m^ZEXQZWd1krhft}CoYaF4cSMvTJ01}X3X37KYdx-D0$c{doUe8 ztY{vlGr-e*;N!WAV%_hgUawyYrhegW>^F)pv%uUTFslHn; zvJ)l{%w(~{!O4`KTmK{Q{zCYltLfs&4?nz|6IdlqHCvX;|HGv~!QW?8P~_d#e0$v$ z)5XHEz{3>qMiH`1+qNYf?huS+@L`J9_$cjJF)Hf?@pu;)`9}BXwGUM{2!{y-4|Z{L zG>z?O%Cp8P5T#j1DID7u_*(Jg?7iss8AZQ+&;u_J{FmILf((9eoiL5nGUe>Fgq*U$z0000 zJ3A|*qoWOonz+4ZQ0KNhDB07SX1?#FrNy8%K)_l}y&kh`*KYdy`Y99&tgNgMLSSrc z?B?+B@HO@P-jS~z2Rgc6yy~Y~%>oJpBxsb$5<&nRLqiuR7K=@0SZj~jTs|sv_jWVX zGe?WflejOaq|Vec=s9+ahmXbyJ|T)Sl*?s82sr2H?Ce~HD5WI+Sz&tmWrN()wI2}+ zKqg92t*l^-#ae~;9%KFlWkmwnY=-UK`_|%ICZ#P1gdjK<2n38VXsuC7{WiU!fZFmm zW~Sda9(Qi@pxO}$ARY+;t##Ao27usOqNt7Hwq6K7G1il@xitj=LIM&{N&#SuX;x4x zmG6FhCg-$PI;hQ=;1iZ>F>^~@)IPi;l}fX?SZ!QiO=X<|pSVkNpJuLHzW(FT_~W-v z?vFpkyE>8ee4d=7wKauH5~dd_M7d2Aa=ICC{Nj7Blqv&DQEP#j_VeWV&WXL>c=LLK zsmYg^_JiDb;%U!UxO%qjFAvsDFj-kzT2$GbV(ZopPM$i$z`!7jvEk07BcC=6FMt4` z*0u3Sy`0b~%#(0000K literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_copy.png b/node_modules/connect/lib-cov/public/icons/page_white_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f31a278e17993d8d4e13beac2f9d5f7b42d08f GIT binary patch literal 309 zcmV-50m}Y~P)sF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?u_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000zE0Ay_3@1Z_7#f-XWL#E{8Al7>L$ z0Rx7lnddoqAyfT%&#`$;v0@*5YdW3w z7mLNoa=FAshK% zDiy@zakyMAxr-H?iQDZi^!t5;Eno2A=?>mMx`Vg(Z!?<53LHLvfTPa`$mjDcX*Qdv zR;ylN4OH+m)fVX&Z#yZpUae;ss@a$K&})gHovkhr@w#xyPVlfVgXti1_357y%I-UHDvRWYvPEX+#g+j4Q9ayba zh7uQN1j%HQgA=Fp9DfODAU^*3*FCs^6IpO7xg`RUXyP)(;=d!ly=#I^l3e0Cub`{H Z`5PU3+D2e&<<>s`J(VpX#y^kqzQ;#=2x({YMw9Q&ndHT&`BD$#%Ql?{+)-OuSA`r}MWJ zVg+2Gc(GW}a=BERPNy^;kEz$|38dTYlFQ{%5S!g@|8f8D_!Nu9_Ni2glF1}xG8xi! zorc39&F6EPOeWOt_XS`W2H_Bo$MXugy}SEctJQj=(TLXTHL(jRXfzs>NF=0SHk;94 zF!&HjdZNX(3U3;LY64IMX__Xv%_wjLC!J2`0Jw?X=zPK$C$`&dYPDKaC={e16bcE@ zgun^<0k;ak*=xLE)@(Lqu~MmsFoMCLY&0Qog`NO(h@kyxaA%EbwJLy8sU*Vi`~52K zX0wrqW;_LmMq@evX4iAM9Od(Q0eHP$1%L|xAh@vrqB`HPQLon}f3aAka=9!3hr=O- z5F9`#J_7Jhah=U(4RjaRhkS4Xkk98kDz-`i!r|~~AQ1TFcDw(@<8g{aBE)l)PNxNE zI(RPyc>9e{@WGSMU%i7*v{!&P$WLz25)0oc=Dl-yy%xYZAm4b-rttL7UjR#%`#j_F R;_m(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000)l$0ECbfb-0$}>7z|u>IvuoHEmW&j4lzv=KA+EpIObc7e7{sGA)QVmnM@*^ z%|h38^m;wC+ilpk%>l#V5LCqP_y2_Cayd^XlX;j*r54R*lW!zbqtSpQNyz8(JVmWm zyV4S$2{Uhyc{Cb0QQbf{ZGT{Kr zvJi{K_&f+q^Pv4MK$hhS4TgFj_FD*rLOePdE-E^T7ZzTFCRUB`*?9&h(a#C!-v8lWG#k3AOJQaUey6Oasked^kDPe=Khg@7s584 zg`XfS1)&u*_c;I76#%`kkBfiZgKKo@0)9d6vZw=ExQUtV?eW{Y1Xv}=4X(2zy85d> Y0C^(qLv?Ui{{R3007*qoM6N<$f-gW7od5s; literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_edit.png b/node_modules/connect/lib-cov/public/icons/page_white_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b93e77600def75c9a144d3d0a5088a62c02cbb0b GIT binary patch literal 618 zcmV-w0+s!VP)$>5Y&axjp2O=VLu>*f>1L;s0)kkvKC!*u?s6CVL=HJ6oP~pNfZc; zsKr=bq;7MITw8NXw{SZm%59TId2x_9BQ zV86`NuvGI!>o^V!Na!=$7GJE{Cq`b+XwknM{UcGHFTTfmuS+ zm-zYC!P3+zmY;SG$?!fYkOih`QYaLxyF}A86h$GGN}kFj)_o*0e zjPMP%zTG7FYMAfO2Nn1D`D0Cj?Wl>5q%@CE10nX)KxpNmwk+!IWkzywiYD( zqUXiYYIq3qcRyMGJ;IY`(Gz~E$J$zu2+R{)xGlE*88b3WK6V*J>}2iPY1HH|tER0W z_+^^FdppY?o)Gt5M2`%xwRDH@R3G}^i1l4|6uchm0X0f!@&YdVLB5K&dd7Rv{)DXX zt^&vP;}kqj3f>94j+4xd93>s|Q!Ezi>?r8(Il$P}PFxSqu{d*!Y%*#cX(R0f|Juz# z3o0_xI14Al->1uky@W-rCI_%l&>PK^TXNSN{byMk2AI5vbwp!K-%-@!-vPR3iikL1L7HA!^!~ChCFU#lnGzp88=I z67V8PHBo4(l$u?-AKmT8?#_0rKW9dUNRbpLc`}piywAM9$xZ-3fR1C75T(BjCn-l* zjUcci2oXXo-}iqun@#)+`W@kL_-U&|2>MxZy~3IdmRm&8b)9!2%ksg3R)nNnT*TJOC=6{2hG86Dz+<^p6qfG5$i^UNUh+u)CD7O2 zK>Ioazn;U|+X0x$=feveYZL1W*Fm%e5P1sajd#eW#^5(ddx76*pt$^)b}$Q4oPabL zLc^HF>Z{8za;f$LtN0P$6C?1{X*jtXkRJ8IEeyiSzencvH3Ux_y>y^}wfJrRCQN#9 z?&e+C>sSAfrE%mZD5RfZ`gSndD)=P?+nG5Oq$zmY&-v+gc7R6c0u8^Ke#|XOq?gF@othF3zFpM8Il<8BJrWqBtF>b#_ye4{0)Xbu6j&@UIhRE002ov JPDHLkV1nWI9dZBw literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_excel.png b/node_modules/connect/lib-cov/public/icons/page_white_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..b977d7e52e2446ea01201c5c7209ac3a05f12c9f GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_find.png b/node_modules/connect/lib-cov/public/icons/page_white_find.png new file mode 100644 index 0000000000000000000000000000000000000000..581843637079359a6a58fcdccf0763690c67b063 GIT binary patch literal 676 zcmV;V0$crwP)_k3`4d{s8lK_6bi^@vq&To98fNoK}7)fx$e2^Y&@<^jR_Ee+8}KG;X`@ z@bCyiolqX>bb1ZIs%QGnjzFU~L8H~d?e;*XP(h(S262}XyZ3a0h07r{KV?E70l+e- zE`%3x|M5#q+;HOC(h@A^M)7Rn13dm0&>K$j%k_F4wOWlsNCIH+!c_#{eS&TL8v4yc zcpnPEY`cQzZ$ILq{U-MA6Z6Z|1p!FZjQ}tXSb25J@HphEqX-6Hqo?-_Zn@{d#>2Ml zJGhxTAd&emK$lV-QK&VM&ix0Xy{GyS3Wp(+E1^8BhD3T0a)m-Lw@Lu4zQRrP)9(3F z^>$hh@N>OAXrmPYunLi|fJ$_*5i`46;M>~*5D{bp>-OL3{+!MJa`3kv~Q#QfQ%c z)1s}QE<_XaYBG;IuRF=td#+}fi4h(6HgoUyJLi0t(*dA^B)%@8kkG&bdM5P5^Z5WF z%d%>m^SbN0XeV)wbUOXn5Ag#A$gJx+7-OCkMM1S%MWIlTkbFLmOeW(&n&wUd&;`>p zVcRy$Z{K0=?SpNnP^;BYEEXleFbq(UY&LrXX$6qkJ~)8+b{=jj3HEXds;Z(?D%}}L zX3`39&dy=Zyar!ehA}e>w)(*vrCct{PI9^2Jpj&OZS8<3-@{0(gNv%1{)zAiLY+_^ zl}e>Ofd4&#Irj#7>=o=Uhv5IJ@?sN0^J|(WL2Uun$4}si6}TG-s3T#p&6GE<<2W)O zf{^Y2HlO#*QDvTp3v&d@;8*}aUC4lisG9(w7@d5Y8y)}U#FwCkqp*Mcgme4{&gGRf zlBfd`nF9cQBKB2_L{F8G2)7pAf$i)Ds`|}-c>pc^LRW{w4SQ)3N^BbZx)6BlCZts! zKph%`(m#xg-q3I7=(us;9<)*2%iuQ1J`oV3gU6V~T}^JU5714JN33&GwEEru0d}Uo U{MPL+lmGw#07*qoM6N<$f^vibe*gdg literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_freehand.png b/node_modules/connect/lib-cov/public/icons/page_white_freehand.png new file mode 100644 index 0000000000000000000000000000000000000000..8d719df5205f7415ce657e5c277db4533c82f346 GIT binary patch literal 639 zcmV-_0)YLAP)p{{sC7)XB-g4w*W1a1)XtvxrMYa1o?wn&v~3 zHnC|#(>B_M1d`_7gfzLiHy=0c<2kQQdXu*33(xYN_xYW39(cz9jEVT%VokB8|DoF~ z8u%Q5sdl@4VB7X#uh+v_;yOGY&pRi?378ghv)P1cngiAAb<}D#l*?rWDV0j_dc6Zk z-|P~AJZQCA=yWcQjG8fYnimzj*3KqTfN0Cy!G^$7)+bQ$+mHVd1J zvwOR^5Lm<|R+uyB1Nu4vL?d4qa3tn?9H7SZH@~u=fFHEDfSH|bHU6kh0O3%cLdyny z{`9S2Sw~WMy0MPy!64i`jdk4Z3>^+KIL_fN2V_d&ywBt`^IJpxUI$=YAph~5`;xCe Z{s%Y0vkUXDnO6V+002ovPDHLkV1loX8z=w( literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_gear.png b/node_modules/connect/lib-cov/public/icons/page_white_gear.png new file mode 100644 index 0000000000000000000000000000000000000000..106f5aa3611a4807ec8c21701c631730275089a4 GIT binary patch literal 402 zcmV;D0d4+?P)<@FR}JvtGRKa0_WfK^c7uXaFH3q@Y!Hnl8VySc`OtkPN3;#l*y*l23+99h*9JzA00}rAC!#M1dZ#v9YOBH|eC*${MmzzYjBu!!-< zK8tujf&(6i)1biy*F>4{f*Kd(IU-JsG&#b_@NgTnx@40)2@2%c;*=?-2Za=}O}7&( w%_K#(S>e1j&gfY?mR})n>>0+8p`iTe2d1K2h8#$+)&Kwi07*qoM6N<$f(2cptN;K2 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_get.png b/node_modules/connect/lib-cov/public/icons/page_white_get.png new file mode 100644 index 0000000000000000000000000000000000000000..e4a1ecba1b60e54f3777717ed105cdde745b7184 GIT binary patch literal 516 zcmV+f0{i`mP)o)wchR-92qq~y6`XqbKmElbB3z{pkZs0VPF`CFvS?7jDn^mFo>d9Y&06* z&1MsS!M-CH3ee+h_sy)Ms%B*ec3R0RpVi9?*mU84yoq(Bw8 z<4(999dJJE!V%pWT~HGRIAb;(#O%2K3?uRpz}AfgE8e9q&OSdr^e^}lC$QXZz;S2A z)w>^oHy>?v)q--`!pmuBe96PxP0u*inQvyFW(llfv9 zXV1s*Jh`y2H%B3ZTA(AzpsQ?hb6_PyZ=c1?_B4fbl>G%!@ubJln=!)x0000#DY{xaiib^#X=YT4@yE_&2#eBulEdzjE`u&@G%2(&u{J-<}d(^uY4W_kMfEX z@!X)AR9F&FL?RJyJRUzvBoeqN{5kY`z3wcM0+du73~_0|*lac! z42Dw(Eg1o{Ash}P8jXrqN+1w`*XxDD;ShmPCZC7#4;wWbHoMvBl$=zF-`?*9j*Nbjd=v@OWt_BgKxP-3wd zy37?ATx&$b+&zRM!K;BD%Okw`Sb@&Pak8$KRX19jWZmC0&n*Ggv%j8nvSPDFw zEkV65AGOoBQ8kf`R|}Px*&INNS%osq9b{Fq2I(x6@xM>tg=vRLF?I`0rWzHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e-C#5QQ<|d}62BjvZR2H60wE-&H<>}%WqH(_V;zPbB1rgSSSC(0? zWlQ#?N3UgnJ9m2C29w!SwoOo5_2Iq!<8vCyEoDoj@#oV($oJEg6Bj@;nD|2g8 s%L|>IZ381yx9RvPhV4J)*SeoEV4lyr#k*`nfWBbxboFyt=akR{0DpOPi2wiq literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_key.png b/node_modules/connect/lib-cov/public/icons/page_white_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d61648452284da1bc28b10385f95b5d2bf027901 GIT binary patch literal 616 zcmV-u0+;=XP)-tZUVHjYHp;RjQ0M0pRlXN=mLv{hk9Ebp9&~+Wj-T9IkpzWPWd#fZ)d=zV^~S`;LE*!&u-?g42^wwN&Xr1~#d5ifl_2*B1OoS}CDno^8a50ArfE8;stQF>AP54J@H~%T zFz84s;dO!QJKD36(~!QOg!t_^gfFcSKDU4yK0+Ypg$NT^mIYcQ6bk*3P(lBLh7Df_ zTu=2xC#+-_%)|{Cv8zz0t|0y4D5M`xAc{gwOKc`ou<*&VjUREFHs1qd<_xSkKeTBt zgyCi=@jj;&Ns^GsWWaIUl0Y2azcDlF@u{(P*!+EH;lnU~b|Lv{4|4Hdkh!qoQHiE$ zY#y>KFA0QEw=4Z|uV{0A^`Y=D}hB$GP&<$bi8q(u;p^0(my3Rz7fP}|# zGZ&#uor4@c3q9r|f?H6-UZmfgKx(iV(MQ`MPWB>iC~SxnN5H*zb*A3#zWwgu&c|}3 zn^g87H{pdeasl%Lhmab&jC?lES}7C?4BFDNA<}20hoY@w_IU%i*T;}}wh!589}7~7 z#Ug`-R~4j&+K_y4kW@X7qLr-)S5qVKU)tO;+kXJ++{vPI@{hVK|PhMVVx_`)vx~zUs}c9O-Ok{00000NkvXXu0mjf DS5_-g literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_link.png b/node_modules/connect/lib-cov/public/icons/page_white_link.png new file mode 100644 index 0000000000000000000000000000000000000000..bf7bd1c9bfd78d689c73ba67cf914182933ee68c GIT binary patch literal 614 zcmV-s0-61ZP)OOAS;jTeL{ZSdz-%)SMH9tDF;N4B6%j=d15J&5qy`F#vB?Ar zqS1nH@%ny_XSI*Y>) z1f5QYdmzT>YciP<3WehS<{GovEaLGv27>{*-7f0&I$yJ^L%ZGPv1YT$V|u;*+ZCWz ztHI~CDVsuy($SfR6-`N~K?9GTB#l%%0h7 z-q`K-y~E)+s8lMyTrPL8^_pUo)9G|SluG5pPqw6!LJB_PzyJUM07*qoM6N<$f^=yZ AYybcN literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_magnify.png b/node_modules/connect/lib-cov/public/icons/page_white_magnify.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b74cc40f82fc83e4dfa6e9647ccc1b34e6ed7e GIT binary patch literal 554 zcmV+_0@eMAP)Vb2f>2}Fa82O3m(Ob=t*sniin`NpInLyMJgI`saru@YOPfh zy4g0#G*cV!#N%;Gq9_VH9?v%kjS3Rb1j8^;C={$Gp=lbj z*(?%?geA!5^Pok%UauwjA)v4g2`HedDw4_Mk4hhBQt?e7YJ5(hcj|3dNu^TOPGnjB zTTsqd3GIZ=Bb`n=7no)dflv&K(lsWw?lH6T1Yht0F9qgIuzh}ym0%n<3d3EBWB*pg z+G!I0lbAEXyd>k|QNuwr4=KX1D+tLPv)j@C1=N4sA4NF9A>HcO3G47*Y6!+SrUH-7 z1hb;^#S=r|`aMh>J#dWruAEf}gcR(DRUC`ZUev&$Sbh0SgLiTXeeHEU<$_YV;9281 zym`igIE%Sm8DpDw7@71Tv^EB5xSdUR*0$Mqp+Wq8OoaZtOg52&)zZ;;M=7#C1Yd6x svjx>8ad4e2x|*xHHwRjcjs6zA0XLDUqKT6dS^xk507*qoM6N<$f*wetruo^Ag2=LamM1T#~4RmC^m`_ zs}H7d&XJ}mg+hU?tu0noRvyjI&o2SRAeYZFesYkts79I^jJ7!A7%6nJwq8O?iT55M z1OQ` zbL{!Cp5o*IRmE9PInMCSPjTwfT~J+EYkz}tjxY=fg5Yf6EQ@DG$0kMJ9h^&$W}9BU zP1oj2;?MWVkKIEl)r=Y;L^Cx2q|>!)qJJ8zE7-V*-Cf7V8_2#1c0N975t~+&QUpQJ z5(uo(-O_`%Rj@U@t>JYAgd!>L?0Idxtd#oW2gc!jinsAEva8|kF4#Ic**mmml_{d^$s}Q5Q)KCys4sfck5bP1SyeHwh2`A<@N&t2j0^lgHC_^(pAAPCNjwl+>AN%C4Ll>_8Hjda%9 oS~i=#*e)>KsPlg0=2)Qg6BCqJ=F8HdGXMYp07*qoM6N<$f@i)wr~m)} literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_office.png b/node_modules/connect/lib-cov/public/icons/page_white_office.png new file mode 100644 index 0000000000000000000000000000000000000000..a65bcb3e1e9613cd9e4950850db43d7025a5fdf9 GIT binary patch literal 779 zcmV+m1N8ifP)JNR5;6x zll@CmQ5eTZ^k*a#RQf}fVOdd`5NJh6S(>6Cf$wEW#f&JyAR#GAn9>Gml;nOf3WCDa z5({5&UB$(IF?G#$x4X@Ickg!Y-HU!Z_rzX=qAq-XI_LS^=lOCT0|0{#{kBkYDS7{3 zD`iu%E=`cDX_^#^#n$5SIQ|4Zhsk8>N|zXHXG@*41$i-7`Jr{8`3S_OEcmY|RF48wXkk?WpdVM4OePBSbfh z#4_=eXJg@3epx~gi>QbUmO}Bm(ENN3+@c?jWiKvSrm(o|W}Ud*?vy~fn1!V~Cl4kB zI-;c!8f~-v)jX82%EG($>?;KSD$64f2&4qQ#=Yyrcpy$57RAVuV#vKMP)0hT$r6m# zc^F^XaJ8R9Q|}x^NoJYIvYZkq-z}Tnj@UJK2l2H zG}p+VvtjP2Z%bsb$~7QLJ9#pC0dKi`ppOd^_V;ME6tdzC0PtV|r=@e@37O`%0k^=5^`%cf$eu00N17Ro!{^30krz>a%3j34C?*{Mt2^a4~ zK=P+Qq%|f;Tc&+9ps;@Mw`EE%rgs&#y=j6BUGg96oIqdwj9-fiy*N(|@o)eD002ov JPDHLkV1j#pUPb@_ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_paint.png b/node_modules/connect/lib-cov/public/icons/page_white_paint.png new file mode 100644 index 0000000000000000000000000000000000000000..23a37b891c2f5faa3b8128d45373ceab794ca609 GIT binary patch literal 688 zcmV;h0#E&kP)PK^TXt2QS_@2qt2T|9~baC-vaPn=ziepcfAwB$0!O2Q)E}1e8!q+9)KT5JVKU z7HNY}h##OS-BxWHWjD0wrPDeEfUClHs%Q6&2u@FTOJkKMQN|_Rlw6rQz$gPzqGNtj z#ruSeFeh835JJFiM6vp@6M5bXj%k7CMt%SIwfbF_fD-3*Os`9Ly_Q3WQ_SX33E{pX z9_WIeeTCGQ3wYALpBcK+P-iuw;3i&7xCua37k5# z`>c`M@sGeC7cdsdz`aE9lOz!hPholbyz%T85LYf6O*@SA+9&+^7k>+4M8$A8iNQq{ zQvn8k?-+dU`Z@gK0z$EtPV#+`^OH`R@cE-cuE&_!D)SZGxmQxeobP_Zwq zMEgi6ePN45N`|V1so0uE8^}1xw8s;VM%Ai@7} z2-&Cyvez_-O4?6uv{zTaj|YeYEk34i~K@`8YW2g{x* zc;7z3lItpVy_et{Z-ZZ)<@*%{l7Ao8mu@V7*gz<_1##mwW*%LEwCdzNsVLYx2*T-J z#HeQ*_a=R~KDdVNk$EVgAIRl$oQi_(`_IrdJciDpH|Xe{K-YsMtc!cRnFi$qzsr4z z5*$;ecov%3->1{YNy6-Gf(Ecy&_I$CjI#laeuE+S120^|Vjsf)W&i*H07*qoM6N<$ Ef)^4A_ab^avY?n0hpS-#mn_4{O$e%cm-@NH=3`90Wq+3`~HKArSdfX`&Z12 z(CY$VW-MNtXX4xy%yUeE?}*~0-|iByA@ZrwXgph4S*bhcc5{HB!DFVm_v}P*g7+Q~K}7K0lcp(^N@X>U zV`{ZpeIf${R6Hgg4FL^`X$Eu75k(PE6ycl$AW0Ic)#@rR7Z(7;V?i-dR1K935Jgcx zPfkwK>2wGokf!Nih^ARp6-6arYFG#(9Ta!x93nFEjoA==z(g?#sDg?Owk?Mg7K+>l zWYsf(<`#+$h9Sp6gFOg_dd+80SkUpk&xM7h0`Sov9W73spU;GP073|VfZ&Gd$J$*0<~TV5aPS|qWH57|VJz+d0000vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_picture.png b/node_modules/connect/lib-cov/public/icons/page_white_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..134b6693687b2fa5fe36d48a9c0b8001f937c741 GIT binary patch literal 650 zcmV;50(Jd~P)VHAd+bMNh~)LLRqN>D)-jd9UvB%+hyKX5U|&4t0)fzgD-MPpQ$nHU%yoz=vI zMGb>1Xu!6Hw$NT~@Au<4P-+{9;Uw?&oj31uzH>xX0T7Xkz!(tn|Ed9-s_FqyReC13 z(ll)vW1O{Ck5ihay12Ob2ABc@RUI;zHpaMiyRDs0r>|D4rHw{ItJSJnYjt~jTbGuW z`X(~}?!&86q40R8<4zYw;$qi0^3ec=c&<&H;r`8W%H=Xymf^i;Wo6~<+}zx2UMzpC z*6MZN?(FMv`n|KO3(KFiUaucP0;Z!@LcUNa%8#vGK5aZ>wDgB0Gi=t*argWJcdlMQ z2#MpEX0wU+9&0U?N(F#OgpviU_Y{jYMsj65U3|PjwUOY}lUYj?MTiK_Il}NCVx-Eh zDx-TzMk7se+M#W_>?A1-x}ZXw3kkyz5kW)_hkjsi@RhKadN#H$Hq)$07*qoM6N<$f}lhwPXGV_ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png b/node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..c4eff0387d5888c638ba09473ba6d2369f7b56f0 GIT binary patch literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000JNR5;6( zlS@kiVHAe7MZY2;Xi-5)WxDDgv@tCUl*&p14T@Z~3ThM5LP4tuQfLu@EnG;nXc<8S z6&3BN?fx-cv-Kp6>HRiNTHE>$X( zD&=w+?GWC>?RLAGC6Yix;an~UmSt)tSf}1VS6N1N2ONORdD? zaj}w6DAZZdOud9Ep?M?{iQWbE5^9HLLZZF|1kdy0Tu4InEuboP9@nvbZ-P0n4AZTy zyMRIxRDmUE#LdqYuD=-Qz4N^bC`_#S7vcLn1M}{J(Wl3#c4VWczu&)AjUlh(11>gp>f`wv{KnjF%!aA*Jk N002ovPDHLkV1kkt*XsZP literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_ruby.png b/node_modules/connect/lib-cov/public/icons/page_white_ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..f59b7c4365fa1720af1aa04eb47167ddaa6eeed4 GIT binary patch literal 626 zcmV-&0*(ENP)ZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_stack.png b/node_modules/connect/lib-cov/public/icons/page_white_stack.png new file mode 100644 index 0000000000000000000000000000000000000000..44084add79b9a0fc3354d16bbd4b4b5ff8095da7 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R@9E+gqH(@-qA%AW0|7U8+xDRI z0k`B18}ImRw2g{jTGP$Pmx3yI6F_2s&$|`cJ!i0UN zB3H;=r{#{FwLaNVJ&hZl9+MTHGx1T^-A=Q0?hRb#8a~x50X%;`b6ik3cw=#XdxWy= zgrpBoDjpwP&g9<9h3x!k_B!?vuTJVkmIJ-U N;OXk;vd$@?2>|rNdMN+^ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_star.png b/node_modules/connect/lib-cov/public/icons/page_white_star.png new file mode 100644 index 0000000000000000000000000000000000000000..3a1441c9a12062a4bb3d706000d3ca14399aebca GIT binary patch literal 565 zcmV-50?Pe~P)SCZIX8XZzY2l?gCw6LlgWJ5Avz#QX4|&mI8LN)w~J1vgL=KLAhlWz*=#m~gyvxa z&;iC6gb?aZvMdXxX`<0+D1hs_pqJ!wxqlEH;CJ)je~uL(gpi@v>!I0f_Kl=E(E+Tq z26na*9gribxx-Oft(HnstyXUUy!39&E-cI%J5Rsy;(PGZH{g{ty!HVC&yGPT3H8x# zw{^gBPW)O0FMoh{k%l<`1a|To_Wl&u&-GXm8izU|&<&utILc4wc6s@u1bmTz6x{qg zTw@7=FQRcg&r`h+gcR$*Jbv+*DPk7v)B@e0o2 z6IlBXW&8xh@9)YKiV~2>+z&XKd24JT55YWz&JtfvCg4r^~bLP79-yS@n$OW00000NkvXXu0mjf DStt2z literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_swoosh.png b/node_modules/connect/lib-cov/public/icons/page_white_swoosh.png new file mode 100644 index 0000000000000000000000000000000000000000..e7708292adabf4821612bfca032cbd019c63180b GIT binary patch literal 634 zcmV-=0)_pFP)KrcWDBzIw9XCtIF5G<@j zP(;CSqHxUrerI>~wKyloM4~t_Ofl@UFEj6$Bmm6p1aK6H{5zI_FOn(%k{CiRq?CT< zoV}Ey-7=-5nVFes;1m!f?EqZLIs4k$n%39XN4dPbtX{9DZnvvaiWV0aH9I>yf;2<< zHmo7WNC<&iE4ji-iKJpsBApDKiAiqWy8R$FV|M@E-RCB03vjWNGQZJxKCc-cSB=dq z#v3snoDMC=4<2BDgiZrv0Veh~mz(X=S@;fbe>CJO_5|oe2o3=wgfW(StLzI-qr&kc zhXEJ?9=`nWXzrUKL_p*Kr9u@95MU9EKqp2vi+%&1&gUn&>Ut_d3>wiyiAJg5G7j%G z#$sf%Kqau!AAHP&4Q?edl!FWqpT=C{D}$15WC#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R>*?YcqH(@;f-l!01CbW>s1Izr z3LkoHh<3E?TVANoG4CX|$empRCCS=R(U(hVJfm~E?IkDKRK&NP2|n`v>d(vV;W1uY zrFGVdwn;4b{qUtE`?GB`)E1ga&i2|7ncUL1b!KMq^QnT#_gn?_Z8(c`1Q~Vy3oL!N z$M8vHL&U1J3SJF!56azQU3B6>r|ZQ{U6)pC|tRy7$(5JQ<@7eB8yk=XcNf-aBIe#;8c_B$^=N z{-Iq&o3%O}V4~G($=zcP(LI|+6dq{?rby~MXwJQ*=!bOvl%?k zYY;jP^@M_k03MHL+-9?_3W5MN=moFW3xmPHU=-4Bw;62MrIhg_lwHEsv)V9U4x>+9cG2kIz8fWo`WyMMfz zdg-)p!<(hFR{VYSDJHEJn09O@#)%q0l?GUg9eS2~vKPUtd+=ak5lWLd-jI=;cjEf# zt$1;~?G!t@s+VLwL=P+Ks;E z!Jkh#NeohG;&02OFD7^EY zP!_PL2~i9VnPEW6Fz?O3dVF_U$duAL$=SU7&hNc@-drC5A4z=IgjR%B|D)?dOEaGb zuwod-$hPex$8oSoqK;@Z8u3EBfK@V2CKKqo?yA%2pjNA)(P%)HWf#)x^$?52W{|1b zPXOA$IfrSQV2q(qC_vLR)a!L9isAxjoeoJRlgE&G0Ga8krBVsGjZJJ-x6y1i(eL-q zwB%+o53no?l}ZJh#drAjlc6nhs3RTn;1IH+x;K#|X)!=#fM76)$IqT4^N}IF%aQ#o zTKS@*)|#L#jiCPi9~);c`x>TR|0{+9a?O5Exg#~V5W2C7G9nAAN(~f z2caqx&t~GhnK;qW3~&OuEke?%u(8Jxs_+ZVVz1^-uLrP95TahadGG$+(D&+%2QMF8 eFxE8s%l`oWamgLPAe&$S0000dKE@duOisOkyZ-5 zuwDqkAi_*y5o3Xrq7ieT<<3p#-R^dGySwea-CgZZZITBc?#1u+FtBuUCJUZe;~j-%Tu@ZpYB;$&ydfdZG#(j;(iB#^yRlqv#C*LO zXWXM0cpKKBlj#L6awm|;A38Zs3mg;sQZmCAZT8m@X{AlP6 zVI=SsiA16x=>2%^XV3U0y4~G+MNE!B{!#;~%L2l(14PX>EblXb{rnCSlVKe0dyf-O zuY#uOf}m&2xq80;4d3i|cuNw}U@sg3VKRU)>Os_1L3pl5mK*|?X3#a}K+EVZt&w?w zefXKP^ZqnW-3y9AhYJZ~r4m*!Z3OSz3d}2Q`nDM_f_u>L%8Cb}8`?bl)x?gwAy>zp z06y57kT6sry1g2l{|V%UW?)JwnbzUugbvpOF3=oZDo}spfs2EWKOH{_^59;ue!o^A z@e7dWS|QI`Ff-E$USJ`LqDF}zH%R}YOlMiv63A=qK^d}n!5_(fW%^k4U_D`_meIDi kNMKea>saR;>gt<+0gk_zsk5>Xc>n+a07*qoM6N<$f>Jg*?*IS* literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_width.png b/node_modules/connect/lib-cov/public/icons/page_white_width.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb880947ddf3e745c29e8d9dc90f09c7e6e323c GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_word.png b/node_modules/connect/lib-cov/public/icons/page_white_word.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8ecbf47672a874c0958d0d113a56162c2bd364 GIT binary patch literal 651 zcmV;60(AX}P)hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_world.png b/node_modules/connect/lib-cov/public/icons/page_white_world.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed2490ed1432d5d667a76235360824a1088e928 GIT binary patch literal 734 zcmV<40wMj0P)JT{hN;C#tgf#9krG=I>5!<*aE1_(spcgF}<`n4i zJi-}^6UUeU4jUFwdCiVPDm%`Zx^UBa8J(mnR6wEgz^}o8;)M*Y(@l_!Kfv)}4+NuM zaPXE50z)r)9=D=SR|RIqfQ^j}Hu!fzMeQBo+@PZk1G8hOw|vBTvkx`HM)Xe9q3xao z@`p0`NO!2904FHSLA6E@Y-O6zH$DQzvq@aHsz}}<(!v(Z_+EodX%R&NZW75g+nENo zV0020rxE^;7d!067AN>6*+&YLp$9uH6F-=In`XC{Cn%+o|5)b&boEPr02w@|P*oGm QmjD0&07*qoM6N<$g78X0Q~&?~ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_wrench.png b/node_modules/connect/lib-cov/public/icons/page_white_wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..fecadd08afed92536be91ab12d8e37b6bf410d5d GIT binary patch literal 613 zcmV-r0-F7aP)wK%m(L+9IV|s|#(WRl-O^4GvaQsnHq|OstfO zIJ3}3<01}YGARE4m!7=)QisvlHUo!Qymx-@-t*p_129Ko-#pVI)6#!*kLj-AGXWNR zyA_{wKii_amK7^YT-v z6#plaNm#8`-kz@OvjIt^4%IN{@J3bR zRI}ME1Mv85p|%;RK>ViR>APPLB4;;BpCtqE@P+*7!G>I4UjNx~e>r3HA^tWCQ@S)l z{BslcSwL-CxQ&_ZZSv_g0Tu{yi*X){Mt|W7)lbE`SQxFP00000NkvXXu0mjf;)M*S literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/icons/page_white_zip.png b/node_modules/connect/lib-cov/public/icons/page_white_zip.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4bbccdf1643f4ff5022fbc59b82546e259317e GIT binary patch literal 386 zcmV-|0e$|7P)_QM!1S$Bhw4w+iRuFWf;tfR6D%SMJrb+tx zC9R6{2>Ou6#juIy6u(I?|;&Owi$sRB4^20apB5xE2 z#B9XekY66S6lzfCL!eEQRgo0LokTA55@Y#%_wN!TXPw^Q4IIXsG~v#u_4t;x_HM16EQ@QRY+rut&97&UefsPmLrQ5P zBC2kcbux9L%2bJz$P$XV$*zSxb2e@6_3O#;&!FD<&hLjGn%~%en;7)djE^d6!t$lW7GyIOKlQ46hr`Z zjLNuRDP_53dNoN?wd&HMgL^m1DXFU<5dQsrceN>fSz00000)O9XRTN^$%%`*Fg>ryDtc(lF@?b>dE!20r+y z#Q*>(wbV5H`-E4Do={CJp7=ERhw15hgZi)?jRG88 zzVz(5;g?Td1izJyO33bhjg2Qc7FVY@f9!o)Gu?DII~vm-Dc?}3M!fsgjP?F(7`rgg z+xOk8XD)e?Zl=5+un`5!7kr?F=eq)K-5uqr%yU$1hLv){Vlm=)*5~`lwMciiXFu*g z)*Jkz6AF>#zb(Vx`Iv{bdGZHtlW)v(y5k^|xgSUc9%0}S20nrYrO}78ofk?bV!5)4 z=Ngz@+$9N1>>mA%IWx`Fqa240bWkiW;2TZgd8CZS0U}@mknC;!2;wi$eI@`h0y2JS`Eae0CW}q(2(%!m8 zWq$`PDU>LT1_y*bBv#P5<@q0@ttz$hIH}YMDvAigCc=y*)jY-VOpTd;A8@3t7Xh4r z0KTWOk;N2Ox4!&&^4B*no$WtTX!BXB)rg!y8dvGgKBQKLJNXRRp0}Bsjd1|LNQX~c zbC~fjrk2iL@4dYF*vt;}dFn(%h)n_-vzEIHMOKRkdF%3Lq|zBgKm_h>TEq!))nWjq zzn;B!?!(dQcHu$#=JF`cS&W~C`WHFW^B!~MI#k)>1Vk&eQy8P1O`J6V04{D@|7d6^ zyBABnh-d^H0FX&L07M||E0n_dp4v&Q%PSE9p#R#Hq)`5I_(B5CE#q dxjPz0{s-<+c#AC!i7@~G002ovPDHLkV1iPlpuqqD literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib-cov/public/style.css b/node_modules/connect/lib-cov/public/style.css new file mode 100644 index 0000000..32b6507 --- /dev/null +++ b/node_modules/connect/lib-cov/public/style.css @@ -0,0 +1,141 @@ +body { + margin: 0; + padding: 80px 100px; + font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; + background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); + background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); + background-repeat: no-repeat; + color: #555; + -webkit-font-smoothing: antialiased; +} +h1, h2, h3 { + margin: 0; + font-size: 22px; + color: #343434; +} +h1 em, h2 em { + padding: 0 5px; + font-weight: normal; +} +h1 { + font-size: 60px; +} +h2 { + margin-top: 10px; +} +h3 { + margin: 5px 0 10px 0; + padding-bottom: 5px; + border-bottom: 1px solid #eee; + font-size: 18px; +} +ul { + margin: 0; + padding: 0; +} +ul li { + margin: 5px 0; + padding: 3px 8px; + list-style: none; +} +ul li:hover { + cursor: pointer; + color: #2e2e2e; +} +ul li .path { + padding-left: 5px; + font-weight: bold; +} +ul li .line { + padding-right: 5px; + font-style: italic; +} +ul li:first-child .path { + padding-left: 0; +} +p { + line-height: 1.5; +} +a { + color: #555; + text-decoration: none; +} +a:hover { + color: #303030; +} +#stacktrace { + margin-top: 15px; +} +.directory h1 { + margin-bottom: 15px; + font-size: 18px; +} +ul#files { + width: 100%; + height: 500px; +} +ul#files li { + padding: 0; +} +ul#files li img { + position: absolute; + top: 5px; + left: 5px; +} +ul#files li a { + position: relative; + display: block; + margin: 1px; + width: 30%; + height: 25px; + line-height: 25px; + text-indent: 8px; + float: left; + border: 1px solid transparent; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + overflow: hidden; + text-overflow: ellipsis; +} +ul#files li a.icon { + text-indent: 25px; +} +ul#files li a:focus, +ul#files li a:hover { + outline: none; + background: rgba(255,255,255,0.65); + border: 1px solid #ececec; +} +ul#files li a.highlight { + -webkit-transition: background .4s ease-in-out; + background: #ffff4f; + border-color: #E9DC51; +} +#search { + display: block; + position: fixed; + top: 20px; + right: 20px; + width: 90px; + -webkit-transition: width ease 0.2s, opacity ease 0.4s; + -moz-transition: width ease 0.2s, opacity ease 0.4s; + -webkit-border-radius: 32px; + -moz-border-radius: 32px; + -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -webkit-font-smoothing: antialiased; + text-align: left; + font: 13px "Helvetica Neue", Arial, sans-serif; + padding: 4px 10px; + border: none; + background: transparent; + margin-bottom: 0; + outline: none; + opacity: 0.7; + color: #888; +} +#search:focus { + width: 120px; + opacity: 1.0; +} diff --git a/node_modules/connect/lib-cov/utils.js b/node_modules/connect/lib-cov/utils.js new file mode 100644 index 0000000..2200dce --- /dev/null +++ b/node_modules/connect/lib-cov/utils.js @@ -0,0 +1,282 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['utils.js']) { + _$jscoverage['utils.js'] = []; + _$jscoverage['utils.js'][13] = 0; + _$jscoverage['utils.js'][26] = 0; + _$jscoverage['utils.js'][27] = 0; + _$jscoverage['utils.js'][39] = 0; + _$jscoverage['utils.js'][40] = 0; + _$jscoverage['utils.js'][41] = 0; + _$jscoverage['utils.js'][54] = 0; + _$jscoverage['utils.js'][55] = 0; + _$jscoverage['utils.js'][56] = 0; + _$jscoverage['utils.js'][57] = 0; + _$jscoverage['utils.js'][73] = 0; + _$jscoverage['utils.js'][74] = 0; + _$jscoverage['utils.js'][95] = 0; + _$jscoverage['utils.js'][96] = 0; + _$jscoverage['utils.js'][97] = 0; + _$jscoverage['utils.js'][98] = 0; + _$jscoverage['utils.js'][101] = 0; + _$jscoverage['utils.js'][112] = 0; + _$jscoverage['utils.js'][113] = 0; + _$jscoverage['utils.js'][132] = 0; + _$jscoverage['utils.js'][133] = 0; + _$jscoverage['utils.js'][147] = 0; + _$jscoverage['utils.js'][148] = 0; + _$jscoverage['utils.js'][149] = 0; + _$jscoverage['utils.js'][166] = 0; + _$jscoverage['utils.js'][167] = 0; + _$jscoverage['utils.js'][168] = 0; + _$jscoverage['utils.js'][169] = 0; + _$jscoverage['utils.js'][184] = 0; + _$jscoverage['utils.js'][185] = 0; + _$jscoverage['utils.js'][186] = 0; + _$jscoverage['utils.js'][187] = 0; + _$jscoverage['utils.js'][188] = 0; + _$jscoverage['utils.js'][189] = 0; + _$jscoverage['utils.js'][190] = 0; + _$jscoverage['utils.js'][191] = 0; + _$jscoverage['utils.js'][192] = 0; + _$jscoverage['utils.js'][196] = 0; + _$jscoverage['utils.js'][208] = 0; + _$jscoverage['utils.js'][209] = 0; + _$jscoverage['utils.js'][222] = 0; + _$jscoverage['utils.js'][223] = 0; + _$jscoverage['utils.js'][224] = 0; + _$jscoverage['utils.js'][225] = 0; + _$jscoverage['utils.js'][226] = 0; + _$jscoverage['utils.js'][228] = 0; + _$jscoverage['utils.js'][239] = 0; + _$jscoverage['utils.js'][240] = 0; + _$jscoverage['utils.js'][241] = 0; + _$jscoverage['utils.js'][242] = 0; + _$jscoverage['utils.js'][267] = 0; + _$jscoverage['utils.js'][276] = 0; + _$jscoverage['utils.js'][277] = 0; + _$jscoverage['utils.js'][278] = 0; + _$jscoverage['utils.js'][279] = 0; + _$jscoverage['utils.js'][292] = 0; + _$jscoverage['utils.js'][293] = 0; + _$jscoverage['utils.js'][305] = 0; + _$jscoverage['utils.js'][306] = 0; + _$jscoverage['utils.js'][307] = 0; + _$jscoverage['utils.js'][308] = 0; + _$jscoverage['utils.js'][319] = 0; + _$jscoverage['utils.js'][320] = 0; + _$jscoverage['utils.js'][321] = 0; + _$jscoverage['utils.js'][322] = 0; + _$jscoverage['utils.js'][334] = 0; + _$jscoverage['utils.js'][335] = 0; + _$jscoverage['utils.js'][346] = 0; + _$jscoverage['utils.js'][347] = 0; + _$jscoverage['utils.js'][350] = 0; + _$jscoverage['utils.js'][351] = 0; + _$jscoverage['utils.js'][355] = 0; + _$jscoverage['utils.js'][358] = 0; + _$jscoverage['utils.js'][369] = 0; + _$jscoverage['utils.js'][370] = 0; + _$jscoverage['utils.js'][371] = 0; + _$jscoverage['utils.js'][372] = 0; + _$jscoverage['utils.js'][374] = 0; + _$jscoverage['utils.js'][386] = 0; +} +_$jscoverage['utils.js'][13]++; +var http = require("http"), crypto = require("crypto"), parse = require("url").parse, signature = require("cookie-signature"); +_$jscoverage['utils.js'][26]++; +exports.hasBody = (function (req) { + _$jscoverage['utils.js'][27]++; + return "transfer-encoding" in req.headers || "content-length" in req.headers; +}); +_$jscoverage['utils.js'][39]++; +exports.mime = (function (req) { + _$jscoverage['utils.js'][40]++; + var str = req.headers["content-type"] || ""; + _$jscoverage['utils.js'][41]++; + return str.split(";")[0]; +}); +_$jscoverage['utils.js'][54]++; +exports.error = (function (code, msg) { + _$jscoverage['utils.js'][55]++; + var err = new Error(msg || http.STATUS_CODES[code]); + _$jscoverage['utils.js'][56]++; + err.status = code; + _$jscoverage['utils.js'][57]++; + return err; +}); +_$jscoverage['utils.js'][73]++; +exports.md5 = (function (str, encoding) { + _$jscoverage['utils.js'][74]++; + return crypto.createHash("md5").update(str).digest(encoding || "hex"); +}); +_$jscoverage['utils.js'][95]++; +exports.merge = (function (a, b) { + _$jscoverage['utils.js'][96]++; + if (a && b) { + _$jscoverage['utils.js'][97]++; + for (var key in b) { + _$jscoverage['utils.js'][98]++; + a[key] = b[key]; +} + } + _$jscoverage['utils.js'][101]++; + return a; +}); +_$jscoverage['utils.js'][112]++; +exports.escape = (function (html) { + _$jscoverage['utils.js'][113]++; + return String(html).replace(/&(?!\w+;)/g, "&").replace(//g, ">").replace(/"/g, """); +}); +_$jscoverage['utils.js'][132]++; +exports.uid = (function (len) { + _$jscoverage['utils.js'][133]++; + return crypto.randomBytes(Math.ceil(len * 3 / 4)).toString("base64").slice(0, len); +}); +_$jscoverage['utils.js'][147]++; +exports.sign = (function (val, secret) { + _$jscoverage['utils.js'][148]++; + console.warn("do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature"); + _$jscoverage['utils.js'][149]++; + return val + "." + crypto.createHmac("sha256", secret).update(val).digest("base64").replace(/=+$/, ""); +}); +_$jscoverage['utils.js'][166]++; +exports.unsign = (function (val, secret) { + _$jscoverage['utils.js'][167]++; + console.warn("do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature"); + _$jscoverage['utils.js'][168]++; + var str = val.slice(0, val.lastIndexOf(".")); + _$jscoverage['utils.js'][169]++; + return exports.sign(str, secret) == val? str: false; +}); +_$jscoverage['utils.js'][184]++; +exports.parseSignedCookies = (function (obj, secret) { + _$jscoverage['utils.js'][185]++; + var ret = {}; + _$jscoverage['utils.js'][186]++; + Object.keys(obj).forEach((function (key) { + _$jscoverage['utils.js'][187]++; + var val = obj[key]; + _$jscoverage['utils.js'][188]++; + if (0 == val.indexOf("s:")) { + _$jscoverage['utils.js'][189]++; + val = signature.unsign(val.slice(2), secret); + _$jscoverage['utils.js'][190]++; + if (val) { + _$jscoverage['utils.js'][191]++; + ret[key] = val; + _$jscoverage['utils.js'][192]++; + delete obj[key]; + } + } +})); + _$jscoverage['utils.js'][196]++; + return ret; +}); +_$jscoverage['utils.js'][208]++; +exports.parseSignedCookie = (function (str, secret) { + _$jscoverage['utils.js'][209]++; + return 0 == str.indexOf("s:")? signature.unsign(str.slice(2), secret): str; +}); +_$jscoverage['utils.js'][222]++; +exports.parseJSONCookies = (function (obj) { + _$jscoverage['utils.js'][223]++; + Object.keys(obj).forEach((function (key) { + _$jscoverage['utils.js'][224]++; + var val = obj[key]; + _$jscoverage['utils.js'][225]++; + var res = exports.parseJSONCookie(val); + _$jscoverage['utils.js'][226]++; + if (res) { + _$jscoverage['utils.js'][226]++; + obj[key] = res; + } +})); + _$jscoverage['utils.js'][228]++; + return obj; +}); +_$jscoverage['utils.js'][239]++; +exports.parseJSONCookie = (function (str) { + _$jscoverage['utils.js'][240]++; + if (0 == str.indexOf("j:")) { + _$jscoverage['utils.js'][241]++; + try { + _$jscoverage['utils.js'][242]++; + return JSON.parse(str.slice(2)); + } + catch (err) { + } + } +}); +_$jscoverage['utils.js'][267]++; +exports.pause = require("pause"); +_$jscoverage['utils.js'][276]++; +exports.removeContentHeaders = (function (res) { + _$jscoverage['utils.js'][277]++; + Object.keys(res._headers).forEach((function (field) { + _$jscoverage['utils.js'][278]++; + if (0 == field.indexOf("content")) { + _$jscoverage['utils.js'][279]++; + res.removeHeader(field); + } +})); +}); +_$jscoverage['utils.js'][292]++; +exports.conditionalGET = (function (req) { + _$jscoverage['utils.js'][293]++; + return req.headers["if-modified-since"] || req.headers["if-none-match"]; +}); +_$jscoverage['utils.js'][305]++; +exports.unauthorized = (function (res, realm) { + _$jscoverage['utils.js'][306]++; + res.statusCode = 401; + _$jscoverage['utils.js'][307]++; + res.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\""); + _$jscoverage['utils.js'][308]++; + res.end("Unauthorized"); +}); +_$jscoverage['utils.js'][319]++; +exports.notModified = (function (res) { + _$jscoverage['utils.js'][320]++; + exports.removeContentHeaders(res); + _$jscoverage['utils.js'][321]++; + res.statusCode = 304; + _$jscoverage['utils.js'][322]++; + res.end(); +}); +_$jscoverage['utils.js'][334]++; +exports.etag = (function (stat) { + _$jscoverage['utils.js'][335]++; + return "\"" + stat.size + "-" + Number(stat.mtime) + "\""; +}); +_$jscoverage['utils.js'][346]++; +exports.parseCacheControl = (function (str) { + _$jscoverage['utils.js'][347]++; + var directives = str.split(","), obj = {}; + _$jscoverage['utils.js'][350]++; + for (var i = 0, len = directives.length; i < len; i++) { + _$jscoverage['utils.js'][351]++; + var parts = directives[i].split("="), key = parts.shift().trim(), val = parseInt(parts.shift(), 10); + _$jscoverage['utils.js'][355]++; + obj[key] = isNaN(val)? true: val; +} + _$jscoverage['utils.js'][358]++; + return obj; +}); +_$jscoverage['utils.js'][369]++; +exports.parseUrl = (function (req) { + _$jscoverage['utils.js'][370]++; + var parsed = req._parsedUrl; + _$jscoverage['utils.js'][371]++; + if (parsed && parsed.href == req.url) { + _$jscoverage['utils.js'][372]++; + return parsed; + } + else { + _$jscoverage['utils.js'][374]++; + return req._parsedUrl = parse(req.url); + } +}); +_$jscoverage['utils.js'][386]++; +exports.parseBytes = require("bytes"); +_$jscoverage['utils.js'].source = ["","/*!"," * Connect - utils"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , crypto = require('crypto')"," , parse = require('url').parse"," , signature = require('cookie-signature');","","/**"," * Return `true` if the request has a body, otherwise return `false`."," *"," * @param {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.hasBody = function(req) {"," return 'transfer-encoding' in req.headers || 'content-length' in req.headers;","};","","/**"," * Extract the mime type from the given request's"," * _Content-Type_ header."," *"," * @param {IncomingMessage} req"," * @return {String}"," * @api private"," */","","exports.mime = function(req) {"," var str = req.headers['content-type'] || '';"," return str.split(';')[0];","};","","/**"," * Generate an `Error` from the given status `code`"," * and optional `msg`."," *"," * @param {Number} code"," * @param {String} msg"," * @return {Error}"," * @api private"," */","","exports.error = function(code, msg){"," var err = new Error(msg || http.STATUS_CODES[code]);"," err.status = code;"," return err;","};","","/**"," * Return md5 hash of the given string and optional encoding,"," * defaulting to hex."," *"," * utils.md5('wahoo');"," * // => \"e493298061761236c96b02ea6aa8a2ad\""," *"," * @param {String} str"," * @param {String} encoding"," * @return {String}"," * @api private"," */","","exports.md5 = function(str, encoding){"," return crypto"," .createHash('md5')"," .update(str)"," .digest(encoding || 'hex');","};","","/**"," * Merge object b with object a."," *"," * var a = { foo: 'bar' }"," * , b = { bar: 'baz' };"," * "," * utils.merge(a, b);"," * // => { foo: 'bar', bar: 'baz' }"," *"," * @param {Object} a"," * @param {Object} b"," * @return {Object}"," * @api private"," */","","exports.merge = function(a, b){"," if (a && b) {"," for (var key in b) {"," a[key] = b[key];"," }"," }"," return a;","};","","/**"," * Escape the given string of `html`."," *"," * @param {String} html"," * @return {String}"," * @api private"," */","","exports.escape = function(html){"," return String(html)"," .replace(/&(?!\\w+;)/g, '&amp;')"," .replace(/</g, '&lt;')"," .replace(/>/g, '&gt;')"," .replace(/\"/g, '&quot;');","};","","","/**"," * Return a unique identifier with the given `len`."," *"," * utils.uid(10);"," * // => \"FDaS435D2z\""," *"," * @param {Number} len"," * @return {String}"," * @api private"," */","","exports.uid = function(len) {"," return crypto.randomBytes(Math.ceil(len * 3 / 4))"," .toString('base64')"," .slice(0, len);","};","","/**"," * Sign the given `val` with `secret`."," *"," * @param {String} val"," * @param {String} secret"," * @return {String}"," * @api private"," */","","exports.sign = function(val, secret){"," console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature')"," 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){"," console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature')"," var str = val.slice(0, val.lastIndexOf('.'));"," return exports.sign(str, secret) == val"," ? str"," : false;","};","","/**"," * Parse signed cookies, returning an object"," * containing the decoded key/value pairs,"," * while removing the signed key from `obj`."," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.parseSignedCookies = function(obj, secret){"," var ret = {};"," Object.keys(obj).forEach(function(key){"," var val = obj[key];"," if (0 == val.indexOf('s:')) {"," val = signature.unsign(val.slice(2), secret);"," if (val) {"," ret[key] = val;"," delete obj[key];"," }"," }"," });"," return ret;","};","","/**"," * Parse a signed cookie string, return the decoded value"," *"," * @param {String} str signed cookie string"," * @param {String} secret"," * @return {String} decoded value"," * @api private"," */","","exports.parseSignedCookie = function(str, secret){"," return 0 == str.indexOf('s:')"," ? signature.unsign(str.slice(2), secret)"," : str;","};","","/**"," * Parse JSON cookies."," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.parseJSONCookies = function(obj){"," Object.keys(obj).forEach(function(key){"," var val = obj[key];"," var res = exports.parseJSONCookie(val);"," if (res) obj[key] = res;"," });"," return obj;","};","","/**"," * Parse JSON cookie string"," *"," * @param {String} str"," * @return {Object} Parsed object or null if not json cookie"," * @api private"," */","","exports.parseJSONCookie = function(str) {"," if (0 == str.indexOf('j:')) {"," try {"," return JSON.parse(str.slice(2));"," } catch (err) {"," // no op"," }"," }","};","","/**"," * Pause `data` and `end` events on the given `obj`."," * Middleware performing async tasks _should_ utilize"," * this utility (or similar), to re-emit data once"," * the async operation has completed, otherwise these"," * events may be lost."," *"," * var pause = utils.pause(req);"," * fs.readFile(path, function(){"," * next();"," * pause.resume();"," * });"," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.pause = require('pause');","","/**"," * Strip `Content-*` headers from `res`."," *"," * @param {ServerResponse} res"," * @api private"," */","","exports.removeContentHeaders = function(res){"," Object.keys(res._headers).forEach(function(field){"," if (0 == field.indexOf('content')) {"," res.removeHeader(field);"," }"," });","};","","/**"," * Check if `req` is a conditional GET request."," *"," * @param {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.conditionalGET = function(req) {"," return req.headers['if-modified-since']"," || req.headers['if-none-match'];","};","","/**"," * Respond with 401 \"Unauthorized\"."," *"," * @param {ServerResponse} res"," * @param {String} realm"," * @api private"," */","","exports.unauthorized = function(res, realm) {"," res.statusCode = 401;"," res.setHeader('WWW-Authenticate', 'Basic realm=\"' + realm + '\"');"," res.end('Unauthorized');","};","","/**"," * Respond with 304 \"Not Modified\"."," *"," * @param {ServerResponse} res"," * @param {Object} headers"," * @api private"," */","","exports.notModified = function(res) {"," exports.removeContentHeaders(res);"," res.statusCode = 304;"," res.end();","};","","/**"," * Return an ETag in the form of `\"<size>-<mtime>\"`"," * from the given `stat`."," *"," * @param {Object} stat"," * @return {String}"," * @api private"," */","","exports.etag = function(stat) {"," return '\"' + stat.size + '-' + Number(stat.mtime) + '\"';","};","","/**"," * Parse the given Cache-Control `str`."," *"," * @param {String} str"," * @return {Object}"," * @api private"," */","","exports.parseCacheControl = function(str){"," var directives = str.split(',')"," , obj = {};",""," for(var i = 0, len = directives.length; i < len; i++) {"," var parts = directives[i].split('=')"," , key = parts.shift().trim()"," , val = parseInt(parts.shift(), 10);",""," obj[key] = isNaN(val) ? true : val;"," }",""," return obj;","};","","/**"," * Parse the `req` url with memoization."," *"," * @param {ServerRequest} req"," * @return {Object}"," * @api private"," */","","exports.parseUrl = function(req){"," var parsed = req._parsedUrl;"," if (parsed && parsed.href == req.url) {"," return parsed;"," } else {"," return req._parsedUrl = parse(req.url);"," }","};","","/**"," * Parse byte `size` string."," *"," * @param {String} size"," * @return {Number}"," * @api private"," */","","exports.parseBytes = require('bytes');"]; diff --git a/node_modules/connect/lib/cache.js b/node_modules/connect/lib/cache.js new file mode 100644 index 0000000..052fcdb --- /dev/null +++ b/node_modules/connect/lib/cache.js @@ -0,0 +1,81 @@ + +/*! + * Connect - Cache + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Expose `Cache`. + */ + +module.exports = Cache; + +/** + * LRU cache store. + * + * @param {Number} limit + * @api private + */ + +function Cache(limit) { + this.store = {}; + this.keys = []; + this.limit = limit; +} + +/** + * Touch `key`, promoting the object. + * + * @param {String} key + * @param {Number} i + * @api private + */ + +Cache.prototype.touch = function(key, i){ + this.keys.splice(i,1); + this.keys.push(key); +}; + +/** + * Remove `key`. + * + * @param {String} key + * @api private + */ + +Cache.prototype.remove = function(key){ + delete this.store[key]; +}; + +/** + * Get the object stored for `key`. + * + * @param {String} key + * @return {Array} + * @api private + */ + +Cache.prototype.get = function(key){ + return this.store[key]; +}; + +/** + * Add a cache `key`. + * + * @param {String} key + * @return {Array} + * @api private + */ + +Cache.prototype.add = function(key){ + // initialize store + var len = this.keys.push(key); + + // limit reached, invalidate LRU + if (len > this.limit) this.remove(this.keys.shift()); + + var arr = this.store[key] = []; + arr.createdAt = new Date; + return arr; +}; diff --git a/node_modules/connect/lib/connect.js b/node_modules/connect/lib/connect.js new file mode 100644 index 0000000..a067e24 --- /dev/null +++ b/node_modules/connect/lib/connect.js @@ -0,0 +1,93 @@ + +/*! + * Connect + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , proto = require('./proto') + , utils = require('./utils') + , path = require('path') + , basename = path.basename + , fs = require('fs'); + +// node patches + +require('./patch'); + +// expose createServer() as the module + +exports = module.exports = createServer; + +/** + * Framework version. + */ + +exports.version = '2.7.2'; + +/** + * Expose mime module. + */ + +exports.mime = require('./middleware/static').mime; + +/** + * Expose the prototype. + */ + +exports.proto = proto; + +/** + * Auto-load middleware getters. + */ + +exports.middleware = {}; + +/** + * Expose utilities. + */ + +exports.utils = utils; + +/** + * Create a new connect server. + * + * @return {Function} + * @api public + */ + +function createServer() { + function app(req, res){ app.handle(req, res); } + utils.merge(app, proto); + utils.merge(app, EventEmitter.prototype); + app.route = '/'; + app.stack = []; + for (var i = 0; i < arguments.length; ++i) { + app.use(arguments[i]); + } + return app; +}; + +/** + * Support old `.createServer()` method. + */ + +createServer.createServer = createServer; + +/** + * Auto-load bundled middleware with getters. + */ + +fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ + if (!/\.js$/.test(filename)) return; + var name = basename(filename, '.js'); + function load(){ return require('./middleware/' + name); } + exports.middleware.__defineGetter__(name, load); + exports.__defineGetter__(name, load); +}); diff --git a/node_modules/connect/lib/index.js b/node_modules/connect/lib/index.js new file mode 100644 index 0000000..2618ddc --- /dev/null +++ b/node_modules/connect/lib/index.js @@ -0,0 +1,50 @@ + +/** + * Connect is a middleware framework for node, + * shipping with over 18 bundled middleware and a rich selection of + * 3rd-party middleware. + * + * var app = connect() + * .use(connect.logger('dev')) + * .use(connect.static('public')) + * .use(function(req, res){ + * res.end('hello world\n'); + * }) + * .listen(3000); + * + * Installation: + * + * $ npm install connect + * + * Middleware: + * + * - [logger](logger.html) request logger with custom format support + * - [csrf](csrf.html) Cross-site request forgery protection + * - [compress](compress.html) Gzip compression middleware + * - [basicAuth](basicAuth.html) basic http authentication + * - [bodyParser](bodyParser.html) extensible request body parser + * - [json](json.html) application/json parser + * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser + * - [multipart](multipart.html) multipart/form-data parser + * - [timeout](timeout.html) request timeouts + * - [cookieParser](cookieParser.html) cookie parser + * - [session](session.html) session management support with bundled MemoryStore + * - [cookieSession](cookieSession.html) cookie-based session support + * - [methodOverride](methodOverride.html) faux HTTP method support + * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time + * - [staticCache](staticCache.html) memory cache layer for the static() middleware + * - [static](static.html) streaming static file server supporting `Range` and more + * - [directory](directory.html) directory listing middleware + * - [vhost](vhost.html) virtual host sub-domain mapping middleware + * - [favicon](favicon.html) efficient favicon server (with default icon) + * - [limit](limit.html) limit the bytesize of request bodies + * - [query](query.html) automatic querystring parser, populating `req.query` + * - [errorHandler](errorHandler.html) flexible error handler + * + * Links: + * + * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware + * - GitHub [repository](http://github.com/senchalabs/connect) + * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md) + * + */ \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/basicAuth.js b/node_modules/connect/lib/middleware/basicAuth.js new file mode 100644 index 0000000..0205812 --- /dev/null +++ b/node_modules/connect/lib/middleware/basicAuth.js @@ -0,0 +1,103 @@ + +/*! + * Connect - basicAuth + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , unauthorized = utils.unauthorized; + +/** + * Basic Auth: + * + * Enfore basic authentication by providing a `callback(user, pass)`, + * which must return `true` in order to gain access. Alternatively an async + * method is provided as well, invoking `callback(user, pass, callback)`. Populates + * `req.user`. The final alternative is simply passing username / password + * strings. + * + * Simple username and password + * + * connect(connect.basicAuth('username', 'password')); + * + * Callback verification + * + * connect() + * .use(connect.basicAuth(function(user, pass){ + * return 'tj' == user & 'wahoo' == pass; + * })) + * + * Async callback verification, accepting `fn(err, user)`. + * + * connect() + * .use(connect.basicAuth(function(user, pass, fn){ + * User.authenticate({ user: user, pass: pass }, fn); + * })) + * + * @param {Function|String} callback or username + * @param {String} realm + * @api public + */ + +module.exports = function basicAuth(callback, realm) { + var username, password; + + // user / pass strings + if ('string' == typeof callback) { + username = callback; + password = realm; + if ('string' != typeof password) throw new Error('password argument required'); + realm = arguments[2]; + callback = function(user, pass){ + return user == username && pass == password; + } + } + + realm = realm || 'Authorization Required'; + + return function(req, res, next) { + var authorization = req.headers.authorization; + + if (req.user) return next(); + if (!authorization) return unauthorized(res, realm); + + var parts = authorization.split(' '); + + if (parts.length !== 2) return next(400); + + var scheme = parts[0] + , credentials = new Buffer(parts[1], 'base64').toString() + , index = credentials.indexOf(':'); + + if ('Basic' != scheme || index < 0) return next(400); + + var user = credentials.slice(0, index) + , pass = credentials.slice(index + 1); + + // async + if (callback.length >= 3) { + var pause = utils.pause(req); + callback(user, pass, function(err, user){ + if (err || !user) return unauthorized(res, realm); + req.user = req.remoteUser = user; + next(); + pause.resume(); + }); + // sync + } else { + if (callback(user, pass)) { + req.user = req.remoteUser = user; + next(); + } else { + unauthorized(res, realm); + } + } + } +}; + diff --git a/node_modules/connect/lib/middleware/bodyParser.js b/node_modules/connect/lib/middleware/bodyParser.js new file mode 100644 index 0000000..9f692cd --- /dev/null +++ b/node_modules/connect/lib/middleware/bodyParser.js @@ -0,0 +1,61 @@ + +/*! + * Connect - bodyParser + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var multipart = require('./multipart') + , urlencoded = require('./urlencoded') + , json = require('./json'); + +/** + * Body parser: + * + * Parse request bodies, supports _application/json_, + * _application/x-www-form-urlencoded_, and _multipart/form-data_. + * + * This is equivalent to: + * + * app.use(connect.json()); + * app.use(connect.urlencoded()); + * app.use(connect.multipart()); + * + * Examples: + * + * connect() + * .use(connect.bodyParser()) + * .use(function(req, res) { + * res.end('viewing user ' + req.body.user.name); + * }); + * + * $ curl -d 'user[name]=tj' http://local/ + * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/ + * + * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function bodyParser(options){ + var _urlencoded = urlencoded(options) + , _multipart = multipart(options) + , _json = json(options); + + return function bodyParser(req, res, next) { + _json(req, res, function(err){ + if (err) return next(err); + _urlencoded(req, res, function(err){ + if (err) return next(err); + _multipart(req, res, next); + }); + }); + } +}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/compress.js b/node_modules/connect/lib/middleware/compress.js new file mode 100644 index 0000000..2dc6437 --- /dev/null +++ b/node_modules/connect/lib/middleware/compress.js @@ -0,0 +1,147 @@ +/*! + * Connect - compress + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var zlib = require('zlib'); + +/** + * Supported content-encoding methods. + */ + +exports.methods = { + gzip: zlib.createGzip + , deflate: zlib.createDeflate +}; + +/** + * Default filter function. + */ + +exports.filter = function(req, res){ + return /json|text|javascript/.test(res.getHeader('Content-Type')); +}; + +/** + * Compress: + * + * Compress response data with gzip/deflate. + * + * Filter: + * + * A `filter` callback function may be passed to + * replace the default logic of: + * + * exports.filter = function(req, res){ + * return /json|text|javascript/.test(res.getHeader('Content-Type')); + * }; + * + * Options: + * + * All remaining options are passed to the gzip/deflate + * creation functions. Consult node's docs for additional details. + * + * - `chunkSize` (default: 16*1024) + * - `windowBits` + * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression + * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more + * - `strategy`: compression strategy + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function compress(options) { + options = options || {}; + var names = Object.keys(exports.methods) + , filter = options.filter || exports.filter; + + return function(req, res, next){ + var accept = req.headers['accept-encoding'] + , write = res.write + , end = res.end + , stream + , method; + + // vary + res.setHeader('Vary', 'Accept-Encoding'); + + // proxy + + res.write = function(chunk, encoding){ + if (!this.headerSent) this._implicitHeader(); + return stream + ? stream.write(new Buffer(chunk, encoding)) + : write.call(res, chunk, encoding); + }; + + res.end = function(chunk, encoding){ + if (chunk) this.write(chunk, encoding); + return stream + ? stream.end() + : end.call(res); + }; + + res.on('header', function(){ + var encoding = res.getHeader('Content-Encoding') || 'identity'; + + // already encoded + if ('identity' != encoding) return; + + // default request filter + if (!filter(req, res)) return; + + // SHOULD use identity + if (!accept) return; + + // head + if ('HEAD' == req.method) return; + + // default to gzip + if ('*' == accept.trim()) method = 'gzip'; + + // compression method + if (!method) { + for (var i = 0, len = names.length; i < len; ++i) { + if (~accept.indexOf(names[i])) { + method = names[i]; + break; + } + } + } + + // compression method + if (!method) return; + + // compression stream + stream = exports.methods[method](options); + + // header fields + res.setHeader('Content-Encoding', method); + res.removeHeader('Content-Length'); + + // compression + + stream.on('data', function(chunk){ + write.call(res, chunk); + }); + + stream.on('end', function(){ + end.call(res); + }); + + stream.on('drain', function() { + res.emit('drain'); + }); + }); + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/connect/lib/middleware/cookieParser.js new file mode 100644 index 0000000..5da23f2 --- /dev/null +++ b/node_modules/connect/lib/middleware/cookieParser.js @@ -0,0 +1,62 @@ + +/*! + * Connect - cookieParser + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./../utils') + , cookie = require('cookie'); + +/** + * Cookie parser: + * + * Parse _Cookie_ header and populate `req.cookies` + * with an object keyed by the cookie names. Optionally + * you may enabled signed cookie support by passing + * a `secret` string, which assigns `req.secret` so + * it may be used by other middleware. + * + * Examples: + * + * connect() + * .use(connect.cookieParser('optional secret string')) + * .use(function(req, res, next){ + * res.end(JSON.stringify(req.cookies)); + * }) + * + * @param {String} secret + * @return {Function} + * @api public + */ + +module.exports = function cookieParser(secret){ + return function cookieParser(req, res, next) { + if (req.cookies) return next(); + var cookies = req.headers.cookie; + + req.secret = secret; + req.cookies = {}; + req.signedCookies = {}; + + if (cookies) { + try { + req.cookies = cookie.parse(cookies); + if (secret) { + req.signedCookies = utils.parseSignedCookies(req.cookies, secret); + req.signedCookies = utils.parseJSONCookies(req.signedCookies); + } + req.cookies = utils.parseJSONCookies(req.cookies); + } catch (err) { + err.status = 400; + return next(err); + } + } + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/cookieSession.js b/node_modules/connect/lib/middleware/cookieSession.js new file mode 100644 index 0000000..1a23d57 --- /dev/null +++ b/node_modules/connect/lib/middleware/cookieSession.js @@ -0,0 +1,115 @@ + +/*! + * Connect - cookieSession + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./../utils') + , Cookie = require('./session/cookie') + , debug = require('debug')('connect:cookieSession') + , signature = require('cookie-signature') + , crc32 = require('buffer-crc32'); + +/** + * Cookie Session: + * + * Cookie session middleware. + * + * var app = connect(); + * app.use(connect.cookieParser()); + * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }})); + * + * Options: + * + * - `key` cookie name defaulting to `connect.sess` + * - `secret` prevents cookie tampering + * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` + * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") + * + * Clearing sessions: + * + * To clear the session simply set its value to `null`, + * `cookieSession()` will then respond with a 1970 Set-Cookie. + * + * req.session = null; + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function cookieSession(options){ + // TODO: utilize Session/Cookie to unify API + options = options || {}; + var key = options.key || 'connect.sess' + , trustProxy = options.proxy; + + return function cookieSession(req, res, next) { + + // req.secret is for backwards compatibility + var secret = options.secret || req.secret; + if (!secret) throw new Error('`secret` option required for cookie sessions'); + + // default session + req.session = {}; + var cookie = req.session.cookie = new Cookie(options.cookie); + + // pathname mismatch + if (0 != req.originalUrl.indexOf(cookie.path)) return next(); + + // cookieParser secret + if (!options.secret && req.secret) { + req.session = req.signedCookies[key] || {}; + } else { + // TODO: refactor + var rawCookie = req.cookies[key]; + if (rawCookie) { + var unsigned = utils.parseSignedCookie(rawCookie, secret); + if (unsigned) { + var originalHash = crc32.signed(unsigned); + req.session = utils.parseJSONCookie(unsigned) || {}; + } + } + } + + res.on('header', function(){ + // removed + if (!req.session) { + debug('clear session'); + cookie.expires = new Date(0); + res.setHeader('Set-Cookie', cookie.serialize(key, '')); + return; + } + + delete req.session.cookie; + + // check security + var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() + , tls = req.connection.encrypted || (trustProxy && 'https' == proto) + , secured = cookie.secure && tls; + + // only send secure cookies via https + if (cookie.secure && !secured) return debug('not secured'); + + // serialize + debug('serializing %j', req.session); + var val = 'j:' + JSON.stringify(req.session); + + // compare hashes, no need to set-cookie if unchanged + if (originalHash == crc32.signed(val)) return debug('unmodified session'); + + // set-cookie + val = 's:' + signature.sign(val, secret); + val = cookie.serialize(key, val); + debug('set-cookie %j', cookie); + res.setHeader('Set-Cookie', val); + }); + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/csrf.js b/node_modules/connect/lib/middleware/csrf.js new file mode 100644 index 0000000..5d5e7c6 --- /dev/null +++ b/node_modules/connect/lib/middleware/csrf.js @@ -0,0 +1,73 @@ +/*! + * Connect - csrf + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils'); + +/** + * Anti CSRF: + * + * CRSF protection middleware. + * + * By default this middleware generates a token named "_csrf" + * which should be added to requests which mutate + * state, within a hidden form field, query-string etc. This + * token is validated against the visitor's `req.session._csrf` + * property. + * + * The default `value` function checks `req.body` generated + * by the `bodyParser()` middleware, `req.query` generated + * by `query()`, and the "X-CSRF-Token" header field. + * + * This middleware requires session support, thus should be added + * somewhere _below_ `session()` and `cookieParser()`. + * + * Options: + * + * - `value` a function accepting the request, returning the token + * + * @param {Object} options + * @api public + */ + +module.exports = function csrf(options) { + options = options || {}; + var value = options.value || defaultValue; + + return function(req, res, next){ + // generate CSRF token + var token = req.session._csrf || (req.session._csrf = utils.uid(24)); + + // ignore these methods + if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next(); + + // determine value + var val = value(req); + + // check + if (val != token) return next(403); + + next(); + } +}; + +/** + * Default value function, checking the `req.body` + * and `req.query` for the CSRF token. + * + * @param {IncomingMessage} req + * @return {String} + * @api private + */ + +function defaultValue(req) { + return (req.body && req.body._csrf) + || (req.query && req.query._csrf) + || (req.headers['x-csrf-token']); +} diff --git a/node_modules/connect/lib/middleware/directory.js b/node_modules/connect/lib/middleware/directory.js new file mode 100644 index 0000000..8fa008c --- /dev/null +++ b/node_modules/connect/lib/middleware/directory.js @@ -0,0 +1,228 @@ + +/*! + * Connect - directory + * Copyright(c) 2011 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +// TODO: icon / style for directories +// TODO: arrow key navigation +// TODO: make icons extensible + +/** + * Module dependencies. + */ + +var fs = require('fs') + , parse = require('url').parse + , path = require('path') + , normalize = path.normalize + , extname = path.extname + , join = path.join; + +/*! + * Icon cache. + */ + +var cache = {}; + +/** + * Directory: + * + * Serve directory listings with the given `root` path. + * + * Options: + * + * - `hidden` display hidden (dot) files. Defaults to false. + * - `icons` display icons. Defaults to false. + * - `filter` Apply this filter function to files. Defaults to false. + * + * @param {String} root + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function directory(root, options){ + options = options || {}; + + // root required + if (!root) throw new Error('directory() root path required'); + var hidden = options.hidden + , icons = options.icons + , filter = options.filter + , root = normalize(root); + + return function directory(req, res, next) { + if ('GET' != req.method && 'HEAD' != req.method) return next(); + + var accept = req.headers.accept || 'text/plain' + , url = parse(req.url) + , dir = decodeURIComponent(url.pathname) + , path = normalize(join(root, dir)) + , originalUrl = parse(req.originalUrl) + , originalDir = decodeURIComponent(originalUrl.pathname) + , showUp = path != root && path != root + '/'; + + // null byte(s), bad request + if (~path.indexOf('\0')) return next(400); + + // malicious path, forbidden + if (0 != path.indexOf(root)) return next(403); + + // check if we have a directory + fs.stat(path, function(err, stat){ + if (err) return 'ENOENT' == err.code + ? next() + : next(err); + + if (!stat.isDirectory()) return next(); + + // fetch files + fs.readdir(path, function(err, files){ + if (err) return next(err); + if (!hidden) files = removeHidden(files); + if (filter) files = files.filter(filter); + files.sort(); + + // content-negotiation + for (var key in exports) { + if (~accept.indexOf(key) || ~accept.indexOf('*/*')) { + exports[key](req, res, files, next, originalDir, showUp, icons); + return; + } + } + + // not acceptable + next(406); + }); + }); + }; +}; + +/** + * Respond with text/html. + */ + +exports.html = function(req, res, files, next, dir, showUp, icons){ + fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){ + if (err) return next(err); + fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){ + if (err) return next(err); + if (showUp) files.unshift('..'); + str = str + .replace('{style}', style) + .replace('{files}', html(files, dir, icons)) + .replace('{directory}', dir) + .replace('{linked-path}', htmlPath(dir)); + res.setHeader('Content-Type', 'text/html'); + res.setHeader('Content-Length', str.length); + res.end(str); + }); + }); +}; + +/** + * Respond with application/json. + */ + +exports.json = function(req, res, files){ + files = JSON.stringify(files); + res.setHeader('Content-Type', 'application/json'); + res.setHeader('Content-Length', files.length); + res.end(files); +}; + +/** + * Respond with text/plain. + */ + +exports.plain = function(req, res, files){ + files = files.join('\n') + '\n'; + res.setHeader('Content-Type', 'text/plain'); + res.setHeader('Content-Length', files.length); + res.end(files); +}; + +/** + * Map html `dir`, returning a linked path. + */ + +function htmlPath(dir) { + var curr = []; + return dir.split('/').map(function(part){ + curr.push(part); + return '' + part + ''; + }).join(' / '); +} + +/** + * Map html `files`, returning an html unordered list. + */ + +function html(files, dir, useIcons) { + return '
      ' + files.map(function(file){ + var icon = '' + , classes = []; + + if (useIcons && '..' != file) { + icon = icons[extname(file)] || icons.default; + icon = ''; + classes.push('icon'); + } + + return '
    • ' + + icon + file + '
    • '; + + }).join('\n') + '
    '; +} + +/** + * Load and cache the given `icon`. + * + * @param {String} icon + * @return {String} + * @api private + */ + +function load(icon) { + if (cache[icon]) return cache[icon]; + return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64'); +} + +/** + * Filter "hidden" `files`, aka files + * beginning with a `.`. + * + * @param {Array} files + * @return {Array} + * @api private + */ + +function removeHidden(files) { + return files.filter(function(file){ + return '.' != file[0]; + }); +} + +/** + * Icon map. + */ + +var icons = { + '.js': 'page_white_code_red.png' + , '.c': 'page_white_c.png' + , '.h': 'page_white_h.png' + , '.cc': 'page_white_cplusplus.png' + , '.php': 'page_white_php.png' + , '.rb': 'page_white_ruby.png' + , '.cpp': 'page_white_cplusplus.png' + , '.swf': 'page_white_flash.png' + , '.pdf': 'page_white_acrobat.png' + , 'default': 'page_white.png' +}; diff --git a/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/connect/lib/middleware/errorHandler.js new file mode 100644 index 0000000..4a84edc --- /dev/null +++ b/node_modules/connect/lib/middleware/errorHandler.js @@ -0,0 +1,86 @@ +/*! + * Connect - errorHandler + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , fs = require('fs'); + +// environment + +var env = process.env.NODE_ENV || 'development'; + +/** + * Error handler: + * + * Development error handler, providing stack traces + * and error message responses for requests accepting text, html, + * or json. + * + * Text: + * + * By default, and when _text/plain_ is accepted a simple stack trace + * or error message will be returned. + * + * JSON: + * + * When _application/json_ is accepted, connect will respond with + * an object in the form of `{ "error": error }`. + * + * HTML: + * + * When accepted connect will output a nice html stack trace. + * + * @return {Function} + * @api public + */ + +exports = module.exports = function errorHandler(){ + return function errorHandler(err, req, res, next){ + if (err.status) res.statusCode = err.status; + if (res.statusCode < 400) res.statusCode = 500; + if ('test' != env) console.error(err.stack); + var accept = req.headers.accept || ''; + // html + if (~accept.indexOf('html')) { + fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ + fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ + var stack = (err.stack || '') + .split('\n').slice(1) + .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); + html = html + .replace('{style}', style) + .replace('{stack}', stack) + .replace('{title}', exports.title) + .replace('{statusCode}', res.statusCode) + .replace(/\{error\}/g, utils.escape(err.toString())); + res.setHeader('Content-Type', 'text/html; charset=utf-8'); + res.end(html); + }); + }); + // json + } else if (~accept.indexOf('json')) { + var error = { message: err.message, stack: err.stack }; + for (var prop in err) error[prop] = err[prop]; + var json = JSON.stringify({ error: error }); + res.setHeader('Content-Type', 'application/json'); + res.end(json); + // plain text + } else { + res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' }); + res.end(err.stack); + } + }; +}; + +/** + * Template title, framework authors may override this value. + */ + +exports.title = 'Connect'; diff --git a/node_modules/connect/lib/middleware/favicon.js b/node_modules/connect/lib/middleware/favicon.js new file mode 100644 index 0000000..c57bf34 --- /dev/null +++ b/node_modules/connect/lib/middleware/favicon.js @@ -0,0 +1,81 @@ + +/*! + * Connect - favicon + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , utils = require('../utils'); + +/** + * Favicon: + * + * By default serves the connect favicon, or the favicon + * located by the given `path`. + * + * Options: + * + * - `maxAge` cache-control max-age directive, defaulting to 1 day + * + * Examples: + * + * Serve default favicon: + * + * connect() + * .use(connect.favicon()) + * + * Serve favicon before logging for brevity: + * + * connect() + * .use(connect.favicon()) + * .use(connect.logger('dev')) + * + * Serve custom favicon: + * + * connect() + * .use(connect.favicon('public/favicon.ico)) + * + * @param {String} path + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function favicon(path, options){ + var options = options || {} + , path = path || __dirname + '/../public/favicon.ico' + , maxAge = options.maxAge || 86400000 + , icon; // favicon cache + + return function favicon(req, res, next){ + if ('/favicon.ico' == req.url) { + if (icon) { + res.writeHead(200, icon.headers); + res.end(icon.body); + } else { + fs.readFile(path, function(err, buf){ + if (err) return next(err); + icon = { + headers: { + 'Content-Type': 'image/x-icon' + , 'Content-Length': buf.length + , 'ETag': '"' + utils.md5(buf) + '"' + , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) + }, + body: buf + }; + res.writeHead(200, icon.headers); + res.end(icon.body); + }); + } + } else { + next(); + } + }; +}; diff --git a/node_modules/connect/lib/middleware/json.js b/node_modules/connect/lib/middleware/json.js new file mode 100644 index 0000000..200006b --- /dev/null +++ b/node_modules/connect/lib/middleware/json.js @@ -0,0 +1,86 @@ + +/*! + * Connect - json + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , _limit = require('./limit'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * JSON: + * + * Parse JSON request bodies, providing the + * parsed object as `req.body`. + * + * Options: + * + * - `strict` when `false` anything `JSON.parse()` accepts will be parsed + * - `reviver` used as the second "reviver" argument for JSON.parse + * - `limit` byte limit disabled by default + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + var options = options || {} + , strict = options.strict !== false; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function json(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + + if (!utils.hasBody(req)) return next(); + + // check Content-Type + if ('application/json' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + var buf = ''; + req.setEncoding('utf8'); + req.on('data', function(chunk){ buf += chunk }); + req.on('end', function(){ + var first = buf.trim()[0]; + + if (0 == buf.length) { + return next(400, 'invalid json, empty body'); + } + + if (strict && '{' != first && '[' != first) return next(400, 'invalid json'); + try { + req.body = JSON.parse(buf, options.reviver); + next(); + } catch (err){ + err.body = buf; + err.status = 400; + next(err); + } + }); + }); + } +}; diff --git a/node_modules/connect/lib/middleware/limit.js b/node_modules/connect/lib/middleware/limit.js new file mode 100644 index 0000000..614787d --- /dev/null +++ b/node_modules/connect/lib/middleware/limit.js @@ -0,0 +1,55 @@ + +/*! + * Connect - limit + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils'); + +/** + * Limit: + * + * Limit request bodies to the given size in `bytes`. + * + * A string representation of the bytesize may also be passed, + * for example "5mb", "200kb", "1gb", etc. + * + * connect() + * .use(connect.limit('5.5mb')) + * .use(handleImageUpload) + * + * @param {Number|String} bytes + * @return {Function} + * @api public + */ + +module.exports = function limit(bytes){ + if ('string' == typeof bytes) bytes = utils.parseBytes(bytes); + if ('number' != typeof bytes) throw new Error('limit() bytes required'); + return function limit(req, res, next){ + var received = 0 + , len = req.headers['content-length'] + ? parseInt(req.headers['content-length'], 10) + : null; + + // self-awareness + if (req._limit) return next(); + req._limit = true; + + // limit by content-length + if (len && len > bytes) return next(413); + + // limit + req.on('data', function(chunk){ + received += chunk.length; + if (received > bytes) req.destroy(); + }); + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/logger.js b/node_modules/connect/lib/middleware/logger.js new file mode 100644 index 0000000..de72244 --- /dev/null +++ b/node_modules/connect/lib/middleware/logger.js @@ -0,0 +1,339 @@ +/*! + * Connect - logger + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var bytes = require('bytes'); + +/*! + * Log buffer. + */ + +var buf = []; + +/*! + * Default log buffer duration. + */ + +var defaultBufferDuration = 1000; + +/** + * Logger: + * + * Log requests with the given `options` or a `format` string. + * + * Options: + * + * - `format` Format string, see below for tokens + * - `stream` Output stream, defaults to _stdout_ + * - `buffer` Buffer duration, defaults to 1000ms when _true_ + * - `immediate` Write log line on request instead of response (for response times) + * + * Tokens: + * + * - `:req[header]` ex: `:req[Accept]` + * - `:res[header]` ex: `:res[Content-Length]` + * - `:http-version` + * - `:response-time` + * - `:remote-addr` + * - `:date` + * - `:method` + * - `:url` + * - `:referrer` + * - `:user-agent` + * - `:status` + * + * Formats: + * + * Pre-defined formats that ship with connect: + * + * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' + * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms' + * - `tiny` ':method :url :status :res[content-length] - :response-time ms' + * - `dev` concise output colored by response status for development use + * + * Examples: + * + * connect.logger() // default + * connect.logger('short') + * connect.logger('tiny') + * connect.logger({ immediate: true, format: 'dev' }) + * connect.logger(':method :url - :referrer') + * connect.logger(':req[content-type] -> :res[content-type]') + * connect.logger(function(tokens, req, res){ return 'some format string' }) + * + * Defining Tokens: + * + * To define a token, simply invoke `connect.logger.token()` with the + * name and a callback function. The value returned is then available + * as ":type" in this case. + * + * connect.logger.token('type', function(req, res){ return req.headers['content-type']; }) + * + * Defining Formats: + * + * All default formats are defined this way, however it's public API as well: + * + * connect.logger.format('name', 'string or function') + * + * @param {String|Function|Object} format or options + * @return {Function} + * @api public + */ + +exports = module.exports = function logger(options) { + if ('object' == typeof options) { + options = options || {}; + } else if (options) { + options = { format: options }; + } else { + options = {}; + } + + // output on request instead of response + var immediate = options.immediate; + + // format name + var fmt = exports[options.format] || options.format || exports.default; + + // compile format + if ('function' != typeof fmt) fmt = compile(fmt); + + // options + var stream = options.stream || process.stdout + , buffer = options.buffer; + + // buffering support + if (buffer) { + var realStream = stream + , interval = 'number' == typeof buffer + ? buffer + : defaultBufferDuration; + + // flush interval + setInterval(function(){ + if (buf.length) { + realStream.write(buf.join('')); + buf.length = 0; + } + }, interval); + + // swap the stream + stream = { + write: function(str){ + buf.push(str); + } + }; + } + + return function logger(req, res, next) { + req._startTime = new Date; + + // immediate + if (immediate) { + var line = fmt(exports, req, res); + if (null == line) return; + stream.write(line + '\n'); + // proxy end to output logging + } else { + var end = res.end; + res.end = function(chunk, encoding){ + res.end = end; + res.end(chunk, encoding); + var line = fmt(exports, req, res); + if (null == line) return; + stream.write(line + '\n'); + }; + } + + + next(); + }; +}; + +/** + * Compile `fmt` into a function. + * + * @param {String} fmt + * @return {Function} + * @api private + */ + +function compile(fmt) { + fmt = fmt.replace(/"/g, '\\"'); + var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ + return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; + }) + '";' + return new Function('tokens, req, res', js); +}; + +/** + * Define a token function with the given `name`, + * and callback `fn(req, res)`. + * + * @param {String} name + * @param {Function} fn + * @return {Object} exports for chaining + * @api public + */ + +exports.token = function(name, fn) { + exports[name] = fn; + return this; +}; + +/** + * Define a `fmt` with the given `name`. + * + * @param {String} name + * @param {String|Function} fmt + * @return {Object} exports for chaining + * @api public + */ + +exports.format = function(name, str){ + exports[name] = str; + return this; +}; + +/** + * Default format. + */ + +exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'); + +/** + * Short format. + */ + +exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'); + +/** + * Tiny format. + */ + +exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms'); + +/** + * dev (colored) + */ + +exports.format('dev', function(tokens, req, res){ + var status = res.statusCode + , len = parseInt(res.getHeader('Content-Length'), 10) + , color = 32; + + if (status >= 500) color = 31 + else if (status >= 400) color = 33 + else if (status >= 300) color = 36; + + len = isNaN(len) + ? '' + : len = ' - ' + bytes(len); + + return '\033[90m' + req.method + + ' ' + req.originalUrl + ' ' + + '\033[' + color + 'm' + res.statusCode + + ' \033[90m' + + (new Date - req._startTime) + + 'ms' + len + + '\033[0m'; +}); + +/** + * request url + */ + +exports.token('url', function(req){ + return req.originalUrl || req.url; +}); + +/** + * request method + */ + +exports.token('method', function(req){ + return req.method; +}); + +/** + * response time in milliseconds + */ + +exports.token('response-time', function(req){ + return new Date - req._startTime; +}); + +/** + * UTC date + */ + +exports.token('date', function(){ + return new Date().toUTCString(); +}); + +/** + * response status code + */ + +exports.token('status', function(req, res){ + return res.statusCode; +}); + +/** + * normalized referrer + */ + +exports.token('referrer', function(req){ + return req.headers['referer'] || req.headers['referrer']; +}); + +/** + * remote address + */ + +exports.token('remote-addr', function(req){ + if (req.ip) return req.ip; + var sock = req.socket; + if (sock.socket) return sock.socket.remoteAddress; + return sock.remoteAddress; +}); + +/** + * HTTP version + */ + +exports.token('http-version', function(req){ + return req.httpVersionMajor + '.' + req.httpVersionMinor; +}); + +/** + * UA string + */ + +exports.token('user-agent', function(req){ + return req.headers['user-agent']; +}); + +/** + * request header + */ + +exports.token('req', function(req, res, field){ + return req.headers[field.toLowerCase()]; +}); + +/** + * response header + */ + +exports.token('res', function(req, res, field){ + return (res._headers || {})[field.toLowerCase()]; +}); + diff --git a/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/connect/lib/middleware/methodOverride.js new file mode 100644 index 0000000..aaf4014 --- /dev/null +++ b/node_modules/connect/lib/middleware/methodOverride.js @@ -0,0 +1,40 @@ + +/*! + * Connect - methodOverride + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Method Override: + * + * Provides faux HTTP method support. + * + * Pass an optional `key` to use when checking for + * a method override, othewise defaults to _\_method_. + * The original method is available via `req.originalMethod`. + * + * @param {String} key + * @return {Function} + * @api public + */ + +module.exports = function methodOverride(key){ + key = key || "_method"; + return function methodOverride(req, res, next) { + req.originalMethod = req.originalMethod || req.method; + + // req.body + if (req.body && key in req.body) { + req.method = req.body[key].toUpperCase(); + delete req.body[key]; + // check X-HTTP-Method-Override + } else if (req.headers['x-http-method-override']) { + req.method = req.headers['x-http-method-override'].toUpperCase(); + } + + next(); + }; +}; + diff --git a/node_modules/connect/lib/middleware/multipart.js b/node_modules/connect/lib/middleware/multipart.js new file mode 100644 index 0000000..7b26fae --- /dev/null +++ b/node_modules/connect/lib/middleware/multipart.js @@ -0,0 +1,133 @@ +/*! + * Connect - multipart + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var formidable = require('formidable') + , _limit = require('./limit') + , utils = require('../utils') + , qs = require('qs'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * Multipart: + * + * Parse multipart/form-data request bodies, + * providing the parsed object as `req.body` + * and `req.files`. + * + * Configuration: + * + * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s + * `IncomingForm` object, allowing you to configure the upload directory, + * size limits, etc. For example if you wish to change the upload dir do the following. + * + * app.use(connect.multipart({ uploadDir: path })); + * + * Options: + * + * - `limit` byte limit defaulting to none + * - `defer` defers processing and exposes the Formidable form object as `req.form`. + * `next()` is called without waiting for the form's "end" event. + * This option is useful if you need to bind to the "progress" event, for example. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + options = options || {}; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function multipart(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + req.files = req.files || {}; + + if (!utils.hasBody(req)) return next(); + + // ignore GET + if ('GET' == req.method || 'HEAD' == req.method) return next(); + + // check Content-Type + if ('multipart/form-data' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + + var form = new formidable.IncomingForm + , data = {} + , files = {} + , done; + + Object.keys(options).forEach(function(key){ + form[key] = options[key]; + }); + + function ondata(name, val, data){ + if (Array.isArray(data[name])) { + data[name].push(val); + } else if (data[name]) { + data[name] = [data[name], val]; + } else { + data[name] = val; + } + } + + form.on('field', function(name, val){ + ondata(name, val, data); + }); + + form.on('file', function(name, val){ + ondata(name, val, files); + }); + + form.on('error', function(err){ + if (!options.defer) { + err.status = 400; + next(err); + } + done = true; + }); + + form.on('end', function(){ + if (done) return; + try { + req.body = qs.parse(data); + req.files = qs.parse(files); + if (!options.defer) next(); + } catch (err) { + form.emit('error', err); + } + }); + + form.parse(req); + + if (options.defer) { + req.form = form; + next(); + } + }); + } +}; diff --git a/node_modules/connect/lib/middleware/query.js b/node_modules/connect/lib/middleware/query.js new file mode 100644 index 0000000..93fc5d3 --- /dev/null +++ b/node_modules/connect/lib/middleware/query.js @@ -0,0 +1,46 @@ +/*! + * Connect - query + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var qs = require('qs') + , parse = require('../utils').parseUrl; + +/** + * Query: + * + * Automatically parse the query-string when available, + * populating the `req.query` object. + * + * Examples: + * + * connect() + * .use(connect.query()) + * .use(function(req, res){ + * res.end(JSON.stringify(req.query)); + * }); + * + * The `options` passed are provided to qs.parse function. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function query(options){ + return function query(req, res, next){ + if (!req.query) { + req.query = ~req.url.indexOf('?') + ? qs.parse(parse(req).query, options) + : {}; + } + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/responseTime.js b/node_modules/connect/lib/middleware/responseTime.js new file mode 100644 index 0000000..62abc04 --- /dev/null +++ b/node_modules/connect/lib/middleware/responseTime.js @@ -0,0 +1,32 @@ + +/*! + * Connect - responseTime + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Reponse time: + * + * Adds the `X-Response-Time` header displaying the response + * duration in milliseconds. + * + * @return {Function} + * @api public + */ + +module.exports = function responseTime(){ + return function(req, res, next){ + var start = new Date; + + if (res._responseTime) return next(); + res._responseTime = true; + + res.on('header', function(){ + var duration = new Date - start; + res.setHeader('X-Response-Time', duration + 'ms'); + }); + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/session.js b/node_modules/connect/lib/middleware/session.js new file mode 100644 index 0000000..f97b8d6 --- /dev/null +++ b/node_modules/connect/lib/middleware/session.js @@ -0,0 +1,352 @@ + +/*! + * Connect - session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Session = require('./session/session') + , debug = require('debug')('connect:session') + , MemoryStore = require('./session/memory') + , signature = require('cookie-signature') + , Cookie = require('./session/cookie') + , Store = require('./session/store') + , utils = require('./../utils') + , parse = utils.parseUrl + , crc32 = require('buffer-crc32'); + +// environment + +var env = process.env.NODE_ENV; + +/** + * Expose the middleware. + */ + +exports = module.exports = session; + +/** + * Expose constructors. + */ + +exports.Store = Store; +exports.Cookie = Cookie; +exports.Session = Session; +exports.MemoryStore = MemoryStore; + +/** + * Warning message for `MemoryStore` usage in production. + */ + +var warning = 'Warning: connection.session() MemoryStore is not\n' + + 'designed for a production environment, as it will leak\n' + + 'memory, and will not scale past a single process.'; + +/** + * Session: + * + * Setup session store with the given `options`. + * + * Session data is _not_ saved in the cookie itself, however + * cookies are used, so we must use the [cookieParser()](cookieParser.html) + * middleware _before_ `session()`. + * + * Examples: + * + * connect() + * .use(connect.cookieParser()) + * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }})) + * + * Options: + * + * - `key` cookie name defaulting to `connect.sid` + * - `store` session store instance + * - `secret` session cookie is signed with this secret to prevent tampering + * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` + * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") + * + * Cookie option: + * + * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set + * so the cookie becomes a browser-session cookie. When the user closes the + * browser the cookie (and session) will be removed. + * + * ## req.session + * + * To store or access session data, simply use the request property `req.session`, + * which is (generally) serialized as JSON by the store, so nested objects + * are typically fine. For example below is a user-specific view counter: + * + * connect() + * .use(connect.favicon()) + * .use(connect.cookieParser()) + * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) + * .use(function(req, res, next){ + * var sess = req.session; + * if (sess.views) { + * res.setHeader('Content-Type', 'text/html'); + * res.write('

    views: ' + sess.views + '

    '); + * res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); + * res.end(); + * sess.views++; + * } else { + * sess.views = 1; + * res.end('welcome to the session demo. refresh!'); + * } + * } + * )).listen(3000); + * + * ## Session#regenerate() + * + * To regenerate the session simply invoke the method, once complete + * a new SID and `Session` instance will be initialized at `req.session`. + * + * req.session.regenerate(function(err){ + * // will have a new session here + * }); + * + * ## Session#destroy() + * + * Destroys the session, removing `req.session`, will be re-generated next request. + * + * req.session.destroy(function(err){ + * // cannot access session here + * }); + * + * ## Session#reload() + * + * Reloads the session data. + * + * req.session.reload(function(err){ + * // session updated + * }); + * + * ## Session#save() + * + * Save the session. + * + * req.session.save(function(err){ + * // session saved + * }); + * + * ## Session#touch() + * + * Updates the `.maxAge` property. Typically this is + * not necessary to call, as the session middleware does this for you. + * + * ## Session#cookie + * + * Each session has a unique cookie object accompany it. This allows + * you to alter the session cookie per visitor. For example we can + * set `req.session.cookie.expires` to `false` to enable the cookie + * to remain for only the duration of the user-agent. + * + * ## Session#maxAge + * + * Alternatively `req.session.cookie.maxAge` will return the time + * remaining in milliseconds, which we may also re-assign a new value + * to adjust the `.expires` property appropriately. The following + * are essentially equivalent + * + * var hour = 3600000; + * req.session.cookie.expires = new Date(Date.now() + hour); + * req.session.cookie.maxAge = hour; + * + * For example when `maxAge` is set to `60000` (one minute), and 30 seconds + * has elapsed it will return `30000` until the current request has completed, + * at which time `req.session.touch()` is called to reset `req.session.maxAge` + * to its original value. + * + * req.session.cookie.maxAge; + * // => 30000 + * + * Session Store Implementation: + * + * Every session store _must_ implement the following methods + * + * - `.get(sid, callback)` + * - `.set(sid, session, callback)` + * - `.destroy(sid, callback)` + * + * Recommended methods include, but are not limited to: + * + * - `.length(callback)` + * - `.clear(callback)` + * + * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +function session(options){ + var options = options || {} + , key = options.key || 'connect.sid' + , store = options.store || new MemoryStore + , cookie = options.cookie || {} + , trustProxy = options.proxy + , storeReady = true; + + // notify user that this store is not + // meant for a production environment + if ('production' == env && store instanceof MemoryStore) { + console.warn(warning); + } + + // generates the new session + store.generate = function(req){ + req.sessionID = utils.uid(24); + req.session = new Session(req); + req.session.cookie = new Cookie(cookie); + }; + + store.on('disconnect', function(){ storeReady = false; }); + store.on('connect', function(){ storeReady = true; }); + + return function session(req, res, next) { + // self-awareness + if (req.session) return next(); + + // Handle connection as if there is no session if + // the store has temporarily disconnected etc + if (!storeReady) return debug('store is disconnected'), next(); + + // pathname mismatch + if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next(); + + // backwards compatibility for signed cookies + // req.secret is passed from the cookie parser middleware + var secret = options.secret || req.secret; + + // ensure secret is available or bail + if (!secret) throw new Error('`secret` option required for sessions'); + + // parse url + var originalHash + , originalId; + + // expose store + req.sessionStore = store; + + // grab the session cookie value and check the signature + var rawCookie = req.cookies[key]; + + // get signedCookies for backwards compat with signed cookies + var unsignedCookie = req.signedCookies[key]; + + if (!unsignedCookie && rawCookie) { + unsignedCookie = utils.parseSignedCookie(rawCookie, secret); + } + + // set-cookie + res.on('header', function(){ + if (!req.session) return; + var cookie = req.session.cookie + , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() + , tls = req.connection.encrypted || (trustProxy && 'https' == proto) + , secured = cookie.secure && tls + , isNew = unsignedCookie != req.sessionID; + + // only send secure cookies via https + if (cookie.secure && !secured) return debug('not secured'); + + // browser-session length cookie + if (null == cookie.expires) { + if (!isNew) return debug('already set browser-session cookie'); + // compare hashes and ids + } else if (originalHash == hash(req.session) && originalId == req.session.id) { + return debug('unmodified session'); + } + + var val = 's:' + signature.sign(req.sessionID, secret); + val = cookie.serialize(key, val); + debug('set-cookie %s', val); + res.setHeader('Set-Cookie', val); + }); + + // proxy end() to commit the session + var end = res.end; + res.end = function(data, encoding){ + res.end = end; + if (!req.session) return res.end(data, encoding); + debug('saving'); + req.session.resetMaxAge(); + req.session.save(function(){ + debug('saved'); + res.end(data, encoding); + }); + }; + + // generate the session + function generate() { + store.generate(req); + } + + // get the sessionID from the cookie + req.sessionID = unsignedCookie; + + // generate a session if the browser doesn't send a sessionID + if (!req.sessionID) { + debug('no SID sent, generating session'); + generate(); + next(); + return; + } + + // generate the session object + var pause = utils.pause(req); + debug('fetching %s', req.sessionID); + store.get(req.sessionID, function(err, sess){ + // proxy to resume() events + var _next = next; + next = function(err){ + _next(err); + pause.resume(); + }; + + // error handling + if (err) { + debug('error'); + if ('ENOENT' == err.code) { + generate(); + next(); + } else { + next(err); + } + // no session + } else if (!sess) { + debug('no session found'); + generate(); + next(); + // populate req.session + } else { + debug('session found'); + store.createSession(req, sess); + originalId = req.sessionID; + originalHash = hash(sess); + next(); + } + }); + }; +}; + +/** + * Hash the given `sess` object omitting changes + * to `.cookie`. + * + * @param {Object} sess + * @return {String} + * @api private + */ + +function hash(sess) { + return crc32.signed(JSON.stringify(sess, function(key, val){ + if ('cookie' != key) return val; + })); +} diff --git a/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/connect/lib/middleware/session/cookie.js new file mode 100644 index 0000000..e8ff862 --- /dev/null +++ b/node_modules/connect/lib/middleware/session/cookie.js @@ -0,0 +1,128 @@ + +/*! + * Connect - session - Cookie + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../../utils') + , cookie = require('cookie'); + +/** + * Initialize a new `Cookie` with the given `options`. + * + * @param {IncomingMessage} req + * @param {Object} options + * @api private + */ + +var Cookie = module.exports = function Cookie(options) { + this.path = '/'; + this.maxAge = null; + this.httpOnly = true; + if (options) utils.merge(this, options); + this.originalMaxAge = undefined == this.originalMaxAge + ? this.maxAge + : this.originalMaxAge; +}; + +/*! + * Prototype. + */ + +Cookie.prototype = { + + /** + * Set expires `date`. + * + * @param {Date} date + * @api public + */ + + set expires(date) { + this._expires = date; + this.originalMaxAge = this.maxAge; + }, + + /** + * Get expires `date`. + * + * @return {Date} + * @api public + */ + + get expires() { + return this._expires; + }, + + /** + * Set expires via max-age in `ms`. + * + * @param {Number} ms + * @api public + */ + + set maxAge(ms) { + this.expires = 'number' == typeof ms + ? new Date(Date.now() + ms) + : ms; + }, + + /** + * Get expires max-age in `ms`. + * + * @return {Number} + * @api public + */ + + get maxAge() { + return this.expires instanceof Date + ? this.expires.valueOf() - Date.now() + : this.expires; + }, + + /** + * Return cookie data object. + * + * @return {Object} + * @api private + */ + + get data() { + return { + originalMaxAge: this.originalMaxAge + , expires: this._expires + , secure: this.secure + , httpOnly: this.httpOnly + , domain: this.domain + , path: this.path + } + }, + + /** + * Return a serialized cookie string. + * + * @return {String} + * @api public + */ + + serialize: function(name, val){ + return cookie.serialize(name, val, this.data); + }, + + /** + * Return JSON representation of this cookie. + * + * @return {Object} + * @api private + */ + + toJSON: function(){ + return this.data; + } +}; diff --git a/node_modules/connect/lib/middleware/session/memory.js b/node_modules/connect/lib/middleware/session/memory.js new file mode 100644 index 0000000..fb93939 --- /dev/null +++ b/node_modules/connect/lib/middleware/session/memory.js @@ -0,0 +1,129 @@ + +/*! + * Connect - session - MemoryStore + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Store = require('./store'); + +/** + * Initialize a new `MemoryStore`. + * + * @api public + */ + +var MemoryStore = module.exports = function MemoryStore() { + this.sessions = {}; +}; + +/** + * Inherit from `Store.prototype`. + */ + +MemoryStore.prototype.__proto__ = Store.prototype; + +/** + * Attempt to fetch session by the given `sid`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.get = function(sid, fn){ + var self = this; + process.nextTick(function(){ + var expires + , sess = self.sessions[sid]; + if (sess) { + sess = JSON.parse(sess); + expires = 'string' == typeof sess.cookie.expires + ? new Date(sess.cookie.expires) + : sess.cookie.expires; + if (!expires || new Date < expires) { + fn(null, sess); + } else { + self.destroy(sid, fn); + } + } else { + fn(); + } + }); +}; + +/** + * Commit the given `sess` object associated with the given `sid`. + * + * @param {String} sid + * @param {Session} sess + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.set = function(sid, sess, fn){ + var self = this; + process.nextTick(function(){ + self.sessions[sid] = JSON.stringify(sess); + fn && fn(); + }); +}; + +/** + * Destroy the session associated with the given `sid`. + * + * @param {String} sid + * @api public + */ + +MemoryStore.prototype.destroy = function(sid, fn){ + var self = this; + process.nextTick(function(){ + delete self.sessions[sid]; + fn && fn(); + }); +}; + +/** + * Invoke the given callback `fn` with all active sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.all = function(fn){ + var arr = [] + , keys = Object.keys(this.sessions); + for (var i = 0, len = keys.length; i < len; ++i) { + arr.push(this.sessions[keys[i]]); + } + fn(null, arr); +}; + +/** + * Clear all sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.clear = function(fn){ + this.sessions = {}; + fn && fn(); +}; + +/** + * Fetch number of sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.length = function(fn){ + fn(null, Object.keys(this.sessions).length); +}; diff --git a/node_modules/connect/lib/middleware/session/session.js b/node_modules/connect/lib/middleware/session/session.js new file mode 100644 index 0000000..0dd4b40 --- /dev/null +++ b/node_modules/connect/lib/middleware/session/session.js @@ -0,0 +1,116 @@ + +/*! + * Connect - session - Session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../../utils'); + +/** + * Create a new `Session` with the given request and `data`. + * + * @param {IncomingRequest} req + * @param {Object} data + * @api private + */ + +var Session = module.exports = function Session(req, data) { + Object.defineProperty(this, 'req', { value: req }); + Object.defineProperty(this, 'id', { value: req.sessionID }); + if ('object' == typeof data) utils.merge(this, data); +}; + +/** + * Update reset `.cookie.maxAge` to prevent + * the cookie from expiring when the + * session is still active. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.touch = function(){ + return this.resetMaxAge(); +}; + +/** + * Reset `.maxAge` to `.originalMaxAge`. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.resetMaxAge = function(){ + this.cookie.maxAge = this.cookie.originalMaxAge; + return this; +}; + +/** + * Save the session data with optional callback `fn(err)`. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.save = function(fn){ + this.req.sessionStore.set(this.id, this, fn || function(){}); + return this; +}; + +/** + * Re-loads the session data _without_ altering + * the maxAge properties. Invokes the callback `fn(err)`, + * after which time if no exception has occurred the + * `req.session` property will be a new `Session` object, + * although representing the same session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.reload = function(fn){ + var req = this.req + , store = this.req.sessionStore; + store.get(this.id, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(new Error('failed to load session')); + store.createSession(req, sess); + fn(); + }); + return this; +}; + +/** + * Destroy `this` session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.destroy = function(fn){ + delete this.req.session; + this.req.sessionStore.destroy(this.id, fn); + return this; +}; + +/** + * Regenerate this request's session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.regenerate = function(fn){ + this.req.sessionStore.regenerate(this.req, fn); + return this; +}; diff --git a/node_modules/connect/lib/middleware/session/store.js b/node_modules/connect/lib/middleware/session/store.js new file mode 100644 index 0000000..54294cb --- /dev/null +++ b/node_modules/connect/lib/middleware/session/store.js @@ -0,0 +1,84 @@ + +/*! + * Connect - session - Store + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , Session = require('./session') + , Cookie = require('./cookie'); + +/** + * Initialize abstract `Store`. + * + * @api private + */ + +var Store = module.exports = function Store(options){}; + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Store.prototype.__proto__ = EventEmitter.prototype; + +/** + * Re-generate the given requests's session. + * + * @param {IncomingRequest} req + * @return {Function} fn + * @api public + */ + +Store.prototype.regenerate = function(req, fn){ + var self = this; + this.destroy(req.sessionID, function(err){ + self.generate(req); + fn(err); + }); +}; + +/** + * Load a `Session` instance via the given `sid` + * and invoke the callback `fn(err, sess)`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +Store.prototype.load = function(sid, fn){ + var self = this; + this.get(sid, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(); + var req = { sessionID: sid, sessionStore: self }; + sess = self.createSession(req, sess); + fn(null, sess); + }); +}; + +/** + * Create session from JSON `sess` data. + * + * @param {IncomingRequest} req + * @param {Object} sess + * @return {Session} + * @api private + */ + +Store.prototype.createSession = function(req, sess){ + var expires = sess.cookie.expires + , orig = sess.cookie.originalMaxAge; + sess.cookie = new Cookie(sess.cookie); + if ('string' == typeof expires) sess.cookie.expires = new Date(expires); + sess.cookie.originalMaxAge = orig; + req.session = new Session(req, sess); + return req.session; +}; diff --git a/node_modules/connect/lib/middleware/static.js b/node_modules/connect/lib/middleware/static.js new file mode 100644 index 0000000..bb29d07 --- /dev/null +++ b/node_modules/connect/lib/middleware/static.js @@ -0,0 +1,94 @@ + +/*! + * Connect - static + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var send = require('send') + , utils = require('../utils') + , parse = utils.parseUrl + , url = require('url'); + +/** + * Static: + * + * Static file server with the given `root` path. + * + * Examples: + * + * var oneDay = 86400000; + * + * connect() + * .use(connect.static(__dirname + '/public')) + * + * connect() + * .use(connect.static(__dirname + '/public', { maxAge: oneDay })) + * + * Options: + * + * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0 + * - `hidden` Allow transfer of hidden files. defaults to false + * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true + * + * @param {String} root + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function static(root, options){ + options = options || {}; + + // root required + if (!root) throw new Error('static() root path required'); + + // default redirect + var redirect = false !== options.redirect; + + return function static(req, res, next) { + if ('GET' != req.method && 'HEAD' != req.method) return next(); + var path = parse(req).pathname; + var pause = utils.pause(req); + + function resume() { + next(); + pause.resume(); + } + + function directory() { + if (!redirect) return resume(); + var pathname = url.parse(req.originalUrl).pathname; + res.statusCode = 301; + res.setHeader('Location', pathname + '/'); + res.end('Redirecting to ' + utils.escape(pathname) + '/'); + } + + function error(err) { + if (404 == err.status) return resume(); + next(err); + } + + send(req, path) + .maxage(options.maxAge || 0) + .root(root) + .hidden(options.hidden) + .on('error', error) + .on('directory', directory) + .pipe(res); + }; +}; + +/** + * Expose mime module. + * + * If you wish to extend the mime table use this + * reference to the "mime" module in the npm registry. + */ + +exports.mime = send.mime; diff --git a/node_modules/connect/lib/middleware/staticCache.js b/node_modules/connect/lib/middleware/staticCache.js new file mode 100644 index 0000000..7354a8f --- /dev/null +++ b/node_modules/connect/lib/middleware/staticCache.js @@ -0,0 +1,231 @@ + +/*! + * Connect - staticCache + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , Cache = require('../cache') + , fresh = require('fresh'); + +/** + * Static cache: + * + * Enables a memory cache layer on top of + * the `static()` middleware, serving popular + * static files. + * + * By default a maximum of 128 objects are + * held in cache, with a max of 256k each, + * totalling ~32mb. + * + * A Least-Recently-Used (LRU) cache algo + * is implemented through the `Cache` object, + * simply rotating cache objects as they are + * hit. This means that increasingly popular + * objects maintain their positions while + * others get shoved out of the stack and + * garbage collected. + * + * Benchmarks: + * + * static(): 2700 rps + * node-static: 5300 rps + * static() + staticCache(): 7500 rps + * + * Options: + * + * - `maxObjects` max cache objects [128] + * - `maxLength` max cache object length 256kb + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function staticCache(options){ + var options = options || {} + , cache = new Cache(options.maxObjects || 128) + , maxlen = options.maxLength || 1024 * 256; + + console.warn('connect.staticCache() is deprecated and will be removed in 3.0'); + console.warn('use varnish or similar reverse proxy caches.'); + + return function staticCache(req, res, next){ + var key = cacheKey(req) + , ranges = req.headers.range + , hasCookies = req.headers.cookie + , hit = cache.get(key); + + // cache static + // TODO: change from staticCache() -> cache() + // and make this work for any request + req.on('static', function(stream){ + var headers = res._headers + , cc = utils.parseCacheControl(headers['cache-control'] || '') + , contentLength = headers['content-length'] + , hit; + + // dont cache set-cookie responses + if (headers['set-cookie']) return hasCookies = true; + + // dont cache when cookies are present + if (hasCookies) return; + + // ignore larger files + if (!contentLength || contentLength > maxlen) return; + + // don't cache partial files + if (headers['content-range']) return; + + // dont cache items we shouldn't be + // TODO: real support for must-revalidate / no-cache + if ( cc['no-cache'] + || cc['no-store'] + || cc['private'] + || cc['must-revalidate']) return; + + // if already in cache then validate + if (hit = cache.get(key)){ + if (headers.etag == hit[0].etag) { + hit[0].date = new Date; + return; + } else { + cache.remove(key); + } + } + + // validation notifiactions don't contain a steam + if (null == stream) return; + + // add the cache object + var arr = []; + + // store the chunks + stream.on('data', function(chunk){ + arr.push(chunk); + }); + + // flag it as complete + stream.on('end', function(){ + var cacheEntry = cache.add(key); + delete headers['x-cache']; // Clean up (TODO: others) + cacheEntry.push(200); + cacheEntry.push(headers); + cacheEntry.push.apply(cacheEntry, arr); + }); + }); + + if (req.method == 'GET' || req.method == 'HEAD') { + if (ranges) { + next(); + } else if (!hasCookies && hit && !mustRevalidate(req, hit)) { + res.setHeader('X-Cache', 'HIT'); + respondFromCache(req, res, hit); + } else { + res.setHeader('X-Cache', 'MISS'); + next(); + } + } else { + next(); + } + } +}; + +/** + * Respond with the provided cached value. + * TODO: Assume 200 code, that's iffy. + * + * @param {Object} req + * @param {Object} res + * @param {Object} cacheEntry + * @return {String} + * @api private + */ + +function respondFromCache(req, res, cacheEntry) { + var status = cacheEntry[0] + , headers = utils.merge({}, cacheEntry[1]) + , content = cacheEntry.slice(2); + + headers.age = (new Date - new Date(headers.date)) / 1000 || 0; + + switch (req.method) { + case 'HEAD': + res.writeHead(status, headers); + res.end(); + break; + case 'GET': + if (utils.conditionalGET(req) && fresh(req.headers, headers)) { + headers['content-length'] = 0; + res.writeHead(304, headers); + res.end(); + } else { + res.writeHead(status, headers); + + function write() { + while (content.length) { + if (false === res.write(content.shift())) { + res.once('drain', write); + return; + } + } + res.end(); + } + + write(); + } + break; + default: + // This should never happen. + res.writeHead(500, ''); + res.end(); + } +} + +/** + * Determine whether or not a cached value must be revalidated. + * + * @param {Object} req + * @param {Object} cacheEntry + * @return {String} + * @api private + */ + +function mustRevalidate(req, cacheEntry) { + var cacheHeaders = cacheEntry[1] + , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '') + , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '') + , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0; + + if ( cacheCC['no-cache'] + || cacheCC['must-revalidate'] + || cacheCC['proxy-revalidate']) return true; + + if (reqCC['no-cache']) return true; + + if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge; + + if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge; + + return false; +} + +/** + * The key to use in the cache. For now, this is the URL path and query. + * + * 'http://example.com/?key=value' -> '/?key=value' + * + * @param {Object} req + * @return {String} + * @api private + */ + +function cacheKey(req) { + return utils.parseUrl(req).path; +} diff --git a/node_modules/connect/lib/middleware/timeout.js b/node_modules/connect/lib/middleware/timeout.js new file mode 100644 index 0000000..a6dc087 --- /dev/null +++ b/node_modules/connect/lib/middleware/timeout.js @@ -0,0 +1,56 @@ + +/*! + * Connect - timeout + * Ported from https://github.com/LearnBoost/connect-timeout + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var debug = require('debug')('connect:timeout'); + +/** + * Timeout: + * + * Times out the request in `ms`, defaulting to `5000`. The + * method `req.clearTimeout()` is added to revert this behaviour + * programmatically within your application's middleware, routes, etc. + * + * The timeout error is passed to `next()` so that you may customize + * the response behaviour. This error has the `.timeout` property as + * well as `.status == 408`. + * + * @param {Number} ms + * @return {Function} + * @api public + */ + +module.exports = function timeout(ms) { + ms = ms || 5000; + + return function(req, res, next) { + var id = setTimeout(function(){ + req.emit('timeout', ms); + }, ms); + + req.on('timeout', function(){ + if (req.headerSent) return debug('response started, cannot timeout'); + var err = new Error('Response timeout'); + err.timeout = ms; + err.status = 503; + next(err); + }); + + req.clearTimeout = function(){ + clearTimeout(id); + }; + + res.on('header', function(){ + clearTimeout(id); + }); + + next(); + }; +}; diff --git a/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/connect/lib/middleware/urlencoded.js new file mode 100644 index 0000000..cceafc0 --- /dev/null +++ b/node_modules/connect/lib/middleware/urlencoded.js @@ -0,0 +1,78 @@ + +/*! + * Connect - urlencoded + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , _limit = require('./limit') + , qs = require('qs'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * Urlencoded: + * + * Parse x-ww-form-urlencoded request bodies, + * providing the parsed object as `req.body`. + * + * Options: + * + * - `limit` byte limit disabled by default + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + options = options || {}; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function urlencoded(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + + if (!utils.hasBody(req)) return next(); + + // check Content-Type + if ('application/x-www-form-urlencoded' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + var buf = ''; + req.setEncoding('utf8'); + req.on('data', function(chunk){ buf += chunk }); + req.on('end', function(){ + try { + req.body = buf.length + ? qs.parse(buf, options) + : {}; + next(); + } catch (err){ + err.body = buf; + next(err); + } + }); + }); + } +}; diff --git a/node_modules/connect/lib/middleware/vhost.js b/node_modules/connect/lib/middleware/vhost.js new file mode 100644 index 0000000..897a9d8 --- /dev/null +++ b/node_modules/connect/lib/middleware/vhost.js @@ -0,0 +1,40 @@ + +/*! + * Connect - vhost + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Vhost: + * + * Setup vhost for the given `hostname` and `server`. + * + * connect() + * .use(connect.vhost('foo.com', fooApp)) + * .use(connect.vhost('bar.com', barApp)) + * .use(connect.vhost('*.com', mainApp)) + * + * The `server` may be a Connect server or + * a regular Node `http.Server`. + * + * @param {String} hostname + * @param {Server} server + * @return {Function} + * @api public + */ + +module.exports = function vhost(hostname, server){ + if (!hostname) throw new Error('vhost hostname required'); + if (!server) throw new Error('vhost server required'); + var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i'); + if (server.onvhost) server.onvhost(hostname); + return function vhost(req, res, next){ + if (!req.headers.host) return next(); + var host = req.headers.host.split(':')[0]; + if (!regexp.test(host)) return next(); + if ('function' == typeof server) return server(req, res, next); + server.emit('request', req, res); + }; +}; diff --git a/node_modules/connect/lib/patch.js b/node_modules/connect/lib/patch.js new file mode 100644 index 0000000..7cf0012 --- /dev/null +++ b/node_modules/connect/lib/patch.js @@ -0,0 +1,79 @@ + +/*! + * Connect + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , res = http.ServerResponse.prototype + , setHeader = res.setHeader + , _renderHeaders = res._renderHeaders + , writeHead = res.writeHead; + +// apply only once + +if (!res._hasConnectPatch) { + + /** + * Provide a public "header sent" flag + * until node does. + * + * @return {Boolean} + * @api public + */ + + res.__defineGetter__('headerSent', function(){ + return this._header; + }); + + /** + * Set header `field` to `val`, special-casing + * the `Set-Cookie` field for multiple support. + * + * @param {String} field + * @param {String} val + * @api public + */ + + res.setHeader = function(field, val){ + var key = field.toLowerCase() + , prev; + + // special-case Set-Cookie + if (this._headers && 'set-cookie' == key) { + if (prev = this.getHeader(field)) { + val = Array.isArray(prev) + ? prev.concat(val) + : [prev, val]; + } + // charset + } else if ('content-type' == key && this.charset) { + val += '; charset=' + this.charset; + } + + return setHeader.call(this, field, val); + }; + + /** + * Proxy to emit "header" event. + */ + + res._renderHeaders = function(){ + if (!this._emittedHeader) this.emit('header'); + this._emittedHeader = true; + return _renderHeaders.call(this); + }; + + res.writeHead = function(){ + if (!this._emittedHeader) this.emit('header'); + this._emittedHeader = true; + return writeHead.apply(this, arguments); + }; + + res._hasConnectPatch = true; +} diff --git a/node_modules/connect/lib/proto.js b/node_modules/connect/lib/proto.js new file mode 100644 index 0000000..889c237 --- /dev/null +++ b/node_modules/connect/lib/proto.js @@ -0,0 +1,239 @@ + +/*! + * Connect - HTTPServer + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , utils = require('./utils') + , debug = require('debug')('connect:dispatcher'); + +// prototype + +var app = module.exports = {}; + +// environment + +var env = process.env.NODE_ENV || 'development'; + +/** + * Utilize the given middleware `handle` to the given `route`, + * defaulting to _/_. This "route" is the mount-point for the + * middleware, when given a value other than _/_ the middleware + * is only effective when that segment is present in the request's + * pathname. + * + * For example if we were to mount a function at _/admin_, it would + * be invoked on _/admin_, and _/admin/settings_, however it would + * not be invoked for _/_, or _/posts_. + * + * Examples: + * + * var app = connect(); + * app.use(connect.favicon()); + * app.use(connect.logger()); + * app.use(connect.static(__dirname + '/public')); + * + * If we wanted to prefix static files with _/public_, we could + * "mount" the `static()` middleware: + * + * app.use('/public', connect.static(__dirname + '/public')); + * + * This api is chainable, so the following is valid: + * + * connect() + * .use(connect.favicon()) + * .use(connect.logger()) + * .use(connect.static(__dirname + '/public')) + * .listen(3000); + * + * @param {String|Function|Server} route, callback or server + * @param {Function|Server} callback or server + * @return {Server} for chaining + * @api public + */ + +app.use = function(route, fn){ + // default route to '/' + if ('string' != typeof route) { + fn = route; + route = '/'; + } + + // wrap sub-apps + if ('function' == typeof fn.handle) { + var server = fn; + fn.route = route; + fn = function(req, res, next){ + server.handle(req, res, next); + }; + } + + // wrap vanilla http.Servers + if (fn instanceof http.Server) { + fn = fn.listeners('request')[0]; + } + + // strip trailing slash + if ('/' == route[route.length - 1]) { + route = route.slice(0, -1); + } + + // add the middleware + debug('use %s %s', route || '/', fn.name || 'anonymous'); + this.stack.push({ route: route, handle: fn }); + + return this; +}; + +/** + * Handle server requests, punting them down + * the middleware stack. + * + * @api private + */ + +app.handle = function(req, res, out) { + var stack = this.stack + , fqdn = ~req.url.indexOf('://') + , removed = '' + , slashAdded = false + , index = 0; + + function next(err, msg) { + var layer, path, status, c; + + if (slashAdded) { + req.url = req.url.substr(1); + slashAdded = false; + } + + req.url = removed + req.url; + req.originalUrl = req.originalUrl || req.url; + removed = ''; + + // next(status, msg) support + if (typeof err === 'number') { + var status = err; + var name = http.STATUS_CODES[status]; + err = new Error(msg || name); + err.name = name; + err.status = status; + } + + // next callback + layer = stack[index++]; + + // all done + if (!layer || res.headerSent) { + // delegate to parent + if (out) return out(err); + + // unhandled error + if (err) { + // default to 500 + if (res.statusCode < 400) res.statusCode = 500; + debug('default %s', res.statusCode); + + // respect err.status + if (err.status) res.statusCode = err.status; + + // production gets a basic error message + var msg = 'production' == env + ? http.STATUS_CODES[res.statusCode] + : err.stack || err.toString(); + + // log to stderr in a non-test env + if ('test' != env) console.error(err.stack || err.toString()); + if (res.headerSent) return req.socket.destroy(); + res.setHeader('Content-Type', 'text/plain'); + res.setHeader('Content-Length', Buffer.byteLength(msg)); + if ('HEAD' == req.method) return res.end(); + res.end(msg); + } else { + debug('default 404'); + res.statusCode = 404; + res.setHeader('Content-Type', 'text/plain'); + if ('HEAD' == req.method) return res.end(); + res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl)); + } + return; + } + + try { + path = utils.parseUrl(req).pathname; + if (undefined == path) path = '/'; + + // skip this layer if the route doesn't match. + if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); + + c = path[layer.route.length]; + if (c && '/' != c && '.' != c) return next(err); + + // Call the layer handler + // Trim off the part of the url that matches the route + removed = layer.route; + req.url = req.url.substr(removed.length); + + // Ensure leading slash + if (!fqdn && '/' != req.url[0]) { + req.url = '/' + req.url; + slashAdded = true; + } + + debug('%s', layer.handle.name || 'anonymous'); + var arity = layer.handle.length; + if (err) { + if (arity === 4) { + layer.handle(err, req, res, next); + } else { + next(err); + } + } else if (arity < 4) { + layer.handle(req, res, next); + } else { + next(); + } + } catch (e) { + next(e); + } + } + next(); +}; + +/** + * Listen for connections. + * + * This method takes the same arguments + * as node's `http.Server#listen()`. + * + * HTTP and HTTPS: + * + * If you run your application both as HTTP + * and HTTPS you may wrap them individually, + * since your Connect "server" is really just + * a JavaScript `Function`. + * + * var connect = require('connect') + * , http = require('http') + * , https = require('https'); + * + * var app = connect(); + * + * http.createServer(app).listen(80); + * https.createServer(options, app).listen(443); + * + * @return {http.Server} + * @api public + */ + +app.listen = function(){ + var server = http.createServer(this); + return server.listen.apply(server, arguments); +}; diff --git a/node_modules/connect/lib/public/directory.html b/node_modules/connect/lib/public/directory.html new file mode 100644 index 0000000..2d63704 --- /dev/null +++ b/node_modules/connect/lib/public/directory.html @@ -0,0 +1,81 @@ + + + + + listing directory {directory} + + + + + +
    +

    {linked-path}

    + {files} +
    + + \ No newline at end of file diff --git a/node_modules/connect/lib/public/error.html b/node_modules/connect/lib/public/error.html new file mode 100644 index 0000000..a6d3faf --- /dev/null +++ b/node_modules/connect/lib/public/error.html @@ -0,0 +1,14 @@ + + + + {error} + + + +
    +

    {title}

    +

    {statusCode} {error}

    +
      {stack}
    +
    + + diff --git a/node_modules/connect/lib/public/favicon.ico b/node_modules/connect/lib/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..895fc96a76b68b4924f1c51d022e1b82fa0f461f GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&}i&OouUjIY8@C}uZw4x5z5N2 zvEG^C^vXtt_xtJ?p3O32c(KTx;lsgZhW%5M85Sf}k-mf`L80)|7ga~M{a znlL=>m1Q`#uoPkbC~GtXMnhnDh5$DU1D6mx+;2QAKt3ZQFH}H~1y~00GcqzVg9QXw z_<%(a7y$V|wJgF=E>MgE#Aid|14}IyCM5MhEnxFF;pTzOK(>#80puP=gnOXwAd33` mpMe2}f66m3eB@_fcnmb^7!b1nO#opK8zcsj1F30)+jEP);68^d)m`eN0o>(5%D`Q(1;j>g@G;xlf`0VBQ`PFY?6)!N&f?*K}$p; zB!U=NBn{eB8${1}&-2_L*HuZp@ZP1@clS@cHp)4iM1ewzw59vko7eMM{e9z|%NNdX z0V;`?KKSzTCvTm5bc{L^CIKLUxc2X{i{ISz$8Sgf{q)1nXTP{`{s?9mQ$4&hPiKC- zY8q7(Y1Xu5iCf33=O4Vy(+|zQ?rW#gkKB0f%}?+6{G*qT22|DQB-73`YzA{N4W^=s zq0kQYcbtFfz zLz)H<&|z(Y4kBG67=JY6c|L1R-#TR>fC$3^Y%QEnYO1xHsf)+GU`3F<{J0kR(;pbF3)zyg$H+idfnl-wl5Wkh!vUH z4Z32YP=l_}1rZd1W_D&^$A($A+&a0e&P?xx0!ctY2}*<#p+qPVN*B(YzvAWXa*%bzq z7Fz41LKILT(GWohi9|LgIzSZBhb*Zf6R6O}WYQ4GOi&71s9lmll0x6;8&ILOl$j(c z0Z1T(6Tg09{?wd{moFHNN6PS?$|e>1MxSJ(0Z7o2)J-Zv|>acY@f`(Y@g7GwsEj5NLQo+q|HsxQ5}XSX_d@*^A9ZT9=A{W~j+$GyI1 zc4oqTHx@1FlRjw4XWyPN5i2~l_F3@aBk!0yu^aoRDvXy}8@HCjUVQUsuSH4$T5|r< zzZOn^?Wfa6y|Q($Hx4{ws+)wX6-HP4zo!S?4KJ@7PG@G3G{CjXs(p*kIrj6rHs7_y z+=<-=Q62s9FuWa^X~WKgJIAAZJR&XBB002ovPDHLkV1jCMPILeO literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/connect/lib/public/icons/page_attach.png new file mode 100644 index 0000000000000000000000000000000000000000..89ee2da0753040d1ba0a3487473a715a8fe89322 GIT binary patch literal 794 zcmV+#1LgdQP)i_t#ewV_0K6;=bl;e_Jt7$~$sQ)q$+ia<4Ec+jeaGt9oWH@O|2`W6&O0t!k{B9sUvLWxkCaPsd9W(`fa z;j-|^ZI^2XnzhgZWYRW-kP&J>DWPo`%;JaBX}or79k=+Jo@h%4Eo72tqev+cB?PjP zO<|ByL#>Tehyq$jR74O$B9WDW1`tK`LzYyL3A9iAcRxLkJ`I)n}v%Od-3H>j$OTBtk>(k-9o?8PqI=0 zB&f-+KOXVnjyKJlf4iHOtnuiE_4+ZVJ$dHjU<^o^YCjQ-wt^!;rPpBv(@pFO{9rdw98 z_s@3+yta93oyfL>7AD5}r=|`zS3Gm$_|(iSl8XBd9k%=91J0j2=ivT5cJ18ZmDjh{ z$-RMd{jQ#X79#Sc literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_code.png b/node_modules/connect/lib/public/icons/page_code.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ea90419d950f9e69d977a1f5847456d96a5f0b GIT binary patch literal 818 zcmV-21I_%2P)@LCln44|RX7Ti z0HI3&7jPq){odH{?_{%nYVq_;n_c4WbUpvU(&Cvnj!vq|kVC-vpF6vp^;;e0mm6HW z+WPzA`AZ|;pPp$&dNjzrc??4rt`k%Q1l*u-BPD0MQ}Fbm8jnsyezNt7+u{23>t7Em zJtETY?ja9KrVs^!LJ$xEMF3-bAZO;-IQJavE60KA7fO$VY_%N)R6s>g5mW>fL4&aR z*EVgKKTBXm!=L?S0?xM zYqL@C$|EDF2q*3zWW7;PDZ}SK*IE8;i!3U62=qn80C&*I1Le7WwNP5EcX;_oh2dJn zf#HgBe4@r$GcjHjmj2vAfT%(YN?}kK=(*+1*DkNNc1H5R++vfBMhACi<5uFUU+N4+ z<&U*CPmWi}REa7C6-t>2im1CWv5Jkefxa6>)dEj-CAW wWa{_}BJ!}~75?MkfaCnj>Dn=~vkLS70Pk`;z)@TQj{pDw07*qoM6N<$f@imYHUIzs literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/connect/lib/public/icons/page_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..195dc6d6c365d298e466026b37c1959d96119ea7 GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6Z z(>-WZK@^7J_sq=QY_e{46@P+~LNG}sRzZsxQHvCsN*h5ir6^j7pq-$xu$N#V1gx}9 zClV7;5)7zih-s3DB)G=7|99>ji@So7-P24n=VQ(@GctDX!^_@$bj%oviY6e4Dh;od zooe%Wvs8LEKQ&&bL&@bwi=STIAI@!-gB2jC5+?y?VR~VkrNxam-`6*8&po|RZ5LpS zNKdJ%c4bTX`XjKsnecf%W>1%6WT?pKNdLLq{=(f(Col?P1+oq@R>)W(n=x!|*BIIh z6DJGw_w`)u6yN|vAhMteYK5#b%r5^v+VCFl1IGssaclZZMS{vs-LJ2$)n7DAr6==K z<29#%AXsBsDoO}SBaXR#_Ap!JKx)(1)3O2pj0_dYWz5By*X74fRT01$Fk%P_RzOMDtV?GU{nsYq#K8iy zb6qzLYDj`_f5$BwC*WE(t0m#xYJ*=jC2|HQYHh=pf#QG7oowi`h!L!{DB$8|qY{~X zu8@sU1tWq;n$XThR0%;45mdqXM892|{CJ@0DS*}>?ami06Q_^tvM~Y3K(_-`#m!8f z8f!QIrH4y#61;0Ym0cCoLl8{IPombPHtnn7%SbTdI&G-d>ZQo!_wBMF9nzX!g8HVY xYTJPGciz9XMh3w2fmZ(7v{)r*QZD48?mrio{~IaoqP z|1Ep}yDQG09bP~E^Dk?@JiKQJ z6-pO(3~IOP)IYisL6D6;oAEd;E%zR}{U$rMRNuD6nQV7nesKS>)yLo7JuDCrD>Abi zbj3uW23?^GA}9jQ{M^8v?ejL?HaT7AX5WPZNkBmfN`w-jL?{tT7ykZt$%Yln?p_m~ z-?>&d(LD(jAd}h=LPltPQbO$*Wbyl@G-_k5jXbb#qffHY03>M1jfEqoPJQ6Mr=Byp=^jfzePZV1 zLjCmNi31hdIJHa%e;5g=1(`u3BRzfeExY%=VCu{loOr{`%2hUR*x>tL^W_TTaj);0 zpPR6CUD1+0>4TQ6zVfH3TQ;%l6#(_%yspK@3gcmG#Q4!WCPyLU93nMKk7E2pcA=l45({2jNho>sdF*A~bA zxX?-cp~y_z_kFf+yqu3m#QiB}03?Z&9vvR5TNgj<)($Vm)xq5G>|o2sFMag&6aNF+ WAT1?sQBYt20000iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_error.png b/node_modules/connect/lib/public/icons/page_error.png new file mode 100644 index 0000000000000000000000000000000000000000..f07f449a44ff2761bfc7b752db3d08d0e1238b02 GIT binary patch literal 793 zcmV+!1LpjRP)lHwhvrAu0-@MQwt}+5~MQTtu}C0%;W( z1<{R?aHBz*g;pk%AyQVBR_Zu5m~;ES_vxI-O!vIF|H*|T{l`n#garr?$RMk>)?Y48 z(ZF2yTneKb};DNWF+jK)IF`6_IfJ{i|F3o%Q+l&4_HGBD|ACE8na_6>L z=s{^>-C(a7J$6=8A_%h5W!1K6dcL!D?XX+Ndk)oei?UundDpX_E&1Y&`)3P8#Ny0s z2Ag7_&ZPhyGj%)g&S6V2LNun1;iBQm#Fwlfv zgyESZR$X}2P;=RW!2zid1r$hBL{K7>2qi*f7>pT1=RdT3@-anEoH{ z={KFOO;Dh#bV*jaN>}M>RZqQd`S=6O9C3KpI~I>l%QFYfo;jqQYe5fcn`)+)zMm6P z4X&L(>gnN0!%J4^rhX->?$S5bY<=GEU%jc!KLL8sww-Eg;h z`H-yBHa)yfojYT}&G*GFc$<(Yja_q=lZvj66DC^O5%$B)|Z(CeD=n`|eM04SP; z>-=-l+xdJjA~vR6^xB#o{ehf~tSM`iwaQv$O<8NIHA}W_WOw*~ XD^gE}t;YAo00000NkvXXu0mjfl6ZQ> literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/connect/lib/public/icons/page_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9 GIT binary patch literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_find.png b/node_modules/connect/lib/public/icons/page_find.png new file mode 100644 index 0000000000000000000000000000000000000000..2f193889f7ea091c292acdd684c595dcb206b5c4 GIT binary patch literal 879 zcmV-#1CacQP)@+1&aazfGU7ezSm^v zpACwO+tu0su66!(dT=`e05DeeCnCFJW(8|RKtKa{4LGONnx2V85A4m%PEQ?MEtR-esdM$pB-`H542D0)N2zSC6Imf)4L8?>%ZrW+H>xCKi$unm zvGZq-*Q%Aahx;C*=l+K%-?>XB)6TB$-L$r*`RUvlA`xP1NG2?)ge8@TQ4EN|Jks0u zcDg;oFC#-#R`YbWB`D?Q`1#y7l$LXhjSLf8AvQuB84}i#j0^!#g{VE#(K7h@5pFHy zSenl=@XBEdxp`h2Ji>CR%=qXJ7!e|?paKet-~;#ok#jETyeB(5&Bkhp;!+;51~G=) zH?L7xmDUu_h+a$+xuWom;AWW!mS$%%+436Rjc@}y?l1134kgD0AOf$OmjOR zstUlshZk$ZC!bAyIg{Y29z#&@3SJ;6D4+_eFume9^#TmMccC5u0J!ZCTnO6m$lnD| z5JeFHf`Xs~1vP>RLKI1GKDY<~pjr2&bi(fX;6Nj-ss@Ds0CcoO0H{JsEQkm{q03skAA);_bv3q{k31qwVo&s-q`Z?_e+j^w(WL? zl+uETs5+~xBU2};OqEE9ETLGwsMGe1%iTRNue)9}|0~E4B*@5#oRXZ9oRXZ9TqRep zPrGZuoOON4n@=uPbyP1y4G=+HktC6l(gZoFD>@_lXDrN?wo+zozGt3P=Qh+3L7+}q z2!WK7geXLnO3Vw;o12Skp%_E#+N#9;DDWP?Q-VS3B$v~Ha)dDzWn0zG~O(^_1!n0HYp-( z+;wPIdoFgQlpYV!10V>5@a)1LyGBMvoa}miyp(bxbMTM-FYNyx;V@TfYddyT00000 LNkvXXu0mjf90!wr literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_go.png b/node_modules/connect/lib/public/icons/page_go.png new file mode 100644 index 0000000000000000000000000000000000000000..80fe1ed0cc75fbb67e9398ae686641f8fb287238 GIT binary patch literal 779 zcmV+m1N8ifP)JNR2Ufr z!Apo%Wf%b9=l#x^8AolrB&K9H?Pg_|78WA8(M3toqE%3B#7*srcF`i*xhupr27%Nr ziguah1+mN)U5GNmyEfQ3-e%_i&-vb-Co#(>FJ+EhQEwjRYVQ(&UYy{U@%vbY||>@4x=B^vIqabI?L* z;-S&DS^V3-ni4^fl|HMkOEbgX)(390>A}|VIypb5Xee4g;7ck zwKh^A3Mi1Mh@eC$5lV!}Fw%sP623U`g3pd_Hr5sunLvTskx4}&Gm%Q6L}(l4x}jCe z*81q1_4-O*ffi~_nMslo?EQ8t*&Ec(pzEw$vc}pKn_Qp0>D7Jr>ATNC3w@9f|Y+U&+)#!t7l&wKp+nP{PQsb+fb=Yf!Fu&5j8vpRj{FT>jD z>d>$sx;A&+`n$HcF}&sYKSyR;=(=9tvvOj@hUG;~4qTYk^_@E=?$*^_pVh_bGnOt~ z;pEw)j{SK$XVc;qy181rT655gW9NG{(yeablViIL>cDI_ux8m>Pp{tY$J0lgo4#ax za?j0EA3s0S!f>{~ykN9h_RhM&g3K(E`q(dE(Rd49+%xMeR9{qlWnmd{s#(SQ>PmFtSQqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_key.png b/node_modules/connect/lib/public/icons/page_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d6626cb09eb11a298b90a8a27b0d8eab41f49a82 GIT binary patch literal 801 zcmV++1K#|JP)$lC4gU2-`f*>nhR-;k6IP7e>YO!0^w)WK%3$w02v-#>5Ep64PCP| zJihT#O|N+nT7XR2h7dAB?UEAOhJF^mol1i`QtQB`HSY}RE7=r! z)zaVIHr5?>v2Gz&fdYw&2ug$!p+txby(aWZ7(4QT)l2`jX7eMQ{>)lG6ev(fWKxmH zOr%mM5$6B%u~qGtCf40#`mbGj3s!n+^%wnJ&#rl>g<4Z)lB5J6f!?|AP275)Zswr* z%T}4~{;_(?waU!#?JabbF3Cy-kf0{R{z}6$e=5yMQKt3BPcl2>zoTPMqMwF;3!_n|>sT?~bK_-2O_m+o>GJ6h zt=+g$4n7y%1qVJI7*5Yw(hqM=JusY{d}*?U(Oj*gT655eZ>Ksn(qrd7v3}DX1}C>` z+X+8@+4-pVq_fxG zlU}~Ye!0+%>J+pPk+0wV{GM$QaYM?5ux)w2z59=S&H2+K?;gH$bZGzL&g5>G ft+noNiyiPkP9r@8gT|RZ00000NkvXXu0mjfuqTIu literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/connect/lib/public/icons/page_lightning.png new file mode 100644 index 0000000000000000000000000000000000000000..7e568703d6432c530224e443771a04fc1e2e59c6 GIT binary patch literal 839 zcmV-N1GxN&P)73{`^;G#xwAtHz%LU)4b zqTRU=ve1RNa3QT=ZM7C`iJ~QFQ*9t7<~pX$d^7W%^M8FFCkcQj-~0ZRTBCB(J0^iD z-~e!d9LR`f3#|=(>$bPvx_D-~2jC%pJ=n_e_OK zeJ_2b-KdDDh@@UlzBSMC;EPygH_MwjWBnPGQegihBV73D?-x9PlHL9A=(Vg=8^d<4 z<9r=UkxuIm)*CO=9e###7PztDxUv}e?$0)rQicmYhV`pQ%S!g@;K(?TVfhM#E?bM| z=B0gfb6h@a8bf5FVT-SV~6}?X}9lK@@Yynoty&1zdZP@?RfODsl=2XzzU% zS8gIN43How+9%bK2S@Xbc`O>`z5`%^;pXGy8^4f>9^3!Sp@|O&)m;dOa3q6d;4P-l zca|=H_{G&m?D_+&-}r{u-J$5T=(X4R&)q|O^gN8cgv;s#@5sEPT5_Z)oFo9Ac>l+I zc4ng5zHpps|9)<_Rw>5bKzE(M1j)dFWI_%OH$BJSz0?T+02W0)_a>#vFqb!*d|5wB zzBUN|M&ty51O@=i?kiDrjQ{{}e|^rU?OS|RdxxP1p5mAw36cX72#`R6UsoeCQFI~! z0ATITp!vfeYyQ?Dr=^5BAshfEa0nB~JG?nUa2Aur006MC*<9`)86SPS(W^`H2n+xi ztOWohsFfVfVWrI7PSKW}BmkyPoj(-|J?ES|BGd-}fIxr{00@ANnO*ZR`#)pee4I5T Rmm>fG002ovPDHLkV1i|Hc$okI literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_link.png b/node_modules/connect/lib/public/icons/page_link.png new file mode 100644 index 0000000000000000000000000000000000000000..312eab0914ab59271384686255d1be913a6b3add GIT binary patch literal 830 zcmV-E1Ht@>P)VWgGzD=Y79#JI$lhEn`|2MpRa?Bt#-nSD~P0P(mbVe{KrOBoKnSsk>m|ML{6l zBosu@om4j#WzNLRAk+{k1JRvL(MfE&vvbb->v>W{*z*1_uMP}0cIRX*?mz+wk%*#O z%0D-+$B*g1nRkvI+_3E8Pr1NC6@5M&4vWaLCnNlr;lNlr4i91z&)eBGqL{L{GNu;Fof}GS9{gM5BJuH;2QWk8yuOZdB3pGR#s8bd~ zAmt<>3Q=YH$t5YJ5;7@+8Uh6=ktBgY6#6Pa%2F?h910?U8cLT43KAj$Z1*==ra&gILO{WkHfs(--F=bly9l~${z@AT>V$oat!YAD@M zBE0v_F{`g#^wOSP-u~!wvlmXdd*uqFqoZ0^{&nEMDU+=!>({S0wrQhFmoB}Yq1)~0 z^{A)L8Xjzdr(W4_exYO6u3a{4*kIeXZMJUR>Q=ksjW_p!rAwDKYUs90>6Q|C>56o@ zbrSq^Xk7Gq#>dAsn@un`Hz$?w$;Ss`%jV7L%9ShgHFV~C)6M>B`Tp%|nqPc&G*A3| z)Qe+}vT4-x^t1~XE@(6wR;^lPWMo9n*~E!cy~)YRsT2{`?fqeIw-e7N@mOA%UcCIq z_kH(_EK7|>pM*1Wt2^DaDAp|cvp*@(ZZDKpYkKC^?97(`0sb&XTXy7N#sB~S07*qo IM6N<$f;YmCWB>pF literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/connect/lib/public/icons/page_paintbrush.png new file mode 100644 index 0000000000000000000000000000000000000000..246a2f0b426faa0c7f5ba009e32b1deaf88d1288 GIT binary patch literal 813 zcmV+|1JeA7P)otxGRZMDZ!_a~nK|b_-`n%VosaL{KDuPV10`(1LIen8kX2Xff$3BE zah#djvFGJ&eE^89Pk*-O^+&d>FC~^GjRYVQ(uuPJyS|-v?9lxA-+tM5>1Qu*n+Ir1 z6KhA>X4$XDH6?-|E5oe1E?pQ5-M;2xw_ex!x}I2+b=}mPFW$U%^;o(Zg*LP!K^1kP%8ynsD^= z1y^6xD1#GLjO{VLdh@0GKY7;d$+NGukV)GRLPn^=q=dF%B#XaJrNP`0E6=}e&Gj3d zKJbQre*WXt!60_DnIzgMQc6S#fvjXxsE1v7;T;njHkdy2miIqAS(nX~o%cO+q+b#h z5tIleLWvL=dQE8OC#{%y*Tnku&K`Tuub&_ELI0t_ea{@3f>Jv&sYqld(%}3_GY3Dm z;O{3*Y?v^A`a|D;^qrM=ykI)U6QHd%WhO~VF!SGjGn0GOZrc3mGZudNl9{Q#X5&-F zuGwVReFLBjE5jr!!^-5*L%!I%PkYH#Hs5rMrEBl^)9)9XTD;xjHFxVZMc3~Dw6#k$ z(-S}RE$bgMHv6Z`mS5|u$$78sp4G-8b@lVkl`HtEv+MGn!F&bKcHPi$$oP_;=BrPf z$(~b3&p3CsuQxhoV$%jIR;`lB-s7FDX)xCTXuJ7ZyIQk96uIR=HBt%-P?N*bp`)EF zq14c}QM+O70NTOa@V~_)&GMZ$^cQDlkyOCa(H3Mf+6xhCuZh`VSN{cQBl5Ys9{cp( rh`2H3A^=GuC6HjQ*7|*0>;m{7QlnX3z3MSD00000NkvXXu0mjfR5FYo literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/connect/lib/public/icons/page_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..968f073fdddc1cc0f0800b1ac4001cd9a55f053d GIT binary patch literal 703 zcmV;w0zmzVP)AVs!l4K}n~L(tL`6d4Up4iSWnZ3Qg~4n+_J zDGk-qQdogO5JUtO-d5pRp7Nd7_r1^a|M&Zq%mn9Oe((|e0sw%Ur!K7T1pojj=U#f? zQM`qbQrM^DPkwa?DK_be^~z<~RgSMIa<`xP_4P7gg2jCwJ{9^k!fsU=#Ti|%I3p;>90Qd+7|~0h&mIklA#nb>ATL2+v$&u)OBgB z;nsHb)I&QRKeX40H~~cIZxCd}5C} z=79lXoXK%6YlyLtsV$~bSm?Upq|DJh#{|*a7XMm`4QJWZ>s6nL2R1|&J z0VPEwJ9?!n`o5PKAjc->P1Gi8BY*%!5&FVp=#)$mMJYul1Jton}gujiUf??eOy!x&!tsjxy;=Q3_DdcXx=a^OBhW0N~`A@4xB0a*%F? l+@c^sQA%W+?pa#c`9H5UNfS6T{e=Jk002ovPDHLkV1grvM=byV literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_red.png b/node_modules/connect/lib/public/icons/page_red.png new file mode 100644 index 0000000000000000000000000000000000000000..0b18247da5850f3c2486373a3e179acd2772e8aa GIT binary patch literal 641 zcmV-{0)G98P);68^@7JE5sw#jpE*579S@TLkU(6yap1yN*Zuy>-hV%Q_v4Ar&!63c8OBr(ZRhFu z_kWs36-AmgZCT>x!RqM;Zu9tqvoHI~k@UmYo_g(*J3c%2{N8}7I+|qKPQzv}7t>%W zsu&9G)UmCzkDYSw{fBnuW4j;1fKV_nicw`$8C6D=F_qu`zUiK$2Oc?5UVY+D(`I@R zW`KlwqLftWHH3Z2_XVNfKn>VgT~k=@- z+N>c>0|@A_HbI9Jn`v0~7cfIF(TS69zaomDS1QtgvaBBfGEPLHccO2~3jc>n^6}^HAEh-2#VxC7YYcDXv!L9X= z-R*SOUvIs;n`8(LxP4~^2|JsiN^hq6cU}5dn4v1~Kl{eT7pm&f$PoY`hyVe%y8G*S bxB&kH@RuR86sIAS00000NkvXXu0mjfZBi!% literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/connect/lib/public/icons/page_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..cf347c7d4685128a4a447abb9fb8e939417644f4 GIT binary patch literal 858 zcmV-g1Eu_lP)`6pHR2Ufr z!EI=jWf;Km|8+n2IrHqe<9xxFVk)&(Nh?w$Xk`TAyvb=#e=0aySC z00NkRDM597_LiNIJ2M^qhuTvB004REvvU8@of{r?P8tmo3;+Pk0F0@*jAMhdOkS&1 zhJPPfQa;pP0|4+Yk%#j>X}o-s#EF1_DMV93FsfPP`G*>Ks>L&)Q}w2g%slu0kBfW1 z+*$*0BC^oTl6>OGIq(9BgG4|C90Dk-N_mPazGrQ7uHZ|>BLD!-KmZ)z1e^#?1Sf(M z!6m}K(^b|i%$TcA5bC}r$tAA?0C)g1@CgWliJ;NAk&ZF+-w#}$`-3nZ32C6IVKrHp zr+(!L2hRfF&AsTw>_@ z1y23;E%Oz}?q^Q2d($ayO;-sON2t7$w(Z|o0Pw1YnSp^}0PI+I5HnDNsFCA?oorkG z5sUIGIq=FSyxcj+xlhkm0en=52Bx3@02o12gdAU$_i?v6iyFMuc7P9#zQ-Hf; zVuV$t9P5`m)F2w1?t6{<8%wk{w-PP#Sj#%1MbsjrSI6n;D_@8q9`~W98dNQf$j=iI z6~hpgww&be%X_HI50Hhx@W==u4TLPB;ei-J-1}G8wH}|{i#Lk-WZAyfv}k4y0|fvU zZTy^$u6L>2nWo(NDSV2@MRD}JQ4(c%G%=dG@_vxH?>gcH#*Ue2HC}9sapf8X?R$Z;XEnm&g zW99mh)5jNw008mK8)r^`_{yH0rNn%u1|SpC(tjf#om=+r#lh+?Kb>DVb9`|C0Bvbv zN3U(>f4-tAC1hosRoA7p(b(hL*V}(j>ug<`&U)|l$6o$)!>PBQ9RQSwn9asj2p*|xhU*R^vq?*Twb0t!lm5}`yW5lRy-U0ZYK?8to!;o!r!XeOE$ z0HB3T+6EEoI4PlR=wonwqJ+TvCoWh&$?CAPVYcU= zD{DS0?AkOtb@-hh^ZLq~FMjxYf19X?pa_YqtgZGvv2TaxcF#KT?O%=_*a-kW_;N|D zakkWsOe!)HsT5WRBiC+p;N-c>0Qwy(1D2MDBC595oXSiR07)sKNk-%9*rDBOO^HUD zZW#;)R&EZpqha<(HK$(tZYU#V29<@0qCXgU{gXeGpc_|pTqQD-WO|}%yKZbeX7k*H z2W~CK$v8NBAq~czrc5A(v51g0Wma7`G8}f=ZcuAiYYxZan@gP(;Ku66M6?bquGiHe z3Q0ya)%Lvk@kLixZfZyU@#UFbv+>pYhcj8TRKSr_sWG8i^X~UA**LvbD3(_Lba3xm ziYcpup*A9qJ$?AA=Og05lndxfwr`!C+O~h|B~4 z01q8H`StcY);%&mId7_+)76ovRpeNWRp&4M?#jx@|E-)x%P*A6t^fc407*qoM6N<$ Ef@ddc(f|Me literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white.png b/node_modules/connect/lib/public/icons/page_white.png new file mode 100644 index 0000000000000000000000000000000000000000..8b8b1ca0000bc8fa8d0379926736029f8fabe364 GIT binary patch literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/connect/lib/public/icons/page_white_acrobat.png new file mode 100644 index 0000000000000000000000000000000000000000..8f8095e46fa4965700afe1f9d065d8a37b101676 GIT binary patch literal 591 zcmV-V0~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/connect/lib/public/icons/page_white_actionscript.png new file mode 100644 index 0000000000000000000000000000000000000000..159b24075191fc259cfd80c797a1b0d74c168422 GIT binary patch literal 664 zcmV;J0%!e+P)7Z7t2}reCh0o`+ zAlt$F2tW%oO@m<=(B8a-_VgLl#~yUMUDWG!0qFPppd^03e+x1WpkO1NhIaKD2A)-@ z=Py8(Wi%R%JtYZG#sTKH@6Z+&!S3Edf8jFJJNKuva#KJQD3X^7;H^fd2di znEN&c58aUG>`>P{Vqq$kLb+TP{?I!d4(|o59X_%|nVEZq2Rk60n7072SWJ{64CV?3 zgS!EB=eYxwQ>P2&$}(iT6UMvuFgHHIEdNA29!EBtg=v~X!DxxEH~}L2zn|52%xalaq@DTdhh{EVwv0IaQ=!?daer zTKp4I`l8SDt;d{8Q`5Ko;BXUi&oAG1l4}59P-{|^S(Rmord5s6qsh<&m@Ab^wqCD) zHyRD}lKLDzpYN&@q5&*47mGzGiqcXpmqR9#K|CH8kXS4RNs`(iEF%HjP%f8ItyaZK z6$%Apvsok(2>~dTO5jTZfq;N?0ch4l01f$k9?4{~Youl-#x{UDMr#AFIkz@SDwPtQ z$gQ^$2|*(Ps9LQiav_8o8Ne<=Zx1*M*syo80sEO1tB%>5 zfdHB`1z+!R@?ghPRKmL)hWEvZE$=*54ose*0JiUNTM_)cMDXhxEKg(?-pD=y<)L4J zT0dSyD0&NhJ$^_8Ko9uom%-ZM4BTM{Tw$9qyPj=-9W;N(Wi@3*-Q4pq`Gcp}^vvNr zyd&PsmG>fpCSZz?K}UIEd;HGgG%0MG>ymxKPwy{>wy(m*Atq7)0000~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU7Lxm88-p zDk^c;sHj}OKUc4lGZU}6umlGVNAJx0%sKDOFwQx|V2pVvxhYKe|L9TNk!~md3BVrm zYPDL8Hk*yU-ER3~LGwJ7N`0ZV&nOhBI{~~A;@ND*=kxg?#^W&`4u`zk?Mg_e)8XlK z`T#M+OaR1!<#Nf_>$S`xrqd}OjYhoJ>q)?3vEX8pY&I()ERjfjrXM$k7e+-Qs3Ihj zNyOuEQ2EGYG7ro!o6VOBQEwuV2z)*tR8>WxP{616FY)p1Pn1d}#9}cxolZC$4n(6- z35hJq0;FlHC{ zp*iF(lgUK(E`($(s9pJ8Kn?(M734H_63WHtf}6SQQ_MXEP!#0|&@>J8dL5TfG&tBw z#tYn{TCGZvAr>cca%YYn^!t73tg8OOJ2FvJ(`YpCyVZi*?Ur+1uUA$hAg8-aK)c;e zQ<)!XwHh|n&ND=$@^)>aF-`~n}#*WMkD*M|f8r$i*z7+W! qF|A!t*4fE(R`<_YIkN&?Jng?3oQ|aAqClPi0000t>5xmo{nArfL4CJwMMm+N`pQ3p^Le$?rMud6Rbxz!-yG7bz2z$^USP5(;udf(gfQ zG~f68y^)EvcNWp#bUoDt2=h+^%o-?-|mo~iieWqLNP<0m@2PTB7ftyb= z@H`K$>v9Pr5X`L|rw&CEN2(9SB7A2SE;d|j9@*F}sd(@*2l|P*fWfK>1drZUrtUA7 zNXO~pKn1cjf~~TLbje1g>EPPzN2GH#UIBxJ{}S9=E`{zs-w#hO?vcH+hJxroI5v?j zD!4lP0WXq8zUx3RAP@|Gq$}6wXCjFLZY^YSWBxN9#&g)ro$%5}aYn#y=tJ_aIT%4d z5d4u`rlp!};XGmbZkJE*kYJoi&N0pd*yxY{0${xD;;Q1h^8f$<07*qoM6N<$f(}t7 Ae*gdg literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/connect/lib/public/icons/page_white_code.png new file mode 100644 index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615 GIT binary patch literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/connect/lib/public/icons/page_white_code_red.png new file mode 100644 index 0000000000000000000000000000000000000000..87a69145075afd8f8fd8b391c5da1249ec8b2889 GIT binary patch literal 587 zcmV-R0<`^!P)LWh{^|hy<@Q*xw+qo|KpY<+vaXbbW{L4q( zTsjXEJvb}e%bgb=o%W0h?4u1;^bWTqH8}5Th002ovPDHLkV1nrS0P+9; literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/connect/lib/public/icons/page_white_coldfusion.png new file mode 100644 index 0000000000000000000000000000000000000000..c66011fb0fbdcbf210483d676b7131542a0e282b GIT binary patch literal 592 zcmV-W0k7R5;6x zlV4BMP#DI+Z{WQcKZBTk0lfkj5F$ztWhP#lcuyb@0@rA^#Kpu5KLA&Rgc}o#aSmis zrZC__xY^&#cI&!!{c|4Q_tcec*#b>|Y15wPcY2=o3;-Bl=(t4;6Ok*pL)-{*A;GX^ zS(@WGp6j~k1wBVR9)BB_gar`}HyRBXh7nM!)u5^>N~MyN6bc0-5{W?44iB<`2biXb zR;wk?jIQg@G!5l)SqhrXCU}x$GU-dY1sra}0uCq@153FUULT=jNwSk}0WBjKz}Jdu z<5gB*<^XtpAmp3m^ZEXQZWd1krhft}CoYaF4cSMvTJ01}X3X37KYdx-D0$c{doUe8 ztY{vlGr-e*;N!WAV%_hgUawyYrhegW>^F)pv%uUTFslHn; zvJ)l{%w(~{!O4`KTmK{Q{zCYltLfs&4?nz|6IdlqHCvX;|HGv~!QW?8P~_d#e0$v$ z)5XHEz{3>qMiH`1+qNYf?huS+@L`J9_$cjJF)Hf?@pu;)`9}BXwGUM{2!{y-4|Z{L zG>z?O%Cp8P5T#j1DID7u_*(Jg?7iss8AZQ+&;u_J{FmILf((9eoiL5nGUe>Fgq*U$z0000 zJ3A|*qoWOonz+4ZQ0KNhDB07SX1?#FrNy8%K)_l}y&kh`*KYdy`Y99&tgNgMLSSrc z?B?+B@HO@P-jS~z2Rgc6yy~Y~%>oJpBxsb$5<&nRLqiuR7K=@0SZj~jTs|sv_jWVX zGe?WflejOaq|Vec=s9+ahmXbyJ|T)Sl*?s82sr2H?Ce~HD5WI+Sz&tmWrN()wI2}+ zKqg92t*l^-#ae~;9%KFlWkmwnY=-UK`_|%ICZ#P1gdjK<2n38VXsuC7{WiU!fZFmm zW~Sda9(Qi@pxO}$ARY+;t##Ao27usOqNt7Hwq6K7G1il@xitj=LIM&{N&#SuX;x4x zmG6FhCg-$PI;hQ=;1iZ>F>^~@)IPi;l}fX?SZ!QiO=X<|pSVkNpJuLHzW(FT_~W-v z?vFpkyE>8ee4d=7wKauH5~dd_M7d2Aa=ICC{Nj7Blqv&DQEP#j_VeWV&WXL>c=LLK zsmYg^_JiDb;%U!UxO%qjFAvsDFj-kzT2$GbV(ZopPM$i$z`!7jvEk07BcC=6FMt4` z*0u3Sy`0b~%#(0000K literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/connect/lib/public/icons/page_white_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f31a278e17993d8d4e13beac2f9d5f7b42d08f GIT binary patch literal 309 zcmV-50m}Y~P)sF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?u_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000zE0Ay_3@1Z_7#f-XWL#E{8Al7>L$ z0Rx7lnddoqAyfT%&#`$;v0@*5YdW3w z7mLNoa=FAshK% zDiy@zakyMAxr-H?iQDZi^!t5;Eno2A=?>mMx`Vg(Z!?<53LHLvfTPa`$mjDcX*Qdv zR;ylN4OH+m)fVX&Z#yZpUae;ss@a$K&})gHovkhr@w#xyPVlfVgXti1_357y%I-UHDvRWYvPEX+#g+j4Q9ayba zh7uQN1j%HQgA=Fp9DfODAU^*3*FCs^6IpO7xg`RUXyP)(;=d!ly=#I^l3e0Cub`{H Z`5PU3+D2e&<<>s`J(VpX#y^kqzQ;#=2x({YMw9Q&ndHT&`BD$#%Ql?{+)-OuSA`r}MWJ zVg+2Gc(GW}a=BERPNy^;kEz$|38dTYlFQ{%5S!g@|8f8D_!Nu9_Ni2glF1}xG8xi! zorc39&F6EPOeWOt_XS`W2H_Bo$MXugy}SEctJQj=(TLXTHL(jRXfzs>NF=0SHk;94 zF!&HjdZNX(3U3;LY64IMX__Xv%_wjLC!J2`0Jw?X=zPK$C$`&dYPDKaC={e16bcE@ zgun^<0k;ak*=xLE)@(Lqu~MmsFoMCLY&0Qog`NO(h@kyxaA%EbwJLy8sU*Vi`~52K zX0wrqW;_LmMq@evX4iAM9Od(Q0eHP$1%L|xAh@vrqB`HPQLon}f3aAka=9!3hr=O- z5F9`#J_7Jhah=U(4RjaRhkS4Xkk98kDz-`i!r|~~AQ1TFcDw(@<8g{aBE)l)PNxNE zI(RPyc>9e{@WGSMU%i7*v{!&P$WLz25)0oc=Dl-yy%xYZAm4b-rttL7UjR#%`#j_F R;_m(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000)l$0ECbfb-0$}>7z|u>IvuoHEmW&j4lzv=KA+EpIObc7e7{sGA)QVmnM@*^ z%|h38^m;wC+ilpk%>l#V5LCqP_y2_Cayd^XlX;j*r54R*lW!zbqtSpQNyz8(JVmWm zyV4S$2{Uhyc{Cb0QQbf{ZGT{Kr zvJi{K_&f+q^Pv4MK$hhS4TgFj_FD*rLOePdE-E^T7ZzTFCRUB`*?9&h(a#C!-v8lWG#k3AOJQaUey6Oasked^kDPe=Khg@7s584 zg`XfS1)&u*_c;I76#%`kkBfiZgKKo@0)9d6vZw=ExQUtV?eW{Y1Xv}=4X(2zy85d> Y0C^(qLv?Ui{{R3007*qoM6N<$f-gW7od5s; literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/connect/lib/public/icons/page_white_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b93e77600def75c9a144d3d0a5088a62c02cbb0b GIT binary patch literal 618 zcmV-w0+s!VP)$>5Y&axjp2O=VLu>*f>1L;s0)kkvKC!*u?s6CVL=HJ6oP~pNfZc; zsKr=bq;7MITw8NXw{SZm%59TId2x_9BQ zV86`NuvGI!>o^V!Na!=$7GJE{Cq`b+XwknM{UcGHFTTfmuS+ zm-zYC!P3+zmY;SG$?!fYkOih`QYaLxyF}A86h$GGN}kFj)_o*0e zjPMP%zTG7FYMAfO2Nn1D`D0Cj?Wl>5q%@CE10nX)KxpNmwk+!IWkzywiYD( zqUXiYYIq3qcRyMGJ;IY`(Gz~E$J$zu2+R{)xGlE*88b3WK6V*J>}2iPY1HH|tER0W z_+^^FdppY?o)Gt5M2`%xwRDH@R3G}^i1l4|6uchm0X0f!@&YdVLB5K&dd7Rv{)DXX zt^&vP;}kqj3f>94j+4xd93>s|Q!Ezi>?r8(Il$P}PFxSqu{d*!Y%*#cX(R0f|Juz# z3o0_xI14Al->1uky@W-rCI_%l&>PK^TXNSN{byMk2AI5vbwp!K-%-@!-vPR3iikL1L7HA!^!~ChCFU#lnGzp88=I z67V8PHBo4(l$u?-AKmT8?#_0rKW9dUNRbpLc`}piywAM9$xZ-3fR1C75T(BjCn-l* zjUcci2oXXo-}iqun@#)+`W@kL_-U&|2>MxZy~3IdmRm&8b)9!2%ksg3R)nNnT*TJOC=6{2hG86Dz+<^p6qfG5$i^UNUh+u)CD7O2 zK>Ioazn;U|+X0x$=feveYZL1W*Fm%e5P1sajd#eW#^5(ddx76*pt$^)b}$Q4oPabL zLc^HF>Z{8za;f$LtN0P$6C?1{X*jtXkRJ8IEeyiSzencvH3Ux_y>y^}wfJrRCQN#9 z?&e+C>sSAfrE%mZD5RfZ`gSndD)=P?+nG5Oq$zmY&-v+gc7R6c0u8^Ke#|XOq?gF@othF3zFpM8Il<8BJrWqBtF>b#_ye4{0)Xbu6j&@UIhRE002ov JPDHLkV1nWI9dZBw literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/connect/lib/public/icons/page_white_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..b977d7e52e2446ea01201c5c7209ac3a05f12c9f GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/connect/lib/public/icons/page_white_find.png new file mode 100644 index 0000000000000000000000000000000000000000..581843637079359a6a58fcdccf0763690c67b063 GIT binary patch literal 676 zcmV;V0$crwP)_k3`4d{s8lK_6bi^@vq&To98fNoK}7)fx$e2^Y&@<^jR_Ee+8}KG;X`@ z@bCyiolqX>bb1ZIs%QGnjzFU~L8H~d?e;*XP(h(S262}XyZ3a0h07r{KV?E70l+e- zE`%3x|M5#q+;HOC(h@A^M)7Rn13dm0&>K$j%k_F4wOWlsNCIH+!c_#{eS&TL8v4yc zcpnPEY`cQzZ$ILq{U-MA6Z6Z|1p!FZjQ}tXSb25J@HphEqX-6Hqo?-_Zn@{d#>2Ml zJGhxTAd&emK$lV-QK&VM&ix0Xy{GyS3Wp(+E1^8BhD3T0a)m-Lw@Lu4zQRrP)9(3F z^>$hh@N>OAXrmPYunLi|fJ$_*5i`46;M>~*5D{bp>-OL3{+!MJa`3kv~Q#QfQ%c z)1s}QE<_XaYBG;IuRF=td#+}fi4h(6HgoUyJLi0t(*dA^B)%@8kkG&bdM5P5^Z5WF z%d%>m^SbN0XeV)wbUOXn5Ag#A$gJx+7-OCkMM1S%MWIlTkbFLmOeW(&n&wUd&;`>p zVcRy$Z{K0=?SpNnP^;BYEEXleFbq(UY&LrXX$6qkJ~)8+b{=jj3HEXds;Z(?D%}}L zX3`39&dy=Zyar!ehA}e>w)(*vrCct{PI9^2Jpj&OZS8<3-@{0(gNv%1{)zAiLY+_^ zl}e>Ofd4&#Irj#7>=o=Uhv5IJ@?sN0^J|(WL2Uun$4}si6}TG-s3T#p&6GE<<2W)O zf{^Y2HlO#*QDvTp3v&d@;8*}aUC4lisG9(w7@d5Y8y)}U#FwCkqp*Mcgme4{&gGRf zlBfd`nF9cQBKB2_L{F8G2)7pAf$i)Ds`|}-c>pc^LRW{w4SQ)3N^BbZx)6BlCZts! zKph%`(m#xg-q3I7=(us;9<)*2%iuQ1J`oV3gU6V~T}^JU5714JN33&GwEEru0d}Uo U{MPL+lmGw#07*qoM6N<$f^vibe*gdg literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/connect/lib/public/icons/page_white_freehand.png new file mode 100644 index 0000000000000000000000000000000000000000..8d719df5205f7415ce657e5c277db4533c82f346 GIT binary patch literal 639 zcmV-_0)YLAP)p{{sC7)XB-g4w*W1a1)XtvxrMYa1o?wn&v~3 zHnC|#(>B_M1d`_7gfzLiHy=0c<2kQQdXu*33(xYN_xYW39(cz9jEVT%VokB8|DoF~ z8u%Q5sdl@4VB7X#uh+v_;yOGY&pRi?378ghv)P1cngiAAb<}D#l*?rWDV0j_dc6Zk z-|P~AJZQCA=yWcQjG8fYnimzj*3KqTfN0Cy!G^$7)+bQ$+mHVd1J zvwOR^5Lm<|R+uyB1Nu4vL?d4qa3tn?9H7SZH@~u=fFHEDfSH|bHU6kh0O3%cLdyny z{`9S2Sw~WMy0MPy!64i`jdk4Z3>^+KIL_fN2V_d&ywBt`^IJpxUI$=YAph~5`;xCe Z{s%Y0vkUXDnO6V+002ovPDHLkV1loX8z=w( literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/connect/lib/public/icons/page_white_gear.png new file mode 100644 index 0000000000000000000000000000000000000000..106f5aa3611a4807ec8c21701c631730275089a4 GIT binary patch literal 402 zcmV;D0d4+?P)<@FR}JvtGRKa0_WfK^c7uXaFH3q@Y!Hnl8VySc`OtkPN3;#l*y*l23+99h*9JzA00}rAC!#M1dZ#v9YOBH|eC*${MmzzYjBu!!-< zK8tujf&(6i)1biy*F>4{f*Kd(IU-JsG&#b_@NgTnx@40)2@2%c;*=?-2Za=}O}7&( w%_K#(S>e1j&gfY?mR})n>>0+8p`iTe2d1K2h8#$+)&Kwi07*qoM6N<$f(2cptN;K2 literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/connect/lib/public/icons/page_white_get.png new file mode 100644 index 0000000000000000000000000000000000000000..e4a1ecba1b60e54f3777717ed105cdde745b7184 GIT binary patch literal 516 zcmV+f0{i`mP)o)wchR-92qq~y6`XqbKmElbB3z{pkZs0VPF`CFvS?7jDn^mFo>d9Y&06* z&1MsS!M-CH3ee+h_sy)Ms%B*ec3R0RpVi9?*mU84yoq(Bw8 z<4(999dJJE!V%pWT~HGRIAb;(#O%2K3?uRpz}AfgE8e9q&OSdr^e^}lC$QXZz;S2A z)w>^oHy>?v)q--`!pmuBe96PxP0u*inQvyFW(llfv9 zXV1s*Jh`y2H%B3ZTA(AzpsQ?hb6_PyZ=c1?_B4fbl>G%!@ubJln=!)x0000#DY{xaiib^#X=YT4@yE_&2#eBulEdzjE`u&@G%2(&u{J-<}d(^uY4W_kMfEX z@!X)AR9F&FL?RJyJRUzvBoeqN{5kY`z3wcM0+du73~_0|*lac! z42Dw(Eg1o{Ash}P8jXrqN+1w`*XxDD;ShmPCZC7#4;wWbHoMvBl$=zF-`?*9j*Nbjd=v@OWt_BgKxP-3wd zy37?ATx&$b+&zRM!K;BD%Okw`Sb@&Pak8$KRX19jWZmC0&n*Ggv%j8nvSPDFw zEkV65AGOoBQ8kf`R|}Px*&INNS%osq9b{Fq2I(x6@xM>tg=vRLF?I`0rWzHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e-C#5QQ<|d}62BjvZR2H60wE-&H<>}%WqH(_V;zPbB1rgSSSC(0? zWlQ#?N3UgnJ9m2C29w!SwoOo5_2Iq!<8vCyEoDoj@#oV($oJEg6Bj@;nD|2g8 s%L|>IZ381yx9RvPhV4J)*SeoEV4lyr#k*`nfWBbxboFyt=akR{0DpOPi2wiq literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/connect/lib/public/icons/page_white_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d61648452284da1bc28b10385f95b5d2bf027901 GIT binary patch literal 616 zcmV-u0+;=XP)-tZUVHjYHp;RjQ0M0pRlXN=mLv{hk9Ebp9&~+Wj-T9IkpzWPWd#fZ)d=zV^~S`;LE*!&u-?g42^wwN&Xr1~#d5ifl_2*B1OoS}CDno^8a50ArfE8;stQF>AP54J@H~%T zFz84s;dO!QJKD36(~!QOg!t_^gfFcSKDU4yK0+Ypg$NT^mIYcQ6bk*3P(lBLh7Df_ zTu=2xC#+-_%)|{Cv8zz0t|0y4D5M`xAc{gwOKc`ou<*&VjUREFHs1qd<_xSkKeTBt zgyCi=@jj;&Ns^GsWWaIUl0Y2azcDlF@u{(P*!+EH;lnU~b|Lv{4|4Hdkh!qoQHiE$ zY#y>KFA0QEw=4Z|uV{0A^`Y=D}hB$GP&<$bi8q(u;p^0(my3Rz7fP}|# zGZ&#uor4@c3q9r|f?H6-UZmfgKx(iV(MQ`MPWB>iC~SxnN5H*zb*A3#zWwgu&c|}3 zn^g87H{pdeasl%Lhmab&jC?lES}7C?4BFDNA<}20hoY@w_IU%i*T;}}wh!589}7~7 z#Ug`-R~4j&+K_y4kW@X7qLr-)S5qVKU)tO;+kXJ++{vPI@{hVK|PhMVVx_`)vx~zUs}c9O-Ok{00000NkvXXu0mjf DS5_-g literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/connect/lib/public/icons/page_white_link.png new file mode 100644 index 0000000000000000000000000000000000000000..bf7bd1c9bfd78d689c73ba67cf914182933ee68c GIT binary patch literal 614 zcmV-s0-61ZP)OOAS;jTeL{ZSdz-%)SMH9tDF;N4B6%j=d15J&5qy`F#vB?Ar zqS1nH@%ny_XSI*Y>) z1f5QYdmzT>YciP<3WehS<{GovEaLGv27>{*-7f0&I$yJ^L%ZGPv1YT$V|u;*+ZCWz ztHI~CDVsuy($SfR6-`N~K?9GTB#l%%0h7 z-q`K-y~E)+s8lMyTrPL8^_pUo)9G|SluG5pPqw6!LJB_PzyJUM07*qoM6N<$f^=yZ AYybcN literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/connect/lib/public/icons/page_white_magnify.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b74cc40f82fc83e4dfa6e9647ccc1b34e6ed7e GIT binary patch literal 554 zcmV+_0@eMAP)Vb2f>2}Fa82O3m(Ob=t*sniin`NpInLyMJgI`saru@YOPfh zy4g0#G*cV!#N%;Gq9_VH9?v%kjS3Rb1j8^;C={$Gp=lbj z*(?%?geA!5^Pok%UauwjA)v4g2`HedDw4_Mk4hhBQt?e7YJ5(hcj|3dNu^TOPGnjB zTTsqd3GIZ=Bb`n=7no)dflv&K(lsWw?lH6T1Yht0F9qgIuzh}ym0%n<3d3EBWB*pg z+G!I0lbAEXyd>k|QNuwr4=KX1D+tLPv)j@C1=N4sA4NF9A>HcO3G47*Y6!+SrUH-7 z1hb;^#S=r|`aMh>J#dWruAEf}gcR(DRUC`ZUev&$Sbh0SgLiTXeeHEU<$_YV;9281 zym`igIE%Sm8DpDw7@71Tv^EB5xSdUR*0$Mqp+Wq8OoaZtOg52&)zZ;;M=7#C1Yd6x svjx>8ad4e2x|*xHHwRjcjs6zA0XLDUqKT6dS^xk507*qoM6N<$f*wetruo^Ag2=LamM1T#~4RmC^m`_ zs}H7d&XJ}mg+hU?tu0noRvyjI&o2SRAeYZFesYkts79I^jJ7!A7%6nJwq8O?iT55M z1OQ` zbL{!Cp5o*IRmE9PInMCSPjTwfT~J+EYkz}tjxY=fg5Yf6EQ@DG$0kMJ9h^&$W}9BU zP1oj2;?MWVkKIEl)r=Y;L^Cx2q|>!)qJJ8zE7-V*-Cf7V8_2#1c0N975t~+&QUpQJ z5(uo(-O_`%Rj@U@t>JYAgd!>L?0Idxtd#oW2gc!jinsAEva8|kF4#Ic**mmml_{d^$s}Q5Q)KCys4sfck5bP1SyeHwh2`A<@N&t2j0^lgHC_^(pAAPCNjwl+>AN%C4Ll>_8Hjda%9 oS~i=#*e)>KsPlg0=2)Qg6BCqJ=F8HdGXMYp07*qoM6N<$f@i)wr~m)} literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/connect/lib/public/icons/page_white_office.png new file mode 100644 index 0000000000000000000000000000000000000000..a65bcb3e1e9613cd9e4950850db43d7025a5fdf9 GIT binary patch literal 779 zcmV+m1N8ifP)JNR5;6x zll@CmQ5eTZ^k*a#RQf}fVOdd`5NJh6S(>6Cf$wEW#f&JyAR#GAn9>Gml;nOf3WCDa z5({5&UB$(IF?G#$x4X@Ickg!Y-HU!Z_rzX=qAq-XI_LS^=lOCT0|0{#{kBkYDS7{3 zD`iu%E=`cDX_^#^#n$5SIQ|4Zhsk8>N|zXHXG@*41$i-7`Jr{8`3S_OEcmY|RF48wXkk?WpdVM4OePBSbfh z#4_=eXJg@3epx~gi>QbUmO}Bm(ENN3+@c?jWiKvSrm(o|W}Ud*?vy~fn1!V~Cl4kB zI-;c!8f~-v)jX82%EG($>?;KSD$64f2&4qQ#=Yyrcpy$57RAVuV#vKMP)0hT$r6m# zc^F^XaJ8R9Q|}x^NoJYIvYZkq-z}Tnj@UJK2l2H zG}p+VvtjP2Z%bsb$~7QLJ9#pC0dKi`ppOd^_V;ME6tdzC0PtV|r=@e@37O`%0k^=5^`%cf$eu00N17Ro!{^30krz>a%3j34C?*{Mt2^a4~ zK=P+Qq%|f;Tc&+9ps;@Mw`EE%rgs&#y=j6BUGg96oIqdwj9-fiy*N(|@o)eD002ov JPDHLkV1j#pUPb@_ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/connect/lib/public/icons/page_white_paint.png new file mode 100644 index 0000000000000000000000000000000000000000..23a37b891c2f5faa3b8128d45373ceab794ca609 GIT binary patch literal 688 zcmV;h0#E&kP)PK^TXt2QS_@2qt2T|9~baC-vaPn=ziepcfAwB$0!O2Q)E}1e8!q+9)KT5JVKU z7HNY}h##OS-BxWHWjD0wrPDeEfUClHs%Q6&2u@FTOJkKMQN|_Rlw6rQz$gPzqGNtj z#ruSeFeh835JJFiM6vp@6M5bXj%k7CMt%SIwfbF_fD-3*Os`9Ly_Q3WQ_SX33E{pX z9_WIeeTCGQ3wYALpBcK+P-iuw;3i&7xCua37k5# z`>c`M@sGeC7cdsdz`aE9lOz!hPholbyz%T85LYf6O*@SA+9&+^7k>+4M8$A8iNQq{ zQvn8k?-+dU`Z@gK0z$EtPV#+`^OH`R@cE-cuE&_!D)SZGxmQxeobP_Zwq zMEgi6ePN45N`|V1so0uE8^}1xw8s;VM%Ai@7} z2-&Cyvez_-O4?6uv{zTaj|YeYEk34i~K@`8YW2g{x* zc;7z3lItpVy_et{Z-ZZ)<@*%{l7Ao8mu@V7*gz<_1##mwW*%LEwCdzNsVLYx2*T-J z#HeQ*_a=R~KDdVNk$EVgAIRl$oQi_(`_IrdJciDpH|Xe{K-YsMtc!cRnFi$qzsr4z z5*$;ecov%3->1{YNy6-Gf(Ecy&_I$CjI#laeuE+S120^|Vjsf)W&i*H07*qoM6N<$ Ef)^4A_ab^avY?n0hpS-#mn_4{O$e%cm-@NH=3`90Wq+3`~HKArSdfX`&Z12 z(CY$VW-MNtXX4xy%yUeE?}*~0-|iByA@ZrwXgph4S*bhcc5{HB!DFVm_v}P*g7+Q~K}7K0lcp(^N@X>U zV`{ZpeIf${R6Hgg4FL^`X$Eu75k(PE6ycl$AW0Ic)#@rR7Z(7;V?i-dR1K935Jgcx zPfkwK>2wGokf!Nih^ARp6-6arYFG#(9Ta!x93nFEjoA==z(g?#sDg?Owk?Mg7K+>l zWYsf(<`#+$h9Sp6gFOg_dd+80SkUpk&xM7h0`Sov9W73spU;GP073|VfZ&Gd$J$*0<~TV5aPS|qWH57|VJz+d0000vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/connect/lib/public/icons/page_white_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..134b6693687b2fa5fe36d48a9c0b8001f937c741 GIT binary patch literal 650 zcmV;50(Jd~P)VHAd+bMNh~)LLRqN>D)-jd9UvB%+hyKX5U|&4t0)fzgD-MPpQ$nHU%yoz=vI zMGb>1Xu!6Hw$NT~@Au<4P-+{9;Uw?&oj31uzH>xX0T7Xkz!(tn|Ed9-s_FqyReC13 z(ll)vW1O{Ck5ihay12Ob2ABc@RUI;zHpaMiyRDs0r>|D4rHw{ItJSJnYjt~jTbGuW z`X(~}?!&86q40R8<4zYw;$qi0^3ec=c&<&H;r`8W%H=Xymf^i;Wo6~<+}zx2UMzpC z*6MZN?(FMv`n|KO3(KFiUaucP0;Z!@LcUNa%8#vGK5aZ>wDgB0Gi=t*argWJcdlMQ z2#MpEX0wU+9&0U?N(F#OgpviU_Y{jYMsj65U3|PjwUOY}lUYj?MTiK_Il}NCVx-Eh zDx-TzMk7se+M#W_>?A1-x}ZXw3kkyz5kW)_hkjsi@RhKadN#H$Hq)$07*qoM6N<$f}lhwPXGV_ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/connect/lib/public/icons/page_white_powerpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..c4eff0387d5888c638ba09473ba6d2369f7b56f0 GIT binary patch literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000JNR5;6( zlS@kiVHAe7MZY2;Xi-5)WxDDgv@tCUl*&p14T@Z~3ThM5LP4tuQfLu@EnG;nXc<8S z6&3BN?fx-cv-Kp6>HRiNTHE>$X( zD&=w+?GWC>?RLAGC6Yix;an~UmSt)tSf}1VS6N1N2ONORdD? zaj}w6DAZZdOud9Ep?M?{iQWbE5^9HLLZZF|1kdy0Tu4InEuboP9@nvbZ-P0n4AZTy zyMRIxRDmUE#LdqYuD=-Qz4N^bC`_#S7vcLn1M}{J(Wl3#c4VWczu&)AjUlh(11>gp>f`wv{KnjF%!aA*Jk N002ovPDHLkV1kkt*XsZP literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/connect/lib/public/icons/page_white_ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..f59b7c4365fa1720af1aa04eb47167ddaa6eeed4 GIT binary patch literal 626 zcmV-&0*(ENP)ZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/connect/lib/public/icons/page_white_stack.png new file mode 100644 index 0000000000000000000000000000000000000000..44084add79b9a0fc3354d16bbd4b4b5ff8095da7 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R@9E+gqH(@-qA%AW0|7U8+xDRI z0k`B18}ImRw2g{jTGP$Pmx3yI6F_2s&$|`cJ!i0UN zB3H;=r{#{FwLaNVJ&hZl9+MTHGx1T^-A=Q0?hRb#8a~x50X%;`b6ik3cw=#XdxWy= zgrpBoDjpwP&g9<9h3x!k_B!?vuTJVkmIJ-U N;OXk;vd$@?2>|rNdMN+^ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/connect/lib/public/icons/page_white_star.png new file mode 100644 index 0000000000000000000000000000000000000000..3a1441c9a12062a4bb3d706000d3ca14399aebca GIT binary patch literal 565 zcmV-50?Pe~P)SCZIX8XZzY2l?gCw6LlgWJ5Avz#QX4|&mI8LN)w~J1vgL=KLAhlWz*=#m~gyvxa z&;iC6gb?aZvMdXxX`<0+D1hs_pqJ!wxqlEH;CJ)je~uL(gpi@v>!I0f_Kl=E(E+Tq z26na*9gribxx-Oft(HnstyXUUy!39&E-cI%J5Rsy;(PGZH{g{ty!HVC&yGPT3H8x# zw{^gBPW)O0FMoh{k%l<`1a|To_Wl&u&-GXm8izU|&<&utILc4wc6s@u1bmTz6x{qg zTw@7=FQRcg&r`h+gcR$*Jbv+*DPk7v)B@e0o2 z6IlBXW&8xh@9)YKiV~2>+z&XKd24JT55YWz&JtfvCg4r^~bLP79-yS@n$OW00000NkvXXu0mjf DStt2z literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/connect/lib/public/icons/page_white_swoosh.png new file mode 100644 index 0000000000000000000000000000000000000000..e7708292adabf4821612bfca032cbd019c63180b GIT binary patch literal 634 zcmV-=0)_pFP)KrcWDBzIw9XCtIF5G<@j zP(;CSqHxUrerI>~wKyloM4~t_Ofl@UFEj6$Bmm6p1aK6H{5zI_FOn(%k{CiRq?CT< zoV}Ey-7=-5nVFes;1m!f?EqZLIs4k$n%39XN4dPbtX{9DZnvvaiWV0aH9I>yf;2<< zHmo7WNC<&iE4ji-iKJpsBApDKiAiqWy8R$FV|M@E-RCB03vjWNGQZJxKCc-cSB=dq z#v3snoDMC=4<2BDgiZrv0Veh~mz(X=S@;fbe>CJO_5|oe2o3=wgfW(StLzI-qr&kc zhXEJ?9=`nWXzrUKL_p*Kr9u@95MU9EKqp2vi+%&1&gUn&>Ut_d3>wiyiAJg5G7j%G z#$sf%Kqau!AAHP&4Q?edl!FWqpT=C{D}$15WC#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R>*?YcqH(@;f-l!01CbW>s1Izr z3LkoHh<3E?TVANoG4CX|$empRCCS=R(U(hVJfm~E?IkDKRK&NP2|n`v>d(vV;W1uY zrFGVdwn;4b{qUtE`?GB`)E1ga&i2|7ncUL1b!KMq^QnT#_gn?_Z8(c`1Q~Vy3oL!N z$M8vHL&U1J3SJF!56azQU3B6>r|ZQ{U6)pC|tRy7$(5JQ<@7eB8yk=XcNf-aBIe#;8c_B$^=N z{-Iq&o3%O}V4~G($=zcP(LI|+6dq{?rby~MXwJQ*=!bOvl%?k zYY;jP^@M_k03MHL+-9?_3W5MN=moFW3xmPHU=-4Bw;62MrIhg_lwHEsv)V9U4x>+9cG2kIz8fWo`WyMMfz zdg-)p!<(hFR{VYSDJHEJn09O@#)%q0l?GUg9eS2~vKPUtd+=ak5lWLd-jI=;cjEf# zt$1;~?G!t@s+VLwL=P+Ks;E z!Jkh#NeohG;&02OFD7^EY zP!_PL2~i9VnPEW6Fz?O3dVF_U$duAL$=SU7&hNc@-drC5A4z=IgjR%B|D)?dOEaGb zuwod-$hPex$8oSoqK;@Z8u3EBfK@V2CKKqo?yA%2pjNA)(P%)HWf#)x^$?52W{|1b zPXOA$IfrSQV2q(qC_vLR)a!L9isAxjoeoJRlgE&G0Ga8krBVsGjZJJ-x6y1i(eL-q zwB%+o53no?l}ZJh#drAjlc6nhs3RTn;1IH+x;K#|X)!=#fM76)$IqT4^N}IF%aQ#o zTKS@*)|#L#jiCPi9~);c`x>TR|0{+9a?O5Exg#~V5W2C7G9nAAN(~f z2caqx&t~GhnK;qW3~&OuEke?%u(8Jxs_+ZVVz1^-uLrP95TahadGG$+(D&+%2QMF8 eFxE8s%l`oWamgLPAe&$S0000dKE@duOisOkyZ-5 zuwDqkAi_*y5o3Xrq7ieT<<3p#-R^dGySwea-CgZZZITBc?#1u+FtBuUCJUZe;~j-%Tu@ZpYB;$&ydfdZG#(j;(iB#^yRlqv#C*LO zXWXM0cpKKBlj#L6awm|;A38Zs3mg;sQZmCAZT8m@X{AlP6 zVI=SsiA16x=>2%^XV3U0y4~G+MNE!B{!#;~%L2l(14PX>EblXb{rnCSlVKe0dyf-O zuY#uOf}m&2xq80;4d3i|cuNw}U@sg3VKRU)>Os_1L3pl5mK*|?X3#a}K+EVZt&w?w zefXKP^ZqnW-3y9AhYJZ~r4m*!Z3OSz3d}2Q`nDM_f_u>L%8Cb}8`?bl)x?gwAy>zp z06y57kT6sry1g2l{|V%UW?)JwnbzUugbvpOF3=oZDo}spfs2EWKOH{_^59;ue!o^A z@e7dWS|QI`Ff-E$USJ`LqDF}zH%R}YOlMiv63A=qK^d}n!5_(fW%^k4U_D`_meIDi kNMKea>saR;>gt<+0gk_zsk5>Xc>n+a07*qoM6N<$f>Jg*?*IS* literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/connect/lib/public/icons/page_white_width.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb880947ddf3e745c29e8d9dc90f09c7e6e323c GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/connect/lib/public/icons/page_white_word.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8ecbf47672a874c0958d0d113a56162c2bd364 GIT binary patch literal 651 zcmV;60(AX}P)hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/connect/lib/public/icons/page_white_world.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed2490ed1432d5d667a76235360824a1088e928 GIT binary patch literal 734 zcmV<40wMj0P)JT{hN;C#tgf#9krG=I>5!<*aE1_(spcgF}<`n4i zJi-}^6UUeU4jUFwdCiVPDm%`Zx^UBa8J(mnR6wEgz^}o8;)M*Y(@l_!Kfv)}4+NuM zaPXE50z)r)9=D=SR|RIqfQ^j}Hu!fzMeQBo+@PZk1G8hOw|vBTvkx`HM)Xe9q3xao z@`p0`NO!2904FHSLA6E@Y-O6zH$DQzvq@aHsz}}<(!v(Z_+EodX%R&NZW75g+nENo zV0020rxE^;7d!067AN>6*+&YLp$9uH6F-=In`XC{Cn%+o|5)b&boEPr02w@|P*oGm QmjD0&07*qoM6N<$g78X0Q~&?~ literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/connect/lib/public/icons/page_white_wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..fecadd08afed92536be91ab12d8e37b6bf410d5d GIT binary patch literal 613 zcmV-r0-F7aP)wK%m(L+9IV|s|#(WRl-O^4GvaQsnHq|OstfO zIJ3}3<01}YGARE4m!7=)QisvlHUo!Qymx-@-t*p_129Ko-#pVI)6#!*kLj-AGXWNR zyA_{wKii_amK7^YT-v z6#plaNm#8`-kz@OvjIt^4%IN{@J3bR zRI}ME1Mv85p|%;RK>ViR>APPLB4;;BpCtqE@P+*7!G>I4UjNx~e>r3HA^tWCQ@S)l z{BslcSwL-CxQ&_ZZSv_g0Tu{yi*X){Mt|W7)lbE`SQxFP00000NkvXXu0mjf;)M*S literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/connect/lib/public/icons/page_white_zip.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4bbccdf1643f4ff5022fbc59b82546e259317e GIT binary patch literal 386 zcmV-|0e$|7P)_QM!1S$Bhw4w+iRuFWf;tfR6D%SMJrb+tx zC9R6{2>Ou6#juIy6u(I?|;&Owi$sRB4^20apB5xE2 z#B9XekY66S6lzfCL!eEQRgo0LokTA55@Y#%_wN!TXPw^Q4IIXsG~v#u_4t;x_HM16EQ@QRY+rut&97&UefsPmLrQ5P zBC2kcbux9L%2bJz$P$XV$*zSxb2e@6_3O#;&!FD<&hLjGn%~%en;7)djE^d6!t$lW7GyIOKlQ46hr`Z zjLNuRDP_53dNoN?wd&HMgL^m1DXFU<5dQsrceN>fSz00000)O9XRTN^$%%`*Fg>ryDtc(lF@?b>dE!20r+y z#Q*>(wbV5H`-E4Do={CJp7=ERhw15hgZi)?jRG88 zzVz(5;g?Td1izJyO33bhjg2Qc7FVY@f9!o)Gu?DII~vm-Dc?}3M!fsgjP?F(7`rgg z+xOk8XD)e?Zl=5+un`5!7kr?F=eq)K-5uqr%yU$1hLv){Vlm=)*5~`lwMciiXFu*g z)*Jkz6AF>#zb(Vx`Iv{bdGZHtlW)v(y5k^|xgSUc9%0}S20nrYrO}78ofk?bV!5)4 z=Ngz@+$9N1>>mA%IWx`Fqa240bWkiW;2TZgd8CZS0U}@mknC;!2;wi$eI@`h0y2JS`Eae0CW}q(2(%!m8 zWq$`PDU>LT1_y*bBv#P5<@q0@ttz$hIH}YMDvAigCc=y*)jY-VOpTd;A8@3t7Xh4r z0KTWOk;N2Ox4!&&^4B*no$WtTX!BXB)rg!y8dvGgKBQKLJNXRRp0}Bsjd1|LNQX~c zbC~fjrk2iL@4dYF*vt;}dFn(%h)n_-vzEIHMOKRkdF%3Lq|zBgKm_h>TEq!))nWjq zzn;B!?!(dQcHu$#=JF`cS&W~C`WHFW^B!~MI#k)>1Vk&eQy8P1O`J6V04{D@|7d6^ zyBABnh-d^H0FX&L07M||E0n_dp4v&Q%PSE9p#R#Hq)`5I_(B5CE#q dxjPz0{s-<+c#AC!i7@~G002ovPDHLkV1iPlpuqqD literal 0 HcmV?d00001 diff --git a/node_modules/connect/lib/public/style.css b/node_modules/connect/lib/public/style.css new file mode 100644 index 0000000..32b6507 --- /dev/null +++ b/node_modules/connect/lib/public/style.css @@ -0,0 +1,141 @@ +body { + margin: 0; + padding: 80px 100px; + font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; + background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); + background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); + background-repeat: no-repeat; + color: #555; + -webkit-font-smoothing: antialiased; +} +h1, h2, h3 { + margin: 0; + font-size: 22px; + color: #343434; +} +h1 em, h2 em { + padding: 0 5px; + font-weight: normal; +} +h1 { + font-size: 60px; +} +h2 { + margin-top: 10px; +} +h3 { + margin: 5px 0 10px 0; + padding-bottom: 5px; + border-bottom: 1px solid #eee; + font-size: 18px; +} +ul { + margin: 0; + padding: 0; +} +ul li { + margin: 5px 0; + padding: 3px 8px; + list-style: none; +} +ul li:hover { + cursor: pointer; + color: #2e2e2e; +} +ul li .path { + padding-left: 5px; + font-weight: bold; +} +ul li .line { + padding-right: 5px; + font-style: italic; +} +ul li:first-child .path { + padding-left: 0; +} +p { + line-height: 1.5; +} +a { + color: #555; + text-decoration: none; +} +a:hover { + color: #303030; +} +#stacktrace { + margin-top: 15px; +} +.directory h1 { + margin-bottom: 15px; + font-size: 18px; +} +ul#files { + width: 100%; + height: 500px; +} +ul#files li { + padding: 0; +} +ul#files li img { + position: absolute; + top: 5px; + left: 5px; +} +ul#files li a { + position: relative; + display: block; + margin: 1px; + width: 30%; + height: 25px; + line-height: 25px; + text-indent: 8px; + float: left; + border: 1px solid transparent; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + overflow: hidden; + text-overflow: ellipsis; +} +ul#files li a.icon { + text-indent: 25px; +} +ul#files li a:focus, +ul#files li a:hover { + outline: none; + background: rgba(255,255,255,0.65); + border: 1px solid #ececec; +} +ul#files li a.highlight { + -webkit-transition: background .4s ease-in-out; + background: #ffff4f; + border-color: #E9DC51; +} +#search { + display: block; + position: fixed; + top: 20px; + right: 20px; + width: 90px; + -webkit-transition: width ease 0.2s, opacity ease 0.4s; + -moz-transition: width ease 0.2s, opacity ease 0.4s; + -webkit-border-radius: 32px; + -moz-border-radius: 32px; + -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -webkit-font-smoothing: antialiased; + text-align: left; + font: 13px "Helvetica Neue", Arial, sans-serif; + padding: 4px 10px; + border: none; + background: transparent; + margin-bottom: 0; + outline: none; + opacity: 0.7; + color: #888; +} +#search:focus { + width: 120px; + opacity: 1.0; +} diff --git a/node_modules/connect/lib/utils.js b/node_modules/connect/lib/utils.js new file mode 100644 index 0000000..47b30e0 --- /dev/null +++ b/node_modules/connect/lib/utils.js @@ -0,0 +1,370 @@ + +/*! + * Connect - utils + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , crypto = require('crypto') + , parse = require('url').parse + , signature = require('cookie-signature'); + +/** + * Return `true` if the request has a body, otherwise return `false`. + * + * @param {IncomingMessage} req + * @return {Boolean} + * @api private + */ + +exports.hasBody = function(req) { + return 'transfer-encoding' in req.headers || 'content-length' in req.headers; +}; + +/** + * Extract the mime type from the given request's + * _Content-Type_ header. + * + * @param {IncomingMessage} req + * @return {String} + * @api private + */ + +exports.mime = function(req) { + var str = req.headers['content-type'] || ''; + return str.split(';')[0]; +}; + +/** + * Return md5 hash of the given string and optional encoding, + * defaulting to hex. + * + * utils.md5('wahoo'); + * // => "e493298061761236c96b02ea6aa8a2ad" + * + * @param {String} str + * @param {String} encoding + * @return {String} + * @api private + */ + +exports.md5 = function(str, encoding){ + return crypto + .createHash('md5') + .update(str) + .digest(encoding || 'hex'); +}; + +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * utils.merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api private + */ + +exports.merge = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; + +/** + * 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, '"'); +}; + + +/** + * Return a unique identifier with the given `len`. + * + * utils.uid(10); + * // => "FDaS435D2z" + * + * @param {Number} len + * @return {String} + * @api private + */ + +exports.uid = function(len) { + return crypto.randomBytes(Math.ceil(len * 3 / 4)) + .toString('base64') + .slice(0, len); +}; + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature') + 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){ + console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature') + var str = val.slice(0, val.lastIndexOf('.')); + return exports.sign(str, secret) == val + ? str + : false; +}; + +/** + * Parse signed cookies, returning an object + * containing the decoded key/value pairs, + * while removing the signed key from `obj`. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.parseSignedCookies = function(obj, secret){ + var ret = {}; + Object.keys(obj).forEach(function(key){ + var val = obj[key]; + if (0 == val.indexOf('s:')) { + val = signature.unsign(val.slice(2), secret); + if (val) { + ret[key] = val; + delete obj[key]; + } + } + }); + return ret; +}; + +/** + * Parse a signed cookie string, return the decoded value + * + * @param {String} str signed cookie string + * @param {String} secret + * @return {String} decoded value + * @api private + */ + +exports.parseSignedCookie = function(str, secret){ + return 0 == str.indexOf('s:') + ? signature.unsign(str.slice(2), secret) + : str; +}; + +/** + * Parse JSON cookies. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.parseJSONCookies = function(obj){ + Object.keys(obj).forEach(function(key){ + var val = obj[key]; + var res = exports.parseJSONCookie(val); + if (res) obj[key] = res; + }); + return obj; +}; + +/** + * Parse JSON cookie string + * + * @param {String} str + * @return {Object} Parsed object or null if not json cookie + * @api private + */ + +exports.parseJSONCookie = function(str) { + if (0 == str.indexOf('j:')) { + try { + return JSON.parse(str.slice(2)); + } catch (err) { + // no op + } + } +}; + +/** + * Pause `data` and `end` events on the given `obj`. + * Middleware performing async tasks _should_ utilize + * this utility (or similar), to re-emit data once + * the async operation has completed, otherwise these + * events may be lost. + * + * var pause = utils.pause(req); + * fs.readFile(path, function(){ + * next(); + * pause.resume(); + * }); + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.pause = require('pause'); + +/** + * Strip `Content-*` headers from `res`. + * + * @param {ServerResponse} res + * @api private + */ + +exports.removeContentHeaders = function(res){ + Object.keys(res._headers).forEach(function(field){ + if (0 == field.indexOf('content')) { + res.removeHeader(field); + } + }); +}; + +/** + * Check if `req` is a conditional GET request. + * + * @param {IncomingMessage} req + * @return {Boolean} + * @api private + */ + +exports.conditionalGET = function(req) { + return req.headers['if-modified-since'] + || req.headers['if-none-match']; +}; + +/** + * Respond with 401 "Unauthorized". + * + * @param {ServerResponse} res + * @param {String} realm + * @api private + */ + +exports.unauthorized = function(res, realm) { + res.statusCode = 401; + res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"'); + res.end('Unauthorized'); +}; + +/** + * Respond with 304 "Not Modified". + * + * @param {ServerResponse} res + * @param {Object} headers + * @api private + */ + +exports.notModified = function(res) { + exports.removeContentHeaders(res); + res.statusCode = 304; + res.end(); +}; + +/** + * 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) + '"'; +}; + +/** + * Parse the given Cache-Control `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + +exports.parseCacheControl = function(str){ + var directives = str.split(',') + , obj = {}; + + for(var i = 0, len = directives.length; i < len; i++) { + var parts = directives[i].split('=') + , key = parts.shift().trim() + , val = parseInt(parts.shift(), 10); + + obj[key] = isNaN(val) ? true : val; + } + + return obj; +}; + +/** + * Parse the `req` url with memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @api private + */ + +exports.parseUrl = function(req){ + var parsed = req._parsedUrl; + if (parsed && parsed.href == req.url) { + return parsed; + } else { + return req._parsedUrl = parse(req.url); + } +}; + +/** + * Parse byte `size` string. + * + * @param {String} size + * @return {Number} + * @api private + */ + +exports.parseBytes = require('bytes'); diff --git a/node_modules/connect/node_modules/buffer-crc32/.npmignore b/node_modules/connect/node_modules/buffer-crc32/.npmignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/.npmignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/node_modules/connect/node_modules/buffer-crc32/.travis.yml b/node_modules/connect/node_modules/buffer-crc32/.travis.yml new file mode 100644 index 0000000..7a902e8 --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.6 + - 0.8 +notifications: + email: + recipients: + - brianloveswords@gmail.com \ No newline at end of file diff --git a/node_modules/connect/node_modules/buffer-crc32/README.md b/node_modules/connect/node_modules/buffer-crc32/README.md new file mode 100644 index 0000000..4ad5d64 --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/README.md @@ -0,0 +1,33 @@ +# buffer-crc32 + +[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) + +crc32 that works with binary data and fancy character sets, outputs +buffer, signed or unsigned data and has tests. + +Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix + +# install +``` +npm install buffer-crc32 +``` + +# example +```js +var crc32 = require('buffer-crc32'); +// works with buffers +var buf = Buffer([[0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) +crc32(buf) // -> + +// has convenience methods for getting signed or unsigned ints +crc32.signed(buf) // -> -1805997238 +crc32.unsigned(buf) // -> 2488970058 + +// will cast to buffer if given a string, so you can +// directly use foreign characters safely +crc32('自動販売機') // -> +``` + +# tests +This was tested against the output of zlib's crc32 method. You can run +the tests with`npm test` (requires tap) diff --git a/node_modules/connect/node_modules/buffer-crc32/index.js b/node_modules/connect/node_modules/buffer-crc32/index.js new file mode 100644 index 0000000..ab0e19e --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/index.js @@ -0,0 +1,84 @@ +var Buffer = require('buffer').Buffer; + +var CRC_TABLE = [ + 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 bufferizeInt(num) { + var tmp = Buffer(4); + tmp.writeInt32BE(num, 0); + return tmp; +} + +function _crc32(buf) { + if (!Buffer.isBuffer(buf)) + buf = Buffer(buf); + var crc = 0xffffffff; + for (var n = 0; n < buf.length; n++) { + crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); + } + return (crc ^ 0xffffffff); +} + +function crc32() { + return bufferizeInt(_crc32.apply(null, arguments)); +} +crc32.signed = function () { + return _crc32.apply(null, arguments); +}; +crc32.unsigned = function () { + return crc32.apply(null, arguments).readUInt32BE(0); +}; + +module.exports = crc32; diff --git a/node_modules/connect/node_modules/buffer-crc32/package.json b/node_modules/connect/node_modules/buffer-crc32/package.json new file mode 100644 index 0000000..de25e58 --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/package.json @@ -0,0 +1,23 @@ +{ + "author": "Brian J. Brennan (http://bjb.io)", + "name": "buffer-crc32", + "description": "A pure javascript CRC32 algorithm that plays nice with binary data", + "version": "0.1.1", + "homepage": "https://github.com/brianloveswords/buffer-crc32", + "repository": { + "type": "git", + "url": "git://github.com/brianloveswords/buffer-crc32.git" + }, + "main": "index.js", + "scripts": { + "test": "./node_modules/.bin/tap tests/*.test.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.2.5" + }, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js new file mode 100644 index 0000000..d4767e3 --- /dev/null +++ b/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js @@ -0,0 +1,52 @@ +var crc32 = require('..'); +var test = require('tap').test; + +test('simple crc32 is no problem', function (t) { + var input = Buffer('hey sup bros'); + var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); + t.same(crc32(input), expected); + t.end(); +}); + +test('another simple one', function (t) { + var input = Buffer('IEND'); + var expected = Buffer([0xae, 0x42, 0x60, 0x82]); + t.same(crc32(input), expected); + t.end(); +}); + +test('slightly more complex', function (t) { + var input = Buffer([0x00, 0x00, 0x00]); + var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); + t.same(crc32(input), expected); + t.end(); +}); + +test('complex crc32 gets calculated like a champ', function (t) { + var input = Buffer('शीर्षक'); + var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); + t.same(crc32(input), expected); + t.end(); +}); + +test('casts to buffer if necessary', function (t) { + var input = 'शीर्षक'; + var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); + t.same(crc32(input), expected); + t.end(); +}); + +test('can do unsigned', function (t) { + var input = 'ham sandwich'; + var expected = -1891873021; + t.same(crc32.signed(input), expected); + t.end(); +}); + +test('can do signed', function (t) { + var input = 'bear sandwich'; + var expected = 3711466352; + t.same(crc32.unsigned(input), expected); + t.end(); +}); + diff --git a/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/connect/node_modules/bytes/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/connect/node_modules/bytes/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/connect/node_modules/bytes/History.md b/node_modules/connect/node_modules/bytes/History.md new file mode 100644 index 0000000..db1f759 --- /dev/null +++ b/node_modules/connect/node_modules/bytes/History.md @@ -0,0 +1,5 @@ + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/node_modules/connect/node_modules/bytes/Makefile b/node_modules/connect/node_modules/bytes/Makefile new file mode 100644 index 0000000..8e8640f --- /dev/null +++ b/node_modules/connect/node_modules/bytes/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/connect/node_modules/bytes/Readme.md b/node_modules/connect/node_modules/bytes/Readme.md new file mode 100644 index 0000000..9325d5b --- /dev/null +++ b/node_modules/connect/node_modules/bytes/Readme.md @@ -0,0 +1,51 @@ +# node-bytes + + Byte string parser / formatter. + +## Example: + +```js +bytes('1kb') +// => 1024 + +bytes('2mb') +// => 2097152 + +bytes('1gb') +// => 1073741824 + +bytes(1073741824) +// => 1gb +``` + +## Installation + +``` +$ npm install bytes +$ component install visionmedia/bytes.js +``` + +## 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. diff --git a/node_modules/connect/node_modules/bytes/component.json b/node_modules/connect/node_modules/bytes/component.json new file mode 100644 index 0000000..76a6057 --- /dev/null +++ b/node_modules/connect/node_modules/bytes/component.json @@ -0,0 +1,7 @@ +{ + "name": "bytes", + "description": "byte size string parser / serializer", + "keywords": ["bytes", "utility"], + "version": "0.1.0", + "scripts": ["index.js"] +} diff --git a/node_modules/connect/node_modules/bytes/index.js b/node_modules/connect/node_modules/bytes/index.js new file mode 100644 index 0000000..3eaafc7 --- /dev/null +++ b/node_modules/connect/node_modules/bytes/index.js @@ -0,0 +1,39 @@ + +/** + * Parse byte `size` string. + * + * @param {String} size + * @return {Number} + * @api public + */ + +module.exports = function(size) { + if ('number' == typeof size) return convert(size); + var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) + , n = parseFloat(parts[1]) + , type = parts[2]; + + var map = { + kb: 1 << 10 + , mb: 1 << 20 + , gb: 1 << 30 + }; + + return map[type] * n; +}; + +/** + * convert bytes into string. + * + * @param {Number} b - bytes to convert + * @return {String}i + * @api public + */ + +function convert (b) { + var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; + if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb'; + if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb'; + if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb'; + return b; +} \ No newline at end of file diff --git a/node_modules/connect/node_modules/bytes/package.json b/node_modules/connect/node_modules/bytes/package.json new file mode 100644 index 0000000..5326178 --- /dev/null +++ b/node_modules/connect/node_modules/bytes/package.json @@ -0,0 +1,17 @@ +{ + "name": "bytes", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "byte size string parser / serializer", + "version": "0.1.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "bytes": "index.js" + } + } +} diff --git a/node_modules/connect/node_modules/cookie-signature/.npmignore b/node_modules/connect/node_modules/cookie-signature/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/connect/node_modules/cookie-signature/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/connect/node_modules/cookie-signature/History.md b/node_modules/connect/node_modules/cookie-signature/History.md new file mode 100644 index 0000000..c8aa68f --- /dev/null +++ b/node_modules/connect/node_modules/cookie-signature/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/connect/node_modules/cookie-signature/Makefile b/node_modules/connect/node_modules/cookie-signature/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/cookie-signature/Readme.md b/node_modules/connect/node_modules/cookie-signature/Readme.md new file mode 100644 index 0000000..2559e84 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/cookie-signature/index.js b/node_modules/connect/node_modules/cookie-signature/index.js new file mode 100644 index 0000000..93206a0 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/cookie-signature/package.json b/node_modules/connect/node_modules/cookie-signature/package.json new file mode 100644 index 0000000..6ddb349 --- /dev/null +++ b/node_modules/connect/node_modules/cookie-signature/package.json @@ -0,0 +1,13 @@ +{ + "name": "cookie-signature", + "version": "0.0.1", + "description": "Sign and unsign cookies", + "keywords": ["cookie", "sign", "unsign"], + "author": "TJ Holowaychuk ", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index" +} \ No newline at end of file diff --git a/node_modules/connect/node_modules/cookie/.npmignore b/node_modules/connect/node_modules/cookie/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/connect/node_modules/cookie/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/connect/node_modules/cookie/.travis.yml b/node_modules/connect/node_modules/cookie/.travis.yml new file mode 100644 index 0000000..320698a --- /dev/null +++ b/node_modules/connect/node_modules/cookie/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 diff --git a/node_modules/connect/node_modules/cookie/README.md b/node_modules/connect/node_modules/cookie/README.md new file mode 100644 index 0000000..5187ed1 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/cookie/index.js b/node_modules/connect/node_modules/cookie/index.js new file mode 100644 index 0000000..db04ad3 --- /dev/null +++ b/node_modules/connect/node_modules/cookie/index.js @@ -0,0 +1,61 @@ + +/// 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]) { + try { + obj[key] = decode(val); + } catch (e) { + obj[key] = val; + } + } + }); + + return obj; +}; + +var encode = encodeURIComponent; +var decode = decodeURIComponent; + +module.exports.serialize = serialize; +module.exports.parse = parse; diff --git a/node_modules/connect/node_modules/cookie/package.json b/node_modules/connect/node_modules/cookie/package.json new file mode 100644 index 0000000..4a416a4 --- /dev/null +++ b/node_modules/connect/node_modules/cookie/package.json @@ -0,0 +1,26 @@ +{ + "author": "Roman Shtylman ", + "name": "cookie", + "description": "cookie parsing and serialization", + "version": "0.0.5", + "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": "*" + } +} diff --git a/node_modules/connect/node_modules/cookie/test/mocha.opts b/node_modules/connect/node_modules/cookie/test/mocha.opts new file mode 100644 index 0000000..e2bfcc5 --- /dev/null +++ b/node_modules/connect/node_modules/cookie/test/mocha.opts @@ -0,0 +1 @@ +--ui qunit diff --git a/node_modules/connect/node_modules/cookie/test/parse.js b/node_modules/connect/node_modules/cookie/test/parse.js new file mode 100644 index 0000000..d8c03ab --- /dev/null +++ b/node_modules/connect/node_modules/cookie/test/parse.js @@ -0,0 +1,28 @@ + +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')); +}); + +test('ignore escaping error and return original value', function() { + assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar')); +}); diff --git a/node_modules/connect/node_modules/cookie/test/serialize.js b/node_modules/connect/node_modules/cookie/test/serialize.js new file mode 100644 index 0000000..d38768d --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/.npmignore b/node_modules/connect/node_modules/debug/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/connect/node_modules/debug/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/connect/node_modules/debug/History.md b/node_modules/connect/node_modules/debug/History.md new file mode 100644 index 0000000..f023269 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/Readme.md b/node_modules/connect/node_modules/debug/Readme.md new file mode 100644 index 0000000..15ee501 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/component.json b/node_modules/connect/node_modules/debug/component.json new file mode 100644 index 0000000..4ad0971 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/debug.js b/node_modules/connect/node_modules/debug/debug.js new file mode 100644 index 0000000..e47ba5b --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/example/app.js b/node_modules/connect/node_modules/debug/example/app.js new file mode 100644 index 0000000..05374d9 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/example/browser.html b/node_modules/connect/node_modules/debug/example/browser.html new file mode 100644 index 0000000..7510eee --- /dev/null +++ b/node_modules/connect/node_modules/debug/example/browser.html @@ -0,0 +1,24 @@ + + + debug() + + + + + + + diff --git a/node_modules/connect/node_modules/debug/example/wildcards.js b/node_modules/connect/node_modules/debug/example/wildcards.js new file mode 100644 index 0000000..1fdac20 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/example/worker.js b/node_modules/connect/node_modules/debug/example/worker.js new file mode 100644 index 0000000..7f6d288 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/index.js b/node_modules/connect/node_modules/debug/index.js new file mode 100644 index 0000000..e02c13b --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/lib/debug.js b/node_modules/connect/node_modules/debug/lib/debug.js new file mode 100644 index 0000000..0b07aa1 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/debug/package.json b/node_modules/connect/node_modules/debug/package.json new file mode 100644 index 0000000..c0c86e1 --- /dev/null +++ b/node_modules/connect/node_modules/debug/package.json @@ -0,0 +1,19 @@ +{ + "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": "TJ Holowaychuk " + , "dependencies": {} + , "devDependencies": { "mocha": "*" } + , "main": "lib/debug.js" + , "browserify": "debug.js" + , "engines": { "node": "*" } + , "component": { + "scripts": { + "debug/index.js": "index.js", + "debug/debug.js": "debug.js" + } + } +} diff --git a/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/connect/node_modules/formidable/.npmignore new file mode 100644 index 0000000..4fbabb3 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/.npmignore @@ -0,0 +1,4 @@ +/test/tmp/ +*.upload +*.un~ +*.http diff --git a/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/connect/node_modules/formidable/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/connect/node_modules/formidable/Makefile b/node_modules/connect/node_modules/formidable/Makefile new file mode 100644 index 0000000..8945872 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/Makefile @@ -0,0 +1,14 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +build: npm test + +npm: + npm install . + +clean: + rm test/tmp/* + +.PHONY: test clean build diff --git a/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/connect/node_modules/formidable/Readme.md new file mode 100644 index 0000000..a5ca104 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/Readme.md @@ -0,0 +1,311 @@ +# Formidable + +[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable) + +## Purpose + +A node.js module for parsing form data, especially file uploads. + +## Current status + +This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading +and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from +a large variety of clients and is considered production-ready. + +## Features + +* Fast (~500mb/sec), non-buffering multipart parser +* Automatically writing file uploads to disk +* Low memory footprint +* Graceful error handling +* Very high test coverage + +## Changelog + +### v1.0.9 + +* Emit progress when content length header parsed (Tim Koschützki) +* Fix Readme syntax due to GitHub changes (goob) +* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) + +### v1.0.8 + +* Strip potentially unsafe characters when using `keepExtensions: true`. +* Switch to utest / urun for testing +* Add travis build + +### v1.0.7 + +* Remove file from package that was causing problems when installing on windows. (#102) +* Fix typos in Readme (Jason Davies). + +### v1.0.6 + +* Do not default to the default to the field name for file uploads where + filename="". + +### v1.0.5 + +* Support filename="" in multipart parts +* Explain unexpected end() errors in parser better + +**Note:** Starting with this version, formidable emits 'file' events for empty +file input fields. Previously those were incorrectly emitted as regular file +input fields with value = "". + +### v1.0.4 + +* Detect a good default tmp directory regardless of platform. (#88) + +### v1.0.3 + +* Fix problems with utf8 characters (#84) / semicolons in filenames (#58) +* Small performance improvements +* New test suite and fixture system + +### v1.0.2 + +* Exclude node\_modules folder from git +* Implement new `'aborted'` event +* Fix files in example folder to work with recent node versions +* Make gently a devDependency + +[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2) + +### v1.0.1 + +* Fix package.json to refer to proper main directory. (#68, Dean Landolt) + +[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1) + +### v1.0.0 + +* Add support for multipart boundaries that are quoted strings. (Jeff Craig) + +This marks the beginning of development on version 2.0 which will include +several architectural improvements. + +[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0) + +### v0.9.11 + +* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki) +* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class + +**Important:** The old property names of the File class will be removed in a +future release. + +[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11) + +### Older releases + +These releases were done before starting to maintain the above Changelog: + +* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10) +* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9) +* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8) +* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7) +* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6) +* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5) +* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4) +* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3) +* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2) +* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) + +## Installation + +Via [npm](http://github.com/isaacs/npm): + + npm install formidable@latest + +Manually: + + git clone git://github.com/felixge/node-formidable.git formidable + vim my.js + # var formidable = require('./formidable'); + +Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library. + +## Example + +Parse an incoming file upload. + + var formidable = require('formidable'), + http = require('http'), + + util = require('util'); + + http.createServer(function(req, res) { + if (req.url == '/upload' && req.method.toLowerCase() == 'post') { + // parse a file upload + var form = new formidable.IncomingForm(); + form.parse(req, function(err, fields, files) { + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received upload:\n\n'); + res.end(util.inspect({fields: fields, files: files})); + }); + return; + } + + // show a file upload form + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + }).listen(80); + +## API + +### formidable.IncomingForm + +__new formidable.IncomingForm()__ + +Creates a new incoming form. + +__incomingForm.encoding = 'utf-8'__ + +The encoding to use for incoming form fields. + +__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__ + +The directory for placing file uploads in. You can move them later on using +`fs.rename()`. The default directory is picked at module load time depending on +the first existing directory from those listed above. + +__incomingForm.keepExtensions = false__ + +If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`. + +__incomingForm.type__ + +Either 'multipart' or 'urlencoded' depending on the incoming request. + +__incomingForm.maxFieldsSize = 2 * 1024 * 1024__ + +Limits the amount of memory a field (not file) can allocate in bytes. +If this value is exceeded, an `'error'` event is emitted. The default +size is 2MB. + +__incomingForm.hash = false__ + +If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`. + +__incomingForm.bytesReceived__ + +The amount of bytes received for this form so far. + +__incomingForm.bytesExpected__ + +The expected number of bytes in this form. + +__incomingForm.parse(request, [cb])__ + +Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback: + + incomingForm.parse(req, function(err, fields, files) { + // ... + }); + +__incomingForm.onPart(part)__ + +You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing. + + incomingForm.onPart = function(part) { + part.addListener('data', function() { + // ... + }); + } + +If you want to use formidable to only handle certain parts for you, you can do so: + + incomingForm.onPart = function(part) { + if (!part.filename) { + // let formidable handle all non-file parts + incomingForm.handlePart(part); + } + } + +Check the code in this method for further inspiration. + +__Event: 'progress' (bytesReceived, bytesExpected)__ + +Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar. + +__Event: 'field' (name, value)__ + +Emitted whenever a field / value pair has been received. + +__Event: 'fileBegin' (name, file)__ + +Emitted whenever a new file is detected in the upload stream. Use this even if +you want to stream the file to somewhere else while buffering the upload on +the file system. + +__Event: 'file' (name, file)__ + +Emitted whenever a field / file pair has been received. `file` is an instance of `File`. + +__Event: 'error' (err)__ + +Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events. + +__Event: 'aborted'__ + +Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core). + +__Event: 'end' ()__ + +Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. + +### formidable.File + +__file.size = 0__ + +The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet. + +__file.path = null__ + +The path this file is being written to. You can modify this in the `'fileBegin'` event in +case you are unhappy with the way formidable generates a temporary path for your files. + +__file.name = null__ + +The name this file had according to the uploading client. + +__file.type = null__ + +The mime type of this file, according to the uploading client. + +__file.lastModifiedDate = null__ + +A date object (or `null`) containing the time this file was last written to. Mostly +here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/). + +__file.hash = null__ + +If hash calculation was set, you can read the hex digest out of this var. + +## License + +Formidable is licensed under the MIT license. + +## Ports + +* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable + +## Credits + +* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js diff --git a/node_modules/connect/node_modules/formidable/TODO b/node_modules/connect/node_modules/formidable/TODO new file mode 100644 index 0000000..e1107f2 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/TODO @@ -0,0 +1,3 @@ +- Better bufferMaxSize handling approach +- Add tests for JSON parser pull request and merge it +- Implement QuerystringParser the same way as MultipartParser diff --git a/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js new file mode 100644 index 0000000..bff41f1 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js @@ -0,0 +1,70 @@ +require('../test/common'); +var multipartParser = require('../lib/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + parser = new MultipartParser(), + Buffer = require('buffer').Buffer, + boundary = '-----------------------------168072824752491622650073', + mb = 100, + buffer = createMultipartBuffer(boundary, mb * 1024 * 1024), + callbacks = + { partBegin: -1, + partEnd: -1, + headerField: -1, + headerValue: -1, + partData: -1, + end: -1, + }; + + +parser.initWithBoundary(boundary); +parser.onHeaderField = function() { + callbacks.headerField++; +}; + +parser.onHeaderValue = function() { + callbacks.headerValue++; +}; + +parser.onPartBegin = function() { + callbacks.partBegin++; +}; + +parser.onPartData = function() { + callbacks.partData++; +}; + +parser.onPartEnd = function() { + callbacks.partEnd++; +}; + +parser.onEnd = function() { + callbacks.end++; +}; + +var start = +new Date(), + nparsed = parser.write(buffer), + duration = +new Date - start, + mbPerSec = (mb / (duration / 1000)).toFixed(2); + +console.log(mbPerSec+' mb/sec'); + +assert.equal(nparsed, buffer.length); + +function createMultipartBuffer(boundary, size) { + var head = + '--'+boundary+'\r\n' + + 'content-disposition: form-data; name="field1"\r\n' + + '\r\n' + , tail = '\r\n--'+boundary+'--\r\n' + , buffer = new Buffer(size); + + buffer.write(head, 'ascii', 0); + buffer.write(tail, 'ascii', buffer.length - tail.length); + return buffer; +} + +process.on('exit', function() { + for (var k in callbacks) { + assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]); + } +}); diff --git a/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/connect/node_modules/formidable/example/post.js new file mode 100644 index 0000000..f6c15a6 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/example/post.js @@ -0,0 +1,43 @@ +require('../test/common'); +var http = require('http'), + util = require('util'), + formidable = require('formidable'), + server; + +server = http.createServer(function(req, res) { + if (req.url == '/') { + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + } else if (req.url == '/post') { + var form = new formidable.IncomingForm(), + fields = []; + + form + .on('error', function(err) { + res.writeHead(200, {'content-type': 'text/plain'}); + res.end('error:\n\n'+util.inspect(err)); + }) + .on('field', function(field, value) { + console.log(field, value); + fields.push([field, value]); + }) + .on('end', function() { + console.log('-> post done'); + res.writeHead(200, {'content-type': 'text/plain'}); + res.end('received fields:\n\n '+util.inspect(fields)); + }); + form.parse(req); + } else { + res.writeHead(404, {'content-type': 'text/plain'}); + res.end('404'); + } +}); +server.listen(TEST_PORT); + +console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/connect/node_modules/formidable/example/upload.js new file mode 100644 index 0000000..050cdd9 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/example/upload.js @@ -0,0 +1,48 @@ +require('../test/common'); +var http = require('http'), + util = require('util'), + formidable = require('formidable'), + server; + +server = http.createServer(function(req, res) { + if (req.url == '/') { + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + } else if (req.url == '/upload') { + var form = new formidable.IncomingForm(), + files = [], + fields = []; + + form.uploadDir = TEST_TMP; + + form + .on('field', function(field, value) { + console.log(field, value); + fields.push([field, value]); + }) + .on('file', function(field, file) { + console.log(field, file); + files.push([field, file]); + }) + .on('end', function() { + console.log('-> upload done'); + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received fields:\n\n '+util.inspect(fields)); + res.write('\n\n'); + res.end('received files:\n\n '+util.inspect(files)); + }); + form.parse(req); + } else { + res.writeHead(404, {'content-type': 'text/plain'}); + res.end('404'); + } +}); +server.listen(TEST_PORT); + +console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/connect/node_modules/formidable/index.js b/node_modules/connect/node_modules/formidable/index.js new file mode 100644 index 0000000..be41032 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/formidable'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/connect/node_modules/formidable/lib/file.js new file mode 100644 index 0000000..dad8d5f --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/file.js @@ -0,0 +1,73 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +var util = require('./util'), + WriteStream = require('fs').WriteStream, + EventEmitter = require('events').EventEmitter, + crypto = require('crypto'); + +function File(properties) { + EventEmitter.call(this); + + this.size = 0; + this.path = null; + this.name = null; + this.type = null; + this.hash = null; + this.lastModifiedDate = null; + + this._writeStream = null; + + for (var key in properties) { + this[key] = properties[key]; + } + + if(typeof this.hash === 'string') { + this.hash = crypto.createHash(properties.hash); + } + + this._backwardsCompatibility(); +} +module.exports = File; +util.inherits(File, EventEmitter); + +// @todo Next release: Show error messages when accessing these +File.prototype._backwardsCompatibility = function() { + var self = this; + this.__defineGetter__('length', function() { + return self.size; + }); + this.__defineGetter__('filename', function() { + return self.name; + }); + this.__defineGetter__('mime', function() { + return self.type; + }); +}; + +File.prototype.open = function() { + this._writeStream = new WriteStream(this.path); +}; + +File.prototype.write = function(buffer, cb) { + var self = this; + this._writeStream.write(buffer, function() { + if(self.hash) { + self.hash.update(buffer); + } + self.lastModifiedDate = new Date(); + self.size += buffer.length; + self.emit('progress', self.size); + cb(); + }); +}; + +File.prototype.end = function(cb) { + var self = this; + this._writeStream.end(function() { + if(self.hash) { + self.hash = self.hash.digest('hex'); + } + self.emit('end'); + cb(); + }); +}; diff --git a/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/connect/node_modules/formidable/lib/incoming_form.js new file mode 100644 index 0000000..060eac2 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/incoming_form.js @@ -0,0 +1,384 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +var fs = require('fs'); +var util = require('./util'), + path = require('path'), + File = require('./file'), + MultipartParser = require('./multipart_parser').MultipartParser, + QuerystringParser = require('./querystring_parser').QuerystringParser, + StringDecoder = require('string_decoder').StringDecoder, + EventEmitter = require('events').EventEmitter, + Stream = require('stream').Stream; + +function IncomingForm(opts) { + if (!(this instanceof IncomingForm)) return new IncomingForm; + EventEmitter.call(this); + + opts=opts||{}; + + this.error = null; + this.ended = false; + + this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024; + this.keepExtensions = opts.keepExtensions || false; + this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR; + this.encoding = opts.encoding || 'utf-8'; + this.headers = null; + this.type = null; + this.hash = false; + + this.bytesReceived = null; + this.bytesExpected = null; + + this._parser = null; + this._flushing = 0; + this._fieldsSize = 0; +}; +util.inherits(IncomingForm, EventEmitter); +exports.IncomingForm = IncomingForm; + +IncomingForm.UPLOAD_DIR = (function() { + var dirs = [process.env.TMP, '/tmp', process.cwd()]; + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + var isDirectory = false; + + try { + isDirectory = fs.statSync(dir).isDirectory(); + } catch (e) {} + + if (isDirectory) return dir; + } +})(); + +IncomingForm.prototype.parse = function(req, cb) { + this.pause = function() { + try { + req.pause(); + } catch (err) { + // the stream was destroyed + if (!this.ended) { + // before it was completed, crash & burn + this._error(err); + } + return false; + } + return true; + }; + + this.resume = function() { + try { + req.resume(); + } catch (err) { + // the stream was destroyed + if (!this.ended) { + // before it was completed, crash & burn + this._error(err); + } + return false; + } + + return true; + }; + + this.writeHeaders(req.headers); + + var self = this; + req + .on('error', function(err) { + self._error(err); + }) + .on('aborted', function() { + self.emit('aborted'); + }) + .on('data', function(buffer) { + self.write(buffer); + }) + .on('end', function() { + if (self.error) { + return; + } + + var err = self._parser.end(); + if (err) { + self._error(err); + } + }); + + if (cb) { + var fields = {}, files = {}; + this + .on('field', function(name, value) { + fields[name] = value; + }) + .on('file', function(name, file) { + files[name] = file; + }) + .on('error', function(err) { + cb(err, fields, files); + }) + .on('end', function() { + cb(null, fields, files); + }); + } + + return this; +}; + +IncomingForm.prototype.writeHeaders = function(headers) { + this.headers = headers; + this._parseContentLength(); + this._parseContentType(); +}; + +IncomingForm.prototype.write = function(buffer) { + if (!this._parser) { + this._error(new Error('unintialized parser')); + return; + } + + this.bytesReceived += buffer.length; + this.emit('progress', this.bytesReceived, this.bytesExpected); + + var bytesParsed = this._parser.write(buffer); + if (bytesParsed !== buffer.length) { + this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed')); + } + + return bytesParsed; +}; + +IncomingForm.prototype.pause = function() { + // this does nothing, unless overwritten in IncomingForm.parse + return false; +}; + +IncomingForm.prototype.resume = function() { + // this does nothing, unless overwritten in IncomingForm.parse + return false; +}; + +IncomingForm.prototype.onPart = function(part) { + // this method can be overwritten by the user + this.handlePart(part); +}; + +IncomingForm.prototype.handlePart = function(part) { + var self = this; + + if (part.filename === undefined) { + var value = '' + , decoder = new StringDecoder(this.encoding); + + part.on('data', function(buffer) { + self._fieldsSize += buffer.length; + if (self._fieldsSize > self.maxFieldsSize) { + self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data')); + return; + } + value += decoder.write(buffer); + }); + + part.on('end', function() { + self.emit('field', part.name, value); + }); + return; + } + + this._flushing++; + + var file = new File({ + path: this._uploadPath(part.filename), + name: part.filename, + type: part.mime, + hash: self.hash + }); + + this.emit('fileBegin', part.name, file); + + file.open(); + + part.on('data', function(buffer) { + self.pause(); + file.write(buffer, function() { + self.resume(); + }); + }); + + part.on('end', function() { + file.end(function() { + self._flushing--; + self.emit('file', part.name, file); + self._maybeEnd(); + }); + }); +}; + +IncomingForm.prototype._parseContentType = function() { + if (!this.headers['content-type']) { + this._error(new Error('bad content-type header, no content-type')); + return; + } + + if (this.headers['content-type'].match(/urlencoded/i)) { + this._initUrlencoded(); + return; + } + + if (this.headers['content-type'].match(/multipart/i)) { + var m; + if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) { + this._initMultipart(m[1] || m[2]); + } else { + this._error(new Error('bad content-type header, no multipart boundary')); + } + return; + } + + this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type'])); +}; + +IncomingForm.prototype._error = function(err) { + if (this.error) { + return; + } + + this.error = err; + this.pause(); + this.emit('error', err); +}; + +IncomingForm.prototype._parseContentLength = function() { + if (this.headers['content-length']) { + this.bytesReceived = 0; + this.bytesExpected = parseInt(this.headers['content-length'], 10); + this.emit('progress', this.bytesReceived, this.bytesExpected); + } +}; + +IncomingForm.prototype._newParser = function() { + return new MultipartParser(); +}; + +IncomingForm.prototype._initMultipart = function(boundary) { + this.type = 'multipart'; + + var parser = new MultipartParser(), + self = this, + headerField, + headerValue, + part; + + parser.initWithBoundary(boundary); + + parser.onPartBegin = function() { + part = new Stream(); + part.readable = true; + part.headers = {}; + part.name = null; + part.filename = null; + part.mime = null; + headerField = ''; + headerValue = ''; + }; + + parser.onHeaderField = function(b, start, end) { + headerField += b.toString(self.encoding, start, end); + }; + + parser.onHeaderValue = function(b, start, end) { + headerValue += b.toString(self.encoding, start, end); + }; + + parser.onHeaderEnd = function() { + headerField = headerField.toLowerCase(); + part.headers[headerField] = headerValue; + + var m; + if (headerField == 'content-disposition') { + if (m = headerValue.match(/name="([^"]+)"/i)) { + part.name = m[1]; + } + + part.filename = self._fileName(headerValue); + } else if (headerField == 'content-type') { + part.mime = headerValue; + } + + headerField = ''; + headerValue = ''; + }; + + parser.onHeadersEnd = function() { + self.onPart(part); + }; + + parser.onPartData = function(b, start, end) { + part.emit('data', b.slice(start, end)); + }; + + parser.onPartEnd = function() { + part.emit('end'); + }; + + parser.onEnd = function() { + self.ended = true; + self._maybeEnd(); + }; + + this._parser = parser; +}; + +IncomingForm.prototype._fileName = function(headerValue) { + var m = headerValue.match(/filename="(.*?)"($|; )/i) + if (!m) return; + + var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); + filename = filename.replace(/%22/g, '"'); + filename = filename.replace(/&#([\d]{4});/g, function(m, code) { + return String.fromCharCode(code); + }); + return filename; +}; + +IncomingForm.prototype._initUrlencoded = function() { + this.type = 'urlencoded'; + + var parser = new QuerystringParser() + , self = this; + + parser.onField = function(key, val) { + self.emit('field', key, val); + }; + + parser.onEnd = function() { + self.ended = true; + self._maybeEnd(); + }; + + this._parser = parser; +}; + +IncomingForm.prototype._uploadPath = function(filename) { + var name = ''; + for (var i = 0; i < 32; i++) { + name += Math.floor(Math.random() * 16).toString(16); + } + + if (this.keepExtensions) { + var ext = path.extname(filename); + ext = ext.replace(/(\.[a-z0-9]+).*/, '$1') + + name += ext; + } + + return path.join(this.uploadDir, name); +}; + +IncomingForm.prototype._maybeEnd = function() { + if (!this.ended || this._flushing) { + return; + } + + this.emit('end'); +}; diff --git a/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/connect/node_modules/formidable/lib/index.js new file mode 100644 index 0000000..7a6e3e1 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/index.js @@ -0,0 +1,3 @@ +var IncomingForm = require('./incoming_form').IncomingForm; +IncomingForm.IncomingForm = IncomingForm; +module.exports = IncomingForm; diff --git a/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/connect/node_modules/formidable/lib/multipart_parser.js new file mode 100644 index 0000000..9ca567c --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/multipart_parser.js @@ -0,0 +1,312 @@ +var Buffer = require('buffer').Buffer, + s = 0, + S = + { PARSER_UNINITIALIZED: s++, + START: s++, + START_BOUNDARY: s++, + HEADER_FIELD_START: s++, + HEADER_FIELD: s++, + HEADER_VALUE_START: s++, + HEADER_VALUE: s++, + HEADER_VALUE_ALMOST_DONE: s++, + HEADERS_ALMOST_DONE: s++, + PART_DATA_START: s++, + PART_DATA: s++, + PART_END: s++, + END: s++, + }, + + f = 1, + F = + { PART_BOUNDARY: f, + LAST_BOUNDARY: f *= 2, + }, + + LF = 10, + CR = 13, + SPACE = 32, + HYPHEN = 45, + COLON = 58, + A = 97, + Z = 122, + + lower = function(c) { + return c | 0x20; + }; + +for (var s in S) { + exports[s] = S[s]; +} + +function MultipartParser() { + this.boundary = null; + this.boundaryChars = null; + this.lookbehind = null; + this.state = S.PARSER_UNINITIALIZED; + + this.index = null; + this.flags = 0; +}; +exports.MultipartParser = MultipartParser; + +MultipartParser.stateToString = function(stateNumber) { + for (var state in S) { + var number = S[state]; + if (number === stateNumber) return state; + } +}; + +MultipartParser.prototype.initWithBoundary = function(str) { + this.boundary = new Buffer(str.length+4); + this.boundary.write('\r\n--', 'ascii', 0); + this.boundary.write(str, 'ascii', 4); + this.lookbehind = new Buffer(this.boundary.length+8); + this.state = S.START; + + this.boundaryChars = {}; + for (var i = 0; i < this.boundary.length; i++) { + this.boundaryChars[this.boundary[i]] = true; + } +}; + +MultipartParser.prototype.write = function(buffer) { + var self = this, + i = 0, + len = buffer.length, + prevIndex = this.index, + index = this.index, + state = this.state, + flags = this.flags, + lookbehind = this.lookbehind, + boundary = this.boundary, + boundaryChars = this.boundaryChars, + boundaryLength = this.boundary.length, + boundaryEnd = boundaryLength - 1, + bufferLength = buffer.length, + c, + cl, + + mark = function(name) { + self[name+'Mark'] = i; + }, + clear = function(name) { + delete self[name+'Mark']; + }, + callback = function(name, buffer, start, end) { + if (start !== undefined && start === end) { + return; + } + + var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1); + if (callbackSymbol in self) { + self[callbackSymbol](buffer, start, end); + } + }, + dataCallback = function(name, clear) { + var markSymbol = name+'Mark'; + if (!(markSymbol in self)) { + return; + } + + if (!clear) { + callback(name, buffer, self[markSymbol], buffer.length); + self[markSymbol] = 0; + } else { + callback(name, buffer, self[markSymbol], i); + delete self[markSymbol]; + } + }; + + for (i = 0; i < len; i++) { + c = buffer[i]; + switch (state) { + case S.PARSER_UNINITIALIZED: + return i; + case S.START: + index = 0; + state = S.START_BOUNDARY; + case S.START_BOUNDARY: + if (index == boundary.length - 2) { + if (c != CR) { + return i; + } + index++; + break; + } else if (index - 1 == boundary.length - 2) { + if (c != LF) { + return i; + } + index = 0; + callback('partBegin'); + state = S.HEADER_FIELD_START; + break; + } + + if (c != boundary[index+2]) { + return i; + } + index++; + break; + case S.HEADER_FIELD_START: + state = S.HEADER_FIELD; + mark('headerField'); + index = 0; + case S.HEADER_FIELD: + if (c == CR) { + clear('headerField'); + state = S.HEADERS_ALMOST_DONE; + break; + } + + index++; + if (c == HYPHEN) { + break; + } + + if (c == COLON) { + if (index == 1) { + // empty header field + return i; + } + dataCallback('headerField', true); + state = S.HEADER_VALUE_START; + break; + } + + cl = lower(c); + if (cl < A || cl > Z) { + return i; + } + break; + case S.HEADER_VALUE_START: + if (c == SPACE) { + break; + } + + mark('headerValue'); + state = S.HEADER_VALUE; + case S.HEADER_VALUE: + if (c == CR) { + dataCallback('headerValue', true); + callback('headerEnd'); + state = S.HEADER_VALUE_ALMOST_DONE; + } + break; + case S.HEADER_VALUE_ALMOST_DONE: + if (c != LF) { + return i; + } + state = S.HEADER_FIELD_START; + break; + case S.HEADERS_ALMOST_DONE: + if (c != LF) { + return i; + } + + callback('headersEnd'); + state = S.PART_DATA_START; + break; + case S.PART_DATA_START: + state = S.PART_DATA + mark('partData'); + case S.PART_DATA: + prevIndex = index; + + if (index == 0) { + // boyer-moore derrived algorithm to safely skip non-boundary data + i += boundaryEnd; + while (i < bufferLength && !(buffer[i] in boundaryChars)) { + i += boundaryLength; + } + i -= boundaryEnd; + c = buffer[i]; + } + + if (index < boundary.length) { + if (boundary[index] == c) { + if (index == 0) { + dataCallback('partData', true); + } + index++; + } else { + index = 0; + } + } else if (index == boundary.length) { + index++; + if (c == CR) { + // CR = part boundary + flags |= F.PART_BOUNDARY; + } else if (c == HYPHEN) { + // HYPHEN = end boundary + flags |= F.LAST_BOUNDARY; + } else { + index = 0; + } + } else if (index - 1 == boundary.length) { + if (flags & F.PART_BOUNDARY) { + index = 0; + if (c == LF) { + // unset the PART_BOUNDARY flag + flags &= ~F.PART_BOUNDARY; + callback('partEnd'); + callback('partBegin'); + state = S.HEADER_FIELD_START; + break; + } + } else if (flags & F.LAST_BOUNDARY) { + if (c == HYPHEN) { + callback('partEnd'); + callback('end'); + state = S.END; + } else { + index = 0; + } + } else { + index = 0; + } + } + + if (index > 0) { + // when matching a possible boundary, keep a lookbehind reference + // in case it turns out to be a false lead + lookbehind[index-1] = c; + } else if (prevIndex > 0) { + // if our boundary turned out to be rubbish, the captured lookbehind + // belongs to partData + callback('partData', lookbehind, 0, prevIndex); + prevIndex = 0; + mark('partData'); + + // reconsider the current character even so it interrupted the sequence + // it could be the beginning of a new sequence + i--; + } + + break; + case S.END: + break; + default: + return i; + } + } + + dataCallback('headerField'); + dataCallback('headerValue'); + dataCallback('partData'); + + this.index = index; + this.state = state; + this.flags = flags; + + return len; +}; + +MultipartParser.prototype.end = function() { + if (this.state != S.END) { + return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain()); + } +}; + +MultipartParser.prototype.explain = function() { + return 'state = ' + MultipartParser.stateToString(this.state); +}; diff --git a/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/connect/node_modules/formidable/lib/querystring_parser.js new file mode 100644 index 0000000..63f109e --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/querystring_parser.js @@ -0,0 +1,25 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +// This is a buffering parser, not quite as nice as the multipart one. +// If I find time I'll rewrite this to be fully streaming as well +var querystring = require('querystring'); + +function QuerystringParser() { + this.buffer = ''; +}; +exports.QuerystringParser = QuerystringParser; + +QuerystringParser.prototype.write = function(buffer) { + this.buffer += buffer.toString('ascii'); + return buffer.length; +}; + +QuerystringParser.prototype.end = function() { + var fields = querystring.parse(this.buffer); + for (var field in fields) { + this.onField(field, fields[field]); + } + this.buffer = ''; + + this.onEnd(); +}; \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/connect/node_modules/formidable/lib/util.js new file mode 100644 index 0000000..e9493e9 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/lib/util.js @@ -0,0 +1,6 @@ +// Backwards compatibility ... +try { + module.exports = require('util'); +} catch (e) { + module.exports = require('sys'); +} diff --git a/node_modules/connect/node_modules/formidable/node-gently/Makefile b/node_modules/connect/node_modules/formidable/node-gently/Makefile new file mode 100644 index 0000000..01f7140 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/Makefile @@ -0,0 +1,4 @@ +test: + @find test/simple/test-*.js | xargs -n 1 -t node + +.PHONY: test \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/Readme.md b/node_modules/connect/node_modules/formidable/node-gently/Readme.md new file mode 100644 index 0000000..f8f0c66 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/Readme.md @@ -0,0 +1,167 @@ +# Gently + +## Purpose + +A node.js module that helps with stubbing and behavior verification. It allows you to test the most remote and nested corners of your code while keeping being fully unobtrusive. + +## Features + +* Overwrite and stub individual object functions +* Verify that all expected calls have been made in the expected order +* Restore stubbed functions to their original behavior +* Detect object / class names from obj.constructor.name and obj.toString() +* Hijack any required module function or class constructor + +## Installation + +Via [npm](http://github.com/isaacs/npm): + + npm install gently@latest + +## Example + +Make sure your dog is working properly: + + function Dog() {} + + Dog.prototype.seeCat = function() { + this.bark('whuf, whuf'); + this.run(); + } + + Dog.prototype.bark = function(bark) { + require('sys').puts(bark); + } + + var gently = new (require('gently')) + , assert = require('assert') + , dog = new Dog(); + + gently.expect(dog, 'bark', function(bark) { + assert.equal(bark, 'whuf, whuf'); + }); + gently.expect(dog, 'run'); + + dog.seeCat(); + +You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by `fs.WriteStream`: + + var gently = new (require('gently')) + , stream = new (require('fs').WriteStream)('my_file.txt'); + + gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'open'); + }); + + gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'drain'); + }); + +For a full read world example, check out this test case: [test-incoming-form.js](http://github.com/felixge/node-formidable/blob/master/test/simple/test-incoming-form.js) (in [node-formdiable](http://github.com/felixge/node-formidable)). + +## API + +### Gently + +#### new Gently() + +Creates a new gently instance. It listens to the process `'exit'` event to make sure all expectations have been verified. + +#### gently.expect(obj, method, [[count], stubFn]) + +Creates an expectation for an objects method to be called. You can optionally specify the call `count` you are expecting, as well as `stubFn` function that will run instead of the original function. + +Returns a reference to the function that is getting overwritten. + +#### gently.expect([count], stubFn) + +Returns a function that is supposed to be executed `count` times, delegating any calls to the provided `stubFn` function. Naming your stubFn closure will help to properly diagnose errors that are being thrown: + + childProcess.exec('ls', gently.expect(function lsCallback(code) { + assert.equal(0, code); + })); + +#### gently.restore(obj, method) + +Restores an object method that has been previously overwritten using `gently.expect()`. + +#### gently.hijack(realRequire) + +Returns a new require functions that catches a reference to all required modules into `gently.hijacked`. + +To use this function, include a line like this in your `'my-module.js'`. + + if (global.GENTLY) require = GENTLY.hijack(require); + + var sys = require('sys'); + exports.hello = function() { + sys.log('world'); + }; + +Now you can write a test for the module above: + + var gently = global.GENTLY = new (require('gently')) + , myModule = require('./my-module'); + + gently.expect(gently.hijacked.sys, 'log', function(str) { + assert.equal(str, 'world'); + }); + + myModule.hello(); + +#### gently.stub(location, [exportsName]) + +Returns a stub class that will be used instead of the real class from the module at `location` with the given `exportsName`. + +This allows to test an OOP version of the previous example, where `'my-module.js'`. + + if (global.GENTLY) require = GENTLY.hijack(require); + + var World = require('./world'); + + exports.hello = function() { + var world = new World(); + world.hello(); + } + +And `world.js` looks like this: + + var sys = require('sys'); + + function World() { + + } + module.exports = World; + + World.prototype.hello = function() { + sys.log('world'); + }; + +Testing `'my-module.js'` can now easily be accomplished: + + var gently = global.GENTLY = new (require('gently')) + , WorldStub = gently.stub('./world') + , myModule = require('./my-module') + , WORLD; + + gently.expect(WorldStub, 'new', function() { + WORLD = this; + }); + + gently.expect(WORLD, 'hello'); + + myModule.hello(); + +#### gently.hijacked + +An object that holds the references to all hijacked modules. + +#### gently.verify([msg]) + +Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process `'exit'` event is fired. + +If `msg` is given, it will appear in any error that might be thrown. + +## License + +Gently is licensed under the MIT license. \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/example/dog.js b/node_modules/connect/node_modules/formidable/node-gently/example/dog.js new file mode 100644 index 0000000..022fae0 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/example/dog.js @@ -0,0 +1,22 @@ +require('../test/common'); +function Dog() {} + +Dog.prototype.seeCat = function() { + this.bark('whuf, whuf'); + this.run(); +} + +Dog.prototype.bark = function(bark) { + require('sys').puts(bark); +} + +var gently = new (require('gently')) + , assert = require('assert') + , dog = new Dog(); + +gently.expect(dog, 'bark', function(bark) { + assert.equal(bark, 'whuf, whuf'); +}); +gently.expect(dog, 'run'); + +dog.seeCat(); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js b/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js new file mode 100644 index 0000000..7def134 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js @@ -0,0 +1,11 @@ +require('../test/common'); +var gently = new (require('gently')) + , stream = new (require('fs').WriteStream)('my_file.txt'); + +gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'open'); +}); + +gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'drain'); +}); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/index.js b/node_modules/connect/node_modules/formidable/node-gently/index.js new file mode 100644 index 0000000..69122bd --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/gently'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js b/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js new file mode 100644 index 0000000..8af0e1e --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js @@ -0,0 +1,184 @@ +var path = require('path'); + +function Gently() { + this.expectations = []; + this.hijacked = {}; + + var self = this; + process.addListener('exit', function() { + self.verify('process exit'); + }); +}; +module.exports = Gently; + +Gently.prototype.stub = function(location, exportsName) { + function Stub() { + return Stub['new'].apply(this, arguments); + }; + + Stub['new'] = function () {}; + + var stubName = 'require('+JSON.stringify(location)+')'; + if (exportsName) { + stubName += '.'+exportsName; + } + + Stub.prototype.toString = Stub.toString = function() { + return stubName; + }; + + var exports = this.hijacked[location] || {}; + if (exportsName) { + exports[exportsName] = Stub; + } else { + exports = Stub; + } + + this.hijacked[location] = exports; + return Stub; +}; + +Gently.prototype.hijack = function(realRequire) { + var self = this; + return function(location) { + return self.hijacked[location] = (self.hijacked[location]) + ? self.hijacked[location] + : realRequire(location); + }; +}; + +Gently.prototype.expect = function(obj, method, count, stubFn) { + if (typeof obj != 'function' && typeof obj != 'object' && typeof obj != 'number') { + throw new Error + ( 'Bad 1st argument for gently.expect(), ' + + 'object, function, or number expected, got: '+(typeof obj) + ); + } else if (typeof obj == 'function' && (typeof method != 'string')) { + // expect(stubFn) interface + stubFn = obj; + obj = null; + method = null; + count = 1; + } else if (typeof method == 'function') { + // expect(count, stubFn) interface + count = obj; + stubFn = method; + obj = null; + method = null; + } else if (typeof count == 'function') { + // expect(obj, method, stubFn) interface + stubFn = count; + count = 1; + } else if (count === undefined) { + // expect(obj, method) interface + count = 1; + } + + var name = this._name(obj, method, stubFn); + this.expectations.push({obj: obj, method: method, stubFn: stubFn, name: name, count: count}); + + var self = this; + function delegate() { + return self._stubFn(this, obj, method, name, Array.prototype.slice.call(arguments)); + } + + if (!obj) { + return delegate; + } + + var original = (obj[method]) + ? obj[method]._original || obj[method] + : undefined; + + obj[method] = delegate; + return obj[method]._original = original; +}; + +Gently.prototype.restore = function(obj, method) { + if (!obj[method] || !obj[method]._original) { + throw new Error(this._name(obj, method)+' is not gently stubbed'); + } + obj[method] = obj[method]._original; +}; + +Gently.prototype.verify = function(msg) { + if (!this.expectations.length) { + return; + } + + var validExpectations = []; + for (var i = 0, l = this.expectations.length; i < l; i++) { + var expectation = this.expectations[i]; + + if (expectation.count > 0) { + validExpectations.push(expectation); + } + } + + this.expectations = []; // reset so that no duplicate verification attempts are made + + if (!validExpectations.length) { + return; + } + + var expectation = validExpectations[0]; + + throw new Error + ( 'Expected call to '+expectation.name+' did not happen' + + ( (msg) + ? ' ('+msg+')' + : '' + ) + ); +}; + +Gently.prototype._stubFn = function(self, obj, method, name, args) { + var expectation = this.expectations[0], obj, method; + + if (!expectation) { + throw new Error('Unexpected call to '+name+', no call was expected'); + } + + if (expectation.obj !== obj || expectation.method !== method) { + throw new Error('Unexpected call to '+name+', expected call to '+ expectation.name); + } + + expectation.count -= 1; + if (expectation.count === 0) { + this.expectations.shift(); + + // autorestore original if its not a closure + // and no more expectations on that object + var has_more_expectations = this.expectations.reduce(function (memo, expectation) { + return memo || (expectation.obj === obj && expectation.method === method); + }, false); + if (obj !== null && method !== null && !has_more_expectations) { + if (typeof obj[method]._original !== 'undefined') { + obj[method] = obj[method]._original; + delete obj[method]._original; + } else { + delete obj[method]; + } + } + } + + if (expectation.stubFn) { + return expectation.stubFn.apply(self, args); + } +}; + +Gently.prototype._name = function(obj, method, stubFn) { + if (obj) { + var objectName = obj.toString(); + if (objectName == '[object Object]' && obj.constructor.name) { + objectName = '['+obj.constructor.name+']'; + } + return (objectName)+'.'+method+'()'; + } + + if (stubFn.name) { + return stubFn.name+'()'; + } + + return '>> '+stubFn.toString()+' <<'; +}; diff --git a/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js b/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js new file mode 100644 index 0000000..64c1977 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js @@ -0,0 +1 @@ +module.exports = require('./gently'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/package.json b/node_modules/connect/node_modules/formidable/node-gently/package.json new file mode 100644 index 0000000..9c1b7a0 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/package.json @@ -0,0 +1,14 @@ +{ + "name": "gently", + "version": "0.9.2", + "directories": { + "lib": "./lib/gently" + }, + "main": "./lib/gently/index", + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": "*" + }, + "optionalDependencies": {} +} diff --git a/node_modules/connect/node_modules/formidable/node-gently/test/common.js b/node_modules/connect/node_modules/formidable/node-gently/test/common.js new file mode 100644 index 0000000..978b5c5 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/test/common.js @@ -0,0 +1,8 @@ +var path = require('path') + , sys = require('sys'); + +require.paths.unshift(path.dirname(__dirname)+'/lib'); + +global.puts = sys.puts; +global.p = function() {sys.error(sys.inspect.apply(null, arguments))};; +global.assert = require('assert'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js b/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js new file mode 100644 index 0000000..4f8fe2d --- /dev/null +++ b/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js @@ -0,0 +1,348 @@ +require('../common'); +var Gently = require('gently') + , gently; + +function test(test) { + process.removeAllListeners('exit'); + gently = new Gently(); + test(); +} + +test(function constructor() { + assert.deepEqual(gently.expectations, []); + assert.deepEqual(gently.hijacked, {}); + assert.equal(gently.constructor.name, 'Gently'); +}); + +test(function expectBadArgs() { + var BAD_ARG = 'oh no'; + try { + gently.expect(BAD_ARG); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Bad 1st argument for gently.expect(), object, function, or number expected, got: '+(typeof BAD_ARG)); + } +}); + +test(function expectObjMethod() { + var OBJ = {}, NAME = 'foobar'; + OBJ.foo = function(x) { + return x; + }; + + gently._name = function() { + return NAME; + }; + + var original = OBJ.foo + , stubFn = function() {}; + + (function testAddOne() { + assert.strictEqual(gently.expect(OBJ, 'foo', stubFn), original); + + assert.equal(gently.expectations.length, 1); + var expectation = gently.expectations[0]; + assert.strictEqual(expectation.obj, OBJ); + assert.strictEqual(expectation.method, 'foo'); + assert.strictEqual(expectation.stubFn, stubFn); + assert.strictEqual(expectation.name, NAME); + assert.strictEqual(OBJ.foo._original, original); + })(); + + (function testAddTwo() { + gently.expect(OBJ, 'foo', 2, stubFn); + assert.equal(gently.expectations.length, 2); + assert.strictEqual(OBJ.foo._original, original); + })(); + + (function testAddOneWithoutMock() { + gently.expect(OBJ, 'foo'); + assert.equal(gently.expectations.length, 3); + })(); + + var stubFnCalled = 0, SELF = {}; + gently._stubFn = function(self, obj, method, name, args) { + stubFnCalled++; + assert.strictEqual(self, SELF); + assert.strictEqual(obj, OBJ); + assert.strictEqual(method, 'foo'); + assert.strictEqual(name, NAME); + assert.deepEqual(args, [1, 2]); + return 23; + }; + assert.equal(OBJ.foo.apply(SELF, [1, 2]), 23); + assert.equal(stubFnCalled, 1); +}); + +test(function expectClosure() { + var NAME = 'MY CLOSURE'; + function closureFn() {}; + + gently._name = function() { + return NAME; + }; + + var fn = gently.expect(closureFn); + assert.equal(gently.expectations.length, 1); + var expectation = gently.expectations[0]; + assert.strictEqual(expectation.obj, null); + assert.strictEqual(expectation.method, null); + assert.strictEqual(expectation.stubFn, closureFn); + assert.strictEqual(expectation.name, NAME); + + var stubFnCalled = 0, SELF = {}; + gently._stubFn = function(self, obj, method, name, args) { + stubFnCalled++; + assert.strictEqual(self, SELF); + assert.strictEqual(obj, null); + assert.strictEqual(method, null); + assert.strictEqual(name, NAME); + assert.deepEqual(args, [1, 2]); + return 23; + }; + assert.equal(fn.apply(SELF, [1, 2]), 23); + assert.equal(stubFnCalled, 1); +}); + +test(function expectClosureCount() { + var stubFnCalled = 0; + function closureFn() {stubFnCalled++}; + + var fn = gently.expect(2, closureFn); + assert.equal(gently.expectations.length, 1); + fn(); + assert.equal(gently.expectations.length, 1); + fn(); + assert.equal(stubFnCalled, 2); +}); + +test(function restore() { + var OBJ = {}, NAME = '[my object].myFn()'; + OBJ.foo = function(x) { + return x; + }; + + gently._name = function() { + return NAME; + }; + + var original = OBJ.foo; + gently.expect(OBJ, 'foo'); + gently.restore(OBJ, 'foo'); + assert.strictEqual(OBJ.foo, original); + + (function testError() { + try { + gently.restore(OBJ, 'foo'); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, NAME+' is not gently stubbed'); + } + })(); +}); + +test(function _stubFn() { + var OBJ1 = {toString: function() {return '[OBJ 1]'}} + , OBJ2 = {toString: function() {return '[OBJ 2]'}, foo: function () {return 'bar';}} + , SELF = {}; + + gently.expect(OBJ1, 'foo', function(x) { + assert.strictEqual(this, SELF); + return x * 2; + }); + + assert.equal(gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]), 10); + + (function testAutorestore() { + assert.equal(OBJ2.foo(), 'bar'); + + gently.expect(OBJ2, 'foo', function() { + return 'stubbed foo'; + }); + + gently.expect(OBJ2, 'foo', function() { + return "didn't restore yet"; + }); + + assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), 'stubbed foo'); + assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), "didn't restore yet"); + assert.equal(OBJ2.foo(), 'bar'); + assert.deepEqual(gently.expectations, []); + })(); + + (function testNoMoreCallExpected() { + try { + gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Unexpected call to dummy_name, no call was expected'); + } + })(); + + (function testDifferentCallExpected() { + gently.expect(OBJ2, 'bar'); + try { + gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Unexpected call to dummy_name, expected call to '+gently._name(OBJ2, 'bar')); + } + + assert.equal(gently.expectations.length, 1); + })(); + + (function testNoMockCallback() { + OBJ2.bar(); + assert.equal(gently.expectations.length, 0); + })(); +}); + +test(function stub() { + var LOCATION = './my_class'; + + (function testRegular() { + var Stub = gently.stub(LOCATION); + assert.ok(Stub instanceof Function); + assert.strictEqual(gently.hijacked[LOCATION], Stub); + assert.ok(Stub['new'] instanceof Function); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); + + (function testConstructor() { + var newCalled = 0 + , STUB + , ARGS = ['foo', 'bar']; + + Stub['new'] = function(a, b) { + assert.equal(a, ARGS[0]); + assert.equal(b, ARGS[1]); + newCalled++; + STUB = this; + }; + + var stub = new Stub(ARGS[0], ARGS[1]); + assert.strictEqual(stub, STUB); + assert.equal(newCalled, 1); + assert.equal(stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); + })(); + + (function testUseReturnValueAsInstance() { + var R = {}; + + Stub['new'] = function() { + return R; + }; + + var stub = new Stub(); + assert.strictEqual(stub, R); + + })(); + })(); + + var EXPORTS_NAME = 'MyClass'; + test(function testExportsName() { + var Stub = gently.stub(LOCATION, EXPORTS_NAME); + assert.strictEqual(gently.hijacked[LOCATION][EXPORTS_NAME], Stub); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); + + (function testConstructor() { + var stub = new Stub(); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); + })(); + }); +}); + +test(function hijack() { + var LOCATION = './foo' + , REQUIRE_CALLS = 0 + , EXPORTS = {} + , REQUIRE = function() { + REQUIRE_CALLS++; + return EXPORTS; + }; + + var hijackedRequire = gently.hijack(REQUIRE); + hijackedRequire(LOCATION); + assert.strictEqual(gently.hijacked[LOCATION], EXPORTS); + + assert.equal(REQUIRE_CALLS, 1); + + // make sure we are caching the hijacked module + hijackedRequire(LOCATION); + assert.equal(REQUIRE_CALLS, 1); +}); + +test(function verify() { + var OBJ = {toString: function() {return '[OBJ]'}}; + gently.verify(); + + gently.expect(OBJ, 'foo'); + try { + gently.verify(); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen'); + } + + try { + gently.verify('foo'); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen (foo)'); + } +}); + +test(function processExit() { + var verifyCalled = 0; + gently.verify = function(msg) { + verifyCalled++; + assert.equal(msg, 'process exit'); + }; + + process.emit('exit'); + assert.equal(verifyCalled, 1); +}); + +test(function _name() { + (function testNamedClass() { + function Foo() {}; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), '[Foo].bar()'); + })(); + + (function testToStringPreference() { + function Foo() {}; + Foo.prototype.toString = function() { + return '[Superman 123]'; + }; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), '[Superman 123].bar()'); + })(); + + (function testUnamedClass() { + var Foo = function() {}; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), foo.toString()+'.bar()'); + })(); + + (function testNamedClosure() { + function myClosure() {}; + assert.equal(gently._name(null, null, myClosure), myClosure.name+'()'); + })(); + + (function testUnamedClosure() { + var myClosure = function() {2+2 == 5}; + assert.equal(gently._name(null, null, myClosure), '>> '+myClosure.toString()+' <<'); + })(); +}); + +test(function verifyExpectNone() { + var OBJ = {toString: function() {return '[OBJ]'}}; + gently.verify(); + + gently.expect(OBJ, 'foo', 0); + try { + gently.verify(); + } catch (e) { + assert.fail('Exception should not have been thrown'); + } +}); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/package.json b/node_modules/connect/node_modules/formidable/package.json new file mode 100644 index 0000000..4d94297 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/package.json @@ -0,0 +1,23 @@ +{ + "name": "formidable", + "version": "1.0.11", + "dependencies": {}, + "devDependencies": { + "gently": "0.8.0", + "findit": "0.1.1", + "hashish": "0.0.4", + "urun": "0.0.4", + "utest": "0.0.3" + }, + "directories": { + "lib": "./lib" + }, + "main": "./lib/index", + "scripts": { + "test": "make test" + }, + "engines": { + "node": "*" + }, + "optionalDependencies": {} +} diff --git a/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/connect/node_modules/formidable/test/common.js new file mode 100644 index 0000000..eb432ad --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/common.js @@ -0,0 +1,19 @@ +var mysql = require('..'); +var path = require('path'); + +var root = path.join(__dirname, '../'); +exports.dir = { + root : root, + lib : root + '/lib', + fixture : root + '/test/fixture', + tmp : root + '/test/tmp', +}; + +exports.port = 13532; + +exports.formidable = require('..'); +exports.assert = require('assert'); + +exports.require = function(lib) { + return require(exports.dir.lib + '/' + lib); +}; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt new file mode 100644 index 0000000..e7a4785 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt @@ -0,0 +1 @@ +I am a text file with a funky name! diff --git a/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt new file mode 100644 index 0000000..9b6903e --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt @@ -0,0 +1 @@ +I am a plain text file diff --git a/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md new file mode 100644 index 0000000..3c9dbe3 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md @@ -0,0 +1,3 @@ +* Opera does not allow submitting this file, it shows a warning to the + user that the file could not be found instead. Tested in 9.8, 11.51 on OSX. + Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com). diff --git a/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js new file mode 100644 index 0000000..0bae449 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js @@ -0,0 +1,3 @@ +module.exports['generic.http'] = [ + {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'}, +]; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js new file mode 100644 index 0000000..eb76fdc --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js @@ -0,0 +1,21 @@ +var properFilename = 'funkyfilename.txt'; + +function expect(filename) { + return [ + {type: 'field', name: 'title', value: 'Weird filename'}, + {type: 'file', name: 'upload', filename: filename, fixture: properFilename}, + ]; +}; + +var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; +var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; + +module.exports = { + 'osx-chrome-13.http' : expect(webkit), + 'osx-firefox-3.6.http' : expect(ffOrIe), + 'osx-safari-5.http' : expect(webkit), + 'xp-chrome-12.http' : expect(webkit), + 'xp-ie-7.http' : expect(ffOrIe), + 'xp-ie-8.http' : expect(ffOrIe), + 'xp-safari-5.http' : expect(webkit), +}; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/connect/node_modules/formidable/test/fixture/multipart.js new file mode 100644 index 0000000..a476169 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/fixture/multipart.js @@ -0,0 +1,72 @@ +exports['rfc1867'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--\r\n', + parts: + [ { headers: { + 'content-disposition': 'form-data; name="field1"', + }, + data: 'Joe Blow\r\nalmost tricked you!', + }, + { headers: { + 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', + 'Content-Type': 'text/plain', + }, + data: '... contents of file1.txt ...\r', + } + ] + }; + +exports['noTrailing\r\n'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--', + parts: + [ { headers: { + 'content-disposition': 'form-data; name="field1"', + }, + data: 'Joe Blow\r\nalmost tricked you!', + }, + { headers: { + 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', + 'Content-Type': 'text/plain', + }, + data: '... contents of file1.txt ...\r', + } + ] + }; + +exports['emptyHeader'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + ': foo\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--\r\n', + expectError: true, + }; diff --git a/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js new file mode 100644 index 0000000..66ad259 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js @@ -0,0 +1,89 @@ +var hashish = require('hashish'); +var fs = require('fs'); +var findit = require('findit'); +var path = require('path'); +var http = require('http'); +var net = require('net'); +var assert = require('assert'); + +var common = require('../common'); +var formidable = common.formidable; + +var server = http.createServer(); +server.listen(common.port, findFixtures); + +function findFixtures() { + var fixtures = []; + findit + .sync(common.dir.fixture + '/js') + .forEach(function(jsPath) { + if (!/\.js$/.test(jsPath)) return; + + var group = path.basename(jsPath, '.js'); + hashish.forEach(require(jsPath), function(fixture, name) { + fixtures.push({ + name : group + '/' + name, + fixture : fixture, + }); + }); + }); + + testNext(fixtures); +} + +function testNext(fixtures) { + var fixture = fixtures.shift(); + if (!fixture) return server.close(); + + var name = fixture.name; + var fixture = fixture.fixture; + + uploadFixture(name, function(err, parts) { + if (err) throw err; + + fixture.forEach(function(expectedPart, i) { + var parsedPart = parts[i]; + assert.equal(parsedPart.type, expectedPart.type); + assert.equal(parsedPart.name, expectedPart.name); + + if (parsedPart.type === 'file') { + var filename = parsedPart.value.name; + assert.equal(filename, expectedPart.filename); + } + }); + + testNext(fixtures); + }); +}; + +function uploadFixture(name, cb) { + server.once('request', function(req, res) { + var form = new formidable.IncomingForm(); + form.uploadDir = common.dir.tmp; + form.parse(req); + + function callback() { + var realCallback = cb; + cb = function() {}; + realCallback.apply(null, arguments); + } + + var parts = []; + form + .on('error', callback) + .on('fileBegin', function(name, value) { + parts.push({type: 'file', name: name, value: value}); + }) + .on('field', function(name, value) { + parts.push({type: 'field', name: name, value: value}); + }) + .on('end', function() { + callback(null, parts); + }); + }); + + var socket = net.createConnection(common.port); + var file = fs.createReadStream(common.dir.fixture + '/http/' + name); + + file.pipe(socket); +} diff --git a/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/connect/node_modules/formidable/test/legacy/common.js new file mode 100644 index 0000000..2b98598 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/common.js @@ -0,0 +1,24 @@ +var path = require('path'), + fs = require('fs'); + +try { + global.Gently = require('gently'); +} catch (e) { + throw new Error('this test suite requires node-gently'); +} + +exports.lib = path.join(__dirname, '../../lib'); + +global.GENTLY = new Gently(); + +global.assert = require('assert'); +global.TEST_PORT = 13532; +global.TEST_FIXTURES = path.join(__dirname, '../fixture'); +global.TEST_TMP = path.join(__dirname, '../tmp'); + +// Stupid new feature in node that complains about gently attaching too many +// listeners to process 'exit'. This is a workaround until I can think of a +// better way to deal with this. +if (process.setMaxListeners) { + process.setMaxListeners(10000); +} diff --git a/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js new file mode 100644 index 0000000..75232aa --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js @@ -0,0 +1,80 @@ +var common = require('../common'); +var CHUNK_LENGTH = 10, + multipartParser = require(common.lib + '/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + parser = new MultipartParser(), + fixtures = require(TEST_FIXTURES + '/multipart'), + Buffer = require('buffer').Buffer; + +Object.keys(fixtures).forEach(function(name) { + var fixture = fixtures[name], + buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')), + offset = 0, + chunk, + nparsed, + + parts = [], + part = null, + headerField, + headerValue, + endCalled = ''; + + parser.initWithBoundary(fixture.boundary); + parser.onPartBegin = function() { + part = {headers: {}, data: ''}; + parts.push(part); + headerField = ''; + headerValue = ''; + }; + + parser.onHeaderField = function(b, start, end) { + headerField += b.toString('ascii', start, end); + }; + + parser.onHeaderValue = function(b, start, end) { + headerValue += b.toString('ascii', start, end); + } + + parser.onHeaderEnd = function() { + part.headers[headerField] = headerValue; + headerField = ''; + headerValue = ''; + }; + + parser.onPartData = function(b, start, end) { + var str = b.toString('ascii', start, end); + part.data += b.slice(start, end); + } + + parser.onEnd = function() { + endCalled = true; + } + + buffer.write(fixture.raw, 'binary', 0); + + while (offset < buffer.length) { + if (offset + CHUNK_LENGTH < buffer.length) { + chunk = buffer.slice(offset, offset+CHUNK_LENGTH); + } else { + chunk = buffer.slice(offset, buffer.length); + } + offset = offset + CHUNK_LENGTH; + + nparsed = parser.write(chunk); + if (nparsed != chunk.length) { + if (fixture.expectError) { + return; + } + puts('-- ERROR --'); + p(chunk.toString('ascii')); + throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!'); + } + } + + if (fixture.expectError) { + throw new Error('expected parse error did not happen'); + } + + assert.ok(endCalled); + assert.deepEqual(parts, fixture.parts); +}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js new file mode 100644 index 0000000..52ceedb --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js @@ -0,0 +1,104 @@ +var common = require('../common'); +var WriteStreamStub = GENTLY.stub('fs', 'WriteStream'); + +var File = require(common.lib + '/file'), + EventEmitter = require('events').EventEmitter, + file, + gently; + +function test(test) { + gently = new Gently(); + file = new File(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.ok(file instanceof EventEmitter); + assert.strictEqual(file.size, 0); + assert.strictEqual(file.path, null); + assert.strictEqual(file.name, null); + assert.strictEqual(file.type, null); + assert.strictEqual(file.lastModifiedDate, null); + + assert.strictEqual(file._writeStream, null); + + (function testSetProperties() { + var file2 = new File({foo: 'bar'}); + assert.equal(file2.foo, 'bar'); + })(); +}); + +test(function open() { + var WRITE_STREAM; + file.path = '/foo'; + + gently.expect(WriteStreamStub, 'new', function (path) { + WRITE_STREAM = this; + assert.strictEqual(path, file.path); + }); + + file.open(); + assert.strictEqual(file._writeStream, WRITE_STREAM); +}); + +test(function write() { + var BUFFER = {length: 10}, + CB_STUB, + CB = function() { + CB_STUB.apply(this, arguments); + }; + + file._writeStream = {}; + + gently.expect(file._writeStream, 'write', function (buffer, cb) { + assert.strictEqual(buffer, BUFFER); + + gently.expect(file, 'emit', function (event, bytesWritten) { + assert.ok(file.lastModifiedDate instanceof Date); + assert.equal(event, 'progress'); + assert.equal(bytesWritten, file.size); + }); + + CB_STUB = gently.expect(function writeCb() { + assert.equal(file.size, 10); + }); + + cb(); + + gently.expect(file, 'emit', function (event, bytesWritten) { + assert.equal(event, 'progress'); + assert.equal(bytesWritten, file.size); + }); + + CB_STUB = gently.expect(function writeCb() { + assert.equal(file.size, 20); + }); + + cb(); + }); + + file.write(BUFFER, CB); +}); + +test(function end() { + var CB_STUB, + CB = function() { + CB_STUB.apply(this, arguments); + }; + + file._writeStream = {}; + + gently.expect(file._writeStream, 'end', function (cb) { + gently.expect(file, 'emit', function (event) { + assert.equal(event, 'end'); + }); + + CB_STUB = gently.expect(function endCb() { + }); + + cb(); + }); + + file.end(CB); +}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js new file mode 100644 index 0000000..84de439 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js @@ -0,0 +1,727 @@ +var common = require('../common'); +var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'), + QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'), + EventEmitterStub = GENTLY.stub('events', 'EventEmitter'), + StreamStub = GENTLY.stub('stream', 'Stream'), + FileStub = GENTLY.stub('./file'); + +var formidable = require(common.lib + '/index'), + IncomingForm = formidable.IncomingForm, + events = require('events'), + fs = require('fs'), + path = require('path'), + Buffer = require('buffer').Buffer, + fixtures = require(TEST_FIXTURES + '/multipart'), + form, + gently; + +function test(test) { + gently = new Gently(); + gently.expect(EventEmitterStub, 'call'); + form = new IncomingForm(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.strictEqual(form.error, null); + assert.strictEqual(form.ended, false); + assert.strictEqual(form.type, null); + assert.strictEqual(form.headers, null); + assert.strictEqual(form.keepExtensions, false); + assert.strictEqual(form.uploadDir, '/tmp'); + assert.strictEqual(form.encoding, 'utf-8'); + assert.strictEqual(form.bytesReceived, null); + assert.strictEqual(form.bytesExpected, null); + assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024); + assert.strictEqual(form._parser, null); + assert.strictEqual(form._flushing, 0); + assert.strictEqual(form._fieldsSize, 0); + assert.ok(form instanceof EventEmitterStub); + assert.equal(form.constructor.name, 'IncomingForm'); + + (function testSimpleConstructor() { + gently.expect(EventEmitterStub, 'call'); + var form = IncomingForm(); + assert.ok(form instanceof IncomingForm); + })(); + + (function testSimpleConstructorShortcut() { + gently.expect(EventEmitterStub, 'call'); + var form = formidable(); + assert.ok(form instanceof IncomingForm); + })(); +}); + +test(function parse() { + var REQ = {headers: {}} + , emit = {}; + + gently.expect(form, 'writeHeaders', function(headers) { + assert.strictEqual(headers, REQ.headers); + }); + + var events = ['error', 'aborted', 'data', 'end']; + gently.expect(REQ, 'on', events.length, function(event, fn) { + assert.equal(event, events.shift()); + emit[event] = fn; + return this; + }); + + form.parse(REQ); + + (function testPause() { + gently.expect(REQ, 'pause'); + assert.strictEqual(form.pause(), true); + })(); + + (function testPauseCriticalException() { + form.ended = false; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'pause', function() { + throw ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + assert.strictEqual(form.pause(), false); + })(); + + (function testPauseHarmlessException() { + form.ended = true; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'pause', function() { + throw ERR; + }); + + assert.strictEqual(form.pause(), false); + })(); + + (function testResume() { + gently.expect(REQ, 'resume'); + assert.strictEqual(form.resume(), true); + })(); + + (function testResumeCriticalException() { + form.ended = false; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'resume', function() { + throw ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + assert.strictEqual(form.resume(), false); + })(); + + (function testResumeHarmlessException() { + form.ended = true; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'resume', function() { + throw ERR; + }); + + assert.strictEqual(form.resume(), false); + })(); + + (function testEmitError() { + var ERR = new Error('something bad happened'); + gently.expect(form, '_error',function(err) { + assert.strictEqual(err, ERR); + }); + emit.error(ERR); + })(); + + (function testEmitAborted() { + gently.expect(form, 'emit',function(event) { + assert.equal(event, 'aborted'); + }); + + emit.aborted(); + })(); + + + (function testEmitData() { + var BUFFER = [1, 2, 3]; + gently.expect(form, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + }); + emit.data(BUFFER); + })(); + + (function testEmitEnd() { + form._parser = {}; + + (function testWithError() { + var ERR = new Error('haha'); + gently.expect(form._parser, 'end', function() { + return ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + emit.end(); + })(); + + (function testWithoutError() { + gently.expect(form._parser, 'end'); + emit.end(); + })(); + + (function testAfterError() { + form.error = true; + emit.end(); + })(); + })(); + + (function testWithCallback() { + gently.expect(EventEmitterStub, 'call'); + var form = new IncomingForm(), + REQ = {headers: {}}, + parseCalled = 0; + + gently.expect(form, 'writeHeaders'); + gently.expect(REQ, 'on', 4, function() { + return this; + }); + + gently.expect(form, 'on', 4, function(event, fn) { + if (event == 'field') { + fn('field1', 'foo'); + fn('field1', 'bar'); + fn('field2', 'nice'); + } + + if (event == 'file') { + fn('file1', '1'); + fn('file1', '2'); + fn('file2', '3'); + } + + if (event == 'end') { + fn(); + } + return this; + }); + + form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) { + assert.deepEqual(fields, {field1: 'bar', field2: 'nice'}); + assert.deepEqual(files, {file1: '2', file2: '3'}); + })); + + gently.expect(form, 'writeHeaders'); + gently.expect(REQ, 'on', 4, function() { + return this; + }); + + var ERR = new Error('test'); + gently.expect(form, 'on', 3, function(event, fn) { + if (event == 'field') { + fn('foo', 'bar'); + } + + if (event == 'error') { + fn(ERR); + gently.expect(form, 'on'); + } + return this; + }); + + form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) { + assert.strictEqual(err, ERR); + assert.deepEqual(fields, {foo: 'bar'}); + })); + })(); +}); + +test(function pause() { + assert.strictEqual(form.pause(), false); +}); + +test(function resume() { + assert.strictEqual(form.resume(), false); +}); + + +test(function writeHeaders() { + var HEADERS = {}; + gently.expect(form, '_parseContentLength'); + gently.expect(form, '_parseContentType'); + + form.writeHeaders(HEADERS); + assert.strictEqual(form.headers, HEADERS); +}); + +test(function write() { + var parser = {}, + BUFFER = [1, 2, 3]; + + form._parser = parser; + form.bytesExpected = 523423; + + (function testBasic() { + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, BUFFER.length); + assert.equal(bytesExpected, form.bytesExpected); + }); + + gently.expect(parser, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + return buffer.length; + }); + + assert.equal(form.write(BUFFER), BUFFER.length); + assert.equal(form.bytesReceived, BUFFER.length); + })(); + + (function testParserError() { + gently.expect(form, 'emit'); + + gently.expect(parser, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + return buffer.length - 1; + }); + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/parser error/i)); + }); + + assert.equal(form.write(BUFFER), BUFFER.length - 1); + assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length); + })(); + + (function testUninitialized() { + delete form._parser; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/unintialized parser/i)); + }); + form.write(BUFFER); + })(); +}); + +test(function parseContentType() { + var HEADERS = {}; + + form.headers = {'content-type': 'application/x-www-form-urlencoded'}; + gently.expect(form, '_initUrlencoded'); + form._parseContentType(); + + // accept anything that has 'urlencoded' in it + form.headers = {'content-type': 'broken-client/urlencoded-stupid'}; + gently.expect(form, '_initUrlencoded'); + form._parseContentType(); + + var BOUNDARY = '---------------------------57814261102167618332366269'; + form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY}; + + gently.expect(form, '_initMultipart', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + form._parseContentType(); + + (function testQuotedBoundary() { + form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'}; + + gently.expect(form, '_initMultipart', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + form._parseContentType(); + })(); + + (function testNoBoundary() { + form.headers = {'content-type': 'multipart/form-data'}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/no multipart boundary/i)); + }); + form._parseContentType(); + })(); + + (function testNoContentType() { + form.headers = {}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/no content-type/i)); + }); + form._parseContentType(); + })(); + + (function testUnknownContentType() { + form.headers = {'content-type': 'invalid'}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/unknown content-type/i)); + }); + form._parseContentType(); + })(); +}); + +test(function parseContentLength() { + var HEADERS = {}; + + form.headers = {}; + form._parseContentLength(); + assert.strictEqual(form.bytesReceived, null); + assert.strictEqual(form.bytesExpected, null); + + form.headers['content-length'] = '8'; + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, 0); + assert.equal(bytesExpected, 8); + }); + form._parseContentLength(); + assert.strictEqual(form.bytesReceived, 0); + assert.strictEqual(form.bytesExpected, 8); + + // JS can be evil, lets make sure we are not + form.headers['content-length'] = '08'; + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, 0); + assert.equal(bytesExpected, 8); + }); + form._parseContentLength(); + assert.strictEqual(form.bytesExpected, 8); +}); + +test(function _initMultipart() { + var BOUNDARY = '123', + PARSER; + + gently.expect(MultipartParserStub, 'new', function() { + PARSER = this; + }); + + gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + + form._initMultipart(BOUNDARY); + assert.equal(form.type, 'multipart'); + assert.strictEqual(form._parser, PARSER); + + (function testRegularField() { + var PART; + gently.expect(StreamStub, 'new', function() { + PART = this; + }); + + gently.expect(form, 'onPart', function(part) { + assert.strictEqual(part, PART); + assert.deepEqual + ( part.headers + , { 'content-disposition': 'form-data; name="field1"' + , 'foo': 'bar' + } + ); + assert.equal(part.name, 'field1'); + + var strings = ['hello', ' world']; + gently.expect(part, 'emit', 2, function(event, b) { + assert.equal(event, 'data'); + assert.equal(b.toString(), strings.shift()); + }); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'end'); + }); + }); + + PARSER.onPartBegin(); + PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10); + PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19); + PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14); + PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24); + PARSER.onHeaderEnd(); + PARSER.onHeaderField(new Buffer('foo'), 0, 3); + PARSER.onHeaderValue(new Buffer('bar'), 0, 3); + PARSER.onHeaderEnd(); + PARSER.onHeadersEnd(); + PARSER.onPartData(new Buffer('hello world'), 0, 5); + PARSER.onPartData(new Buffer('hello world'), 5, 11); + PARSER.onPartEnd(); + })(); + + (function testFileField() { + var PART; + gently.expect(StreamStub, 'new', function() { + PART = this; + }); + + gently.expect(form, 'onPart', function(part) { + assert.deepEqual + ( part.headers + , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"' + , 'content-type': 'text/plain' + } + ); + assert.equal(part.name, 'field2'); + assert.equal(part.filename, 'Sun"et.jpg'); + assert.equal(part.mime, 'text/plain'); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'data'); + assert.equal(b.toString(), '... contents of file1.txt ...'); + }); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'end'); + }); + }); + + PARSER.onPartBegin(); + PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19); + PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85); + PARSER.onHeaderEnd(); + PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12); + PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10); + PARSER.onHeaderEnd(); + PARSER.onHeadersEnd(); + PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29); + PARSER.onPartEnd(); + })(); + + (function testEnd() { + gently.expect(form, '_maybeEnd'); + PARSER.onEnd(); + assert.ok(form.ended); + })(); +}); + +test(function _fileName() { + // TODO + return; +}); + +test(function _initUrlencoded() { + var PARSER; + + gently.expect(QuerystringParserStub, 'new', function() { + PARSER = this; + }); + + form._initUrlencoded(); + assert.equal(form.type, 'urlencoded'); + assert.strictEqual(form._parser, PARSER); + + (function testOnField() { + var KEY = 'KEY', VAL = 'VAL'; + gently.expect(form, 'emit', function(field, key, val) { + assert.equal(field, 'field'); + assert.equal(key, KEY); + assert.equal(val, VAL); + }); + + PARSER.onField(KEY, VAL); + })(); + + (function testOnEnd() { + gently.expect(form, '_maybeEnd'); + + PARSER.onEnd(); + assert.equal(form.ended, true); + })(); +}); + +test(function _error() { + var ERR = new Error('bla'); + + gently.expect(form, 'pause'); + gently.expect(form, 'emit', function(event, err) { + assert.equal(event, 'error'); + assert.strictEqual(err, ERR); + }); + + form._error(ERR); + assert.strictEqual(form.error, ERR); + + // make sure _error only does its thing once + form._error(ERR); +}); + +test(function onPart() { + var PART = {}; + gently.expect(form, 'handlePart', function(part) { + assert.strictEqual(part, PART); + }); + + form.onPart(PART); +}); + +test(function handlePart() { + (function testUtf8Field() { + var PART = new events.EventEmitter(); + PART.name = 'my_field'; + + gently.expect(form, 'emit', function(event, field, value) { + assert.equal(event, 'field'); + assert.equal(field, 'my_field'); + assert.equal(value, 'hello world: €'); + }); + + form.handlePart(PART); + PART.emit('data', new Buffer('hello')); + PART.emit('data', new Buffer(' world: ')); + PART.emit('data', new Buffer([0xE2])); + PART.emit('data', new Buffer([0x82, 0xAC])); + PART.emit('end'); + })(); + + (function testBinaryField() { + var PART = new events.EventEmitter(); + PART.name = 'my_field2'; + + gently.expect(form, 'emit', function(event, field, value) { + assert.equal(event, 'field'); + assert.equal(field, 'my_field2'); + assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary')); + }); + + form.encoding = 'binary'; + form.handlePart(PART); + PART.emit('data', new Buffer('hello')); + PART.emit('data', new Buffer(' world: ')); + PART.emit('data', new Buffer([0xE2])); + PART.emit('data', new Buffer([0x82, 0xAC])); + PART.emit('end'); + })(); + + (function testFieldSize() { + form.maxFieldsSize = 8; + var PART = new events.EventEmitter(); + PART.name = 'my_field'; + + gently.expect(form, '_error', function(err) { + assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data'); + }); + + form.handlePart(PART); + form._fieldsSize = 1; + PART.emit('data', new Buffer(7)); + PART.emit('data', new Buffer(1)); + })(); + + (function testFilePart() { + var PART = new events.EventEmitter(), + FILE = new events.EventEmitter(), + PATH = '/foo/bar'; + + PART.name = 'my_file'; + PART.filename = 'sweet.txt'; + PART.mime = 'sweet.txt'; + + gently.expect(form, '_uploadPath', function(filename) { + assert.equal(filename, PART.filename); + return PATH; + }); + + gently.expect(FileStub, 'new', function(properties) { + assert.equal(properties.path, PATH); + assert.equal(properties.name, PART.filename); + assert.equal(properties.type, PART.mime); + FILE = this; + + gently.expect(form, 'emit', function (event, field, file) { + assert.equal(event, 'fileBegin'); + assert.strictEqual(field, PART.name); + assert.strictEqual(file, FILE); + }); + + gently.expect(FILE, 'open'); + }); + + form.handlePart(PART); + assert.equal(form._flushing, 1); + + var BUFFER; + gently.expect(form, 'pause'); + gently.expect(FILE, 'write', function(buffer, cb) { + assert.strictEqual(buffer, BUFFER); + gently.expect(form, 'resume'); + // @todo handle cb(new Err) + cb(); + }); + + PART.emit('data', BUFFER = new Buffer('test')); + + gently.expect(FILE, 'end', function(cb) { + gently.expect(form, 'emit', function(event, field, file) { + assert.equal(event, 'file'); + assert.strictEqual(file, FILE); + }); + + gently.expect(form, '_maybeEnd'); + + cb(); + assert.equal(form._flushing, 0); + }); + + PART.emit('end'); + })(); +}); + +test(function _uploadPath() { + (function testUniqueId() { + var UUID_A, UUID_B; + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { + assert.equal(uploadDir, form.uploadDir); + UUID_A = uuid; + }); + form._uploadPath(); + + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { + UUID_B = uuid; + }); + form._uploadPath(); + + assert.notEqual(UUID_A, UUID_B); + })(); + + (function testFileExtension() { + form.keepExtensions = true; + var FILENAME = 'foo.jpg', + EXT = '.bar'; + + gently.expect(GENTLY.hijacked.path, 'extname', function(filename) { + assert.equal(filename, FILENAME); + gently.restore(path, 'extname'); + + return EXT; + }); + + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) { + assert.equal(path.extname(name), EXT); + }); + form._uploadPath(FILENAME); + })(); +}); + +test(function _maybeEnd() { + gently.expect(form, 'emit', 0); + form._maybeEnd(); + + form.ended = true; + form._flushing = 1; + form._maybeEnd(); + + gently.expect(form, 'emit', function(event) { + assert.equal(event, 'end'); + }); + + form.ended = true; + form._flushing = 0; + form._maybeEnd(); +}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js new file mode 100644 index 0000000..d8dc968 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js @@ -0,0 +1,50 @@ +var common = require('../common'); +var multipartParser = require(common.lib + '/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + events = require('events'), + Buffer = require('buffer').Buffer, + parser; + +function test(test) { + parser = new MultipartParser(); + test(); +} + +test(function constructor() { + assert.equal(parser.boundary, null); + assert.equal(parser.state, 0); + assert.equal(parser.flags, 0); + assert.equal(parser.boundaryChars, null); + assert.equal(parser.index, null); + assert.equal(parser.lookbehind, null); + assert.equal(parser.constructor.name, 'MultipartParser'); +}); + +test(function initWithBoundary() { + var boundary = 'abc'; + parser.initWithBoundary(boundary); + assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]); + assert.equal(parser.state, multipartParser.START); + + assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true}); +}); + +test(function parserError() { + var boundary = 'abc', + buffer = new Buffer(5); + + parser.initWithBoundary(boundary); + buffer.write('--ad', 'ascii', 0); + assert.equal(parser.write(buffer), 3); +}); + +test(function end() { + (function testError() { + assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain()); + })(); + + (function testRegular() { + parser.state = multipartParser.END; + assert.strictEqual(parser.end(), undefined); + })(); +}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js new file mode 100644 index 0000000..54d3e2d --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js @@ -0,0 +1,45 @@ +var common = require('../common'); +var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser, + Buffer = require('buffer').Buffer, + gently, + parser; + +function test(test) { + gently = new Gently(); + parser = new QuerystringParser(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.equal(parser.buffer, ''); + assert.equal(parser.constructor.name, 'QuerystringParser'); +}); + +test(function write() { + var a = new Buffer('a=1'); + assert.equal(parser.write(a), a.length); + + var b = new Buffer('&b=2'); + parser.write(b); + assert.equal(parser.buffer, a + b); +}); + +test(function end() { + var FIELDS = {a: ['b', {c: 'd'}], e: 'f'}; + + gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) { + assert.equal(str, parser.buffer); + return FIELDS; + }); + + gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) { + assert.deepEqual(FIELDS[key], val); + }); + + gently.expect(parser, 'onEnd'); + + parser.buffer = 'my buffer'; + parser.end(); + assert.equal(parser.buffer, ''); +}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js new file mode 100644 index 0000000..479e46d --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js @@ -0,0 +1,75 @@ +var common = require('../common'); +var BOUNDARY = '---------------------------10102754414578508781458777923', + FIXTURE = TEST_FIXTURES+'/multi_video.upload', + fs = require('fs'), + util = require(common.lib + '/util'), + http = require('http'), + formidable = require(common.lib + '/index'), + server = http.createServer(); + +server.on('request', function(req, res) { + var form = new formidable.IncomingForm(), + uploads = {}; + + form.uploadDir = TEST_TMP; + form.hash = 'sha1'; + form.parse(req); + + form + .on('fileBegin', function(field, file) { + assert.equal(field, 'upload'); + + var tracker = {file: file, progress: [], ended: false}; + uploads[file.filename] = tracker; + file + .on('progress', function(bytesReceived) { + tracker.progress.push(bytesReceived); + assert.equal(bytesReceived, file.length); + }) + .on('end', function() { + tracker.ended = true; + }); + }) + .on('field', function(field, value) { + assert.equal(field, 'title'); + assert.equal(value, ''); + }) + .on('file', function(field, file) { + assert.equal(field, 'upload'); + assert.strictEqual(uploads[file.filename].file, file); + }) + .on('end', function() { + assert.ok(uploads['shortest_video.flv']); + assert.ok(uploads['shortest_video.flv'].ended); + assert.ok(uploads['shortest_video.flv'].progress.length > 3); + assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a'); + assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length); + assert.ok(uploads['shortest_video.mp4']); + assert.ok(uploads['shortest_video.mp4'].ended); + assert.ok(uploads['shortest_video.mp4'].progress.length > 3); + assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f'); + + server.close(); + res.writeHead(200); + res.end('good'); + }); +}); + +server.listen(TEST_PORT, function() { + var client = http.createClient(TEST_PORT), + stat = fs.statSync(FIXTURE), + headers = { + 'content-type': 'multipart/form-data; boundary='+BOUNDARY, + 'content-length': stat.size, + } + request = client.request('POST', '/', headers), + fixture = new fs.ReadStream(FIXTURE); + + fixture + .on('data', function(b) { + request.write(b); + }) + .on('end', function() { + request.end(); + }); +}); diff --git a/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/connect/node_modules/formidable/test/run.js new file mode 100755 index 0000000..50b2361 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/run.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('urun')(__dirname) diff --git a/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js new file mode 100644 index 0000000..fe2ac1c --- /dev/null +++ b/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js @@ -0,0 +1,63 @@ +var common = require('../common'); +var test = require('utest'); +var assert = common.assert; +var IncomingForm = common.require('incoming_form').IncomingForm; +var path = require('path'); + +var form; +test('IncomingForm', { + before: function() { + form = new IncomingForm(); + }, + + '#_fileName with regular characters': function() { + var filename = 'foo.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'foo.txt'); + }, + + '#_fileName with unescaped quote': function() { + var filename = 'my".txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); + }, + + '#_fileName with escaped quote': function() { + var filename = 'my%22.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); + }, + + '#_fileName with bad quote and additional sub-header': function() { + var filename = 'my".txt'; + var header = makeHeader(filename) + '; foo="bar"'; + assert.equal(form._fileName(header), filename); + }, + + '#_fileName with semicolon': function() { + var filename = 'my;.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my;.txt'); + }, + + '#_fileName with utf8 character': function() { + var filename = 'my☃.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt'); + }, + + '#_uploadPath strips harmful characters from extension when keepExtensions': function() { + form.keepExtensions = true; + + var ext = path.extname(form._uploadPath('fine.jpg?foo=bar')); + assert.equal(ext, '.jpg'); + + var ext = path.extname(form._uploadPath('fine?foo=bar')); + assert.equal(ext, ''); + + var ext = path.extname(form._uploadPath('super.cr2+dsad')); + assert.equal(ext, '.cr2'); + + var ext = path.extname(form._uploadPath('super.bar')); + assert.equal(ext, '.bar'); + }, +}); + +function makeHeader(filename) { + return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"'; +} diff --git a/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/connect/node_modules/formidable/tool/record.js new file mode 100644 index 0000000..9f1cef8 --- /dev/null +++ b/node_modules/connect/node_modules/formidable/tool/record.js @@ -0,0 +1,47 @@ +var http = require('http'); +var fs = require('fs'); +var connections = 0; + +var server = http.createServer(function(req, res) { + var socket = req.socket; + console.log('Request: %s %s -> %s', req.method, req.url, socket.filename); + + req.on('end', function() { + if (req.url !== '/') { + res.end(JSON.stringify({ + method: req.method, + url: req.url, + filename: socket.filename, + })); + return; + } + + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + }); +}); + +server.on('connection', function(socket) { + connections++; + + socket.id = connections; + socket.filename = 'connection-' + socket.id + '.http'; + socket.file = fs.createWriteStream(socket.filename); + socket.pipe(socket.file); + + console.log('--> %s', socket.filename); + socket.on('close', function() { + console.log('<-- %s', socket.filename); + }); +}); + +var port = process.env.PORT || 8080; +server.listen(port, function() { + console.log('Recording connections on port %s', port); +}); diff --git a/node_modules/connect/node_modules/fresh/.npmignore b/node_modules/connect/node_modules/fresh/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/connect/node_modules/fresh/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/connect/node_modules/fresh/Makefile b/node_modules/connect/node_modules/fresh/Makefile new file mode 100644 index 0000000..8e8640f --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/fresh/Readme.md b/node_modules/connect/node_modules/fresh/Readme.md new file mode 100644 index 0000000..273130d --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/fresh/index.js b/node_modules/connect/node_modules/fresh/index.js new file mode 100644 index 0000000..b2f4d41 --- /dev/null +++ b/node_modules/connect/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/connect/node_modules/fresh/package.json b/node_modules/connect/node_modules/fresh/package.json new file mode 100644 index 0000000..d81fc0d --- /dev/null +++ b/node_modules/connect/node_modules/fresh/package.json @@ -0,0 +1,12 @@ +{ + "name": "fresh", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "HTTP response freshness testing", + "version": "0.1.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + } +} diff --git a/node_modules/connect/node_modules/pause/.npmignore b/node_modules/connect/node_modules/pause/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/connect/node_modules/pause/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/connect/node_modules/pause/History.md b/node_modules/connect/node_modules/pause/History.md new file mode 100644 index 0000000..c8aa68f --- /dev/null +++ b/node_modules/connect/node_modules/pause/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/connect/node_modules/pause/Makefile b/node_modules/connect/node_modules/pause/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/connect/node_modules/pause/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/connect/node_modules/pause/Readme.md b/node_modules/connect/node_modules/pause/Readme.md new file mode 100644 index 0000000..1cdd68a --- /dev/null +++ b/node_modules/connect/node_modules/pause/Readme.md @@ -0,0 +1,29 @@ + +# pause + + Pause streams... + +## 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/connect/node_modules/pause/index.js b/node_modules/connect/node_modules/pause/index.js new file mode 100644 index 0000000..1b7b379 --- /dev/null +++ b/node_modules/connect/node_modules/pause/index.js @@ -0,0 +1,29 @@ + +module.exports = function(obj){ + var onData + , onEnd + , events = []; + + // buffer data + obj.on('data', onData = function(data, encoding){ + events.push(['data', data, encoding]); + }); + + // buffer end + obj.on('end', onEnd = function(data, encoding){ + events.push(['end', data, encoding]); + }); + + return { + end: function(){ + obj.removeListener('data', onData); + obj.removeListener('end', onEnd); + }, + resume: function(){ + this.end(); + for (var i = 0, len = events.length; i < len; ++i) { + obj.emit.apply(obj, events[i]); + } + } + }; +}; \ No newline at end of file diff --git a/node_modules/connect/node_modules/pause/package.json b/node_modules/connect/node_modules/pause/package.json new file mode 100644 index 0000000..ae472ac --- /dev/null +++ b/node_modules/connect/node_modules/pause/package.json @@ -0,0 +1,13 @@ +{ + "name": "pause", + "version": "0.0.1", + "description": "Pause streams...", + "keywords": [], + "author": "TJ Holowaychuk ", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index" +} \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/connect/node_modules/qs/.gitmodules new file mode 100644 index 0000000..49e31da --- /dev/null +++ b/node_modules/connect/node_modules/qs/.gitmodules @@ -0,0 +1,6 @@ +[submodule "support/expresso"] + path = support/expresso + url = git://github.com/visionmedia/expresso.git +[submodule "support/should"] + path = support/should + url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/connect/node_modules/qs/.npmignore b/node_modules/connect/node_modules/qs/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/connect/node_modules/qs/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/connect/node_modules/qs/.travis.yml new file mode 100644 index 0000000..2c0a8f6 --- /dev/null +++ b/node_modules/connect/node_modules/qs/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.4 \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/History.md b/node_modules/connect/node_modules/qs/History.md new file mode 100644 index 0000000..1feef45 --- /dev/null +++ b/node_modules/connect/node_modules/qs/History.md @@ -0,0 +1,83 @@ + +0.5.1 / 2012-09-18 +================== + + * fix encoded `=`. Closes #43 + +0.5.0 / 2012-05-04 +================== + + * Added component support + +0.4.2 / 2012-02-08 +================== + + * Fixed: ensure objects are created when appropriate not arrays [aheckmann] + +0.4.1 / 2012-01-26 +================== + + * Fixed stringify()ing numbers. Closes #23 + +0.4.0 / 2011-11-21 +================== + + * Allow parsing of an existing object (for `bodyParser()`) [jackyz] + * Replaced expresso with mocha + +0.3.2 / 2011-11-08 +================== + + * Fixed global variable leak + +0.3.1 / 2011-08-17 +================== + + * Added `try/catch` around malformed uri components + * Add test coverage for Array native method bleed-though + +0.3.0 / 2011-07-19 +================== + + * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] + +0.2.0 / 2011-06-29 +================== + + * Added `qs.stringify()` [Cory Forsyth] + +0.1.0 / 2011-04-13 +================== + + * Added jQuery-ish array support + +0.0.7 / 2011-03-13 +================== + + * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] + allows for convenient `qs.parse(url.parse(str).query)` + +0.0.6 / 2011-02-14 +================== + + * Fixed; support for implicit arrays + +0.0.4 / 2011-02-09 +================== + + * Fixed `+` as a space + +0.0.3 / 2011-02-08 +================== + + * Fixed case when right-hand value contains "]" + +0.0.2 / 2011-02-07 +================== + + * Fixed "=" presence in key + +0.0.1 / 2011-02-07 +================== + + * Initial release \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/Makefile b/node_modules/connect/node_modules/qs/Makefile new file mode 100644 index 0000000..0a21cf7 --- /dev/null +++ b/node_modules/connect/node_modules/qs/Makefile @@ -0,0 +1,12 @@ + +test/browser/qs.js: querystring.js + component build package.json test/browser/qs + +querystring.js: lib/head.js lib/querystring.js lib/tail.js + cat $^ > $@ + +test: + @./node_modules/.bin/mocha \ + --ui bdd + +.PHONY: test \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/Readme.md b/node_modules/connect/node_modules/qs/Readme.md new file mode 100644 index 0000000..27e54a4 --- /dev/null +++ b/node_modules/connect/node_modules/qs/Readme.md @@ -0,0 +1,58 @@ +# node-querystring + + query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. + +## Installation + + $ npm install qs + +## Examples + +```js +var qs = require('qs'); + +qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); +// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } + +qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) +// => user[name]=Tobi&user[email]=tobi%40learnboost.com +``` + +## Testing + +Install dev dependencies: + + $ npm install -d + +and execute: + + $ make test + +browser: + + $ open test/browser/index.html + +## License + +(The MIT License) + +Copyright (c) 2010 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/connect/node_modules/qs/benchmark.js b/node_modules/connect/node_modules/qs/benchmark.js new file mode 100644 index 0000000..97e2c93 --- /dev/null +++ b/node_modules/connect/node_modules/qs/benchmark.js @@ -0,0 +1,17 @@ + +var qs = require('./'); + +var times = 100000 + , start = new Date + , n = times; + +console.log('times: %d', times); + +while (n--) qs.parse('foo=bar'); +console.log('simple: %dms', new Date - start); + +var start = new Date + , n = times; + +while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); +console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/component.json b/node_modules/connect/node_modules/qs/component.json new file mode 100644 index 0000000..ba34ead --- /dev/null +++ b/node_modules/connect/node_modules/qs/component.json @@ -0,0 +1,6 @@ +{ + "name": "querystring", + "description": "Querystring parser / stringifier with nesting support", + "keywords": ["querystring", "query", "parser"], + "main": "lib/querystring.js" +} \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/examples.js b/node_modules/connect/node_modules/qs/examples.js new file mode 100644 index 0000000..27617b7 --- /dev/null +++ b/node_modules/connect/node_modules/qs/examples.js @@ -0,0 +1,51 @@ + +/** + * Module dependencies. + */ + +var qs = require('./'); + +var obj = qs.parse('foo'); +console.log(obj) + +var obj = qs.parse('foo=bar=baz'); +console.log(obj) + +var obj = qs.parse('users[]'); +console.log(obj) + +var obj = qs.parse('name=tj&email=tj@vision-media.ca'); +console.log(obj) + +var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); +console.log(obj) + +var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); +console.log(obj) + +var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); +console.log(obj) + +var obj = qs.parse('a=a&a=b&a=c'); +console.log(obj) + +var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); +console.log(obj) + +var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); +console.log(obj) + +var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[1]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[foo]=TJ'); +console.log(obj) + +var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); +console.log(str); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/index.js b/node_modules/connect/node_modules/qs/index.js new file mode 100644 index 0000000..d177d20 --- /dev/null +++ b/node_modules/connect/node_modules/qs/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/lib/head.js b/node_modules/connect/node_modules/qs/lib/head.js new file mode 100644 index 0000000..55d3817 --- /dev/null +++ b/node_modules/connect/node_modules/qs/lib/head.js @@ -0,0 +1 @@ +;(function(){ diff --git a/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/connect/node_modules/qs/lib/querystring.js new file mode 100644 index 0000000..d3689bb --- /dev/null +++ b/node_modules/connect/node_modules/qs/lib/querystring.js @@ -0,0 +1,262 @@ + +/** + * Object#toString() ref for stringify(). + */ + +var toString = Object.prototype.toString; + +/** + * Cache non-integer test regexp. + */ + +var isint = /^[0-9]+$/; + +function promote(parent, key) { + if (parent[key].length == 0) return parent[key] = {}; + var t = {}; + for (var i in parent[key]) t[i] = parent[key][i]; + parent[key] = t; + return t; +} + +function parse(parts, parent, key, val) { + var part = parts.shift(); + // end + if (!part) { + if (Array.isArray(parent[key])) { + parent[key].push(val); + } else if ('object' == typeof parent[key]) { + parent[key] = val; + } else if ('undefined' == typeof parent[key]) { + parent[key] = val; + } else { + parent[key] = [parent[key], val]; + } + // array + } else { + var obj = parent[key] = parent[key] || []; + if (']' == part) { + if (Array.isArray(obj)) { + if ('' != val) obj.push(val); + } else if ('object' == typeof obj) { + obj[Object.keys(obj).length] = val; + } else { + obj = parent[key] = [parent[key], val]; + } + // prop + } else if (~part.indexOf(']')) { + part = part.substr(0, part.length - 1); + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + // key + } else { + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + } + } +} + +/** + * Merge parent key/val pair. + */ + +function merge(parent, key, val){ + if (~key.indexOf(']')) { + var parts = key.split('[') + , len = parts.length + , last = len - 1; + parse(parts, parent, 'base', val); + // optimize + } else { + if (!isint.test(key) && Array.isArray(parent.base)) { + var t = {}; + for (var k in parent.base) t[k] = parent.base[k]; + parent.base = t; + } + set(parent.base, key, val); + } + + return parent; +} + +/** + * Parse the given obj. + */ + +function parseObject(obj){ + var ret = { base: {} }; + Object.keys(obj).forEach(function(name){ + merge(ret, name, obj[name]); + }); + return ret.base; +} + +/** + * Parse the given str. + */ + +function parseString(str){ + return String(str) + .split('&') + .reduce(function(ret, pair){ + var eql = pair.indexOf('=') + , brace = lastBraceInKey(pair) + , key = pair.substr(0, brace || eql) + , val = pair.substr(brace || eql, pair.length) + , val = val.substr(val.indexOf('=') + 1, val.length); + + // ?foo + if ('' == key) key = pair, val = ''; + + return merge(ret, decode(key), decode(val)); + }, { base: {} }).base; +} + +/** + * Parse the given query `str` or `obj`, returning an object. + * + * @param {String} str | {Object} obj + * @return {Object} + * @api public + */ + +exports.parse = function(str){ + if (null == str || '' == str) return {}; + return 'object' == typeof str + ? parseObject(str) + : parseString(str); +}; + +/** + * Turn the given `obj` into a query string + * + * @param {Object} obj + * @return {String} + * @api public + */ + +var stringify = exports.stringify = function(obj, prefix) { + if (Array.isArray(obj)) { + return stringifyArray(obj, prefix); + } else if ('[object Object]' == toString.call(obj)) { + return stringifyObject(obj, prefix); + } else if ('string' == typeof obj) { + return stringifyString(obj, prefix); + } else { + return prefix + '=' + obj; + } +}; + +/** + * Stringify the given `str`. + * + * @param {String} str + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyString(str, prefix) { + if (!prefix) throw new TypeError('stringify expects an object'); + return prefix + '=' + encodeURIComponent(str); +} + +/** + * Stringify the given `arr`. + * + * @param {Array} arr + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyArray(arr, prefix) { + var ret = []; + if (!prefix) throw new TypeError('stringify expects an object'); + for (var i = 0; i < arr.length; i++) { + ret.push(stringify(arr[i], prefix + '['+i+']')); + } + return ret.join('&'); +} + +/** + * Stringify the given `obj`. + * + * @param {Object} obj + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyObject(obj, prefix) { + var ret = [] + , keys = Object.keys(obj) + , key; + + for (var i = 0, len = keys.length; i < len; ++i) { + key = keys[i]; + ret.push(stringify(obj[key], prefix + ? prefix + '[' + encodeURIComponent(key) + ']' + : encodeURIComponent(key))); + } + + return ret.join('&'); +} + +/** + * Set `obj`'s `key` to `val` respecting + * the weird and wonderful syntax of a qs, + * where "foo=bar&foo=baz" becomes an array. + * + * @param {Object} obj + * @param {String} key + * @param {String} val + * @api private + */ + +function set(obj, key, val) { + var v = obj[key]; + if (undefined === v) { + obj[key] = val; + } else if (Array.isArray(v)) { + v.push(val); + } else { + obj[key] = [v, val]; + } +} + +/** + * Locate last brace in `str` within the key. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function lastBraceInKey(str) { + var len = str.length + , brace + , c; + for (var i = 0; i < len; ++i) { + c = str[i]; + if (']' == c) brace = false; + if ('[' == c) brace = true; + if ('=' == c && !brace) return i; + } +} + +/** + * Decode `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +function decode(str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (err) { + return str; + } +} diff --git a/node_modules/connect/node_modules/qs/lib/tail.js b/node_modules/connect/node_modules/qs/lib/tail.js new file mode 100644 index 0000000..158693a --- /dev/null +++ b/node_modules/connect/node_modules/qs/lib/tail.js @@ -0,0 +1 @@ +})(); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/package.json b/node_modules/connect/node_modules/qs/package.json new file mode 100644 index 0000000..6a4022e --- /dev/null +++ b/node_modules/connect/node_modules/qs/package.json @@ -0,0 +1,22 @@ +{ + "name": "qs", + "description": "querystring parser", + "version": "0.5.1", + "keywords": ["query string", "parser", "component"], + "repository": { + "type" : "git", + "url" : "git://github.com/visionmedia/node-querystring.git" + }, + "devDependencies": { + "mocha": "*" + , "expect.js": "*" + }, + "component": { + "scripts": { + "querystring": "querystring.js" + } + }, + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "main": "index", + "engines": { "node": "*" } +} \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/querystring.js b/node_modules/connect/node_modules/qs/querystring.js new file mode 100644 index 0000000..7466b06 --- /dev/null +++ b/node_modules/connect/node_modules/qs/querystring.js @@ -0,0 +1,254 @@ +;(function(){ + +/** + * Object#toString() ref for stringify(). + */ + +var toString = Object.prototype.toString; + +/** + * Cache non-integer test regexp. + */ + +var isint = /^[0-9]+$/; + +function promote(parent, key) { + if (parent[key].length == 0) return parent[key] = {}; + var t = {}; + for (var i in parent[key]) t[i] = parent[key][i]; + parent[key] = t; + return t; +} + +function parse(parts, parent, key, val) { + var part = parts.shift(); + // end + if (!part) { + if (Array.isArray(parent[key])) { + parent[key].push(val); + } else if ('object' == typeof parent[key]) { + parent[key] = val; + } else if ('undefined' == typeof parent[key]) { + parent[key] = val; + } else { + parent[key] = [parent[key], val]; + } + // array + } else { + var obj = parent[key] = parent[key] || []; + if (']' == part) { + if (Array.isArray(obj)) { + if ('' != val) obj.push(val); + } else if ('object' == typeof obj) { + obj[Object.keys(obj).length] = val; + } else { + obj = parent[key] = [parent[key], val]; + } + // prop + } else if (~part.indexOf(']')) { + part = part.substr(0, part.length - 1); + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + // key + } else { + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + } + } +} + +/** + * Merge parent key/val pair. + */ + +function merge(parent, key, val){ + if (~key.indexOf(']')) { + var parts = key.split('[') + , len = parts.length + , last = len - 1; + parse(parts, parent, 'base', val); + // optimize + } else { + if (!isint.test(key) && Array.isArray(parent.base)) { + var t = {}; + for (var k in parent.base) t[k] = parent.base[k]; + parent.base = t; + } + set(parent.base, key, val); + } + + return parent; +} + +/** + * Parse the given obj. + */ + +function parseObject(obj){ + var ret = { base: {} }; + Object.keys(obj).forEach(function(name){ + merge(ret, name, obj[name]); + }); + return ret.base; +} + +/** + * Parse the given str. + */ + +function parseString(str){ + return String(str) + .split('&') + .reduce(function(ret, pair){ + try{ + pair = decodeURIComponent(pair.replace(/\+/g, ' ')); + } catch(e) { + // ignore + } + + var eql = pair.indexOf('=') + , brace = lastBraceInKey(pair) + , key = pair.substr(0, brace || eql) + , val = pair.substr(brace || eql, pair.length) + , val = val.substr(val.indexOf('=') + 1, val.length); + + // ?foo + if ('' == key) key = pair, val = ''; + + return merge(ret, key, val); + }, { base: {} }).base; +} + +/** + * Parse the given query `str` or `obj`, returning an object. + * + * @param {String} str | {Object} obj + * @return {Object} + * @api public + */ + +exports.parse = function(str){ + if (null == str || '' == str) return {}; + return 'object' == typeof str + ? parseObject(str) + : parseString(str); +}; + +/** + * Turn the given `obj` into a query string + * + * @param {Object} obj + * @return {String} + * @api public + */ + +var stringify = exports.stringify = function(obj, prefix) { + if (Array.isArray(obj)) { + return stringifyArray(obj, prefix); + } else if ('[object Object]' == toString.call(obj)) { + return stringifyObject(obj, prefix); + } else if ('string' == typeof obj) { + return stringifyString(obj, prefix); + } else { + return prefix + '=' + obj; + } +}; + +/** + * Stringify the given `str`. + * + * @param {String} str + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyString(str, prefix) { + if (!prefix) throw new TypeError('stringify expects an object'); + return prefix + '=' + encodeURIComponent(str); +} + +/** + * Stringify the given `arr`. + * + * @param {Array} arr + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyArray(arr, prefix) { + var ret = []; + if (!prefix) throw new TypeError('stringify expects an object'); + for (var i = 0; i < arr.length; i++) { + ret.push(stringify(arr[i], prefix + '['+i+']')); + } + return ret.join('&'); +} + +/** + * Stringify the given `obj`. + * + * @param {Object} obj + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyObject(obj, prefix) { + var ret = [] + , keys = Object.keys(obj) + , key; + + for (var i = 0, len = keys.length; i < len; ++i) { + key = keys[i]; + ret.push(stringify(obj[key], prefix + ? prefix + '[' + encodeURIComponent(key) + ']' + : encodeURIComponent(key))); + } + + return ret.join('&'); +} + +/** + * Set `obj`'s `key` to `val` respecting + * the weird and wonderful syntax of a qs, + * where "foo=bar&foo=baz" becomes an array. + * + * @param {Object} obj + * @param {String} key + * @param {String} val + * @api private + */ + +function set(obj, key, val) { + var v = obj[key]; + if (undefined === v) { + obj[key] = val; + } else if (Array.isArray(v)) { + v.push(val); + } else { + obj[key] = [v, val]; + } +} + +/** + * Locate last brace in `str` within the key. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function lastBraceInKey(str) { + var len = str.length + , brace + , c; + for (var i = 0; i < len; ++i) { + c = str[i]; + if (']' == c) brace = false; + if ('[' == c) brace = true; + if ('=' == c && !brace) return i; + } +} +})(); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/test/browser/expect.js b/node_modules/connect/node_modules/qs/test/browser/expect.js new file mode 100644 index 0000000..76aa4e8 --- /dev/null +++ b/node_modules/connect/node_modules/qs/test/browser/expect.js @@ -0,0 +1,1202 @@ + +(function (global, module) { + + if ('undefined' == typeof module) { + var module = { exports: {} } + , exports = module.exports + } + + /** + * Exports. + */ + + module.exports = expect; + expect.Assertion = Assertion; + + /** + * Exports version. + */ + + expect.version = '0.1.2'; + + /** + * Possible assertion flags. + */ + + var flags = { + not: ['to', 'be', 'have', 'include', 'only'] + , to: ['be', 'have', 'include', 'only', 'not'] + , only: ['have'] + , have: ['own'] + , be: ['an'] + }; + + function expect (obj) { + return new Assertion(obj); + } + + /** + * Constructor + * + * @api private + */ + + function Assertion (obj, flag, parent) { + this.obj = obj; + this.flags = {}; + + if (undefined != parent) { + this.flags[flag] = true; + + for (var i in parent.flags) { + if (parent.flags.hasOwnProperty(i)) { + this.flags[i] = true; + } + } + } + + var $flags = flag ? flags[flag] : keys(flags) + , self = this + + if ($flags) { + for (var i = 0, l = $flags.length; i < l; i++) { + // avoid recursion + if (this.flags[$flags[i]]) continue; + + var name = $flags[i] + , assertion = new Assertion(this.obj, name, this) + + if ('function' == typeof Assertion.prototype[name]) { + // clone the function, make sure we dont touch the prot reference + var old = this[name]; + this[name] = function () { + return old.apply(self, arguments); + } + + for (var fn in Assertion.prototype) { + if (Assertion.prototype.hasOwnProperty(fn) && fn != name) { + this[name][fn] = bind(assertion[fn], assertion); + } + } + } else { + this[name] = assertion; + } + } + } + }; + + /** + * Performs an assertion + * + * @api private + */ + + Assertion.prototype.assert = function (truth, msg, error) { + var msg = this.flags.not ? error : msg + , ok = this.flags.not ? !truth : truth; + + if (!ok) { + throw new Error(msg); + } + + this.and = new Assertion(this.obj); + }; + + /** + * Check if the value is truthy + * + * @api public + */ + + Assertion.prototype.ok = function () { + this.assert( + !!this.obj + , 'expected ' + i(this.obj) + ' to be truthy' + , 'expected ' + i(this.obj) + ' to be falsy'); + }; + + /** + * Assert that the function throws. + * + * @param {Function|RegExp} callback, or regexp to match error string against + * @api public + */ + + Assertion.prototype.throwError = + Assertion.prototype.throwException = function (fn) { + expect(this.obj).to.be.a('function'); + + var thrown = false + , not = this.flags.not + + try { + this.obj(); + } catch (e) { + if ('function' == typeof fn) { + fn(e); + } else if ('object' == typeof fn) { + var subject = 'string' == typeof e ? e : e.message; + if (not) { + expect(subject).to.not.match(fn); + } else { + expect(subject).to.match(fn); + } + } + thrown = true; + } + + if ('object' == typeof fn && not) { + // in the presence of a matcher, ensure the `not` only applies to + // the matching. + this.flags.not = false; + } + + var name = this.obj.name || 'fn'; + this.assert( + thrown + , 'expected ' + name + ' to throw an exception' + , 'expected ' + name + ' not to throw an exception'); + }; + + /** + * Checks if the array is empty. + * + * @api public + */ + + Assertion.prototype.empty = function () { + var expectation; + + if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) { + if ('number' == typeof this.obj.length) { + expectation = !this.obj.length; + } else { + expectation = !keys(this.obj).length; + } + } else { + if ('string' != typeof this.obj) { + expect(this.obj).to.be.an('object'); + } + + expect(this.obj).to.have.property('length'); + expectation = !this.obj.length; + } + + this.assert( + expectation + , 'expected ' + i(this.obj) + ' to be empty' + , 'expected ' + i(this.obj) + ' to not be empty'); + return this; + }; + + /** + * Checks if the obj exactly equals another. + * + * @api public + */ + + Assertion.prototype.be = + Assertion.prototype.equal = function (obj) { + this.assert( + obj === this.obj + , 'expected ' + i(this.obj) + ' to equal ' + i(obj) + , 'expected ' + i(this.obj) + ' to not equal ' + i(obj)); + return this; + }; + + /** + * Checks if the obj sortof equals another. + * + * @api public + */ + + Assertion.prototype.eql = function (obj) { + this.assert( + expect.eql(obj, this.obj) + , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) + , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj)); + return this; + }; + + /** + * Assert within start to finish (inclusive). + * + * @param {Number} start + * @param {Number} finish + * @api public + */ + + Assertion.prototype.within = function (start, finish) { + var range = start + '..' + finish; + this.assert( + this.obj >= start && this.obj <= finish + , 'expected ' + i(this.obj) + ' to be within ' + range + , 'expected ' + i(this.obj) + ' to not be within ' + range); + return this; + }; + + /** + * Assert typeof / instance of + * + * @api public + */ + + Assertion.prototype.a = + Assertion.prototype.an = function (type) { + if ('string' == typeof type) { + // proper english in error msg + var n = /^[aeiou]/.test(type) ? 'n' : ''; + + // typeof with support for 'array' + this.assert( + 'array' == type ? isArray(this.obj) : + 'object' == type + ? 'object' == typeof this.obj && null !== this.obj + : type == typeof this.obj + , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type + , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type); + } else { + // instanceof + var name = type.name || 'supplied constructor'; + this.assert( + this.obj instanceof type + , 'expected ' + i(this.obj) + ' to be an instance of ' + name + , 'expected ' + i(this.obj) + ' not to be an instance of ' + name); + } + + return this; + }; + + /** + * Assert numeric value above _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.greaterThan = + Assertion.prototype.above = function (n) { + this.assert( + this.obj > n + , 'expected ' + i(this.obj) + ' to be above ' + n + , 'expected ' + i(this.obj) + ' to be below ' + n); + return this; + }; + + /** + * Assert numeric value below _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.lessThan = + Assertion.prototype.below = function (n) { + this.assert( + this.obj < n + , 'expected ' + i(this.obj) + ' to be below ' + n + , 'expected ' + i(this.obj) + ' to be above ' + n); + return this; + }; + + /** + * Assert string value matches _regexp_. + * + * @param {RegExp} regexp + * @api public + */ + + Assertion.prototype.match = function (regexp) { + this.assert( + regexp.exec(this.obj) + , 'expected ' + i(this.obj) + ' to match ' + regexp + , 'expected ' + i(this.obj) + ' not to match ' + regexp); + return this; + }; + + /** + * Assert property "length" exists and has value of _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.length = function (n) { + expect(this.obj).to.have.property('length'); + var len = this.obj.length; + this.assert( + n == len + , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len + , 'expected ' + i(this.obj) + ' to not have a length of ' + len); + return this; + }; + + /** + * Assert property _name_ exists, with optional _val_. + * + * @param {String} name + * @param {Mixed} val + * @api public + */ + + Assertion.prototype.property = function (name, val) { + if (this.flags.own) { + this.assert( + Object.prototype.hasOwnProperty.call(this.obj, name) + , 'expected ' + i(this.obj) + ' to have own property ' + i(name) + , 'expected ' + i(this.obj) + ' to not have own property ' + i(name)); + return this; + } + + if (this.flags.not && undefined !== val) { + if (undefined === this.obj[name]) { + throw new Error(i(this.obj) + ' has no property ' + i(name)); + } + } else { + var hasProp; + try { + hasProp = name in this.obj + } catch (e) { + hasProp = undefined !== this.obj[name] + } + + this.assert( + hasProp + , 'expected ' + i(this.obj) + ' to have a property ' + i(name) + , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)); + } + + if (undefined !== val) { + this.assert( + val === this.obj[name] + , 'expected ' + i(this.obj) + ' to have a property ' + i(name) + + ' of ' + i(val) + ', but got ' + i(this.obj[name]) + , 'expected ' + i(this.obj) + ' to not have a property ' + i(name) + + ' of ' + i(val)); + } + + this.obj = this.obj[name]; + return this; + }; + + /** + * Assert that the array contains _obj_ or string contains _obj_. + * + * @param {Mixed} obj|string + * @api public + */ + + Assertion.prototype.string = + Assertion.prototype.contain = function (obj) { + if ('string' == typeof this.obj) { + this.assert( + ~this.obj.indexOf(obj) + , 'expected ' + i(this.obj) + ' to contain ' + i(obj) + , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); + } else { + this.assert( + ~indexOf(this.obj, obj) + , 'expected ' + i(this.obj) + ' to contain ' + i(obj) + , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); + } + return this; + }; + + /** + * Assert exact keys or inclusion of keys by using + * the `.own` modifier. + * + * @param {Array|String ...} keys + * @api public + */ + + Assertion.prototype.key = + Assertion.prototype.keys = function ($keys) { + var str + , ok = true; + + $keys = isArray($keys) + ? $keys + : Array.prototype.slice.call(arguments); + + if (!$keys.length) throw new Error('keys required'); + + var actual = keys(this.obj) + , len = $keys.length; + + // Inclusion + ok = every($keys, function (key) { + return ~indexOf(actual, key); + }); + + // Strict + if (!this.flags.not && this.flags.only) { + ok = ok && $keys.length == actual.length; + } + + // Key string + if (len > 1) { + $keys = map($keys, function (key) { + return i(key); + }); + var last = $keys.pop(); + str = $keys.join(', ') + ', and ' + last; + } else { + str = i($keys[0]); + } + + // Form + str = (len > 1 ? 'keys ' : 'key ') + str; + + // Have / include + str = (!this.flags.only ? 'include ' : 'only have ') + str; + + // Assertion + this.assert( + ok + , 'expected ' + i(this.obj) + ' to ' + str + , 'expected ' + i(this.obj) + ' to not ' + str); + + return this; + }; + + /** + * Function bind implementation. + */ + + function bind (fn, scope) { + return function () { + return fn.apply(scope, arguments); + } + } + + /** + * Array every compatibility + * + * @see bit.ly/5Fq1N2 + * @api public + */ + + function every (arr, fn, thisObj) { + var scope = thisObj || global; + for (var i = 0, j = arr.length; i < j; ++i) { + if (!fn.call(scope, arr[i], i, arr)) { + return false; + } + } + return true; + }; + + /** + * Array indexOf compatibility. + * + * @see bit.ly/a5Dxa2 + * @api public + */ + + function indexOf (arr, o, i) { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(arr, o, i); + } + + if (arr.length === undefined) { + return -1; + } + + for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0 + ; i < j && arr[i] !== o; i++); + + return j <= i ? -1 : i; + }; + + /** + * Inspects an object. + * + * @see taken from node.js `util` module (copyright Joyent, MIT license) + * @api private + */ + + function i (obj, showHidden, depth) { + var seen = []; + + function stylize (str) { + return str; + }; + + function format (value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (value && typeof value.inspect === 'function' && + // Filter out the util module, it's inspect function is special + value !== exports && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + return value.inspect(recurseTimes); + } + + // Primitive types cannot have properties + switch (typeof value) { + case 'undefined': + return stylize('undefined', 'undefined'); + + case 'string': + var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return stylize(simple, 'string'); + + case 'number': + return stylize('' + value, 'number'); + + case 'boolean': + return stylize('' + value, 'boolean'); + } + // For some reason typeof null is "object", so special case here. + if (value === null) { + return stylize('null', 'null'); + } + + // Look up the keys of the object. + var visible_keys = keys(value); + var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; + + // Functions without properties can be shortcutted. + if (typeof value === 'function' && $keys.length === 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + var name = value.name ? ': ' + value.name : ''; + return stylize('[Function' + name + ']', 'special'); + } + } + + // Dates without properties can be shortcutted + if (isDate(value) && $keys.length === 0) { + return stylize(value.toUTCString(), 'date'); + } + + var base, type, braces; + // Determine the object type + if (isArray(value)) { + type = 'Array'; + braces = ['[', ']']; + } else { + type = 'Object'; + braces = ['{', '}']; + } + + // Make functions say that they are functions + if (typeof value === 'function') { + var n = value.name ? ': ' + value.name : ''; + base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']'; + } else { + base = ''; + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + value.toUTCString(); + } + + if ($keys.length === 0) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + return stylize('[Object]', 'special'); + } + } + + seen.push(value); + + var output = map($keys, function (key) { + var name, str; + if (value.__lookupGetter__) { + if (value.__lookupGetter__(key)) { + if (value.__lookupSetter__(key)) { + str = stylize('[Getter/Setter]', 'special'); + } else { + str = stylize('[Getter]', 'special'); + } + } else { + if (value.__lookupSetter__(key)) { + str = stylize('[Setter]', 'special'); + } + } + } + if (indexOf(visible_keys, key) < 0) { + name = '[' + key + ']'; + } + if (!str) { + if (indexOf(seen, value[key]) < 0) { + if (recurseTimes === null) { + str = format(value[key]); + } else { + str = format(value[key], recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (isArray(value)) { + str = map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = stylize('[Circular]', 'special'); + } + } + if (typeof name === 'undefined') { + if (type === 'Array' && key.match(/^\d+$/)) { + return str; + } + name = json.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = stylize(name, 'string'); + } + } + + return name + ': ' + str; + }); + + seen.pop(); + + var numLinesEst = 0; + var length = reduce(output, function (prev, cur) { + numLinesEst++; + if (indexOf(cur, '\n') >= 0) numLinesEst++; + return prev + cur.length + 1; + }, 0); + + if (length > 50) { + output = braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + + } else { + output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; + } + + return output; + } + return format(obj, (typeof depth === 'undefined' ? 2 : depth)); + }; + + function isArray (ar) { + return Object.prototype.toString.call(ar) == '[object Array]'; + }; + + function isRegExp(re) { + var s = '' + re; + return re instanceof RegExp || // easy case + // duck-type for context-switching evalcx case + typeof(re) === 'function' && + re.constructor.name === 'RegExp' && + re.compile && + re.test && + re.exec && + s.match(/^\/.*\/[gim]{0,3}$/); + }; + + function isDate(d) { + if (d instanceof Date) return true; + return false; + }; + + function keys (obj) { + if (Object.keys) { + return Object.keys(obj); + } + + var keys = []; + + for (var i in obj) { + if (Object.prototype.hasOwnProperty.call(obj, i)) { + keys.push(i); + } + } + + return keys; + } + + function map (arr, mapper, that) { + if (Array.prototype.map) { + return Array.prototype.map.call(arr, mapper, that); + } + + var other= new Array(arr.length); + + for (var i= 0, n = arr.length; i= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= len) + throw new TypeError(); + } while (true); + } + + for (; i < len; i++) { + if (i in this) + rv = fun.call(null, rv, this[i], i, this); + } + + return rv; + }; + + /** + * Asserts deep equality + * + * @see taken from node.js `assert` module (copyright Joyent, MIT license) + * @api private + */ + + expect.eql = function eql (actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if ('undefined' != typeof Buffer + && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { + if (actual.length != expected.length) return false; + + for (var i = 0; i < actual.length; i++) { + if (actual[i] !== expected[i]) return false; + } + + return true; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } + } + + function isUndefinedOrNull (value) { + return value === null || value === undefined; + } + + function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + } + + function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return expect.eql(a, b); + } + try{ + var ka = keys(a), + kb = keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!expect.eql(a[key], b[key])) + return false; + } + return true; + } + + var json = (function () { + "use strict"; + + if ('object' == typeof JSON && JSON.parse && JSON.stringify) { + return { + parse: nativeJSON.parse + , stringify: nativeJSON.stringify + } + } + + var JSON = {}; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + function date(d, key) { + return isFinite(d.valueOf()) ? + d.getUTCFullYear() + '-' + + f(d.getUTCMonth() + 1) + '-' + + f(d.getUTCDate()) + 'T' + + f(d.getUTCHours()) + ':' + + f(d.getUTCMinutes()) + ':' + + f(d.getUTCSeconds()) + 'Z' : null; + }; + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + + + function str(key, holder) { + + // Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + + if (value instanceof Date) { + value = date(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + + // JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + + return String(value); + + // If the type is 'object', we might be dealing with an object or an array or + // null. + + case 'object': + + // Due to a specification blunder in ECMAScript, typeof null is 'object', + // so watch out for that case. + + if (!value) { + return 'null'; + } + + // Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + + // Is the value an array? + + if (Object.prototype.toString.apply(value) === '[object Array]') { + + // The value is an array. Stringify every element. Use null as a placeholder + // for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and wrap them in + // brackets. + + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === 'string') { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + + // Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + + // If the JSON object does not yet have a stringify method, give it one. + + JSON.stringify = function (value, replacer, space) { + + // The stringify method takes a value and an optional replacer, and an optional + // space parameter, and returns a JSON text. The replacer can be a function + // that can replace values, or an array of strings that will select the keys. + // A default replacer method can be provided. Use of the space parameter can + // produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + + // If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + + return str('', {'': value}); + }; + + // If the JSON object does not yet have a parse method, give it one. + + JSON.parse = function (text, reviver) { + // The parse method takes a text and an optional reviver function, and returns + // a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + + // The walk method is used to recursively walk the resulting structure so + // that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + + // Parsing happens in four stages. In the first stage, we replace certain + // Unicode characters with escape sequences. JavaScript handles many characters + // incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + + // In the second stage, we run the text against regular expressions that look + // for non-JSON patterns. We are especially concerned with '()' and 'new' + // because they can cause invocation, and '=' because it can cause mutation. + // But just to be safe, we want to reject all unexpected forms. + + // We split the second stage into 4 regexp operations in order to work around + // crippling inefficiencies in IE's and Safari's regexp engines. First we + // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we + // replace all simple value tokens with ']' characters. Third, we delete all + // open brackets that follow a colon or comma or that begin the text. Finally, + // we look to see that the remaining characters are only whitespace or ']' or + // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ + .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') + .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + + // In the third stage we use the eval function to compile the text into a + // JavaScript structure. The '{' operator is subject to a syntactic ambiguity + // in JavaScript: it can begin a block or an object literal. We wrap the text + // in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + + // In the optional fourth stage, we recursively walk the new structure, passing + // each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + + // If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + + return JSON; + })(); + + if ('undefined' != typeof window) { + window.expect = module.exports; + } + +})( + this + , 'undefined' != typeof module ? module : {} + , 'undefined' != typeof exports ? exports : {} +); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/test/browser/index.html b/node_modules/connect/node_modules/qs/test/browser/index.html new file mode 100644 index 0000000..c73147a --- /dev/null +++ b/node_modules/connect/node_modules/qs/test/browser/index.html @@ -0,0 +1,18 @@ + + + Mocha + + + + + + + + + + + + +
    + + diff --git a/node_modules/connect/node_modules/qs/test/browser/jquery.js b/node_modules/connect/node_modules/qs/test/browser/jquery.js new file mode 100644 index 0000000..f3201aa --- /dev/null +++ b/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 + + + +
    +

    {linked-path}

    + {files} +
    + + \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib-cov/public/error.html b/node_modules/express/node_modules/connect/lib-cov/public/error.html new file mode 100644 index 0000000..c5ae73a --- /dev/null +++ b/node_modules/express/node_modules/connect/lib-cov/public/error.html @@ -0,0 +1,13 @@ + + + {error} + + + +
    +

    {title}

    +

    {statusCode} {error}

    +
      {stack}
    +
    + + diff --git a/node_modules/express/node_modules/connect/lib-cov/public/favicon.ico b/node_modules/express/node_modules/connect/lib-cov/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..895fc96a76b68b4924f1c51d022e1b82fa0f461f GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&}i&OouUjIY8@C}uZw4x5z5N2 zvEG^C^vXtt_xtJ?p3O32c(KTx;lsgZhW%5M85Sf}k-mf`L80)|7ga~M{a znlL=>m1Q`#uoPkbC~GtXMnhnDh5$DU1D6mx+;2QAKt3ZQFH}H~1y~00GcqzVg9QXw z_<%(a7y$V|wJgF=E>MgE#Aid|14}IyCM5MhEnxFF;pTzOK(>#80puP=gnOXwAd33` mpMe2}f66m3eB@_fcnmb^7!b1nO#opK8zcsj1F30)+jEP);68^d)m`eN0o>(5%D`Q(1;j>g@G;xlf`0VBQ`PFY?6)!N&f?*K}$p; zB!U=NBn{eB8${1}&-2_L*HuZp@ZP1@clS@cHp)4iM1ewzw59vko7eMM{e9z|%NNdX z0V;`?KKSzTCvTm5bc{L^CIKLUxc2X{i{ISz$8Sgf{q)1nXTP{`{s?9mQ$4&hPiKC- zY8q7(Y1Xu5iCf33=O4Vy(+|zQ?rW#gkKB0f%}?+6{G*qT22|DQB-73`YzA{N4W^=s zq0kQYcbtFfz zLz)H<&|z(Y4kBG67=JY6c|L1R-#TR>fC$3^Y%QEnYO1xHsf)+GU`3F<{J0kR(;pbF3)zyg$H+idfnl-wl5Wkh!vUH z4Z32YP=l_}1rZd1W_D&^$A($A+&a0e&P?xx0!ctY2}*<#p+qPVN*B(YzvAWXa*%bzq z7Fz41LKILT(GWohi9|LgIzSZBhb*Zf6R6O}WYQ4GOi&71s9lmll0x6;8&ILOl$j(c z0Z1T(6Tg09{?wd{moFHNN6PS?$|e>1MxSJ(0Z7o2)J-Zv|>acY@f`(Y@g7GwsEj5NLQo+q|HsxQ5}XSX_d@*^A9ZT9=A{W~j+$GyI1 zc4oqTHx@1FlRjw4XWyPN5i2~l_F3@aBk!0yu^aoRDvXy}8@HCjUVQUsuSH4$T5|r< zzZOn^?Wfa6y|Q($Hx4{ws+)wX6-HP4zo!S?4KJ@7PG@G3G{CjXs(p*kIrj6rHs7_y z+=<-=Q62s9FuWa^X~WKgJIAAZJR&XBB002ovPDHLkV1jCMPILeO literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_attach.png new file mode 100644 index 0000000000000000000000000000000000000000..89ee2da0753040d1ba0a3487473a715a8fe89322 GIT binary patch literal 794 zcmV+#1LgdQP)i_t#ewV_0K6;=bl;e_Jt7$~$sQ)q$+ia<4Ec+jeaGt9oWH@O|2`W6&O0t!k{B9sUvLWxkCaPsd9W(`fa z;j-|^ZI^2XnzhgZWYRW-kP&J>DWPo`%;JaBX}or79k=+Jo@h%4Eo72tqev+cB?PjP zO<|ByL#>Tehyq$jR74O$B9WDW1`tK`LzYyL3A9iAcRxLkJ`I)n}v%Od-3H>j$OTBtk>(k-9o?8PqI=0 zB&f-+KOXVnjyKJlf4iHOtnuiE_4+ZVJ$dHjU<^o^YCjQ-wt^!;rPpBv(@pFO{9rdw98 z_s@3+yta93oyfL>7AD5}r=|`zS3Gm$_|(iSl8XBd9k%=91J0j2=ivT5cJ18ZmDjh{ z$-RMd{jQ#X79#Sc literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_code.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ea90419d950f9e69d977a1f5847456d96a5f0b GIT binary patch literal 818 zcmV-21I_%2P)@LCln44|RX7Ti z0HI3&7jPq){odH{?_{%nYVq_;n_c4WbUpvU(&Cvnj!vq|kVC-vpF6vp^;;e0mm6HW z+WPzA`AZ|;pPp$&dNjzrc??4rt`k%Q1l*u-BPD0MQ}Fbm8jnsyezNt7+u{23>t7Em zJtETY?ja9KrVs^!LJ$xEMF3-bAZO;-IQJavE60KA7fO$VY_%N)R6s>g5mW>fL4&aR z*EVgKKTBXm!=L?S0?xM zYqL@C$|EDF2q*3zWW7;PDZ}SK*IE8;i!3U62=qn80C&*I1Le7WwNP5EcX;_oh2dJn zf#HgBe4@r$GcjHjmj2vAfT%(YN?}kK=(*+1*DkNNc1H5R++vfBMhACi<5uFUU+N4+ z<&U*CPmWi}REa7C6-t>2im1CWv5Jkefxa6>)dEj-CAW wWa{_}BJ!}~75?MkfaCnj>Dn=~vkLS70Pk`;z)@TQj{pDw07*qoM6N<$f@imYHUIzs literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..195dc6d6c365d298e466026b37c1959d96119ea7 GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6Z z(>-WZK@^7J_sq=QY_e{46@P+~LNG}sRzZsxQHvCsN*h5ir6^j7pq-$xu$N#V1gx}9 zClV7;5)7zih-s3DB)G=7|99>ji@So7-P24n=VQ(@GctDX!^_@$bj%oviY6e4Dh;od zooe%Wvs8LEKQ&&bL&@bwi=STIAI@!-gB2jC5+?y?VR~VkrNxam-`6*8&po|RZ5LpS zNKdJ%c4bTX`XjKsnecf%W>1%6WT?pKNdLLq{=(f(Col?P1+oq@R>)W(n=x!|*BIIh z6DJGw_w`)u6yN|vAhMteYK5#b%r5^v+VCFl1IGssaclZZMS{vs-LJ2$)n7DAr6==K z<29#%AXsBsDoO}SBaXR#_Ap!JKx)(1)3O2pj0_dYWz5By*X74fRT01$Fk%P_RzOMDtV?GU{nsYq#K8iy zb6qzLYDj`_f5$BwC*WE(t0m#xYJ*=jC2|HQYHh=pf#QG7oowi`h!L!{DB$8|qY{~X zu8@sU1tWq;n$XThR0%;45mdqXM892|{CJ@0DS*}>?ami06Q_^tvM~Y3K(_-`#m!8f z8f!QIrH4y#61;0Ym0cCoLl8{IPombPHtnn7%SbTdI&G-d>ZQo!_wBMF9nzX!g8HVY xYTJPGciz9XMh3w2fmZ(7v{)r*QZD48?mrio{~IaoqP z|1Ep}yDQG09bP~E^Dk?@JiKQJ z6-pO(3~IOP)IYisL6D6;oAEd;E%zR}{U$rMRNuD6nQV7nesKS>)yLo7JuDCrD>Abi zbj3uW23?^GA}9jQ{M^8v?ejL?HaT7AX5WPZNkBmfN`w-jL?{tT7ykZt$%Yln?p_m~ z-?>&d(LD(jAd}h=LPltPQbO$*Wbyl@G-_k5jXbb#qffHY03>M1jfEqoPJQ6Mr=Byp=^jfzePZV1 zLjCmNi31hdIJHa%e;5g=1(`u3BRzfeExY%=VCu{loOr{`%2hUR*x>tL^W_TTaj);0 zpPR6CUD1+0>4TQ6zVfH3TQ;%l6#(_%yspK@3gcmG#Q4!WCPyLU93nMKk7E2pcA=l45({2jNho>sdF*A~bA zxX?-cp~y_z_kFf+yqu3m#QiB}03?Z&9vvR5TNgj<)($Vm)xq5G>|o2sFMag&6aNF+ WAT1?sQBYt20000iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_error.png new file mode 100644 index 0000000000000000000000000000000000000000..f07f449a44ff2761bfc7b752db3d08d0e1238b02 GIT binary patch literal 793 zcmV+!1LpjRP)lHwhvrAu0-@MQwt}+5~MQTtu}C0%;W( z1<{R?aHBz*g;pk%AyQVBR_Zu5m~;ES_vxI-O!vIF|H*|T{l`n#garr?$RMk>)?Y48 z(ZF2yTneKb};DNWF+jK)IF`6_IfJ{i|F3o%Q+l&4_HGBD|ACE8na_6>L z=s{^>-C(a7J$6=8A_%h5W!1K6dcL!D?XX+Ndk)oei?UundDpX_E&1Y&`)3P8#Ny0s z2Ag7_&ZPhyGj%)g&S6V2LNun1;iBQm#Fwlfv zgyESZR$X}2P;=RW!2zid1r$hBL{K7>2qi*f7>pT1=RdT3@-anEoH{ z={KFOO;Dh#bV*jaN>}M>RZqQd`S=6O9C3KpI~I>l%QFYfo;jqQYe5fcn`)+)zMm6P z4X&L(>gnN0!%J4^rhX->?$S5bY<=GEU%jc!KLL8sww-Eg;h z`H-yBHa)yfojYT}&G*GFc$<(Yja_q=lZvj66DC^O5%$B)|Z(CeD=n`|eM04SP; z>-=-l+xdJjA~vR6^xB#o{ehf~tSM`iwaQv$O<8NIHA}W_WOw*~ XD^gE}t;YAo00000NkvXXu0mjfl6ZQ> literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9 GIT binary patch literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_find.png new file mode 100644 index 0000000000000000000000000000000000000000..2f193889f7ea091c292acdd684c595dcb206b5c4 GIT binary patch literal 879 zcmV-#1CacQP)@+1&aazfGU7ezSm^v zpACwO+tu0su66!(dT=`e05DeeCnCFJW(8|RKtKa{4LGONnx2V85A4m%PEQ?MEtR-esdM$pB-`H542D0)N2zSC6Imf)4L8?>%ZrW+H>xCKi$unm zvGZq-*Q%Aahx;C*=l+K%-?>XB)6TB$-L$r*`RUvlA`xP1NG2?)ge8@TQ4EN|Jks0u zcDg;oFC#-#R`YbWB`D?Q`1#y7l$LXhjSLf8AvQuB84}i#j0^!#g{VE#(K7h@5pFHy zSenl=@XBEdxp`h2Ji>CR%=qXJ7!e|?paKet-~;#ok#jETyeB(5&Bkhp;!+;51~G=) zH?L7xmDUu_h+a$+xuWom;AWW!mS$%%+436Rjc@}y?l1134kgD0AOf$OmjOR zstUlshZk$ZC!bAyIg{Y29z#&@3SJ;6D4+_eFume9^#TmMccC5u0J!ZCTnO6m$lnD| z5JeFHf`Xs~1vP>RLKI1GKDY<~pjr2&bi(fX;6Nj-ss@Ds0CcoO0H{JsEQkm{q03skAA);_bv3q{k31qwVo&s-q`Z?_e+j^w(WL? zl+uETs5+~xBU2};OqEE9ETLGwsMGe1%iTRNue)9}|0~E4B*@5#oRXZ9oRXZ9TqRep zPrGZuoOON4n@=uPbyP1y4G=+HktC6l(gZoFD>@_lXDrN?wo+zozGt3P=Qh+3L7+}q z2!WK7geXLnO3Vw;o12Skp%_E#+N#9;DDWP?Q-VS3B$v~Ha)dDzWn0zG~O(^_1!n0HYp-( z+;wPIdoFgQlpYV!10V>5@a)1LyGBMvoa}miyp(bxbMTM-FYNyx;V@TfYddyT00000 LNkvXXu0mjf90!wr literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_go.png new file mode 100644 index 0000000000000000000000000000000000000000..80fe1ed0cc75fbb67e9398ae686641f8fb287238 GIT binary patch literal 779 zcmV+m1N8ifP)JNR2Ufr z!Apo%Wf%b9=l#x^8AolrB&K9H?Pg_|78WA8(M3toqE%3B#7*srcF`i*xhupr27%Nr ziguah1+mN)U5GNmyEfQ3-e%_i&-vb-Co#(>FJ+EhQEwjRYVQ(&UYy{U@%vbY||>@4x=B^vIqabI?L* z;-S&DS^V3-ni4^fl|HMkOEbgX)(390>A}|VIypb5Xee4g;7ck zwKh^A3Mi1Mh@eC$5lV!}Fw%sP623U`g3pd_Hr5sunLvTskx4}&Gm%Q6L}(l4x}jCe z*81q1_4-O*ffi~_nMslo?EQ8t*&Ec(pzEw$vc}pKn_Qp0>D7Jr>ATNC3w@9f|Y+U&+)#!t7l&wKp+nP{PQsb+fb=Yf!Fu&5j8vpRj{FT>jD z>d>$sx;A&+`n$HcF}&sYKSyR;=(=9tvvOj@hUG;~4qTYk^_@E=?$*^_pVh_bGnOt~ z;pEw)j{SK$XVc;qy181rT655gW9NG{(yeablViIL>cDI_ux8m>Pp{tY$J0lgo4#ax za?j0EA3s0S!f>{~ykN9h_RhM&g3K(E`q(dE(Rd49+%xMeR9{qlWnmd{s#(SQ>PmFtSQqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d6626cb09eb11a298b90a8a27b0d8eab41f49a82 GIT binary patch literal 801 zcmV++1K#|JP)$lC4gU2-`f*>nhR-;k6IP7e>YO!0^w)WK%3$w02v-#>5Ep64PCP| zJihT#O|N+nT7XR2h7dAB?UEAOhJF^mol1i`QtQB`HSY}RE7=r! z)zaVIHr5?>v2Gz&fdYw&2ug$!p+txby(aWZ7(4QT)l2`jX7eMQ{>)lG6ev(fWKxmH zOr%mM5$6B%u~qGtCf40#`mbGj3s!n+^%wnJ&#rl>g<4Z)lB5J6f!?|AP275)Zswr* z%T}4~{;_(?waU!#?JabbF3Cy-kf0{R{z}6$e=5yMQKt3BPcl2>zoTPMqMwF;3!_n|>sT?~bK_-2O_m+o>GJ6h zt=+g$4n7y%1qVJI7*5Yw(hqM=JusY{d}*?U(Oj*gT655eZ>Ksn(qrd7v3}DX1}C>` z+X+8@+4-pVq_fxG zlU}~Ye!0+%>J+pPk+0wV{GM$QaYM?5ux)w2z59=S&H2+K?;gH$bZGzL&g5>G ft+noNiyiPkP9r@8gT|RZ00000NkvXXu0mjfuqTIu literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_lightning.png new file mode 100644 index 0000000000000000000000000000000000000000..7e568703d6432c530224e443771a04fc1e2e59c6 GIT binary patch literal 839 zcmV-N1GxN&P)73{`^;G#xwAtHz%LU)4b zqTRU=ve1RNa3QT=ZM7C`iJ~QFQ*9t7<~pX$d^7W%^M8FFCkcQj-~0ZRTBCB(J0^iD z-~e!d9LR`f3#|=(>$bPvx_D-~2jC%pJ=n_e_OK zeJ_2b-KdDDh@@UlzBSMC;EPygH_MwjWBnPGQegihBV73D?-x9PlHL9A=(Vg=8^d<4 z<9r=UkxuIm)*CO=9e###7PztDxUv}e?$0)rQicmYhV`pQ%S!g@;K(?TVfhM#E?bM| z=B0gfb6h@a8bf5FVT-SV~6}?X}9lK@@Yynoty&1zdZP@?RfODsl=2XzzU% zS8gIN43How+9%bK2S@Xbc`O>`z5`%^;pXGy8^4f>9^3!Sp@|O&)m;dOa3q6d;4P-l zca|=H_{G&m?D_+&-}r{u-J$5T=(X4R&)q|O^gN8cgv;s#@5sEPT5_Z)oFo9Ac>l+I zc4ng5zHpps|9)<_Rw>5bKzE(M1j)dFWI_%OH$BJSz0?T+02W0)_a>#vFqb!*d|5wB zzBUN|M&ty51O@=i?kiDrjQ{{}e|^rU?OS|RdxxP1p5mAw36cX72#`R6UsoeCQFI~! z0ATITp!vfeYyQ?Dr=^5BAshfEa0nB~JG?nUa2Aur006MC*<9`)86SPS(W^`H2n+xi ztOWohsFfVfVWrI7PSKW}BmkyPoj(-|J?ES|BGd-}fIxr{00@ANnO*ZR`#)pee4I5T Rmm>fG002ovPDHLkV1i|Hc$okI literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_link.png new file mode 100644 index 0000000000000000000000000000000000000000..312eab0914ab59271384686255d1be913a6b3add GIT binary patch literal 830 zcmV-E1Ht@>P)VWgGzD=Y79#JI$lhEn`|2MpRa?Bt#-nSD~P0P(mbVe{KrOBoKnSsk>m|ML{6l zBosu@om4j#WzNLRAk+{k1JRvL(MfE&vvbb->v>W{*z*1_uMP}0cIRX*?mz+wk%*#O z%0D-+$B*g1nRkvI+_3E8Pr1NC6@5M&4vWaLCnNlr;lNlr4i91z&)eBGqL{L{GNu;Fof}GS9{gM5BJuH;2QWk8yuOZdB3pGR#s8bd~ zAmt<>3Q=YH$t5YJ5;7@+8Uh6=ktBgY6#6Pa%2F?h910?U8cLT43KAj$Z1*==ra&gILO{WkHfs(--F=bly9l~${z@AT>V$oat!YAD@M zBE0v_F{`g#^wOSP-u~!wvlmXdd*uqFqoZ0^{&nEMDU+=!>({S0wrQhFmoB}Yq1)~0 z^{A)L8Xjzdr(W4_exYO6u3a{4*kIeXZMJUR>Q=ksjW_p!rAwDKYUs90>6Q|C>56o@ zbrSq^Xk7Gq#>dAsn@un`Hz$?w$;Ss`%jV7L%9ShgHFV~C)6M>B`Tp%|nqPc&G*A3| z)Qe+}vT4-x^t1~XE@(6wR;^lPWMo9n*~E!cy~)YRsT2{`?fqeIw-e7N@mOA%UcCIq z_kH(_EK7|>pM*1Wt2^DaDAp|cvp*@(ZZDKpYkKC^?97(`0sb&XTXy7N#sB~S07*qo IM6N<$f;YmCWB>pF literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_paintbrush.png new file mode 100644 index 0000000000000000000000000000000000000000..246a2f0b426faa0c7f5ba009e32b1deaf88d1288 GIT binary patch literal 813 zcmV+|1JeA7P)otxGRZMDZ!_a~nK|b_-`n%VosaL{KDuPV10`(1LIen8kX2Xff$3BE zah#djvFGJ&eE^89Pk*-O^+&d>FC~^GjRYVQ(uuPJyS|-v?9lxA-+tM5>1Qu*n+Ir1 z6KhA>X4$XDH6?-|E5oe1E?pQ5-M;2xw_ex!x}I2+b=}mPFW$U%^;o(Zg*LP!K^1kP%8ynsD^= z1y^6xD1#GLjO{VLdh@0GKY7;d$+NGukV)GRLPn^=q=dF%B#XaJrNP`0E6=}e&Gj3d zKJbQre*WXt!60_DnIzgMQc6S#fvjXxsE1v7;T;njHkdy2miIqAS(nX~o%cO+q+b#h z5tIleLWvL=dQE8OC#{%y*Tnku&K`Tuub&_ELI0t_ea{@3f>Jv&sYqld(%}3_GY3Dm z;O{3*Y?v^A`a|D;^qrM=ykI)U6QHd%WhO~VF!SGjGn0GOZrc3mGZudNl9{Q#X5&-F zuGwVReFLBjE5jr!!^-5*L%!I%PkYH#Hs5rMrEBl^)9)9XTD;xjHFxVZMc3~Dw6#k$ z(-S}RE$bgMHv6Z`mS5|u$$78sp4G-8b@lVkl`HtEv+MGn!F&bKcHPi$$oP_;=BrPf z$(~b3&p3CsuQxhoV$%jIR;`lB-s7FDX)xCTXuJ7ZyIQk96uIR=HBt%-P?N*bp`)EF zq14c}QM+O70NTOa@V~_)&GMZ$^cQDlkyOCa(H3Mf+6xhCuZh`VSN{cQBl5Ys9{cp( rh`2H3A^=GuC6HjQ*7|*0>;m{7QlnX3z3MSD00000NkvXXu0mjfR5FYo literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..968f073fdddc1cc0f0800b1ac4001cd9a55f053d GIT binary patch literal 703 zcmV;w0zmzVP)AVs!l4K}n~L(tL`6d4Up4iSWnZ3Qg~4n+_J zDGk-qQdogO5JUtO-d5pRp7Nd7_r1^a|M&Zq%mn9Oe((|e0sw%Ur!K7T1pojj=U#f? zQM`qbQrM^DPkwa?DK_be^~z<~RgSMIa<`xP_4P7gg2jCwJ{9^k!fsU=#Ti|%I3p;>90Qd+7|~0h&mIklA#nb>ATL2+v$&u)OBgB z;nsHb)I&QRKeX40H~~cIZxCd}5C} z=79lXoXK%6YlyLtsV$~bSm?Upq|DJh#{|*a7XMm`4QJWZ>s6nL2R1|&J z0VPEwJ9?!n`o5PKAjc->P1Gi8BY*%!5&FVp=#)$mMJYul1Jton}gujiUf??eOy!x&!tsjxy;=Q3_DdcXx=a^OBhW0N~`A@4xB0a*%F? l+@c^sQA%W+?pa#c`9H5UNfS6T{e=Jk002ovPDHLkV1grvM=byV literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_red.png new file mode 100644 index 0000000000000000000000000000000000000000..0b18247da5850f3c2486373a3e179acd2772e8aa GIT binary patch literal 641 zcmV-{0)G98P);68^@7JE5sw#jpE*579S@TLkU(6yap1yN*Zuy>-hV%Q_v4Ar&!63c8OBr(ZRhFu z_kWs36-AmgZCT>x!RqM;Zu9tqvoHI~k@UmYo_g(*J3c%2{N8}7I+|qKPQzv}7t>%W zsu&9G)UmCzkDYSw{fBnuW4j;1fKV_nicw`$8C6D=F_qu`zUiK$2Oc?5UVY+D(`I@R zW`KlwqLftWHH3Z2_XVNfKn>VgT~k=@- z+N>c>0|@A_HbI9Jn`v0~7cfIF(TS69zaomDS1QtgvaBBfGEPLHccO2~3jc>n^6}^HAEh-2#VxC7YYcDXv!L9X= z-R*SOUvIs;n`8(LxP4~^2|JsiN^hq6cU}5dn4v1~Kl{eT7pm&f$PoY`hyVe%y8G*S bxB&kH@RuR86sIAS00000NkvXXu0mjfZBi!% literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..cf347c7d4685128a4a447abb9fb8e939417644f4 GIT binary patch literal 858 zcmV-g1Eu_lP)`6pHR2Ufr z!EI=jWf;Km|8+n2IrHqe<9xxFVk)&(Nh?w$Xk`TAyvb=#e=0aySC z00NkRDM597_LiNIJ2M^qhuTvB004REvvU8@of{r?P8tmo3;+Pk0F0@*jAMhdOkS&1 zhJPPfQa;pP0|4+Yk%#j>X}o-s#EF1_DMV93FsfPP`G*>Ks>L&)Q}w2g%slu0kBfW1 z+*$*0BC^oTl6>OGIq(9BgG4|C90Dk-N_mPazGrQ7uHZ|>BLD!-KmZ)z1e^#?1Sf(M z!6m}K(^b|i%$TcA5bC}r$tAA?0C)g1@CgWliJ;NAk&ZF+-w#}$`-3nZ32C6IVKrHp zr+(!L2hRfF&AsTw>_@ z1y23;E%Oz}?q^Q2d($ayO;-sON2t7$w(Z|o0Pw1YnSp^}0PI+I5HnDNsFCA?oorkG z5sUIGIq=FSyxcj+xlhkm0en=52Bx3@02o12gdAU$_i?v6iyFMuc7P9#zQ-Hf; zVuV$t9P5`m)F2w1?t6{<8%wk{w-PP#Sj#%1MbsjrSI6n;D_@8q9`~W98dNQf$j=iI z6~hpgww&be%X_HI50Hhx@W==u4TLPB;ei-J-1}G8wH}|{i#Lk-WZAyfv}k4y0|fvU zZTy^$u6L>2nWo(NDSV2@MRD}JQ4(c%G%=dG@_vxH?>gcH#*Ue2HC}9sapf8X?R$Z;XEnm&g zW99mh)5jNw008mK8)r^`_{yH0rNn%u1|SpC(tjf#om=+r#lh+?Kb>DVb9`|C0Bvbv zN3U(>f4-tAC1hosRoA7p(b(hL*V}(j>ug<`&U)|l$6o$)!>PBQ9RQSwn9asj2p*|xhU*R^vq?*Twb0t!lm5}`yW5lRy-U0ZYK?8to!;o!r!XeOE$ z0HB3T+6EEoI4PlR=wonwqJ+TvCoWh&$?CAPVYcU= zD{DS0?AkOtb@-hh^ZLq~FMjxYf19X?pa_YqtgZGvv2TaxcF#KT?O%=_*a-kW_;N|D zakkWsOe!)HsT5WRBiC+p;N-c>0Qwy(1D2MDBC595oXSiR07)sKNk-%9*rDBOO^HUD zZW#;)R&EZpqha<(HK$(tZYU#V29<@0qCXgU{gXeGpc_|pTqQD-WO|}%yKZbeX7k*H z2W~CK$v8NBAq~czrc5A(v51g0Wma7`G8}f=ZcuAiYYxZan@gP(;Ku66M6?bquGiHe z3Q0ya)%Lvk@kLixZfZyU@#UFbv+>pYhcj8TRKSr_sWG8i^X~UA**LvbD3(_Lba3xm ziYcpup*A9qJ$?AA=Og05lndxfwr`!C+O~h|B~4 z01q8H`StcY);%&mId7_+)76ovRpeNWRp&4M?#jx@|E-)x%P*A6t^fc407*qoM6N<$ Ef@ddc(f|Me literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white.png new file mode 100644 index 0000000000000000000000000000000000000000..8b8b1ca0000bc8fa8d0379926736029f8fabe364 GIT binary patch literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_acrobat.png new file mode 100644 index 0000000000000000000000000000000000000000..8f8095e46fa4965700afe1f9d065d8a37b101676 GIT binary patch literal 591 zcmV-V0~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_actionscript.png new file mode 100644 index 0000000000000000000000000000000000000000..159b24075191fc259cfd80c797a1b0d74c168422 GIT binary patch literal 664 zcmV;J0%!e+P)7Z7t2}reCh0o`+ zAlt$F2tW%oO@m<=(B8a-_VgLl#~yUMUDWG!0qFPppd^03e+x1WpkO1NhIaKD2A)-@ z=Py8(Wi%R%JtYZG#sTKH@6Z+&!S3Edf8jFJJNKuva#KJQD3X^7;H^fd2di znEN&c58aUG>`>P{Vqq$kLb+TP{?I!d4(|o59X_%|nVEZq2Rk60n7072SWJ{64CV?3 zgS!EB=eYxwQ>P2&$}(iT6UMvuFgHHIEdNA29!EBtg=v~X!DxxEH~}L2zn|52%xalaq@DTdhh{EVwv0IaQ=!?daer zTKp4I`l8SDt;d{8Q`5Ko;BXUi&oAG1l4}59P-{|^S(Rmord5s6qsh<&m@Ab^wqCD) zHyRD}lKLDzpYN&@q5&*47mGzGiqcXpmqR9#K|CH8kXS4RNs`(iEF%HjP%f8ItyaZK z6$%Apvsok(2>~dTO5jTZfq;N?0ch4l01f$k9?4{~Youl-#x{UDMr#AFIkz@SDwPtQ z$gQ^$2|*(Ps9LQiav_8o8Ne<=Zx1*M*syo80sEO1tB%>5 zfdHB`1z+!R@?ghPRKmL)hWEvZE$=*54ose*0JiUNTM_)cMDXhxEKg(?-pD=y<)L4J zT0dSyD0&NhJ$^_8Ko9uom%-ZM4BTM{Tw$9qyPj=-9W;N(Wi@3*-Q4pq`Gcp}^vvNr zyd&PsmG>fpCSZz?K}UIEd;HGgG%0MG>ymxKPwy{>wy(m*Atq7)0000~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU7Lxm88-p zDk^c;sHj}OKUc4lGZU}6umlGVNAJx0%sKDOFwQx|V2pVvxhYKe|L9TNk!~md3BVrm zYPDL8Hk*yU-ER3~LGwJ7N`0ZV&nOhBI{~~A;@ND*=kxg?#^W&`4u`zk?Mg_e)8XlK z`T#M+OaR1!<#Nf_>$S`xrqd}OjYhoJ>q)?3vEX8pY&I()ERjfjrXM$k7e+-Qs3Ihj zNyOuEQ2EGYG7ro!o6VOBQEwuV2z)*tR8>WxP{616FY)p1Pn1d}#9}cxolZC$4n(6- z35hJq0;FlHC{ zp*iF(lgUK(E`($(s9pJ8Kn?(M734H_63WHtf}6SQQ_MXEP!#0|&@>J8dL5TfG&tBw z#tYn{TCGZvAr>cca%YYn^!t73tg8OOJ2FvJ(`YpCyVZi*?Ur+1uUA$hAg8-aK)c;e zQ<)!XwHh|n&ND=$@^)>aF-`~n}#*WMkD*M|f8r$i*z7+W! qF|A!t*4fE(R`<_YIkN&?Jng?3oQ|aAqClPi0000t>5xmo{nArfL4CJwMMm+N`pQ3p^Le$?rMud6Rbxz!-yG7bz2z$^USP5(;udf(gfQ zG~f68y^)EvcNWp#bUoDt2=h+^%o-?-|mo~iieWqLNP<0m@2PTB7ftyb= z@H`K$>v9Pr5X`L|rw&CEN2(9SB7A2SE;d|j9@*F}sd(@*2l|P*fWfK>1drZUrtUA7 zNXO~pKn1cjf~~TLbje1g>EPPzN2GH#UIBxJ{}S9=E`{zs-w#hO?vcH+hJxroI5v?j zD!4lP0WXq8zUx3RAP@|Gq$}6wXCjFLZY^YSWBxN9#&g)ro$%5}aYn#y=tJ_aIT%4d z5d4u`rlp!};XGmbZkJE*kYJoi&N0pd*yxY{0${xD;;Q1h^8f$<07*qoM6N<$f(}t7 Ae*gdg literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code.png new file mode 100644 index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615 GIT binary patch literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_code_red.png new file mode 100644 index 0000000000000000000000000000000000000000..87a69145075afd8f8fd8b391c5da1249ec8b2889 GIT binary patch literal 587 zcmV-R0<`^!P)LWh{^|hy<@Q*xw+qo|KpY<+vaXbbW{L4q( zTsjXEJvb}e%bgb=o%W0h?4u1;^bWTqH8}5Th002ovPDHLkV1nrS0P+9; literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_coldfusion.png new file mode 100644 index 0000000000000000000000000000000000000000..c66011fb0fbdcbf210483d676b7131542a0e282b GIT binary patch literal 592 zcmV-W0k7R5;6x zlV4BMP#DI+Z{WQcKZBTk0lfkj5F$ztWhP#lcuyb@0@rA^#Kpu5KLA&Rgc}o#aSmis zrZC__xY^&#cI&!!{c|4Q_tcec*#b>|Y15wPcY2=o3;-Bl=(t4;6Ok*pL)-{*A;GX^ zS(@WGp6j~k1wBVR9)BB_gar`}HyRBXh7nM!)u5^>N~MyN6bc0-5{W?44iB<`2biXb zR;wk?jIQg@G!5l)SqhrXCU}x$GU-dY1sra}0uCq@153FUULT=jNwSk}0WBjKz}Jdu z<5gB*<^XtpAmp3m^ZEXQZWd1krhft}CoYaF4cSMvTJ01}X3X37KYdx-D0$c{doUe8 ztY{vlGr-e*;N!WAV%_hgUawyYrhegW>^F)pv%uUTFslHn; zvJ)l{%w(~{!O4`KTmK{Q{zCYltLfs&4?nz|6IdlqHCvX;|HGv~!QW?8P~_d#e0$v$ z)5XHEz{3>qMiH`1+qNYf?huS+@L`J9_$cjJF)Hf?@pu;)`9}BXwGUM{2!{y-4|Z{L zG>z?O%Cp8P5T#j1DID7u_*(Jg?7iss8AZQ+&;u_J{FmILf((9eoiL5nGUe>Fgq*U$z0000 zJ3A|*qoWOonz+4ZQ0KNhDB07SX1?#FrNy8%K)_l}y&kh`*KYdy`Y99&tgNgMLSSrc z?B?+B@HO@P-jS~z2Rgc6yy~Y~%>oJpBxsb$5<&nRLqiuR7K=@0SZj~jTs|sv_jWVX zGe?WflejOaq|Vec=s9+ahmXbyJ|T)Sl*?s82sr2H?Ce~HD5WI+Sz&tmWrN()wI2}+ zKqg92t*l^-#ae~;9%KFlWkmwnY=-UK`_|%ICZ#P1gdjK<2n38VXsuC7{WiU!fZFmm zW~Sda9(Qi@pxO}$ARY+;t##Ao27usOqNt7Hwq6K7G1il@xitj=LIM&{N&#SuX;x4x zmG6FhCg-$PI;hQ=;1iZ>F>^~@)IPi;l}fX?SZ!QiO=X<|pSVkNpJuLHzW(FT_~W-v z?vFpkyE>8ee4d=7wKauH5~dd_M7d2Aa=ICC{Nj7Blqv&DQEP#j_VeWV&WXL>c=LLK zsmYg^_JiDb;%U!UxO%qjFAvsDFj-kzT2$GbV(ZopPM$i$z`!7jvEk07BcC=6FMt4` z*0u3Sy`0b~%#(0000K literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f31a278e17993d8d4e13beac2f9d5f7b42d08f GIT binary patch literal 309 zcmV-50m}Y~P)sF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?u_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000zE0Ay_3@1Z_7#f-XWL#E{8Al7>L$ z0Rx7lnddoqAyfT%&#`$;v0@*5YdW3w z7mLNoa=FAshK% zDiy@zakyMAxr-H?iQDZi^!t5;Eno2A=?>mMx`Vg(Z!?<53LHLvfTPa`$mjDcX*Qdv zR;ylN4OH+m)fVX&Z#yZpUae;ss@a$K&})gHovkhr@w#xyPVlfVgXti1_357y%I-UHDvRWYvPEX+#g+j4Q9ayba zh7uQN1j%HQgA=Fp9DfODAU^*3*FCs^6IpO7xg`RUXyP)(;=d!ly=#I^l3e0Cub`{H Z`5PU3+D2e&<<>s`J(VpX#y^kqzQ;#=2x({YMw9Q&ndHT&`BD$#%Ql?{+)-OuSA`r}MWJ zVg+2Gc(GW}a=BERPNy^;kEz$|38dTYlFQ{%5S!g@|8f8D_!Nu9_Ni2glF1}xG8xi! zorc39&F6EPOeWOt_XS`W2H_Bo$MXugy}SEctJQj=(TLXTHL(jRXfzs>NF=0SHk;94 zF!&HjdZNX(3U3;LY64IMX__Xv%_wjLC!J2`0Jw?X=zPK$C$`&dYPDKaC={e16bcE@ zgun^<0k;ak*=xLE)@(Lqu~MmsFoMCLY&0Qog`NO(h@kyxaA%EbwJLy8sU*Vi`~52K zX0wrqW;_LmMq@evX4iAM9Od(Q0eHP$1%L|xAh@vrqB`HPQLon}f3aAka=9!3hr=O- z5F9`#J_7Jhah=U(4RjaRhkS4Xkk98kDz-`i!r|~~AQ1TFcDw(@<8g{aBE)l)PNxNE zI(RPyc>9e{@WGSMU%i7*v{!&P$WLz25)0oc=Dl-yy%xYZAm4b-rttL7UjR#%`#j_F R;_m(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000)l$0ECbfb-0$}>7z|u>IvuoHEmW&j4lzv=KA+EpIObc7e7{sGA)QVmnM@*^ z%|h38^m;wC+ilpk%>l#V5LCqP_y2_Cayd^XlX;j*r54R*lW!zbqtSpQNyz8(JVmWm zyV4S$2{Uhyc{Cb0QQbf{ZGT{Kr zvJi{K_&f+q^Pv4MK$hhS4TgFj_FD*rLOePdE-E^T7ZzTFCRUB`*?9&h(a#C!-v8lWG#k3AOJQaUey6Oasked^kDPe=Khg@7s584 zg`XfS1)&u*_c;I76#%`kkBfiZgKKo@0)9d6vZw=ExQUtV?eW{Y1Xv}=4X(2zy85d> Y0C^(qLv?Ui{{R3007*qoM6N<$f-gW7od5s; literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b93e77600def75c9a144d3d0a5088a62c02cbb0b GIT binary patch literal 618 zcmV-w0+s!VP)$>5Y&axjp2O=VLu>*f>1L;s0)kkvKC!*u?s6CVL=HJ6oP~pNfZc; zsKr=bq;7MITw8NXw{SZm%59TId2x_9BQ zV86`NuvGI!>o^V!Na!=$7GJE{Cq`b+XwknM{UcGHFTTfmuS+ zm-zYC!P3+zmY;SG$?!fYkOih`QYaLxyF}A86h$GGN}kFj)_o*0e zjPMP%zTG7FYMAfO2Nn1D`D0Cj?Wl>5q%@CE10nX)KxpNmwk+!IWkzywiYD( zqUXiYYIq3qcRyMGJ;IY`(Gz~E$J$zu2+R{)xGlE*88b3WK6V*J>}2iPY1HH|tER0W z_+^^FdppY?o)Gt5M2`%xwRDH@R3G}^i1l4|6uchm0X0f!@&YdVLB5K&dd7Rv{)DXX zt^&vP;}kqj3f>94j+4xd93>s|Q!Ezi>?r8(Il$P}PFxSqu{d*!Y%*#cX(R0f|Juz# z3o0_xI14Al->1uky@W-rCI_%l&>PK^TXNSN{byMk2AI5vbwp!K-%-@!-vPR3iikL1L7HA!^!~ChCFU#lnGzp88=I z67V8PHBo4(l$u?-AKmT8?#_0rKW9dUNRbpLc`}piywAM9$xZ-3fR1C75T(BjCn-l* zjUcci2oXXo-}iqun@#)+`W@kL_-U&|2>MxZy~3IdmRm&8b)9!2%ksg3R)nNnT*TJOC=6{2hG86Dz+<^p6qfG5$i^UNUh+u)CD7O2 zK>Ioazn;U|+X0x$=feveYZL1W*Fm%e5P1sajd#eW#^5(ddx76*pt$^)b}$Q4oPabL zLc^HF>Z{8za;f$LtN0P$6C?1{X*jtXkRJ8IEeyiSzencvH3Ux_y>y^}wfJrRCQN#9 z?&e+C>sSAfrE%mZD5RfZ`gSndD)=P?+nG5Oq$zmY&-v+gc7R6c0u8^Ke#|XOq?gF@othF3zFpM8Il<8BJrWqBtF>b#_ye4{0)Xbu6j&@UIhRE002ov JPDHLkV1nWI9dZBw literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..b977d7e52e2446ea01201c5c7209ac3a05f12c9f GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_find.png new file mode 100644 index 0000000000000000000000000000000000000000..581843637079359a6a58fcdccf0763690c67b063 GIT binary patch literal 676 zcmV;V0$crwP)_k3`4d{s8lK_6bi^@vq&To98fNoK}7)fx$e2^Y&@<^jR_Ee+8}KG;X`@ z@bCyiolqX>bb1ZIs%QGnjzFU~L8H~d?e;*XP(h(S262}XyZ3a0h07r{KV?E70l+e- zE`%3x|M5#q+;HOC(h@A^M)7Rn13dm0&>K$j%k_F4wOWlsNCIH+!c_#{eS&TL8v4yc zcpnPEY`cQzZ$ILq{U-MA6Z6Z|1p!FZjQ}tXSb25J@HphEqX-6Hqo?-_Zn@{d#>2Ml zJGhxTAd&emK$lV-QK&VM&ix0Xy{GyS3Wp(+E1^8BhD3T0a)m-Lw@Lu4zQRrP)9(3F z^>$hh@N>OAXrmPYunLi|fJ$_*5i`46;M>~*5D{bp>-OL3{+!MJa`3kv~Q#QfQ%c z)1s}QE<_XaYBG;IuRF=td#+}fi4h(6HgoUyJLi0t(*dA^B)%@8kkG&bdM5P5^Z5WF z%d%>m^SbN0XeV)wbUOXn5Ag#A$gJx+7-OCkMM1S%MWIlTkbFLmOeW(&n&wUd&;`>p zVcRy$Z{K0=?SpNnP^;BYEEXleFbq(UY&LrXX$6qkJ~)8+b{=jj3HEXds;Z(?D%}}L zX3`39&dy=Zyar!ehA}e>w)(*vrCct{PI9^2Jpj&OZS8<3-@{0(gNv%1{)zAiLY+_^ zl}e>Ofd4&#Irj#7>=o=Uhv5IJ@?sN0^J|(WL2Uun$4}si6}TG-s3T#p&6GE<<2W)O zf{^Y2HlO#*QDvTp3v&d@;8*}aUC4lisG9(w7@d5Y8y)}U#FwCkqp*Mcgme4{&gGRf zlBfd`nF9cQBKB2_L{F8G2)7pAf$i)Ds`|}-c>pc^LRW{w4SQ)3N^BbZx)6BlCZts! zKph%`(m#xg-q3I7=(us;9<)*2%iuQ1J`oV3gU6V~T}^JU5714JN33&GwEEru0d}Uo U{MPL+lmGw#07*qoM6N<$f^vibe*gdg literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_freehand.png new file mode 100644 index 0000000000000000000000000000000000000000..8d719df5205f7415ce657e5c277db4533c82f346 GIT binary patch literal 639 zcmV-_0)YLAP)p{{sC7)XB-g4w*W1a1)XtvxrMYa1o?wn&v~3 zHnC|#(>B_M1d`_7gfzLiHy=0c<2kQQdXu*33(xYN_xYW39(cz9jEVT%VokB8|DoF~ z8u%Q5sdl@4VB7X#uh+v_;yOGY&pRi?378ghv)P1cngiAAb<}D#l*?rWDV0j_dc6Zk z-|P~AJZQCA=yWcQjG8fYnimzj*3KqTfN0Cy!G^$7)+bQ$+mHVd1J zvwOR^5Lm<|R+uyB1Nu4vL?d4qa3tn?9H7SZH@~u=fFHEDfSH|bHU6kh0O3%cLdyny z{`9S2Sw~WMy0MPy!64i`jdk4Z3>^+KIL_fN2V_d&ywBt`^IJpxUI$=YAph~5`;xCe Z{s%Y0vkUXDnO6V+002ovPDHLkV1loX8z=w( literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_gear.png new file mode 100644 index 0000000000000000000000000000000000000000..106f5aa3611a4807ec8c21701c631730275089a4 GIT binary patch literal 402 zcmV;D0d4+?P)<@FR}JvtGRKa0_WfK^c7uXaFH3q@Y!Hnl8VySc`OtkPN3;#l*y*l23+99h*9JzA00}rAC!#M1dZ#v9YOBH|eC*${MmzzYjBu!!-< zK8tujf&(6i)1biy*F>4{f*Kd(IU-JsG&#b_@NgTnx@40)2@2%c;*=?-2Za=}O}7&( w%_K#(S>e1j&gfY?mR})n>>0+8p`iTe2d1K2h8#$+)&Kwi07*qoM6N<$f(2cptN;K2 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_get.png new file mode 100644 index 0000000000000000000000000000000000000000..e4a1ecba1b60e54f3777717ed105cdde745b7184 GIT binary patch literal 516 zcmV+f0{i`mP)o)wchR-92qq~y6`XqbKmElbB3z{pkZs0VPF`CFvS?7jDn^mFo>d9Y&06* z&1MsS!M-CH3ee+h_sy)Ms%B*ec3R0RpVi9?*mU84yoq(Bw8 z<4(999dJJE!V%pWT~HGRIAb;(#O%2K3?uRpz}AfgE8e9q&OSdr^e^}lC$QXZz;S2A z)w>^oHy>?v)q--`!pmuBe96PxP0u*inQvyFW(llfv9 zXV1s*Jh`y2H%B3ZTA(AzpsQ?hb6_PyZ=c1?_B4fbl>G%!@ubJln=!)x0000#DY{xaiib^#X=YT4@yE_&2#eBulEdzjE`u&@G%2(&u{J-<}d(^uY4W_kMfEX z@!X)AR9F&FL?RJyJRUzvBoeqN{5kY`z3wcM0+du73~_0|*lac! z42Dw(Eg1o{Ash}P8jXrqN+1w`*XxDD;ShmPCZC7#4;wWbHoMvBl$=zF-`?*9j*Nbjd=v@OWt_BgKxP-3wd zy37?ATx&$b+&zRM!K;BD%Okw`Sb@&Pak8$KRX19jWZmC0&n*Ggv%j8nvSPDFw zEkV65AGOoBQ8kf`R|}Px*&INNS%osq9b{Fq2I(x6@xM>tg=vRLF?I`0rWzHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e-C#5QQ<|d}62BjvZR2H60wE-&H<>}%WqH(_V;zPbB1rgSSSC(0? zWlQ#?N3UgnJ9m2C29w!SwoOo5_2Iq!<8vCyEoDoj@#oV($oJEg6Bj@;nD|2g8 s%L|>IZ381yx9RvPhV4J)*SeoEV4lyr#k*`nfWBbxboFyt=akR{0DpOPi2wiq literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d61648452284da1bc28b10385f95b5d2bf027901 GIT binary patch literal 616 zcmV-u0+;=XP)-tZUVHjYHp;RjQ0M0pRlXN=mLv{hk9Ebp9&~+Wj-T9IkpzWPWd#fZ)d=zV^~S`;LE*!&u-?g42^wwN&Xr1~#d5ifl_2*B1OoS}CDno^8a50ArfE8;stQF>AP54J@H~%T zFz84s;dO!QJKD36(~!QOg!t_^gfFcSKDU4yK0+Ypg$NT^mIYcQ6bk*3P(lBLh7Df_ zTu=2xC#+-_%)|{Cv8zz0t|0y4D5M`xAc{gwOKc`ou<*&VjUREFHs1qd<_xSkKeTBt zgyCi=@jj;&Ns^GsWWaIUl0Y2azcDlF@u{(P*!+EH;lnU~b|Lv{4|4Hdkh!qoQHiE$ zY#y>KFA0QEw=4Z|uV{0A^`Y=D}hB$GP&<$bi8q(u;p^0(my3Rz7fP}|# zGZ&#uor4@c3q9r|f?H6-UZmfgKx(iV(MQ`MPWB>iC~SxnN5H*zb*A3#zWwgu&c|}3 zn^g87H{pdeasl%Lhmab&jC?lES}7C?4BFDNA<}20hoY@w_IU%i*T;}}wh!589}7~7 z#Ug`-R~4j&+K_y4kW@X7qLr-)S5qVKU)tO;+kXJ++{vPI@{hVK|PhMVVx_`)vx~zUs}c9O-Ok{00000NkvXXu0mjf DS5_-g literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_link.png new file mode 100644 index 0000000000000000000000000000000000000000..bf7bd1c9bfd78d689c73ba67cf914182933ee68c GIT binary patch literal 614 zcmV-s0-61ZP)OOAS;jTeL{ZSdz-%)SMH9tDF;N4B6%j=d15J&5qy`F#vB?Ar zqS1nH@%ny_XSI*Y>) z1f5QYdmzT>YciP<3WehS<{GovEaLGv27>{*-7f0&I$yJ^L%ZGPv1YT$V|u;*+ZCWz ztHI~CDVsuy($SfR6-`N~K?9GTB#l%%0h7 z-q`K-y~E)+s8lMyTrPL8^_pUo)9G|SluG5pPqw6!LJB_PzyJUM07*qoM6N<$f^=yZ AYybcN literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_magnify.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b74cc40f82fc83e4dfa6e9647ccc1b34e6ed7e GIT binary patch literal 554 zcmV+_0@eMAP)Vb2f>2}Fa82O3m(Ob=t*sniin`NpInLyMJgI`saru@YOPfh zy4g0#G*cV!#N%;Gq9_VH9?v%kjS3Rb1j8^;C={$Gp=lbj z*(?%?geA!5^Pok%UauwjA)v4g2`HedDw4_Mk4hhBQt?e7YJ5(hcj|3dNu^TOPGnjB zTTsqd3GIZ=Bb`n=7no)dflv&K(lsWw?lH6T1Yht0F9qgIuzh}ym0%n<3d3EBWB*pg z+G!I0lbAEXyd>k|QNuwr4=KX1D+tLPv)j@C1=N4sA4NF9A>HcO3G47*Y6!+SrUH-7 z1hb;^#S=r|`aMh>J#dWruAEf}gcR(DRUC`ZUev&$Sbh0SgLiTXeeHEU<$_YV;9281 zym`igIE%Sm8DpDw7@71Tv^EB5xSdUR*0$Mqp+Wq8OoaZtOg52&)zZ;;M=7#C1Yd6x svjx>8ad4e2x|*xHHwRjcjs6zA0XLDUqKT6dS^xk507*qoM6N<$f*wetruo^Ag2=LamM1T#~4RmC^m`_ zs}H7d&XJ}mg+hU?tu0noRvyjI&o2SRAeYZFesYkts79I^jJ7!A7%6nJwq8O?iT55M z1OQ` zbL{!Cp5o*IRmE9PInMCSPjTwfT~J+EYkz}tjxY=fg5Yf6EQ@DG$0kMJ9h^&$W}9BU zP1oj2;?MWVkKIEl)r=Y;L^Cx2q|>!)qJJ8zE7-V*-Cf7V8_2#1c0N975t~+&QUpQJ z5(uo(-O_`%Rj@U@t>JYAgd!>L?0Idxtd#oW2gc!jinsAEva8|kF4#Ic**mmml_{d^$s}Q5Q)KCys4sfck5bP1SyeHwh2`A<@N&t2j0^lgHC_^(pAAPCNjwl+>AN%C4Ll>_8Hjda%9 oS~i=#*e)>KsPlg0=2)Qg6BCqJ=F8HdGXMYp07*qoM6N<$f@i)wr~m)} literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_office.png new file mode 100644 index 0000000000000000000000000000000000000000..a65bcb3e1e9613cd9e4950850db43d7025a5fdf9 GIT binary patch literal 779 zcmV+m1N8ifP)JNR5;6x zll@CmQ5eTZ^k*a#RQf}fVOdd`5NJh6S(>6Cf$wEW#f&JyAR#GAn9>Gml;nOf3WCDa z5({5&UB$(IF?G#$x4X@Ickg!Y-HU!Z_rzX=qAq-XI_LS^=lOCT0|0{#{kBkYDS7{3 zD`iu%E=`cDX_^#^#n$5SIQ|4Zhsk8>N|zXHXG@*41$i-7`Jr{8`3S_OEcmY|RF48wXkk?WpdVM4OePBSbfh z#4_=eXJg@3epx~gi>QbUmO}Bm(ENN3+@c?jWiKvSrm(o|W}Ud*?vy~fn1!V~Cl4kB zI-;c!8f~-v)jX82%EG($>?;KSD$64f2&4qQ#=Yyrcpy$57RAVuV#vKMP)0hT$r6m# zc^F^XaJ8R9Q|}x^NoJYIvYZkq-z}Tnj@UJK2l2H zG}p+VvtjP2Z%bsb$~7QLJ9#pC0dKi`ppOd^_V;ME6tdzC0PtV|r=@e@37O`%0k^=5^`%cf$eu00N17Ro!{^30krz>a%3j34C?*{Mt2^a4~ zK=P+Qq%|f;Tc&+9ps;@Mw`EE%rgs&#y=j6BUGg96oIqdwj9-fiy*N(|@o)eD002ov JPDHLkV1j#pUPb@_ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_paint.png new file mode 100644 index 0000000000000000000000000000000000000000..23a37b891c2f5faa3b8128d45373ceab794ca609 GIT binary patch literal 688 zcmV;h0#E&kP)PK^TXt2QS_@2qt2T|9~baC-vaPn=ziepcfAwB$0!O2Q)E}1e8!q+9)KT5JVKU z7HNY}h##OS-BxWHWjD0wrPDeEfUClHs%Q6&2u@FTOJkKMQN|_Rlw6rQz$gPzqGNtj z#ruSeFeh835JJFiM6vp@6M5bXj%k7CMt%SIwfbF_fD-3*Os`9Ly_Q3WQ_SX33E{pX z9_WIeeTCGQ3wYALpBcK+P-iuw;3i&7xCua37k5# z`>c`M@sGeC7cdsdz`aE9lOz!hPholbyz%T85LYf6O*@SA+9&+^7k>+4M8$A8iNQq{ zQvn8k?-+dU`Z@gK0z$EtPV#+`^OH`R@cE-cuE&_!D)SZGxmQxeobP_Zwq zMEgi6ePN45N`|V1so0uE8^}1xw8s;VM%Ai@7} z2-&Cyvez_-O4?6uv{zTaj|YeYEk34i~K@`8YW2g{x* zc;7z3lItpVy_et{Z-ZZ)<@*%{l7Ao8mu@V7*gz<_1##mwW*%LEwCdzNsVLYx2*T-J z#HeQ*_a=R~KDdVNk$EVgAIRl$oQi_(`_IrdJciDpH|Xe{K-YsMtc!cRnFi$qzsr4z z5*$;ecov%3->1{YNy6-Gf(Ecy&_I$CjI#laeuE+S120^|Vjsf)W&i*H07*qoM6N<$ Ef)^4A_ab^avY?n0hpS-#mn_4{O$e%cm-@NH=3`90Wq+3`~HKArSdfX`&Z12 z(CY$VW-MNtXX4xy%yUeE?}*~0-|iByA@ZrwXgph4S*bhcc5{HB!DFVm_v}P*g7+Q~K}7K0lcp(^N@X>U zV`{ZpeIf${R6Hgg4FL^`X$Eu75k(PE6ycl$AW0Ic)#@rR7Z(7;V?i-dR1K935Jgcx zPfkwK>2wGokf!Nih^ARp6-6arYFG#(9Ta!x93nFEjoA==z(g?#sDg?Owk?Mg7K+>l zWYsf(<`#+$h9Sp6gFOg_dd+80SkUpk&xM7h0`Sov9W73spU;GP073|VfZ&Gd$J$*0<~TV5aPS|qWH57|VJz+d0000vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..134b6693687b2fa5fe36d48a9c0b8001f937c741 GIT binary patch literal 650 zcmV;50(Jd~P)VHAd+bMNh~)LLRqN>D)-jd9UvB%+hyKX5U|&4t0)fzgD-MPpQ$nHU%yoz=vI zMGb>1Xu!6Hw$NT~@Au<4P-+{9;Uw?&oj31uzH>xX0T7Xkz!(tn|Ed9-s_FqyReC13 z(ll)vW1O{Ck5ihay12Ob2ABc@RUI;zHpaMiyRDs0r>|D4rHw{ItJSJnYjt~jTbGuW z`X(~}?!&86q40R8<4zYw;$qi0^3ec=c&<&H;r`8W%H=Xymf^i;Wo6~<+}zx2UMzpC z*6MZN?(FMv`n|KO3(KFiUaucP0;Z!@LcUNa%8#vGK5aZ>wDgB0Gi=t*argWJcdlMQ z2#MpEX0wU+9&0U?N(F#OgpviU_Y{jYMsj65U3|PjwUOY}lUYj?MTiK_Il}NCVx-Eh zDx-TzMk7se+M#W_>?A1-x}ZXw3kkyz5kW)_hkjsi@RhKadN#H$Hq)$07*qoM6N<$f}lhwPXGV_ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_powerpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..c4eff0387d5888c638ba09473ba6d2369f7b56f0 GIT binary patch literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000JNR5;6( zlS@kiVHAe7MZY2;Xi-5)WxDDgv@tCUl*&p14T@Z~3ThM5LP4tuQfLu@EnG;nXc<8S z6&3BN?fx-cv-Kp6>HRiNTHE>$X( zD&=w+?GWC>?RLAGC6Yix;an~UmSt)tSf}1VS6N1N2ONORdD? zaj}w6DAZZdOud9Ep?M?{iQWbE5^9HLLZZF|1kdy0Tu4InEuboP9@nvbZ-P0n4AZTy zyMRIxRDmUE#LdqYuD=-Qz4N^bC`_#S7vcLn1M}{J(Wl3#c4VWczu&)AjUlh(11>gp>f`wv{KnjF%!aA*Jk N002ovPDHLkV1kkt*XsZP literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..f59b7c4365fa1720af1aa04eb47167ddaa6eeed4 GIT binary patch literal 626 zcmV-&0*(ENP)ZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_stack.png new file mode 100644 index 0000000000000000000000000000000000000000..44084add79b9a0fc3354d16bbd4b4b5ff8095da7 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R@9E+gqH(@-qA%AW0|7U8+xDRI z0k`B18}ImRw2g{jTGP$Pmx3yI6F_2s&$|`cJ!i0UN zB3H;=r{#{FwLaNVJ&hZl9+MTHGx1T^-A=Q0?hRb#8a~x50X%;`b6ik3cw=#XdxWy= zgrpBoDjpwP&g9<9h3x!k_B!?vuTJVkmIJ-U N;OXk;vd$@?2>|rNdMN+^ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_star.png new file mode 100644 index 0000000000000000000000000000000000000000..3a1441c9a12062a4bb3d706000d3ca14399aebca GIT binary patch literal 565 zcmV-50?Pe~P)SCZIX8XZzY2l?gCw6LlgWJ5Avz#QX4|&mI8LN)w~J1vgL=KLAhlWz*=#m~gyvxa z&;iC6gb?aZvMdXxX`<0+D1hs_pqJ!wxqlEH;CJ)je~uL(gpi@v>!I0f_Kl=E(E+Tq z26na*9gribxx-Oft(HnstyXUUy!39&E-cI%J5Rsy;(PGZH{g{ty!HVC&yGPT3H8x# zw{^gBPW)O0FMoh{k%l<`1a|To_Wl&u&-GXm8izU|&<&utILc4wc6s@u1bmTz6x{qg zTw@7=FQRcg&r`h+gcR$*Jbv+*DPk7v)B@e0o2 z6IlBXW&8xh@9)YKiV~2>+z&XKd24JT55YWz&JtfvCg4r^~bLP79-yS@n$OW00000NkvXXu0mjf DStt2z literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_swoosh.png new file mode 100644 index 0000000000000000000000000000000000000000..e7708292adabf4821612bfca032cbd019c63180b GIT binary patch literal 634 zcmV-=0)_pFP)KrcWDBzIw9XCtIF5G<@j zP(;CSqHxUrerI>~wKyloM4~t_Ofl@UFEj6$Bmm6p1aK6H{5zI_FOn(%k{CiRq?CT< zoV}Ey-7=-5nVFes;1m!f?EqZLIs4k$n%39XN4dPbtX{9DZnvvaiWV0aH9I>yf;2<< zHmo7WNC<&iE4ji-iKJpsBApDKiAiqWy8R$FV|M@E-RCB03vjWNGQZJxKCc-cSB=dq z#v3snoDMC=4<2BDgiZrv0Veh~mz(X=S@;fbe>CJO_5|oe2o3=wgfW(StLzI-qr&kc zhXEJ?9=`nWXzrUKL_p*Kr9u@95MU9EKqp2vi+%&1&gUn&>Ut_d3>wiyiAJg5G7j%G z#$sf%Kqau!AAHP&4Q?edl!FWqpT=C{D}$15WC#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R>*?YcqH(@;f-l!01CbW>s1Izr z3LkoHh<3E?TVANoG4CX|$empRCCS=R(U(hVJfm~E?IkDKRK&NP2|n`v>d(vV;W1uY zrFGVdwn;4b{qUtE`?GB`)E1ga&i2|7ncUL1b!KMq^QnT#_gn?_Z8(c`1Q~Vy3oL!N z$M8vHL&U1J3SJF!56azQU3B6>r|ZQ{U6)pC|tRy7$(5JQ<@7eB8yk=XcNf-aBIe#;8c_B$^=N z{-Iq&o3%O}V4~G($=zcP(LI|+6dq{?rby~MXwJQ*=!bOvl%?k zYY;jP^@M_k03MHL+-9?_3W5MN=moFW3xmPHU=-4Bw;62MrIhg_lwHEsv)V9U4x>+9cG2kIz8fWo`WyMMfz zdg-)p!<(hFR{VYSDJHEJn09O@#)%q0l?GUg9eS2~vKPUtd+=ak5lWLd-jI=;cjEf# zt$1;~?G!t@s+VLwL=P+Ks;E z!Jkh#NeohG;&02OFD7^EY zP!_PL2~i9VnPEW6Fz?O3dVF_U$duAL$=SU7&hNc@-drC5A4z=IgjR%B|D)?dOEaGb zuwod-$hPex$8oSoqK;@Z8u3EBfK@V2CKKqo?yA%2pjNA)(P%)HWf#)x^$?52W{|1b zPXOA$IfrSQV2q(qC_vLR)a!L9isAxjoeoJRlgE&G0Ga8krBVsGjZJJ-x6y1i(eL-q zwB%+o53no?l}ZJh#drAjlc6nhs3RTn;1IH+x;K#|X)!=#fM76)$IqT4^N}IF%aQ#o zTKS@*)|#L#jiCPi9~);c`x>TR|0{+9a?O5Exg#~V5W2C7G9nAAN(~f z2caqx&t~GhnK;qW3~&OuEke?%u(8Jxs_+ZVVz1^-uLrP95TahadGG$+(D&+%2QMF8 eFxE8s%l`oWamgLPAe&$S0000dKE@duOisOkyZ-5 zuwDqkAi_*y5o3Xrq7ieT<<3p#-R^dGySwea-CgZZZITBc?#1u+FtBuUCJUZe;~j-%Tu@ZpYB;$&ydfdZG#(j;(iB#^yRlqv#C*LO zXWXM0cpKKBlj#L6awm|;A38Zs3mg;sQZmCAZT8m@X{AlP6 zVI=SsiA16x=>2%^XV3U0y4~G+MNE!B{!#;~%L2l(14PX>EblXb{rnCSlVKe0dyf-O zuY#uOf}m&2xq80;4d3i|cuNw}U@sg3VKRU)>Os_1L3pl5mK*|?X3#a}K+EVZt&w?w zefXKP^ZqnW-3y9AhYJZ~r4m*!Z3OSz3d}2Q`nDM_f_u>L%8Cb}8`?bl)x?gwAy>zp z06y57kT6sry1g2l{|V%UW?)JwnbzUugbvpOF3=oZDo}spfs2EWKOH{_^59;ue!o^A z@e7dWS|QI`Ff-E$USJ`LqDF}zH%R}YOlMiv63A=qK^d}n!5_(fW%^k4U_D`_meIDi kNMKea>saR;>gt<+0gk_zsk5>Xc>n+a07*qoM6N<$f>Jg*?*IS* literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_width.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb880947ddf3e745c29e8d9dc90f09c7e6e323c GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_word.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8ecbf47672a874c0958d0d113a56162c2bd364 GIT binary patch literal 651 zcmV;60(AX}P)hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_world.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed2490ed1432d5d667a76235360824a1088e928 GIT binary patch literal 734 zcmV<40wMj0P)JT{hN;C#tgf#9krG=I>5!<*aE1_(spcgF}<`n4i zJi-}^6UUeU4jUFwdCiVPDm%`Zx^UBa8J(mnR6wEgz^}o8;)M*Y(@l_!Kfv)}4+NuM zaPXE50z)r)9=D=SR|RIqfQ^j}Hu!fzMeQBo+@PZk1G8hOw|vBTvkx`HM)Xe9q3xao z@`p0`NO!2904FHSLA6E@Y-O6zH$DQzvq@aHsz}}<(!v(Z_+EodX%R&NZW75g+nENo zV0020rxE^;7d!067AN>6*+&YLp$9uH6F-=In`XC{Cn%+o|5)b&boEPr02w@|P*oGm QmjD0&07*qoM6N<$g78X0Q~&?~ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..fecadd08afed92536be91ab12d8e37b6bf410d5d GIT binary patch literal 613 zcmV-r0-F7aP)wK%m(L+9IV|s|#(WRl-O^4GvaQsnHq|OstfO zIJ3}3<01}YGARE4m!7=)QisvlHUo!Qymx-@-t*p_129Ko-#pVI)6#!*kLj-AGXWNR zyA_{wKii_amK7^YT-v z6#plaNm#8`-kz@OvjIt^4%IN{@J3bR zRI}ME1Mv85p|%;RK>ViR>APPLB4;;BpCtqE@P+*7!G>I4UjNx~e>r3HA^tWCQ@S)l z{BslcSwL-CxQ&_ZZSv_g0Tu{yi*X){Mt|W7)lbE`SQxFP00000NkvXXu0mjf;)M*S literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib-cov/public/icons/page_white_zip.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4bbccdf1643f4ff5022fbc59b82546e259317e GIT binary patch literal 386 zcmV-|0e$|7P)_QM!1S$Bhw4w+iRuFWf;tfR6D%SMJrb+tx zC9R6{2>Ou6#juIy6u(I?|;&Owi$sRB4^20apB5xE2 z#B9XekY66S6lzfCL!eEQRgo0LokTA55@Y#%_wN!TXPw^Q4IIXsG~v#u_4t;x_HM16EQ@QRY+rut&97&UefsPmLrQ5P zBC2kcbux9L%2bJz$P$XV$*zSxb2e@6_3O#;&!FD<&hLjGn%~%en;7)djE^d6!t$lW7GyIOKlQ46hr`Z zjLNuRDP_53dNoN?wd&HMgL^m1DXFU<5dQsrceN>fSz00000)O9XRTN^$%%`*Fg>ryDtc(lF@?b>dE!20r+y z#Q*>(wbV5H`-E4Do={CJp7=ERhw15hgZi)?jRG88 zzVz(5;g?Td1izJyO33bhjg2Qc7FVY@f9!o)Gu?DII~vm-Dc?}3M!fsgjP?F(7`rgg z+xOk8XD)e?Zl=5+un`5!7kr?F=eq)K-5uqr%yU$1hLv){Vlm=)*5~`lwMciiXFu*g z)*Jkz6AF>#zb(Vx`Iv{bdGZHtlW)v(y5k^|xgSUc9%0}S20nrYrO}78ofk?bV!5)4 z=Ngz@+$9N1>>mA%IWx`Fqa240bWkiW;2TZgd8CZS0U}@mknC;!2;wi$eI@`h0y2JS`Eae0CW}q(2(%!m8 zWq$`PDU>LT1_y*bBv#P5<@q0@ttz$hIH}YMDvAigCc=y*)jY-VOpTd;A8@3t7Xh4r z0KTWOk;N2Ox4!&&^4B*no$WtTX!BXB)rg!y8dvGgKBQKLJNXRRp0}Bsjd1|LNQX~c zbC~fjrk2iL@4dYF*vt;}dFn(%h)n_-vzEIHMOKRkdF%3Lq|zBgKm_h>TEq!))nWjq zzn;B!?!(dQcHu$#=JF`cS&W~C`WHFW^B!~MI#k)>1Vk&eQy8P1O`J6V04{D@|7d6^ zyBABnh-d^H0FX&L07M||E0n_dp4v&Q%PSE9p#R#Hq)`5I_(B5CE#q dxjPz0{s-<+c#AC!i7@~G002ovPDHLkV1iPlpuqqD literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib-cov/public/style.css b/node_modules/express/node_modules/connect/lib-cov/public/style.css new file mode 100644 index 0000000..32b6507 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib-cov/public/style.css @@ -0,0 +1,141 @@ +body { + margin: 0; + padding: 80px 100px; + font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; + background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); + background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); + background-repeat: no-repeat; + color: #555; + -webkit-font-smoothing: antialiased; +} +h1, h2, h3 { + margin: 0; + font-size: 22px; + color: #343434; +} +h1 em, h2 em { + padding: 0 5px; + font-weight: normal; +} +h1 { + font-size: 60px; +} +h2 { + margin-top: 10px; +} +h3 { + margin: 5px 0 10px 0; + padding-bottom: 5px; + border-bottom: 1px solid #eee; + font-size: 18px; +} +ul { + margin: 0; + padding: 0; +} +ul li { + margin: 5px 0; + padding: 3px 8px; + list-style: none; +} +ul li:hover { + cursor: pointer; + color: #2e2e2e; +} +ul li .path { + padding-left: 5px; + font-weight: bold; +} +ul li .line { + padding-right: 5px; + font-style: italic; +} +ul li:first-child .path { + padding-left: 0; +} +p { + line-height: 1.5; +} +a { + color: #555; + text-decoration: none; +} +a:hover { + color: #303030; +} +#stacktrace { + margin-top: 15px; +} +.directory h1 { + margin-bottom: 15px; + font-size: 18px; +} +ul#files { + width: 100%; + height: 500px; +} +ul#files li { + padding: 0; +} +ul#files li img { + position: absolute; + top: 5px; + left: 5px; +} +ul#files li a { + position: relative; + display: block; + margin: 1px; + width: 30%; + height: 25px; + line-height: 25px; + text-indent: 8px; + float: left; + border: 1px solid transparent; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + overflow: hidden; + text-overflow: ellipsis; +} +ul#files li a.icon { + text-indent: 25px; +} +ul#files li a:focus, +ul#files li a:hover { + outline: none; + background: rgba(255,255,255,0.65); + border: 1px solid #ececec; +} +ul#files li a.highlight { + -webkit-transition: background .4s ease-in-out; + background: #ffff4f; + border-color: #E9DC51; +} +#search { + display: block; + position: fixed; + top: 20px; + right: 20px; + width: 90px; + -webkit-transition: width ease 0.2s, opacity ease 0.4s; + -moz-transition: width ease 0.2s, opacity ease 0.4s; + -webkit-border-radius: 32px; + -moz-border-radius: 32px; + -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -webkit-font-smoothing: antialiased; + text-align: left; + font: 13px "Helvetica Neue", Arial, sans-serif; + padding: 4px 10px; + border: none; + background: transparent; + margin-bottom: 0; + outline: none; + opacity: 0.7; + color: #888; +} +#search:focus { + width: 120px; + opacity: 1.0; +} diff --git a/node_modules/express/node_modules/connect/lib-cov/utils.js b/node_modules/express/node_modules/connect/lib-cov/utils.js new file mode 100644 index 0000000..2200dce --- /dev/null +++ b/node_modules/express/node_modules/connect/lib-cov/utils.js @@ -0,0 +1,282 @@ +/* automatically generated by JSCoverage - do not edit */ +if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; +if (! _$jscoverage['utils.js']) { + _$jscoverage['utils.js'] = []; + _$jscoverage['utils.js'][13] = 0; + _$jscoverage['utils.js'][26] = 0; + _$jscoverage['utils.js'][27] = 0; + _$jscoverage['utils.js'][39] = 0; + _$jscoverage['utils.js'][40] = 0; + _$jscoverage['utils.js'][41] = 0; + _$jscoverage['utils.js'][54] = 0; + _$jscoverage['utils.js'][55] = 0; + _$jscoverage['utils.js'][56] = 0; + _$jscoverage['utils.js'][57] = 0; + _$jscoverage['utils.js'][73] = 0; + _$jscoverage['utils.js'][74] = 0; + _$jscoverage['utils.js'][95] = 0; + _$jscoverage['utils.js'][96] = 0; + _$jscoverage['utils.js'][97] = 0; + _$jscoverage['utils.js'][98] = 0; + _$jscoverage['utils.js'][101] = 0; + _$jscoverage['utils.js'][112] = 0; + _$jscoverage['utils.js'][113] = 0; + _$jscoverage['utils.js'][132] = 0; + _$jscoverage['utils.js'][133] = 0; + _$jscoverage['utils.js'][147] = 0; + _$jscoverage['utils.js'][148] = 0; + _$jscoverage['utils.js'][149] = 0; + _$jscoverage['utils.js'][166] = 0; + _$jscoverage['utils.js'][167] = 0; + _$jscoverage['utils.js'][168] = 0; + _$jscoverage['utils.js'][169] = 0; + _$jscoverage['utils.js'][184] = 0; + _$jscoverage['utils.js'][185] = 0; + _$jscoverage['utils.js'][186] = 0; + _$jscoverage['utils.js'][187] = 0; + _$jscoverage['utils.js'][188] = 0; + _$jscoverage['utils.js'][189] = 0; + _$jscoverage['utils.js'][190] = 0; + _$jscoverage['utils.js'][191] = 0; + _$jscoverage['utils.js'][192] = 0; + _$jscoverage['utils.js'][196] = 0; + _$jscoverage['utils.js'][208] = 0; + _$jscoverage['utils.js'][209] = 0; + _$jscoverage['utils.js'][222] = 0; + _$jscoverage['utils.js'][223] = 0; + _$jscoverage['utils.js'][224] = 0; + _$jscoverage['utils.js'][225] = 0; + _$jscoverage['utils.js'][226] = 0; + _$jscoverage['utils.js'][228] = 0; + _$jscoverage['utils.js'][239] = 0; + _$jscoverage['utils.js'][240] = 0; + _$jscoverage['utils.js'][241] = 0; + _$jscoverage['utils.js'][242] = 0; + _$jscoverage['utils.js'][267] = 0; + _$jscoverage['utils.js'][276] = 0; + _$jscoverage['utils.js'][277] = 0; + _$jscoverage['utils.js'][278] = 0; + _$jscoverage['utils.js'][279] = 0; + _$jscoverage['utils.js'][292] = 0; + _$jscoverage['utils.js'][293] = 0; + _$jscoverage['utils.js'][305] = 0; + _$jscoverage['utils.js'][306] = 0; + _$jscoverage['utils.js'][307] = 0; + _$jscoverage['utils.js'][308] = 0; + _$jscoverage['utils.js'][319] = 0; + _$jscoverage['utils.js'][320] = 0; + _$jscoverage['utils.js'][321] = 0; + _$jscoverage['utils.js'][322] = 0; + _$jscoverage['utils.js'][334] = 0; + _$jscoverage['utils.js'][335] = 0; + _$jscoverage['utils.js'][346] = 0; + _$jscoverage['utils.js'][347] = 0; + _$jscoverage['utils.js'][350] = 0; + _$jscoverage['utils.js'][351] = 0; + _$jscoverage['utils.js'][355] = 0; + _$jscoverage['utils.js'][358] = 0; + _$jscoverage['utils.js'][369] = 0; + _$jscoverage['utils.js'][370] = 0; + _$jscoverage['utils.js'][371] = 0; + _$jscoverage['utils.js'][372] = 0; + _$jscoverage['utils.js'][374] = 0; + _$jscoverage['utils.js'][386] = 0; +} +_$jscoverage['utils.js'][13]++; +var http = require("http"), crypto = require("crypto"), parse = require("url").parse, signature = require("cookie-signature"); +_$jscoverage['utils.js'][26]++; +exports.hasBody = (function (req) { + _$jscoverage['utils.js'][27]++; + return "transfer-encoding" in req.headers || "content-length" in req.headers; +}); +_$jscoverage['utils.js'][39]++; +exports.mime = (function (req) { + _$jscoverage['utils.js'][40]++; + var str = req.headers["content-type"] || ""; + _$jscoverage['utils.js'][41]++; + return str.split(";")[0]; +}); +_$jscoverage['utils.js'][54]++; +exports.error = (function (code, msg) { + _$jscoverage['utils.js'][55]++; + var err = new Error(msg || http.STATUS_CODES[code]); + _$jscoverage['utils.js'][56]++; + err.status = code; + _$jscoverage['utils.js'][57]++; + return err; +}); +_$jscoverage['utils.js'][73]++; +exports.md5 = (function (str, encoding) { + _$jscoverage['utils.js'][74]++; + return crypto.createHash("md5").update(str).digest(encoding || "hex"); +}); +_$jscoverage['utils.js'][95]++; +exports.merge = (function (a, b) { + _$jscoverage['utils.js'][96]++; + if (a && b) { + _$jscoverage['utils.js'][97]++; + for (var key in b) { + _$jscoverage['utils.js'][98]++; + a[key] = b[key]; +} + } + _$jscoverage['utils.js'][101]++; + return a; +}); +_$jscoverage['utils.js'][112]++; +exports.escape = (function (html) { + _$jscoverage['utils.js'][113]++; + return String(html).replace(/&(?!\w+;)/g, "&").replace(//g, ">").replace(/"/g, """); +}); +_$jscoverage['utils.js'][132]++; +exports.uid = (function (len) { + _$jscoverage['utils.js'][133]++; + return crypto.randomBytes(Math.ceil(len * 3 / 4)).toString("base64").slice(0, len); +}); +_$jscoverage['utils.js'][147]++; +exports.sign = (function (val, secret) { + _$jscoverage['utils.js'][148]++; + console.warn("do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature"); + _$jscoverage['utils.js'][149]++; + return val + "." + crypto.createHmac("sha256", secret).update(val).digest("base64").replace(/=+$/, ""); +}); +_$jscoverage['utils.js'][166]++; +exports.unsign = (function (val, secret) { + _$jscoverage['utils.js'][167]++; + console.warn("do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature"); + _$jscoverage['utils.js'][168]++; + var str = val.slice(0, val.lastIndexOf(".")); + _$jscoverage['utils.js'][169]++; + return exports.sign(str, secret) == val? str: false; +}); +_$jscoverage['utils.js'][184]++; +exports.parseSignedCookies = (function (obj, secret) { + _$jscoverage['utils.js'][185]++; + var ret = {}; + _$jscoverage['utils.js'][186]++; + Object.keys(obj).forEach((function (key) { + _$jscoverage['utils.js'][187]++; + var val = obj[key]; + _$jscoverage['utils.js'][188]++; + if (0 == val.indexOf("s:")) { + _$jscoverage['utils.js'][189]++; + val = signature.unsign(val.slice(2), secret); + _$jscoverage['utils.js'][190]++; + if (val) { + _$jscoverage['utils.js'][191]++; + ret[key] = val; + _$jscoverage['utils.js'][192]++; + delete obj[key]; + } + } +})); + _$jscoverage['utils.js'][196]++; + return ret; +}); +_$jscoverage['utils.js'][208]++; +exports.parseSignedCookie = (function (str, secret) { + _$jscoverage['utils.js'][209]++; + return 0 == str.indexOf("s:")? signature.unsign(str.slice(2), secret): str; +}); +_$jscoverage['utils.js'][222]++; +exports.parseJSONCookies = (function (obj) { + _$jscoverage['utils.js'][223]++; + Object.keys(obj).forEach((function (key) { + _$jscoverage['utils.js'][224]++; + var val = obj[key]; + _$jscoverage['utils.js'][225]++; + var res = exports.parseJSONCookie(val); + _$jscoverage['utils.js'][226]++; + if (res) { + _$jscoverage['utils.js'][226]++; + obj[key] = res; + } +})); + _$jscoverage['utils.js'][228]++; + return obj; +}); +_$jscoverage['utils.js'][239]++; +exports.parseJSONCookie = (function (str) { + _$jscoverage['utils.js'][240]++; + if (0 == str.indexOf("j:")) { + _$jscoverage['utils.js'][241]++; + try { + _$jscoverage['utils.js'][242]++; + return JSON.parse(str.slice(2)); + } + catch (err) { + } + } +}); +_$jscoverage['utils.js'][267]++; +exports.pause = require("pause"); +_$jscoverage['utils.js'][276]++; +exports.removeContentHeaders = (function (res) { + _$jscoverage['utils.js'][277]++; + Object.keys(res._headers).forEach((function (field) { + _$jscoverage['utils.js'][278]++; + if (0 == field.indexOf("content")) { + _$jscoverage['utils.js'][279]++; + res.removeHeader(field); + } +})); +}); +_$jscoverage['utils.js'][292]++; +exports.conditionalGET = (function (req) { + _$jscoverage['utils.js'][293]++; + return req.headers["if-modified-since"] || req.headers["if-none-match"]; +}); +_$jscoverage['utils.js'][305]++; +exports.unauthorized = (function (res, realm) { + _$jscoverage['utils.js'][306]++; + res.statusCode = 401; + _$jscoverage['utils.js'][307]++; + res.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\""); + _$jscoverage['utils.js'][308]++; + res.end("Unauthorized"); +}); +_$jscoverage['utils.js'][319]++; +exports.notModified = (function (res) { + _$jscoverage['utils.js'][320]++; + exports.removeContentHeaders(res); + _$jscoverage['utils.js'][321]++; + res.statusCode = 304; + _$jscoverage['utils.js'][322]++; + res.end(); +}); +_$jscoverage['utils.js'][334]++; +exports.etag = (function (stat) { + _$jscoverage['utils.js'][335]++; + return "\"" + stat.size + "-" + Number(stat.mtime) + "\""; +}); +_$jscoverage['utils.js'][346]++; +exports.parseCacheControl = (function (str) { + _$jscoverage['utils.js'][347]++; + var directives = str.split(","), obj = {}; + _$jscoverage['utils.js'][350]++; + for (var i = 0, len = directives.length; i < len; i++) { + _$jscoverage['utils.js'][351]++; + var parts = directives[i].split("="), key = parts.shift().trim(), val = parseInt(parts.shift(), 10); + _$jscoverage['utils.js'][355]++; + obj[key] = isNaN(val)? true: val; +} + _$jscoverage['utils.js'][358]++; + return obj; +}); +_$jscoverage['utils.js'][369]++; +exports.parseUrl = (function (req) { + _$jscoverage['utils.js'][370]++; + var parsed = req._parsedUrl; + _$jscoverage['utils.js'][371]++; + if (parsed && parsed.href == req.url) { + _$jscoverage['utils.js'][372]++; + return parsed; + } + else { + _$jscoverage['utils.js'][374]++; + return req._parsedUrl = parse(req.url); + } +}); +_$jscoverage['utils.js'][386]++; +exports.parseBytes = require("bytes"); +_$jscoverage['utils.js'].source = ["","/*!"," * Connect - utils"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , crypto = require('crypto')"," , parse = require('url').parse"," , signature = require('cookie-signature');","","/**"," * Return `true` if the request has a body, otherwise return `false`."," *"," * @param {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.hasBody = function(req) {"," return 'transfer-encoding' in req.headers || 'content-length' in req.headers;","};","","/**"," * Extract the mime type from the given request's"," * _Content-Type_ header."," *"," * @param {IncomingMessage} req"," * @return {String}"," * @api private"," */","","exports.mime = function(req) {"," var str = req.headers['content-type'] || '';"," return str.split(';')[0];","};","","/**"," * Generate an `Error` from the given status `code`"," * and optional `msg`."," *"," * @param {Number} code"," * @param {String} msg"," * @return {Error}"," * @api private"," */","","exports.error = function(code, msg){"," var err = new Error(msg || http.STATUS_CODES[code]);"," err.status = code;"," return err;","};","","/**"," * Return md5 hash of the given string and optional encoding,"," * defaulting to hex."," *"," * utils.md5('wahoo');"," * // => \"e493298061761236c96b02ea6aa8a2ad\""," *"," * @param {String} str"," * @param {String} encoding"," * @return {String}"," * @api private"," */","","exports.md5 = function(str, encoding){"," return crypto"," .createHash('md5')"," .update(str)"," .digest(encoding || 'hex');","};","","/**"," * Merge object b with object a."," *"," * var a = { foo: 'bar' }"," * , b = { bar: 'baz' };"," * "," * utils.merge(a, b);"," * // => { foo: 'bar', bar: 'baz' }"," *"," * @param {Object} a"," * @param {Object} b"," * @return {Object}"," * @api private"," */","","exports.merge = function(a, b){"," if (a && b) {"," for (var key in b) {"," a[key] = b[key];"," }"," }"," return a;","};","","/**"," * Escape the given string of `html`."," *"," * @param {String} html"," * @return {String}"," * @api private"," */","","exports.escape = function(html){"," return String(html)"," .replace(/&(?!\\w+;)/g, '&amp;')"," .replace(/</g, '&lt;')"," .replace(/>/g, '&gt;')"," .replace(/\"/g, '&quot;');","};","","","/**"," * Return a unique identifier with the given `len`."," *"," * utils.uid(10);"," * // => \"FDaS435D2z\""," *"," * @param {Number} len"," * @return {String}"," * @api private"," */","","exports.uid = function(len) {"," return crypto.randomBytes(Math.ceil(len * 3 / 4))"," .toString('base64')"," .slice(0, len);","};","","/**"," * Sign the given `val` with `secret`."," *"," * @param {String} val"," * @param {String} secret"," * @return {String}"," * @api private"," */","","exports.sign = function(val, secret){"," console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature')"," 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){"," console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature')"," var str = val.slice(0, val.lastIndexOf('.'));"," return exports.sign(str, secret) == val"," ? str"," : false;","};","","/**"," * Parse signed cookies, returning an object"," * containing the decoded key/value pairs,"," * while removing the signed key from `obj`."," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.parseSignedCookies = function(obj, secret){"," var ret = {};"," Object.keys(obj).forEach(function(key){"," var val = obj[key];"," if (0 == val.indexOf('s:')) {"," val = signature.unsign(val.slice(2), secret);"," if (val) {"," ret[key] = val;"," delete obj[key];"," }"," }"," });"," return ret;","};","","/**"," * Parse a signed cookie string, return the decoded value"," *"," * @param {String} str signed cookie string"," * @param {String} secret"," * @return {String} decoded value"," * @api private"," */","","exports.parseSignedCookie = function(str, secret){"," return 0 == str.indexOf('s:')"," ? signature.unsign(str.slice(2), secret)"," : str;","};","","/**"," * Parse JSON cookies."," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.parseJSONCookies = function(obj){"," Object.keys(obj).forEach(function(key){"," var val = obj[key];"," var res = exports.parseJSONCookie(val);"," if (res) obj[key] = res;"," });"," return obj;","};","","/**"," * Parse JSON cookie string"," *"," * @param {String} str"," * @return {Object} Parsed object or null if not json cookie"," * @api private"," */","","exports.parseJSONCookie = function(str) {"," if (0 == str.indexOf('j:')) {"," try {"," return JSON.parse(str.slice(2));"," } catch (err) {"," // no op"," }"," }","};","","/**"," * Pause `data` and `end` events on the given `obj`."," * Middleware performing async tasks _should_ utilize"," * this utility (or similar), to re-emit data once"," * the async operation has completed, otherwise these"," * events may be lost."," *"," * var pause = utils.pause(req);"," * fs.readFile(path, function(){"," * next();"," * pause.resume();"," * });"," *"," * @param {Object} obj"," * @return {Object}"," * @api private"," */","","exports.pause = require('pause');","","/**"," * Strip `Content-*` headers from `res`."," *"," * @param {ServerResponse} res"," * @api private"," */","","exports.removeContentHeaders = function(res){"," Object.keys(res._headers).forEach(function(field){"," if (0 == field.indexOf('content')) {"," res.removeHeader(field);"," }"," });","};","","/**"," * Check if `req` is a conditional GET request."," *"," * @param {IncomingMessage} req"," * @return {Boolean}"," * @api private"," */","","exports.conditionalGET = function(req) {"," return req.headers['if-modified-since']"," || req.headers['if-none-match'];","};","","/**"," * Respond with 401 \"Unauthorized\"."," *"," * @param {ServerResponse} res"," * @param {String} realm"," * @api private"," */","","exports.unauthorized = function(res, realm) {"," res.statusCode = 401;"," res.setHeader('WWW-Authenticate', 'Basic realm=\"' + realm + '\"');"," res.end('Unauthorized');","};","","/**"," * Respond with 304 \"Not Modified\"."," *"," * @param {ServerResponse} res"," * @param {Object} headers"," * @api private"," */","","exports.notModified = function(res) {"," exports.removeContentHeaders(res);"," res.statusCode = 304;"," res.end();","};","","/**"," * Return an ETag in the form of `\"<size>-<mtime>\"`"," * from the given `stat`."," *"," * @param {Object} stat"," * @return {String}"," * @api private"," */","","exports.etag = function(stat) {"," return '\"' + stat.size + '-' + Number(stat.mtime) + '\"';","};","","/**"," * Parse the given Cache-Control `str`."," *"," * @param {String} str"," * @return {Object}"," * @api private"," */","","exports.parseCacheControl = function(str){"," var directives = str.split(',')"," , obj = {};",""," for(var i = 0, len = directives.length; i < len; i++) {"," var parts = directives[i].split('=')"," , key = parts.shift().trim()"," , val = parseInt(parts.shift(), 10);",""," obj[key] = isNaN(val) ? true : val;"," }",""," return obj;","};","","/**"," * Parse the `req` url with memoization."," *"," * @param {ServerRequest} req"," * @return {Object}"," * @api private"," */","","exports.parseUrl = function(req){"," var parsed = req._parsedUrl;"," if (parsed && parsed.href == req.url) {"," return parsed;"," } else {"," return req._parsedUrl = parse(req.url);"," }","};","","/**"," * Parse byte `size` string."," *"," * @param {String} size"," * @return {Number}"," * @api private"," */","","exports.parseBytes = require('bytes');"]; diff --git a/node_modules/express/node_modules/connect/lib/cache.js b/node_modules/express/node_modules/connect/lib/cache.js new file mode 100644 index 0000000..052fcdb --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/cache.js @@ -0,0 +1,81 @@ + +/*! + * Connect - Cache + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Expose `Cache`. + */ + +module.exports = Cache; + +/** + * LRU cache store. + * + * @param {Number} limit + * @api private + */ + +function Cache(limit) { + this.store = {}; + this.keys = []; + this.limit = limit; +} + +/** + * Touch `key`, promoting the object. + * + * @param {String} key + * @param {Number} i + * @api private + */ + +Cache.prototype.touch = function(key, i){ + this.keys.splice(i,1); + this.keys.push(key); +}; + +/** + * Remove `key`. + * + * @param {String} key + * @api private + */ + +Cache.prototype.remove = function(key){ + delete this.store[key]; +}; + +/** + * Get the object stored for `key`. + * + * @param {String} key + * @return {Array} + * @api private + */ + +Cache.prototype.get = function(key){ + return this.store[key]; +}; + +/** + * Add a cache `key`. + * + * @param {String} key + * @return {Array} + * @api private + */ + +Cache.prototype.add = function(key){ + // initialize store + var len = this.keys.push(key); + + // limit reached, invalidate LRU + if (len > this.limit) this.remove(this.keys.shift()); + + var arr = this.store[key] = []; + arr.createdAt = new Date; + return arr; +}; diff --git a/node_modules/express/node_modules/connect/lib/connect.js b/node_modules/express/node_modules/connect/lib/connect.js new file mode 100644 index 0000000..a067e24 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/connect.js @@ -0,0 +1,93 @@ + +/*! + * Connect + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , proto = require('./proto') + , utils = require('./utils') + , path = require('path') + , basename = path.basename + , fs = require('fs'); + +// node patches + +require('./patch'); + +// expose createServer() as the module + +exports = module.exports = createServer; + +/** + * Framework version. + */ + +exports.version = '2.7.2'; + +/** + * Expose mime module. + */ + +exports.mime = require('./middleware/static').mime; + +/** + * Expose the prototype. + */ + +exports.proto = proto; + +/** + * Auto-load middleware getters. + */ + +exports.middleware = {}; + +/** + * Expose utilities. + */ + +exports.utils = utils; + +/** + * Create a new connect server. + * + * @return {Function} + * @api public + */ + +function createServer() { + function app(req, res){ app.handle(req, res); } + utils.merge(app, proto); + utils.merge(app, EventEmitter.prototype); + app.route = '/'; + app.stack = []; + for (var i = 0; i < arguments.length; ++i) { + app.use(arguments[i]); + } + return app; +}; + +/** + * Support old `.createServer()` method. + */ + +createServer.createServer = createServer; + +/** + * Auto-load bundled middleware with getters. + */ + +fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ + if (!/\.js$/.test(filename)) return; + var name = basename(filename, '.js'); + function load(){ return require('./middleware/' + name); } + exports.middleware.__defineGetter__(name, load); + exports.__defineGetter__(name, load); +}); diff --git a/node_modules/express/node_modules/connect/lib/index.js b/node_modules/express/node_modules/connect/lib/index.js new file mode 100644 index 0000000..2618ddc --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/index.js @@ -0,0 +1,50 @@ + +/** + * Connect is a middleware framework for node, + * shipping with over 18 bundled middleware and a rich selection of + * 3rd-party middleware. + * + * var app = connect() + * .use(connect.logger('dev')) + * .use(connect.static('public')) + * .use(function(req, res){ + * res.end('hello world\n'); + * }) + * .listen(3000); + * + * Installation: + * + * $ npm install connect + * + * Middleware: + * + * - [logger](logger.html) request logger with custom format support + * - [csrf](csrf.html) Cross-site request forgery protection + * - [compress](compress.html) Gzip compression middleware + * - [basicAuth](basicAuth.html) basic http authentication + * - [bodyParser](bodyParser.html) extensible request body parser + * - [json](json.html) application/json parser + * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser + * - [multipart](multipart.html) multipart/form-data parser + * - [timeout](timeout.html) request timeouts + * - [cookieParser](cookieParser.html) cookie parser + * - [session](session.html) session management support with bundled MemoryStore + * - [cookieSession](cookieSession.html) cookie-based session support + * - [methodOverride](methodOverride.html) faux HTTP method support + * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time + * - [staticCache](staticCache.html) memory cache layer for the static() middleware + * - [static](static.html) streaming static file server supporting `Range` and more + * - [directory](directory.html) directory listing middleware + * - [vhost](vhost.html) virtual host sub-domain mapping middleware + * - [favicon](favicon.html) efficient favicon server (with default icon) + * - [limit](limit.html) limit the bytesize of request bodies + * - [query](query.html) automatic querystring parser, populating `req.query` + * - [errorHandler](errorHandler.html) flexible error handler + * + * Links: + * + * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware + * - GitHub [repository](http://github.com/senchalabs/connect) + * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md) + * + */ \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js b/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js new file mode 100644 index 0000000..0205812 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js @@ -0,0 +1,103 @@ + +/*! + * Connect - basicAuth + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , unauthorized = utils.unauthorized; + +/** + * Basic Auth: + * + * Enfore basic authentication by providing a `callback(user, pass)`, + * which must return `true` in order to gain access. Alternatively an async + * method is provided as well, invoking `callback(user, pass, callback)`. Populates + * `req.user`. The final alternative is simply passing username / password + * strings. + * + * Simple username and password + * + * connect(connect.basicAuth('username', 'password')); + * + * Callback verification + * + * connect() + * .use(connect.basicAuth(function(user, pass){ + * return 'tj' == user & 'wahoo' == pass; + * })) + * + * Async callback verification, accepting `fn(err, user)`. + * + * connect() + * .use(connect.basicAuth(function(user, pass, fn){ + * User.authenticate({ user: user, pass: pass }, fn); + * })) + * + * @param {Function|String} callback or username + * @param {String} realm + * @api public + */ + +module.exports = function basicAuth(callback, realm) { + var username, password; + + // user / pass strings + if ('string' == typeof callback) { + username = callback; + password = realm; + if ('string' != typeof password) throw new Error('password argument required'); + realm = arguments[2]; + callback = function(user, pass){ + return user == username && pass == password; + } + } + + realm = realm || 'Authorization Required'; + + return function(req, res, next) { + var authorization = req.headers.authorization; + + if (req.user) return next(); + if (!authorization) return unauthorized(res, realm); + + var parts = authorization.split(' '); + + if (parts.length !== 2) return next(400); + + var scheme = parts[0] + , credentials = new Buffer(parts[1], 'base64').toString() + , index = credentials.indexOf(':'); + + if ('Basic' != scheme || index < 0) return next(400); + + var user = credentials.slice(0, index) + , pass = credentials.slice(index + 1); + + // async + if (callback.length >= 3) { + var pause = utils.pause(req); + callback(user, pass, function(err, user){ + if (err || !user) return unauthorized(res, realm); + req.user = req.remoteUser = user; + next(); + pause.resume(); + }); + // sync + } else { + if (callback(user, pass)) { + req.user = req.remoteUser = user; + next(); + } else { + unauthorized(res, realm); + } + } + } +}; + diff --git a/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js b/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js new file mode 100644 index 0000000..9f692cd --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js @@ -0,0 +1,61 @@ + +/*! + * Connect - bodyParser + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var multipart = require('./multipart') + , urlencoded = require('./urlencoded') + , json = require('./json'); + +/** + * Body parser: + * + * Parse request bodies, supports _application/json_, + * _application/x-www-form-urlencoded_, and _multipart/form-data_. + * + * This is equivalent to: + * + * app.use(connect.json()); + * app.use(connect.urlencoded()); + * app.use(connect.multipart()); + * + * Examples: + * + * connect() + * .use(connect.bodyParser()) + * .use(function(req, res) { + * res.end('viewing user ' + req.body.user.name); + * }); + * + * $ curl -d 'user[name]=tj' http://local/ + * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/ + * + * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function bodyParser(options){ + var _urlencoded = urlencoded(options) + , _multipart = multipart(options) + , _json = json(options); + + return function bodyParser(req, res, next) { + _json(req, res, function(err){ + if (err) return next(err); + _urlencoded(req, res, function(err){ + if (err) return next(err); + _multipart(req, res, next); + }); + }); + } +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/middleware/compress.js b/node_modules/express/node_modules/connect/lib/middleware/compress.js new file mode 100644 index 0000000..2dc6437 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/compress.js @@ -0,0 +1,147 @@ +/*! + * Connect - compress + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var zlib = require('zlib'); + +/** + * Supported content-encoding methods. + */ + +exports.methods = { + gzip: zlib.createGzip + , deflate: zlib.createDeflate +}; + +/** + * Default filter function. + */ + +exports.filter = function(req, res){ + return /json|text|javascript/.test(res.getHeader('Content-Type')); +}; + +/** + * Compress: + * + * Compress response data with gzip/deflate. + * + * Filter: + * + * A `filter` callback function may be passed to + * replace the default logic of: + * + * exports.filter = function(req, res){ + * return /json|text|javascript/.test(res.getHeader('Content-Type')); + * }; + * + * Options: + * + * All remaining options are passed to the gzip/deflate + * creation functions. Consult node's docs for additional details. + * + * - `chunkSize` (default: 16*1024) + * - `windowBits` + * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression + * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more + * - `strategy`: compression strategy + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function compress(options) { + options = options || {}; + var names = Object.keys(exports.methods) + , filter = options.filter || exports.filter; + + return function(req, res, next){ + var accept = req.headers['accept-encoding'] + , write = res.write + , end = res.end + , stream + , method; + + // vary + res.setHeader('Vary', 'Accept-Encoding'); + + // proxy + + res.write = function(chunk, encoding){ + if (!this.headerSent) this._implicitHeader(); + return stream + ? stream.write(new Buffer(chunk, encoding)) + : write.call(res, chunk, encoding); + }; + + res.end = function(chunk, encoding){ + if (chunk) this.write(chunk, encoding); + return stream + ? stream.end() + : end.call(res); + }; + + res.on('header', function(){ + var encoding = res.getHeader('Content-Encoding') || 'identity'; + + // already encoded + if ('identity' != encoding) return; + + // default request filter + if (!filter(req, res)) return; + + // SHOULD use identity + if (!accept) return; + + // head + if ('HEAD' == req.method) return; + + // default to gzip + if ('*' == accept.trim()) method = 'gzip'; + + // compression method + if (!method) { + for (var i = 0, len = names.length; i < len; ++i) { + if (~accept.indexOf(names[i])) { + method = names[i]; + break; + } + } + } + + // compression method + if (!method) return; + + // compression stream + stream = exports.methods[method](options); + + // header fields + res.setHeader('Content-Encoding', method); + res.removeHeader('Content-Length'); + + // compression + + stream.on('data', function(chunk){ + write.call(res, chunk); + }); + + stream.on('end', function(){ + end.call(res); + }); + + stream.on('drain', function() { + res.emit('drain'); + }); + }); + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js new file mode 100644 index 0000000..5da23f2 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js @@ -0,0 +1,62 @@ + +/*! + * Connect - cookieParser + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./../utils') + , cookie = require('cookie'); + +/** + * Cookie parser: + * + * Parse _Cookie_ header and populate `req.cookies` + * with an object keyed by the cookie names. Optionally + * you may enabled signed cookie support by passing + * a `secret` string, which assigns `req.secret` so + * it may be used by other middleware. + * + * Examples: + * + * connect() + * .use(connect.cookieParser('optional secret string')) + * .use(function(req, res, next){ + * res.end(JSON.stringify(req.cookies)); + * }) + * + * @param {String} secret + * @return {Function} + * @api public + */ + +module.exports = function cookieParser(secret){ + return function cookieParser(req, res, next) { + if (req.cookies) return next(); + var cookies = req.headers.cookie; + + req.secret = secret; + req.cookies = {}; + req.signedCookies = {}; + + if (cookies) { + try { + req.cookies = cookie.parse(cookies); + if (secret) { + req.signedCookies = utils.parseSignedCookies(req.cookies, secret); + req.signedCookies = utils.parseJSONCookies(req.signedCookies); + } + req.cookies = utils.parseJSONCookies(req.cookies); + } catch (err) { + err.status = 400; + return next(err); + } + } + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js b/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js new file mode 100644 index 0000000..1a23d57 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js @@ -0,0 +1,115 @@ + +/*! + * Connect - cookieSession + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./../utils') + , Cookie = require('./session/cookie') + , debug = require('debug')('connect:cookieSession') + , signature = require('cookie-signature') + , crc32 = require('buffer-crc32'); + +/** + * Cookie Session: + * + * Cookie session middleware. + * + * var app = connect(); + * app.use(connect.cookieParser()); + * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }})); + * + * Options: + * + * - `key` cookie name defaulting to `connect.sess` + * - `secret` prevents cookie tampering + * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` + * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") + * + * Clearing sessions: + * + * To clear the session simply set its value to `null`, + * `cookieSession()` will then respond with a 1970 Set-Cookie. + * + * req.session = null; + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function cookieSession(options){ + // TODO: utilize Session/Cookie to unify API + options = options || {}; + var key = options.key || 'connect.sess' + , trustProxy = options.proxy; + + return function cookieSession(req, res, next) { + + // req.secret is for backwards compatibility + var secret = options.secret || req.secret; + if (!secret) throw new Error('`secret` option required for cookie sessions'); + + // default session + req.session = {}; + var cookie = req.session.cookie = new Cookie(options.cookie); + + // pathname mismatch + if (0 != req.originalUrl.indexOf(cookie.path)) return next(); + + // cookieParser secret + if (!options.secret && req.secret) { + req.session = req.signedCookies[key] || {}; + } else { + // TODO: refactor + var rawCookie = req.cookies[key]; + if (rawCookie) { + var unsigned = utils.parseSignedCookie(rawCookie, secret); + if (unsigned) { + var originalHash = crc32.signed(unsigned); + req.session = utils.parseJSONCookie(unsigned) || {}; + } + } + } + + res.on('header', function(){ + // removed + if (!req.session) { + debug('clear session'); + cookie.expires = new Date(0); + res.setHeader('Set-Cookie', cookie.serialize(key, '')); + return; + } + + delete req.session.cookie; + + // check security + var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() + , tls = req.connection.encrypted || (trustProxy && 'https' == proto) + , secured = cookie.secure && tls; + + // only send secure cookies via https + if (cookie.secure && !secured) return debug('not secured'); + + // serialize + debug('serializing %j', req.session); + var val = 'j:' + JSON.stringify(req.session); + + // compare hashes, no need to set-cookie if unchanged + if (originalHash == crc32.signed(val)) return debug('unmodified session'); + + // set-cookie + val = 's:' + signature.sign(val, secret); + val = cookie.serialize(key, val); + debug('set-cookie %j', cookie); + res.setHeader('Set-Cookie', val); + }); + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/csrf.js b/node_modules/express/node_modules/connect/lib/middleware/csrf.js new file mode 100644 index 0000000..5d5e7c6 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/csrf.js @@ -0,0 +1,73 @@ +/*! + * Connect - csrf + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils'); + +/** + * Anti CSRF: + * + * CRSF protection middleware. + * + * By default this middleware generates a token named "_csrf" + * which should be added to requests which mutate + * state, within a hidden form field, query-string etc. This + * token is validated against the visitor's `req.session._csrf` + * property. + * + * The default `value` function checks `req.body` generated + * by the `bodyParser()` middleware, `req.query` generated + * by `query()`, and the "X-CSRF-Token" header field. + * + * This middleware requires session support, thus should be added + * somewhere _below_ `session()` and `cookieParser()`. + * + * Options: + * + * - `value` a function accepting the request, returning the token + * + * @param {Object} options + * @api public + */ + +module.exports = function csrf(options) { + options = options || {}; + var value = options.value || defaultValue; + + return function(req, res, next){ + // generate CSRF token + var token = req.session._csrf || (req.session._csrf = utils.uid(24)); + + // ignore these methods + if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next(); + + // determine value + var val = value(req); + + // check + if (val != token) return next(403); + + next(); + } +}; + +/** + * Default value function, checking the `req.body` + * and `req.query` for the CSRF token. + * + * @param {IncomingMessage} req + * @return {String} + * @api private + */ + +function defaultValue(req) { + return (req.body && req.body._csrf) + || (req.query && req.query._csrf) + || (req.headers['x-csrf-token']); +} diff --git a/node_modules/express/node_modules/connect/lib/middleware/directory.js b/node_modules/express/node_modules/connect/lib/middleware/directory.js new file mode 100644 index 0000000..8fa008c --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/directory.js @@ -0,0 +1,228 @@ + +/*! + * Connect - directory + * Copyright(c) 2011 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +// TODO: icon / style for directories +// TODO: arrow key navigation +// TODO: make icons extensible + +/** + * Module dependencies. + */ + +var fs = require('fs') + , parse = require('url').parse + , path = require('path') + , normalize = path.normalize + , extname = path.extname + , join = path.join; + +/*! + * Icon cache. + */ + +var cache = {}; + +/** + * Directory: + * + * Serve directory listings with the given `root` path. + * + * Options: + * + * - `hidden` display hidden (dot) files. Defaults to false. + * - `icons` display icons. Defaults to false. + * - `filter` Apply this filter function to files. Defaults to false. + * + * @param {String} root + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function directory(root, options){ + options = options || {}; + + // root required + if (!root) throw new Error('directory() root path required'); + var hidden = options.hidden + , icons = options.icons + , filter = options.filter + , root = normalize(root); + + return function directory(req, res, next) { + if ('GET' != req.method && 'HEAD' != req.method) return next(); + + var accept = req.headers.accept || 'text/plain' + , url = parse(req.url) + , dir = decodeURIComponent(url.pathname) + , path = normalize(join(root, dir)) + , originalUrl = parse(req.originalUrl) + , originalDir = decodeURIComponent(originalUrl.pathname) + , showUp = path != root && path != root + '/'; + + // null byte(s), bad request + if (~path.indexOf('\0')) return next(400); + + // malicious path, forbidden + if (0 != path.indexOf(root)) return next(403); + + // check if we have a directory + fs.stat(path, function(err, stat){ + if (err) return 'ENOENT' == err.code + ? next() + : next(err); + + if (!stat.isDirectory()) return next(); + + // fetch files + fs.readdir(path, function(err, files){ + if (err) return next(err); + if (!hidden) files = removeHidden(files); + if (filter) files = files.filter(filter); + files.sort(); + + // content-negotiation + for (var key in exports) { + if (~accept.indexOf(key) || ~accept.indexOf('*/*')) { + exports[key](req, res, files, next, originalDir, showUp, icons); + return; + } + } + + // not acceptable + next(406); + }); + }); + }; +}; + +/** + * Respond with text/html. + */ + +exports.html = function(req, res, files, next, dir, showUp, icons){ + fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){ + if (err) return next(err); + fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){ + if (err) return next(err); + if (showUp) files.unshift('..'); + str = str + .replace('{style}', style) + .replace('{files}', html(files, dir, icons)) + .replace('{directory}', dir) + .replace('{linked-path}', htmlPath(dir)); + res.setHeader('Content-Type', 'text/html'); + res.setHeader('Content-Length', str.length); + res.end(str); + }); + }); +}; + +/** + * Respond with application/json. + */ + +exports.json = function(req, res, files){ + files = JSON.stringify(files); + res.setHeader('Content-Type', 'application/json'); + res.setHeader('Content-Length', files.length); + res.end(files); +}; + +/** + * Respond with text/plain. + */ + +exports.plain = function(req, res, files){ + files = files.join('\n') + '\n'; + res.setHeader('Content-Type', 'text/plain'); + res.setHeader('Content-Length', files.length); + res.end(files); +}; + +/** + * Map html `dir`, returning a linked path. + */ + +function htmlPath(dir) { + var curr = []; + return dir.split('/').map(function(part){ + curr.push(part); + return '' + part + ''; + }).join(' / '); +} + +/** + * Map html `files`, returning an html unordered list. + */ + +function html(files, dir, useIcons) { + return '
      ' + files.map(function(file){ + var icon = '' + , classes = []; + + if (useIcons && '..' != file) { + icon = icons[extname(file)] || icons.default; + icon = ''; + classes.push('icon'); + } + + return '
    • ' + + icon + file + '
    • '; + + }).join('\n') + '
    '; +} + +/** + * Load and cache the given `icon`. + * + * @param {String} icon + * @return {String} + * @api private + */ + +function load(icon) { + if (cache[icon]) return cache[icon]; + return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64'); +} + +/** + * Filter "hidden" `files`, aka files + * beginning with a `.`. + * + * @param {Array} files + * @return {Array} + * @api private + */ + +function removeHidden(files) { + return files.filter(function(file){ + return '.' != file[0]; + }); +} + +/** + * Icon map. + */ + +var icons = { + '.js': 'page_white_code_red.png' + , '.c': 'page_white_c.png' + , '.h': 'page_white_h.png' + , '.cc': 'page_white_cplusplus.png' + , '.php': 'page_white_php.png' + , '.rb': 'page_white_ruby.png' + , '.cpp': 'page_white_cplusplus.png' + , '.swf': 'page_white_flash.png' + , '.pdf': 'page_white_acrobat.png' + , 'default': 'page_white.png' +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js new file mode 100644 index 0000000..4a84edc --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js @@ -0,0 +1,86 @@ +/*! + * Connect - errorHandler + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , fs = require('fs'); + +// environment + +var env = process.env.NODE_ENV || 'development'; + +/** + * Error handler: + * + * Development error handler, providing stack traces + * and error message responses for requests accepting text, html, + * or json. + * + * Text: + * + * By default, and when _text/plain_ is accepted a simple stack trace + * or error message will be returned. + * + * JSON: + * + * When _application/json_ is accepted, connect will respond with + * an object in the form of `{ "error": error }`. + * + * HTML: + * + * When accepted connect will output a nice html stack trace. + * + * @return {Function} + * @api public + */ + +exports = module.exports = function errorHandler(){ + return function errorHandler(err, req, res, next){ + if (err.status) res.statusCode = err.status; + if (res.statusCode < 400) res.statusCode = 500; + if ('test' != env) console.error(err.stack); + var accept = req.headers.accept || ''; + // html + if (~accept.indexOf('html')) { + fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ + fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ + var stack = (err.stack || '') + .split('\n').slice(1) + .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); + html = html + .replace('{style}', style) + .replace('{stack}', stack) + .replace('{title}', exports.title) + .replace('{statusCode}', res.statusCode) + .replace(/\{error\}/g, utils.escape(err.toString())); + res.setHeader('Content-Type', 'text/html; charset=utf-8'); + res.end(html); + }); + }); + // json + } else if (~accept.indexOf('json')) { + var error = { message: err.message, stack: err.stack }; + for (var prop in err) error[prop] = err[prop]; + var json = JSON.stringify({ error: error }); + res.setHeader('Content-Type', 'application/json'); + res.end(json); + // plain text + } else { + res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' }); + res.end(err.stack); + } + }; +}; + +/** + * Template title, framework authors may override this value. + */ + +exports.title = 'Connect'; diff --git a/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/node_modules/express/node_modules/connect/lib/middleware/favicon.js new file mode 100644 index 0000000..c57bf34 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/favicon.js @@ -0,0 +1,81 @@ + +/*! + * Connect - favicon + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , utils = require('../utils'); + +/** + * Favicon: + * + * By default serves the connect favicon, or the favicon + * located by the given `path`. + * + * Options: + * + * - `maxAge` cache-control max-age directive, defaulting to 1 day + * + * Examples: + * + * Serve default favicon: + * + * connect() + * .use(connect.favicon()) + * + * Serve favicon before logging for brevity: + * + * connect() + * .use(connect.favicon()) + * .use(connect.logger('dev')) + * + * Serve custom favicon: + * + * connect() + * .use(connect.favicon('public/favicon.ico)) + * + * @param {String} path + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function favicon(path, options){ + var options = options || {} + , path = path || __dirname + '/../public/favicon.ico' + , maxAge = options.maxAge || 86400000 + , icon; // favicon cache + + return function favicon(req, res, next){ + if ('/favicon.ico' == req.url) { + if (icon) { + res.writeHead(200, icon.headers); + res.end(icon.body); + } else { + fs.readFile(path, function(err, buf){ + if (err) return next(err); + icon = { + headers: { + 'Content-Type': 'image/x-icon' + , 'Content-Length': buf.length + , 'ETag': '"' + utils.md5(buf) + '"' + , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) + }, + body: buf + }; + res.writeHead(200, icon.headers); + res.end(icon.body); + }); + } + } else { + next(); + } + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/json.js b/node_modules/express/node_modules/connect/lib/middleware/json.js new file mode 100644 index 0000000..200006b --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/json.js @@ -0,0 +1,86 @@ + +/*! + * Connect - json + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , _limit = require('./limit'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * JSON: + * + * Parse JSON request bodies, providing the + * parsed object as `req.body`. + * + * Options: + * + * - `strict` when `false` anything `JSON.parse()` accepts will be parsed + * - `reviver` used as the second "reviver" argument for JSON.parse + * - `limit` byte limit disabled by default + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + var options = options || {} + , strict = options.strict !== false; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function json(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + + if (!utils.hasBody(req)) return next(); + + // check Content-Type + if ('application/json' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + var buf = ''; + req.setEncoding('utf8'); + req.on('data', function(chunk){ buf += chunk }); + req.on('end', function(){ + var first = buf.trim()[0]; + + if (0 == buf.length) { + return next(400, 'invalid json, empty body'); + } + + if (strict && '{' != first && '[' != first) return next(400, 'invalid json'); + try { + req.body = JSON.parse(buf, options.reviver); + next(); + } catch (err){ + err.body = buf; + err.status = 400; + next(err); + } + }); + }); + } +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/limit.js b/node_modules/express/node_modules/connect/lib/middleware/limit.js new file mode 100644 index 0000000..614787d --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/limit.js @@ -0,0 +1,55 @@ + +/*! + * Connect - limit + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils'); + +/** + * Limit: + * + * Limit request bodies to the given size in `bytes`. + * + * A string representation of the bytesize may also be passed, + * for example "5mb", "200kb", "1gb", etc. + * + * connect() + * .use(connect.limit('5.5mb')) + * .use(handleImageUpload) + * + * @param {Number|String} bytes + * @return {Function} + * @api public + */ + +module.exports = function limit(bytes){ + if ('string' == typeof bytes) bytes = utils.parseBytes(bytes); + if ('number' != typeof bytes) throw new Error('limit() bytes required'); + return function limit(req, res, next){ + var received = 0 + , len = req.headers['content-length'] + ? parseInt(req.headers['content-length'], 10) + : null; + + // self-awareness + if (req._limit) return next(); + req._limit = true; + + // limit by content-length + if (len && len > bytes) return next(413); + + // limit + req.on('data', function(chunk){ + received += chunk.length; + if (received > bytes) req.destroy(); + }); + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/logger.js b/node_modules/express/node_modules/connect/lib/middleware/logger.js new file mode 100644 index 0000000..de72244 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/logger.js @@ -0,0 +1,339 @@ +/*! + * Connect - logger + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var bytes = require('bytes'); + +/*! + * Log buffer. + */ + +var buf = []; + +/*! + * Default log buffer duration. + */ + +var defaultBufferDuration = 1000; + +/** + * Logger: + * + * Log requests with the given `options` or a `format` string. + * + * Options: + * + * - `format` Format string, see below for tokens + * - `stream` Output stream, defaults to _stdout_ + * - `buffer` Buffer duration, defaults to 1000ms when _true_ + * - `immediate` Write log line on request instead of response (for response times) + * + * Tokens: + * + * - `:req[header]` ex: `:req[Accept]` + * - `:res[header]` ex: `:res[Content-Length]` + * - `:http-version` + * - `:response-time` + * - `:remote-addr` + * - `:date` + * - `:method` + * - `:url` + * - `:referrer` + * - `:user-agent` + * - `:status` + * + * Formats: + * + * Pre-defined formats that ship with connect: + * + * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' + * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms' + * - `tiny` ':method :url :status :res[content-length] - :response-time ms' + * - `dev` concise output colored by response status for development use + * + * Examples: + * + * connect.logger() // default + * connect.logger('short') + * connect.logger('tiny') + * connect.logger({ immediate: true, format: 'dev' }) + * connect.logger(':method :url - :referrer') + * connect.logger(':req[content-type] -> :res[content-type]') + * connect.logger(function(tokens, req, res){ return 'some format string' }) + * + * Defining Tokens: + * + * To define a token, simply invoke `connect.logger.token()` with the + * name and a callback function. The value returned is then available + * as ":type" in this case. + * + * connect.logger.token('type', function(req, res){ return req.headers['content-type']; }) + * + * Defining Formats: + * + * All default formats are defined this way, however it's public API as well: + * + * connect.logger.format('name', 'string or function') + * + * @param {String|Function|Object} format or options + * @return {Function} + * @api public + */ + +exports = module.exports = function logger(options) { + if ('object' == typeof options) { + options = options || {}; + } else if (options) { + options = { format: options }; + } else { + options = {}; + } + + // output on request instead of response + var immediate = options.immediate; + + // format name + var fmt = exports[options.format] || options.format || exports.default; + + // compile format + if ('function' != typeof fmt) fmt = compile(fmt); + + // options + var stream = options.stream || process.stdout + , buffer = options.buffer; + + // buffering support + if (buffer) { + var realStream = stream + , interval = 'number' == typeof buffer + ? buffer + : defaultBufferDuration; + + // flush interval + setInterval(function(){ + if (buf.length) { + realStream.write(buf.join('')); + buf.length = 0; + } + }, interval); + + // swap the stream + stream = { + write: function(str){ + buf.push(str); + } + }; + } + + return function logger(req, res, next) { + req._startTime = new Date; + + // immediate + if (immediate) { + var line = fmt(exports, req, res); + if (null == line) return; + stream.write(line + '\n'); + // proxy end to output logging + } else { + var end = res.end; + res.end = function(chunk, encoding){ + res.end = end; + res.end(chunk, encoding); + var line = fmt(exports, req, res); + if (null == line) return; + stream.write(line + '\n'); + }; + } + + + next(); + }; +}; + +/** + * Compile `fmt` into a function. + * + * @param {String} fmt + * @return {Function} + * @api private + */ + +function compile(fmt) { + fmt = fmt.replace(/"/g, '\\"'); + var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ + return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; + }) + '";' + return new Function('tokens, req, res', js); +}; + +/** + * Define a token function with the given `name`, + * and callback `fn(req, res)`. + * + * @param {String} name + * @param {Function} fn + * @return {Object} exports for chaining + * @api public + */ + +exports.token = function(name, fn) { + exports[name] = fn; + return this; +}; + +/** + * Define a `fmt` with the given `name`. + * + * @param {String} name + * @param {String|Function} fmt + * @return {Object} exports for chaining + * @api public + */ + +exports.format = function(name, str){ + exports[name] = str; + return this; +}; + +/** + * Default format. + */ + +exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'); + +/** + * Short format. + */ + +exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'); + +/** + * Tiny format. + */ + +exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms'); + +/** + * dev (colored) + */ + +exports.format('dev', function(tokens, req, res){ + var status = res.statusCode + , len = parseInt(res.getHeader('Content-Length'), 10) + , color = 32; + + if (status >= 500) color = 31 + else if (status >= 400) color = 33 + else if (status >= 300) color = 36; + + len = isNaN(len) + ? '' + : len = ' - ' + bytes(len); + + return '\033[90m' + req.method + + ' ' + req.originalUrl + ' ' + + '\033[' + color + 'm' + res.statusCode + + ' \033[90m' + + (new Date - req._startTime) + + 'ms' + len + + '\033[0m'; +}); + +/** + * request url + */ + +exports.token('url', function(req){ + return req.originalUrl || req.url; +}); + +/** + * request method + */ + +exports.token('method', function(req){ + return req.method; +}); + +/** + * response time in milliseconds + */ + +exports.token('response-time', function(req){ + return new Date - req._startTime; +}); + +/** + * UTC date + */ + +exports.token('date', function(){ + return new Date().toUTCString(); +}); + +/** + * response status code + */ + +exports.token('status', function(req, res){ + return res.statusCode; +}); + +/** + * normalized referrer + */ + +exports.token('referrer', function(req){ + return req.headers['referer'] || req.headers['referrer']; +}); + +/** + * remote address + */ + +exports.token('remote-addr', function(req){ + if (req.ip) return req.ip; + var sock = req.socket; + if (sock.socket) return sock.socket.remoteAddress; + return sock.remoteAddress; +}); + +/** + * HTTP version + */ + +exports.token('http-version', function(req){ + return req.httpVersionMajor + '.' + req.httpVersionMinor; +}); + +/** + * UA string + */ + +exports.token('user-agent', function(req){ + return req.headers['user-agent']; +}); + +/** + * request header + */ + +exports.token('req', function(req, res, field){ + return req.headers[field.toLowerCase()]; +}); + +/** + * response header + */ + +exports.token('res', function(req, res, field){ + return (res._headers || {})[field.toLowerCase()]; +}); + diff --git a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js new file mode 100644 index 0000000..aaf4014 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js @@ -0,0 +1,40 @@ + +/*! + * Connect - methodOverride + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Method Override: + * + * Provides faux HTTP method support. + * + * Pass an optional `key` to use when checking for + * a method override, othewise defaults to _\_method_. + * The original method is available via `req.originalMethod`. + * + * @param {String} key + * @return {Function} + * @api public + */ + +module.exports = function methodOverride(key){ + key = key || "_method"; + return function methodOverride(req, res, next) { + req.originalMethod = req.originalMethod || req.method; + + // req.body + if (req.body && key in req.body) { + req.method = req.body[key].toUpperCase(); + delete req.body[key]; + // check X-HTTP-Method-Override + } else if (req.headers['x-http-method-override']) { + req.method = req.headers['x-http-method-override'].toUpperCase(); + } + + next(); + }; +}; + diff --git a/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/node_modules/express/node_modules/connect/lib/middleware/multipart.js new file mode 100644 index 0000000..7b26fae --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/multipart.js @@ -0,0 +1,133 @@ +/*! + * Connect - multipart + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var formidable = require('formidable') + , _limit = require('./limit') + , utils = require('../utils') + , qs = require('qs'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * Multipart: + * + * Parse multipart/form-data request bodies, + * providing the parsed object as `req.body` + * and `req.files`. + * + * Configuration: + * + * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s + * `IncomingForm` object, allowing you to configure the upload directory, + * size limits, etc. For example if you wish to change the upload dir do the following. + * + * app.use(connect.multipart({ uploadDir: path })); + * + * Options: + * + * - `limit` byte limit defaulting to none + * - `defer` defers processing and exposes the Formidable form object as `req.form`. + * `next()` is called without waiting for the form's "end" event. + * This option is useful if you need to bind to the "progress" event, for example. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + options = options || {}; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function multipart(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + req.files = req.files || {}; + + if (!utils.hasBody(req)) return next(); + + // ignore GET + if ('GET' == req.method || 'HEAD' == req.method) return next(); + + // check Content-Type + if ('multipart/form-data' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + + var form = new formidable.IncomingForm + , data = {} + , files = {} + , done; + + Object.keys(options).forEach(function(key){ + form[key] = options[key]; + }); + + function ondata(name, val, data){ + if (Array.isArray(data[name])) { + data[name].push(val); + } else if (data[name]) { + data[name] = [data[name], val]; + } else { + data[name] = val; + } + } + + form.on('field', function(name, val){ + ondata(name, val, data); + }); + + form.on('file', function(name, val){ + ondata(name, val, files); + }); + + form.on('error', function(err){ + if (!options.defer) { + err.status = 400; + next(err); + } + done = true; + }); + + form.on('end', function(){ + if (done) return; + try { + req.body = qs.parse(data); + req.files = qs.parse(files); + if (!options.defer) next(); + } catch (err) { + form.emit('error', err); + } + }); + + form.parse(req); + + if (options.defer) { + req.form = form; + next(); + } + }); + } +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/query.js b/node_modules/express/node_modules/connect/lib/middleware/query.js new file mode 100644 index 0000000..93fc5d3 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/query.js @@ -0,0 +1,46 @@ +/*! + * Connect - query + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var qs = require('qs') + , parse = require('../utils').parseUrl; + +/** + * Query: + * + * Automatically parse the query-string when available, + * populating the `req.query` object. + * + * Examples: + * + * connect() + * .use(connect.query()) + * .use(function(req, res){ + * res.end(JSON.stringify(req.query)); + * }); + * + * The `options` passed are provided to qs.parse function. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function query(options){ + return function query(req, res, next){ + if (!req.query) { + req.query = ~req.url.indexOf('?') + ? qs.parse(parse(req).query, options) + : {}; + } + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js new file mode 100644 index 0000000..62abc04 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js @@ -0,0 +1,32 @@ + +/*! + * Connect - responseTime + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Reponse time: + * + * Adds the `X-Response-Time` header displaying the response + * duration in milliseconds. + * + * @return {Function} + * @api public + */ + +module.exports = function responseTime(){ + return function(req, res, next){ + var start = new Date; + + if (res._responseTime) return next(); + res._responseTime = true; + + res.on('header', function(){ + var duration = new Date - start; + res.setHeader('X-Response-Time', duration + 'ms'); + }); + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session.js b/node_modules/express/node_modules/connect/lib/middleware/session.js new file mode 100644 index 0000000..f97b8d6 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/session.js @@ -0,0 +1,352 @@ + +/*! + * Connect - session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Session = require('./session/session') + , debug = require('debug')('connect:session') + , MemoryStore = require('./session/memory') + , signature = require('cookie-signature') + , Cookie = require('./session/cookie') + , Store = require('./session/store') + , utils = require('./../utils') + , parse = utils.parseUrl + , crc32 = require('buffer-crc32'); + +// environment + +var env = process.env.NODE_ENV; + +/** + * Expose the middleware. + */ + +exports = module.exports = session; + +/** + * Expose constructors. + */ + +exports.Store = Store; +exports.Cookie = Cookie; +exports.Session = Session; +exports.MemoryStore = MemoryStore; + +/** + * Warning message for `MemoryStore` usage in production. + */ + +var warning = 'Warning: connection.session() MemoryStore is not\n' + + 'designed for a production environment, as it will leak\n' + + 'memory, and will not scale past a single process.'; + +/** + * Session: + * + * Setup session store with the given `options`. + * + * Session data is _not_ saved in the cookie itself, however + * cookies are used, so we must use the [cookieParser()](cookieParser.html) + * middleware _before_ `session()`. + * + * Examples: + * + * connect() + * .use(connect.cookieParser()) + * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }})) + * + * Options: + * + * - `key` cookie name defaulting to `connect.sid` + * - `store` session store instance + * - `secret` session cookie is signed with this secret to prevent tampering + * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` + * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") + * + * Cookie option: + * + * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set + * so the cookie becomes a browser-session cookie. When the user closes the + * browser the cookie (and session) will be removed. + * + * ## req.session + * + * To store or access session data, simply use the request property `req.session`, + * which is (generally) serialized as JSON by the store, so nested objects + * are typically fine. For example below is a user-specific view counter: + * + * connect() + * .use(connect.favicon()) + * .use(connect.cookieParser()) + * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) + * .use(function(req, res, next){ + * var sess = req.session; + * if (sess.views) { + * res.setHeader('Content-Type', 'text/html'); + * res.write('

    views: ' + sess.views + '

    '); + * res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); + * res.end(); + * sess.views++; + * } else { + * sess.views = 1; + * res.end('welcome to the session demo. refresh!'); + * } + * } + * )).listen(3000); + * + * ## Session#regenerate() + * + * To regenerate the session simply invoke the method, once complete + * a new SID and `Session` instance will be initialized at `req.session`. + * + * req.session.regenerate(function(err){ + * // will have a new session here + * }); + * + * ## Session#destroy() + * + * Destroys the session, removing `req.session`, will be re-generated next request. + * + * req.session.destroy(function(err){ + * // cannot access session here + * }); + * + * ## Session#reload() + * + * Reloads the session data. + * + * req.session.reload(function(err){ + * // session updated + * }); + * + * ## Session#save() + * + * Save the session. + * + * req.session.save(function(err){ + * // session saved + * }); + * + * ## Session#touch() + * + * Updates the `.maxAge` property. Typically this is + * not necessary to call, as the session middleware does this for you. + * + * ## Session#cookie + * + * Each session has a unique cookie object accompany it. This allows + * you to alter the session cookie per visitor. For example we can + * set `req.session.cookie.expires` to `false` to enable the cookie + * to remain for only the duration of the user-agent. + * + * ## Session#maxAge + * + * Alternatively `req.session.cookie.maxAge` will return the time + * remaining in milliseconds, which we may also re-assign a new value + * to adjust the `.expires` property appropriately. The following + * are essentially equivalent + * + * var hour = 3600000; + * req.session.cookie.expires = new Date(Date.now() + hour); + * req.session.cookie.maxAge = hour; + * + * For example when `maxAge` is set to `60000` (one minute), and 30 seconds + * has elapsed it will return `30000` until the current request has completed, + * at which time `req.session.touch()` is called to reset `req.session.maxAge` + * to its original value. + * + * req.session.cookie.maxAge; + * // => 30000 + * + * Session Store Implementation: + * + * Every session store _must_ implement the following methods + * + * - `.get(sid, callback)` + * - `.set(sid, session, callback)` + * - `.destroy(sid, callback)` + * + * Recommended methods include, but are not limited to: + * + * - `.length(callback)` + * - `.clear(callback)` + * + * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. + * + * @param {Object} options + * @return {Function} + * @api public + */ + +function session(options){ + var options = options || {} + , key = options.key || 'connect.sid' + , store = options.store || new MemoryStore + , cookie = options.cookie || {} + , trustProxy = options.proxy + , storeReady = true; + + // notify user that this store is not + // meant for a production environment + if ('production' == env && store instanceof MemoryStore) { + console.warn(warning); + } + + // generates the new session + store.generate = function(req){ + req.sessionID = utils.uid(24); + req.session = new Session(req); + req.session.cookie = new Cookie(cookie); + }; + + store.on('disconnect', function(){ storeReady = false; }); + store.on('connect', function(){ storeReady = true; }); + + return function session(req, res, next) { + // self-awareness + if (req.session) return next(); + + // Handle connection as if there is no session if + // the store has temporarily disconnected etc + if (!storeReady) return debug('store is disconnected'), next(); + + // pathname mismatch + if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next(); + + // backwards compatibility for signed cookies + // req.secret is passed from the cookie parser middleware + var secret = options.secret || req.secret; + + // ensure secret is available or bail + if (!secret) throw new Error('`secret` option required for sessions'); + + // parse url + var originalHash + , originalId; + + // expose store + req.sessionStore = store; + + // grab the session cookie value and check the signature + var rawCookie = req.cookies[key]; + + // get signedCookies for backwards compat with signed cookies + var unsignedCookie = req.signedCookies[key]; + + if (!unsignedCookie && rawCookie) { + unsignedCookie = utils.parseSignedCookie(rawCookie, secret); + } + + // set-cookie + res.on('header', function(){ + if (!req.session) return; + var cookie = req.session.cookie + , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() + , tls = req.connection.encrypted || (trustProxy && 'https' == proto) + , secured = cookie.secure && tls + , isNew = unsignedCookie != req.sessionID; + + // only send secure cookies via https + if (cookie.secure && !secured) return debug('not secured'); + + // browser-session length cookie + if (null == cookie.expires) { + if (!isNew) return debug('already set browser-session cookie'); + // compare hashes and ids + } else if (originalHash == hash(req.session) && originalId == req.session.id) { + return debug('unmodified session'); + } + + var val = 's:' + signature.sign(req.sessionID, secret); + val = cookie.serialize(key, val); + debug('set-cookie %s', val); + res.setHeader('Set-Cookie', val); + }); + + // proxy end() to commit the session + var end = res.end; + res.end = function(data, encoding){ + res.end = end; + if (!req.session) return res.end(data, encoding); + debug('saving'); + req.session.resetMaxAge(); + req.session.save(function(){ + debug('saved'); + res.end(data, encoding); + }); + }; + + // generate the session + function generate() { + store.generate(req); + } + + // get the sessionID from the cookie + req.sessionID = unsignedCookie; + + // generate a session if the browser doesn't send a sessionID + if (!req.sessionID) { + debug('no SID sent, generating session'); + generate(); + next(); + return; + } + + // generate the session object + var pause = utils.pause(req); + debug('fetching %s', req.sessionID); + store.get(req.sessionID, function(err, sess){ + // proxy to resume() events + var _next = next; + next = function(err){ + _next(err); + pause.resume(); + }; + + // error handling + if (err) { + debug('error'); + if ('ENOENT' == err.code) { + generate(); + next(); + } else { + next(err); + } + // no session + } else if (!sess) { + debug('no session found'); + generate(); + next(); + // populate req.session + } else { + debug('session found'); + store.createSession(req, sess); + originalId = req.sessionID; + originalHash = hash(sess); + next(); + } + }); + }; +}; + +/** + * Hash the given `sess` object omitting changes + * to `.cookie`. + * + * @param {Object} sess + * @return {String} + * @api private + */ + +function hash(sess) { + return crc32.signed(JSON.stringify(sess, function(key, val){ + if ('cookie' != key) return val; + })); +} diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js new file mode 100644 index 0000000..e8ff862 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js @@ -0,0 +1,128 @@ + +/*! + * Connect - session - Cookie + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../../utils') + , cookie = require('cookie'); + +/** + * Initialize a new `Cookie` with the given `options`. + * + * @param {IncomingMessage} req + * @param {Object} options + * @api private + */ + +var Cookie = module.exports = function Cookie(options) { + this.path = '/'; + this.maxAge = null; + this.httpOnly = true; + if (options) utils.merge(this, options); + this.originalMaxAge = undefined == this.originalMaxAge + ? this.maxAge + : this.originalMaxAge; +}; + +/*! + * Prototype. + */ + +Cookie.prototype = { + + /** + * Set expires `date`. + * + * @param {Date} date + * @api public + */ + + set expires(date) { + this._expires = date; + this.originalMaxAge = this.maxAge; + }, + + /** + * Get expires `date`. + * + * @return {Date} + * @api public + */ + + get expires() { + return this._expires; + }, + + /** + * Set expires via max-age in `ms`. + * + * @param {Number} ms + * @api public + */ + + set maxAge(ms) { + this.expires = 'number' == typeof ms + ? new Date(Date.now() + ms) + : ms; + }, + + /** + * Get expires max-age in `ms`. + * + * @return {Number} + * @api public + */ + + get maxAge() { + return this.expires instanceof Date + ? this.expires.valueOf() - Date.now() + : this.expires; + }, + + /** + * Return cookie data object. + * + * @return {Object} + * @api private + */ + + get data() { + return { + originalMaxAge: this.originalMaxAge + , expires: this._expires + , secure: this.secure + , httpOnly: this.httpOnly + , domain: this.domain + , path: this.path + } + }, + + /** + * Return a serialized cookie string. + * + * @return {String} + * @api public + */ + + serialize: function(name, val){ + return cookie.serialize(name, val, this.data); + }, + + /** + * Return JSON representation of this cookie. + * + * @return {Object} + * @api private + */ + + toJSON: function(){ + return this.data; + } +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js new file mode 100644 index 0000000..fb93939 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js @@ -0,0 +1,129 @@ + +/*! + * Connect - session - MemoryStore + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Store = require('./store'); + +/** + * Initialize a new `MemoryStore`. + * + * @api public + */ + +var MemoryStore = module.exports = function MemoryStore() { + this.sessions = {}; +}; + +/** + * Inherit from `Store.prototype`. + */ + +MemoryStore.prototype.__proto__ = Store.prototype; + +/** + * Attempt to fetch session by the given `sid`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.get = function(sid, fn){ + var self = this; + process.nextTick(function(){ + var expires + , sess = self.sessions[sid]; + if (sess) { + sess = JSON.parse(sess); + expires = 'string' == typeof sess.cookie.expires + ? new Date(sess.cookie.expires) + : sess.cookie.expires; + if (!expires || new Date < expires) { + fn(null, sess); + } else { + self.destroy(sid, fn); + } + } else { + fn(); + } + }); +}; + +/** + * Commit the given `sess` object associated with the given `sid`. + * + * @param {String} sid + * @param {Session} sess + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.set = function(sid, sess, fn){ + var self = this; + process.nextTick(function(){ + self.sessions[sid] = JSON.stringify(sess); + fn && fn(); + }); +}; + +/** + * Destroy the session associated with the given `sid`. + * + * @param {String} sid + * @api public + */ + +MemoryStore.prototype.destroy = function(sid, fn){ + var self = this; + process.nextTick(function(){ + delete self.sessions[sid]; + fn && fn(); + }); +}; + +/** + * Invoke the given callback `fn` with all active sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.all = function(fn){ + var arr = [] + , keys = Object.keys(this.sessions); + for (var i = 0, len = keys.length; i < len; ++i) { + arr.push(this.sessions[keys[i]]); + } + fn(null, arr); +}; + +/** + * Clear all sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.clear = function(fn){ + this.sessions = {}; + fn && fn(); +}; + +/** + * Fetch number of sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.length = function(fn){ + fn(null, Object.keys(this.sessions).length); +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/node_modules/express/node_modules/connect/lib/middleware/session/session.js new file mode 100644 index 0000000..0dd4b40 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/session/session.js @@ -0,0 +1,116 @@ + +/*! + * Connect - session - Session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../../utils'); + +/** + * Create a new `Session` with the given request and `data`. + * + * @param {IncomingRequest} req + * @param {Object} data + * @api private + */ + +var Session = module.exports = function Session(req, data) { + Object.defineProperty(this, 'req', { value: req }); + Object.defineProperty(this, 'id', { value: req.sessionID }); + if ('object' == typeof data) utils.merge(this, data); +}; + +/** + * Update reset `.cookie.maxAge` to prevent + * the cookie from expiring when the + * session is still active. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.touch = function(){ + return this.resetMaxAge(); +}; + +/** + * Reset `.maxAge` to `.originalMaxAge`. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.resetMaxAge = function(){ + this.cookie.maxAge = this.cookie.originalMaxAge; + return this; +}; + +/** + * Save the session data with optional callback `fn(err)`. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.save = function(fn){ + this.req.sessionStore.set(this.id, this, fn || function(){}); + return this; +}; + +/** + * Re-loads the session data _without_ altering + * the maxAge properties. Invokes the callback `fn(err)`, + * after which time if no exception has occurred the + * `req.session` property will be a new `Session` object, + * although representing the same session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.reload = function(fn){ + var req = this.req + , store = this.req.sessionStore; + store.get(this.id, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(new Error('failed to load session')); + store.createSession(req, sess); + fn(); + }); + return this; +}; + +/** + * Destroy `this` session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.destroy = function(fn){ + delete this.req.session; + this.req.sessionStore.destroy(this.id, fn); + return this; +}; + +/** + * Regenerate this request's session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.regenerate = function(fn){ + this.req.sessionStore.regenerate(this.req, fn); + return this; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/node_modules/express/node_modules/connect/lib/middleware/session/store.js new file mode 100644 index 0000000..54294cb --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/session/store.js @@ -0,0 +1,84 @@ + +/*! + * Connect - session - Store + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , Session = require('./session') + , Cookie = require('./cookie'); + +/** + * Initialize abstract `Store`. + * + * @api private + */ + +var Store = module.exports = function Store(options){}; + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Store.prototype.__proto__ = EventEmitter.prototype; + +/** + * Re-generate the given requests's session. + * + * @param {IncomingRequest} req + * @return {Function} fn + * @api public + */ + +Store.prototype.regenerate = function(req, fn){ + var self = this; + this.destroy(req.sessionID, function(err){ + self.generate(req); + fn(err); + }); +}; + +/** + * Load a `Session` instance via the given `sid` + * and invoke the callback `fn(err, sess)`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +Store.prototype.load = function(sid, fn){ + var self = this; + this.get(sid, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(); + var req = { sessionID: sid, sessionStore: self }; + sess = self.createSession(req, sess); + fn(null, sess); + }); +}; + +/** + * Create session from JSON `sess` data. + * + * @param {IncomingRequest} req + * @param {Object} sess + * @return {Session} + * @api private + */ + +Store.prototype.createSession = function(req, sess){ + var expires = sess.cookie.expires + , orig = sess.cookie.originalMaxAge; + sess.cookie = new Cookie(sess.cookie); + if ('string' == typeof expires) sess.cookie.expires = new Date(expires); + sess.cookie.originalMaxAge = orig; + req.session = new Session(req, sess); + return req.session; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/static.js b/node_modules/express/node_modules/connect/lib/middleware/static.js new file mode 100644 index 0000000..bb29d07 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/static.js @@ -0,0 +1,94 @@ + +/*! + * Connect - static + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var send = require('send') + , utils = require('../utils') + , parse = utils.parseUrl + , url = require('url'); + +/** + * Static: + * + * Static file server with the given `root` path. + * + * Examples: + * + * var oneDay = 86400000; + * + * connect() + * .use(connect.static(__dirname + '/public')) + * + * connect() + * .use(connect.static(__dirname + '/public', { maxAge: oneDay })) + * + * Options: + * + * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0 + * - `hidden` Allow transfer of hidden files. defaults to false + * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true + * + * @param {String} root + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function static(root, options){ + options = options || {}; + + // root required + if (!root) throw new Error('static() root path required'); + + // default redirect + var redirect = false !== options.redirect; + + return function static(req, res, next) { + if ('GET' != req.method && 'HEAD' != req.method) return next(); + var path = parse(req).pathname; + var pause = utils.pause(req); + + function resume() { + next(); + pause.resume(); + } + + function directory() { + if (!redirect) return resume(); + var pathname = url.parse(req.originalUrl).pathname; + res.statusCode = 301; + res.setHeader('Location', pathname + '/'); + res.end('Redirecting to ' + utils.escape(pathname) + '/'); + } + + function error(err) { + if (404 == err.status) return resume(); + next(err); + } + + send(req, path) + .maxage(options.maxAge || 0) + .root(root) + .hidden(options.hidden) + .on('error', error) + .on('directory', directory) + .pipe(res); + }; +}; + +/** + * Expose mime module. + * + * If you wish to extend the mime table use this + * reference to the "mime" module in the npm registry. + */ + +exports.mime = send.mime; diff --git a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js new file mode 100644 index 0000000..7354a8f --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js @@ -0,0 +1,231 @@ + +/*! + * Connect - staticCache + * Copyright(c) 2011 Sencha Inc. + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , Cache = require('../cache') + , fresh = require('fresh'); + +/** + * Static cache: + * + * Enables a memory cache layer on top of + * the `static()` middleware, serving popular + * static files. + * + * By default a maximum of 128 objects are + * held in cache, with a max of 256k each, + * totalling ~32mb. + * + * A Least-Recently-Used (LRU) cache algo + * is implemented through the `Cache` object, + * simply rotating cache objects as they are + * hit. This means that increasingly popular + * objects maintain their positions while + * others get shoved out of the stack and + * garbage collected. + * + * Benchmarks: + * + * static(): 2700 rps + * node-static: 5300 rps + * static() + staticCache(): 7500 rps + * + * Options: + * + * - `maxObjects` max cache objects [128] + * - `maxLength` max cache object length 256kb + * + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function staticCache(options){ + var options = options || {} + , cache = new Cache(options.maxObjects || 128) + , maxlen = options.maxLength || 1024 * 256; + + console.warn('connect.staticCache() is deprecated and will be removed in 3.0'); + console.warn('use varnish or similar reverse proxy caches.'); + + return function staticCache(req, res, next){ + var key = cacheKey(req) + , ranges = req.headers.range + , hasCookies = req.headers.cookie + , hit = cache.get(key); + + // cache static + // TODO: change from staticCache() -> cache() + // and make this work for any request + req.on('static', function(stream){ + var headers = res._headers + , cc = utils.parseCacheControl(headers['cache-control'] || '') + , contentLength = headers['content-length'] + , hit; + + // dont cache set-cookie responses + if (headers['set-cookie']) return hasCookies = true; + + // dont cache when cookies are present + if (hasCookies) return; + + // ignore larger files + if (!contentLength || contentLength > maxlen) return; + + // don't cache partial files + if (headers['content-range']) return; + + // dont cache items we shouldn't be + // TODO: real support for must-revalidate / no-cache + if ( cc['no-cache'] + || cc['no-store'] + || cc['private'] + || cc['must-revalidate']) return; + + // if already in cache then validate + if (hit = cache.get(key)){ + if (headers.etag == hit[0].etag) { + hit[0].date = new Date; + return; + } else { + cache.remove(key); + } + } + + // validation notifiactions don't contain a steam + if (null == stream) return; + + // add the cache object + var arr = []; + + // store the chunks + stream.on('data', function(chunk){ + arr.push(chunk); + }); + + // flag it as complete + stream.on('end', function(){ + var cacheEntry = cache.add(key); + delete headers['x-cache']; // Clean up (TODO: others) + cacheEntry.push(200); + cacheEntry.push(headers); + cacheEntry.push.apply(cacheEntry, arr); + }); + }); + + if (req.method == 'GET' || req.method == 'HEAD') { + if (ranges) { + next(); + } else if (!hasCookies && hit && !mustRevalidate(req, hit)) { + res.setHeader('X-Cache', 'HIT'); + respondFromCache(req, res, hit); + } else { + res.setHeader('X-Cache', 'MISS'); + next(); + } + } else { + next(); + } + } +}; + +/** + * Respond with the provided cached value. + * TODO: Assume 200 code, that's iffy. + * + * @param {Object} req + * @param {Object} res + * @param {Object} cacheEntry + * @return {String} + * @api private + */ + +function respondFromCache(req, res, cacheEntry) { + var status = cacheEntry[0] + , headers = utils.merge({}, cacheEntry[1]) + , content = cacheEntry.slice(2); + + headers.age = (new Date - new Date(headers.date)) / 1000 || 0; + + switch (req.method) { + case 'HEAD': + res.writeHead(status, headers); + res.end(); + break; + case 'GET': + if (utils.conditionalGET(req) && fresh(req.headers, headers)) { + headers['content-length'] = 0; + res.writeHead(304, headers); + res.end(); + } else { + res.writeHead(status, headers); + + function write() { + while (content.length) { + if (false === res.write(content.shift())) { + res.once('drain', write); + return; + } + } + res.end(); + } + + write(); + } + break; + default: + // This should never happen. + res.writeHead(500, ''); + res.end(); + } +} + +/** + * Determine whether or not a cached value must be revalidated. + * + * @param {Object} req + * @param {Object} cacheEntry + * @return {String} + * @api private + */ + +function mustRevalidate(req, cacheEntry) { + var cacheHeaders = cacheEntry[1] + , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '') + , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '') + , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0; + + if ( cacheCC['no-cache'] + || cacheCC['must-revalidate'] + || cacheCC['proxy-revalidate']) return true; + + if (reqCC['no-cache']) return true; + + if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge; + + if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge; + + return false; +} + +/** + * The key to use in the cache. For now, this is the URL path and query. + * + * 'http://example.com/?key=value' -> '/?key=value' + * + * @param {Object} req + * @return {String} + * @api private + */ + +function cacheKey(req) { + return utils.parseUrl(req).path; +} diff --git a/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/node_modules/express/node_modules/connect/lib/middleware/timeout.js new file mode 100644 index 0000000..a6dc087 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/timeout.js @@ -0,0 +1,56 @@ + +/*! + * Connect - timeout + * Ported from https://github.com/LearnBoost/connect-timeout + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var debug = require('debug')('connect:timeout'); + +/** + * Timeout: + * + * Times out the request in `ms`, defaulting to `5000`. The + * method `req.clearTimeout()` is added to revert this behaviour + * programmatically within your application's middleware, routes, etc. + * + * The timeout error is passed to `next()` so that you may customize + * the response behaviour. This error has the `.timeout` property as + * well as `.status == 408`. + * + * @param {Number} ms + * @return {Function} + * @api public + */ + +module.exports = function timeout(ms) { + ms = ms || 5000; + + return function(req, res, next) { + var id = setTimeout(function(){ + req.emit('timeout', ms); + }, ms); + + req.on('timeout', function(){ + if (req.headerSent) return debug('response started, cannot timeout'); + var err = new Error('Response timeout'); + err.timeout = ms; + err.status = 503; + next(err); + }); + + req.clearTimeout = function(){ + clearTimeout(id); + }; + + res.on('header', function(){ + clearTimeout(id); + }); + + next(); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js new file mode 100644 index 0000000..cceafc0 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js @@ -0,0 +1,78 @@ + +/*! + * Connect - urlencoded + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('../utils') + , _limit = require('./limit') + , qs = require('qs'); + +/** + * noop middleware. + */ + +function noop(req, res, next) { + next(); +} + +/** + * Urlencoded: + * + * Parse x-ww-form-urlencoded request bodies, + * providing the parsed object as `req.body`. + * + * Options: + * + * - `limit` byte limit disabled by default + * + * @param {Object} options + * @return {Function} + * @api public + */ + +exports = module.exports = function(options){ + options = options || {}; + + var limit = options.limit + ? _limit(options.limit) + : noop; + + return function urlencoded(req, res, next) { + if (req._body) return next(); + req.body = req.body || {}; + + if (!utils.hasBody(req)) return next(); + + // check Content-Type + if ('application/x-www-form-urlencoded' != utils.mime(req)) return next(); + + // flag as parsed + req._body = true; + + // parse + limit(req, res, function(err){ + if (err) return next(err); + var buf = ''; + req.setEncoding('utf8'); + req.on('data', function(chunk){ buf += chunk }); + req.on('end', function(){ + try { + req.body = buf.length + ? qs.parse(buf, options) + : {}; + next(); + } catch (err){ + err.body = buf; + next(err); + } + }); + }); + } +}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/node_modules/express/node_modules/connect/lib/middleware/vhost.js new file mode 100644 index 0000000..897a9d8 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/middleware/vhost.js @@ -0,0 +1,40 @@ + +/*! + * Connect - vhost + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Vhost: + * + * Setup vhost for the given `hostname` and `server`. + * + * connect() + * .use(connect.vhost('foo.com', fooApp)) + * .use(connect.vhost('bar.com', barApp)) + * .use(connect.vhost('*.com', mainApp)) + * + * The `server` may be a Connect server or + * a regular Node `http.Server`. + * + * @param {String} hostname + * @param {Server} server + * @return {Function} + * @api public + */ + +module.exports = function vhost(hostname, server){ + if (!hostname) throw new Error('vhost hostname required'); + if (!server) throw new Error('vhost server required'); + var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i'); + if (server.onvhost) server.onvhost(hostname); + return function vhost(req, res, next){ + if (!req.headers.host) return next(); + var host = req.headers.host.split(':')[0]; + if (!regexp.test(host)) return next(); + if ('function' == typeof server) return server(req, res, next); + server.emit('request', req, res); + }; +}; diff --git a/node_modules/express/node_modules/connect/lib/patch.js b/node_modules/express/node_modules/connect/lib/patch.js new file mode 100644 index 0000000..7cf0012 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/patch.js @@ -0,0 +1,79 @@ + +/*! + * Connect + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , res = http.ServerResponse.prototype + , setHeader = res.setHeader + , _renderHeaders = res._renderHeaders + , writeHead = res.writeHead; + +// apply only once + +if (!res._hasConnectPatch) { + + /** + * Provide a public "header sent" flag + * until node does. + * + * @return {Boolean} + * @api public + */ + + res.__defineGetter__('headerSent', function(){ + return this._header; + }); + + /** + * Set header `field` to `val`, special-casing + * the `Set-Cookie` field for multiple support. + * + * @param {String} field + * @param {String} val + * @api public + */ + + res.setHeader = function(field, val){ + var key = field.toLowerCase() + , prev; + + // special-case Set-Cookie + if (this._headers && 'set-cookie' == key) { + if (prev = this.getHeader(field)) { + val = Array.isArray(prev) + ? prev.concat(val) + : [prev, val]; + } + // charset + } else if ('content-type' == key && this.charset) { + val += '; charset=' + this.charset; + } + + return setHeader.call(this, field, val); + }; + + /** + * Proxy to emit "header" event. + */ + + res._renderHeaders = function(){ + if (!this._emittedHeader) this.emit('header'); + this._emittedHeader = true; + return _renderHeaders.call(this); + }; + + res.writeHead = function(){ + if (!this._emittedHeader) this.emit('header'); + this._emittedHeader = true; + return writeHead.apply(this, arguments); + }; + + res._hasConnectPatch = true; +} diff --git a/node_modules/express/node_modules/connect/lib/proto.js b/node_modules/express/node_modules/connect/lib/proto.js new file mode 100644 index 0000000..889c237 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/proto.js @@ -0,0 +1,239 @@ + +/*! + * Connect - HTTPServer + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , utils = require('./utils') + , debug = require('debug')('connect:dispatcher'); + +// prototype + +var app = module.exports = {}; + +// environment + +var env = process.env.NODE_ENV || 'development'; + +/** + * Utilize the given middleware `handle` to the given `route`, + * defaulting to _/_. This "route" is the mount-point for the + * middleware, when given a value other than _/_ the middleware + * is only effective when that segment is present in the request's + * pathname. + * + * For example if we were to mount a function at _/admin_, it would + * be invoked on _/admin_, and _/admin/settings_, however it would + * not be invoked for _/_, or _/posts_. + * + * Examples: + * + * var app = connect(); + * app.use(connect.favicon()); + * app.use(connect.logger()); + * app.use(connect.static(__dirname + '/public')); + * + * If we wanted to prefix static files with _/public_, we could + * "mount" the `static()` middleware: + * + * app.use('/public', connect.static(__dirname + '/public')); + * + * This api is chainable, so the following is valid: + * + * connect() + * .use(connect.favicon()) + * .use(connect.logger()) + * .use(connect.static(__dirname + '/public')) + * .listen(3000); + * + * @param {String|Function|Server} route, callback or server + * @param {Function|Server} callback or server + * @return {Server} for chaining + * @api public + */ + +app.use = function(route, fn){ + // default route to '/' + if ('string' != typeof route) { + fn = route; + route = '/'; + } + + // wrap sub-apps + if ('function' == typeof fn.handle) { + var server = fn; + fn.route = route; + fn = function(req, res, next){ + server.handle(req, res, next); + }; + } + + // wrap vanilla http.Servers + if (fn instanceof http.Server) { + fn = fn.listeners('request')[0]; + } + + // strip trailing slash + if ('/' == route[route.length - 1]) { + route = route.slice(0, -1); + } + + // add the middleware + debug('use %s %s', route || '/', fn.name || 'anonymous'); + this.stack.push({ route: route, handle: fn }); + + return this; +}; + +/** + * Handle server requests, punting them down + * the middleware stack. + * + * @api private + */ + +app.handle = function(req, res, out) { + var stack = this.stack + , fqdn = ~req.url.indexOf('://') + , removed = '' + , slashAdded = false + , index = 0; + + function next(err, msg) { + var layer, path, status, c; + + if (slashAdded) { + req.url = req.url.substr(1); + slashAdded = false; + } + + req.url = removed + req.url; + req.originalUrl = req.originalUrl || req.url; + removed = ''; + + // next(status, msg) support + if (typeof err === 'number') { + var status = err; + var name = http.STATUS_CODES[status]; + err = new Error(msg || name); + err.name = name; + err.status = status; + } + + // next callback + layer = stack[index++]; + + // all done + if (!layer || res.headerSent) { + // delegate to parent + if (out) return out(err); + + // unhandled error + if (err) { + // default to 500 + if (res.statusCode < 400) res.statusCode = 500; + debug('default %s', res.statusCode); + + // respect err.status + if (err.status) res.statusCode = err.status; + + // production gets a basic error message + var msg = 'production' == env + ? http.STATUS_CODES[res.statusCode] + : err.stack || err.toString(); + + // log to stderr in a non-test env + if ('test' != env) console.error(err.stack || err.toString()); + if (res.headerSent) return req.socket.destroy(); + res.setHeader('Content-Type', 'text/plain'); + res.setHeader('Content-Length', Buffer.byteLength(msg)); + if ('HEAD' == req.method) return res.end(); + res.end(msg); + } else { + debug('default 404'); + res.statusCode = 404; + res.setHeader('Content-Type', 'text/plain'); + if ('HEAD' == req.method) return res.end(); + res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl)); + } + return; + } + + try { + path = utils.parseUrl(req).pathname; + if (undefined == path) path = '/'; + + // skip this layer if the route doesn't match. + if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); + + c = path[layer.route.length]; + if (c && '/' != c && '.' != c) return next(err); + + // Call the layer handler + // Trim off the part of the url that matches the route + removed = layer.route; + req.url = req.url.substr(removed.length); + + // Ensure leading slash + if (!fqdn && '/' != req.url[0]) { + req.url = '/' + req.url; + slashAdded = true; + } + + debug('%s', layer.handle.name || 'anonymous'); + var arity = layer.handle.length; + if (err) { + if (arity === 4) { + layer.handle(err, req, res, next); + } else { + next(err); + } + } else if (arity < 4) { + layer.handle(req, res, next); + } else { + next(); + } + } catch (e) { + next(e); + } + } + next(); +}; + +/** + * Listen for connections. + * + * This method takes the same arguments + * as node's `http.Server#listen()`. + * + * HTTP and HTTPS: + * + * If you run your application both as HTTP + * and HTTPS you may wrap them individually, + * since your Connect "server" is really just + * a JavaScript `Function`. + * + * var connect = require('connect') + * , http = require('http') + * , https = require('https'); + * + * var app = connect(); + * + * http.createServer(app).listen(80); + * https.createServer(options, app).listen(443); + * + * @return {http.Server} + * @api public + */ + +app.listen = function(){ + var server = http.createServer(this); + return server.listen.apply(server, arguments); +}; diff --git a/node_modules/express/node_modules/connect/lib/public/directory.html b/node_modules/express/node_modules/connect/lib/public/directory.html new file mode 100644 index 0000000..2d63704 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/public/directory.html @@ -0,0 +1,81 @@ + + + + + listing directory {directory} + + + + + +
    +

    {linked-path}

    + {files} +
    + + \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/public/error.html b/node_modules/express/node_modules/connect/lib/public/error.html new file mode 100644 index 0000000..a6d3faf --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/public/error.html @@ -0,0 +1,14 @@ + + + + {error} + + + +
    +

    {title}

    +

    {statusCode} {error}

    +
      {stack}
    +
    + + diff --git a/node_modules/express/node_modules/connect/lib/public/favicon.ico b/node_modules/express/node_modules/connect/lib/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..895fc96a76b68b4924f1c51d022e1b82fa0f461f GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&}i&OouUjIY8@C}uZw4x5z5N2 zvEG^C^vXtt_xtJ?p3O32c(KTx;lsgZhW%5M85Sf}k-mf`L80)|7ga~M{a znlL=>m1Q`#uoPkbC~GtXMnhnDh5$DU1D6mx+;2QAKt3ZQFH}H~1y~00GcqzVg9QXw z_<%(a7y$V|wJgF=E>MgE#Aid|14}IyCM5MhEnxFF;pTzOK(>#80puP=gnOXwAd33` mpMe2}f66m3eB@_fcnmb^7!b1nO#opK8zcsj1F30)+jEP);68^d)m`eN0o>(5%D`Q(1;j>g@G;xlf`0VBQ`PFY?6)!N&f?*K}$p; zB!U=NBn{eB8${1}&-2_L*HuZp@ZP1@clS@cHp)4iM1ewzw59vko7eMM{e9z|%NNdX z0V;`?KKSzTCvTm5bc{L^CIKLUxc2X{i{ISz$8Sgf{q)1nXTP{`{s?9mQ$4&hPiKC- zY8q7(Y1Xu5iCf33=O4Vy(+|zQ?rW#gkKB0f%}?+6{G*qT22|DQB-73`YzA{N4W^=s zq0kQYcbtFfz zLz)H<&|z(Y4kBG67=JY6c|L1R-#TR>fC$3^Y%QEnYO1xHsf)+GU`3F<{J0kR(;pbF3)zyg$H+idfnl-wl5Wkh!vUH z4Z32YP=l_}1rZd1W_D&^$A($A+&a0e&P?xx0!ctY2}*<#p+qPVN*B(YzvAWXa*%bzq z7Fz41LKILT(GWohi9|LgIzSZBhb*Zf6R6O}WYQ4GOi&71s9lmll0x6;8&ILOl$j(c z0Z1T(6Tg09{?wd{moFHNN6PS?$|e>1MxSJ(0Z7o2)J-Zv|>acY@f`(Y@g7GwsEj5NLQo+q|HsxQ5}XSX_d@*^A9ZT9=A{W~j+$GyI1 zc4oqTHx@1FlRjw4XWyPN5i2~l_F3@aBk!0yu^aoRDvXy}8@HCjUVQUsuSH4$T5|r< zzZOn^?Wfa6y|Q($Hx4{ws+)wX6-HP4zo!S?4KJ@7PG@G3G{CjXs(p*kIrj6rHs7_y z+=<-=Q62s9FuWa^X~WKgJIAAZJR&XBB002ovPDHLkV1jCMPILeO literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png new file mode 100644 index 0000000000000000000000000000000000000000..89ee2da0753040d1ba0a3487473a715a8fe89322 GIT binary patch literal 794 zcmV+#1LgdQP)i_t#ewV_0K6;=bl;e_Jt7$~$sQ)q$+ia<4Ec+jeaGt9oWH@O|2`W6&O0t!k{B9sUvLWxkCaPsd9W(`fa z;j-|^ZI^2XnzhgZWYRW-kP&J>DWPo`%;JaBX}or79k=+Jo@h%4Eo72tqev+cB?PjP zO<|ByL#>Tehyq$jR74O$B9WDW1`tK`LzYyL3A9iAcRxLkJ`I)n}v%Od-3H>j$OTBtk>(k-9o?8PqI=0 zB&f-+KOXVnjyKJlf4iHOtnuiE_4+ZVJ$dHjU<^o^YCjQ-wt^!;rPpBv(@pFO{9rdw98 z_s@3+yta93oyfL>7AD5}r=|`zS3Gm$_|(iSl8XBd9k%=91J0j2=ivT5cJ18ZmDjh{ z$-RMd{jQ#X79#Sc literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ea90419d950f9e69d977a1f5847456d96a5f0b GIT binary patch literal 818 zcmV-21I_%2P)@LCln44|RX7Ti z0HI3&7jPq){odH{?_{%nYVq_;n_c4WbUpvU(&Cvnj!vq|kVC-vpF6vp^;;e0mm6HW z+WPzA`AZ|;pPp$&dNjzrc??4rt`k%Q1l*u-BPD0MQ}Fbm8jnsyezNt7+u{23>t7Em zJtETY?ja9KrVs^!LJ$xEMF3-bAZO;-IQJavE60KA7fO$VY_%N)R6s>g5mW>fL4&aR z*EVgKKTBXm!=L?S0?xM zYqL@C$|EDF2q*3zWW7;PDZ}SK*IE8;i!3U62=qn80C&*I1Le7WwNP5EcX;_oh2dJn zf#HgBe4@r$GcjHjmj2vAfT%(YN?}kK=(*+1*DkNNc1H5R++vfBMhACi<5uFUU+N4+ z<&U*CPmWi}REa7C6-t>2im1CWv5Jkefxa6>)dEj-CAW wWa{_}BJ!}~75?MkfaCnj>Dn=~vkLS70Pk`;z)@TQj{pDw07*qoM6N<$f@imYHUIzs literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..195dc6d6c365d298e466026b37c1959d96119ea7 GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6Z z(>-WZK@^7J_sq=QY_e{46@P+~LNG}sRzZsxQHvCsN*h5ir6^j7pq-$xu$N#V1gx}9 zClV7;5)7zih-s3DB)G=7|99>ji@So7-P24n=VQ(@GctDX!^_@$bj%oviY6e4Dh;od zooe%Wvs8LEKQ&&bL&@bwi=STIAI@!-gB2jC5+?y?VR~VkrNxam-`6*8&po|RZ5LpS zNKdJ%c4bTX`XjKsnecf%W>1%6WT?pKNdLLq{=(f(Col?P1+oq@R>)W(n=x!|*BIIh z6DJGw_w`)u6yN|vAhMteYK5#b%r5^v+VCFl1IGssaclZZMS{vs-LJ2$)n7DAr6==K z<29#%AXsBsDoO}SBaXR#_Ap!JKx)(1)3O2pj0_dYWz5By*X74fRT01$Fk%P_RzOMDtV?GU{nsYq#K8iy zb6qzLYDj`_f5$BwC*WE(t0m#xYJ*=jC2|HQYHh=pf#QG7oowi`h!L!{DB$8|qY{~X zu8@sU1tWq;n$XThR0%;45mdqXM892|{CJ@0DS*}>?ami06Q_^tvM~Y3K(_-`#m!8f z8f!QIrH4y#61;0Ym0cCoLl8{IPombPHtnn7%SbTdI&G-d>ZQo!_wBMF9nzX!g8HVY xYTJPGciz9XMh3w2fmZ(7v{)r*QZD48?mrio{~IaoqP z|1Ep}yDQG09bP~E^Dk?@JiKQJ z6-pO(3~IOP)IYisL6D6;oAEd;E%zR}{U$rMRNuD6nQV7nesKS>)yLo7JuDCrD>Abi zbj3uW23?^GA}9jQ{M^8v?ejL?HaT7AX5WPZNkBmfN`w-jL?{tT7ykZt$%Yln?p_m~ z-?>&d(LD(jAd}h=LPltPQbO$*Wbyl@G-_k5jXbb#qffHY03>M1jfEqoPJQ6Mr=Byp=^jfzePZV1 zLjCmNi31hdIJHa%e;5g=1(`u3BRzfeExY%=VCu{loOr{`%2hUR*x>tL^W_TTaj);0 zpPR6CUD1+0>4TQ6zVfH3TQ;%l6#(_%yspK@3gcmG#Q4!WCPyLU93nMKk7E2pcA=l45({2jNho>sdF*A~bA zxX?-cp~y_z_kFf+yqu3m#QiB}03?Z&9vvR5TNgj<)($Vm)xq5G>|o2sFMag&6aNF+ WAT1?sQBYt20000iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png new file mode 100644 index 0000000000000000000000000000000000000000..f07f449a44ff2761bfc7b752db3d08d0e1238b02 GIT binary patch literal 793 zcmV+!1LpjRP)lHwhvrAu0-@MQwt}+5~MQTtu}C0%;W( z1<{R?aHBz*g;pk%AyQVBR_Zu5m~;ES_vxI-O!vIF|H*|T{l`n#garr?$RMk>)?Y48 z(ZF2yTneKb};DNWF+jK)IF`6_IfJ{i|F3o%Q+l&4_HGBD|ACE8na_6>L z=s{^>-C(a7J$6=8A_%h5W!1K6dcL!D?XX+Ndk)oei?UundDpX_E&1Y&`)3P8#Ny0s z2Ag7_&ZPhyGj%)g&S6V2LNun1;iBQm#Fwlfv zgyESZR$X}2P;=RW!2zid1r$hBL{K7>2qi*f7>pT1=RdT3@-anEoH{ z={KFOO;Dh#bV*jaN>}M>RZqQd`S=6O9C3KpI~I>l%QFYfo;jqQYe5fcn`)+)zMm6P z4X&L(>gnN0!%J4^rhX->?$S5bY<=GEU%jc!KLL8sww-Eg;h z`H-yBHa)yfojYT}&G*GFc$<(Yja_q=lZvj66DC^O5%$B)|Z(CeD=n`|eM04SP; z>-=-l+xdJjA~vR6^xB#o{ehf~tSM`iwaQv$O<8NIHA}W_WOw*~ XD^gE}t;YAo00000NkvXXu0mjfl6ZQ> literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9 GIT binary patch literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png new file mode 100644 index 0000000000000000000000000000000000000000..2f193889f7ea091c292acdd684c595dcb206b5c4 GIT binary patch literal 879 zcmV-#1CacQP)@+1&aazfGU7ezSm^v zpACwO+tu0su66!(dT=`e05DeeCnCFJW(8|RKtKa{4LGONnx2V85A4m%PEQ?MEtR-esdM$pB-`H542D0)N2zSC6Imf)4L8?>%ZrW+H>xCKi$unm zvGZq-*Q%Aahx;C*=l+K%-?>XB)6TB$-L$r*`RUvlA`xP1NG2?)ge8@TQ4EN|Jks0u zcDg;oFC#-#R`YbWB`D?Q`1#y7l$LXhjSLf8AvQuB84}i#j0^!#g{VE#(K7h@5pFHy zSenl=@XBEdxp`h2Ji>CR%=qXJ7!e|?paKet-~;#ok#jETyeB(5&Bkhp;!+;51~G=) zH?L7xmDUu_h+a$+xuWom;AWW!mS$%%+436Rjc@}y?l1134kgD0AOf$OmjOR zstUlshZk$ZC!bAyIg{Y29z#&@3SJ;6D4+_eFume9^#TmMccC5u0J!ZCTnO6m$lnD| z5JeFHf`Xs~1vP>RLKI1GKDY<~pjr2&bi(fX;6Nj-ss@Ds0CcoO0H{JsEQkm{q03skAA);_bv3q{k31qwVo&s-q`Z?_e+j^w(WL? zl+uETs5+~xBU2};OqEE9ETLGwsMGe1%iTRNue)9}|0~E4B*@5#oRXZ9oRXZ9TqRep zPrGZuoOON4n@=uPbyP1y4G=+HktC6l(gZoFD>@_lXDrN?wo+zozGt3P=Qh+3L7+}q z2!WK7geXLnO3Vw;o12Skp%_E#+N#9;DDWP?Q-VS3B$v~Ha)dDzWn0zG~O(^_1!n0HYp-( z+;wPIdoFgQlpYV!10V>5@a)1LyGBMvoa}miyp(bxbMTM-FYNyx;V@TfYddyT00000 LNkvXXu0mjf90!wr literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png new file mode 100644 index 0000000000000000000000000000000000000000..80fe1ed0cc75fbb67e9398ae686641f8fb287238 GIT binary patch literal 779 zcmV+m1N8ifP)JNR2Ufr z!Apo%Wf%b9=l#x^8AolrB&K9H?Pg_|78WA8(M3toqE%3B#7*srcF`i*xhupr27%Nr ziguah1+mN)U5GNmyEfQ3-e%_i&-vb-Co#(>FJ+EhQEwjRYVQ(&UYy{U@%vbY||>@4x=B^vIqabI?L* z;-S&DS^V3-ni4^fl|HMkOEbgX)(390>A}|VIypb5Xee4g;7ck zwKh^A3Mi1Mh@eC$5lV!}Fw%sP623U`g3pd_Hr5sunLvTskx4}&Gm%Q6L}(l4x}jCe z*81q1_4-O*ffi~_nMslo?EQ8t*&Ec(pzEw$vc}pKn_Qp0>D7Jr>ATNC3w@9f|Y+U&+)#!t7l&wKp+nP{PQsb+fb=Yf!Fu&5j8vpRj{FT>jD z>d>$sx;A&+`n$HcF}&sYKSyR;=(=9tvvOj@hUG;~4qTYk^_@E=?$*^_pVh_bGnOt~ z;pEw)j{SK$XVc;qy181rT655gW9NG{(yeablViIL>cDI_ux8m>Pp{tY$J0lgo4#ax za?j0EA3s0S!f>{~ykN9h_RhM&g3K(E`q(dE(Rd49+%xMeR9{qlWnmd{s#(SQ>PmFtSQqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d6626cb09eb11a298b90a8a27b0d8eab41f49a82 GIT binary patch literal 801 zcmV++1K#|JP)$lC4gU2-`f*>nhR-;k6IP7e>YO!0^w)WK%3$w02v-#>5Ep64PCP| zJihT#O|N+nT7XR2h7dAB?UEAOhJF^mol1i`QtQB`HSY}RE7=r! z)zaVIHr5?>v2Gz&fdYw&2ug$!p+txby(aWZ7(4QT)l2`jX7eMQ{>)lG6ev(fWKxmH zOr%mM5$6B%u~qGtCf40#`mbGj3s!n+^%wnJ&#rl>g<4Z)lB5J6f!?|AP275)Zswr* z%T}4~{;_(?waU!#?JabbF3Cy-kf0{R{z}6$e=5yMQKt3BPcl2>zoTPMqMwF;3!_n|>sT?~bK_-2O_m+o>GJ6h zt=+g$4n7y%1qVJI7*5Yw(hqM=JusY{d}*?U(Oj*gT655eZ>Ksn(qrd7v3}DX1}C>` z+X+8@+4-pVq_fxG zlU}~Ye!0+%>J+pPk+0wV{GM$QaYM?5ux)w2z59=S&H2+K?;gH$bZGzL&g5>G ft+noNiyiPkP9r@8gT|RZ00000NkvXXu0mjfuqTIu literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png new file mode 100644 index 0000000000000000000000000000000000000000..7e568703d6432c530224e443771a04fc1e2e59c6 GIT binary patch literal 839 zcmV-N1GxN&P)73{`^;G#xwAtHz%LU)4b zqTRU=ve1RNa3QT=ZM7C`iJ~QFQ*9t7<~pX$d^7W%^M8FFCkcQj-~0ZRTBCB(J0^iD z-~e!d9LR`f3#|=(>$bPvx_D-~2jC%pJ=n_e_OK zeJ_2b-KdDDh@@UlzBSMC;EPygH_MwjWBnPGQegihBV73D?-x9PlHL9A=(Vg=8^d<4 z<9r=UkxuIm)*CO=9e###7PztDxUv}e?$0)rQicmYhV`pQ%S!g@;K(?TVfhM#E?bM| z=B0gfb6h@a8bf5FVT-SV~6}?X}9lK@@Yynoty&1zdZP@?RfODsl=2XzzU% zS8gIN43How+9%bK2S@Xbc`O>`z5`%^;pXGy8^4f>9^3!Sp@|O&)m;dOa3q6d;4P-l zca|=H_{G&m?D_+&-}r{u-J$5T=(X4R&)q|O^gN8cgv;s#@5sEPT5_Z)oFo9Ac>l+I zc4ng5zHpps|9)<_Rw>5bKzE(M1j)dFWI_%OH$BJSz0?T+02W0)_a>#vFqb!*d|5wB zzBUN|M&ty51O@=i?kiDrjQ{{}e|^rU?OS|RdxxP1p5mAw36cX72#`R6UsoeCQFI~! z0ATITp!vfeYyQ?Dr=^5BAshfEa0nB~JG?nUa2Aur006MC*<9`)86SPS(W^`H2n+xi ztOWohsFfVfVWrI7PSKW}BmkyPoj(-|J?ES|BGd-}fIxr{00@ANnO*ZR`#)pee4I5T Rmm>fG002ovPDHLkV1i|Hc$okI literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png new file mode 100644 index 0000000000000000000000000000000000000000..312eab0914ab59271384686255d1be913a6b3add GIT binary patch literal 830 zcmV-E1Ht@>P)VWgGzD=Y79#JI$lhEn`|2MpRa?Bt#-nSD~P0P(mbVe{KrOBoKnSsk>m|ML{6l zBosu@om4j#WzNLRAk+{k1JRvL(MfE&vvbb->v>W{*z*1_uMP}0cIRX*?mz+wk%*#O z%0D-+$B*g1nRkvI+_3E8Pr1NC6@5M&4vWaLCnNlr;lNlr4i91z&)eBGqL{L{GNu;Fof}GS9{gM5BJuH;2QWk8yuOZdB3pGR#s8bd~ zAmt<>3Q=YH$t5YJ5;7@+8Uh6=ktBgY6#6Pa%2F?h910?U8cLT43KAj$Z1*==ra&gILO{WkHfs(--F=bly9l~${z@AT>V$oat!YAD@M zBE0v_F{`g#^wOSP-u~!wvlmXdd*uqFqoZ0^{&nEMDU+=!>({S0wrQhFmoB}Yq1)~0 z^{A)L8Xjzdr(W4_exYO6u3a{4*kIeXZMJUR>Q=ksjW_p!rAwDKYUs90>6Q|C>56o@ zbrSq^Xk7Gq#>dAsn@un`Hz$?w$;Ss`%jV7L%9ShgHFV~C)6M>B`Tp%|nqPc&G*A3| z)Qe+}vT4-x^t1~XE@(6wR;^lPWMo9n*~E!cy~)YRsT2{`?fqeIw-e7N@mOA%UcCIq z_kH(_EK7|>pM*1Wt2^DaDAp|cvp*@(ZZDKpYkKC^?97(`0sb&XTXy7N#sB~S07*qo IM6N<$f;YmCWB>pF literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png new file mode 100644 index 0000000000000000000000000000000000000000..246a2f0b426faa0c7f5ba009e32b1deaf88d1288 GIT binary patch literal 813 zcmV+|1JeA7P)otxGRZMDZ!_a~nK|b_-`n%VosaL{KDuPV10`(1LIen8kX2Xff$3BE zah#djvFGJ&eE^89Pk*-O^+&d>FC~^GjRYVQ(uuPJyS|-v?9lxA-+tM5>1Qu*n+Ir1 z6KhA>X4$XDH6?-|E5oe1E?pQ5-M;2xw_ex!x}I2+b=}mPFW$U%^;o(Zg*LP!K^1kP%8ynsD^= z1y^6xD1#GLjO{VLdh@0GKY7;d$+NGukV)GRLPn^=q=dF%B#XaJrNP`0E6=}e&Gj3d zKJbQre*WXt!60_DnIzgMQc6S#fvjXxsE1v7;T;njHkdy2miIqAS(nX~o%cO+q+b#h z5tIleLWvL=dQE8OC#{%y*Tnku&K`Tuub&_ELI0t_ea{@3f>Jv&sYqld(%}3_GY3Dm z;O{3*Y?v^A`a|D;^qrM=ykI)U6QHd%WhO~VF!SGjGn0GOZrc3mGZudNl9{Q#X5&-F zuGwVReFLBjE5jr!!^-5*L%!I%PkYH#Hs5rMrEBl^)9)9XTD;xjHFxVZMc3~Dw6#k$ z(-S}RE$bgMHv6Z`mS5|u$$78sp4G-8b@lVkl`HtEv+MGn!F&bKcHPi$$oP_;=BrPf z$(~b3&p3CsuQxhoV$%jIR;`lB-s7FDX)xCTXuJ7ZyIQk96uIR=HBt%-P?N*bp`)EF zq14c}QM+O70NTOa@V~_)&GMZ$^cQDlkyOCa(H3Mf+6xhCuZh`VSN{cQBl5Ys9{cp( rh`2H3A^=GuC6HjQ*7|*0>;m{7QlnX3z3MSD00000NkvXXu0mjfR5FYo literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..968f073fdddc1cc0f0800b1ac4001cd9a55f053d GIT binary patch literal 703 zcmV;w0zmzVP)AVs!l4K}n~L(tL`6d4Up4iSWnZ3Qg~4n+_J zDGk-qQdogO5JUtO-d5pRp7Nd7_r1^a|M&Zq%mn9Oe((|e0sw%Ur!K7T1pojj=U#f? zQM`qbQrM^DPkwa?DK_be^~z<~RgSMIa<`xP_4P7gg2jCwJ{9^k!fsU=#Ti|%I3p;>90Qd+7|~0h&mIklA#nb>ATL2+v$&u)OBgB z;nsHb)I&QRKeX40H~~cIZxCd}5C} z=79lXoXK%6YlyLtsV$~bSm?Upq|DJh#{|*a7XMm`4QJWZ>s6nL2R1|&J z0VPEwJ9?!n`o5PKAjc->P1Gi8BY*%!5&FVp=#)$mMJYul1Jton}gujiUf??eOy!x&!tsjxy;=Q3_DdcXx=a^OBhW0N~`A@4xB0a*%F? l+@c^sQA%W+?pa#c`9H5UNfS6T{e=Jk002ovPDHLkV1grvM=byV literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png new file mode 100644 index 0000000000000000000000000000000000000000..0b18247da5850f3c2486373a3e179acd2772e8aa GIT binary patch literal 641 zcmV-{0)G98P);68^@7JE5sw#jpE*579S@TLkU(6yap1yN*Zuy>-hV%Q_v4Ar&!63c8OBr(ZRhFu z_kWs36-AmgZCT>x!RqM;Zu9tqvoHI~k@UmYo_g(*J3c%2{N8}7I+|qKPQzv}7t>%W zsu&9G)UmCzkDYSw{fBnuW4j;1fKV_nicw`$8C6D=F_qu`zUiK$2Oc?5UVY+D(`I@R zW`KlwqLftWHH3Z2_XVNfKn>VgT~k=@- z+N>c>0|@A_HbI9Jn`v0~7cfIF(TS69zaomDS1QtgvaBBfGEPLHccO2~3jc>n^6}^HAEh-2#VxC7YYcDXv!L9X= z-R*SOUvIs;n`8(LxP4~^2|JsiN^hq6cU}5dn4v1~Kl{eT7pm&f$PoY`hyVe%y8G*S bxB&kH@RuR86sIAS00000NkvXXu0mjfZBi!% literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..cf347c7d4685128a4a447abb9fb8e939417644f4 GIT binary patch literal 858 zcmV-g1Eu_lP)`6pHR2Ufr z!EI=jWf;Km|8+n2IrHqe<9xxFVk)&(Nh?w$Xk`TAyvb=#e=0aySC z00NkRDM597_LiNIJ2M^qhuTvB004REvvU8@of{r?P8tmo3;+Pk0F0@*jAMhdOkS&1 zhJPPfQa;pP0|4+Yk%#j>X}o-s#EF1_DMV93FsfPP`G*>Ks>L&)Q}w2g%slu0kBfW1 z+*$*0BC^oTl6>OGIq(9BgG4|C90Dk-N_mPazGrQ7uHZ|>BLD!-KmZ)z1e^#?1Sf(M z!6m}K(^b|i%$TcA5bC}r$tAA?0C)g1@CgWliJ;NAk&ZF+-w#}$`-3nZ32C6IVKrHp zr+(!L2hRfF&AsTw>_@ z1y23;E%Oz}?q^Q2d($ayO;-sON2t7$w(Z|o0Pw1YnSp^}0PI+I5HnDNsFCA?oorkG z5sUIGIq=FSyxcj+xlhkm0en=52Bx3@02o12gdAU$_i?v6iyFMuc7P9#zQ-Hf; zVuV$t9P5`m)F2w1?t6{<8%wk{w-PP#Sj#%1MbsjrSI6n;D_@8q9`~W98dNQf$j=iI z6~hpgww&be%X_HI50Hhx@W==u4TLPB;ei-J-1}G8wH}|{i#Lk-WZAyfv}k4y0|fvU zZTy^$u6L>2nWo(NDSV2@MRD}JQ4(c%G%=dG@_vxH?>gcH#*Ue2HC}9sapf8X?R$Z;XEnm&g zW99mh)5jNw008mK8)r^`_{yH0rNn%u1|SpC(tjf#om=+r#lh+?Kb>DVb9`|C0Bvbv zN3U(>f4-tAC1hosRoA7p(b(hL*V}(j>ug<`&U)|l$6o$)!>PBQ9RQSwn9asj2p*|xhU*R^vq?*Twb0t!lm5}`yW5lRy-U0ZYK?8to!;o!r!XeOE$ z0HB3T+6EEoI4PlR=wonwqJ+TvCoWh&$?CAPVYcU= zD{DS0?AkOtb@-hh^ZLq~FMjxYf19X?pa_YqtgZGvv2TaxcF#KT?O%=_*a-kW_;N|D zakkWsOe!)HsT5WRBiC+p;N-c>0Qwy(1D2MDBC595oXSiR07)sKNk-%9*rDBOO^HUD zZW#;)R&EZpqha<(HK$(tZYU#V29<@0qCXgU{gXeGpc_|pTqQD-WO|}%yKZbeX7k*H z2W~CK$v8NBAq~czrc5A(v51g0Wma7`G8}f=ZcuAiYYxZan@gP(;Ku66M6?bquGiHe z3Q0ya)%Lvk@kLixZfZyU@#UFbv+>pYhcj8TRKSr_sWG8i^X~UA**LvbD3(_Lba3xm ziYcpup*A9qJ$?AA=Og05lndxfwr`!C+O~h|B~4 z01q8H`StcY);%&mId7_+)76ovRpeNWRp&4M?#jx@|E-)x%P*A6t^fc407*qoM6N<$ Ef@ddc(f|Me literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png new file mode 100644 index 0000000000000000000000000000000000000000..8b8b1ca0000bc8fa8d0379926736029f8fabe364 GIT binary patch literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png new file mode 100644 index 0000000000000000000000000000000000000000..8f8095e46fa4965700afe1f9d065d8a37b101676 GIT binary patch literal 591 zcmV-V0~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png new file mode 100644 index 0000000000000000000000000000000000000000..159b24075191fc259cfd80c797a1b0d74c168422 GIT binary patch literal 664 zcmV;J0%!e+P)7Z7t2}reCh0o`+ zAlt$F2tW%oO@m<=(B8a-_VgLl#~yUMUDWG!0qFPppd^03e+x1WpkO1NhIaKD2A)-@ z=Py8(Wi%R%JtYZG#sTKH@6Z+&!S3Edf8jFJJNKuva#KJQD3X^7;H^fd2di znEN&c58aUG>`>P{Vqq$kLb+TP{?I!d4(|o59X_%|nVEZq2Rk60n7072SWJ{64CV?3 zgS!EB=eYxwQ>P2&$}(iT6UMvuFgHHIEdNA29!EBtg=v~X!DxxEH~}L2zn|52%xalaq@DTdhh{EVwv0IaQ=!?daer zTKp4I`l8SDt;d{8Q`5Ko;BXUi&oAG1l4}59P-{|^S(Rmord5s6qsh<&m@Ab^wqCD) zHyRD}lKLDzpYN&@q5&*47mGzGiqcXpmqR9#K|CH8kXS4RNs`(iEF%HjP%f8ItyaZK z6$%Apvsok(2>~dTO5jTZfq;N?0ch4l01f$k9?4{~Youl-#x{UDMr#AFIkz@SDwPtQ z$gQ^$2|*(Ps9LQiav_8o8Ne<=Zx1*M*syo80sEO1tB%>5 zfdHB`1z+!R@?ghPRKmL)hWEvZE$=*54ose*0JiUNTM_)cMDXhxEKg(?-pD=y<)L4J zT0dSyD0&NhJ$^_8Ko9uom%-ZM4BTM{Tw$9qyPj=-9W;N(Wi@3*-Q4pq`Gcp}^vvNr zyd&PsmG>fpCSZz?K}UIEd;HGgG%0MG>ymxKPwy{>wy(m*Atq7)0000~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU7Lxm88-p zDk^c;sHj}OKUc4lGZU}6umlGVNAJx0%sKDOFwQx|V2pVvxhYKe|L9TNk!~md3BVrm zYPDL8Hk*yU-ER3~LGwJ7N`0ZV&nOhBI{~~A;@ND*=kxg?#^W&`4u`zk?Mg_e)8XlK z`T#M+OaR1!<#Nf_>$S`xrqd}OjYhoJ>q)?3vEX8pY&I()ERjfjrXM$k7e+-Qs3Ihj zNyOuEQ2EGYG7ro!o6VOBQEwuV2z)*tR8>WxP{616FY)p1Pn1d}#9}cxolZC$4n(6- z35hJq0;FlHC{ zp*iF(lgUK(E`($(s9pJ8Kn?(M734H_63WHtf}6SQQ_MXEP!#0|&@>J8dL5TfG&tBw z#tYn{TCGZvAr>cca%YYn^!t73tg8OOJ2FvJ(`YpCyVZi*?Ur+1uUA$hAg8-aK)c;e zQ<)!XwHh|n&ND=$@^)>aF-`~n}#*WMkD*M|f8r$i*z7+W! qF|A!t*4fE(R`<_YIkN&?Jng?3oQ|aAqClPi0000t>5xmo{nArfL4CJwMMm+N`pQ3p^Le$?rMud6Rbxz!-yG7bz2z$^USP5(;udf(gfQ zG~f68y^)EvcNWp#bUoDt2=h+^%o-?-|mo~iieWqLNP<0m@2PTB7ftyb= z@H`K$>v9Pr5X`L|rw&CEN2(9SB7A2SE;d|j9@*F}sd(@*2l|P*fWfK>1drZUrtUA7 zNXO~pKn1cjf~~TLbje1g>EPPzN2GH#UIBxJ{}S9=E`{zs-w#hO?vcH+hJxroI5v?j zD!4lP0WXq8zUx3RAP@|Gq$}6wXCjFLZY^YSWBxN9#&g)ro$%5}aYn#y=tJ_aIT%4d z5d4u`rlp!};XGmbZkJE*kYJoi&N0pd*yxY{0${xD;;Q1h^8f$<07*qoM6N<$f(}t7 Ae*gdg literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png new file mode 100644 index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615 GIT binary patch literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png new file mode 100644 index 0000000000000000000000000000000000000000..87a69145075afd8f8fd8b391c5da1249ec8b2889 GIT binary patch literal 587 zcmV-R0<`^!P)LWh{^|hy<@Q*xw+qo|KpY<+vaXbbW{L4q( zTsjXEJvb}e%bgb=o%W0h?4u1;^bWTqH8}5Th002ovPDHLkV1nrS0P+9; literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png new file mode 100644 index 0000000000000000000000000000000000000000..c66011fb0fbdcbf210483d676b7131542a0e282b GIT binary patch literal 592 zcmV-W0k7R5;6x zlV4BMP#DI+Z{WQcKZBTk0lfkj5F$ztWhP#lcuyb@0@rA^#Kpu5KLA&Rgc}o#aSmis zrZC__xY^&#cI&!!{c|4Q_tcec*#b>|Y15wPcY2=o3;-Bl=(t4;6Ok*pL)-{*A;GX^ zS(@WGp6j~k1wBVR9)BB_gar`}HyRBXh7nM!)u5^>N~MyN6bc0-5{W?44iB<`2biXb zR;wk?jIQg@G!5l)SqhrXCU}x$GU-dY1sra}0uCq@153FUULT=jNwSk}0WBjKz}Jdu z<5gB*<^XtpAmp3m^ZEXQZWd1krhft}CoYaF4cSMvTJ01}X3X37KYdx-D0$c{doUe8 ztY{vlGr-e*;N!WAV%_hgUawyYrhegW>^F)pv%uUTFslHn; zvJ)l{%w(~{!O4`KTmK{Q{zCYltLfs&4?nz|6IdlqHCvX;|HGv~!QW?8P~_d#e0$v$ z)5XHEz{3>qMiH`1+qNYf?huS+@L`J9_$cjJF)Hf?@pu;)`9}BXwGUM{2!{y-4|Z{L zG>z?O%Cp8P5T#j1DID7u_*(Jg?7iss8AZQ+&;u_J{FmILf((9eoiL5nGUe>Fgq*U$z0000 zJ3A|*qoWOonz+4ZQ0KNhDB07SX1?#FrNy8%K)_l}y&kh`*KYdy`Y99&tgNgMLSSrc z?B?+B@HO@P-jS~z2Rgc6yy~Y~%>oJpBxsb$5<&nRLqiuR7K=@0SZj~jTs|sv_jWVX zGe?WflejOaq|Vec=s9+ahmXbyJ|T)Sl*?s82sr2H?Ce~HD5WI+Sz&tmWrN()wI2}+ zKqg92t*l^-#ae~;9%KFlWkmwnY=-UK`_|%ICZ#P1gdjK<2n38VXsuC7{WiU!fZFmm zW~Sda9(Qi@pxO}$ARY+;t##Ao27usOqNt7Hwq6K7G1il@xitj=LIM&{N&#SuX;x4x zmG6FhCg-$PI;hQ=;1iZ>F>^~@)IPi;l}fX?SZ!QiO=X<|pSVkNpJuLHzW(FT_~W-v z?vFpkyE>8ee4d=7wKauH5~dd_M7d2Aa=ICC{Nj7Blqv&DQEP#j_VeWV&WXL>c=LLK zsmYg^_JiDb;%U!UxO%qjFAvsDFj-kzT2$GbV(ZopPM$i$z`!7jvEk07BcC=6FMt4` z*0u3Sy`0b~%#(0000K literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f31a278e17993d8d4e13beac2f9d5f7b42d08f GIT binary patch literal 309 zcmV-50m}Y~P)sF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?u_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000zE0Ay_3@1Z_7#f-XWL#E{8Al7>L$ z0Rx7lnddoqAyfT%&#`$;v0@*5YdW3w z7mLNoa=FAshK% zDiy@zakyMAxr-H?iQDZi^!t5;Eno2A=?>mMx`Vg(Z!?<53LHLvfTPa`$mjDcX*Qdv zR;ylN4OH+m)fVX&Z#yZpUae;ss@a$K&})gHovkhr@w#xyPVlfVgXti1_357y%I-UHDvRWYvPEX+#g+j4Q9ayba zh7uQN1j%HQgA=Fp9DfODAU^*3*FCs^6IpO7xg`RUXyP)(;=d!ly=#I^l3e0Cub`{H Z`5PU3+D2e&<<>s`J(VpX#y^kqzQ;#=2x({YMw9Q&ndHT&`BD$#%Ql?{+)-OuSA`r}MWJ zVg+2Gc(GW}a=BERPNy^;kEz$|38dTYlFQ{%5S!g@|8f8D_!Nu9_Ni2glF1}xG8xi! zorc39&F6EPOeWOt_XS`W2H_Bo$MXugy}SEctJQj=(TLXTHL(jRXfzs>NF=0SHk;94 zF!&HjdZNX(3U3;LY64IMX__Xv%_wjLC!J2`0Jw?X=zPK$C$`&dYPDKaC={e16bcE@ zgun^<0k;ak*=xLE)@(Lqu~MmsFoMCLY&0Qog`NO(h@kyxaA%EbwJLy8sU*Vi`~52K zX0wrqW;_LmMq@evX4iAM9Od(Q0eHP$1%L|xAh@vrqB`HPQLon}f3aAka=9!3hr=O- z5F9`#J_7Jhah=U(4RjaRhkS4Xkk98kDz-`i!r|~~AQ1TFcDw(@<8g{aBE)l)PNxNE zI(RPyc>9e{@WGSMU%i7*v{!&P$WLz25)0oc=Dl-yy%xYZAm4b-rttL7UjR#%`#j_F R;_m(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000)l$0ECbfb-0$}>7z|u>IvuoHEmW&j4lzv=KA+EpIObc7e7{sGA)QVmnM@*^ z%|h38^m;wC+ilpk%>l#V5LCqP_y2_Cayd^XlX;j*r54R*lW!zbqtSpQNyz8(JVmWm zyV4S$2{Uhyc{Cb0QQbf{ZGT{Kr zvJi{K_&f+q^Pv4MK$hhS4TgFj_FD*rLOePdE-E^T7ZzTFCRUB`*?9&h(a#C!-v8lWG#k3AOJQaUey6Oasked^kDPe=Khg@7s584 zg`XfS1)&u*_c;I76#%`kkBfiZgKKo@0)9d6vZw=ExQUtV?eW{Y1Xv}=4X(2zy85d> Y0C^(qLv?Ui{{R3007*qoM6N<$f-gW7od5s; literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b93e77600def75c9a144d3d0a5088a62c02cbb0b GIT binary patch literal 618 zcmV-w0+s!VP)$>5Y&axjp2O=VLu>*f>1L;s0)kkvKC!*u?s6CVL=HJ6oP~pNfZc; zsKr=bq;7MITw8NXw{SZm%59TId2x_9BQ zV86`NuvGI!>o^V!Na!=$7GJE{Cq`b+XwknM{UcGHFTTfmuS+ zm-zYC!P3+zmY;SG$?!fYkOih`QYaLxyF}A86h$GGN}kFj)_o*0e zjPMP%zTG7FYMAfO2Nn1D`D0Cj?Wl>5q%@CE10nX)KxpNmwk+!IWkzywiYD( zqUXiYYIq3qcRyMGJ;IY`(Gz~E$J$zu2+R{)xGlE*88b3WK6V*J>}2iPY1HH|tER0W z_+^^FdppY?o)Gt5M2`%xwRDH@R3G}^i1l4|6uchm0X0f!@&YdVLB5K&dd7Rv{)DXX zt^&vP;}kqj3f>94j+4xd93>s|Q!Ezi>?r8(Il$P}PFxSqu{d*!Y%*#cX(R0f|Juz# z3o0_xI14Al->1uky@W-rCI_%l&>PK^TXNSN{byMk2AI5vbwp!K-%-@!-vPR3iikL1L7HA!^!~ChCFU#lnGzp88=I z67V8PHBo4(l$u?-AKmT8?#_0rKW9dUNRbpLc`}piywAM9$xZ-3fR1C75T(BjCn-l* zjUcci2oXXo-}iqun@#)+`W@kL_-U&|2>MxZy~3IdmRm&8b)9!2%ksg3R)nNnT*TJOC=6{2hG86Dz+<^p6qfG5$i^UNUh+u)CD7O2 zK>Ioazn;U|+X0x$=feveYZL1W*Fm%e5P1sajd#eW#^5(ddx76*pt$^)b}$Q4oPabL zLc^HF>Z{8za;f$LtN0P$6C?1{X*jtXkRJ8IEeyiSzencvH3Ux_y>y^}wfJrRCQN#9 z?&e+C>sSAfrE%mZD5RfZ`gSndD)=P?+nG5Oq$zmY&-v+gc7R6c0u8^Ke#|XOq?gF@othF3zFpM8Il<8BJrWqBtF>b#_ye4{0)Xbu6j&@UIhRE002ov JPDHLkV1nWI9dZBw literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png new file mode 100644 index 0000000000000000000000000000000000000000..b977d7e52e2446ea01201c5c7209ac3a05f12c9f GIT binary patch literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png new file mode 100644 index 0000000000000000000000000000000000000000..581843637079359a6a58fcdccf0763690c67b063 GIT binary patch literal 676 zcmV;V0$crwP)_k3`4d{s8lK_6bi^@vq&To98fNoK}7)fx$e2^Y&@<^jR_Ee+8}KG;X`@ z@bCyiolqX>bb1ZIs%QGnjzFU~L8H~d?e;*XP(h(S262}XyZ3a0h07r{KV?E70l+e- zE`%3x|M5#q+;HOC(h@A^M)7Rn13dm0&>K$j%k_F4wOWlsNCIH+!c_#{eS&TL8v4yc zcpnPEY`cQzZ$ILq{U-MA6Z6Z|1p!FZjQ}tXSb25J@HphEqX-6Hqo?-_Zn@{d#>2Ml zJGhxTAd&emK$lV-QK&VM&ix0Xy{GyS3Wp(+E1^8BhD3T0a)m-Lw@Lu4zQRrP)9(3F z^>$hh@N>OAXrmPYunLi|fJ$_*5i`46;M>~*5D{bp>-OL3{+!MJa`3kv~Q#QfQ%c z)1s}QE<_XaYBG;IuRF=td#+}fi4h(6HgoUyJLi0t(*dA^B)%@8kkG&bdM5P5^Z5WF z%d%>m^SbN0XeV)wbUOXn5Ag#A$gJx+7-OCkMM1S%MWIlTkbFLmOeW(&n&wUd&;`>p zVcRy$Z{K0=?SpNnP^;BYEEXleFbq(UY&LrXX$6qkJ~)8+b{=jj3HEXds;Z(?D%}}L zX3`39&dy=Zyar!ehA}e>w)(*vrCct{PI9^2Jpj&OZS8<3-@{0(gNv%1{)zAiLY+_^ zl}e>Ofd4&#Irj#7>=o=Uhv5IJ@?sN0^J|(WL2Uun$4}si6}TG-s3T#p&6GE<<2W)O zf{^Y2HlO#*QDvTp3v&d@;8*}aUC4lisG9(w7@d5Y8y)}U#FwCkqp*Mcgme4{&gGRf zlBfd`nF9cQBKB2_L{F8G2)7pAf$i)Ds`|}-c>pc^LRW{w4SQ)3N^BbZx)6BlCZts! zKph%`(m#xg-q3I7=(us;9<)*2%iuQ1J`oV3gU6V~T}^JU5714JN33&GwEEru0d}Uo U{MPL+lmGw#07*qoM6N<$f^vibe*gdg literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png new file mode 100644 index 0000000000000000000000000000000000000000..8d719df5205f7415ce657e5c277db4533c82f346 GIT binary patch literal 639 zcmV-_0)YLAP)p{{sC7)XB-g4w*W1a1)XtvxrMYa1o?wn&v~3 zHnC|#(>B_M1d`_7gfzLiHy=0c<2kQQdXu*33(xYN_xYW39(cz9jEVT%VokB8|DoF~ z8u%Q5sdl@4VB7X#uh+v_;yOGY&pRi?378ghv)P1cngiAAb<}D#l*?rWDV0j_dc6Zk z-|P~AJZQCA=yWcQjG8fYnimzj*3KqTfN0Cy!G^$7)+bQ$+mHVd1J zvwOR^5Lm<|R+uyB1Nu4vL?d4qa3tn?9H7SZH@~u=fFHEDfSH|bHU6kh0O3%cLdyny z{`9S2Sw~WMy0MPy!64i`jdk4Z3>^+KIL_fN2V_d&ywBt`^IJpxUI$=YAph~5`;xCe Z{s%Y0vkUXDnO6V+002ovPDHLkV1loX8z=w( literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png new file mode 100644 index 0000000000000000000000000000000000000000..106f5aa3611a4807ec8c21701c631730275089a4 GIT binary patch literal 402 zcmV;D0d4+?P)<@FR}JvtGRKa0_WfK^c7uXaFH3q@Y!Hnl8VySc`OtkPN3;#l*y*l23+99h*9JzA00}rAC!#M1dZ#v9YOBH|eC*${MmzzYjBu!!-< zK8tujf&(6i)1biy*F>4{f*Kd(IU-JsG&#b_@NgTnx@40)2@2%c;*=?-2Za=}O}7&( w%_K#(S>e1j&gfY?mR})n>>0+8p`iTe2d1K2h8#$+)&Kwi07*qoM6N<$f(2cptN;K2 literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png new file mode 100644 index 0000000000000000000000000000000000000000..e4a1ecba1b60e54f3777717ed105cdde745b7184 GIT binary patch literal 516 zcmV+f0{i`mP)o)wchR-92qq~y6`XqbKmElbB3z{pkZs0VPF`CFvS?7jDn^mFo>d9Y&06* z&1MsS!M-CH3ee+h_sy)Ms%B*ec3R0RpVi9?*mU84yoq(Bw8 z<4(999dJJE!V%pWT~HGRIAb;(#O%2K3?uRpz}AfgE8e9q&OSdr^e^}lC$QXZz;S2A z)w>^oHy>?v)q--`!pmuBe96PxP0u*inQvyFW(llfv9 zXV1s*Jh`y2H%B3ZTA(AzpsQ?hb6_PyZ=c1?_B4fbl>G%!@ubJln=!)x0000#DY{xaiib^#X=YT4@yE_&2#eBulEdzjE`u&@G%2(&u{J-<}d(^uY4W_kMfEX z@!X)AR9F&FL?RJyJRUzvBoeqN{5kY`z3wcM0+du73~_0|*lac! z42Dw(Eg1o{Ash}P8jXrqN+1w`*XxDD;ShmPCZC7#4;wWbHoMvBl$=zF-`?*9j*Nbjd=v@OWt_BgKxP-3wd zy37?ATx&$b+&zRM!K;BD%Okw`Sb@&Pak8$KRX19jWZmC0&n*Ggv%j8nvSPDFw zEkV65AGOoBQ8kf`R|}Px*&INNS%osq9b{Fq2I(x6@xM>tg=vRLF?I`0rWzHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e-C#5QQ<|d}62BjvZR2H60wE-&H<>}%WqH(_V;zPbB1rgSSSC(0? zWlQ#?N3UgnJ9m2C29w!SwoOo5_2Iq!<8vCyEoDoj@#oV($oJEg6Bj@;nD|2g8 s%L|>IZ381yx9RvPhV4J)*SeoEV4lyr#k*`nfWBbxboFyt=akR{0DpOPi2wiq literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png new file mode 100644 index 0000000000000000000000000000000000000000..d61648452284da1bc28b10385f95b5d2bf027901 GIT binary patch literal 616 zcmV-u0+;=XP)-tZUVHjYHp;RjQ0M0pRlXN=mLv{hk9Ebp9&~+Wj-T9IkpzWPWd#fZ)d=zV^~S`;LE*!&u-?g42^wwN&Xr1~#d5ifl_2*B1OoS}CDno^8a50ArfE8;stQF>AP54J@H~%T zFz84s;dO!QJKD36(~!QOg!t_^gfFcSKDU4yK0+Ypg$NT^mIYcQ6bk*3P(lBLh7Df_ zTu=2xC#+-_%)|{Cv8zz0t|0y4D5M`xAc{gwOKc`ou<*&VjUREFHs1qd<_xSkKeTBt zgyCi=@jj;&Ns^GsWWaIUl0Y2azcDlF@u{(P*!+EH;lnU~b|Lv{4|4Hdkh!qoQHiE$ zY#y>KFA0QEw=4Z|uV{0A^`Y=D}hB$GP&<$bi8q(u;p^0(my3Rz7fP}|# zGZ&#uor4@c3q9r|f?H6-UZmfgKx(iV(MQ`MPWB>iC~SxnN5H*zb*A3#zWwgu&c|}3 zn^g87H{pdeasl%Lhmab&jC?lES}7C?4BFDNA<}20hoY@w_IU%i*T;}}wh!589}7~7 z#Ug`-R~4j&+K_y4kW@X7qLr-)S5qVKU)tO;+kXJ++{vPI@{hVK|PhMVVx_`)vx~zUs}c9O-Ok{00000NkvXXu0mjf DS5_-g literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png new file mode 100644 index 0000000000000000000000000000000000000000..bf7bd1c9bfd78d689c73ba67cf914182933ee68c GIT binary patch literal 614 zcmV-s0-61ZP)OOAS;jTeL{ZSdz-%)SMH9tDF;N4B6%j=d15J&5qy`F#vB?Ar zqS1nH@%ny_XSI*Y>) z1f5QYdmzT>YciP<3WehS<{GovEaLGv27>{*-7f0&I$yJ^L%ZGPv1YT$V|u;*+ZCWz ztHI~CDVsuy($SfR6-`N~K?9GTB#l%%0h7 z-q`K-y~E)+s8lMyTrPL8^_pUo)9G|SluG5pPqw6!LJB_PzyJUM07*qoM6N<$f^=yZ AYybcN literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b74cc40f82fc83e4dfa6e9647ccc1b34e6ed7e GIT binary patch literal 554 zcmV+_0@eMAP)Vb2f>2}Fa82O3m(Ob=t*sniin`NpInLyMJgI`saru@YOPfh zy4g0#G*cV!#N%;Gq9_VH9?v%kjS3Rb1j8^;C={$Gp=lbj z*(?%?geA!5^Pok%UauwjA)v4g2`HedDw4_Mk4hhBQt?e7YJ5(hcj|3dNu^TOPGnjB zTTsqd3GIZ=Bb`n=7no)dflv&K(lsWw?lH6T1Yht0F9qgIuzh}ym0%n<3d3EBWB*pg z+G!I0lbAEXyd>k|QNuwr4=KX1D+tLPv)j@C1=N4sA4NF9A>HcO3G47*Y6!+SrUH-7 z1hb;^#S=r|`aMh>J#dWruAEf}gcR(DRUC`ZUev&$Sbh0SgLiTXeeHEU<$_YV;9281 zym`igIE%Sm8DpDw7@71Tv^EB5xSdUR*0$Mqp+Wq8OoaZtOg52&)zZ;;M=7#C1Yd6x svjx>8ad4e2x|*xHHwRjcjs6zA0XLDUqKT6dS^xk507*qoM6N<$f*wetruo^Ag2=LamM1T#~4RmC^m`_ zs}H7d&XJ}mg+hU?tu0noRvyjI&o2SRAeYZFesYkts79I^jJ7!A7%6nJwq8O?iT55M z1OQ` zbL{!Cp5o*IRmE9PInMCSPjTwfT~J+EYkz}tjxY=fg5Yf6EQ@DG$0kMJ9h^&$W}9BU zP1oj2;?MWVkKIEl)r=Y;L^Cx2q|>!)qJJ8zE7-V*-Cf7V8_2#1c0N975t~+&QUpQJ z5(uo(-O_`%Rj@U@t>JYAgd!>L?0Idxtd#oW2gc!jinsAEva8|kF4#Ic**mmml_{d^$s}Q5Q)KCys4sfck5bP1SyeHwh2`A<@N&t2j0^lgHC_^(pAAPCNjwl+>AN%C4Ll>_8Hjda%9 oS~i=#*e)>KsPlg0=2)Qg6BCqJ=F8HdGXMYp07*qoM6N<$f@i)wr~m)} literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png new file mode 100644 index 0000000000000000000000000000000000000000..a65bcb3e1e9613cd9e4950850db43d7025a5fdf9 GIT binary patch literal 779 zcmV+m1N8ifP)JNR5;6x zll@CmQ5eTZ^k*a#RQf}fVOdd`5NJh6S(>6Cf$wEW#f&JyAR#GAn9>Gml;nOf3WCDa z5({5&UB$(IF?G#$x4X@Ickg!Y-HU!Z_rzX=qAq-XI_LS^=lOCT0|0{#{kBkYDS7{3 zD`iu%E=`cDX_^#^#n$5SIQ|4Zhsk8>N|zXHXG@*41$i-7`Jr{8`3S_OEcmY|RF48wXkk?WpdVM4OePBSbfh z#4_=eXJg@3epx~gi>QbUmO}Bm(ENN3+@c?jWiKvSrm(o|W}Ud*?vy~fn1!V~Cl4kB zI-;c!8f~-v)jX82%EG($>?;KSD$64f2&4qQ#=Yyrcpy$57RAVuV#vKMP)0hT$r6m# zc^F^XaJ8R9Q|}x^NoJYIvYZkq-z}Tnj@UJK2l2H zG}p+VvtjP2Z%bsb$~7QLJ9#pC0dKi`ppOd^_V;ME6tdzC0PtV|r=@e@37O`%0k^=5^`%cf$eu00N17Ro!{^30krz>a%3j34C?*{Mt2^a4~ zK=P+Qq%|f;Tc&+9ps;@Mw`EE%rgs&#y=j6BUGg96oIqdwj9-fiy*N(|@o)eD002ov JPDHLkV1j#pUPb@_ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png new file mode 100644 index 0000000000000000000000000000000000000000..23a37b891c2f5faa3b8128d45373ceab794ca609 GIT binary patch literal 688 zcmV;h0#E&kP)PK^TXt2QS_@2qt2T|9~baC-vaPn=ziepcfAwB$0!O2Q)E}1e8!q+9)KT5JVKU z7HNY}h##OS-BxWHWjD0wrPDeEfUClHs%Q6&2u@FTOJkKMQN|_Rlw6rQz$gPzqGNtj z#ruSeFeh835JJFiM6vp@6M5bXj%k7CMt%SIwfbF_fD-3*Os`9Ly_Q3WQ_SX33E{pX z9_WIeeTCGQ3wYALpBcK+P-iuw;3i&7xCua37k5# z`>c`M@sGeC7cdsdz`aE9lOz!hPholbyz%T85LYf6O*@SA+9&+^7k>+4M8$A8iNQq{ zQvn8k?-+dU`Z@gK0z$EtPV#+`^OH`R@cE-cuE&_!D)SZGxmQxeobP_Zwq zMEgi6ePN45N`|V1so0uE8^}1xw8s;VM%Ai@7} z2-&Cyvez_-O4?6uv{zTaj|YeYEk34i~K@`8YW2g{x* zc;7z3lItpVy_et{Z-ZZ)<@*%{l7Ao8mu@V7*gz<_1##mwW*%LEwCdzNsVLYx2*T-J z#HeQ*_a=R~KDdVNk$EVgAIRl$oQi_(`_IrdJciDpH|Xe{K-YsMtc!cRnFi$qzsr4z z5*$;ecov%3->1{YNy6-Gf(Ecy&_I$CjI#laeuE+S120^|Vjsf)W&i*H07*qoM6N<$ Ef)^4A_ab^avY?n0hpS-#mn_4{O$e%cm-@NH=3`90Wq+3`~HKArSdfX`&Z12 z(CY$VW-MNtXX4xy%yUeE?}*~0-|iByA@ZrwXgph4S*bhcc5{HB!DFVm_v}P*g7+Q~K}7K0lcp(^N@X>U zV`{ZpeIf${R6Hgg4FL^`X$Eu75k(PE6ycl$AW0Ic)#@rR7Z(7;V?i-dR1K935Jgcx zPfkwK>2wGokf!Nih^ARp6-6arYFG#(9Ta!x93nFEjoA==z(g?#sDg?Owk?Mg7K+>l zWYsf(<`#+$h9Sp6gFOg_dd+80SkUpk&xM7h0`Sov9W73spU;GP073|VfZ&Gd$J$*0<~TV5aPS|qWH57|VJz+d0000vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..134b6693687b2fa5fe36d48a9c0b8001f937c741 GIT binary patch literal 650 zcmV;50(Jd~P)VHAd+bMNh~)LLRqN>D)-jd9UvB%+hyKX5U|&4t0)fzgD-MPpQ$nHU%yoz=vI zMGb>1Xu!6Hw$NT~@Au<4P-+{9;Uw?&oj31uzH>xX0T7Xkz!(tn|Ed9-s_FqyReC13 z(ll)vW1O{Ck5ihay12Ob2ABc@RUI;zHpaMiyRDs0r>|D4rHw{ItJSJnYjt~jTbGuW z`X(~}?!&86q40R8<4zYw;$qi0^3ec=c&<&H;r`8W%H=Xymf^i;Wo6~<+}zx2UMzpC z*6MZN?(FMv`n|KO3(KFiUaucP0;Z!@LcUNa%8#vGK5aZ>wDgB0Gi=t*argWJcdlMQ z2#MpEX0wU+9&0U?N(F#OgpviU_Y{jYMsj65U3|PjwUOY}lUYj?MTiK_Il}NCVx-Eh zDx-TzMk7se+M#W_>?A1-x}ZXw3kkyz5kW)_hkjsi@RhKadN#H$Hq)$07*qoM6N<$f}lhwPXGV_ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..c4eff0387d5888c638ba09473ba6d2369f7b56f0 GIT binary patch literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000JNR5;6( zlS@kiVHAe7MZY2;Xi-5)WxDDgv@tCUl*&p14T@Z~3ThM5LP4tuQfLu@EnG;nXc<8S z6&3BN?fx-cv-Kp6>HRiNTHE>$X( zD&=w+?GWC>?RLAGC6Yix;an~UmSt)tSf}1VS6N1N2ONORdD? zaj}w6DAZZdOud9Ep?M?{iQWbE5^9HLLZZF|1kdy0Tu4InEuboP9@nvbZ-P0n4AZTy zyMRIxRDmUE#LdqYuD=-Qz4N^bC`_#S7vcLn1M}{J(Wl3#c4VWczu&)AjUlh(11>gp>f`wv{KnjF%!aA*Jk N002ovPDHLkV1kkt*XsZP literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..f59b7c4365fa1720af1aa04eb47167ddaa6eeed4 GIT binary patch literal 626 zcmV-&0*(ENP)ZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png new file mode 100644 index 0000000000000000000000000000000000000000..44084add79b9a0fc3354d16bbd4b4b5ff8095da7 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R@9E+gqH(@-qA%AW0|7U8+xDRI z0k`B18}ImRw2g{jTGP$Pmx3yI6F_2s&$|`cJ!i0UN zB3H;=r{#{FwLaNVJ&hZl9+MTHGx1T^-A=Q0?hRb#8a~x50X%;`b6ik3cw=#XdxWy= zgrpBoDjpwP&g9<9h3x!k_B!?vuTJVkmIJ-U N;OXk;vd$@?2>|rNdMN+^ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png new file mode 100644 index 0000000000000000000000000000000000000000..3a1441c9a12062a4bb3d706000d3ca14399aebca GIT binary patch literal 565 zcmV-50?Pe~P)SCZIX8XZzY2l?gCw6LlgWJ5Avz#QX4|&mI8LN)w~J1vgL=KLAhlWz*=#m~gyvxa z&;iC6gb?aZvMdXxX`<0+D1hs_pqJ!wxqlEH;CJ)je~uL(gpi@v>!I0f_Kl=E(E+Tq z26na*9gribxx-Oft(HnstyXUUy!39&E-cI%J5Rsy;(PGZH{g{ty!HVC&yGPT3H8x# zw{^gBPW)O0FMoh{k%l<`1a|To_Wl&u&-GXm8izU|&<&utILc4wc6s@u1bmTz6x{qg zTw@7=FQRcg&r`h+gcR$*Jbv+*DPk7v)B@e0o2 z6IlBXW&8xh@9)YKiV~2>+z&XKd24JT55YWz&JtfvCg4r^~bLP79-yS@n$OW00000NkvXXu0mjf DStt2z literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png new file mode 100644 index 0000000000000000000000000000000000000000..e7708292adabf4821612bfca032cbd019c63180b GIT binary patch literal 634 zcmV-=0)_pFP)KrcWDBzIw9XCtIF5G<@j zP(;CSqHxUrerI>~wKyloM4~t_Ofl@UFEj6$Bmm6p1aK6H{5zI_FOn(%k{CiRq?CT< zoV}Ey-7=-5nVFes;1m!f?EqZLIs4k$n%39XN4dPbtX{9DZnvvaiWV0aH9I>yf;2<< zHmo7WNC<&iE4ji-iKJpsBApDKiAiqWy8R$FV|M@E-RCB03vjWNGQZJxKCc-cSB=dq z#v3snoDMC=4<2BDgiZrv0Veh~mz(X=S@;fbe>CJO_5|oe2o3=wgfW(StLzI-qr&kc zhXEJ?9=`nWXzrUKL_p*Kr9u@95MU9EKqp2vi+%&1&gUn&>Ut_d3>wiyiAJg5G7j%G z#$sf%Kqau!AAHP&4Q?edl!FWqpT=C{D}$15WC#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R>*?YcqH(@;f-l!01CbW>s1Izr z3LkoHh<3E?TVANoG4CX|$empRCCS=R(U(hVJfm~E?IkDKRK&NP2|n`v>d(vV;W1uY zrFGVdwn;4b{qUtE`?GB`)E1ga&i2|7ncUL1b!KMq^QnT#_gn?_Z8(c`1Q~Vy3oL!N z$M8vHL&U1J3SJF!56azQU3B6>r|ZQ{U6)pC|tRy7$(5JQ<@7eB8yk=XcNf-aBIe#;8c_B$^=N z{-Iq&o3%O}V4~G($=zcP(LI|+6dq{?rby~MXwJQ*=!bOvl%?k zYY;jP^@M_k03MHL+-9?_3W5MN=moFW3xmPHU=-4Bw;62MrIhg_lwHEsv)V9U4x>+9cG2kIz8fWo`WyMMfz zdg-)p!<(hFR{VYSDJHEJn09O@#)%q0l?GUg9eS2~vKPUtd+=ak5lWLd-jI=;cjEf# zt$1;~?G!t@s+VLwL=P+Ks;E z!Jkh#NeohG;&02OFD7^EY zP!_PL2~i9VnPEW6Fz?O3dVF_U$duAL$=SU7&hNc@-drC5A4z=IgjR%B|D)?dOEaGb zuwod-$hPex$8oSoqK;@Z8u3EBfK@V2CKKqo?yA%2pjNA)(P%)HWf#)x^$?52W{|1b zPXOA$IfrSQV2q(qC_vLR)a!L9isAxjoeoJRlgE&G0Ga8krBVsGjZJJ-x6y1i(eL-q zwB%+o53no?l}ZJh#drAjlc6nhs3RTn;1IH+x;K#|X)!=#fM76)$IqT4^N}IF%aQ#o zTKS@*)|#L#jiCPi9~);c`x>TR|0{+9a?O5Exg#~V5W2C7G9nAAN(~f z2caqx&t~GhnK;qW3~&OuEke?%u(8Jxs_+ZVVz1^-uLrP95TahadGG$+(D&+%2QMF8 eFxE8s%l`oWamgLPAe&$S0000dKE@duOisOkyZ-5 zuwDqkAi_*y5o3Xrq7ieT<<3p#-R^dGySwea-CgZZZITBc?#1u+FtBuUCJUZe;~j-%Tu@ZpYB;$&ydfdZG#(j;(iB#^yRlqv#C*LO zXWXM0cpKKBlj#L6awm|;A38Zs3mg;sQZmCAZT8m@X{AlP6 zVI=SsiA16x=>2%^XV3U0y4~G+MNE!B{!#;~%L2l(14PX>EblXb{rnCSlVKe0dyf-O zuY#uOf}m&2xq80;4d3i|cuNw}U@sg3VKRU)>Os_1L3pl5mK*|?X3#a}K+EVZt&w?w zefXKP^ZqnW-3y9AhYJZ~r4m*!Z3OSz3d}2Q`nDM_f_u>L%8Cb}8`?bl)x?gwAy>zp z06y57kT6sry1g2l{|V%UW?)JwnbzUugbvpOF3=oZDo}spfs2EWKOH{_^59;ue!o^A z@e7dWS|QI`Ff-E$USJ`LqDF}zH%R}YOlMiv63A=qK^d}n!5_(fW%^k4U_D`_meIDi kNMKea>saR;>gt<+0gk_zsk5>Xc>n+a07*qoM6N<$f>Jg*?*IS* literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb880947ddf3e745c29e8d9dc90f09c7e6e323c GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8ecbf47672a874c0958d0d113a56162c2bd364 GIT binary patch literal 651 zcmV;60(AX}P)hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed2490ed1432d5d667a76235360824a1088e928 GIT binary patch literal 734 zcmV<40wMj0P)JT{hN;C#tgf#9krG=I>5!<*aE1_(spcgF}<`n4i zJi-}^6UUeU4jUFwdCiVPDm%`Zx^UBa8J(mnR6wEgz^}o8;)M*Y(@l_!Kfv)}4+NuM zaPXE50z)r)9=D=SR|RIqfQ^j}Hu!fzMeQBo+@PZk1G8hOw|vBTvkx`HM)Xe9q3xao z@`p0`NO!2904FHSLA6E@Y-O6zH$DQzvq@aHsz}}<(!v(Z_+EodX%R&NZW75g+nENo zV0020rxE^;7d!067AN>6*+&YLp$9uH6F-=In`XC{Cn%+o|5)b&boEPr02w@|P*oGm QmjD0&07*qoM6N<$g78X0Q~&?~ literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..fecadd08afed92536be91ab12d8e37b6bf410d5d GIT binary patch literal 613 zcmV-r0-F7aP)wK%m(L+9IV|s|#(WRl-O^4GvaQsnHq|OstfO zIJ3}3<01}YGARE4m!7=)QisvlHUo!Qymx-@-t*p_129Ko-#pVI)6#!*kLj-AGXWNR zyA_{wKii_amK7^YT-v z6#plaNm#8`-kz@OvjIt^4%IN{@J3bR zRI}ME1Mv85p|%;RK>ViR>APPLB4;;BpCtqE@P+*7!G>I4UjNx~e>r3HA^tWCQ@S)l z{BslcSwL-CxQ&_ZZSv_g0Tu{yi*X){Mt|W7)lbE`SQxFP00000NkvXXu0mjf;)M*S literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4bbccdf1643f4ff5022fbc59b82546e259317e GIT binary patch literal 386 zcmV-|0e$|7P)_QM!1S$Bhw4w+iRuFWf;tfR6D%SMJrb+tx zC9R6{2>Ou6#juIy6u(I?|;&Owi$sRB4^20apB5xE2 z#B9XekY66S6lzfCL!eEQRgo0LokTA55@Y#%_wN!TXPw^Q4IIXsG~v#u_4t;x_HM16EQ@QRY+rut&97&UefsPmLrQ5P zBC2kcbux9L%2bJz$P$XV$*zSxb2e@6_3O#;&!FD<&hLjGn%~%en;7)djE^d6!t$lW7GyIOKlQ46hr`Z zjLNuRDP_53dNoN?wd&HMgL^m1DXFU<5dQsrceN>fSz00000)O9XRTN^$%%`*Fg>ryDtc(lF@?b>dE!20r+y z#Q*>(wbV5H`-E4Do={CJp7=ERhw15hgZi)?jRG88 zzVz(5;g?Td1izJyO33bhjg2Qc7FVY@f9!o)Gu?DII~vm-Dc?}3M!fsgjP?F(7`rgg z+xOk8XD)e?Zl=5+un`5!7kr?F=eq)K-5uqr%yU$1hLv){Vlm=)*5~`lwMciiXFu*g z)*Jkz6AF>#zb(Vx`Iv{bdGZHtlW)v(y5k^|xgSUc9%0}S20nrYrO}78ofk?bV!5)4 z=Ngz@+$9N1>>mA%IWx`Fqa240bWkiW;2TZgd8CZS0U}@mknC;!2;wi$eI@`h0y2JS`Eae0CW}q(2(%!m8 zWq$`PDU>LT1_y*bBv#P5<@q0@ttz$hIH}YMDvAigCc=y*)jY-VOpTd;A8@3t7Xh4r z0KTWOk;N2Ox4!&&^4B*no$WtTX!BXB)rg!y8dvGgKBQKLJNXRRp0}Bsjd1|LNQX~c zbC~fjrk2iL@4dYF*vt;}dFn(%h)n_-vzEIHMOKRkdF%3Lq|zBgKm_h>TEq!))nWjq zzn;B!?!(dQcHu$#=JF`cS&W~C`WHFW^B!~MI#k)>1Vk&eQy8P1O`J6V04{D@|7d6^ zyBABnh-d^H0FX&L07M||E0n_dp4v&Q%PSE9p#R#Hq)`5I_(B5CE#q dxjPz0{s-<+c#AC!i7@~G002ovPDHLkV1iPlpuqqD literal 0 HcmV?d00001 diff --git a/node_modules/express/node_modules/connect/lib/public/style.css b/node_modules/express/node_modules/connect/lib/public/style.css new file mode 100644 index 0000000..32b6507 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/public/style.css @@ -0,0 +1,141 @@ +body { + margin: 0; + padding: 80px 100px; + font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; + background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); + background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); + background-repeat: no-repeat; + color: #555; + -webkit-font-smoothing: antialiased; +} +h1, h2, h3 { + margin: 0; + font-size: 22px; + color: #343434; +} +h1 em, h2 em { + padding: 0 5px; + font-weight: normal; +} +h1 { + font-size: 60px; +} +h2 { + margin-top: 10px; +} +h3 { + margin: 5px 0 10px 0; + padding-bottom: 5px; + border-bottom: 1px solid #eee; + font-size: 18px; +} +ul { + margin: 0; + padding: 0; +} +ul li { + margin: 5px 0; + padding: 3px 8px; + list-style: none; +} +ul li:hover { + cursor: pointer; + color: #2e2e2e; +} +ul li .path { + padding-left: 5px; + font-weight: bold; +} +ul li .line { + padding-right: 5px; + font-style: italic; +} +ul li:first-child .path { + padding-left: 0; +} +p { + line-height: 1.5; +} +a { + color: #555; + text-decoration: none; +} +a:hover { + color: #303030; +} +#stacktrace { + margin-top: 15px; +} +.directory h1 { + margin-bottom: 15px; + font-size: 18px; +} +ul#files { + width: 100%; + height: 500px; +} +ul#files li { + padding: 0; +} +ul#files li img { + position: absolute; + top: 5px; + left: 5px; +} +ul#files li a { + position: relative; + display: block; + margin: 1px; + width: 30%; + height: 25px; + line-height: 25px; + text-indent: 8px; + float: left; + border: 1px solid transparent; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + overflow: hidden; + text-overflow: ellipsis; +} +ul#files li a.icon { + text-indent: 25px; +} +ul#files li a:focus, +ul#files li a:hover { + outline: none; + background: rgba(255,255,255,0.65); + border: 1px solid #ececec; +} +ul#files li a.highlight { + -webkit-transition: background .4s ease-in-out; + background: #ffff4f; + border-color: #E9DC51; +} +#search { + display: block; + position: fixed; + top: 20px; + right: 20px; + width: 90px; + -webkit-transition: width ease 0.2s, opacity ease 0.4s; + -moz-transition: width ease 0.2s, opacity ease 0.4s; + -webkit-border-radius: 32px; + -moz-border-radius: 32px; + -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); + -webkit-font-smoothing: antialiased; + text-align: left; + font: 13px "Helvetica Neue", Arial, sans-serif; + padding: 4px 10px; + border: none; + background: transparent; + margin-bottom: 0; + outline: none; + opacity: 0.7; + color: #888; +} +#search:focus { + width: 120px; + opacity: 1.0; +} diff --git a/node_modules/express/node_modules/connect/lib/utils.js b/node_modules/express/node_modules/connect/lib/utils.js new file mode 100644 index 0000000..47b30e0 --- /dev/null +++ b/node_modules/express/node_modules/connect/lib/utils.js @@ -0,0 +1,370 @@ + +/*! + * Connect - utils + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var http = require('http') + , crypto = require('crypto') + , parse = require('url').parse + , signature = require('cookie-signature'); + +/** + * Return `true` if the request has a body, otherwise return `false`. + * + * @param {IncomingMessage} req + * @return {Boolean} + * @api private + */ + +exports.hasBody = function(req) { + return 'transfer-encoding' in req.headers || 'content-length' in req.headers; +}; + +/** + * Extract the mime type from the given request's + * _Content-Type_ header. + * + * @param {IncomingMessage} req + * @return {String} + * @api private + */ + +exports.mime = function(req) { + var str = req.headers['content-type'] || ''; + return str.split(';')[0]; +}; + +/** + * Return md5 hash of the given string and optional encoding, + * defaulting to hex. + * + * utils.md5('wahoo'); + * // => "e493298061761236c96b02ea6aa8a2ad" + * + * @param {String} str + * @param {String} encoding + * @return {String} + * @api private + */ + +exports.md5 = function(str, encoding){ + return crypto + .createHash('md5') + .update(str) + .digest(encoding || 'hex'); +}; + +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * utils.merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api private + */ + +exports.merge = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; + +/** + * 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, '"'); +}; + + +/** + * Return a unique identifier with the given `len`. + * + * utils.uid(10); + * // => "FDaS435D2z" + * + * @param {Number} len + * @return {String} + * @api private + */ + +exports.uid = function(len) { + return crypto.randomBytes(Math.ceil(len * 3 / 4)) + .toString('base64') + .slice(0, len); +}; + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature') + 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){ + console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature') + var str = val.slice(0, val.lastIndexOf('.')); + return exports.sign(str, secret) == val + ? str + : false; +}; + +/** + * Parse signed cookies, returning an object + * containing the decoded key/value pairs, + * while removing the signed key from `obj`. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.parseSignedCookies = function(obj, secret){ + var ret = {}; + Object.keys(obj).forEach(function(key){ + var val = obj[key]; + if (0 == val.indexOf('s:')) { + val = signature.unsign(val.slice(2), secret); + if (val) { + ret[key] = val; + delete obj[key]; + } + } + }); + return ret; +}; + +/** + * Parse a signed cookie string, return the decoded value + * + * @param {String} str signed cookie string + * @param {String} secret + * @return {String} decoded value + * @api private + */ + +exports.parseSignedCookie = function(str, secret){ + return 0 == str.indexOf('s:') + ? signature.unsign(str.slice(2), secret) + : str; +}; + +/** + * Parse JSON cookies. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.parseJSONCookies = function(obj){ + Object.keys(obj).forEach(function(key){ + var val = obj[key]; + var res = exports.parseJSONCookie(val); + if (res) obj[key] = res; + }); + return obj; +}; + +/** + * Parse JSON cookie string + * + * @param {String} str + * @return {Object} Parsed object or null if not json cookie + * @api private + */ + +exports.parseJSONCookie = function(str) { + if (0 == str.indexOf('j:')) { + try { + return JSON.parse(str.slice(2)); + } catch (err) { + // no op + } + } +}; + +/** + * Pause `data` and `end` events on the given `obj`. + * Middleware performing async tasks _should_ utilize + * this utility (or similar), to re-emit data once + * the async operation has completed, otherwise these + * events may be lost. + * + * var pause = utils.pause(req); + * fs.readFile(path, function(){ + * next(); + * pause.resume(); + * }); + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +exports.pause = require('pause'); + +/** + * Strip `Content-*` headers from `res`. + * + * @param {ServerResponse} res + * @api private + */ + +exports.removeContentHeaders = function(res){ + Object.keys(res._headers).forEach(function(field){ + if (0 == field.indexOf('content')) { + res.removeHeader(field); + } + }); +}; + +/** + * Check if `req` is a conditional GET request. + * + * @param {IncomingMessage} req + * @return {Boolean} + * @api private + */ + +exports.conditionalGET = function(req) { + return req.headers['if-modified-since'] + || req.headers['if-none-match']; +}; + +/** + * Respond with 401 "Unauthorized". + * + * @param {ServerResponse} res + * @param {String} realm + * @api private + */ + +exports.unauthorized = function(res, realm) { + res.statusCode = 401; + res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"'); + res.end('Unauthorized'); +}; + +/** + * Respond with 304 "Not Modified". + * + * @param {ServerResponse} res + * @param {Object} headers + * @api private + */ + +exports.notModified = function(res) { + exports.removeContentHeaders(res); + res.statusCode = 304; + res.end(); +}; + +/** + * 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) + '"'; +}; + +/** + * Parse the given Cache-Control `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + +exports.parseCacheControl = function(str){ + var directives = str.split(',') + , obj = {}; + + for(var i = 0, len = directives.length; i < len; i++) { + var parts = directives[i].split('=') + , key = parts.shift().trim() + , val = parseInt(parts.shift(), 10); + + obj[key] = isNaN(val) ? true : val; + } + + return obj; +}; + +/** + * Parse the `req` url with memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @api private + */ + +exports.parseUrl = function(req){ + var parsed = req._parsedUrl; + if (parsed && parsed.href == req.url) { + return parsed; + } else { + return req._parsedUrl = parse(req.url); + } +}; + +/** + * Parse byte `size` string. + * + * @param {String} size + * @return {Number} + * @api private + */ + +exports.parseBytes = require('bytes'); diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/node_modules/express/node_modules/connect/node_modules/bytes/History.md new file mode 100644 index 0000000..db1f759 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/History.md @@ -0,0 +1,5 @@ + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile new file mode 100644 index 0000000..8e8640f --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/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/connect/node_modules/bytes/Readme.md b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md new file mode 100644 index 0000000..9325d5b --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md @@ -0,0 +1,51 @@ +# node-bytes + + Byte string parser / formatter. + +## Example: + +```js +bytes('1kb') +// => 1024 + +bytes('2mb') +// => 2097152 + +bytes('1gb') +// => 1073741824 + +bytes(1073741824) +// => 1gb +``` + +## Installation + +``` +$ npm install bytes +$ component install visionmedia/bytes.js +``` + +## 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. diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/node_modules/express/node_modules/connect/node_modules/bytes/component.json new file mode 100644 index 0000000..76a6057 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/component.json @@ -0,0 +1,7 @@ +{ + "name": "bytes", + "description": "byte size string parser / serializer", + "keywords": ["bytes", "utility"], + "version": "0.1.0", + "scripts": ["index.js"] +} diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/node_modules/express/node_modules/connect/node_modules/bytes/index.js new file mode 100644 index 0000000..3eaafc7 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/index.js @@ -0,0 +1,39 @@ + +/** + * Parse byte `size` string. + * + * @param {String} size + * @return {Number} + * @api public + */ + +module.exports = function(size) { + if ('number' == typeof size) return convert(size); + var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) + , n = parseFloat(parts[1]) + , type = parts[2]; + + var map = { + kb: 1 << 10 + , mb: 1 << 20 + , gb: 1 << 30 + }; + + return map[type] * n; +}; + +/** + * convert bytes into string. + * + * @param {Number} b - bytes to convert + * @return {String}i + * @api public + */ + +function convert (b) { + var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; + if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb'; + if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb'; + if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb'; + return b; +} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/node_modules/express/node_modules/connect/node_modules/bytes/package.json new file mode 100644 index 0000000..5326178 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/bytes/package.json @@ -0,0 +1,17 @@ +{ + "name": "bytes", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "byte size string parser / serializer", + "version": "0.1.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "bytes": "index.js" + } + } +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore new file mode 100644 index 0000000..4fbabb3 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore @@ -0,0 +1,4 @@ +/test/tmp/ +*.upload +*.un~ +*.http diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile new file mode 100644 index 0000000..8945872 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile @@ -0,0 +1,14 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +build: npm test + +npm: + npm install . + +clean: + rm test/tmp/* + +.PHONY: test clean build diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md new file mode 100644 index 0000000..a5ca104 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md @@ -0,0 +1,311 @@ +# Formidable + +[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable) + +## Purpose + +A node.js module for parsing form data, especially file uploads. + +## Current status + +This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading +and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from +a large variety of clients and is considered production-ready. + +## Features + +* Fast (~500mb/sec), non-buffering multipart parser +* Automatically writing file uploads to disk +* Low memory footprint +* Graceful error handling +* Very high test coverage + +## Changelog + +### v1.0.9 + +* Emit progress when content length header parsed (Tim Koschützki) +* Fix Readme syntax due to GitHub changes (goob) +* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) + +### v1.0.8 + +* Strip potentially unsafe characters when using `keepExtensions: true`. +* Switch to utest / urun for testing +* Add travis build + +### v1.0.7 + +* Remove file from package that was causing problems when installing on windows. (#102) +* Fix typos in Readme (Jason Davies). + +### v1.0.6 + +* Do not default to the default to the field name for file uploads where + filename="". + +### v1.0.5 + +* Support filename="" in multipart parts +* Explain unexpected end() errors in parser better + +**Note:** Starting with this version, formidable emits 'file' events for empty +file input fields. Previously those were incorrectly emitted as regular file +input fields with value = "". + +### v1.0.4 + +* Detect a good default tmp directory regardless of platform. (#88) + +### v1.0.3 + +* Fix problems with utf8 characters (#84) / semicolons in filenames (#58) +* Small performance improvements +* New test suite and fixture system + +### v1.0.2 + +* Exclude node\_modules folder from git +* Implement new `'aborted'` event +* Fix files in example folder to work with recent node versions +* Make gently a devDependency + +[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2) + +### v1.0.1 + +* Fix package.json to refer to proper main directory. (#68, Dean Landolt) + +[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1) + +### v1.0.0 + +* Add support for multipart boundaries that are quoted strings. (Jeff Craig) + +This marks the beginning of development on version 2.0 which will include +several architectural improvements. + +[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0) + +### v0.9.11 + +* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki) +* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class + +**Important:** The old property names of the File class will be removed in a +future release. + +[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11) + +### Older releases + +These releases were done before starting to maintain the above Changelog: + +* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10) +* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9) +* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8) +* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7) +* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6) +* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5) +* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4) +* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3) +* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2) +* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) +* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) + +## Installation + +Via [npm](http://github.com/isaacs/npm): + + npm install formidable@latest + +Manually: + + git clone git://github.com/felixge/node-formidable.git formidable + vim my.js + # var formidable = require('./formidable'); + +Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library. + +## Example + +Parse an incoming file upload. + + var formidable = require('formidable'), + http = require('http'), + + util = require('util'); + + http.createServer(function(req, res) { + if (req.url == '/upload' && req.method.toLowerCase() == 'post') { + // parse a file upload + var form = new formidable.IncomingForm(); + form.parse(req, function(err, fields, files) { + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received upload:\n\n'); + res.end(util.inspect({fields: fields, files: files})); + }); + return; + } + + // show a file upload form + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + }).listen(80); + +## API + +### formidable.IncomingForm + +__new formidable.IncomingForm()__ + +Creates a new incoming form. + +__incomingForm.encoding = 'utf-8'__ + +The encoding to use for incoming form fields. + +__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__ + +The directory for placing file uploads in. You can move them later on using +`fs.rename()`. The default directory is picked at module load time depending on +the first existing directory from those listed above. + +__incomingForm.keepExtensions = false__ + +If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`. + +__incomingForm.type__ + +Either 'multipart' or 'urlencoded' depending on the incoming request. + +__incomingForm.maxFieldsSize = 2 * 1024 * 1024__ + +Limits the amount of memory a field (not file) can allocate in bytes. +If this value is exceeded, an `'error'` event is emitted. The default +size is 2MB. + +__incomingForm.hash = false__ + +If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`. + +__incomingForm.bytesReceived__ + +The amount of bytes received for this form so far. + +__incomingForm.bytesExpected__ + +The expected number of bytes in this form. + +__incomingForm.parse(request, [cb])__ + +Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback: + + incomingForm.parse(req, function(err, fields, files) { + // ... + }); + +__incomingForm.onPart(part)__ + +You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing. + + incomingForm.onPart = function(part) { + part.addListener('data', function() { + // ... + }); + } + +If you want to use formidable to only handle certain parts for you, you can do so: + + incomingForm.onPart = function(part) { + if (!part.filename) { + // let formidable handle all non-file parts + incomingForm.handlePart(part); + } + } + +Check the code in this method for further inspiration. + +__Event: 'progress' (bytesReceived, bytesExpected)__ + +Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar. + +__Event: 'field' (name, value)__ + +Emitted whenever a field / value pair has been received. + +__Event: 'fileBegin' (name, file)__ + +Emitted whenever a new file is detected in the upload stream. Use this even if +you want to stream the file to somewhere else while buffering the upload on +the file system. + +__Event: 'file' (name, file)__ + +Emitted whenever a field / file pair has been received. `file` is an instance of `File`. + +__Event: 'error' (err)__ + +Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events. + +__Event: 'aborted'__ + +Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core). + +__Event: 'end' ()__ + +Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. + +### formidable.File + +__file.size = 0__ + +The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet. + +__file.path = null__ + +The path this file is being written to. You can modify this in the `'fileBegin'` event in +case you are unhappy with the way formidable generates a temporary path for your files. + +__file.name = null__ + +The name this file had according to the uploading client. + +__file.type = null__ + +The mime type of this file, according to the uploading client. + +__file.lastModifiedDate = null__ + +A date object (or `null`) containing the time this file was last written to. Mostly +here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/). + +__file.hash = null__ + +If hash calculation was set, you can read the hex digest out of this var. + +## License + +Formidable is licensed under the MIT license. + +## Ports + +* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable + +## Credits + +* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/TODO b/node_modules/express/node_modules/connect/node_modules/formidable/TODO new file mode 100644 index 0000000..e1107f2 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/TODO @@ -0,0 +1,3 @@ +- Better bufferMaxSize handling approach +- Add tests for JSON parser pull request and merge it +- Implement QuerystringParser the same way as MultipartParser diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js new file mode 100644 index 0000000..bff41f1 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js @@ -0,0 +1,70 @@ +require('../test/common'); +var multipartParser = require('../lib/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + parser = new MultipartParser(), + Buffer = require('buffer').Buffer, + boundary = '-----------------------------168072824752491622650073', + mb = 100, + buffer = createMultipartBuffer(boundary, mb * 1024 * 1024), + callbacks = + { partBegin: -1, + partEnd: -1, + headerField: -1, + headerValue: -1, + partData: -1, + end: -1, + }; + + +parser.initWithBoundary(boundary); +parser.onHeaderField = function() { + callbacks.headerField++; +}; + +parser.onHeaderValue = function() { + callbacks.headerValue++; +}; + +parser.onPartBegin = function() { + callbacks.partBegin++; +}; + +parser.onPartData = function() { + callbacks.partData++; +}; + +parser.onPartEnd = function() { + callbacks.partEnd++; +}; + +parser.onEnd = function() { + callbacks.end++; +}; + +var start = +new Date(), + nparsed = parser.write(buffer), + duration = +new Date - start, + mbPerSec = (mb / (duration / 1000)).toFixed(2); + +console.log(mbPerSec+' mb/sec'); + +assert.equal(nparsed, buffer.length); + +function createMultipartBuffer(boundary, size) { + var head = + '--'+boundary+'\r\n' + + 'content-disposition: form-data; name="field1"\r\n' + + '\r\n' + , tail = '\r\n--'+boundary+'--\r\n' + , buffer = new Buffer(size); + + buffer.write(head, 'ascii', 0); + buffer.write(tail, 'ascii', buffer.length - tail.length); + return buffer; +} + +process.on('exit', function() { + for (var k in callbacks) { + assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]); + } +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js new file mode 100644 index 0000000..f6c15a6 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js @@ -0,0 +1,43 @@ +require('../test/common'); +var http = require('http'), + util = require('util'), + formidable = require('formidable'), + server; + +server = http.createServer(function(req, res) { + if (req.url == '/') { + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + } else if (req.url == '/post') { + var form = new formidable.IncomingForm(), + fields = []; + + form + .on('error', function(err) { + res.writeHead(200, {'content-type': 'text/plain'}); + res.end('error:\n\n'+util.inspect(err)); + }) + .on('field', function(field, value) { + console.log(field, value); + fields.push([field, value]); + }) + .on('end', function() { + console.log('-> post done'); + res.writeHead(200, {'content-type': 'text/plain'}); + res.end('received fields:\n\n '+util.inspect(fields)); + }); + form.parse(req); + } else { + res.writeHead(404, {'content-type': 'text/plain'}); + res.end('404'); + } +}); +server.listen(TEST_PORT); + +console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js new file mode 100644 index 0000000..050cdd9 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js @@ -0,0 +1,48 @@ +require('../test/common'); +var http = require('http'), + util = require('util'), + formidable = require('formidable'), + server; + +server = http.createServer(function(req, res) { + if (req.url == '/') { + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + } else if (req.url == '/upload') { + var form = new formidable.IncomingForm(), + files = [], + fields = []; + + form.uploadDir = TEST_TMP; + + form + .on('field', function(field, value) { + console.log(field, value); + fields.push([field, value]); + }) + .on('file', function(field, file) { + console.log(field, file); + files.push([field, file]); + }) + .on('end', function() { + console.log('-> upload done'); + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received fields:\n\n '+util.inspect(fields)); + res.write('\n\n'); + res.end('received files:\n\n '+util.inspect(files)); + }); + form.parse(req); + } else { + res.writeHead(404, {'content-type': 'text/plain'}); + res.end('404'); + } +}); +server.listen(TEST_PORT); + +console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/index.js new file mode 100644 index 0000000..be41032 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/formidable'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js new file mode 100644 index 0000000..dad8d5f --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js @@ -0,0 +1,73 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +var util = require('./util'), + WriteStream = require('fs').WriteStream, + EventEmitter = require('events').EventEmitter, + crypto = require('crypto'); + +function File(properties) { + EventEmitter.call(this); + + this.size = 0; + this.path = null; + this.name = null; + this.type = null; + this.hash = null; + this.lastModifiedDate = null; + + this._writeStream = null; + + for (var key in properties) { + this[key] = properties[key]; + } + + if(typeof this.hash === 'string') { + this.hash = crypto.createHash(properties.hash); + } + + this._backwardsCompatibility(); +} +module.exports = File; +util.inherits(File, EventEmitter); + +// @todo Next release: Show error messages when accessing these +File.prototype._backwardsCompatibility = function() { + var self = this; + this.__defineGetter__('length', function() { + return self.size; + }); + this.__defineGetter__('filename', function() { + return self.name; + }); + this.__defineGetter__('mime', function() { + return self.type; + }); +}; + +File.prototype.open = function() { + this._writeStream = new WriteStream(this.path); +}; + +File.prototype.write = function(buffer, cb) { + var self = this; + this._writeStream.write(buffer, function() { + if(self.hash) { + self.hash.update(buffer); + } + self.lastModifiedDate = new Date(); + self.size += buffer.length; + self.emit('progress', self.size); + cb(); + }); +}; + +File.prototype.end = function(cb) { + var self = this; + this._writeStream.end(function() { + if(self.hash) { + self.hash = self.hash.digest('hex'); + } + self.emit('end'); + cb(); + }); +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js new file mode 100644 index 0000000..060eac2 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js @@ -0,0 +1,384 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +var fs = require('fs'); +var util = require('./util'), + path = require('path'), + File = require('./file'), + MultipartParser = require('./multipart_parser').MultipartParser, + QuerystringParser = require('./querystring_parser').QuerystringParser, + StringDecoder = require('string_decoder').StringDecoder, + EventEmitter = require('events').EventEmitter, + Stream = require('stream').Stream; + +function IncomingForm(opts) { + if (!(this instanceof IncomingForm)) return new IncomingForm; + EventEmitter.call(this); + + opts=opts||{}; + + this.error = null; + this.ended = false; + + this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024; + this.keepExtensions = opts.keepExtensions || false; + this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR; + this.encoding = opts.encoding || 'utf-8'; + this.headers = null; + this.type = null; + this.hash = false; + + this.bytesReceived = null; + this.bytesExpected = null; + + this._parser = null; + this._flushing = 0; + this._fieldsSize = 0; +}; +util.inherits(IncomingForm, EventEmitter); +exports.IncomingForm = IncomingForm; + +IncomingForm.UPLOAD_DIR = (function() { + var dirs = [process.env.TMP, '/tmp', process.cwd()]; + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + var isDirectory = false; + + try { + isDirectory = fs.statSync(dir).isDirectory(); + } catch (e) {} + + if (isDirectory) return dir; + } +})(); + +IncomingForm.prototype.parse = function(req, cb) { + this.pause = function() { + try { + req.pause(); + } catch (err) { + // the stream was destroyed + if (!this.ended) { + // before it was completed, crash & burn + this._error(err); + } + return false; + } + return true; + }; + + this.resume = function() { + try { + req.resume(); + } catch (err) { + // the stream was destroyed + if (!this.ended) { + // before it was completed, crash & burn + this._error(err); + } + return false; + } + + return true; + }; + + this.writeHeaders(req.headers); + + var self = this; + req + .on('error', function(err) { + self._error(err); + }) + .on('aborted', function() { + self.emit('aborted'); + }) + .on('data', function(buffer) { + self.write(buffer); + }) + .on('end', function() { + if (self.error) { + return; + } + + var err = self._parser.end(); + if (err) { + self._error(err); + } + }); + + if (cb) { + var fields = {}, files = {}; + this + .on('field', function(name, value) { + fields[name] = value; + }) + .on('file', function(name, file) { + files[name] = file; + }) + .on('error', function(err) { + cb(err, fields, files); + }) + .on('end', function() { + cb(null, fields, files); + }); + } + + return this; +}; + +IncomingForm.prototype.writeHeaders = function(headers) { + this.headers = headers; + this._parseContentLength(); + this._parseContentType(); +}; + +IncomingForm.prototype.write = function(buffer) { + if (!this._parser) { + this._error(new Error('unintialized parser')); + return; + } + + this.bytesReceived += buffer.length; + this.emit('progress', this.bytesReceived, this.bytesExpected); + + var bytesParsed = this._parser.write(buffer); + if (bytesParsed !== buffer.length) { + this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed')); + } + + return bytesParsed; +}; + +IncomingForm.prototype.pause = function() { + // this does nothing, unless overwritten in IncomingForm.parse + return false; +}; + +IncomingForm.prototype.resume = function() { + // this does nothing, unless overwritten in IncomingForm.parse + return false; +}; + +IncomingForm.prototype.onPart = function(part) { + // this method can be overwritten by the user + this.handlePart(part); +}; + +IncomingForm.prototype.handlePart = function(part) { + var self = this; + + if (part.filename === undefined) { + var value = '' + , decoder = new StringDecoder(this.encoding); + + part.on('data', function(buffer) { + self._fieldsSize += buffer.length; + if (self._fieldsSize > self.maxFieldsSize) { + self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data')); + return; + } + value += decoder.write(buffer); + }); + + part.on('end', function() { + self.emit('field', part.name, value); + }); + return; + } + + this._flushing++; + + var file = new File({ + path: this._uploadPath(part.filename), + name: part.filename, + type: part.mime, + hash: self.hash + }); + + this.emit('fileBegin', part.name, file); + + file.open(); + + part.on('data', function(buffer) { + self.pause(); + file.write(buffer, function() { + self.resume(); + }); + }); + + part.on('end', function() { + file.end(function() { + self._flushing--; + self.emit('file', part.name, file); + self._maybeEnd(); + }); + }); +}; + +IncomingForm.prototype._parseContentType = function() { + if (!this.headers['content-type']) { + this._error(new Error('bad content-type header, no content-type')); + return; + } + + if (this.headers['content-type'].match(/urlencoded/i)) { + this._initUrlencoded(); + return; + } + + if (this.headers['content-type'].match(/multipart/i)) { + var m; + if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) { + this._initMultipart(m[1] || m[2]); + } else { + this._error(new Error('bad content-type header, no multipart boundary')); + } + return; + } + + this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type'])); +}; + +IncomingForm.prototype._error = function(err) { + if (this.error) { + return; + } + + this.error = err; + this.pause(); + this.emit('error', err); +}; + +IncomingForm.prototype._parseContentLength = function() { + if (this.headers['content-length']) { + this.bytesReceived = 0; + this.bytesExpected = parseInt(this.headers['content-length'], 10); + this.emit('progress', this.bytesReceived, this.bytesExpected); + } +}; + +IncomingForm.prototype._newParser = function() { + return new MultipartParser(); +}; + +IncomingForm.prototype._initMultipart = function(boundary) { + this.type = 'multipart'; + + var parser = new MultipartParser(), + self = this, + headerField, + headerValue, + part; + + parser.initWithBoundary(boundary); + + parser.onPartBegin = function() { + part = new Stream(); + part.readable = true; + part.headers = {}; + part.name = null; + part.filename = null; + part.mime = null; + headerField = ''; + headerValue = ''; + }; + + parser.onHeaderField = function(b, start, end) { + headerField += b.toString(self.encoding, start, end); + }; + + parser.onHeaderValue = function(b, start, end) { + headerValue += b.toString(self.encoding, start, end); + }; + + parser.onHeaderEnd = function() { + headerField = headerField.toLowerCase(); + part.headers[headerField] = headerValue; + + var m; + if (headerField == 'content-disposition') { + if (m = headerValue.match(/name="([^"]+)"/i)) { + part.name = m[1]; + } + + part.filename = self._fileName(headerValue); + } else if (headerField == 'content-type') { + part.mime = headerValue; + } + + headerField = ''; + headerValue = ''; + }; + + parser.onHeadersEnd = function() { + self.onPart(part); + }; + + parser.onPartData = function(b, start, end) { + part.emit('data', b.slice(start, end)); + }; + + parser.onPartEnd = function() { + part.emit('end'); + }; + + parser.onEnd = function() { + self.ended = true; + self._maybeEnd(); + }; + + this._parser = parser; +}; + +IncomingForm.prototype._fileName = function(headerValue) { + var m = headerValue.match(/filename="(.*?)"($|; )/i) + if (!m) return; + + var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); + filename = filename.replace(/%22/g, '"'); + filename = filename.replace(/&#([\d]{4});/g, function(m, code) { + return String.fromCharCode(code); + }); + return filename; +}; + +IncomingForm.prototype._initUrlencoded = function() { + this.type = 'urlencoded'; + + var parser = new QuerystringParser() + , self = this; + + parser.onField = function(key, val) { + self.emit('field', key, val); + }; + + parser.onEnd = function() { + self.ended = true; + self._maybeEnd(); + }; + + this._parser = parser; +}; + +IncomingForm.prototype._uploadPath = function(filename) { + var name = ''; + for (var i = 0; i < 32; i++) { + name += Math.floor(Math.random() * 16).toString(16); + } + + if (this.keepExtensions) { + var ext = path.extname(filename); + ext = ext.replace(/(\.[a-z0-9]+).*/, '$1') + + name += ext; + } + + return path.join(this.uploadDir, name); +}; + +IncomingForm.prototype._maybeEnd = function() { + if (!this.ended || this._flushing) { + return; + } + + this.emit('end'); +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js new file mode 100644 index 0000000..7a6e3e1 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js @@ -0,0 +1,3 @@ +var IncomingForm = require('./incoming_form').IncomingForm; +IncomingForm.IncomingForm = IncomingForm; +module.exports = IncomingForm; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js new file mode 100644 index 0000000..9ca567c --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js @@ -0,0 +1,312 @@ +var Buffer = require('buffer').Buffer, + s = 0, + S = + { PARSER_UNINITIALIZED: s++, + START: s++, + START_BOUNDARY: s++, + HEADER_FIELD_START: s++, + HEADER_FIELD: s++, + HEADER_VALUE_START: s++, + HEADER_VALUE: s++, + HEADER_VALUE_ALMOST_DONE: s++, + HEADERS_ALMOST_DONE: s++, + PART_DATA_START: s++, + PART_DATA: s++, + PART_END: s++, + END: s++, + }, + + f = 1, + F = + { PART_BOUNDARY: f, + LAST_BOUNDARY: f *= 2, + }, + + LF = 10, + CR = 13, + SPACE = 32, + HYPHEN = 45, + COLON = 58, + A = 97, + Z = 122, + + lower = function(c) { + return c | 0x20; + }; + +for (var s in S) { + exports[s] = S[s]; +} + +function MultipartParser() { + this.boundary = null; + this.boundaryChars = null; + this.lookbehind = null; + this.state = S.PARSER_UNINITIALIZED; + + this.index = null; + this.flags = 0; +}; +exports.MultipartParser = MultipartParser; + +MultipartParser.stateToString = function(stateNumber) { + for (var state in S) { + var number = S[state]; + if (number === stateNumber) return state; + } +}; + +MultipartParser.prototype.initWithBoundary = function(str) { + this.boundary = new Buffer(str.length+4); + this.boundary.write('\r\n--', 'ascii', 0); + this.boundary.write(str, 'ascii', 4); + this.lookbehind = new Buffer(this.boundary.length+8); + this.state = S.START; + + this.boundaryChars = {}; + for (var i = 0; i < this.boundary.length; i++) { + this.boundaryChars[this.boundary[i]] = true; + } +}; + +MultipartParser.prototype.write = function(buffer) { + var self = this, + i = 0, + len = buffer.length, + prevIndex = this.index, + index = this.index, + state = this.state, + flags = this.flags, + lookbehind = this.lookbehind, + boundary = this.boundary, + boundaryChars = this.boundaryChars, + boundaryLength = this.boundary.length, + boundaryEnd = boundaryLength - 1, + bufferLength = buffer.length, + c, + cl, + + mark = function(name) { + self[name+'Mark'] = i; + }, + clear = function(name) { + delete self[name+'Mark']; + }, + callback = function(name, buffer, start, end) { + if (start !== undefined && start === end) { + return; + } + + var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1); + if (callbackSymbol in self) { + self[callbackSymbol](buffer, start, end); + } + }, + dataCallback = function(name, clear) { + var markSymbol = name+'Mark'; + if (!(markSymbol in self)) { + return; + } + + if (!clear) { + callback(name, buffer, self[markSymbol], buffer.length); + self[markSymbol] = 0; + } else { + callback(name, buffer, self[markSymbol], i); + delete self[markSymbol]; + } + }; + + for (i = 0; i < len; i++) { + c = buffer[i]; + switch (state) { + case S.PARSER_UNINITIALIZED: + return i; + case S.START: + index = 0; + state = S.START_BOUNDARY; + case S.START_BOUNDARY: + if (index == boundary.length - 2) { + if (c != CR) { + return i; + } + index++; + break; + } else if (index - 1 == boundary.length - 2) { + if (c != LF) { + return i; + } + index = 0; + callback('partBegin'); + state = S.HEADER_FIELD_START; + break; + } + + if (c != boundary[index+2]) { + return i; + } + index++; + break; + case S.HEADER_FIELD_START: + state = S.HEADER_FIELD; + mark('headerField'); + index = 0; + case S.HEADER_FIELD: + if (c == CR) { + clear('headerField'); + state = S.HEADERS_ALMOST_DONE; + break; + } + + index++; + if (c == HYPHEN) { + break; + } + + if (c == COLON) { + if (index == 1) { + // empty header field + return i; + } + dataCallback('headerField', true); + state = S.HEADER_VALUE_START; + break; + } + + cl = lower(c); + if (cl < A || cl > Z) { + return i; + } + break; + case S.HEADER_VALUE_START: + if (c == SPACE) { + break; + } + + mark('headerValue'); + state = S.HEADER_VALUE; + case S.HEADER_VALUE: + if (c == CR) { + dataCallback('headerValue', true); + callback('headerEnd'); + state = S.HEADER_VALUE_ALMOST_DONE; + } + break; + case S.HEADER_VALUE_ALMOST_DONE: + if (c != LF) { + return i; + } + state = S.HEADER_FIELD_START; + break; + case S.HEADERS_ALMOST_DONE: + if (c != LF) { + return i; + } + + callback('headersEnd'); + state = S.PART_DATA_START; + break; + case S.PART_DATA_START: + state = S.PART_DATA + mark('partData'); + case S.PART_DATA: + prevIndex = index; + + if (index == 0) { + // boyer-moore derrived algorithm to safely skip non-boundary data + i += boundaryEnd; + while (i < bufferLength && !(buffer[i] in boundaryChars)) { + i += boundaryLength; + } + i -= boundaryEnd; + c = buffer[i]; + } + + if (index < boundary.length) { + if (boundary[index] == c) { + if (index == 0) { + dataCallback('partData', true); + } + index++; + } else { + index = 0; + } + } else if (index == boundary.length) { + index++; + if (c == CR) { + // CR = part boundary + flags |= F.PART_BOUNDARY; + } else if (c == HYPHEN) { + // HYPHEN = end boundary + flags |= F.LAST_BOUNDARY; + } else { + index = 0; + } + } else if (index - 1 == boundary.length) { + if (flags & F.PART_BOUNDARY) { + index = 0; + if (c == LF) { + // unset the PART_BOUNDARY flag + flags &= ~F.PART_BOUNDARY; + callback('partEnd'); + callback('partBegin'); + state = S.HEADER_FIELD_START; + break; + } + } else if (flags & F.LAST_BOUNDARY) { + if (c == HYPHEN) { + callback('partEnd'); + callback('end'); + state = S.END; + } else { + index = 0; + } + } else { + index = 0; + } + } + + if (index > 0) { + // when matching a possible boundary, keep a lookbehind reference + // in case it turns out to be a false lead + lookbehind[index-1] = c; + } else if (prevIndex > 0) { + // if our boundary turned out to be rubbish, the captured lookbehind + // belongs to partData + callback('partData', lookbehind, 0, prevIndex); + prevIndex = 0; + mark('partData'); + + // reconsider the current character even so it interrupted the sequence + // it could be the beginning of a new sequence + i--; + } + + break; + case S.END: + break; + default: + return i; + } + } + + dataCallback('headerField'); + dataCallback('headerValue'); + dataCallback('partData'); + + this.index = index; + this.state = state; + this.flags = flags; + + return len; +}; + +MultipartParser.prototype.end = function() { + if (this.state != S.END) { + return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain()); + } +}; + +MultipartParser.prototype.explain = function() { + return 'state = ' + MultipartParser.stateToString(this.state); +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js new file mode 100644 index 0000000..63f109e --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js @@ -0,0 +1,25 @@ +if (global.GENTLY) require = GENTLY.hijack(require); + +// This is a buffering parser, not quite as nice as the multipart one. +// If I find time I'll rewrite this to be fully streaming as well +var querystring = require('querystring'); + +function QuerystringParser() { + this.buffer = ''; +}; +exports.QuerystringParser = QuerystringParser; + +QuerystringParser.prototype.write = function(buffer) { + this.buffer += buffer.toString('ascii'); + return buffer.length; +}; + +QuerystringParser.prototype.end = function() { + var fields = querystring.parse(this.buffer); + for (var field in fields) { + this.onField(field, fields[field]); + } + this.buffer = ''; + + this.onEnd(); +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js new file mode 100644 index 0000000..e9493e9 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js @@ -0,0 +1,6 @@ +// Backwards compatibility ... +try { + module.exports = require('util'); +} catch (e) { + module.exports = require('sys'); +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile new file mode 100644 index 0000000..01f7140 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile @@ -0,0 +1,4 @@ +test: + @find test/simple/test-*.js | xargs -n 1 -t node + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md new file mode 100644 index 0000000..f8f0c66 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md @@ -0,0 +1,167 @@ +# Gently + +## Purpose + +A node.js module that helps with stubbing and behavior verification. It allows you to test the most remote and nested corners of your code while keeping being fully unobtrusive. + +## Features + +* Overwrite and stub individual object functions +* Verify that all expected calls have been made in the expected order +* Restore stubbed functions to their original behavior +* Detect object / class names from obj.constructor.name and obj.toString() +* Hijack any required module function or class constructor + +## Installation + +Via [npm](http://github.com/isaacs/npm): + + npm install gently@latest + +## Example + +Make sure your dog is working properly: + + function Dog() {} + + Dog.prototype.seeCat = function() { + this.bark('whuf, whuf'); + this.run(); + } + + Dog.prototype.bark = function(bark) { + require('sys').puts(bark); + } + + var gently = new (require('gently')) + , assert = require('assert') + , dog = new Dog(); + + gently.expect(dog, 'bark', function(bark) { + assert.equal(bark, 'whuf, whuf'); + }); + gently.expect(dog, 'run'); + + dog.seeCat(); + +You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by `fs.WriteStream`: + + var gently = new (require('gently')) + , stream = new (require('fs').WriteStream)('my_file.txt'); + + gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'open'); + }); + + gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'drain'); + }); + +For a full read world example, check out this test case: [test-incoming-form.js](http://github.com/felixge/node-formidable/blob/master/test/simple/test-incoming-form.js) (in [node-formdiable](http://github.com/felixge/node-formidable)). + +## API + +### Gently + +#### new Gently() + +Creates a new gently instance. It listens to the process `'exit'` event to make sure all expectations have been verified. + +#### gently.expect(obj, method, [[count], stubFn]) + +Creates an expectation for an objects method to be called. You can optionally specify the call `count` you are expecting, as well as `stubFn` function that will run instead of the original function. + +Returns a reference to the function that is getting overwritten. + +#### gently.expect([count], stubFn) + +Returns a function that is supposed to be executed `count` times, delegating any calls to the provided `stubFn` function. Naming your stubFn closure will help to properly diagnose errors that are being thrown: + + childProcess.exec('ls', gently.expect(function lsCallback(code) { + assert.equal(0, code); + })); + +#### gently.restore(obj, method) + +Restores an object method that has been previously overwritten using `gently.expect()`. + +#### gently.hijack(realRequire) + +Returns a new require functions that catches a reference to all required modules into `gently.hijacked`. + +To use this function, include a line like this in your `'my-module.js'`. + + if (global.GENTLY) require = GENTLY.hijack(require); + + var sys = require('sys'); + exports.hello = function() { + sys.log('world'); + }; + +Now you can write a test for the module above: + + var gently = global.GENTLY = new (require('gently')) + , myModule = require('./my-module'); + + gently.expect(gently.hijacked.sys, 'log', function(str) { + assert.equal(str, 'world'); + }); + + myModule.hello(); + +#### gently.stub(location, [exportsName]) + +Returns a stub class that will be used instead of the real class from the module at `location` with the given `exportsName`. + +This allows to test an OOP version of the previous example, where `'my-module.js'`. + + if (global.GENTLY) require = GENTLY.hijack(require); + + var World = require('./world'); + + exports.hello = function() { + var world = new World(); + world.hello(); + } + +And `world.js` looks like this: + + var sys = require('sys'); + + function World() { + + } + module.exports = World; + + World.prototype.hello = function() { + sys.log('world'); + }; + +Testing `'my-module.js'` can now easily be accomplished: + + var gently = global.GENTLY = new (require('gently')) + , WorldStub = gently.stub('./world') + , myModule = require('./my-module') + , WORLD; + + gently.expect(WorldStub, 'new', function() { + WORLD = this; + }); + + gently.expect(WORLD, 'hello'); + + myModule.hello(); + +#### gently.hijacked + +An object that holds the references to all hijacked modules. + +#### gently.verify([msg]) + +Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process `'exit'` event is fired. + +If `msg` is given, it will appear in any error that might be thrown. + +## License + +Gently is licensed under the MIT license. \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js new file mode 100644 index 0000000..022fae0 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js @@ -0,0 +1,22 @@ +require('../test/common'); +function Dog() {} + +Dog.prototype.seeCat = function() { + this.bark('whuf, whuf'); + this.run(); +} + +Dog.prototype.bark = function(bark) { + require('sys').puts(bark); +} + +var gently = new (require('gently')) + , assert = require('assert') + , dog = new Dog(); + +gently.expect(dog, 'bark', function(bark) { + assert.equal(bark, 'whuf, whuf'); +}); +gently.expect(dog, 'run'); + +dog.seeCat(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js new file mode 100644 index 0000000..7def134 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js @@ -0,0 +1,11 @@ +require('../test/common'); +var gently = new (require('gently')) + , stream = new (require('fs').WriteStream)('my_file.txt'); + +gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'open'); +}); + +gently.expect(stream, 'emit', function(event) { + assert.equal(event, 'drain'); +}); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js new file mode 100644 index 0000000..69122bd --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/gently'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js new file mode 100644 index 0000000..8af0e1e --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js @@ -0,0 +1,184 @@ +var path = require('path'); + +function Gently() { + this.expectations = []; + this.hijacked = {}; + + var self = this; + process.addListener('exit', function() { + self.verify('process exit'); + }); +}; +module.exports = Gently; + +Gently.prototype.stub = function(location, exportsName) { + function Stub() { + return Stub['new'].apply(this, arguments); + }; + + Stub['new'] = function () {}; + + var stubName = 'require('+JSON.stringify(location)+')'; + if (exportsName) { + stubName += '.'+exportsName; + } + + Stub.prototype.toString = Stub.toString = function() { + return stubName; + }; + + var exports = this.hijacked[location] || {}; + if (exportsName) { + exports[exportsName] = Stub; + } else { + exports = Stub; + } + + this.hijacked[location] = exports; + return Stub; +}; + +Gently.prototype.hijack = function(realRequire) { + var self = this; + return function(location) { + return self.hijacked[location] = (self.hijacked[location]) + ? self.hijacked[location] + : realRequire(location); + }; +}; + +Gently.prototype.expect = function(obj, method, count, stubFn) { + if (typeof obj != 'function' && typeof obj != 'object' && typeof obj != 'number') { + throw new Error + ( 'Bad 1st argument for gently.expect(), ' + + 'object, function, or number expected, got: '+(typeof obj) + ); + } else if (typeof obj == 'function' && (typeof method != 'string')) { + // expect(stubFn) interface + stubFn = obj; + obj = null; + method = null; + count = 1; + } else if (typeof method == 'function') { + // expect(count, stubFn) interface + count = obj; + stubFn = method; + obj = null; + method = null; + } else if (typeof count == 'function') { + // expect(obj, method, stubFn) interface + stubFn = count; + count = 1; + } else if (count === undefined) { + // expect(obj, method) interface + count = 1; + } + + var name = this._name(obj, method, stubFn); + this.expectations.push({obj: obj, method: method, stubFn: stubFn, name: name, count: count}); + + var self = this; + function delegate() { + return self._stubFn(this, obj, method, name, Array.prototype.slice.call(arguments)); + } + + if (!obj) { + return delegate; + } + + var original = (obj[method]) + ? obj[method]._original || obj[method] + : undefined; + + obj[method] = delegate; + return obj[method]._original = original; +}; + +Gently.prototype.restore = function(obj, method) { + if (!obj[method] || !obj[method]._original) { + throw new Error(this._name(obj, method)+' is not gently stubbed'); + } + obj[method] = obj[method]._original; +}; + +Gently.prototype.verify = function(msg) { + if (!this.expectations.length) { + return; + } + + var validExpectations = []; + for (var i = 0, l = this.expectations.length; i < l; i++) { + var expectation = this.expectations[i]; + + if (expectation.count > 0) { + validExpectations.push(expectation); + } + } + + this.expectations = []; // reset so that no duplicate verification attempts are made + + if (!validExpectations.length) { + return; + } + + var expectation = validExpectations[0]; + + throw new Error + ( 'Expected call to '+expectation.name+' did not happen' + + ( (msg) + ? ' ('+msg+')' + : '' + ) + ); +}; + +Gently.prototype._stubFn = function(self, obj, method, name, args) { + var expectation = this.expectations[0], obj, method; + + if (!expectation) { + throw new Error('Unexpected call to '+name+', no call was expected'); + } + + if (expectation.obj !== obj || expectation.method !== method) { + throw new Error('Unexpected call to '+name+', expected call to '+ expectation.name); + } + + expectation.count -= 1; + if (expectation.count === 0) { + this.expectations.shift(); + + // autorestore original if its not a closure + // and no more expectations on that object + var has_more_expectations = this.expectations.reduce(function (memo, expectation) { + return memo || (expectation.obj === obj && expectation.method === method); + }, false); + if (obj !== null && method !== null && !has_more_expectations) { + if (typeof obj[method]._original !== 'undefined') { + obj[method] = obj[method]._original; + delete obj[method]._original; + } else { + delete obj[method]; + } + } + } + + if (expectation.stubFn) { + return expectation.stubFn.apply(self, args); + } +}; + +Gently.prototype._name = function(obj, method, stubFn) { + if (obj) { + var objectName = obj.toString(); + if (objectName == '[object Object]' && obj.constructor.name) { + objectName = '['+obj.constructor.name+']'; + } + return (objectName)+'.'+method+'()'; + } + + if (stubFn.name) { + return stubFn.name+'()'; + } + + return '>> '+stubFn.toString()+' <<'; +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js new file mode 100644 index 0000000..64c1977 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js @@ -0,0 +1 @@ +module.exports = require('./gently'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json new file mode 100644 index 0000000..9c1b7a0 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json @@ -0,0 +1,14 @@ +{ + "name": "gently", + "version": "0.9.2", + "directories": { + "lib": "./lib/gently" + }, + "main": "./lib/gently/index", + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": "*" + }, + "optionalDependencies": {} +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js new file mode 100644 index 0000000..978b5c5 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js @@ -0,0 +1,8 @@ +var path = require('path') + , sys = require('sys'); + +require.paths.unshift(path.dirname(__dirname)+'/lib'); + +global.puts = sys.puts; +global.p = function() {sys.error(sys.inspect.apply(null, arguments))};; +global.assert = require('assert'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js new file mode 100644 index 0000000..4f8fe2d --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js @@ -0,0 +1,348 @@ +require('../common'); +var Gently = require('gently') + , gently; + +function test(test) { + process.removeAllListeners('exit'); + gently = new Gently(); + test(); +} + +test(function constructor() { + assert.deepEqual(gently.expectations, []); + assert.deepEqual(gently.hijacked, {}); + assert.equal(gently.constructor.name, 'Gently'); +}); + +test(function expectBadArgs() { + var BAD_ARG = 'oh no'; + try { + gently.expect(BAD_ARG); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Bad 1st argument for gently.expect(), object, function, or number expected, got: '+(typeof BAD_ARG)); + } +}); + +test(function expectObjMethod() { + var OBJ = {}, NAME = 'foobar'; + OBJ.foo = function(x) { + return x; + }; + + gently._name = function() { + return NAME; + }; + + var original = OBJ.foo + , stubFn = function() {}; + + (function testAddOne() { + assert.strictEqual(gently.expect(OBJ, 'foo', stubFn), original); + + assert.equal(gently.expectations.length, 1); + var expectation = gently.expectations[0]; + assert.strictEqual(expectation.obj, OBJ); + assert.strictEqual(expectation.method, 'foo'); + assert.strictEqual(expectation.stubFn, stubFn); + assert.strictEqual(expectation.name, NAME); + assert.strictEqual(OBJ.foo._original, original); + })(); + + (function testAddTwo() { + gently.expect(OBJ, 'foo', 2, stubFn); + assert.equal(gently.expectations.length, 2); + assert.strictEqual(OBJ.foo._original, original); + })(); + + (function testAddOneWithoutMock() { + gently.expect(OBJ, 'foo'); + assert.equal(gently.expectations.length, 3); + })(); + + var stubFnCalled = 0, SELF = {}; + gently._stubFn = function(self, obj, method, name, args) { + stubFnCalled++; + assert.strictEqual(self, SELF); + assert.strictEqual(obj, OBJ); + assert.strictEqual(method, 'foo'); + assert.strictEqual(name, NAME); + assert.deepEqual(args, [1, 2]); + return 23; + }; + assert.equal(OBJ.foo.apply(SELF, [1, 2]), 23); + assert.equal(stubFnCalled, 1); +}); + +test(function expectClosure() { + var NAME = 'MY CLOSURE'; + function closureFn() {}; + + gently._name = function() { + return NAME; + }; + + var fn = gently.expect(closureFn); + assert.equal(gently.expectations.length, 1); + var expectation = gently.expectations[0]; + assert.strictEqual(expectation.obj, null); + assert.strictEqual(expectation.method, null); + assert.strictEqual(expectation.stubFn, closureFn); + assert.strictEqual(expectation.name, NAME); + + var stubFnCalled = 0, SELF = {}; + gently._stubFn = function(self, obj, method, name, args) { + stubFnCalled++; + assert.strictEqual(self, SELF); + assert.strictEqual(obj, null); + assert.strictEqual(method, null); + assert.strictEqual(name, NAME); + assert.deepEqual(args, [1, 2]); + return 23; + }; + assert.equal(fn.apply(SELF, [1, 2]), 23); + assert.equal(stubFnCalled, 1); +}); + +test(function expectClosureCount() { + var stubFnCalled = 0; + function closureFn() {stubFnCalled++}; + + var fn = gently.expect(2, closureFn); + assert.equal(gently.expectations.length, 1); + fn(); + assert.equal(gently.expectations.length, 1); + fn(); + assert.equal(stubFnCalled, 2); +}); + +test(function restore() { + var OBJ = {}, NAME = '[my object].myFn()'; + OBJ.foo = function(x) { + return x; + }; + + gently._name = function() { + return NAME; + }; + + var original = OBJ.foo; + gently.expect(OBJ, 'foo'); + gently.restore(OBJ, 'foo'); + assert.strictEqual(OBJ.foo, original); + + (function testError() { + try { + gently.restore(OBJ, 'foo'); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, NAME+' is not gently stubbed'); + } + })(); +}); + +test(function _stubFn() { + var OBJ1 = {toString: function() {return '[OBJ 1]'}} + , OBJ2 = {toString: function() {return '[OBJ 2]'}, foo: function () {return 'bar';}} + , SELF = {}; + + gently.expect(OBJ1, 'foo', function(x) { + assert.strictEqual(this, SELF); + return x * 2; + }); + + assert.equal(gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]), 10); + + (function testAutorestore() { + assert.equal(OBJ2.foo(), 'bar'); + + gently.expect(OBJ2, 'foo', function() { + return 'stubbed foo'; + }); + + gently.expect(OBJ2, 'foo', function() { + return "didn't restore yet"; + }); + + assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), 'stubbed foo'); + assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), "didn't restore yet"); + assert.equal(OBJ2.foo(), 'bar'); + assert.deepEqual(gently.expectations, []); + })(); + + (function testNoMoreCallExpected() { + try { + gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Unexpected call to dummy_name, no call was expected'); + } + })(); + + (function testDifferentCallExpected() { + gently.expect(OBJ2, 'bar'); + try { + gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Unexpected call to dummy_name, expected call to '+gently._name(OBJ2, 'bar')); + } + + assert.equal(gently.expectations.length, 1); + })(); + + (function testNoMockCallback() { + OBJ2.bar(); + assert.equal(gently.expectations.length, 0); + })(); +}); + +test(function stub() { + var LOCATION = './my_class'; + + (function testRegular() { + var Stub = gently.stub(LOCATION); + assert.ok(Stub instanceof Function); + assert.strictEqual(gently.hijacked[LOCATION], Stub); + assert.ok(Stub['new'] instanceof Function); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); + + (function testConstructor() { + var newCalled = 0 + , STUB + , ARGS = ['foo', 'bar']; + + Stub['new'] = function(a, b) { + assert.equal(a, ARGS[0]); + assert.equal(b, ARGS[1]); + newCalled++; + STUB = this; + }; + + var stub = new Stub(ARGS[0], ARGS[1]); + assert.strictEqual(stub, STUB); + assert.equal(newCalled, 1); + assert.equal(stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); + })(); + + (function testUseReturnValueAsInstance() { + var R = {}; + + Stub['new'] = function() { + return R; + }; + + var stub = new Stub(); + assert.strictEqual(stub, R); + + })(); + })(); + + var EXPORTS_NAME = 'MyClass'; + test(function testExportsName() { + var Stub = gently.stub(LOCATION, EXPORTS_NAME); + assert.strictEqual(gently.hijacked[LOCATION][EXPORTS_NAME], Stub); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); + + (function testConstructor() { + var stub = new Stub(); + assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); + })(); + }); +}); + +test(function hijack() { + var LOCATION = './foo' + , REQUIRE_CALLS = 0 + , EXPORTS = {} + , REQUIRE = function() { + REQUIRE_CALLS++; + return EXPORTS; + }; + + var hijackedRequire = gently.hijack(REQUIRE); + hijackedRequire(LOCATION); + assert.strictEqual(gently.hijacked[LOCATION], EXPORTS); + + assert.equal(REQUIRE_CALLS, 1); + + // make sure we are caching the hijacked module + hijackedRequire(LOCATION); + assert.equal(REQUIRE_CALLS, 1); +}); + +test(function verify() { + var OBJ = {toString: function() {return '[OBJ]'}}; + gently.verify(); + + gently.expect(OBJ, 'foo'); + try { + gently.verify(); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen'); + } + + try { + gently.verify('foo'); + assert.ok(false, 'throw needs to happen'); + } catch (e) { + assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen (foo)'); + } +}); + +test(function processExit() { + var verifyCalled = 0; + gently.verify = function(msg) { + verifyCalled++; + assert.equal(msg, 'process exit'); + }; + + process.emit('exit'); + assert.equal(verifyCalled, 1); +}); + +test(function _name() { + (function testNamedClass() { + function Foo() {}; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), '[Foo].bar()'); + })(); + + (function testToStringPreference() { + function Foo() {}; + Foo.prototype.toString = function() { + return '[Superman 123]'; + }; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), '[Superman 123].bar()'); + })(); + + (function testUnamedClass() { + var Foo = function() {}; + var foo = new Foo(); + assert.equal(gently._name(foo, 'bar'), foo.toString()+'.bar()'); + })(); + + (function testNamedClosure() { + function myClosure() {}; + assert.equal(gently._name(null, null, myClosure), myClosure.name+'()'); + })(); + + (function testUnamedClosure() { + var myClosure = function() {2+2 == 5}; + assert.equal(gently._name(null, null, myClosure), '>> '+myClosure.toString()+' <<'); + })(); +}); + +test(function verifyExpectNone() { + var OBJ = {toString: function() {return '[OBJ]'}}; + gently.verify(); + + gently.expect(OBJ, 'foo', 0); + try { + gently.verify(); + } catch (e) { + assert.fail('Exception should not have been thrown'); + } +}); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/package.json new file mode 100644 index 0000000..4d94297 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/package.json @@ -0,0 +1,23 @@ +{ + "name": "formidable", + "version": "1.0.11", + "dependencies": {}, + "devDependencies": { + "gently": "0.8.0", + "findit": "0.1.1", + "hashish": "0.0.4", + "urun": "0.0.4", + "utest": "0.0.3" + }, + "directories": { + "lib": "./lib" + }, + "main": "./lib/index", + "scripts": { + "test": "make test" + }, + "engines": { + "node": "*" + }, + "optionalDependencies": {} +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js new file mode 100644 index 0000000..eb432ad --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js @@ -0,0 +1,19 @@ +var mysql = require('..'); +var path = require('path'); + +var root = path.join(__dirname, '../'); +exports.dir = { + root : root, + lib : root + '/lib', + fixture : root + '/test/fixture', + tmp : root + '/test/tmp', +}; + +exports.port = 13532; + +exports.formidable = require('..'); +exports.assert = require('assert'); + +exports.require = function(lib) { + return require(exports.dir.lib + '/' + lib); +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt new file mode 100644 index 0000000..e7a4785 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt @@ -0,0 +1 @@ +I am a text file with a funky name! diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt new file mode 100644 index 0000000..9b6903e --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt @@ -0,0 +1 @@ +I am a plain text file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md new file mode 100644 index 0000000..3c9dbe3 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md @@ -0,0 +1,3 @@ +* Opera does not allow submitting this file, it shows a warning to the + user that the file could not be found instead. Tested in 9.8, 11.51 on OSX. + Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com). diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js new file mode 100644 index 0000000..0bae449 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js @@ -0,0 +1,3 @@ +module.exports['generic.http'] = [ + {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'}, +]; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js new file mode 100644 index 0000000..eb76fdc --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js @@ -0,0 +1,21 @@ +var properFilename = 'funkyfilename.txt'; + +function expect(filename) { + return [ + {type: 'field', name: 'title', value: 'Weird filename'}, + {type: 'file', name: 'upload', filename: filename, fixture: properFilename}, + ]; +}; + +var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; +var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; + +module.exports = { + 'osx-chrome-13.http' : expect(webkit), + 'osx-firefox-3.6.http' : expect(ffOrIe), + 'osx-safari-5.http' : expect(webkit), + 'xp-chrome-12.http' : expect(webkit), + 'xp-ie-7.http' : expect(ffOrIe), + 'xp-ie-8.http' : expect(ffOrIe), + 'xp-safari-5.http' : expect(webkit), +}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js new file mode 100644 index 0000000..a476169 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js @@ -0,0 +1,72 @@ +exports['rfc1867'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--\r\n', + parts: + [ { headers: { + 'content-disposition': 'form-data; name="field1"', + }, + data: 'Joe Blow\r\nalmost tricked you!', + }, + { headers: { + 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', + 'Content-Type': 'text/plain', + }, + data: '... contents of file1.txt ...\r', + } + ] + }; + +exports['noTrailing\r\n'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--', + parts: + [ { headers: { + 'content-disposition': 'form-data; name="field1"', + }, + data: 'Joe Blow\r\nalmost tricked you!', + }, + { headers: { + 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', + 'Content-Type': 'text/plain', + }, + data: '... contents of file1.txt ...\r', + } + ] + }; + +exports['emptyHeader'] = + { boundary: 'AaB03x', + raw: + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="field1"\r\n'+ + ': foo\r\n'+ + '\r\n'+ + 'Joe Blow\r\nalmost tricked you!\r\n'+ + '--AaB03x\r\n'+ + 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ + 'Content-Type: text/plain\r\n'+ + '\r\n'+ + '... contents of file1.txt ...\r\r\n'+ + '--AaB03x--\r\n', + expectError: true, + }; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js new file mode 100644 index 0000000..66ad259 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js @@ -0,0 +1,89 @@ +var hashish = require('hashish'); +var fs = require('fs'); +var findit = require('findit'); +var path = require('path'); +var http = require('http'); +var net = require('net'); +var assert = require('assert'); + +var common = require('../common'); +var formidable = common.formidable; + +var server = http.createServer(); +server.listen(common.port, findFixtures); + +function findFixtures() { + var fixtures = []; + findit + .sync(common.dir.fixture + '/js') + .forEach(function(jsPath) { + if (!/\.js$/.test(jsPath)) return; + + var group = path.basename(jsPath, '.js'); + hashish.forEach(require(jsPath), function(fixture, name) { + fixtures.push({ + name : group + '/' + name, + fixture : fixture, + }); + }); + }); + + testNext(fixtures); +} + +function testNext(fixtures) { + var fixture = fixtures.shift(); + if (!fixture) return server.close(); + + var name = fixture.name; + var fixture = fixture.fixture; + + uploadFixture(name, function(err, parts) { + if (err) throw err; + + fixture.forEach(function(expectedPart, i) { + var parsedPart = parts[i]; + assert.equal(parsedPart.type, expectedPart.type); + assert.equal(parsedPart.name, expectedPart.name); + + if (parsedPart.type === 'file') { + var filename = parsedPart.value.name; + assert.equal(filename, expectedPart.filename); + } + }); + + testNext(fixtures); + }); +}; + +function uploadFixture(name, cb) { + server.once('request', function(req, res) { + var form = new formidable.IncomingForm(); + form.uploadDir = common.dir.tmp; + form.parse(req); + + function callback() { + var realCallback = cb; + cb = function() {}; + realCallback.apply(null, arguments); + } + + var parts = []; + form + .on('error', callback) + .on('fileBegin', function(name, value) { + parts.push({type: 'file', name: name, value: value}); + }) + .on('field', function(name, value) { + parts.push({type: 'field', name: name, value: value}); + }) + .on('end', function() { + callback(null, parts); + }); + }); + + var socket = net.createConnection(common.port); + var file = fs.createReadStream(common.dir.fixture + '/http/' + name); + + file.pipe(socket); +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js new file mode 100644 index 0000000..2b98598 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js @@ -0,0 +1,24 @@ +var path = require('path'), + fs = require('fs'); + +try { + global.Gently = require('gently'); +} catch (e) { + throw new Error('this test suite requires node-gently'); +} + +exports.lib = path.join(__dirname, '../../lib'); + +global.GENTLY = new Gently(); + +global.assert = require('assert'); +global.TEST_PORT = 13532; +global.TEST_FIXTURES = path.join(__dirname, '../fixture'); +global.TEST_TMP = path.join(__dirname, '../tmp'); + +// Stupid new feature in node that complains about gently attaching too many +// listeners to process 'exit'. This is a workaround until I can think of a +// better way to deal with this. +if (process.setMaxListeners) { + process.setMaxListeners(10000); +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js new file mode 100644 index 0000000..75232aa --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js @@ -0,0 +1,80 @@ +var common = require('../common'); +var CHUNK_LENGTH = 10, + multipartParser = require(common.lib + '/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + parser = new MultipartParser(), + fixtures = require(TEST_FIXTURES + '/multipart'), + Buffer = require('buffer').Buffer; + +Object.keys(fixtures).forEach(function(name) { + var fixture = fixtures[name], + buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')), + offset = 0, + chunk, + nparsed, + + parts = [], + part = null, + headerField, + headerValue, + endCalled = ''; + + parser.initWithBoundary(fixture.boundary); + parser.onPartBegin = function() { + part = {headers: {}, data: ''}; + parts.push(part); + headerField = ''; + headerValue = ''; + }; + + parser.onHeaderField = function(b, start, end) { + headerField += b.toString('ascii', start, end); + }; + + parser.onHeaderValue = function(b, start, end) { + headerValue += b.toString('ascii', start, end); + } + + parser.onHeaderEnd = function() { + part.headers[headerField] = headerValue; + headerField = ''; + headerValue = ''; + }; + + parser.onPartData = function(b, start, end) { + var str = b.toString('ascii', start, end); + part.data += b.slice(start, end); + } + + parser.onEnd = function() { + endCalled = true; + } + + buffer.write(fixture.raw, 'binary', 0); + + while (offset < buffer.length) { + if (offset + CHUNK_LENGTH < buffer.length) { + chunk = buffer.slice(offset, offset+CHUNK_LENGTH); + } else { + chunk = buffer.slice(offset, buffer.length); + } + offset = offset + CHUNK_LENGTH; + + nparsed = parser.write(chunk); + if (nparsed != chunk.length) { + if (fixture.expectError) { + return; + } + puts('-- ERROR --'); + p(chunk.toString('ascii')); + throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!'); + } + } + + if (fixture.expectError) { + throw new Error('expected parse error did not happen'); + } + + assert.ok(endCalled); + assert.deepEqual(parts, fixture.parts); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js new file mode 100644 index 0000000..52ceedb --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js @@ -0,0 +1,104 @@ +var common = require('../common'); +var WriteStreamStub = GENTLY.stub('fs', 'WriteStream'); + +var File = require(common.lib + '/file'), + EventEmitter = require('events').EventEmitter, + file, + gently; + +function test(test) { + gently = new Gently(); + file = new File(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.ok(file instanceof EventEmitter); + assert.strictEqual(file.size, 0); + assert.strictEqual(file.path, null); + assert.strictEqual(file.name, null); + assert.strictEqual(file.type, null); + assert.strictEqual(file.lastModifiedDate, null); + + assert.strictEqual(file._writeStream, null); + + (function testSetProperties() { + var file2 = new File({foo: 'bar'}); + assert.equal(file2.foo, 'bar'); + })(); +}); + +test(function open() { + var WRITE_STREAM; + file.path = '/foo'; + + gently.expect(WriteStreamStub, 'new', function (path) { + WRITE_STREAM = this; + assert.strictEqual(path, file.path); + }); + + file.open(); + assert.strictEqual(file._writeStream, WRITE_STREAM); +}); + +test(function write() { + var BUFFER = {length: 10}, + CB_STUB, + CB = function() { + CB_STUB.apply(this, arguments); + }; + + file._writeStream = {}; + + gently.expect(file._writeStream, 'write', function (buffer, cb) { + assert.strictEqual(buffer, BUFFER); + + gently.expect(file, 'emit', function (event, bytesWritten) { + assert.ok(file.lastModifiedDate instanceof Date); + assert.equal(event, 'progress'); + assert.equal(bytesWritten, file.size); + }); + + CB_STUB = gently.expect(function writeCb() { + assert.equal(file.size, 10); + }); + + cb(); + + gently.expect(file, 'emit', function (event, bytesWritten) { + assert.equal(event, 'progress'); + assert.equal(bytesWritten, file.size); + }); + + CB_STUB = gently.expect(function writeCb() { + assert.equal(file.size, 20); + }); + + cb(); + }); + + file.write(BUFFER, CB); +}); + +test(function end() { + var CB_STUB, + CB = function() { + CB_STUB.apply(this, arguments); + }; + + file._writeStream = {}; + + gently.expect(file._writeStream, 'end', function (cb) { + gently.expect(file, 'emit', function (event) { + assert.equal(event, 'end'); + }); + + CB_STUB = gently.expect(function endCb() { + }); + + cb(); + }); + + file.end(CB); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js new file mode 100644 index 0000000..84de439 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js @@ -0,0 +1,727 @@ +var common = require('../common'); +var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'), + QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'), + EventEmitterStub = GENTLY.stub('events', 'EventEmitter'), + StreamStub = GENTLY.stub('stream', 'Stream'), + FileStub = GENTLY.stub('./file'); + +var formidable = require(common.lib + '/index'), + IncomingForm = formidable.IncomingForm, + events = require('events'), + fs = require('fs'), + path = require('path'), + Buffer = require('buffer').Buffer, + fixtures = require(TEST_FIXTURES + '/multipart'), + form, + gently; + +function test(test) { + gently = new Gently(); + gently.expect(EventEmitterStub, 'call'); + form = new IncomingForm(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.strictEqual(form.error, null); + assert.strictEqual(form.ended, false); + assert.strictEqual(form.type, null); + assert.strictEqual(form.headers, null); + assert.strictEqual(form.keepExtensions, false); + assert.strictEqual(form.uploadDir, '/tmp'); + assert.strictEqual(form.encoding, 'utf-8'); + assert.strictEqual(form.bytesReceived, null); + assert.strictEqual(form.bytesExpected, null); + assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024); + assert.strictEqual(form._parser, null); + assert.strictEqual(form._flushing, 0); + assert.strictEqual(form._fieldsSize, 0); + assert.ok(form instanceof EventEmitterStub); + assert.equal(form.constructor.name, 'IncomingForm'); + + (function testSimpleConstructor() { + gently.expect(EventEmitterStub, 'call'); + var form = IncomingForm(); + assert.ok(form instanceof IncomingForm); + })(); + + (function testSimpleConstructorShortcut() { + gently.expect(EventEmitterStub, 'call'); + var form = formidable(); + assert.ok(form instanceof IncomingForm); + })(); +}); + +test(function parse() { + var REQ = {headers: {}} + , emit = {}; + + gently.expect(form, 'writeHeaders', function(headers) { + assert.strictEqual(headers, REQ.headers); + }); + + var events = ['error', 'aborted', 'data', 'end']; + gently.expect(REQ, 'on', events.length, function(event, fn) { + assert.equal(event, events.shift()); + emit[event] = fn; + return this; + }); + + form.parse(REQ); + + (function testPause() { + gently.expect(REQ, 'pause'); + assert.strictEqual(form.pause(), true); + })(); + + (function testPauseCriticalException() { + form.ended = false; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'pause', function() { + throw ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + assert.strictEqual(form.pause(), false); + })(); + + (function testPauseHarmlessException() { + form.ended = true; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'pause', function() { + throw ERR; + }); + + assert.strictEqual(form.pause(), false); + })(); + + (function testResume() { + gently.expect(REQ, 'resume'); + assert.strictEqual(form.resume(), true); + })(); + + (function testResumeCriticalException() { + form.ended = false; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'resume', function() { + throw ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + assert.strictEqual(form.resume(), false); + })(); + + (function testResumeHarmlessException() { + form.ended = true; + + var ERR = new Error('dasdsa'); + gently.expect(REQ, 'resume', function() { + throw ERR; + }); + + assert.strictEqual(form.resume(), false); + })(); + + (function testEmitError() { + var ERR = new Error('something bad happened'); + gently.expect(form, '_error',function(err) { + assert.strictEqual(err, ERR); + }); + emit.error(ERR); + })(); + + (function testEmitAborted() { + gently.expect(form, 'emit',function(event) { + assert.equal(event, 'aborted'); + }); + + emit.aborted(); + })(); + + + (function testEmitData() { + var BUFFER = [1, 2, 3]; + gently.expect(form, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + }); + emit.data(BUFFER); + })(); + + (function testEmitEnd() { + form._parser = {}; + + (function testWithError() { + var ERR = new Error('haha'); + gently.expect(form._parser, 'end', function() { + return ERR; + }); + + gently.expect(form, '_error', function(err) { + assert.strictEqual(err, ERR); + }); + + emit.end(); + })(); + + (function testWithoutError() { + gently.expect(form._parser, 'end'); + emit.end(); + })(); + + (function testAfterError() { + form.error = true; + emit.end(); + })(); + })(); + + (function testWithCallback() { + gently.expect(EventEmitterStub, 'call'); + var form = new IncomingForm(), + REQ = {headers: {}}, + parseCalled = 0; + + gently.expect(form, 'writeHeaders'); + gently.expect(REQ, 'on', 4, function() { + return this; + }); + + gently.expect(form, 'on', 4, function(event, fn) { + if (event == 'field') { + fn('field1', 'foo'); + fn('field1', 'bar'); + fn('field2', 'nice'); + } + + if (event == 'file') { + fn('file1', '1'); + fn('file1', '2'); + fn('file2', '3'); + } + + if (event == 'end') { + fn(); + } + return this; + }); + + form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) { + assert.deepEqual(fields, {field1: 'bar', field2: 'nice'}); + assert.deepEqual(files, {file1: '2', file2: '3'}); + })); + + gently.expect(form, 'writeHeaders'); + gently.expect(REQ, 'on', 4, function() { + return this; + }); + + var ERR = new Error('test'); + gently.expect(form, 'on', 3, function(event, fn) { + if (event == 'field') { + fn('foo', 'bar'); + } + + if (event == 'error') { + fn(ERR); + gently.expect(form, 'on'); + } + return this; + }); + + form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) { + assert.strictEqual(err, ERR); + assert.deepEqual(fields, {foo: 'bar'}); + })); + })(); +}); + +test(function pause() { + assert.strictEqual(form.pause(), false); +}); + +test(function resume() { + assert.strictEqual(form.resume(), false); +}); + + +test(function writeHeaders() { + var HEADERS = {}; + gently.expect(form, '_parseContentLength'); + gently.expect(form, '_parseContentType'); + + form.writeHeaders(HEADERS); + assert.strictEqual(form.headers, HEADERS); +}); + +test(function write() { + var parser = {}, + BUFFER = [1, 2, 3]; + + form._parser = parser; + form.bytesExpected = 523423; + + (function testBasic() { + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, BUFFER.length); + assert.equal(bytesExpected, form.bytesExpected); + }); + + gently.expect(parser, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + return buffer.length; + }); + + assert.equal(form.write(BUFFER), BUFFER.length); + assert.equal(form.bytesReceived, BUFFER.length); + })(); + + (function testParserError() { + gently.expect(form, 'emit'); + + gently.expect(parser, 'write', function(buffer) { + assert.strictEqual(buffer, BUFFER); + return buffer.length - 1; + }); + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/parser error/i)); + }); + + assert.equal(form.write(BUFFER), BUFFER.length - 1); + assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length); + })(); + + (function testUninitialized() { + delete form._parser; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/unintialized parser/i)); + }); + form.write(BUFFER); + })(); +}); + +test(function parseContentType() { + var HEADERS = {}; + + form.headers = {'content-type': 'application/x-www-form-urlencoded'}; + gently.expect(form, '_initUrlencoded'); + form._parseContentType(); + + // accept anything that has 'urlencoded' in it + form.headers = {'content-type': 'broken-client/urlencoded-stupid'}; + gently.expect(form, '_initUrlencoded'); + form._parseContentType(); + + var BOUNDARY = '---------------------------57814261102167618332366269'; + form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY}; + + gently.expect(form, '_initMultipart', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + form._parseContentType(); + + (function testQuotedBoundary() { + form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'}; + + gently.expect(form, '_initMultipart', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + form._parseContentType(); + })(); + + (function testNoBoundary() { + form.headers = {'content-type': 'multipart/form-data'}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/no multipart boundary/i)); + }); + form._parseContentType(); + })(); + + (function testNoContentType() { + form.headers = {}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/no content-type/i)); + }); + form._parseContentType(); + })(); + + (function testUnknownContentType() { + form.headers = {'content-type': 'invalid'}; + + gently.expect(form, '_error', function(err) { + assert.ok(err.message.match(/unknown content-type/i)); + }); + form._parseContentType(); + })(); +}); + +test(function parseContentLength() { + var HEADERS = {}; + + form.headers = {}; + form._parseContentLength(); + assert.strictEqual(form.bytesReceived, null); + assert.strictEqual(form.bytesExpected, null); + + form.headers['content-length'] = '8'; + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, 0); + assert.equal(bytesExpected, 8); + }); + form._parseContentLength(); + assert.strictEqual(form.bytesReceived, 0); + assert.strictEqual(form.bytesExpected, 8); + + // JS can be evil, lets make sure we are not + form.headers['content-length'] = '08'; + gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { + assert.equal(event, 'progress'); + assert.equal(bytesReceived, 0); + assert.equal(bytesExpected, 8); + }); + form._parseContentLength(); + assert.strictEqual(form.bytesExpected, 8); +}); + +test(function _initMultipart() { + var BOUNDARY = '123', + PARSER; + + gently.expect(MultipartParserStub, 'new', function() { + PARSER = this; + }); + + gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) { + assert.equal(boundary, BOUNDARY); + }); + + form._initMultipart(BOUNDARY); + assert.equal(form.type, 'multipart'); + assert.strictEqual(form._parser, PARSER); + + (function testRegularField() { + var PART; + gently.expect(StreamStub, 'new', function() { + PART = this; + }); + + gently.expect(form, 'onPart', function(part) { + assert.strictEqual(part, PART); + assert.deepEqual + ( part.headers + , { 'content-disposition': 'form-data; name="field1"' + , 'foo': 'bar' + } + ); + assert.equal(part.name, 'field1'); + + var strings = ['hello', ' world']; + gently.expect(part, 'emit', 2, function(event, b) { + assert.equal(event, 'data'); + assert.equal(b.toString(), strings.shift()); + }); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'end'); + }); + }); + + PARSER.onPartBegin(); + PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10); + PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19); + PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14); + PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24); + PARSER.onHeaderEnd(); + PARSER.onHeaderField(new Buffer('foo'), 0, 3); + PARSER.onHeaderValue(new Buffer('bar'), 0, 3); + PARSER.onHeaderEnd(); + PARSER.onHeadersEnd(); + PARSER.onPartData(new Buffer('hello world'), 0, 5); + PARSER.onPartData(new Buffer('hello world'), 5, 11); + PARSER.onPartEnd(); + })(); + + (function testFileField() { + var PART; + gently.expect(StreamStub, 'new', function() { + PART = this; + }); + + gently.expect(form, 'onPart', function(part) { + assert.deepEqual + ( part.headers + , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"' + , 'content-type': 'text/plain' + } + ); + assert.equal(part.name, 'field2'); + assert.equal(part.filename, 'Sun"et.jpg'); + assert.equal(part.mime, 'text/plain'); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'data'); + assert.equal(b.toString(), '... contents of file1.txt ...'); + }); + + gently.expect(part, 'emit', function(event, b) { + assert.equal(event, 'end'); + }); + }); + + PARSER.onPartBegin(); + PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19); + PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85); + PARSER.onHeaderEnd(); + PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12); + PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10); + PARSER.onHeaderEnd(); + PARSER.onHeadersEnd(); + PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29); + PARSER.onPartEnd(); + })(); + + (function testEnd() { + gently.expect(form, '_maybeEnd'); + PARSER.onEnd(); + assert.ok(form.ended); + })(); +}); + +test(function _fileName() { + // TODO + return; +}); + +test(function _initUrlencoded() { + var PARSER; + + gently.expect(QuerystringParserStub, 'new', function() { + PARSER = this; + }); + + form._initUrlencoded(); + assert.equal(form.type, 'urlencoded'); + assert.strictEqual(form._parser, PARSER); + + (function testOnField() { + var KEY = 'KEY', VAL = 'VAL'; + gently.expect(form, 'emit', function(field, key, val) { + assert.equal(field, 'field'); + assert.equal(key, KEY); + assert.equal(val, VAL); + }); + + PARSER.onField(KEY, VAL); + })(); + + (function testOnEnd() { + gently.expect(form, '_maybeEnd'); + + PARSER.onEnd(); + assert.equal(form.ended, true); + })(); +}); + +test(function _error() { + var ERR = new Error('bla'); + + gently.expect(form, 'pause'); + gently.expect(form, 'emit', function(event, err) { + assert.equal(event, 'error'); + assert.strictEqual(err, ERR); + }); + + form._error(ERR); + assert.strictEqual(form.error, ERR); + + // make sure _error only does its thing once + form._error(ERR); +}); + +test(function onPart() { + var PART = {}; + gently.expect(form, 'handlePart', function(part) { + assert.strictEqual(part, PART); + }); + + form.onPart(PART); +}); + +test(function handlePart() { + (function testUtf8Field() { + var PART = new events.EventEmitter(); + PART.name = 'my_field'; + + gently.expect(form, 'emit', function(event, field, value) { + assert.equal(event, 'field'); + assert.equal(field, 'my_field'); + assert.equal(value, 'hello world: €'); + }); + + form.handlePart(PART); + PART.emit('data', new Buffer('hello')); + PART.emit('data', new Buffer(' world: ')); + PART.emit('data', new Buffer([0xE2])); + PART.emit('data', new Buffer([0x82, 0xAC])); + PART.emit('end'); + })(); + + (function testBinaryField() { + var PART = new events.EventEmitter(); + PART.name = 'my_field2'; + + gently.expect(form, 'emit', function(event, field, value) { + assert.equal(event, 'field'); + assert.equal(field, 'my_field2'); + assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary')); + }); + + form.encoding = 'binary'; + form.handlePart(PART); + PART.emit('data', new Buffer('hello')); + PART.emit('data', new Buffer(' world: ')); + PART.emit('data', new Buffer([0xE2])); + PART.emit('data', new Buffer([0x82, 0xAC])); + PART.emit('end'); + })(); + + (function testFieldSize() { + form.maxFieldsSize = 8; + var PART = new events.EventEmitter(); + PART.name = 'my_field'; + + gently.expect(form, '_error', function(err) { + assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data'); + }); + + form.handlePart(PART); + form._fieldsSize = 1; + PART.emit('data', new Buffer(7)); + PART.emit('data', new Buffer(1)); + })(); + + (function testFilePart() { + var PART = new events.EventEmitter(), + FILE = new events.EventEmitter(), + PATH = '/foo/bar'; + + PART.name = 'my_file'; + PART.filename = 'sweet.txt'; + PART.mime = 'sweet.txt'; + + gently.expect(form, '_uploadPath', function(filename) { + assert.equal(filename, PART.filename); + return PATH; + }); + + gently.expect(FileStub, 'new', function(properties) { + assert.equal(properties.path, PATH); + assert.equal(properties.name, PART.filename); + assert.equal(properties.type, PART.mime); + FILE = this; + + gently.expect(form, 'emit', function (event, field, file) { + assert.equal(event, 'fileBegin'); + assert.strictEqual(field, PART.name); + assert.strictEqual(file, FILE); + }); + + gently.expect(FILE, 'open'); + }); + + form.handlePart(PART); + assert.equal(form._flushing, 1); + + var BUFFER; + gently.expect(form, 'pause'); + gently.expect(FILE, 'write', function(buffer, cb) { + assert.strictEqual(buffer, BUFFER); + gently.expect(form, 'resume'); + // @todo handle cb(new Err) + cb(); + }); + + PART.emit('data', BUFFER = new Buffer('test')); + + gently.expect(FILE, 'end', function(cb) { + gently.expect(form, 'emit', function(event, field, file) { + assert.equal(event, 'file'); + assert.strictEqual(file, FILE); + }); + + gently.expect(form, '_maybeEnd'); + + cb(); + assert.equal(form._flushing, 0); + }); + + PART.emit('end'); + })(); +}); + +test(function _uploadPath() { + (function testUniqueId() { + var UUID_A, UUID_B; + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { + assert.equal(uploadDir, form.uploadDir); + UUID_A = uuid; + }); + form._uploadPath(); + + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { + UUID_B = uuid; + }); + form._uploadPath(); + + assert.notEqual(UUID_A, UUID_B); + })(); + + (function testFileExtension() { + form.keepExtensions = true; + var FILENAME = 'foo.jpg', + EXT = '.bar'; + + gently.expect(GENTLY.hijacked.path, 'extname', function(filename) { + assert.equal(filename, FILENAME); + gently.restore(path, 'extname'); + + return EXT; + }); + + gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) { + assert.equal(path.extname(name), EXT); + }); + form._uploadPath(FILENAME); + })(); +}); + +test(function _maybeEnd() { + gently.expect(form, 'emit', 0); + form._maybeEnd(); + + form.ended = true; + form._flushing = 1; + form._maybeEnd(); + + gently.expect(form, 'emit', function(event) { + assert.equal(event, 'end'); + }); + + form.ended = true; + form._flushing = 0; + form._maybeEnd(); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js new file mode 100644 index 0000000..d8dc968 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js @@ -0,0 +1,50 @@ +var common = require('../common'); +var multipartParser = require(common.lib + '/multipart_parser'), + MultipartParser = multipartParser.MultipartParser, + events = require('events'), + Buffer = require('buffer').Buffer, + parser; + +function test(test) { + parser = new MultipartParser(); + test(); +} + +test(function constructor() { + assert.equal(parser.boundary, null); + assert.equal(parser.state, 0); + assert.equal(parser.flags, 0); + assert.equal(parser.boundaryChars, null); + assert.equal(parser.index, null); + assert.equal(parser.lookbehind, null); + assert.equal(parser.constructor.name, 'MultipartParser'); +}); + +test(function initWithBoundary() { + var boundary = 'abc'; + parser.initWithBoundary(boundary); + assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]); + assert.equal(parser.state, multipartParser.START); + + assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true}); +}); + +test(function parserError() { + var boundary = 'abc', + buffer = new Buffer(5); + + parser.initWithBoundary(boundary); + buffer.write('--ad', 'ascii', 0); + assert.equal(parser.write(buffer), 3); +}); + +test(function end() { + (function testError() { + assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain()); + })(); + + (function testRegular() { + parser.state = multipartParser.END; + assert.strictEqual(parser.end(), undefined); + })(); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js new file mode 100644 index 0000000..54d3e2d --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js @@ -0,0 +1,45 @@ +var common = require('../common'); +var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser, + Buffer = require('buffer').Buffer, + gently, + parser; + +function test(test) { + gently = new Gently(); + parser = new QuerystringParser(); + test(); + gently.verify(test.name); +} + +test(function constructor() { + assert.equal(parser.buffer, ''); + assert.equal(parser.constructor.name, 'QuerystringParser'); +}); + +test(function write() { + var a = new Buffer('a=1'); + assert.equal(parser.write(a), a.length); + + var b = new Buffer('&b=2'); + parser.write(b); + assert.equal(parser.buffer, a + b); +}); + +test(function end() { + var FIELDS = {a: ['b', {c: 'd'}], e: 'f'}; + + gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) { + assert.equal(str, parser.buffer); + return FIELDS; + }); + + gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) { + assert.deepEqual(FIELDS[key], val); + }); + + gently.expect(parser, 'onEnd'); + + parser.buffer = 'my buffer'; + parser.end(); + assert.equal(parser.buffer, ''); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js new file mode 100644 index 0000000..479e46d --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js @@ -0,0 +1,75 @@ +var common = require('../common'); +var BOUNDARY = '---------------------------10102754414578508781458777923', + FIXTURE = TEST_FIXTURES+'/multi_video.upload', + fs = require('fs'), + util = require(common.lib + '/util'), + http = require('http'), + formidable = require(common.lib + '/index'), + server = http.createServer(); + +server.on('request', function(req, res) { + var form = new formidable.IncomingForm(), + uploads = {}; + + form.uploadDir = TEST_TMP; + form.hash = 'sha1'; + form.parse(req); + + form + .on('fileBegin', function(field, file) { + assert.equal(field, 'upload'); + + var tracker = {file: file, progress: [], ended: false}; + uploads[file.filename] = tracker; + file + .on('progress', function(bytesReceived) { + tracker.progress.push(bytesReceived); + assert.equal(bytesReceived, file.length); + }) + .on('end', function() { + tracker.ended = true; + }); + }) + .on('field', function(field, value) { + assert.equal(field, 'title'); + assert.equal(value, ''); + }) + .on('file', function(field, file) { + assert.equal(field, 'upload'); + assert.strictEqual(uploads[file.filename].file, file); + }) + .on('end', function() { + assert.ok(uploads['shortest_video.flv']); + assert.ok(uploads['shortest_video.flv'].ended); + assert.ok(uploads['shortest_video.flv'].progress.length > 3); + assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a'); + assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length); + assert.ok(uploads['shortest_video.mp4']); + assert.ok(uploads['shortest_video.mp4'].ended); + assert.ok(uploads['shortest_video.mp4'].progress.length > 3); + assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f'); + + server.close(); + res.writeHead(200); + res.end('good'); + }); +}); + +server.listen(TEST_PORT, function() { + var client = http.createClient(TEST_PORT), + stat = fs.statSync(FIXTURE), + headers = { + 'content-type': 'multipart/form-data; boundary='+BOUNDARY, + 'content-length': stat.size, + } + request = client.request('POST', '/', headers), + fixture = new fs.ReadStream(FIXTURE); + + fixture + .on('data', function(b) { + request.write(b); + }) + .on('end', function() { + request.end(); + }); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js new file mode 100755 index 0000000..50b2361 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('urun')(__dirname) diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js new file mode 100644 index 0000000..fe2ac1c --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js @@ -0,0 +1,63 @@ +var common = require('../common'); +var test = require('utest'); +var assert = common.assert; +var IncomingForm = common.require('incoming_form').IncomingForm; +var path = require('path'); + +var form; +test('IncomingForm', { + before: function() { + form = new IncomingForm(); + }, + + '#_fileName with regular characters': function() { + var filename = 'foo.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'foo.txt'); + }, + + '#_fileName with unescaped quote': function() { + var filename = 'my".txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); + }, + + '#_fileName with escaped quote': function() { + var filename = 'my%22.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); + }, + + '#_fileName with bad quote and additional sub-header': function() { + var filename = 'my".txt'; + var header = makeHeader(filename) + '; foo="bar"'; + assert.equal(form._fileName(header), filename); + }, + + '#_fileName with semicolon': function() { + var filename = 'my;.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my;.txt'); + }, + + '#_fileName with utf8 character': function() { + var filename = 'my☃.txt'; + assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt'); + }, + + '#_uploadPath strips harmful characters from extension when keepExtensions': function() { + form.keepExtensions = true; + + var ext = path.extname(form._uploadPath('fine.jpg?foo=bar')); + assert.equal(ext, '.jpg'); + + var ext = path.extname(form._uploadPath('fine?foo=bar')); + assert.equal(ext, ''); + + var ext = path.extname(form._uploadPath('super.cr2+dsad')); + assert.equal(ext, '.cr2'); + + var ext = path.extname(form._uploadPath('super.bar')); + assert.equal(ext, '.bar'); + }, +}); + +function makeHeader(filename) { + return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"'; +} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js new file mode 100644 index 0000000..9f1cef8 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js @@ -0,0 +1,47 @@ +var http = require('http'); +var fs = require('fs'); +var connections = 0; + +var server = http.createServer(function(req, res) { + var socket = req.socket; + console.log('Request: %s %s -> %s', req.method, req.url, socket.filename); + + req.on('end', function() { + if (req.url !== '/') { + res.end(JSON.stringify({ + method: req.method, + url: req.url, + filename: socket.filename, + })); + return; + } + + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    ' + ); + }); +}); + +server.on('connection', function(socket) { + connections++; + + socket.id = connections; + socket.filename = 'connection-' + socket.id + '.http'; + socket.file = fs.createWriteStream(socket.filename); + socket.pipe(socket.file); + + console.log('--> %s', socket.filename); + socket.on('close', function() { + console.log('<-- %s', socket.filename); + }); +}); + +var port = process.env.PORT || 8080; +server.listen(port, function() { + console.log('Recording connections on port %s', port); +}); diff --git a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/express/node_modules/connect/node_modules/pause/History.md b/node_modules/express/node_modules/connect/node_modules/pause/History.md new file mode 100644 index 0000000..c8aa68f --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/node_modules/express/node_modules/connect/node_modules/pause/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/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/connect/node_modules/pause/Readme.md b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md new file mode 100644 index 0000000..1cdd68a --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md @@ -0,0 +1,29 @@ + +# pause + + Pause streams... + +## 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/connect/node_modules/pause/index.js b/node_modules/express/node_modules/connect/node_modules/pause/index.js new file mode 100644 index 0000000..1b7b379 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/index.js @@ -0,0 +1,29 @@ + +module.exports = function(obj){ + var onData + , onEnd + , events = []; + + // buffer data + obj.on('data', onData = function(data, encoding){ + events.push(['data', data, encoding]); + }); + + // buffer end + obj.on('end', onEnd = function(data, encoding){ + events.push(['end', data, encoding]); + }); + + return { + end: function(){ + obj.removeListener('data', onData); + obj.removeListener('end', onEnd); + }, + resume: function(){ + this.end(); + for (var i = 0, len = events.length; i < len; ++i) { + obj.emit.apply(obj, events[i]); + } + } + }; +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/pause/package.json b/node_modules/express/node_modules/connect/node_modules/pause/package.json new file mode 100644 index 0000000..ae472ac --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/pause/package.json @@ -0,0 +1,13 @@ +{ + "name": "pause", + "version": "0.0.1", + "description": "Pause streams...", + "keywords": [], + "author": "TJ Holowaychuk ", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index" +} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules new file mode 100644 index 0000000..49e31da --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules @@ -0,0 +1,6 @@ +[submodule "support/expresso"] + path = support/expresso + url = git://github.com/visionmedia/expresso.git +[submodule "support/should"] + path = support/should + url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml new file mode 100644 index 0000000..2c0a8f6 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.4 \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/History.md b/node_modules/express/node_modules/connect/node_modules/qs/History.md new file mode 100644 index 0000000..1feef45 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/History.md @@ -0,0 +1,83 @@ + +0.5.1 / 2012-09-18 +================== + + * fix encoded `=`. Closes #43 + +0.5.0 / 2012-05-04 +================== + + * Added component support + +0.4.2 / 2012-02-08 +================== + + * Fixed: ensure objects are created when appropriate not arrays [aheckmann] + +0.4.1 / 2012-01-26 +================== + + * Fixed stringify()ing numbers. Closes #23 + +0.4.0 / 2011-11-21 +================== + + * Allow parsing of an existing object (for `bodyParser()`) [jackyz] + * Replaced expresso with mocha + +0.3.2 / 2011-11-08 +================== + + * Fixed global variable leak + +0.3.1 / 2011-08-17 +================== + + * Added `try/catch` around malformed uri components + * Add test coverage for Array native method bleed-though + +0.3.0 / 2011-07-19 +================== + + * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] + +0.2.0 / 2011-06-29 +================== + + * Added `qs.stringify()` [Cory Forsyth] + +0.1.0 / 2011-04-13 +================== + + * Added jQuery-ish array support + +0.0.7 / 2011-03-13 +================== + + * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] + allows for convenient `qs.parse(url.parse(str).query)` + +0.0.6 / 2011-02-14 +================== + + * Fixed; support for implicit arrays + +0.0.4 / 2011-02-09 +================== + + * Fixed `+` as a space + +0.0.3 / 2011-02-08 +================== + + * Fixed case when right-hand value contains "]" + +0.0.2 / 2011-02-07 +================== + + * Fixed "=" presence in key + +0.0.1 / 2011-02-07 +================== + + * Initial release \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Makefile b/node_modules/express/node_modules/connect/node_modules/qs/Makefile new file mode 100644 index 0000000..0a21cf7 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/Makefile @@ -0,0 +1,12 @@ + +test/browser/qs.js: querystring.js + component build package.json test/browser/qs + +querystring.js: lib/head.js lib/querystring.js lib/tail.js + cat $^ > $@ + +test: + @./node_modules/.bin/mocha \ + --ui bdd + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md new file mode 100644 index 0000000..27e54a4 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md @@ -0,0 +1,58 @@ +# node-querystring + + query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. + +## Installation + + $ npm install qs + +## Examples + +```js +var qs = require('qs'); + +qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); +// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } + +qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) +// => user[name]=Tobi&user[email]=tobi%40learnboost.com +``` + +## Testing + +Install dev dependencies: + + $ npm install -d + +and execute: + + $ make test + +browser: + + $ open test/browser/index.html + +## License + +(The MIT License) + +Copyright (c) 2010 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/connect/node_modules/qs/benchmark.js b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js new file mode 100644 index 0000000..97e2c93 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js @@ -0,0 +1,17 @@ + +var qs = require('./'); + +var times = 100000 + , start = new Date + , n = times; + +console.log('times: %d', times); + +while (n--) qs.parse('foo=bar'); +console.log('simple: %dms', new Date - start); + +var start = new Date + , n = times; + +while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); +console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/component.json b/node_modules/express/node_modules/connect/node_modules/qs/component.json new file mode 100644 index 0000000..ba34ead --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/component.json @@ -0,0 +1,6 @@ +{ + "name": "querystring", + "description": "Querystring parser / stringifier with nesting support", + "keywords": ["querystring", "query", "parser"], + "main": "lib/querystring.js" +} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/examples.js b/node_modules/express/node_modules/connect/node_modules/qs/examples.js new file mode 100644 index 0000000..27617b7 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/examples.js @@ -0,0 +1,51 @@ + +/** + * Module dependencies. + */ + +var qs = require('./'); + +var obj = qs.parse('foo'); +console.log(obj) + +var obj = qs.parse('foo=bar=baz'); +console.log(obj) + +var obj = qs.parse('users[]'); +console.log(obj) + +var obj = qs.parse('name=tj&email=tj@vision-media.ca'); +console.log(obj) + +var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); +console.log(obj) + +var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); +console.log(obj) + +var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); +console.log(obj) + +var obj = qs.parse('a=a&a=b&a=c'); +console.log(obj) + +var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); +console.log(obj) + +var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); +console.log(obj) + +var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[1]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[]=TJ'); +console.log(obj) + +var obj = qs.parse('user[0]=tj&user[foo]=TJ'); +console.log(obj) + +var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); +console.log(str); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/index.js b/node_modules/express/node_modules/connect/node_modules/qs/index.js new file mode 100644 index 0000000..d177d20 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js new file mode 100644 index 0000000..55d3817 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js @@ -0,0 +1 @@ +;(function(){ diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js new file mode 100644 index 0000000..d3689bb --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js @@ -0,0 +1,262 @@ + +/** + * Object#toString() ref for stringify(). + */ + +var toString = Object.prototype.toString; + +/** + * Cache non-integer test regexp. + */ + +var isint = /^[0-9]+$/; + +function promote(parent, key) { + if (parent[key].length == 0) return parent[key] = {}; + var t = {}; + for (var i in parent[key]) t[i] = parent[key][i]; + parent[key] = t; + return t; +} + +function parse(parts, parent, key, val) { + var part = parts.shift(); + // end + if (!part) { + if (Array.isArray(parent[key])) { + parent[key].push(val); + } else if ('object' == typeof parent[key]) { + parent[key] = val; + } else if ('undefined' == typeof parent[key]) { + parent[key] = val; + } else { + parent[key] = [parent[key], val]; + } + // array + } else { + var obj = parent[key] = parent[key] || []; + if (']' == part) { + if (Array.isArray(obj)) { + if ('' != val) obj.push(val); + } else if ('object' == typeof obj) { + obj[Object.keys(obj).length] = val; + } else { + obj = parent[key] = [parent[key], val]; + } + // prop + } else if (~part.indexOf(']')) { + part = part.substr(0, part.length - 1); + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + // key + } else { + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + } + } +} + +/** + * Merge parent key/val pair. + */ + +function merge(parent, key, val){ + if (~key.indexOf(']')) { + var parts = key.split('[') + , len = parts.length + , last = len - 1; + parse(parts, parent, 'base', val); + // optimize + } else { + if (!isint.test(key) && Array.isArray(parent.base)) { + var t = {}; + for (var k in parent.base) t[k] = parent.base[k]; + parent.base = t; + } + set(parent.base, key, val); + } + + return parent; +} + +/** + * Parse the given obj. + */ + +function parseObject(obj){ + var ret = { base: {} }; + Object.keys(obj).forEach(function(name){ + merge(ret, name, obj[name]); + }); + return ret.base; +} + +/** + * Parse the given str. + */ + +function parseString(str){ + return String(str) + .split('&') + .reduce(function(ret, pair){ + var eql = pair.indexOf('=') + , brace = lastBraceInKey(pair) + , key = pair.substr(0, brace || eql) + , val = pair.substr(brace || eql, pair.length) + , val = val.substr(val.indexOf('=') + 1, val.length); + + // ?foo + if ('' == key) key = pair, val = ''; + + return merge(ret, decode(key), decode(val)); + }, { base: {} }).base; +} + +/** + * Parse the given query `str` or `obj`, returning an object. + * + * @param {String} str | {Object} obj + * @return {Object} + * @api public + */ + +exports.parse = function(str){ + if (null == str || '' == str) return {}; + return 'object' == typeof str + ? parseObject(str) + : parseString(str); +}; + +/** + * Turn the given `obj` into a query string + * + * @param {Object} obj + * @return {String} + * @api public + */ + +var stringify = exports.stringify = function(obj, prefix) { + if (Array.isArray(obj)) { + return stringifyArray(obj, prefix); + } else if ('[object Object]' == toString.call(obj)) { + return stringifyObject(obj, prefix); + } else if ('string' == typeof obj) { + return stringifyString(obj, prefix); + } else { + return prefix + '=' + obj; + } +}; + +/** + * Stringify the given `str`. + * + * @param {String} str + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyString(str, prefix) { + if (!prefix) throw new TypeError('stringify expects an object'); + return prefix + '=' + encodeURIComponent(str); +} + +/** + * Stringify the given `arr`. + * + * @param {Array} arr + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyArray(arr, prefix) { + var ret = []; + if (!prefix) throw new TypeError('stringify expects an object'); + for (var i = 0; i < arr.length; i++) { + ret.push(stringify(arr[i], prefix + '['+i+']')); + } + return ret.join('&'); +} + +/** + * Stringify the given `obj`. + * + * @param {Object} obj + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyObject(obj, prefix) { + var ret = [] + , keys = Object.keys(obj) + , key; + + for (var i = 0, len = keys.length; i < len; ++i) { + key = keys[i]; + ret.push(stringify(obj[key], prefix + ? prefix + '[' + encodeURIComponent(key) + ']' + : encodeURIComponent(key))); + } + + return ret.join('&'); +} + +/** + * Set `obj`'s `key` to `val` respecting + * the weird and wonderful syntax of a qs, + * where "foo=bar&foo=baz" becomes an array. + * + * @param {Object} obj + * @param {String} key + * @param {String} val + * @api private + */ + +function set(obj, key, val) { + var v = obj[key]; + if (undefined === v) { + obj[key] = val; + } else if (Array.isArray(v)) { + v.push(val); + } else { + obj[key] = [v, val]; + } +} + +/** + * Locate last brace in `str` within the key. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function lastBraceInKey(str) { + var len = str.length + , brace + , c; + for (var i = 0; i < len; ++i) { + c = str[i]; + if (']' == c) brace = false; + if ('[' == c) brace = true; + if ('=' == c && !brace) return i; + } +} + +/** + * Decode `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +function decode(str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (err) { + return str; + } +} diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js new file mode 100644 index 0000000..158693a --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js @@ -0,0 +1 @@ +})(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/package.json b/node_modules/express/node_modules/connect/node_modules/qs/package.json new file mode 100644 index 0000000..6a4022e --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/package.json @@ -0,0 +1,22 @@ +{ + "name": "qs", + "description": "querystring parser", + "version": "0.5.1", + "keywords": ["query string", "parser", "component"], + "repository": { + "type" : "git", + "url" : "git://github.com/visionmedia/node-querystring.git" + }, + "devDependencies": { + "mocha": "*" + , "expect.js": "*" + }, + "component": { + "scripts": { + "querystring": "querystring.js" + } + }, + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "main": "index", + "engines": { "node": "*" } +} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js new file mode 100644 index 0000000..7466b06 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js @@ -0,0 +1,254 @@ +;(function(){ + +/** + * Object#toString() ref for stringify(). + */ + +var toString = Object.prototype.toString; + +/** + * Cache non-integer test regexp. + */ + +var isint = /^[0-9]+$/; + +function promote(parent, key) { + if (parent[key].length == 0) return parent[key] = {}; + var t = {}; + for (var i in parent[key]) t[i] = parent[key][i]; + parent[key] = t; + return t; +} + +function parse(parts, parent, key, val) { + var part = parts.shift(); + // end + if (!part) { + if (Array.isArray(parent[key])) { + parent[key].push(val); + } else if ('object' == typeof parent[key]) { + parent[key] = val; + } else if ('undefined' == typeof parent[key]) { + parent[key] = val; + } else { + parent[key] = [parent[key], val]; + } + // array + } else { + var obj = parent[key] = parent[key] || []; + if (']' == part) { + if (Array.isArray(obj)) { + if ('' != val) obj.push(val); + } else if ('object' == typeof obj) { + obj[Object.keys(obj).length] = val; + } else { + obj = parent[key] = [parent[key], val]; + } + // prop + } else if (~part.indexOf(']')) { + part = part.substr(0, part.length - 1); + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + // key + } else { + if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + } + } +} + +/** + * Merge parent key/val pair. + */ + +function merge(parent, key, val){ + if (~key.indexOf(']')) { + var parts = key.split('[') + , len = parts.length + , last = len - 1; + parse(parts, parent, 'base', val); + // optimize + } else { + if (!isint.test(key) && Array.isArray(parent.base)) { + var t = {}; + for (var k in parent.base) t[k] = parent.base[k]; + parent.base = t; + } + set(parent.base, key, val); + } + + return parent; +} + +/** + * Parse the given obj. + */ + +function parseObject(obj){ + var ret = { base: {} }; + Object.keys(obj).forEach(function(name){ + merge(ret, name, obj[name]); + }); + return ret.base; +} + +/** + * Parse the given str. + */ + +function parseString(str){ + return String(str) + .split('&') + .reduce(function(ret, pair){ + try{ + pair = decodeURIComponent(pair.replace(/\+/g, ' ')); + } catch(e) { + // ignore + } + + var eql = pair.indexOf('=') + , brace = lastBraceInKey(pair) + , key = pair.substr(0, brace || eql) + , val = pair.substr(brace || eql, pair.length) + , val = val.substr(val.indexOf('=') + 1, val.length); + + // ?foo + if ('' == key) key = pair, val = ''; + + return merge(ret, key, val); + }, { base: {} }).base; +} + +/** + * Parse the given query `str` or `obj`, returning an object. + * + * @param {String} str | {Object} obj + * @return {Object} + * @api public + */ + +exports.parse = function(str){ + if (null == str || '' == str) return {}; + return 'object' == typeof str + ? parseObject(str) + : parseString(str); +}; + +/** + * Turn the given `obj` into a query string + * + * @param {Object} obj + * @return {String} + * @api public + */ + +var stringify = exports.stringify = function(obj, prefix) { + if (Array.isArray(obj)) { + return stringifyArray(obj, prefix); + } else if ('[object Object]' == toString.call(obj)) { + return stringifyObject(obj, prefix); + } else if ('string' == typeof obj) { + return stringifyString(obj, prefix); + } else { + return prefix + '=' + obj; + } +}; + +/** + * Stringify the given `str`. + * + * @param {String} str + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyString(str, prefix) { + if (!prefix) throw new TypeError('stringify expects an object'); + return prefix + '=' + encodeURIComponent(str); +} + +/** + * Stringify the given `arr`. + * + * @param {Array} arr + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyArray(arr, prefix) { + var ret = []; + if (!prefix) throw new TypeError('stringify expects an object'); + for (var i = 0; i < arr.length; i++) { + ret.push(stringify(arr[i], prefix + '['+i+']')); + } + return ret.join('&'); +} + +/** + * Stringify the given `obj`. + * + * @param {Object} obj + * @param {String} prefix + * @return {String} + * @api private + */ + +function stringifyObject(obj, prefix) { + var ret = [] + , keys = Object.keys(obj) + , key; + + for (var i = 0, len = keys.length; i < len; ++i) { + key = keys[i]; + ret.push(stringify(obj[key], prefix + ? prefix + '[' + encodeURIComponent(key) + ']' + : encodeURIComponent(key))); + } + + return ret.join('&'); +} + +/** + * Set `obj`'s `key` to `val` respecting + * the weird and wonderful syntax of a qs, + * where "foo=bar&foo=baz" becomes an array. + * + * @param {Object} obj + * @param {String} key + * @param {String} val + * @api private + */ + +function set(obj, key, val) { + var v = obj[key]; + if (undefined === v) { + obj[key] = val; + } else if (Array.isArray(v)) { + v.push(val); + } else { + obj[key] = [v, val]; + } +} + +/** + * Locate last brace in `str` within the key. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function lastBraceInKey(str) { + var len = str.length + , brace + , c; + for (var i = 0; i < len; ++i) { + c = str[i]; + if (']' == c) brace = false; + if ('[' == c) brace = true; + if ('=' == c && !brace) return i; + } +} +})(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js new file mode 100644 index 0000000..76aa4e8 --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js @@ -0,0 +1,1202 @@ + +(function (global, module) { + + if ('undefined' == typeof module) { + var module = { exports: {} } + , exports = module.exports + } + + /** + * Exports. + */ + + module.exports = expect; + expect.Assertion = Assertion; + + /** + * Exports version. + */ + + expect.version = '0.1.2'; + + /** + * Possible assertion flags. + */ + + var flags = { + not: ['to', 'be', 'have', 'include', 'only'] + , to: ['be', 'have', 'include', 'only', 'not'] + , only: ['have'] + , have: ['own'] + , be: ['an'] + }; + + function expect (obj) { + return new Assertion(obj); + } + + /** + * Constructor + * + * @api private + */ + + function Assertion (obj, flag, parent) { + this.obj = obj; + this.flags = {}; + + if (undefined != parent) { + this.flags[flag] = true; + + for (var i in parent.flags) { + if (parent.flags.hasOwnProperty(i)) { + this.flags[i] = true; + } + } + } + + var $flags = flag ? flags[flag] : keys(flags) + , self = this + + if ($flags) { + for (var i = 0, l = $flags.length; i < l; i++) { + // avoid recursion + if (this.flags[$flags[i]]) continue; + + var name = $flags[i] + , assertion = new Assertion(this.obj, name, this) + + if ('function' == typeof Assertion.prototype[name]) { + // clone the function, make sure we dont touch the prot reference + var old = this[name]; + this[name] = function () { + return old.apply(self, arguments); + } + + for (var fn in Assertion.prototype) { + if (Assertion.prototype.hasOwnProperty(fn) && fn != name) { + this[name][fn] = bind(assertion[fn], assertion); + } + } + } else { + this[name] = assertion; + } + } + } + }; + + /** + * Performs an assertion + * + * @api private + */ + + Assertion.prototype.assert = function (truth, msg, error) { + var msg = this.flags.not ? error : msg + , ok = this.flags.not ? !truth : truth; + + if (!ok) { + throw new Error(msg); + } + + this.and = new Assertion(this.obj); + }; + + /** + * Check if the value is truthy + * + * @api public + */ + + Assertion.prototype.ok = function () { + this.assert( + !!this.obj + , 'expected ' + i(this.obj) + ' to be truthy' + , 'expected ' + i(this.obj) + ' to be falsy'); + }; + + /** + * Assert that the function throws. + * + * @param {Function|RegExp} callback, or regexp to match error string against + * @api public + */ + + Assertion.prototype.throwError = + Assertion.prototype.throwException = function (fn) { + expect(this.obj).to.be.a('function'); + + var thrown = false + , not = this.flags.not + + try { + this.obj(); + } catch (e) { + if ('function' == typeof fn) { + fn(e); + } else if ('object' == typeof fn) { + var subject = 'string' == typeof e ? e : e.message; + if (not) { + expect(subject).to.not.match(fn); + } else { + expect(subject).to.match(fn); + } + } + thrown = true; + } + + if ('object' == typeof fn && not) { + // in the presence of a matcher, ensure the `not` only applies to + // the matching. + this.flags.not = false; + } + + var name = this.obj.name || 'fn'; + this.assert( + thrown + , 'expected ' + name + ' to throw an exception' + , 'expected ' + name + ' not to throw an exception'); + }; + + /** + * Checks if the array is empty. + * + * @api public + */ + + Assertion.prototype.empty = function () { + var expectation; + + if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) { + if ('number' == typeof this.obj.length) { + expectation = !this.obj.length; + } else { + expectation = !keys(this.obj).length; + } + } else { + if ('string' != typeof this.obj) { + expect(this.obj).to.be.an('object'); + } + + expect(this.obj).to.have.property('length'); + expectation = !this.obj.length; + } + + this.assert( + expectation + , 'expected ' + i(this.obj) + ' to be empty' + , 'expected ' + i(this.obj) + ' to not be empty'); + return this; + }; + + /** + * Checks if the obj exactly equals another. + * + * @api public + */ + + Assertion.prototype.be = + Assertion.prototype.equal = function (obj) { + this.assert( + obj === this.obj + , 'expected ' + i(this.obj) + ' to equal ' + i(obj) + , 'expected ' + i(this.obj) + ' to not equal ' + i(obj)); + return this; + }; + + /** + * Checks if the obj sortof equals another. + * + * @api public + */ + + Assertion.prototype.eql = function (obj) { + this.assert( + expect.eql(obj, this.obj) + , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) + , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj)); + return this; + }; + + /** + * Assert within start to finish (inclusive). + * + * @param {Number} start + * @param {Number} finish + * @api public + */ + + Assertion.prototype.within = function (start, finish) { + var range = start + '..' + finish; + this.assert( + this.obj >= start && this.obj <= finish + , 'expected ' + i(this.obj) + ' to be within ' + range + , 'expected ' + i(this.obj) + ' to not be within ' + range); + return this; + }; + + /** + * Assert typeof / instance of + * + * @api public + */ + + Assertion.prototype.a = + Assertion.prototype.an = function (type) { + if ('string' == typeof type) { + // proper english in error msg + var n = /^[aeiou]/.test(type) ? 'n' : ''; + + // typeof with support for 'array' + this.assert( + 'array' == type ? isArray(this.obj) : + 'object' == type + ? 'object' == typeof this.obj && null !== this.obj + : type == typeof this.obj + , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type + , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type); + } else { + // instanceof + var name = type.name || 'supplied constructor'; + this.assert( + this.obj instanceof type + , 'expected ' + i(this.obj) + ' to be an instance of ' + name + , 'expected ' + i(this.obj) + ' not to be an instance of ' + name); + } + + return this; + }; + + /** + * Assert numeric value above _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.greaterThan = + Assertion.prototype.above = function (n) { + this.assert( + this.obj > n + , 'expected ' + i(this.obj) + ' to be above ' + n + , 'expected ' + i(this.obj) + ' to be below ' + n); + return this; + }; + + /** + * Assert numeric value below _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.lessThan = + Assertion.prototype.below = function (n) { + this.assert( + this.obj < n + , 'expected ' + i(this.obj) + ' to be below ' + n + , 'expected ' + i(this.obj) + ' to be above ' + n); + return this; + }; + + /** + * Assert string value matches _regexp_. + * + * @param {RegExp} regexp + * @api public + */ + + Assertion.prototype.match = function (regexp) { + this.assert( + regexp.exec(this.obj) + , 'expected ' + i(this.obj) + ' to match ' + regexp + , 'expected ' + i(this.obj) + ' not to match ' + regexp); + return this; + }; + + /** + * Assert property "length" exists and has value of _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.length = function (n) { + expect(this.obj).to.have.property('length'); + var len = this.obj.length; + this.assert( + n == len + , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len + , 'expected ' + i(this.obj) + ' to not have a length of ' + len); + return this; + }; + + /** + * Assert property _name_ exists, with optional _val_. + * + * @param {String} name + * @param {Mixed} val + * @api public + */ + + Assertion.prototype.property = function (name, val) { + if (this.flags.own) { + this.assert( + Object.prototype.hasOwnProperty.call(this.obj, name) + , 'expected ' + i(this.obj) + ' to have own property ' + i(name) + , 'expected ' + i(this.obj) + ' to not have own property ' + i(name)); + return this; + } + + if (this.flags.not && undefined !== val) { + if (undefined === this.obj[name]) { + throw new Error(i(this.obj) + ' has no property ' + i(name)); + } + } else { + var hasProp; + try { + hasProp = name in this.obj + } catch (e) { + hasProp = undefined !== this.obj[name] + } + + this.assert( + hasProp + , 'expected ' + i(this.obj) + ' to have a property ' + i(name) + , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)); + } + + if (undefined !== val) { + this.assert( + val === this.obj[name] + , 'expected ' + i(this.obj) + ' to have a property ' + i(name) + + ' of ' + i(val) + ', but got ' + i(this.obj[name]) + , 'expected ' + i(this.obj) + ' to not have a property ' + i(name) + + ' of ' + i(val)); + } + + this.obj = this.obj[name]; + return this; + }; + + /** + * Assert that the array contains _obj_ or string contains _obj_. + * + * @param {Mixed} obj|string + * @api public + */ + + Assertion.prototype.string = + Assertion.prototype.contain = function (obj) { + if ('string' == typeof this.obj) { + this.assert( + ~this.obj.indexOf(obj) + , 'expected ' + i(this.obj) + ' to contain ' + i(obj) + , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); + } else { + this.assert( + ~indexOf(this.obj, obj) + , 'expected ' + i(this.obj) + ' to contain ' + i(obj) + , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); + } + return this; + }; + + /** + * Assert exact keys or inclusion of keys by using + * the `.own` modifier. + * + * @param {Array|String ...} keys + * @api public + */ + + Assertion.prototype.key = + Assertion.prototype.keys = function ($keys) { + var str + , ok = true; + + $keys = isArray($keys) + ? $keys + : Array.prototype.slice.call(arguments); + + if (!$keys.length) throw new Error('keys required'); + + var actual = keys(this.obj) + , len = $keys.length; + + // Inclusion + ok = every($keys, function (key) { + return ~indexOf(actual, key); + }); + + // Strict + if (!this.flags.not && this.flags.only) { + ok = ok && $keys.length == actual.length; + } + + // Key string + if (len > 1) { + $keys = map($keys, function (key) { + return i(key); + }); + var last = $keys.pop(); + str = $keys.join(', ') + ', and ' + last; + } else { + str = i($keys[0]); + } + + // Form + str = (len > 1 ? 'keys ' : 'key ') + str; + + // Have / include + str = (!this.flags.only ? 'include ' : 'only have ') + str; + + // Assertion + this.assert( + ok + , 'expected ' + i(this.obj) + ' to ' + str + , 'expected ' + i(this.obj) + ' to not ' + str); + + return this; + }; + + /** + * Function bind implementation. + */ + + function bind (fn, scope) { + return function () { + return fn.apply(scope, arguments); + } + } + + /** + * Array every compatibility + * + * @see bit.ly/5Fq1N2 + * @api public + */ + + function every (arr, fn, thisObj) { + var scope = thisObj || global; + for (var i = 0, j = arr.length; i < j; ++i) { + if (!fn.call(scope, arr[i], i, arr)) { + return false; + } + } + return true; + }; + + /** + * Array indexOf compatibility. + * + * @see bit.ly/a5Dxa2 + * @api public + */ + + function indexOf (arr, o, i) { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(arr, o, i); + } + + if (arr.length === undefined) { + return -1; + } + + for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0 + ; i < j && arr[i] !== o; i++); + + return j <= i ? -1 : i; + }; + + /** + * Inspects an object. + * + * @see taken from node.js `util` module (copyright Joyent, MIT license) + * @api private + */ + + function i (obj, showHidden, depth) { + var seen = []; + + function stylize (str) { + return str; + }; + + function format (value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (value && typeof value.inspect === 'function' && + // Filter out the util module, it's inspect function is special + value !== exports && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + return value.inspect(recurseTimes); + } + + // Primitive types cannot have properties + switch (typeof value) { + case 'undefined': + return stylize('undefined', 'undefined'); + + case 'string': + var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return stylize(simple, 'string'); + + case 'number': + return stylize('' + value, 'number'); + + case 'boolean': + return stylize('' + value, 'boolean'); + } + // For some reason typeof null is "object", so special case here. + if (value === null) { + return stylize('null', 'null'); + } + + // Look up the keys of the object. + var visible_keys = keys(value); + var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; + + // Functions without properties can be shortcutted. + if (typeof value === 'function' && $keys.length === 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + var name = value.name ? ': ' + value.name : ''; + return stylize('[Function' + name + ']', 'special'); + } + } + + // Dates without properties can be shortcutted + if (isDate(value) && $keys.length === 0) { + return stylize(value.toUTCString(), 'date'); + } + + var base, type, braces; + // Determine the object type + if (isArray(value)) { + type = 'Array'; + braces = ['[', ']']; + } else { + type = 'Object'; + braces = ['{', '}']; + } + + // Make functions say that they are functions + if (typeof value === 'function') { + var n = value.name ? ': ' + value.name : ''; + base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']'; + } else { + base = ''; + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + value.toUTCString(); + } + + if ($keys.length === 0) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + return stylize('[Object]', 'special'); + } + } + + seen.push(value); + + var output = map($keys, function (key) { + var name, str; + if (value.__lookupGetter__) { + if (value.__lookupGetter__(key)) { + if (value.__lookupSetter__(key)) { + str = stylize('[Getter/Setter]', 'special'); + } else { + str = stylize('[Getter]', 'special'); + } + } else { + if (value.__lookupSetter__(key)) { + str = stylize('[Setter]', 'special'); + } + } + } + if (indexOf(visible_keys, key) < 0) { + name = '[' + key + ']'; + } + if (!str) { + if (indexOf(seen, value[key]) < 0) { + if (recurseTimes === null) { + str = format(value[key]); + } else { + str = format(value[key], recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (isArray(value)) { + str = map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = stylize('[Circular]', 'special'); + } + } + if (typeof name === 'undefined') { + if (type === 'Array' && key.match(/^\d+$/)) { + return str; + } + name = json.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = stylize(name, 'string'); + } + } + + return name + ': ' + str; + }); + + seen.pop(); + + var numLinesEst = 0; + var length = reduce(output, function (prev, cur) { + numLinesEst++; + if (indexOf(cur, '\n') >= 0) numLinesEst++; + return prev + cur.length + 1; + }, 0); + + if (length > 50) { + output = braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + + } else { + output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; + } + + return output; + } + return format(obj, (typeof depth === 'undefined' ? 2 : depth)); + }; + + function isArray (ar) { + return Object.prototype.toString.call(ar) == '[object Array]'; + }; + + function isRegExp(re) { + var s = '' + re; + return re instanceof RegExp || // easy case + // duck-type for context-switching evalcx case + typeof(re) === 'function' && + re.constructor.name === 'RegExp' && + re.compile && + re.test && + re.exec && + s.match(/^\/.*\/[gim]{0,3}$/); + }; + + function isDate(d) { + if (d instanceof Date) return true; + return false; + }; + + function keys (obj) { + if (Object.keys) { + return Object.keys(obj); + } + + var keys = []; + + for (var i in obj) { + if (Object.prototype.hasOwnProperty.call(obj, i)) { + keys.push(i); + } + } + + return keys; + } + + function map (arr, mapper, that) { + if (Array.prototype.map) { + return Array.prototype.map.call(arr, mapper, that); + } + + var other= new Array(arr.length); + + for (var i= 0, n = arr.length; i= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= len) + throw new TypeError(); + } while (true); + } + + for (; i < len; i++) { + if (i in this) + rv = fun.call(null, rv, this[i], i, this); + } + + return rv; + }; + + /** + * Asserts deep equality + * + * @see taken from node.js `assert` module (copyright Joyent, MIT license) + * @api private + */ + + expect.eql = function eql (actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if ('undefined' != typeof Buffer + && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { + if (actual.length != expected.length) return false; + + for (var i = 0; i < actual.length; i++) { + if (actual[i] !== expected[i]) return false; + } + + return true; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } + } + + function isUndefinedOrNull (value) { + return value === null || value === undefined; + } + + function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + } + + function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return expect.eql(a, b); + } + try{ + var ka = keys(a), + kb = keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!expect.eql(a[key], b[key])) + return false; + } + return true; + } + + var json = (function () { + "use strict"; + + if ('object' == typeof JSON && JSON.parse && JSON.stringify) { + return { + parse: nativeJSON.parse + , stringify: nativeJSON.stringify + } + } + + var JSON = {}; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + function date(d, key) { + return isFinite(d.valueOf()) ? + d.getUTCFullYear() + '-' + + f(d.getUTCMonth() + 1) + '-' + + f(d.getUTCDate()) + 'T' + + f(d.getUTCHours()) + ':' + + f(d.getUTCMinutes()) + ':' + + f(d.getUTCSeconds()) + 'Z' : null; + }; + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + + + function str(key, holder) { + + // Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + + if (value instanceof Date) { + value = date(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + + // JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + + return String(value); + + // If the type is 'object', we might be dealing with an object or an array or + // null. + + case 'object': + + // Due to a specification blunder in ECMAScript, typeof null is 'object', + // so watch out for that case. + + if (!value) { + return 'null'; + } + + // Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + + // Is the value an array? + + if (Object.prototype.toString.apply(value) === '[object Array]') { + + // The value is an array. Stringify every element. Use null as a placeholder + // for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and wrap them in + // brackets. + + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === 'string') { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + + // Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + + // If the JSON object does not yet have a stringify method, give it one. + + JSON.stringify = function (value, replacer, space) { + + // The stringify method takes a value and an optional replacer, and an optional + // space parameter, and returns a JSON text. The replacer can be a function + // that can replace values, or an array of strings that will select the keys. + // A default replacer method can be provided. Use of the space parameter can + // produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + + // If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + + return str('', {'': value}); + }; + + // If the JSON object does not yet have a parse method, give it one. + + JSON.parse = function (text, reviver) { + // The parse method takes a text and an optional reviver function, and returns + // a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + + // The walk method is used to recursively walk the resulting structure so + // that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + + // Parsing happens in four stages. In the first stage, we replace certain + // Unicode characters with escape sequences. JavaScript handles many characters + // incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + + // In the second stage, we run the text against regular expressions that look + // for non-JSON patterns. We are especially concerned with '()' and 'new' + // because they can cause invocation, and '=' because it can cause mutation. + // But just to be safe, we want to reject all unexpected forms. + + // We split the second stage into 4 regexp operations in order to work around + // crippling inefficiencies in IE's and Safari's regexp engines. First we + // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we + // replace all simple value tokens with ']' characters. Third, we delete all + // open brackets that follow a colon or comma or that begin the text. Finally, + // we look to see that the remaining characters are only whitespace or ']' or + // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ + .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') + .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + + // In the third stage we use the eval function to compile the text into a + // JavaScript structure. The '{' operator is subject to a syntactic ambiguity + // in JavaScript: it can begin a block or an object literal. We wrap the text + // in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + + // In the optional fourth stage, we recursively walk the new structure, passing + // each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + + // If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + + return JSON; + })(); + + if ('undefined' != typeof window) { + window.expect = module.exports; + } + +})( + this + , 'undefined' != typeof module ? module : {} + , 'undefined' != typeof exports ? exports : {} +); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html new file mode 100644 index 0000000..c73147a --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html @@ -0,0 +1,18 @@ + + + Mocha + + + + + + + + + + + + +
    + + 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 + + + + + + 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..c0c86e1 --- /dev/null +++ b/node_modules/express/node_modules/debug/package.json @@ -0,0 +1,19 @@ +{ + "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": "TJ Holowaychuk " + , "dependencies": {} + , "devDependencies": { "mocha": "*" } + , "main": "lib/debug.js" + , "browserify": "debug.js" + , "engines": { "node": "*" } + , "component": { + "scripts": { + "debug/index.js": "index.js", + "debug/debug.js": "debug.js" + } + } +} 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..d81fc0d --- /dev/null +++ b/node_modules/express/node_modules/fresh/package.json @@ -0,0 +1,12 @@ +{ + "name": "fresh", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "HTTP response freshness testing", + "version": "0.1.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + } +} 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..09bef10 --- /dev/null +++ b/node_modules/express/node_modules/methods/package.json @@ -0,0 +1,15 @@ +{ + "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": "TJ Holowaychuk", + "license": "MIT" +} 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..d7f132d --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/package.json @@ -0,0 +1,23 @@ +{ + "name" : "mkdirp", + "description" : "Recursively mkdir, like `mkdir -p`", + "version" : "0.3.3", + "author" : "James Halliday (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": "*" } +} 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/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..0306040 --- /dev/null +++ b/node_modules/express/node_modules/range-parser/package.json @@ -0,0 +1,12 @@ +{ + "name": "range-parser", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "Range header field string parser", + "version": "0.0.4", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + } +} 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/send/node_modules/mime/LICENSE b/node_modules/express/node_modules/send/node_modules/mime/LICENSE new file mode 100644 index 0000000..451fc45 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 Benjamin Thomas, Robert Kieffer + +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/send/node_modules/mime/README.md b/node_modules/express/node_modules/send/node_modules/mime/README.md new file mode 100644 index 0000000..d8b66a8 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/README.md @@ -0,0 +1,63 @@ +# mime + +Comprehensive 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. + +## Install + +Install with [npm](http://github.com/isaacs/npm): + + npm install mime + +## API - Queries + +### mime.lookup(path) +Get 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. + + var mime = require('mime'); + + mime.lookup('/path/to/file.txt'); // => 'text/plain' + mime.lookup('file.txt'); // => 'text/plain' + mime.lookup('.TXT'); // => 'text/plain' + mime.lookup('htm'); // => 'text/html' + +### mime.extension(type) +Get the default extension for `type` + + mime.extension('text/html'); // => 'html' + mime.extension('application/octet-stream'); // => 'bin' + +### mime.charsets.lookup() + +Map mime-type to charset + + mime.charsets.lookup('text/plain'); // => 'UTF-8' + +(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) + +## API - Defining Custom Types + +The 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). + +### mime.define() + +Add custom mime/extension mappings + + mime.define({ + 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], + 'application/x-my-type': ['x-mt', 'x-mtt'], + // etc ... + }); + + mime.lookup('x-sft'); // => 'text/x-some-format' + +The first entry in the extensions array is returned by `mime.extension()`. E.g. + + mime.extension('text/x-some-format'); // => 'x-sf' + +### mime.load(filepath) + +Load mappings from an Apache ".types" format file + + mime.load('./my_project.types'); + +The .types file format is simple - See the `types` dir for examples. 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..05f6fb4 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/package.json @@ -0,0 +1,22 @@ +{ + "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": "https://github.com/broofa/node-mime", "type": "git"}, + "version": "1.2.6" +} diff --git a/node_modules/express/node_modules/send/node_modules/mime/test.js b/node_modules/express/node_modules/send/node_modules/mime/test.js new file mode 100644 index 0000000..cbad034 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/test.js @@ -0,0 +1,55 @@ +/** + * Usage: node test.js + */ + +var mime = require('./mime'); +var assert = require('assert'); + +function eq(a, b) { + console.log('Test: ' + a + ' === ' + b); + assert.strictEqual.apply(null, arguments); +} + +console.log(Object.keys(mime.extensions).length + ' types'); +console.log(Object.keys(mime.types).length + ' extensions\n'); + +// +// Test mime lookups +// + +eq('text/plain', mime.lookup('text.txt')); +eq('text/plain', mime.lookup('.text.txt')); +eq('text/plain', mime.lookup('.txt')); +eq('text/plain', mime.lookup('txt')); +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 +// + +eq('txt', mime.extension(mime.types.text)); +eq('html', mime.extension(mime.types.htm)); +eq('bin', mime.extension('application/octet-stream')); +eq(undefined, mime.extension('constructor')); + +// +// Test node types +// + +eq('application/octet-stream', mime.lookup('file.buffer')); +eq('audio/mp4', mime.lookup('file.m4a')); + +// +// Test charsets +// + +eq('UTF-8', mime.charsets.lookup('text/plain')); +eq(undefined, mime.charsets.lookup(mime.types.js)); +eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); + +console.log('\nOK'); diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/mime.types b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types new file mode 100644 index 0000000..b3cae2e --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types @@ -0,0 +1,1510 @@ +# This file maps Internet media types to unique file extension(s). +# Although created for httpd, this file is used by many software systems +# and has been placed in the public domain for unlimited redisribution. +# +# The table below contains both registered and (common) unregistered types. +# A type that has no unique extension can be ignored -- they are listed +# here to guide configurations toward known types and to make it easier to +# identify "new" types. File extensions are also commonly used to indicate +# content languages and encodings, so choose them carefully. +# +# Internet media types should be registered as described in RFC 4288. +# The registry is at . +# +# MIME type (lowercased) Extensions +# ============================================ ========== +# application/1d-interleaved-parityfec +# application/3gpp-ims+xml +# application/activemessage +application/andrew-inset ez +# application/applefile +application/applixware aw +application/atom+xml atom +application/atomcat+xml atomcat +# application/atomicmail +application/atomsvc+xml atomsvc +# application/auth-policy+xml +# application/batch-smtp +# application/beep+xml +# application/calendar+xml +# application/cals-1840 +# application/ccmp+xml +application/ccxml+xml ccxml +application/cdmi-capability cdmia +application/cdmi-container cdmic +application/cdmi-domain cdmid +application/cdmi-object cdmio +application/cdmi-queue cdmiq +# application/cea-2018+xml +# application/cellml+xml +# application/cfw +# application/cnrp+xml +# application/commonground +# application/conference-info+xml +# application/cpl+xml +# application/csta+xml +# application/cstadata+xml +application/cu-seeme cu +# application/cybercash +application/davmount+xml davmount +# application/dca-rft +# application/dec-dx +# application/dialog-info+xml +# application/dicom +# application/dns +# application/dskpp+xml +application/dssc+der dssc +application/dssc+xml xdssc +# application/dvcs +application/ecmascript ecma +# application/edi-consent +# application/edi-x12 +# application/edifact +application/emma+xml emma +# application/epp+xml +application/epub+zip epub +# application/eshop +# application/example +application/exi exi +# application/fastinfoset +# application/fastsoap +# application/fits +application/font-tdpfr pfr +# application/framework-attributes+xml +# application/h224 +# application/held+xml +# application/http +application/hyperstudio stk +# application/ibe-key-request+xml +# application/ibe-pkg-reply+xml +# application/ibe-pp-data +# application/iges +# application/im-iscomposing+xml +# application/index +# application/index.cmd +# application/index.obj +# application/index.response +# application/index.vnd +application/inkml+xml ink inkml +# application/iotp +application/ipfix ipfix +# application/ipp +# application/isup +application/java-archive jar +application/java-serialized-object ser +application/java-vm class +application/javascript js +application/json json +# application/kpml-request+xml +# application/kpml-response+xml +application/lost+xml lostxml +application/mac-binhex40 hqx +application/mac-compactpro cpt +# application/macwriteii +application/mads+xml mads +application/marc mrc +application/marcxml+xml mrcx +application/mathematica ma nb mb +# application/mathml-content+xml +# application/mathml-presentation+xml +application/mathml+xml mathml +# application/mbms-associated-procedure-description+xml +# application/mbms-deregister+xml +# application/mbms-envelope+xml +# application/mbms-msk+xml +# application/mbms-msk-response+xml +# application/mbms-protection-description+xml +# application/mbms-reception-report+xml +# application/mbms-register+xml +# application/mbms-register-response+xml +# application/mbms-user-service-description+xml +application/mbox mbox +# application/media_control+xml +application/mediaservercontrol+xml mscml +application/metalink4+xml meta4 +application/mets+xml mets +# application/mikey +application/mods+xml mods +# application/moss-keys +# application/moss-signature +# application/mosskey-data +# application/mosskey-request +application/mp21 m21 mp21 +application/mp4 mp4s +# application/mpeg4-generic +# application/mpeg4-iod +# application/mpeg4-iod-xmt +# application/msc-ivr+xml +# application/msc-mixer+xml +application/msword doc dot +application/mxf mxf +# application/nasdata +# application/news-checkgroups +# application/news-groupinfo +# application/news-transmission +# application/nss +# application/ocsp-request +# application/ocsp-response +application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy +application/oda oda +application/oebps-package+xml opf +application/ogg ogx +application/onenote onetoc onetoc2 onetmp onepkg +application/oxps oxps +# application/parityfec +application/patch-ops-error+xml xer +application/pdf pdf +application/pgp-encrypted pgp +# application/pgp-keys +application/pgp-signature asc sig +application/pics-rules prf +# application/pidf+xml +# application/pidf-diff+xml +application/pkcs10 p10 +application/pkcs7-mime p7m p7c +application/pkcs7-signature p7s +application/pkcs8 p8 +application/pkix-attr-cert ac +application/pkix-cert cer +application/pkix-crl crl +application/pkix-pkipath pkipath +application/pkixcmp pki +application/pls+xml pls +# application/poc-settings+xml +application/postscript ai eps ps +# application/prs.alvestrand.titrax-sheet +application/prs.cww cww +# application/prs.nprend +# application/prs.plucker +# application/prs.rdf-xml-crypt +# application/prs.xsf+xml +application/pskc+xml pskcxml +# application/qsig +application/rdf+xml rdf +application/reginfo+xml rif +application/relax-ng-compact-syntax rnc +# application/remote-printing +application/resource-lists+xml rl +application/resource-lists-diff+xml rld +# application/riscos +# application/rlmi+xml +application/rls-services+xml rs +application/rpki-ghostbusters gbr +application/rpki-manifest mft +application/rpki-roa roa +# application/rpki-updown +application/rsd+xml rsd +application/rss+xml rss +application/rtf rtf +# application/rtx +# application/samlassertion+xml +# application/samlmetadata+xml +application/sbml+xml sbml +application/scvp-cv-request scq +application/scvp-cv-response scs +application/scvp-vp-request spq +application/scvp-vp-response spp +application/sdp sdp +# application/set-payment +application/set-payment-initiation setpay +# application/set-registration +application/set-registration-initiation setreg +# application/sgml +# application/sgml-open-catalog +application/shf+xml shf +# application/sieve +# application/simple-filter+xml +# application/simple-message-summary +# application/simplesymbolcontainer +# application/slate +# application/smil +application/smil+xml smi smil +# application/soap+fastinfoset +# application/soap+xml +application/sparql-query rq +application/sparql-results+xml srx +# application/spirits-event+xml +application/srgs gram +application/srgs+xml grxml +application/sru+xml sru +application/ssml+xml ssml +# application/tamp-apex-update +# application/tamp-apex-update-confirm +# application/tamp-community-update +# application/tamp-community-update-confirm +# application/tamp-error +# application/tamp-sequence-adjust +# application/tamp-sequence-adjust-confirm +# application/tamp-status-query +# application/tamp-status-response +# application/tamp-update +# application/tamp-update-confirm +application/tei+xml tei teicorpus +application/thraud+xml tfi +# application/timestamp-query +# application/timestamp-reply +application/timestamped-data tsd +# application/tve-trigger +# application/ulpfec +# application/vcard+xml +# application/vemmi +# application/vividence.scriptfile +# application/vnd.3gpp.bsf+xml +application/vnd.3gpp.pic-bw-large plb +application/vnd.3gpp.pic-bw-small psb +application/vnd.3gpp.pic-bw-var pvb +# application/vnd.3gpp.sms +# application/vnd.3gpp2.bcmcsinfo+xml +# application/vnd.3gpp2.sms +application/vnd.3gpp2.tcap tcap +application/vnd.3m.post-it-notes pwn +application/vnd.accpac.simply.aso aso +application/vnd.accpac.simply.imp imp +application/vnd.acucobol acu +application/vnd.acucorp atc acutc +application/vnd.adobe.air-application-installer-package+zip air +application/vnd.adobe.fxp fxp fxpl +# application/vnd.adobe.partial-upload +application/vnd.adobe.xdp+xml xdp +application/vnd.adobe.xfdf xfdf +# application/vnd.aether.imp +# application/vnd.ah-barcode +application/vnd.ahead.space ahead +application/vnd.airzip.filesecure.azf azf +application/vnd.airzip.filesecure.azs azs +application/vnd.amazon.ebook azw +application/vnd.americandynamics.acc acc +application/vnd.amiga.ami ami +# application/vnd.amundsen.maze+xml +application/vnd.android.package-archive apk +application/vnd.anser-web-certificate-issue-initiation cii +application/vnd.anser-web-funds-transfer-initiation fti +application/vnd.antix.game-component atx +application/vnd.apple.installer+xml mpkg +application/vnd.apple.mpegurl m3u8 +# application/vnd.arastra.swi +application/vnd.aristanetworks.swi swi +application/vnd.astraea-software.iota iota +application/vnd.audiograph aep +# application/vnd.autopackage +# application/vnd.avistar+xml +application/vnd.blueice.multipass mpm +# application/vnd.bluetooth.ep.oob +application/vnd.bmi bmi +application/vnd.businessobjects rep +# application/vnd.cab-jscript +# application/vnd.canon-cpdl +# application/vnd.canon-lips +# application/vnd.cendio.thinlinc.clientconf +application/vnd.chemdraw+xml cdxml +application/vnd.chipnuts.karaoke-mmd mmd +application/vnd.cinderella cdy +# application/vnd.cirpack.isdn-ext +application/vnd.claymore cla +application/vnd.cloanto.rp9 rp9 +application/vnd.clonk.c4group c4g c4d c4f c4p c4u +application/vnd.cluetrust.cartomobile-config c11amc +application/vnd.cluetrust.cartomobile-config-pkg c11amz +# application/vnd.collection+json +# application/vnd.commerce-battelle +application/vnd.commonspace csp +application/vnd.contact.cmsg cdbcmsg +application/vnd.cosmocaller cmc +application/vnd.crick.clicker clkx +application/vnd.crick.clicker.keyboard clkk +application/vnd.crick.clicker.palette clkp +application/vnd.crick.clicker.template clkt +application/vnd.crick.clicker.wordbank clkw +application/vnd.criticaltools.wbs+xml wbs +application/vnd.ctc-posml pml +# application/vnd.ctct.ws+xml +# application/vnd.cups-pdf +# application/vnd.cups-postscript +application/vnd.cups-ppd ppd +# application/vnd.cups-raster +# application/vnd.cups-raw +# application/vnd.curl +application/vnd.curl.car car +application/vnd.curl.pcurl pcurl +# application/vnd.cybank +application/vnd.data-vision.rdz rdz +application/vnd.dece.data uvf uvvf uvd uvvd +application/vnd.dece.ttml+xml uvt uvvt +application/vnd.dece.unspecified uvx uvvx +application/vnd.dece.zip uvz uvvz +application/vnd.denovo.fcselayout-link fe_launch +# application/vnd.dir-bi.plate-dl-nosuffix +application/vnd.dna dna +application/vnd.dolby.mlp mlp +# application/vnd.dolby.mobile.1 +# application/vnd.dolby.mobile.2 +application/vnd.dpgraph dpg +application/vnd.dreamfactory dfac +application/vnd.dvb.ait ait +# application/vnd.dvb.dvbj +# application/vnd.dvb.esgcontainer +# application/vnd.dvb.ipdcdftnotifaccess +# application/vnd.dvb.ipdcesgaccess +# application/vnd.dvb.ipdcesgaccess2 +# application/vnd.dvb.ipdcesgpdd +# application/vnd.dvb.ipdcroaming +# application/vnd.dvb.iptv.alfec-base +# application/vnd.dvb.iptv.alfec-enhancement +# application/vnd.dvb.notif-aggregate-root+xml +# application/vnd.dvb.notif-container+xml +# application/vnd.dvb.notif-generic+xml +# application/vnd.dvb.notif-ia-msglist+xml +# application/vnd.dvb.notif-ia-registration-request+xml +# application/vnd.dvb.notif-ia-registration-response+xml +# application/vnd.dvb.notif-init+xml +# application/vnd.dvb.pfr +application/vnd.dvb.service svc +# application/vnd.dxr +application/vnd.dynageo geo +# application/vnd.easykaraoke.cdgdownload +# application/vnd.ecdis-update +application/vnd.ecowin.chart mag +# application/vnd.ecowin.filerequest +# application/vnd.ecowin.fileupdate +# application/vnd.ecowin.series +# application/vnd.ecowin.seriesrequest +# application/vnd.ecowin.seriesupdate +# application/vnd.emclient.accessrequest+xml +application/vnd.enliven nml +# application/vnd.eprints.data+xml +application/vnd.epson.esf esf +application/vnd.epson.msf msf +application/vnd.epson.quickanime qam +application/vnd.epson.salt slt +application/vnd.epson.ssf ssf +# application/vnd.ericsson.quickcall +application/vnd.eszigno3+xml es3 et3 +# application/vnd.etsi.aoc+xml +# application/vnd.etsi.cug+xml +# application/vnd.etsi.iptvcommand+xml +# application/vnd.etsi.iptvdiscovery+xml +# application/vnd.etsi.iptvprofile+xml +# application/vnd.etsi.iptvsad-bc+xml +# application/vnd.etsi.iptvsad-cod+xml +# application/vnd.etsi.iptvsad-npvr+xml +# application/vnd.etsi.iptvservice+xml +# application/vnd.etsi.iptvsync+xml +# application/vnd.etsi.iptvueprofile+xml +# application/vnd.etsi.mcid+xml +# application/vnd.etsi.overload-control-policy-dataset+xml +# application/vnd.etsi.sci+xml +# application/vnd.etsi.simservs+xml +# application/vnd.etsi.tsl+xml +# application/vnd.etsi.tsl.der +# application/vnd.eudora.data +application/vnd.ezpix-album ez2 +application/vnd.ezpix-package ez3 +# application/vnd.f-secure.mobile +application/vnd.fdf fdf +application/vnd.fdsn.mseed mseed +application/vnd.fdsn.seed seed dataless +# application/vnd.ffsns +# application/vnd.fints +application/vnd.flographit gph +application/vnd.fluxtime.clip ftc +# application/vnd.font-fontforge-sfd +application/vnd.framemaker fm frame maker book +application/vnd.frogans.fnc fnc +application/vnd.frogans.ltf ltf +application/vnd.fsc.weblaunch fsc +application/vnd.fujitsu.oasys oas +application/vnd.fujitsu.oasys2 oa2 +application/vnd.fujitsu.oasys3 oa3 +application/vnd.fujitsu.oasysgp fg5 +application/vnd.fujitsu.oasysprs bh2 +# application/vnd.fujixerox.art-ex +# application/vnd.fujixerox.art4 +# application/vnd.fujixerox.hbpl +application/vnd.fujixerox.ddd ddd +application/vnd.fujixerox.docuworks xdw +application/vnd.fujixerox.docuworks.binder xbd +# application/vnd.fut-misnet +application/vnd.fuzzysheet fzs +application/vnd.genomatix.tuxedo txd +# application/vnd.geocube+xml +application/vnd.geogebra.file ggb +application/vnd.geogebra.tool ggt +application/vnd.geometry-explorer gex gre +application/vnd.geonext gxt +application/vnd.geoplan g2w +application/vnd.geospace g3w +# application/vnd.globalplatform.card-content-mgt +# application/vnd.globalplatform.card-content-mgt-response +application/vnd.gmx gmx +application/vnd.google-earth.kml+xml kml +application/vnd.google-earth.kmz kmz +application/vnd.grafeq gqf gqs +# application/vnd.gridmp +application/vnd.groove-account gac +application/vnd.groove-help ghf +application/vnd.groove-identity-message gim +application/vnd.groove-injector grv +application/vnd.groove-tool-message gtm +application/vnd.groove-tool-template tpl +application/vnd.groove-vcard vcg +# application/vnd.hal+json +application/vnd.hal+xml hal +application/vnd.handheld-entertainment+xml zmm +application/vnd.hbci hbci +# application/vnd.hcl-bireports +application/vnd.hhe.lesson-player les +application/vnd.hp-hpgl hpgl +application/vnd.hp-hpid hpid +application/vnd.hp-hps hps +application/vnd.hp-jlyt jlt +application/vnd.hp-pcl pcl +application/vnd.hp-pclxl pclxl +# application/vnd.httphone +application/vnd.hydrostatix.sof-data sfd-hdstx +application/vnd.hzn-3d-crossword x3d +# application/vnd.ibm.afplinedata +# application/vnd.ibm.electronic-media +application/vnd.ibm.minipay mpy +application/vnd.ibm.modcap afp listafp list3820 +application/vnd.ibm.rights-management irm +application/vnd.ibm.secure-container sc +application/vnd.iccprofile icc icm +application/vnd.igloader igl +application/vnd.immervision-ivp ivp +application/vnd.immervision-ivu ivu +# application/vnd.informedcontrol.rms+xml +# application/vnd.informix-visionary +# application/vnd.infotech.project +# application/vnd.infotech.project+xml +application/vnd.insors.igm igm +application/vnd.intercon.formnet xpw xpx +application/vnd.intergeo i2g +# application/vnd.intertrust.digibox +# application/vnd.intertrust.nncp +application/vnd.intu.qbo qbo +application/vnd.intu.qfx qfx +# application/vnd.iptc.g2.conceptitem+xml +# application/vnd.iptc.g2.knowledgeitem+xml +# application/vnd.iptc.g2.newsitem+xml +# application/vnd.iptc.g2.packageitem+xml +application/vnd.ipunplugged.rcprofile rcprofile +application/vnd.irepository.package+xml irp +application/vnd.is-xpr xpr +application/vnd.isac.fcs fcs +application/vnd.jam jam +# application/vnd.japannet-directory-service +# application/vnd.japannet-jpnstore-wakeup +# application/vnd.japannet-payment-wakeup +# application/vnd.japannet-registration +# application/vnd.japannet-registration-wakeup +# application/vnd.japannet-setstore-wakeup +# application/vnd.japannet-verification +# application/vnd.japannet-verification-wakeup +application/vnd.jcp.javame.midlet-rms rms +application/vnd.jisp jisp +application/vnd.joost.joda-archive joda +application/vnd.kahootz ktz ktr +application/vnd.kde.karbon karbon +application/vnd.kde.kchart chrt +application/vnd.kde.kformula kfo +application/vnd.kde.kivio flw +application/vnd.kde.kontour kon +application/vnd.kde.kpresenter kpr kpt +application/vnd.kde.kspread ksp +application/vnd.kde.kword kwd kwt +application/vnd.kenameaapp htke +application/vnd.kidspiration kia +application/vnd.kinar kne knp +application/vnd.koan skp skd skt skm +application/vnd.kodak-descriptor sse +application/vnd.las.las+xml lasxml +# application/vnd.liberty-request+xml +application/vnd.llamagraphics.life-balance.desktop lbd +application/vnd.llamagraphics.life-balance.exchange+xml lbe +application/vnd.lotus-1-2-3 123 +application/vnd.lotus-approach apr +application/vnd.lotus-freelance pre +application/vnd.lotus-notes nsf +application/vnd.lotus-organizer org +application/vnd.lotus-screencam scm +application/vnd.lotus-wordpro lwp +application/vnd.macports.portpkg portpkg +# application/vnd.marlin.drm.actiontoken+xml +# application/vnd.marlin.drm.conftoken+xml +# application/vnd.marlin.drm.license+xml +# application/vnd.marlin.drm.mdcf +application/vnd.mcd mcd +application/vnd.medcalcdata mc1 +application/vnd.mediastation.cdkey cdkey +# application/vnd.meridian-slingshot +application/vnd.mfer mwf +application/vnd.mfmp mfm +application/vnd.micrografx.flo flo +application/vnd.micrografx.igx igx +application/vnd.mif mif +# application/vnd.minisoft-hp3000-save +# application/vnd.mitsubishi.misty-guard.trustweb +application/vnd.mobius.daf daf +application/vnd.mobius.dis dis +application/vnd.mobius.mbk mbk +application/vnd.mobius.mqy mqy +application/vnd.mobius.msl msl +application/vnd.mobius.plc plc +application/vnd.mobius.txf txf +application/vnd.mophun.application mpn +application/vnd.mophun.certificate mpc +# application/vnd.motorola.flexsuite +# application/vnd.motorola.flexsuite.adsi +# application/vnd.motorola.flexsuite.fis +# application/vnd.motorola.flexsuite.gotap +# application/vnd.motorola.flexsuite.kmr +# application/vnd.motorola.flexsuite.ttc +# application/vnd.motorola.flexsuite.wem +# application/vnd.motorola.iprm +application/vnd.mozilla.xul+xml xul +application/vnd.ms-artgalry cil +# application/vnd.ms-asf +application/vnd.ms-cab-compressed cab +application/vnd.ms-excel xls xlm xla xlc xlt xlw +application/vnd.ms-excel.addin.macroenabled.12 xlam +application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb +application/vnd.ms-excel.sheet.macroenabled.12 xlsm +application/vnd.ms-excel.template.macroenabled.12 xltm +application/vnd.ms-fontobject eot +application/vnd.ms-htmlhelp chm +application/vnd.ms-ims ims +application/vnd.ms-lrm lrm +# application/vnd.ms-office.activex+xml +application/vnd.ms-officetheme thmx +application/vnd.ms-pki.seccat cat +application/vnd.ms-pki.stl stl +# application/vnd.ms-playready.initiator+xml +application/vnd.ms-powerpoint ppt pps pot +application/vnd.ms-powerpoint.addin.macroenabled.12 ppam +application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm +application/vnd.ms-powerpoint.slide.macroenabled.12 sldm +application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm +application/vnd.ms-powerpoint.template.macroenabled.12 potm +application/vnd.ms-project mpp mpt +# application/vnd.ms-tnef +# application/vnd.ms-wmdrm.lic-chlg-req +# application/vnd.ms-wmdrm.lic-resp +# application/vnd.ms-wmdrm.meter-chlg-req +# application/vnd.ms-wmdrm.meter-resp +application/vnd.ms-word.document.macroenabled.12 docm +application/vnd.ms-word.template.macroenabled.12 dotm +application/vnd.ms-works wps wks wcm wdb +application/vnd.ms-wpl wpl +application/vnd.ms-xpsdocument xps +application/vnd.mseq mseq +# application/vnd.msign +# application/vnd.multiad.creator +# application/vnd.multiad.creator.cif +# application/vnd.music-niff +application/vnd.musician mus +application/vnd.muvee.style msty +application/vnd.mynfc taglet +# application/vnd.ncd.control +# application/vnd.ncd.reference +# application/vnd.nervana +# application/vnd.netfpx +application/vnd.neurolanguage.nlu nlu +application/vnd.noblenet-directory nnd +application/vnd.noblenet-sealer nns +application/vnd.noblenet-web nnw +# application/vnd.nokia.catalogs +# application/vnd.nokia.conml+wbxml +# application/vnd.nokia.conml+xml +# application/vnd.nokia.isds-radio-presets +# application/vnd.nokia.iptv.config+xml +# application/vnd.nokia.landmark+wbxml +# application/vnd.nokia.landmark+xml +# application/vnd.nokia.landmarkcollection+xml +# application/vnd.nokia.n-gage.ac+xml +application/vnd.nokia.n-gage.data ngdat +application/vnd.nokia.n-gage.symbian.install n-gage +# application/vnd.nokia.ncd +# application/vnd.nokia.pcd+wbxml +# application/vnd.nokia.pcd+xml +application/vnd.nokia.radio-preset rpst +application/vnd.nokia.radio-presets rpss +application/vnd.novadigm.edm edm +application/vnd.novadigm.edx edx +application/vnd.novadigm.ext ext +# application/vnd.ntt-local.file-transfer +# application/vnd.ntt-local.sip-ta_remote +# application/vnd.ntt-local.sip-ta_tcp_stream +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.chart-template otc +application/vnd.oasis.opendocument.database odb +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.formula-template odft +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.image-template oti +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master odm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +# application/vnd.obn +# application/vnd.oftn.l10n+json +# application/vnd.oipf.contentaccessdownload+xml +# application/vnd.oipf.contentaccessstreaming+xml +# application/vnd.oipf.cspg-hexbinary +# application/vnd.oipf.dae.svg+xml +# application/vnd.oipf.dae.xhtml+xml +# application/vnd.oipf.mippvcontrolmessage+xml +# application/vnd.oipf.pae.gem +# application/vnd.oipf.spdiscovery+xml +# application/vnd.oipf.spdlist+xml +# application/vnd.oipf.ueprofile+xml +# application/vnd.oipf.userprofile+xml +application/vnd.olpc-sugar xo +# application/vnd.oma-scws-config +# application/vnd.oma-scws-http-request +# application/vnd.oma-scws-http-response +# application/vnd.oma.bcast.associated-procedure-parameter+xml +# application/vnd.oma.bcast.drm-trigger+xml +# application/vnd.oma.bcast.imd+xml +# application/vnd.oma.bcast.ltkm +# application/vnd.oma.bcast.notification+xml +# application/vnd.oma.bcast.provisioningtrigger +# application/vnd.oma.bcast.sgboot +# application/vnd.oma.bcast.sgdd+xml +# application/vnd.oma.bcast.sgdu +# application/vnd.oma.bcast.simple-symbol-container +# application/vnd.oma.bcast.smartcard-trigger+xml +# application/vnd.oma.bcast.sprov+xml +# application/vnd.oma.bcast.stkm +# application/vnd.oma.cab-address-book+xml +# application/vnd.oma.cab-feature-handler+xml +# application/vnd.oma.cab-pcc+xml +# application/vnd.oma.cab-user-prefs+xml +# application/vnd.oma.dcd +# application/vnd.oma.dcdc +application/vnd.oma.dd2+xml dd2 +# application/vnd.oma.drm.risd+xml +# application/vnd.oma.group-usage-list+xml +# application/vnd.oma.pal+xml +# application/vnd.oma.poc.detailed-progress-report+xml +# application/vnd.oma.poc.final-report+xml +# application/vnd.oma.poc.groups+xml +# application/vnd.oma.poc.invocation-descriptor+xml +# application/vnd.oma.poc.optimized-progress-report+xml +# application/vnd.oma.push +# application/vnd.oma.scidm.messages+xml +# application/vnd.oma.xcap-directory+xml +# application/vnd.omads-email+xml +# application/vnd.omads-file+xml +# application/vnd.omads-folder+xml +# application/vnd.omaloc-supl-init +application/vnd.openofficeorg.extension oxt +# application/vnd.openxmlformats-officedocument.custom-properties+xml +# application/vnd.openxmlformats-officedocument.customxmlproperties+xml +# application/vnd.openxmlformats-officedocument.drawing+xml +# application/vnd.openxmlformats-officedocument.drawingml.chart+xml +# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml +# application/vnd.openxmlformats-officedocument.extended-properties+xml +# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml +# application/vnd.openxmlformats-officedocument.presentationml.comments+xml +# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml +application/vnd.openxmlformats-officedocument.presentationml.presentation pptx +# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml +application/vnd.openxmlformats-officedocument.presentationml.slide sldx +# application/vnd.openxmlformats-officedocument.presentationml.slide+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml +application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx +# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml +# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml +# application/vnd.openxmlformats-officedocument.presentationml.tags+xml +application/vnd.openxmlformats-officedocument.presentationml.template potx +# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx +# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml +# application/vnd.openxmlformats-officedocument.theme+xml +# application/vnd.openxmlformats-officedocument.themeoverride+xml +# application/vnd.openxmlformats-officedocument.vmldrawing +# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.document docx +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx +# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml +# application/vnd.openxmlformats-package.core-properties+xml +# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml +# application/vnd.openxmlformats-package.relationships+xml +# application/vnd.quobject-quoxdocument +# application/vnd.osa.netdeploy +application/vnd.osgeo.mapguide.package mgp +# application/vnd.osgi.bundle +application/vnd.osgi.dp dp +# application/vnd.otps.ct-kip+xml +application/vnd.palm pdb pqa oprc +# application/vnd.paos.xml +application/vnd.pawaafile paw +application/vnd.pg.format str +application/vnd.pg.osasli ei6 +# application/vnd.piaccess.application-licence +application/vnd.picsel efif +application/vnd.pmi.widget wg +# application/vnd.poc.group-advertisement+xml +application/vnd.pocketlearn plf +application/vnd.powerbuilder6 pbd +# application/vnd.powerbuilder6-s +# application/vnd.powerbuilder7 +# application/vnd.powerbuilder7-s +# application/vnd.powerbuilder75 +# application/vnd.powerbuilder75-s +# application/vnd.preminet +application/vnd.previewsystems.box box +application/vnd.proteus.magazine mgz +application/vnd.publishare-delta-tree qps +application/vnd.pvi.ptid1 ptid +# application/vnd.pwg-multiplexed +# application/vnd.pwg-xhtml-print+xml +# application/vnd.qualcomm.brew-app-res +application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb +# application/vnd.radisys.moml+xml +# application/vnd.radisys.msml+xml +# application/vnd.radisys.msml-audit+xml +# application/vnd.radisys.msml-audit-conf+xml +# application/vnd.radisys.msml-audit-conn+xml +# application/vnd.radisys.msml-audit-dialog+xml +# application/vnd.radisys.msml-audit-stream+xml +# application/vnd.radisys.msml-conf+xml +# application/vnd.radisys.msml-dialog+xml +# application/vnd.radisys.msml-dialog-base+xml +# application/vnd.radisys.msml-dialog-fax-detect+xml +# application/vnd.radisys.msml-dialog-fax-sendrecv+xml +# application/vnd.radisys.msml-dialog-group+xml +# application/vnd.radisys.msml-dialog-speech+xml +# application/vnd.radisys.msml-dialog-transform+xml +# application/vnd.rainstor.data +# application/vnd.rapid +application/vnd.realvnc.bed bed +application/vnd.recordare.musicxml mxl +application/vnd.recordare.musicxml+xml musicxml +# application/vnd.renlearn.rlprint +application/vnd.rig.cryptonote cryptonote +application/vnd.rim.cod cod +application/vnd.rn-realmedia rm +application/vnd.route66.link66+xml link66 +# application/vnd.ruckus.download +# application/vnd.s3sms +application/vnd.sailingtracker.track st +# application/vnd.sbm.cid +# application/vnd.sbm.mid2 +# application/vnd.scribus +# application/vnd.sealed.3df +# application/vnd.sealed.csf +# application/vnd.sealed.doc +# application/vnd.sealed.eml +# application/vnd.sealed.mht +# application/vnd.sealed.net +# application/vnd.sealed.ppt +# application/vnd.sealed.tiff +# application/vnd.sealed.xls +# application/vnd.sealedmedia.softseal.html +# application/vnd.sealedmedia.softseal.pdf +application/vnd.seemail see +application/vnd.sema sema +application/vnd.semd semd +application/vnd.semf semf +application/vnd.shana.informed.formdata ifm +application/vnd.shana.informed.formtemplate itp +application/vnd.shana.informed.interchange iif +application/vnd.shana.informed.package ipk +application/vnd.simtech-mindmapper twd twds +application/vnd.smaf mmf +# application/vnd.smart.notebook +application/vnd.smart.teacher teacher +# application/vnd.software602.filler.form+xml +# application/vnd.software602.filler.form-xml-zip +application/vnd.solent.sdkm+xml sdkm sdkd +application/vnd.spotfire.dxp dxp +application/vnd.spotfire.sfs sfs +# application/vnd.sss-cod +# application/vnd.sss-dtf +# application/vnd.sss-ntf +application/vnd.stardivision.calc sdc +application/vnd.stardivision.draw sda +application/vnd.stardivision.impress sdd +application/vnd.stardivision.math smf +application/vnd.stardivision.writer sdw vor +application/vnd.stardivision.writer-global sgl +application/vnd.stepmania.package smzip +application/vnd.stepmania.stepchart sm +# application/vnd.street-stream +application/vnd.sun.xml.calc sxc +application/vnd.sun.xml.calc.template stc +application/vnd.sun.xml.draw sxd +application/vnd.sun.xml.draw.template std +application/vnd.sun.xml.impress sxi +application/vnd.sun.xml.impress.template sti +application/vnd.sun.xml.math sxm +application/vnd.sun.xml.writer sxw +application/vnd.sun.xml.writer.global sxg +application/vnd.sun.xml.writer.template stw +# application/vnd.sun.wadl+xml +application/vnd.sus-calendar sus susp +application/vnd.svd svd +# application/vnd.swiftview-ics +application/vnd.symbian.install sis sisx +application/vnd.syncml+xml xsm +application/vnd.syncml.dm+wbxml bdm +application/vnd.syncml.dm+xml xdm +# application/vnd.syncml.dm.notification +# application/vnd.syncml.ds.notification +application/vnd.tao.intent-module-archive tao +application/vnd.tcpdump.pcap pcap cap dmp +application/vnd.tmobile-livetv tmo +application/vnd.trid.tpt tpt +application/vnd.triscape.mxs mxs +application/vnd.trueapp tra +# application/vnd.truedoc +# application/vnd.ubisoft.webplayer +application/vnd.ufdl ufd ufdl +application/vnd.uiq.theme utz +application/vnd.umajin umj +application/vnd.unity unityweb +application/vnd.uoml+xml uoml +# application/vnd.uplanet.alert +# application/vnd.uplanet.alert-wbxml +# application/vnd.uplanet.bearer-choice +# application/vnd.uplanet.bearer-choice-wbxml +# application/vnd.uplanet.cacheop +# application/vnd.uplanet.cacheop-wbxml +# application/vnd.uplanet.channel +# application/vnd.uplanet.channel-wbxml +# application/vnd.uplanet.list +# application/vnd.uplanet.list-wbxml +# application/vnd.uplanet.listcmd +# application/vnd.uplanet.listcmd-wbxml +# application/vnd.uplanet.signal +application/vnd.vcx vcx +# application/vnd.vd-study +# application/vnd.vectorworks +# application/vnd.verimatrix.vcas +# application/vnd.vidsoft.vidconference +application/vnd.visio vsd vst vss vsw +application/vnd.visionary vis +# application/vnd.vividence.scriptfile +application/vnd.vsf vsf +# application/vnd.wap.sic +# application/vnd.wap.slc +application/vnd.wap.wbxml wbxml +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/vnd.webturbo wtb +# application/vnd.wfa.wsc +# application/vnd.wmc +# application/vnd.wmf.bootstrap +# application/vnd.wolfram.mathematica +# application/vnd.wolfram.mathematica.package +application/vnd.wolfram.player nbp +application/vnd.wordperfect wpd +application/vnd.wqd wqd +# application/vnd.wrq-hp3000-labelled +application/vnd.wt.stf stf +# application/vnd.wv.csp+wbxml +# application/vnd.wv.csp+xml +# application/vnd.wv.ssp+xml +application/vnd.xara xar +application/vnd.xfdl xfdl +# application/vnd.xfdl.webform +# application/vnd.xmi+xml +# application/vnd.xmpie.cpkg +# application/vnd.xmpie.dpkg +# application/vnd.xmpie.plan +# application/vnd.xmpie.ppkg +# application/vnd.xmpie.xlim +application/vnd.yamaha.hv-dic hvd +application/vnd.yamaha.hv-script hvs +application/vnd.yamaha.hv-voice hvp +application/vnd.yamaha.openscoreformat osf +application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg +# application/vnd.yamaha.remote-setup +application/vnd.yamaha.smaf-audio saf +application/vnd.yamaha.smaf-phrase spf +# application/vnd.yamaha.through-ngn +# application/vnd.yamaha.tunnel-udpencap +application/vnd.yellowriver-custom-menu cmp +application/vnd.zul zir zirz +application/vnd.zzazz.deck+xml zaz +application/voicexml+xml vxml +# application/vq-rtcpxr +# application/watcherinfo+xml +# application/whoispp-query +# application/whoispp-response +application/widget wgt +application/winhlp hlp +# application/wita +# application/wordperfect5.1 +application/wsdl+xml wsdl +application/wspolicy+xml wspolicy +application/x-7z-compressed 7z +application/x-abiword abw +application/x-ace-compressed ace +application/x-authorware-bin aab x32 u32 vox +application/x-authorware-map aam +application/x-authorware-seg aas +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-bzip bz +application/x-bzip2 bz2 boz +application/x-cdlink vcd +application/x-chat chat +application/x-chess-pgn pgn +# application/x-compress +application/x-cpio cpio +application/x-csh csh +application/x-debian-package deb udeb +application/x-director dir dcr dxr cst cct cxt w3d fgd swa +application/x-doom wad +application/x-dtbncx+xml ncx +application/x-dtbook+xml dtb +application/x-dtbresource+xml res +application/x-dvi dvi +application/x-font-bdf bdf +# application/x-font-dos +# application/x-font-framemaker +application/x-font-ghostscript gsf +# application/x-font-libgrx +application/x-font-linux-psf psf +application/x-font-otf otf +application/x-font-pcf pcf +application/x-font-snf snf +# application/x-font-speedo +# application/x-font-sunos-news +application/x-font-ttf ttf ttc +application/x-font-type1 pfa pfb pfm afm +application/x-font-woff woff +# application/x-font-vfont +application/x-futuresplash spl +application/x-gnumeric gnumeric +application/x-gtar gtar +# application/x-gzip +application/x-hdf hdf +application/x-java-jnlp-file jnlp +application/x-latex latex +application/x-mobipocket-ebook prc mobi +application/x-ms-application application +application/x-ms-wmd wmd +application/x-ms-wmz wmz +application/x-ms-xbap xbap +application/x-msaccess mdb +application/x-msbinder obd +application/x-mscardfile crd +application/x-msclip clp +application/x-msdownload exe dll com bat msi +application/x-msmediaview mvb m13 m14 +application/x-msmetafile wmf +application/x-msmoney mny +application/x-mspublisher pub +application/x-msschedule scd +application/x-msterminal trm +application/x-mswrite wri +application/x-netcdf nc cdf +application/x-pkcs12 p12 pfx +application/x-pkcs7-certificates p7b spc +application/x-pkcs7-certreqresp p7r +application/x-rar-compressed rar +application/x-sh sh +application/x-shar shar +application/x-shockwave-flash swf +application/x-silverlight-app xap +application/x-stuffit sit +application/x-stuffitx sitx +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-tar tar +application/x-tcl tcl +application/x-tex tex +application/x-tex-tfm tfm +application/x-texinfo texinfo texi +application/x-ustar ustar +application/x-wais-source src +application/x-x509-ca-cert der crt +application/x-xfig fig +application/x-xpinstall xpi +# application/x400-bp +# application/xcap-att+xml +# application/xcap-caps+xml +application/xcap-diff+xml xdf +# application/xcap-el+xml +# application/xcap-error+xml +# application/xcap-ns+xml +# application/xcon-conference-info-diff+xml +# application/xcon-conference-info+xml +application/xenc+xml xenc +application/xhtml+xml xhtml xht +# application/xhtml-voice+xml +application/xml xml xsl +application/xml-dtd dtd +# application/xml-external-parsed-entity +# application/xmpp+xml +application/xop+xml xop +application/xslt+xml xslt +application/xspf+xml xspf +application/xv+xml mxml xhvml xvml xvm +application/yang yang +application/yin+xml yin +application/zip zip +# audio/1d-interleaved-parityfec +# audio/32kadpcm +# audio/3gpp +# audio/3gpp2 +# audio/ac3 +audio/adpcm adp +# audio/amr +# audio/amr-wb +# audio/amr-wb+ +# audio/asc +# audio/atrac-advanced-lossless +# audio/atrac-x +# audio/atrac3 +audio/basic au snd +# audio/bv16 +# audio/bv32 +# audio/clearmode +# audio/cn +# audio/dat12 +# audio/dls +# audio/dsr-es201108 +# audio/dsr-es202050 +# audio/dsr-es202211 +# audio/dsr-es202212 +# audio/dv +# audio/dvi4 +# audio/eac3 +# audio/evrc +# audio/evrc-qcp +# audio/evrc0 +# audio/evrc1 +# audio/evrcb +# audio/evrcb0 +# audio/evrcb1 +# audio/evrcwb +# audio/evrcwb0 +# audio/evrcwb1 +# audio/example +# audio/fwdred +# audio/g719 +# audio/g722 +# audio/g7221 +# audio/g723 +# audio/g726-16 +# audio/g726-24 +# audio/g726-32 +# audio/g726-40 +# audio/g728 +# audio/g729 +# audio/g7291 +# audio/g729d +# audio/g729e +# audio/gsm +# audio/gsm-efr +# audio/gsm-hr-08 +# audio/ilbc +# audio/ip-mr_v2.5 +# audio/l16 +# audio/l20 +# audio/l24 +# audio/l8 +# audio/lpc +audio/midi mid midi kar rmi +# audio/mobile-xmf +audio/mp4 mp4a +# audio/mp4a-latm +# audio/mpa +# audio/mpa-robust +audio/mpeg mpga mp2 mp2a mp3 m2a m3a +# audio/mpeg4-generic +audio/ogg oga ogg spx +# audio/parityfec +# audio/pcma +# audio/pcma-wb +# audio/pcmu-wb +# audio/pcmu +# audio/prs.sid +# audio/qcelp +# audio/red +# audio/rtp-enc-aescm128 +# audio/rtp-midi +# audio/rtx +# audio/smv +# audio/smv0 +# audio/smv-qcp +# audio/sp-midi +# audio/speex +# audio/t140c +# audio/t38 +# audio/telephone-event +# audio/tone +# audio/uemclip +# audio/ulpfec +# audio/vdvi +# audio/vmr-wb +# audio/vnd.3gpp.iufp +# audio/vnd.4sb +# audio/vnd.audiokoz +# audio/vnd.celp +# audio/vnd.cisco.nse +# audio/vnd.cmles.radio-events +# audio/vnd.cns.anp1 +# audio/vnd.cns.inf1 +audio/vnd.dece.audio uva uvva +audio/vnd.digital-winds eol +# audio/vnd.dlna.adts +# audio/vnd.dolby.heaac.1 +# audio/vnd.dolby.heaac.2 +# audio/vnd.dolby.mlp +# audio/vnd.dolby.mps +# audio/vnd.dolby.pl2 +# audio/vnd.dolby.pl2x +# audio/vnd.dolby.pl2z +# audio/vnd.dolby.pulse.1 +audio/vnd.dra dra +audio/vnd.dts dts +audio/vnd.dts.hd dtshd +# audio/vnd.dvb.file dvb +# audio/vnd.everad.plj +# audio/vnd.hns.audio +audio/vnd.lucent.voice lvp +audio/vnd.ms-playready.media.pya pya +# audio/vnd.nokia.mobile-xmf +# audio/vnd.nortel.vbk +audio/vnd.nuera.ecelp4800 ecelp4800 +audio/vnd.nuera.ecelp7470 ecelp7470 +audio/vnd.nuera.ecelp9600 ecelp9600 +# audio/vnd.octel.sbc +# audio/vnd.qcelp +# audio/vnd.rhetorex.32kadpcm +audio/vnd.rip rip +# audio/vnd.sealedmedia.softseal.mpeg +# audio/vnd.vmx.cvsd +# audio/vorbis +# audio/vorbis-config +audio/webm weba +audio/x-aac aac +audio/x-aiff aif aiff aifc +audio/x-mpegurl m3u +audio/x-ms-wax wax +audio/x-ms-wma wma +audio/x-pn-realaudio ram ra +audio/x-pn-realaudio-plugin rmp +audio/x-wav wav +chemical/x-cdx cdx +chemical/x-cif cif +chemical/x-cmdf cmdf +chemical/x-cml cml +chemical/x-csml csml +# chemical/x-pdb +chemical/x-xyz xyz +image/bmp bmp +image/cgm cgm +# image/example +# image/fits +image/g3fax g3 +image/gif gif +image/ief ief +# image/jp2 +image/jpeg jpeg jpg jpe +# image/jpm +# image/jpx +image/ktx ktx +# image/naplps +image/png png +image/prs.btif btif +# image/prs.pti +image/svg+xml svg svgz +# image/t38 +image/tiff tiff tif +# image/tiff-fx +image/vnd.adobe.photoshop psd +# image/vnd.cns.inf2 +image/vnd.dece.graphic uvi uvvi uvg uvvg +image/vnd.dvb.subtitle sub +image/vnd.djvu djvu djv +image/vnd.dwg dwg +image/vnd.dxf dxf +image/vnd.fastbidsheet fbs +image/vnd.fpx fpx +image/vnd.fst fst +image/vnd.fujixerox.edmics-mmr mmr +image/vnd.fujixerox.edmics-rlc rlc +# image/vnd.globalgraphics.pgb +# image/vnd.microsoft.icon +# image/vnd.mix +image/vnd.ms-modi mdi +image/vnd.net-fpx npx +# image/vnd.radiance +# image/vnd.sealed.png +# image/vnd.sealedmedia.softseal.gif +# image/vnd.sealedmedia.softseal.jpg +# image/vnd.svf +image/vnd.wap.wbmp wbmp +image/vnd.xiff xif +image/webp webp +image/x-cmu-raster ras +image/x-cmx cmx +image/x-freehand fh fhc fh4 fh5 fh7 +image/x-icon ico +image/x-pcx pcx +image/x-pict pic pct +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd +# message/cpim +# message/delivery-status +# message/disposition-notification +# message/example +# message/external-body +# message/feedback-report +# message/global +# message/global-delivery-status +# message/global-disposition-notification +# message/global-headers +# message/http +# message/imdn+xml +# message/news +# message/partial +message/rfc822 eml mime +# message/s-http +# message/sip +# message/sipfrag +# message/tracking-status +# message/vnd.si.simp +# model/example +model/iges igs iges +model/mesh msh mesh silo +model/vnd.collada+xml dae +model/vnd.dwf dwf +# model/vnd.flatland.3dml +model/vnd.gdl gdl +# model/vnd.gs-gdl +# model/vnd.gs.gdl +model/vnd.gtw gtw +# model/vnd.moml+xml +model/vnd.mts mts +# model/vnd.parasolid.transmit.binary +# model/vnd.parasolid.transmit.text +model/vnd.vtu vtu +model/vrml wrl vrml +# multipart/alternative +# multipart/appledouble +# multipart/byteranges +# multipart/digest +# multipart/encrypted +# multipart/example +# multipart/form-data +# multipart/header-set +# multipart/mixed +# multipart/parallel +# multipart/related +# multipart/report +# multipart/signed +# multipart/voice-message +# text/1d-interleaved-parityfec +text/calendar ics ifb +text/css css +text/csv csv +# text/directory +# text/dns +# text/ecmascript +# text/enriched +# text/example +# text/fwdred +text/html html htm +# text/javascript +text/n3 n3 +# text/parityfec +text/plain txt text conf def list log in +# text/prs.fallenstein.rst +text/prs.lines.tag dsc +# text/vnd.radisys.msml-basic-layout +# text/red +# text/rfc822-headers +text/richtext rtx +# text/rtf +# text/rtp-enc-aescm128 +# text/rtx +text/sgml sgml sgm +# text/t140 +text/tab-separated-values tsv +text/troff t tr roff man me ms +text/turtle ttl +# text/ulpfec +text/uri-list uri uris urls +text/vcard vcard +# text/vnd.abc +text/vnd.curl curl +text/vnd.curl.dcurl dcurl +text/vnd.curl.scurl scurl +text/vnd.curl.mcurl mcurl +# text/vnd.dmclientscript +text/vnd.dvb.subtitle sub +# text/vnd.esmertec.theme-descriptor +text/vnd.fly fly +text/vnd.fmi.flexstor flx +text/vnd.graphviz gv +text/vnd.in3d.3dml 3dml +text/vnd.in3d.spot spot +# text/vnd.iptc.newsml +# text/vnd.iptc.nitf +# text/vnd.latex-z +# text/vnd.motorola.reflex +# text/vnd.ms-mediapackage +# text/vnd.net2phone.commcenter.command +# text/vnd.si.uricatalogue +text/vnd.sun.j2me.app-descriptor jad +# text/vnd.trolltech.linguist +# text/vnd.wap.si +# text/vnd.wap.sl +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/x-asm s asm +text/x-c c cc cxx cpp h hh dic +text/x-fortran f for f77 f90 +text/x-pascal p pas +text/x-java-source java +text/x-setext etx +text/x-uuencode uu +text/x-vcalendar vcs +text/x-vcard vcf +# text/xml +# text/xml-external-parsed-entity +# video/1d-interleaved-parityfec +video/3gpp 3gp +# video/3gpp-tt +video/3gpp2 3g2 +# video/bmpeg +# video/bt656 +# video/celb +# video/dv +# video/example +video/h261 h261 +video/h263 h263 +# video/h263-1998 +# video/h263-2000 +video/h264 h264 +# video/h264-rcdo +# video/h264-svc +video/jpeg jpgv +# video/jpeg2000 +video/jpm jpm jpgm +video/mj2 mj2 mjp2 +# video/mp1s +# video/mp2p +# video/mp2t +video/mp4 mp4 mp4v mpg4 +# video/mp4v-es +video/mpeg mpeg mpg mpe m1v m2v +# video/mpeg4-generic +# video/mpv +# video/nv +video/ogg ogv +# video/parityfec +# video/pointer +video/quicktime qt mov +# video/raw +# video/rtp-enc-aescm128 +# video/rtx +# video/smpte292m +# video/ulpfec +# video/vc1 +# video/vnd.cctv +video/vnd.dece.hd uvh uvvh +video/vnd.dece.mobile uvm uvvm +# video/vnd.dece.mp4 +video/vnd.dece.pd uvp uvvp +video/vnd.dece.sd uvs uvvs +video/vnd.dece.video uvv uvvv +# video/vnd.directv.mpeg +# video/vnd.directv.mpeg-tts +# video/vnd.dlna.mpeg-tts +video/vnd.dvb.file dvb +video/vnd.fvt fvt +# video/vnd.hns.video +# video/vnd.iptvforum.1dparityfec-1010 +# video/vnd.iptvforum.1dparityfec-2005 +# video/vnd.iptvforum.2dparityfec-1010 +# video/vnd.iptvforum.2dparityfec-2005 +# video/vnd.iptvforum.ttsavc +# video/vnd.iptvforum.ttsmpeg2 +# video/vnd.motorola.video +# video/vnd.motorola.videop +video/vnd.mpegurl mxu m4u +video/vnd.ms-playready.media.pyv pyv +# video/vnd.nokia.interleaved-multimedia +# video/vnd.nokia.videovoip +# video/vnd.objectvideo +# video/vnd.sealed.mpeg1 +# video/vnd.sealed.mpeg4 +# video/vnd.sealed.swf +# video/vnd.sealedmedia.softseal.mov +video/vnd.uvvu.mp4 uvu uvvu +video/vnd.vivo viv +video/webm webm +video/x-f4v f4v +video/x-fli fli +video/x-flv flv +video/x-m4v m4v +video/x-ms-asf asf asx +video/x-ms-wm wm +video/x-ms-wmv wmv +video/x-ms-wmx wmx +video/x-ms-wvx wvx +video/x-msvideo avi +video/x-sgi-movie movie +x-conference/x-cooltalk ice diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/node.types b/node_modules/express/node_modules/send/node_modules/mime/types/node.types new file mode 100644 index 0000000..b7fe8c0 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/types/node.types @@ -0,0 +1,65 @@ +# What: Google Chrome Extension +# Why: To allow apps to (work) be served with the right content type header. +# http://codereview.chromium.org/2830017 +# Added by: niftylettuce +application/x-chrome-extension crx + +# What: OTF Message Silencer +# Why: To silence the "Resource interpreted as font but transferred with MIME +# type font/otf" message that occurs in Google Chrome +# Added by: niftylettuce +font/opentype otf + +# What: HTC support +# Why: To properly render .htc files such as CSS3PIE +# Added by: niftylettuce +text/x-component htc + +# What: HTML5 application cache manifest +# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps +# per https://developer.mozilla.org/en/offline_resources_in_firefox +# Added by: louisremi +text/cache-manifest appcache manifest + +# What: node binary buffer format +# Why: semi-standard extension w/in the node community +# Added by: tootallnate +application/octet-stream buffer + +# What: The "protected" MP-4 formats used by iTunes. +# Why: Required for streaming music to browsers (?) +# Added by: broofa +application/mp4 m4p +audio/mp4 m4a + +# What: Music playlist format (http://en.wikipedia.org/wiki/M3U) +# Why: See https://github.com/bentomas/node-mime/pull/6 +# Added by: mjrusso +application/x-mpegURL m3u8 + +# What: Video format, Part of RFC1890 +# Why: See https://github.com/bentomas/node-mime/pull/6 +# Added by: mjrusso +video/MP2T ts + +# What: The FLAC lossless codec format +# Why: Streaming and serving FLAC audio +# Added by: jacobrask +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..696df31 --- /dev/null +++ b/node_modules/express/node_modules/send/package.json @@ -0,0 +1,23 @@ +{ + "name": "send", + "version": "0.1.0", + "description": "Better streaming static file server with Range and conditional-GET support", + "keywords": ["static", "file", "server"], + "author": "TJ Holowaychuk ", + "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" +} \ No newline at end of file diff --git a/node_modules/express/package.json b/node_modules/express/package.json new file mode 100644 index 0000000..55b43d9 --- /dev/null +++ b/node_modules/express/package.json @@ -0,0 +1,56 @@ +{ + "name": "express", + "description": "Sinatra inspired web development framework", + "version": "3.1.0", + "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" } + ], + "dependencies": { + "connect": "2.7.2", + "commander": "0.6.1", + "range-parser": "0.0.4", + "mkdirp": "0.3.3", + "cookie": "0.0.5", + "buffer-crc32": "0.1.1", + "fresh": "0.1.0", + "methods": "0.0.1", + "send": "0.1.0", + "cookie-signature": "0.0.1", + "debug": "*" + }, + "devDependencies": { + "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": "git://github.com/visionmedia/express", + "main": "index", + "bin": { "express": "./bin/express" }, + "scripts": { + "prepublish" : "npm prune", + "test": "make test" + }, + "engines": { "node": "*" } +} + diff --git a/node_modules/express/test.js b/node_modules/express/test.js new file mode 100644 index 0000000..112ee0a --- /dev/null +++ b/node_modules/express/test.js @@ -0,0 +1,14 @@ + +/** + * Module dependencies. + */ + +var express = require('./') + , app = express() + +app.get('/', function(req, res){ + console.log(req.query); +}); + +app.listen(3000); +console.log('listening on 3000'); diff --git a/node_modules/jade/.npmignore b/node_modules/jade/.npmignore new file mode 100644 index 0000000..fdc7b89 --- /dev/null +++ b/node_modules/jade/.npmignore @@ -0,0 +1,14 @@ +test +support +benchmarks +examples +lib-cov +coverage.html +.gitmodules +.travis.yml +History.md +Makefile +test/ +support/ +benchmarks/ +examples/ diff --git a/node_modules/jade/LICENSE b/node_modules/jade/LICENSE new file mode 100644 index 0000000..8ad0e0d --- /dev/null +++ b/node_modules/jade/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2009-2010 TJ Holowaychuk + +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/jade/Readme.md b/node_modules/jade/Readme.md new file mode 100644 index 0000000..9f629d9 --- /dev/null +++ b/node_modules/jade/Readme.md @@ -0,0 +1,1298 @@ + [![Build Status](https://secure.travis-ci.org/visionmedia/jade.png)](http://travis-ci.org/visionmedia/jade) + +# Jade - template engine + + Jade is a high performance template engine heavily influenced by [Haml](http://haml-lang.com) + and implemented with JavaScript for [node](http://nodejs.org). For discussion join the [Google Group](http://groups.google.com/group/jadejs). + +## Test drive + + You can test drive Jade online [here](http://naltatis.github.com/jade-syntax-docs). + +## README Contents + +- [Features](#a1) +- [Implementations](#a2) +- [Installation](#a3) +- [Browser Support](#a4) +- [Public API](#a5) +- [Syntax](#a6) + - [Line Endings](#a6-1) + - [Tags](#a6-2) + - [Tag Text](#a6-3) + - [Comments](#a6-4) + - [Block Comments](#a6-5) + - [Nesting](#a6-6) + - [Block Expansion](#a6-7) + - [Case](#a6-8) + - [Attributes](#a6-9) + - [HTML](#a6-10) + - [Doctypes](#a6-11) +- [Filters](#a7) +- [Code](#a8) +- [Iteration](#a9) +- [Conditionals](#a10) +- [Template inheritance](#a11) +- [Block append / prepend](#a12) +- [Includes](#a13) +- [Mixins](#a14) +- [Generated Output](#a15) +- [Example Makefile](#a16) +- [jade(1)](#a17) +- [Tutorials](#a18) +- [License](#a19) + + +## Features + + - client-side support + - great readability + - flexible indentation + - block-expansion + - mixins + - static includes + - attribute interpolation + - code is escaped by default for security + - contextual error reporting at compile & run time + - executable for compiling jade templates via the command line + - html 5 mode (the default doctype) + - optional memory caching + - combine dynamic and static tag classes + - parse tree manipulation via _filters_ + - template inheritance + - block append / prepend + - supports [Express JS](http://expressjs.com) out of the box + - transparent iteration over objects, arrays, and even non-enumerables via `each` + - block comments + - no tag prefix + - filters + - :stylus must have [stylus](http://github.com/LearnBoost/stylus) installed + - :less must have [less.js](http://github.com/cloudhead/less.js) installed + - :markdown must have [markdown-js](http://github.com/evilstreak/markdown-js), [node-discount](http://github.com/visionmedia/node-discount), or [marked](http://github.com/chjj/marked) installed + - :cdata + - :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed + - [Emacs Mode](https://github.com/brianc/jade-mode) + - [Vim Syntax](https://github.com/digitaltoad/vim-jade) + - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) + - [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode) + - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) + - [html2jade](https://github.com/donpark/html2jade) converter + + +## Implementations + + - [php](http://github.com/everzet/jade.php) + - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) + - [ruby](http://github.com/stonean/slim) + - [python](https://github.com/SyrusAkbary/pyjade) + - [java](https://github.com/neuland/jade4j) + + +## Installation + +via npm: + +```bash +$ npm install jade +``` + + +## Browser Support + + To compile jade to a single file compatible for client-side use simply execute: + +```bash +$ make jade.js +``` + + Alternatively, if uglifyjs is installed via npm (`npm install uglify-js`) you may execute the following which will create both files. However each release builds these for you. + +```bash +$ make jade.min.js +``` + + By default Jade instruments templates with line number statements such as `__.lineno = 3` for debugging purposes. When used in a browser it's useful to minimize this boiler plate, you can do so by passing the option `{ compileDebug: false }`. The following template + +```jade +p Hello #{name} +``` + + Can then be as small as the following generated function: + +```js +function anonymous(locals, attrs, escape, rethrow) { + var buf = []; + with (locals || {}) { + var interp; + buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); + } + return buf.join(""); +} +``` + + Through the use of Jade's `./runtime.js` you may utilize these pre-compiled templates on the client-side _without_ Jade itself, all you need is the associated utility functions (in runtime.js), which are then available as `jade.attrs`, `jade.escape` etc. To enable this you should pass `{ client: true }` to `jade.compile()` to tell Jade to reference the helper functions + via `jade.attrs`, `jade.escape` etc. + +```js +function anonymous(locals, attrs, escape, rethrow) { + var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; + var buf = []; + with (locals || {}) { + var interp; + buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); + } + return buf.join(""); +} +``` + +
    +## Public API + +```js +var jade = require('jade'); + +// Compile a function +var fn = jade.compile('string of jade', options); +fn(locals); +``` + +### Options + + - `self` Use a `self` namespace to hold the locals _(false by default)_ + - `locals` Local variable object + - `filename` Used in exceptions, and required when using includes + - `debug` Outputs tokens and function body generated + - `compiler` Compiler to replace jade's default + - `compileDebug` When `false` no debug instrumentation is compiled + - `pretty` Add pretty-indentation whitespace to output _(false by default)_ + + +## Syntax + + +### Line Endings + +**CRLF** and **CR** are converted to **LF** before parsing. + + +### Tags + +A tag is simply a leading word: + +```jade +html +``` + +for example is converted to `` + +tags can also have ids: + +```jade +div#container +``` + +which would render `
    ` + +how about some classes? + +```jade +div.user-details +``` + +renders `
    ` + +multiple classes? _and_ an id? sure: + +```jade +div#foo.bar.baz +``` + +renders `
    ` + +div div div sure is annoying, how about: + +```jade +#foo +.bar +``` + +which is syntactic sugar for what we have already been doing, and outputs: + +```html +
    +``` + +
    +### Tag Text + +Simply place some content after the tag: + +```jade +p wahoo! +``` + +renders `

    wahoo!

    `. + +well cool, but how about large bodies of text: + +```jade +p + | foo bar baz + | rawr rawr + | super cool + | go jade go +``` + +renders `

    foo bar baz rawr.....

    ` + +interpolation? yup! both types of text can utilize interpolation, +if we passed `{ name: 'tj', email: 'tj@vision-media.ca' }` to the compiled function we can do the following: + +```jade +#user #{name} <#{email}> +``` + +outputs `
    tj <tj@vision-media.ca>
    ` + +Actually want `#{}` for some reason? escape it! + +```jade +p \#{something} +``` + +now we have `

    #{something}

    ` + +We can also utilize the unescaped variant `!{html}`, so the following +will result in a literal script tag: + +```jade +- var html = "" +| !{html} +``` + +Nested tags that also contain text can optionally use a text block: + +```jade +label + | Username: + input(name='user[name]') +``` + +or immediate tag text: + +```jade +label Username: + input(name='user[name]') +``` + +Tags that accept _only_ text such as `script` and `style` do not +need the leading `|` character, for example: + +```jade +html + head + title Example + script + if (foo) { + bar(); + } else { + baz(); + } +``` + +Once again as an alternative, we may use a trailing `.` to indicate a text block, for example: + +```jade +p. + foo asdf + asdf + asdfasdfaf + asdf + asd. +``` + +outputs: + +```html +

    foo asdf +asdf + asdfasdfaf + asdf +asd. +

    +``` + +This however differs from a trailing `.` followed by a space, which although is ignored by the Jade parser, tells Jade that this period is a literal: + +```jade +p . +``` + +outputs: + +```html +

    .

    +``` + +It should be noted that text blocks should be doubled escaped. For example if you desire the following output. + +```html +

    foo\bar

    +``` + +use: + +```jade +p. + foo\\bar +``` + +
    +### Comments + +Single line comments currently look the same as JavaScript comments, +aka `//` and must be placed on their own line: + +```jade +// just some paragraphs +p foo +p bar +``` + +would output + +```html + +

    foo

    +

    bar

    +``` + +Jade also supports unbuffered comments, by simply adding a hyphen: + +```jade +//- will not output within markup +p foo +p bar +``` + +outputting + +```html +

    foo

    +

    bar

    +``` + +
    +### Block Comments + + A block comment is legal as well: + +```jade +body + // + #content + h1 Example +``` + +outputting + +```html + + + +``` + +Jade supports conditional-comments as well, for example: + +```jade +head + //if lt IE 8 + script(src='http://github.com/ie-sucks.js') +``` + +outputs: + +```html + + + +``` + + +### Nesting + + Jade supports nesting to define the tags in a natural way: + +```jade +ul + li.first + a(href='#') foo + li + a(href='#') bar + li.last + a(href='#') baz +``` + + +### Block Expansion + + Block expansion allows you to create terse single-line nested tags, + the following example is equivalent to the nesting example above. + +```jade +ul + li.first: a(href='#') foo + li: a(href='#') bar + li.last: a(href='#') baz +``` + + +### Case + + The case statement takes the following form: + +```jade +html + body + friends = 10 + case friends + when 0 + p you have no friends + when 1 + p you have a friend + default + p you have #{friends} friends +``` + + Block expansion may also be used: + +```jade +friends = 5 + +html + body + case friends + when 0: p you have no friends + when 1: p you have a friend + default: p you have #{friends} friends +``` + + +### Attributes + +Jade currently supports `(` and `)` as attribute delimiters. + +```jade +a(href='http://github.com/login', title='View login page') Login +``` + +When a value is `undefined` or `null` the attribute is _not_ added, +so this is fine, it will not compile `something="null"`. + +```jade +div(something=null) +``` + +Boolean attributes are also supported: + +```jade +input(type="checkbox", checked) +``` + +Boolean attributes with code will only output the attribute when `true`: + +```jade +input(type="checkbox", checked=someValue) +``` + +Multiple lines work too: + +```jade +input(type='checkbox', + name='agreement', + checked) +``` + +Multiple lines without the comma work fine: + +```jade +input(type='checkbox' + name='agreement' + checked) +``` + +Funky whitespace? fine: + +```jade +input( + type='checkbox' + name='agreement' + checked) +``` + +Colons work: + +```jade +rss(xmlns:atom="atom") +``` + +Suppose we have the `user` local `{ id: 12, name: 'tobi' }` +and we wish to create an anchor tag with `href` pointing to "/user/12" +we could use regular javascript concatenation: + +```jade +a(href='http://github.com/user/' + user.id)= user.name +``` + +or we could use jade's interpolation, which I added because everyone +using Ruby or CoffeeScript seems to think this is legal js..: + +```jade +a(href='http://github.com/user/#{user.id}')= user.name +``` + +The `class` attribute is special-cased when an array is given, +allowing you to pass an array such as `bodyClasses = ['user', 'authenticated']` directly: + +```jade +body(class=bodyClasses) +``` + + +### HTML + + Inline html is fine, we can use the pipe syntax to + write arbitrary text, in this case some html: + +```jade +html + body + |

    Title

    + |

    foo bar baz

    +``` + + Or we can use the trailing `.` to indicate to Jade that we + only want text in this block, allowing us to omit the pipes: + +```jade +html + body. +

    Title

    +

    foo bar baz

    +``` + + Both of these examples yield the same result: + +```html +

    Title

    +

    foo bar baz

    + +``` + + The same rule applies for anywhere you can have text + in jade, raw html is fine: + +```jade +html + body + h1 User #{name} +``` + +
    +### Doctypes + +To add a doctype simply use `!!!`, or `doctype` followed by an optional value: + +```jade +!!! +``` + +or + +```jade +doctype +``` + +Will output the _html 5_ doctype, however: + +```jade +!!! transitional +``` + +Will output the _transitional_ doctype. + +Doctypes are case-insensitive, so the following are equivalent: + +```jade +doctype Basic +doctype basic +``` + +it's also possible to simply pass a doctype literal: + +```jade +doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN +``` + +yielding: + +```html + +``` + +Below are the doctypes defined by default, which can easily be extended: + +```js +var doctypes = exports.doctypes = { + '5': '', + 'default': '', + 'xml': '', + 'transitional': '', + 'strict': '', + 'frameset': '', + '1.1': '', + 'basic': '', + 'mobile': '' +}; +``` + +To alter the default simply change: + +```js +jade.doctypes.default = 'whatever you want'; +``` + + +## Filters + +Filters are prefixed with `:`, for example `:markdown` and +pass the following block of text to an arbitrary function for processing. View the _features_ +at the top of this document for available filters. + +```jade +body + :markdown + Woah! jade _and_ markdown, very **cool** + we can even link to [stuff](http://google.com) +``` + +Renders: + +```html +

    Woah! jade and markdown, very cool we can even link to stuff

    +``` + + +## Code + +Jade currently supports three classifications of executable code. The first +is prefixed by `-`, and is not buffered: + +```jade +- var foo = 'bar'; +``` + +This can be used for conditionals, or iteration: + +```jade +- for (var key in obj) + p= obj[key] +``` + +Due to Jade's buffering techniques the following is valid as well: + +```jade +- if (foo) + ul + li yay + li foo + li worked +- else + p oh no! didnt work +``` + +Hell, even verbose iteration: + +```jade +- if (items.length) + ul + - items.forEach(function(item){ + li= item + - }) +``` + +Anything you want! + +Next up we have _escaped_ buffered code, which is used to +buffer a return value, which is prefixed by `=`: + +```jade +- var foo = 'bar' += foo +h1= foo +``` + +Which outputs `bar

    bar

    `. Code buffered by `=` is escaped +by default for security, however to output unescaped return values +you may use `!=`: + +```jade +p!= aVarContainingMoreHTML +``` + + Jade also has designer-friendly variants, making the literal JavaScript + more expressive and declarative. For example the following assignments + are equivalent, and the expression is still regular javascript: + +```jade +- var foo = 'foo ' + 'bar' +foo = 'foo ' + 'bar' +``` + + Likewise Jade has first-class `if`, `else if`, `else`, `until`, `while`, `unless` among others, however you must remember that the expressions are still regular javascript: + +```jade +if foo == 'bar' + ul + li yay + li foo + li worked +else + p oh no! didnt work +``` + +
    +## Iteration + + Along with vanilla JavaScript Jade also supports a subset of + constructs that allow you to create more designer-friendly templates, + one of these constructs is `each`, taking the form: + +```jade +each VAL[, KEY] in OBJ +``` + +An example iterating over an array: + +```jade +- var items = ["one", "two", "three"] +each item in items + li= item +``` + +outputs: + +```html +
  • one
  • +
  • two
  • +
  • three
  • +``` + +iterating an array with index: + +```jade +items = ["one", "two", "three"] +each item, i in items + li #{item}: #{i} +``` + +outputs: + +```html +
  • one: 0
  • +
  • two: 1
  • +
  • three: 2
  • +``` + +iterating an object's keys and values: + +```jade +obj = { foo: 'bar' } +each val, key in obj + li #{key}: #{val} +``` + +would output `
  • foo: bar
  • ` + +Internally Jade converts these statements to regular +JavaScript loops such as `users.forEach(function(user){`, +so lexical scope and nesting applies as it would with regular +JavaScript: + +```jade +each user in users + each role in user.roles + li= role +``` + + You may also use `for` if you prefer: + +```jade +for user in users + for role in user.roles + li= role +``` + +
    +## Conditionals + + Jade conditionals are equivalent to those using the code (`-`) prefix, + however allow you to ditch parenthesis to become more designer friendly, + however keep in mind the expression given is _regular_ JavaScript: + +```jade +for user in users + if user.role == 'admin' + p #{user.name} is an admin + else + p= user.name +``` + + is equivalent to the following using vanilla JavaScript literals: + +```jade +for user in users + - if (user.role == 'admin') + p #{user.name} is an admin + - else + p= user.name +``` + + Jade also provides have `unless` which is equivalent to `if (!(expr))`: + +```jade +for user in users + unless user.isAnonymous + p + | Click to view + a(href='http://github.com/users/' + user.id)= user.name +``` + + +## Template inheritance + + Jade supports template inheritance via the `block` and `extends` keywords. A block is simply a "block" of Jade that may be replaced within a child template, this process is recursive. To activate template inheritance in Express 2.x you must add: `app.set('view options', { layout: false });`. + + Jade blocks can provide default content if desired, however optional as shown below by `block scripts`, `block content`, and `block foot`. + +```jade +html + head + h1 My Site - #{title} + block scripts + script(src='http://github.com/jquery.js') + body + block content + block foot + #footer + p some footer content +``` + + Now to extend the layout, simply create a new file and use the `extends` directive as shown below, giving the path (with or without the .jade extension). You may now define one or more blocks that will override the parent block content, note that here the `foot` block is _not_ redefined and will output "some footer content". + +```jade +extends layout + +block scripts + script(src='http://github.com/jquery.js') + script(src='http://github.com/pets.js') + +block content + h1= title + each pet in pets + include pet +``` + + It's also possible to override a block to provide additional blocks, as shown in the following example where `content` now exposes a `sidebar` and `primary` block for overriding, or the child template could override `content` all together. + +```jade +extends regular-layout + +block content + .sidebar + block sidebar + p nothing + .primary + block primary + p nothing +``` + + +## Block append / prepend + + Jade allows you to _replace_ (default), _prepend_, or _append_ blocks. Suppose for example you have default scripts in a "head" block that you wish to utilize on _every_ page, you might do this: + +```jade +html + head + block head + script(src='http://github.com/vendor/jquery.js') + script(src='http://github.com/vendor/caustic.js') + body + block content +``` + + Now suppose you have a page of your application for a JavaScript game, you want some game related scripts as well as these defaults, you can simply `append` the block: + +```jade +extends layout + +block append head + script(src='http://github.com/vendor/three.js') + script(src='http://github.com/game.js') +``` + + When using `block append` or `block prepend` the `block` is optional: + +```jade +extends layout + +append head + script(src='http://github.com/vendor/three.js') + script(src='http://github.com/game.js') +``` + + +## Includes + + Includes allow you to statically include chunks of Jade, + or other content like css, or html which lives in separate files. The classical example is including a header and footer. Suppose we have the following directory structure: + + ./layout.jade + ./includes/ + ./head.jade + ./foot.jade + +and the following _layout.jade_: + +```jade +html + include includes/head + body + h1 My Site + p Welcome to my super amazing site. + include includes/foot +``` + +both includes _includes/head_ and _includes/foot_ are +read relative to the `filename` option given to _layout.jade_, +which should be an absolute path to this file, however Express does this for you. Include then parses these files, and injects the AST produced to render what you would expect: + +```html + + + My Site + + + +

    My Site

    +

    Welcome to my super lame site.

    + + + +``` + + As mentioned `include` can be used to include other content + such as html or css. By providing an extension Jade will not + assume that the file is Jade source and will include it as + a literal: + +```jade +html + body + include content.html +``` + + Include directives may also accept a block, in which case the + the given block will be appended to the _last_ block defined + in the file. For example if `head.jade` contains: + +```jade +head + script(src='http://github.com/jquery.js') +``` + + We may append values by providing a block to `include head` + as shown below, adding the two scripts. + +```jade +html + include head + script(src='http://github.com/foo.js') + script(src='http://github.com/bar.js') + body + h1 test +``` + + You may also `yield` within an included template, allowing you to explicitly mark where the block given to `include` will be placed. Suppose for example you wish to prepend scripts rather than append, you might do the following: + +```jade +head + yield + script(src='http://github.com/jquery.js') + script(src='http://github.com/jquery.ui.js') +``` + + Since included Jade is parsed and literally merges the AST, lexically scoped variables function as if the included Jade was written right in the same file. This means `include` may be used as sort of partial, for example suppose we have `user.jade` which utilizes a `user` variable. + +```jade +h1= user.name +p= user.occupation +``` + +We could then simply `include user` while iterating users, and since the `user` variable is already defined within the loop the included template will have access to it. + +```jade +users = [{ name: 'Tobi', occupation: 'Ferret' }] + +each user in users + .user + include user +``` + +yielding: + +```html +
    +

    Tobi

    +

    Ferret

    +
    +``` + +If we wanted to expose a different variable name as `user` since `user.jade` references that name, we could simply define a new variable as shown here with `user = person`: + +```jade +each person in users + .user + user = person + include user +``` + +
    +## Mixins + + Mixins are converted to regular JavaScript functions in + the compiled template that Jade constructs. Mixins may + take arguments, though not required: + +```jade +mixin list + ul + li foo + li bar + li baz +``` + + Utilizing a mixin without args looks similar, just without a block: + +```jade +h2 Groceries +mixin list +``` + + Mixins may take one or more arguments as well, the arguments + are regular javascripts expressions, so for example the following: + +```jade +mixin pets(pets) + ul.pets + - each pet in pets + li= pet + +mixin profile(user) + .user + h2= user.name + mixin pets(user.pets) +``` + + Would yield something similar to the following html: + +```html +
    +

    tj

    +
      +
    • tobi
    • +
    • loki
    • +
    • jane
    • +
    • manny
    • +
    +
    +``` + +
    +## Generated Output + + Suppose we have the following Jade: + +```jade +- var title = 'yay' +h1.title #{title} +p Just an example +``` + + When the `compileDebug` option is not explicitly `false`, Jade + will compile the function instrumented with `__.lineno = n;`, which + in the event of an exception is passed to `rethrow()` which constructs + a useful message relative to the initial Jade input. + +```js +function anonymous(locals) { + var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; + var rethrow = jade.rethrow; + try { + var attrs = jade.attrs, escape = jade.escape; + var buf = []; + with (locals || {}) { + var interp; + __.lineno = 1; + var title = 'yay' + __.lineno = 2; + buf.push(''); + buf.push('' + escape((interp = title) == null ? '' : interp) + ''); + buf.push(''); + __.lineno = 3; + buf.push('

    '); + buf.push('Just an example'); + buf.push('

    '); + } + return buf.join(""); + } catch (err) { + rethrow(err, __.input, __.filename, __.lineno); + } +} +``` + +When the `compileDebug` option _is_ explicitly `false`, this instrumentation +is stripped, which is very helpful for light-weight client-side templates. Combining Jade's options with the `./runtime.js` file in this repo allows you +to toString() compiled templates and avoid running the entire Jade library on +the client, increasing performance, and decreasing the amount of JavaScript +required. + +```js +function anonymous(locals) { + var attrs = jade.attrs, escape = jade.escape; + var buf = []; + with (locals || {}) { + var interp; + var title = 'yay' + buf.push(''); + buf.push('' + escape((interp = title) == null ? '' : interp) + ''); + buf.push(''); + buf.push('

    '); + buf.push('Just an example'); + buf.push('

    '); + } + return buf.join(""); +} +``` + +
    +## Example Makefile + + Below is an example Makefile used to compile _pages/*.jade_ + into _pages/*.html_ files by simply executing `make`. + +```make +JADE = $(shell find pages/*.jade) +HTML = $(JADE:.jade=.html) + +all: $(HTML) + +%.html: %.jade + jade < $< --path $< > $@ + +clean: + rm -f $(HTML) + +.PHONY: clean +``` + +this can be combined with the `watch(1)` command to produce +a watcher-like behaviour: + +```bash +$ watch make +``` + + +## jade(1) + +``` + +Usage: jade [options] [dir|file ...] + +Options: + + -h, --help output usage information + -V, --version output the version number + -o, --obj javascript options object + -O, --out output the compiled html to + -p, --path filename used to resolve includes + -P, --pretty compile pretty html output + -c, --client compile for client-side runtime.js + -D, --no-debug compile without debugging (smaller functions) + +Examples: + + # translate jade the templates dir + $ jade templates + + # create {foo,bar}.html + $ jade {foo,bar}.jade + + # jade over stdio + $ jade < my.jade > my.html + + # jade over stdio + $ echo "h1 Jade!" | jade + + # foo, bar dirs rendering to /tmp + $ jade foo bar --out /tmp + +``` + + +## Tutorials + + - cssdeck interactive [Jade syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax) + - cssdeck interactive [Jade logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2) + - in [Japanese](http://blog.craftgear.net/4f501e97c1347ec934000001/title/10%E5%88%86%E3%81%A7%E3%82%8F%E3%81%8B%E3%82%8Bjade%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3) + + +## License + +(The MIT License) + +Copyright (c) 2009-2010 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. diff --git a/node_modules/jade/Readme_zh-cn.md b/node_modules/jade/Readme_zh-cn.md new file mode 100644 index 0000000..cb90608 --- /dev/null +++ b/node_modules/jade/Readme_zh-cn.md @@ -0,0 +1,921 @@ +# Jade - 模板引擎 + + Jade 是一个高性能的模板引擎,它深受[Haml](http://haml-lang.com)影响,它是用javascript实现的,并且可以供[node](http://nodejs.org)使用. + + 翻译:[草依山](http://jser.me)   [翻译反馈](http://weibo.com/1826461472/z9jriDdmB#pl_profile_nav)  [Fork me](https://github.com/jserme/jade/) + +## 特性 + + - 客户端支持 + - 代码高可读 + - 灵活的缩进 + - 块展开 + - 混合 + - 静态包含 + - 属性改写 + - 安全,默认代码是转义的 + - 运行时和编译时上下文错误报告 + - 命令行下编译jade模板 + - html 5 模式 (使用 _!!! 5_ 文档类型) + - 在内存中缓存(可选) + - 合并动态和静态标签类 + - 可以通过 _filters_ 修改树 + - 模板继承 + - 原生支持 [Express JS](http://expressjs.com) + - 通过 `each` 枚举对象、数组甚至是不能枚举的对象 + - 块注释 + - 没有前缀的标签 + - AST filters + - 过滤器 + - :sass 必须已经安装[sass.js](http://github.com/visionmedia/sass.js) + - :less 必须已经安装[less.js](http://github.com/cloudhead/less.js) + - :markdown 必须已经安装[markdown-js](http://github.com/evilstreak/markdown-js) 或者[node-discount](http://github.com/visionmedia/node-discount) + - :cdata + - :coffeescript 必须已经安装[coffee-script](http://jashkenas.github.com/coffee-script/) + - [Vim Syntax](https://github.com/digitaltoad/vim-jade) + - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) + - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) + - [html2jade](https://github.com/donpark/html2jade) 转换器 + +## 其它实现 + + - [php](http://github.com/everzet/jade.php) + - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) + - [ruby](http://github.com/stonean/slim) + +## 安装 + +通过 npm: + + npm install jade + +## 浏览器支持 + + 把jade编译为一个可供浏览器使用的单文件,只需要简单的执行: + + $ make jade.js + + 如果你已经安装了uglifyjs (`npm install uglify-js`),你可以执行下面的命令它会生成所有的文件。其实每一个正式版本里都帮你做了这事。 + + $ make jade.min.js + + 默认情况下,为了方便调试Jade会把模板组织成带有形如 `__.lineno = 3` 的行号的形式。 + 在浏览器里使用的时候,你可以通过传递一个选项`{ compileDebug: false }`来去掉这个。 + 下面的模板 + + p Hello #{name} + + 会被翻译成下面的函数: + +```js +function anonymous(locals, attrs, escape, rethrow) { + var buf = []; + with (locals || {}) { + var interp; + buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); + } + return buf.join(""); +} +``` + + 通过使用Jade的 `./runtime.js`你可以在浏览器使用这些预编译的模板而不需要使用Jade, 你只需要使用runtime.js里的工具函数, 它们会放在`jade.attrs`, `jade.escape` 这些里。 把选项 `{ client: true }` 传递给 `jade.compile()`, Jade 会把这些帮助函数的引用放在`jade.attrs`, `jade.escape`. + +```js +function anonymous(locals, attrs, escape, rethrow) { + var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; + var buf = []; + with (locals || {}) { + var interp; + buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); + } + return buf.join(""); +} +``` + +## 公开API + +```javascript + var jade = require('jade'); + + // Compile a function + var fn = jade.compile('string of jade', options); + fn(locals); +``` + +### 选项 + + - `self` 使用`self` 命名空间来持有本地变量. _默认为false_ + - `locals` 本地变量对象 + - `filename` 异常发生时使用,includes时必需 + - `debug` 输出token和翻译后的函数体 + - `compiler` 替换掉jade默认的编译器 + - `compileDebug` `false`的时候调试的结构不会被输出 + +## 语法 + +### 行结束标志 + +**CRLF** 和 **CR** 会在编译之前被转换为 **LF** + +### 标签 + +标签就是一个简单的单词: + + html + +它会被转换为 `` + +标签也是可以有id的: + + div#container + +它会被转换为 `
    ` + +怎么加类呢? + + div.user-details + +转换为 `
    ` + +多个类? 和id? 也是可以搞定的: + + div#foo.bar.baz + +转换为 `
    ` + +不停的div div div 很讨厌啊 , 可以这样: + + #foo + .bar + +这个算是我们的语法糖,它已经被很好的支持了,上面的会输出: + + `
    ` + +### 标签文本 + +只需要简单的把内容放在标签之后: + + p wahoo! + +它会被渲染为 `

    wahoo!

    `. + +很帅吧,但是大段的文本怎么办呢: + + p + | foo bar baz + | rawr rawr + | super cool + | go jade go + +渲染为 `

    foo bar baz rawr.....

    ` + +怎么和数据结合起来? 所有类型的文本展示都可以和数据结合起来,如果我们把`{ name: 'tj', email: 'tj@vision-media.ca' }` 传给编译函数,下面是模板上的写法: + + #user #{name} <#{email}> + +它会被渲染为 `
    tj <tj@vision-media.ca>
    ` + +当就是要输出`#{}` 的时候怎么办? 转义一下! + + p \#{something} + +它会输出`

    #{something}

    ` + +同样可以使用非转义的变量`!{html}`, 下面的模板将直接输出一个script标签 + + - var html = "" + | !{html} + +内联标签同样可以使用文本块来包含文本: + + label + | Username: + input(name='user[name]') + +或者直接使用标签文本: + + label Username: + input(name='user[name]') + +_只_包含文本的标签,比如`script`, `style`, 和 `textarea` 不需要前缀`|` 字符, 比如: + + html + head + title Example + script + if (foo) { + bar(); + } else { + baz(); + } + +这里还有一种选择,可以使用'.' 来开始一段文本块,比如: + + p. + foo asdf + asdf + asdfasdfaf + asdf + asd. + +会被渲染为: + +

    foo asdf + asdf + asdfasdfaf + asdf + asd + . +

    + +这和带一个空格的 '.' 是不一样的, 带空格的会被Jade的解析器忽略,当作一个普通的文字: + + p . + +渲染为: + +

    .

    + + +需要注意的是广西块需要两次转义。比如想要输出下面的文本: + +

    foo\bar

    + +使用: + + p. + foo\\bar + +### 注释 + +单行注释和JavaScript里是一样的,通过"//"来开始,并且必须单独一行: + + // just some paragraphs + p foo + p bar + +渲染为: + + +

    foo

    +

    bar

    + +Jade 同样支持不输出的注释,加一个短横线就行了: + + //- will not output within markup + p foo + p bar + +渲染为: + +

    foo

    +

    bar

    + +### 块注释 + + 块注释也是支持的: + + body + // + #content + h1 Example + +渲染为: + + + + + +Jade 同样很好的支持了条件注释: + + body + //if IE + a(href='http://www.mozilla.com/en-US/firefox/') Get Firefox + + +渲染为: + + + + + +### 内联 + + Jade 支持以自然的方式定义标签嵌套: + + ul + li.first + a(href='#') foo + li + a(href='#') bar + li.last + a(href='#') baz + +### 块展开 + + 块展开可以帮助你在一行内创建嵌套的标签,下面的例子和上面的是一样的: + + ul + li.first: a(href='#') foo + li: a(href='#') bar + li.last: a(href='#') baz + + +### 属性 + +Jade 现在支持使用'(' 和 ')' 作为属性分隔符 + + a(href='http://github.com/login', title='View login page') Login + +当一个值是 `undefined` 或者 `null` 属性_不_会被加上, +所以呢,它不会编译出 'something="null"'. + + div(something=null) + +Boolean 属性也是支持的: + + input(type="checkbox", checked) + +使用代码的Boolean 属性只有当属性为`true`时才会输出: + + input(type="checkbox", checked=someValue) + +多行同样也是可用的: + + input(type='checkbox', + name='agreement', + checked) + +多行的时候可以不加逗号: + + input(type='checkbox' + name='agreement' + checked) + +加点空格,格式好看一点?同样支持 + + input( + type='checkbox' + name='agreement' + checked) + +冒号也是支持的: + + rss(xmlns:atom="atom") + +假如我有一个`user` 对象 `{ id: 12, name: 'tobi' }` +我们希望创建一个指向"/user/12"的链接 `href`, 我们可以使用普通的javascript字符串连接,如下: + + a(href='http://github.com/user/' + user.id)= user.name + +或者我们使用jade的修改方式,这个我想很多使用Ruby或者 CoffeeScript的人会看起来像普通的js..: + + a(href='http://github.com/user/#{user.id}')= user.name + +`class`属性是一个特殊的属性,你可以直接传递一个数组,比如`bodyClasses = ['user', 'authenticated']` : + + body(class=bodyClasses) + +### HTML + + 内联的html是可以的,我们可以使用管道定义一段文本 : + +``` +html + body + |

    Title

    + |

    foo bar baz

    +``` + + 或者我们可以使用`.` 来告诉Jade我们需要一段文本: + +``` +html + body. +

    Title

    +

    foo bar baz

    +``` + + 上面的两个例子都会渲染成相同的结果: + +``` +

    Title

    +

    foo bar baz

    + +``` + + 这条规则适应于在jade里的任何文本: + +``` +html + body + h1 User #{name} +``` + +### Doctypes + +添加文档类型只需要简单的使用 `!!!`, 或者 `doctype` 跟上下面的可选项: + + !!! + +会渲染出 _transitional_ 文档类型, 或者: + + !!! 5 + +or + + !!! html + +or + + doctype html + +doctypes 是大小写不敏感的, 所以下面两个是一样的: + + doctype Basic + doctype basic + +当然也是可以直接传递一段文档类型的文本: + + doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN + +渲染后: + + + +会输出 _html 5_ 文档类型. 下面的默认的文档类型,可以很简单的扩展: + +```javascript + var doctypes = exports.doctypes = { + '5': '', + 'xml': '', + 'default': '', + 'transitional': '', + 'strict': '', + 'frameset': '', + '1.1': '', + 'basic': '', + 'mobile': '' + }; +``` + +通过下面的代码可以很简单的改变默认的文档类型: + +```javascript + jade.doctypes.default = 'whatever you want'; +``` + +## 过滤器 + +过滤器前缀 `:`, 比如 `:markdown` 会把下面块里的文本交给专门的函数进行处理。查看顶部 _特性_ 里有哪些可用的过滤器。 + + body + :markdown + Woah! jade _and_ markdown, very **cool** + we can even link to [stuff](http://google.com) + +渲染为: + +

    Woah! jade and markdown, very cool we can even link to stuff

    + +## 代码 + +Jade目前支持三种类型的可执行代码。第一种是前缀`-`, 这是不会被输出的: + + - var foo = 'bar'; + +这可以用在条件语句或者循环中: + + - for (var key in obj) + p= obj[key] + +由于Jade的缓存技术,下面的代码也是可以的: + + - if (foo) + ul + li yay + li foo + li worked + - else + p oh no! didnt work + +哈哈,甚至是很长的循环也是可以的: + + - if (items.length) + ul + - items.forEach(function(item){ + li= item + - }) + +所以你想要的! + +下一步我们要_转义_输出的代码,比如我们返回一个值,只要前缀一个`=`: + + - var foo = 'bar' + = foo + h1= foo + +它会渲染为`bar

    bar

    `. 为了安全起见,使用`=`输出的代码默认是转义的,如果想直接输出不转义的值可以使用`!=`: + + p!= aVarContainingMoreHTML + +Jade 同样是设计师友好的,它可以使javascript更直接更富表现力。比如下面的赋值语句是相等的,同时表达式还是通常的javascript: + + - var foo = 'foo ' + 'bar' + foo = 'foo ' + 'bar' + +Jade会把 `if`, `else if`, `else`, `until`, `while`, `unless`同别的优先对待, 但是你得记住它们还是普通的javascript: + + if foo == 'bar' + ul + li yay + li foo + li worked + else + p oh no! didnt work + +## 循环 + +尽管已经支持JavaScript原生代码,Jade还是支持了一些特殊的标签,它们可以让模板更加易于理解,其中之一就是`each`, 这种形式: + + each VAL[, KEY] in OBJ + +一个遍历数组的例子 : + + - var items = ["one", "two", "three"] + each item in items + li= item + +渲染为: + +
  • one
  • +
  • two
  • +
  • three
  • + +遍历一个数组同时带上索引: + + items = ["one", "two", "three"] + each item, i in items + li #{item}: #{i} + +渲染为: + +
  • one: 0
  • +
  • two: 1
  • +
  • three: 2
  • + +遍历一个数组的键值: + + obj = { foo: 'bar' } + each val, key in obj + li #{key}: #{val} + +将会渲染为:`
  • foo: bar
  • ` + +Jade在内部会把这些语句转换成原生的JavaScript语句,就像使用 `users.forEach(function(user){`, +词法作用域和嵌套会像在普通的JavaScript中一样: + + each user in users + each role in user.roles + li= role + +如果你喜欢,也可以使用`for` : + + for user in users + for role in user.roles + li= role + +## 条件语句 + +Jade 条件语句和使用了(`-`) 前缀的JavaScript语句是一致的,然后它允许你不使用圆括号,这样会看上去对设计师更友好一点, +同时要在心里记住这个表达式渲染出的是_常规_Javascript: + + for user in users + if user.role == 'admin' + p #{user.name} is an admin + else + p= user.name + +和下面的使用了常规JavaScript的代码是相等的: + + for user in users + - if (user.role == 'admin') + p #{user.name} is an admin + - else + p= user.name + +Jade 同时支持`unless`, 这和`if (!(expr))`是等价的: + + for user in users + unless user.isAnonymous + p + | Click to view + a(href='http://github.com/users/' + user.id)= user.name + +## 模板继承 + + Jade 支持通过 `block` 和 `extends` 关键字来实现模板继承。 一个块就是一个Jade的"block" ,它将在子模板中实现,同时是支持递归的。 + + Jade 块如果没有内容,Jade会添加默认内容,下面的代码默认会输出`block scripts`, `block content`, 和 `block foot`. + +``` +html + head + h1 My Site - #{title} + block scripts + script(src='http://github.com/jquery.js') + body + block content + block foot + #footer + p some footer content +``` + + 现在我们来继承这个布局,简单创建一个新文件,像下面那样直接使用`extends`,给定路径(可以选择带.jade扩展名或者不带). 你可以定义一个或者更多的块来覆盖父级块内容, 注意到这里的`foot`块_没有_定义,所以它还会输出父级的"some footer content"。 + +``` +extends extend-layout + +block scripts + script(src='http://github.com/jquery.js') + script(src='http://github.com/pets.js') + +block content + h1= title + each pet in pets + include pet +``` + + 同样可以在一个子块里添加块,就像下面实现的块`content`里又定义了两个可以被实现的块`sidebar`和`primary`,或者子模板直接实现`content`。 + +``` +extends regular-layout + +block content + .sidebar + block sidebar + p nothing + .primary + block primary + p nothing +``` + +## 包含 + + Includes 允许你静态包含一段Jade, 或者别的存放在单个文件中的东西比如css, html。 非常常见的例子是包含头部和页脚。 假设我们有一个下面目录结构的文件夹: + + ./layout.jade + ./includes/ + ./head.jade + ./tail.jade + +下面是 _layout.jade_ 的内容: + + html + include includes/head + body + h1 My Site + p Welcome to my super amazing site. + include includes/foot + +这两个包含 _includes/head_ 和 _includes/foot_ 都会读取相对于给 _layout.jade_ 参数`filename` 的路径的文件, 这是一个绝对路径,不用担心Express帮你搞定这些了。Include 会解析这些文件,并且插入到已经生成的语法树中,然后渲染为你期待的内容: + +```html + + + My Site + + + +

    My Site

    +

    Welcome to my super lame site.

    + + + +``` + + 前面已经提到,`include` 可以包含比如html或者css这样的内容。给定一个扩展名后,Jade不会把这个文件当作一个Jade源代码,并且会把它当作一个普通文本包含进来: + +``` +html + body + include content.html +``` + + Include 也可以接受块内容,给定的块将会附加到包含文件 _最后_ 的块里。 举个例子,`head.jade` 包含下面的内容: + + + ``` +head + script(src='http://github.com/jquery.js') +``` + + 我们可以像下面给`include head`添加内容, 这里是添加两个脚本. + +``` +html + include head + script(src='http://github.com/foo.js') + script(src='http://github.com/bar.js') + body + h1 test +``` + + +## Mixins + + Mixins在编译的模板里会被Jade转换为普通的JavaScript函数。 Mixins 可以还参数,但不是必需的: + + mixin list + ul + li foo + li bar + li baz + + 使用不带参数的mixin看上去非常简单,在一个块外: + + h2 Groceries + mixin list + + Mixins 也可以带一个或者多个参数,参数就是普通的javascripts表达式,比如下面的例子: + + mixin pets(pets) + ul.pets + - each pet in pets + li= pet + + mixin profile(user) + .user + h2= user.name + mixin pets(user.pets) + + 会输出像下面的html: + +```html +
    +

    tj

    +
      +
    • tobi
    • +
    • loki
    • +
    • jane
    • +
    • manny
    • +
    +
    +``` + +## 产生输出 + + 假设我们有下面的Jade源码: + +``` +- var title = 'yay' +h1.title #{title} +p Just an example +``` + + 当 `compileDebug` 选项不是`false`, Jade 会编译时会把函数里加上 `__.lineno = n;`, 这个参数会在编译出错时传递给`rethrow()`, 而这个函数会在Jade初始输出时给出一个有用的错误信息。 + +```js +function anonymous(locals) { + var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; + var rethrow = jade.rethrow; + try { + var attrs = jade.attrs, escape = jade.escape; + var buf = []; + with (locals || {}) { + var interp; + __.lineno = 1; + var title = 'yay' + __.lineno = 2; + buf.push(''); + buf.push('' + escape((interp = title) == null ? '' : interp) + ''); + buf.push(''); + __.lineno = 3; + buf.push('

    '); + buf.push('Just an example'); + buf.push('

    '); + } + return buf.join(""); + } catch (err) { + rethrow(err, __.input, __.filename, __.lineno); + } +} +``` + +当`compileDebug` 参数是`false`, 这个参数会被去掉,这样对于轻量级的浏览器端模板是非常有用的。结合Jade的参数和当前源码库里的 `./runtime.js` 文件,你可以通过toString()来编译模板而不需要在浏览器端运行整个Jade库,这样可以提高性能,也可以减少载入的JavaScript数量。 + +```js +function anonymous(locals) { + var attrs = jade.attrs, escape = jade.escape; + var buf = []; + with (locals || {}) { + var interp; + var title = 'yay' + buf.push(''); + buf.push('' + escape((interp = title) == null ? '' : interp) + ''); + buf.push(''); + buf.push('

    '); + buf.push('Just an example'); + buf.push('

    '); + } + return buf.join(""); +} +``` + +## Makefile的一个例子 + + 通过执行`make`, 下面的Makefile例子可以把 _pages/*.jade_ 编译为 _pages/*.html_ 。 + +```make +JADE = $(shell find pages/*.jade) +HTML = $(JADE:.jade=.html) + +all: $(HTML) + +%.html: %.jade + jade < $< --path $< > $@ + +clean: + rm -f $(HTML) + +.PHONY: clean +``` + +这个可以和`watch(1)` 命令起来产生像下面的行为: + + $ watch make + +## 命令行的jade(1) + +``` + +使用: jade [options] [dir|file ...] + +选项: + + -h, --help 输出帮助信息 + -v, --version 输出版本号 + -o, --obj javascript选项 + -O, --out 输出编译后的html到 + -p, --path 在处理stdio时,查找包含文件时的查找路径 + +Examples: + + # 编译整个目录 + $ jade templates + + # 生成 {foo,bar}.html + $ jade {foo,bar}.jade + + # 在标准IO下使用jade + $ jade < my.jade > my.html + + # 在标准IO下使用jade, 同时指定用于查找包含的文件 + $ jade < my.jade -p my.jade > my.html + + # 在标准IO下使用jade + $ echo "h1 Jade!" | jade + + # foo, bar 目录渲染到 /tmp + $ jade foo bar --out /tmp + +``` + +## License + +(The MIT License) + +Copyright (c) 2009-2010 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. diff --git a/node_modules/jade/bin/jade b/node_modules/jade/bin/jade new file mode 100755 index 0000000..8f1c816 --- /dev/null +++ b/node_modules/jade/bin/jade @@ -0,0 +1,168 @@ +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var fs = require('fs') + , program = require('commander') + , path = require('path') + , basename = path.basename + , dirname = path.dirname + , resolve = path.resolve + , exists = fs.existsSync || path.existsSync + , join = path.join + , mkdirp = require('mkdirp') + , jade = require('../'); + +// jade options + +var options = {}; + +// options + +program + .version(jade.version) + .usage('[options] [dir|file ...]') + .option('-o, --obj ', 'javascript options object') + .option('-O, --out ', 'output the compiled html to ') + .option('-p, --path ', 'filename used to resolve includes') + .option('-P, --pretty', 'compile pretty html output') + .option('-c, --client', 'compile function for client-side runtime.js') + .option('-D, --no-debug', 'compile without debugging (smaller functions)') + .option('-w, --watch', 'watch files for changes and automatically re-render') + +program.on('--help', function(){ + console.log(' Examples:'); + console.log(''); + console.log(' # translate jade the templates dir'); + console.log(' $ jade templates'); + console.log(''); + console.log(' # create {foo,bar}.html'); + console.log(' $ jade {foo,bar}.jade'); + console.log(''); + console.log(' # jade over stdio'); + console.log(' $ jade < my.jade > my.html'); + console.log(''); + console.log(' # jade over stdio'); + console.log(' $ echo "h1 Jade!" | jade'); + console.log(''); + console.log(' # foo, bar dirs rendering to /tmp'); + console.log(' $ jade foo bar --out /tmp '); + console.log(''); +}); + +program.parse(process.argv); + +// options given, parse them + +if (program.obj) { + if (exists(program.obj)) { + options = JSON.parse(fs.readFileSync(program.obj)); + } else { + options = eval('(' + program.obj + ')'); + } +} + +// --filename + +if (program.path) options.filename = program.path; + +// --no-debug + +options.compileDebug = program.debug; + +// --client + +options.client = program.client; + +// --pretty + +options.pretty = program.pretty; + +// --watch + +options.watch = program.watch; + +// left-over args are file paths + +var files = program.args; + +// compile files + +if (files.length) { + console.log(); + files.forEach(renderFile); + if (options.watch) { + files.forEach(function (file) { + fs.watchFile(file, {interval: 100}, function (curr, prev) { + if (curr.mtime > prev.mtime) renderFile(file); + }); + }); + } + process.on('exit', function () { + console.log(); + }); +// stdio +} else { + stdin(); +} + +/** + * Compile from stdin. + */ + +function stdin() { + var buf = ''; + process.stdin.setEncoding('utf8'); + process.stdin.on('data', function(chunk){ buf += chunk; }); + process.stdin.on('end', function(){ + var fn = jade.compile(buf, options); + var output = options.client + ? fn.toString() + : fn(options); + process.stdout.write(output); + }).resume(); +} + +/** + * Process the given path, compiling the jade files found. + * Always walk the subdirectories. + */ + +function renderFile(path) { + var re = /\.jade$/; + fs.lstat(path, function(err, stat) { + if (err) throw err; + // Found jade file + if (stat.isFile() && re.test(path)) { + fs.readFile(path, 'utf8', function(err, str){ + if (err) throw err; + options.filename = path; + var fn = jade.compile(str, options); + var extname = options.client ? '.js' : '.html'; + path = path.replace(re, extname); + if (program.out) path = join(program.out, basename(path)); + var dir = resolve(dirname(path)); + mkdirp(dir, 0755, function(err){ + if (err) throw err; + var output = options.client + ? fn.toString() + : fn(options); + fs.writeFile(path, output, function(err){ + if (err) throw err; + console.log(' \033[90mrendered \033[36m%s\033[0m', path); + }); + }); + }); + // Found directory + } else if (stat.isDirectory()) { + fs.readdir(path, function(err, files) { + if (err) throw err; + files.map(function(filename) { + return path + '/' + filename; + }).forEach(renderFile); + }); + } + }); +} diff --git a/node_modules/jade/index.js b/node_modules/jade/index.js new file mode 100644 index 0000000..8ad059f --- /dev/null +++ b/node_modules/jade/index.js @@ -0,0 +1,4 @@ + +module.exports = process.env.JADE_COV + ? require('./lib-cov/jade') + : require('./lib/jade'); \ No newline at end of file diff --git a/node_modules/jade/jade.js b/node_modules/jade/jade.js new file mode 100644 index 0000000..ad22ec3 --- /dev/null +++ b/node_modules/jade/jade.js @@ -0,0 +1,3654 @@ +(function() { + +// CommonJS require() + +function require(p){ + 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.charAt(0)) 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("compiler.js", function(module, exports, require){ + +/*! + * Jade - Compiler + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var nodes = require('./nodes') + , filters = require('./filters') + , doctypes = require('./doctypes') + , selfClosing = require('./self-closing') + , runtime = require('./runtime') + , utils = require('./utils'); + + + if (!Object.keys) { + Object.keys = function(obj){ + var arr = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + arr.push(key); + } + } + return arr; + } + } + + if (!String.prototype.trimLeft) { + String.prototype.trimLeft = function(){ + return this.replace(/^\s+/, ''); + } + } + + + +/** + * Initialize `Compiler` with the given `node`. + * + * @param {Node} node + * @param {Object} options + * @api public + */ + +var Compiler = module.exports = function Compiler(node, options) { + this.options = options = options || {}; + this.node = node; + this.hasCompiledDoctype = false; + this.hasCompiledTag = false; + this.pp = options.pretty || false; + this.debug = false !== options.compileDebug; + this.indents = 0; + this.parentIndents = 0; + if (options.doctype) this.setDoctype(options.doctype); +}; + +/** + * Compiler prototype. + */ + +Compiler.prototype = { + + /** + * Compile parse tree to JavaScript. + * + * @api public + */ + + compile: function(){ + this.buf = ['var interp;']; + if (this.pp) this.buf.push("var __indent = [];"); + this.lastBufferedIdx = -1; + this.visit(this.node); + return this.buf.join('\n'); + }, + + /** + * Sets the default doctype `name`. Sets terse mode to `true` when + * html 5 is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {string} name + * @api public + */ + + setDoctype: function(name){ + name = (name && name.toLowerCase()) || 'default'; + this.doctype = doctypes[name] || ''; + this.terse = this.doctype.toLowerCase() == ''; + this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) + this.prettyIndent(1, true); + + for (var i = 0; i < len; ++i) { + // Pretty print text + if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) + this.prettyIndent(1, false); + + this.visit(block.nodes[i]); + // Multiple text nodes are separated by newlines + if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) + this.buffer('\\n'); + } + }, + + /** + * Visit `doctype`. Sets terse mode to `true` when html 5 + * is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {Doctype} doctype + * @api public + */ + + visitDoctype: function(doctype){ + if (doctype && (doctype.val || !this.doctype)) { + this.setDoctype(doctype.val || 'default'); + } + + if (this.doctype) this.buffer(this.doctype); + this.hasCompiledDoctype = true; + }, + + /** + * Visit `mixin`, generating a function that + * may be called within the template. + * + * @param {Mixin} mixin + * @api public + */ + + visitMixin: function(mixin){ + var name = mixin.name.replace(/-/g, '_') + '_mixin' + , args = mixin.args || '' + , block = mixin.block + , attrs = mixin.attrs + , pp = this.pp; + + if (mixin.call) { + if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") + if (block || attrs.length) { + + this.buf.push(name + '.call({'); + + if (block) { + this.buf.push('block: function(){'); + + // Render block with no indents, dynamically added when rendered + this.parentIndents++; + var _indents = this.indents; + this.indents = 0; + this.visit(mixin.block); + this.indents = _indents; + this.parentIndents--; + + if (attrs.length) { + this.buf.push('},'); + } else { + this.buf.push('}'); + } + } + + if (attrs.length) { + var val = this.attrs(attrs); + if (val.inherits) { + this.buf.push('attributes: merge({' + val.buf + + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); + } else { + this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); + } + } + + if (args) { + this.buf.push('}, ' + args + ');'); + } else { + this.buf.push('});'); + } + + } else { + this.buf.push(name + '(' + args + ');'); + } + if (pp) this.buf.push("__indent.pop();") + } else { + this.buf.push('var ' + name + ' = function(' + args + '){'); + this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); + this.parentIndents++; + this.visit(block); + this.parentIndents--; + this.buf.push('};'); + } + }, + + /** + * Visit `tag` buffering tag markup, generating + * attributes, visiting the `tag`'s code and block. + * + * @param {Tag} tag + * @api public + */ + + visitTag: function(tag){ + this.indents++; + var name = tag.name + , pp = this.pp; + + if (tag.buffer) name = "' + (" + name + ") + '"; + + if (!this.hasCompiledTag) { + if (!this.hasCompiledDoctype && 'html' == name) { + this.visitDoctype(); + } + this.hasCompiledTag = true; + } + + // pretty print + if (pp && !tag.isInline()) + this.prettyIndent(0, true); + + if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { + this.buffer('<' + name); + this.visitAttributes(tag.attrs); + this.terse + ? this.buffer('>') + : this.buffer('/>'); + } else { + // Optimize attributes buffering + if (tag.attrs.length) { + this.buffer('<' + name); + if (tag.attrs.length) this.visitAttributes(tag.attrs); + this.buffer('>'); + } else { + this.buffer('<' + name + '>'); + } + if (tag.code) this.visitCode(tag.code); + this.escape = 'pre' == tag.name; + this.visit(tag.block); + + // pretty print + if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) + this.prettyIndent(0, true); + + this.buffer(''); + } + this.indents--; + }, + + /** + * Visit `filter`, throwing when the filter does not exist. + * + * @param {Filter} filter + * @api public + */ + + visitFilter: function(filter){ + var fn = filters[filter.name]; + + // unknown filter + if (!fn) { + if (filter.isASTFilter) { + throw new Error('unknown ast filter "' + filter.name + ':"'); + } else { + throw new Error('unknown filter ":' + filter.name + '"'); + } + } + + if (filter.isASTFilter) { + this.buf.push(fn(filter.block, this, filter.attrs)); + } else { + var text = filter.block.nodes.map(function(node){ return node.val }).join('\n'); + filter.attrs = filter.attrs || {}; + filter.attrs.filename = this.options.filename; + this.buffer(utils.text(fn(text, filter.attrs))); + } + }, + + /** + * Visit `text` node. + * + * @param {Text} text + * @api public + */ + + visitText: function(text){ + text = utils.text(text.val.replace(/\\/g, '_SLASH_')); + if (this.escape) text = escape(text); + text = text.replace(/_SLASH_/g, '\\\\'); + this.buffer(text); + }, + + /** + * Visit a `comment`, only buffering when the buffer flag is set. + * + * @param {Comment} comment + * @api public + */ + + visitComment: function(comment){ + if (!comment.buffer) return; + if (this.pp) this.prettyIndent(1, true); + this.buffer(''); + }, + + /** + * Visit a `BlockComment`. + * + * @param {Comment} comment + * @api public + */ + + visitBlockComment: function(comment){ + if (!comment.buffer) return; + if (0 == comment.val.trim().indexOf('if')) { + this.buffer(''); + } else { + this.buffer(''); + } + }, + + /** + * Visit `code`, respecting buffer / escape flags. + * If the code is followed by a block, wrap it in + * a self-calling function. + * + * @param {Code} code + * @api public + */ + + visitCode: function(code){ + // Wrap code blocks with {}. + // we only wrap unbuffered code blocks ATM + // since they are usually flow control + + // Buffer code + if (code.buffer) { + var val = code.val.trimLeft(); + this.buf.push('var __val__ = ' + val); + val = 'null == __val__ ? "" : __val__'; + if (code.escape) val = 'escape(' + val + ')'; + this.buf.push("buf.push(" + val + ");"); + } else { + this.buf.push(code.val); + } + + // Block support + if (code.block) { + if (!code.buffer) this.buf.push('{'); + this.visit(code.block); + if (!code.buffer) this.buf.push('}'); + } + }, + + /** + * Visit `each` block. + * + * @param {Each} each + * @api public + */ + + visitEach: function(each){ + this.buf.push('' + + '// iterate ' + each.obj + '\n' + + ';(function(){\n' + + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); + + if (each.alternative) { + this.buf.push(' if (' + each.obj + '.length) {'); + } + + this.buf.push('' + + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' + + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); + + this.visit(each.block); + + this.buf.push(' }\n'); + + if (each.alternative) { + this.buf.push(' } else {'); + this.visit(each.alternative); + this.buf.push(' }'); + } + + this.buf.push('' + + ' } else {\n' + + ' var $$l = 0;\n' + + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' + + ' $$l++;' + + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' + + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); + + this.visit(each.block); + + this.buf.push(' }\n'); + + this.buf.push(' }\n'); + if (each.alternative) { + this.buf.push(' if ($$l === 0) {'); + this.visit(each.alternative); + this.buf.push(' }'); + } + this.buf.push(' }\n}).call(this);\n'); + }, + + /** + * Visit `attrs`. + * + * @param {Array} attrs + * @api public + */ + + visitAttributes: function(attrs){ + var val = this.attrs(attrs); + if (val.inherits) { + this.buf.push("buf.push(attrs(merge({ " + val.buf + + " }, attributes), merge(" + val.escaped + ", escaped, true)));"); + } else if (val.constant) { + eval('var buf={' + val.buf + '};'); + this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); + } else { + this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); + } + }, + + /** + * Compile attributes. + */ + + attrs: function(attrs){ + var buf = [] + , classes = [] + , escaped = {} + , constant = attrs.every(function(attr){ return isConstant(attr.val) }) + , inherits = false; + + if (this.terse) buf.push('terse: true'); + + attrs.forEach(function(attr){ + if (attr.name == 'attributes') return inherits = true; + escaped[attr.name] = attr.escaped; + if (attr.name == 'class') { + classes.push('(' + attr.val + ')'); + } else { + var pair = "'" + attr.name + "':(" + attr.val + ')'; + buf.push(pair); + } + }); + + if (classes.length) { + classes = classes.join(" + ' ' + "); + buf.push("class: " + classes); + } + + return { + buf: buf.join(', ').replace('class:', '"class":'), + escaped: JSON.stringify(escaped), + inherits: inherits, + constant: constant + }; + } +}; + +/** + * Check if expression can be evaluated to a constant + * + * @param {String} expression + * @return {Boolean} + * @api private + */ + +function isConstant(val){ + // Check strings/literals + if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) + return true; + + // Check numbers + if (!isNaN(Number(val))) + return true; + + // Check arrays + var matches; + if (matches = /^ *\[(.*)\] *$/.exec(val)) + return matches[1].split(',').every(isConstant); + + return false; +} + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +function escape(html){ + return String(html) + .replace(/&(?!\w+;)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +} + +}); // module: compiler.js + +require.register("doctypes.js", function(module, exports, require){ + +/*! + * Jade - doctypes + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = { + '5': '' + , 'default': '' + , 'xml': '' + , 'transitional': '' + , 'strict': '' + , 'frameset': '' + , '1.1': '' + , 'basic': '' + , 'mobile': '' +}; +}); // module: doctypes.js + +require.register("filters.js", function(module, exports, require){ + +/*! + * Jade - filters + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = { + + /** + * Wrap text with CDATA block. + */ + + cdata: function(str){ + return ''; + }, + + /** + * Transform sass to css, wrapped in style tags. + */ + + sass: function(str){ + str = str.replace(/\\n/g, '\n'); + var sass = require('sass').render(str).replace(/\n/g, '\\n'); + return ''; + }, + + /** + * Transform stylus to css, wrapped in style tags. + */ + + stylus: function(str, options){ + var ret; + str = str.replace(/\\n/g, '\n'); + var stylus = require('stylus'); + stylus(str, options).render(function(err, css){ + if (err) throw err; + ret = css.replace(/\n/g, '\\n'); + }); + return ''; + }, + + /** + * Transform less to css, wrapped in style tags. + */ + + less: function(str){ + var ret; + str = str.replace(/\\n/g, '\n'); + require('less').render(str, function(err, css){ + if (err) throw err; + ret = ''; + }); + return ret; + }, + + /** + * Transform markdown to html. + */ + + markdown: function(str){ + var md; + + // support markdown / discount + try { + md = require('markdown'); + } catch (err){ + try { + md = require('discount'); + } catch (err) { + try { + md = require('markdown-js'); + } catch (err) { + try { + md = require('marked'); + } catch (err) { + throw new + Error('Cannot find markdown library, install markdown, discount, or marked.'); + } + } + } + } + + str = str.replace(/\\n/g, '\n'); + return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); + }, + + /** + * Transform coffeescript to javascript. + */ + + coffeescript: function(str){ + var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); + return ''; + } +}; + +}); // module: filters.js + +require.register("inline-tags.js", function(module, exports, require){ + +/*! + * Jade - inline tags + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = [ + 'a' + , 'abbr' + , 'acronym' + , 'b' + , 'br' + , 'code' + , 'em' + , 'font' + , 'i' + , 'img' + , 'ins' + , 'kbd' + , 'map' + , 'samp' + , 'small' + , 'span' + , 'strong' + , 'sub' + , 'sup' +]; +}); // module: inline-tags.js + +require.register("jade.js", function(module, exports, require){ +/*! + * Jade + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Parser = require('./parser') + , Lexer = require('./lexer') + , Compiler = require('./compiler') + , runtime = require('./runtime') + +/** + * Library version. + */ + +exports.version = '0.27.6'; + +/** + * Expose self closing tags. + */ + +exports.selfClosing = require('./self-closing'); + +/** + * Default supported doctypes. + */ + +exports.doctypes = require('./doctypes'); + +/** + * Text filters. + */ + +exports.filters = require('./filters'); + +/** + * Utilities. + */ + +exports.utils = require('./utils'); + +/** + * Expose `Compiler`. + */ + +exports.Compiler = Compiler; + +/** + * Expose `Parser`. + */ + +exports.Parser = Parser; + +/** + * Expose `Lexer`. + */ + +exports.Lexer = Lexer; + +/** + * Nodes. + */ + +exports.nodes = require('./nodes'); + +/** + * Jade runtime helpers. + */ + +exports.runtime = runtime; + +/** + * Template function cache. + */ + +exports.cache = {}; + +/** + * Parse the given `str` of jade and return a function body. + * + * @param {String} str + * @param {Object} options + * @return {String} + * @api private + */ + +function parse(str, options){ + try { + // Parse + var parser = new Parser(str, options.filename, options); + + // Compile + var compiler = new (options.compiler || Compiler)(parser.parse(), options) + , js = compiler.compile(); + + // Debug compiler + if (options.debug) { + console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); + } + + return '' + + 'var buf = [];\n' + + (options.self + ? 'var self = locals || {};\n' + js + : 'with (locals || {}) {\n' + js + '\n}\n') + + 'return buf.join("");'; + } catch (err) { + parser = parser.context(); + runtime.rethrow(err, parser.filename, parser.lexer.lineno); + } +} + +/** + * Strip any UTF-8 BOM off of the start of `str`, if it exists. + * + * @param {String} str + * @return {String} + * @api private + */ + +function stripBOM(str){ + return 0xFEFF == str.charCodeAt(0) + ? str.substring(1) + : str; +} + +/** + * Compile a `Function` representation of the given jade `str`. + * + * Options: + * + * - `compileDebug` when `false` debugging code is stripped from the compiled template + * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` + * for use with the Jade client-side runtime.js + * + * @param {String} str + * @param {Options} options + * @return {Function} + * @api public + */ + +exports.compile = function(str, options){ + var options = options || {} + , client = options.client + , filename = options.filename + ? JSON.stringify(options.filename) + : 'undefined' + , fn; + + str = stripBOM(String(str)); + + if (options.compileDebug !== false) { + fn = [ + 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' + , 'try {' + , parse(str, options) + , '} catch (err) {' + , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' + , '}' + ].join('\n'); + } else { + fn = parse(str, options); + } + + if (client) { + fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; + } + + fn = new Function('locals, attrs, escape, rethrow, merge', fn); + + if (client) return fn; + + return function(locals){ + return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); + }; +}; + +/** + * Render the given `str` of jade and invoke + * the callback `fn(err, str)`. + * + * Options: + * + * - `cache` enable template caching + * - `filename` filename required for `include` / `extends` and caching + * + * @param {String} str + * @param {Object|Function} options or fn + * @param {Function} fn + * @api public + */ + +exports.render = function(str, options, fn){ + // swap args + if ('function' == typeof options) { + fn = options, options = {}; + } + + // cache requires .filename + if (options.cache && !options.filename) { + return fn(new Error('the "filename" option is required for caching')); + } + + try { + var path = options.filename; + var tmpl = options.cache + ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) + : exports.compile(str, options); + fn(null, tmpl(options)); + } catch (err) { + fn(err); + } +}; + +/** + * Render a Jade 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 = {}; + } + + try { + options.filename = path; + var str = options.cache + ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) + : fs.readFileSync(path, 'utf8'); + exports.render(str, options, fn); + } catch (err) { + fn(err); + } +}; + +/** + * Express support. + */ + +exports.__express = exports.renderFile; + +}); // module: jade.js + +require.register("lexer.js", function(module, exports, require){ +/*! + * Jade - Lexer + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +var utils = require('./utils'); + +/** + * Initialize `Lexer` with the given `str`. + * + * Options: + * + * - `colons` allow colons for attr delimiters + * + * @param {String} str + * @param {Object} options + * @api private + */ + +var Lexer = module.exports = function Lexer(str, options) { + options = options || {}; + this.input = str.replace(/\r\n|\r/g, '\n'); + this.colons = options.colons; + this.deferredTokens = []; + this.lastIndents = 0; + this.lineno = 1; + this.stash = []; + this.indentStack = []; + this.indentRe = null; + this.pipeless = false; +}; + +/** + * Lexer prototype. + */ + +Lexer.prototype = { + + /** + * Construct a token with the given `type` and `val`. + * + * @param {String} type + * @param {String} val + * @return {Object} + * @api private + */ + + tok: function(type, val){ + return { + type: type + , line: this.lineno + , val: val + } + }, + + /** + * Consume the given `len` of input. + * + * @param {Number} len + * @api private + */ + + consume: function(len){ + this.input = this.input.substr(len); + }, + + /** + * Scan for `type` with the given `regexp`. + * + * @param {String} type + * @param {RegExp} regexp + * @return {Object} + * @api private + */ + + scan: function(regexp, type){ + var captures; + if (captures = regexp.exec(this.input)) { + this.consume(captures[0].length); + return this.tok(type, captures[1]); + } + }, + + /** + * Defer the given `tok`. + * + * @param {Object} tok + * @api private + */ + + defer: function(tok){ + this.deferredTokens.push(tok); + }, + + /** + * Lookahead `n` tokens. + * + * @param {Number} n + * @return {Object} + * @api private + */ + + lookahead: function(n){ + var fetch = n - this.stash.length; + while (fetch-- > 0) this.stash.push(this.next()); + return this.stash[--n]; + }, + + /** + * Return the indexOf `start` / `end` delimiters. + * + * @param {String} start + * @param {String} end + * @return {Number} + * @api private + */ + + indexOfDelimiters: function(start, end){ + var str = this.input + , nstart = 0 + , nend = 0 + , pos = 0; + for (var i = 0, len = str.length; i < len; ++i) { + if (start == str.charAt(i)) { + ++nstart; + } else if (end == str.charAt(i)) { + if (++nend == nstart) { + pos = i; + break; + } + } + } + return pos; + }, + + /** + * Stashed token. + */ + + stashed: function() { + return this.stash.length + && this.stash.shift(); + }, + + /** + * Deferred token. + */ + + deferred: function() { + return this.deferredTokens.length + && this.deferredTokens.shift(); + }, + + /** + * end-of-source. + */ + + eos: function() { + if (this.input.length) return; + if (this.indentStack.length) { + this.indentStack.shift(); + return this.tok('outdent'); + } else { + return this.tok('eos'); + } + }, + + /** + * Blank line. + */ + + blank: function() { + var captures; + if (captures = /^\n *\n/.exec(this.input)) { + this.consume(captures[0].length - 1); + + ++this.lineno; + if (this.pipeless) return this.tok('text', ''); + return this.next(); + } + }, + + /** + * Comment. + */ + + comment: function() { + var captures; + if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('comment', captures[2]); + tok.buffer = '-' != captures[1]; + return tok; + } + }, + + /** + * Interpolated tag. + */ + + interpolation: function() { + var captures; + if (captures = /^#\{(.*?)\}/.exec(this.input)) { + this.consume(captures[0].length); + return this.tok('interpolation', captures[1]); + } + }, + + /** + * Tag. + */ + + tag: function() { + var captures; + if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { + this.consume(captures[0].length); + var tok, name = captures[1]; + if (':' == name[name.length - 1]) { + name = name.slice(0, -1); + tok = this.tok('tag', name); + this.defer(this.tok(':')); + while (' ' == this.input[0]) this.input = this.input.substr(1); + } else { + tok = this.tok('tag', name); + } + tok.selfClosing = !! captures[2]; + return tok; + } + }, + + /** + * Filter. + */ + + filter: function() { + return this.scan(/^:(\w+)/, 'filter'); + }, + + /** + * Doctype. + */ + + doctype: function() { + return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); + }, + + /** + * Id. + */ + + id: function() { + return this.scan(/^#([\w-]+)/, 'id'); + }, + + /** + * Class. + */ + + className: function() { + return this.scan(/^\.([\w-]+)/, 'class'); + }, + + /** + * Text. + */ + + text: function() { + return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); + }, + + /** + * Extends. + */ + + "extends": function() { + return this.scan(/^extends? +([^\n]+)/, 'extends'); + }, + + /** + * Block prepend. + */ + + prepend: function() { + var captures; + if (captures = /^prepend +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = 'prepend' + , name = captures[1] + , tok = this.tok('block', name); + tok.mode = mode; + return tok; + } + }, + + /** + * Block append. + */ + + append: function() { + var captures; + if (captures = /^append +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = 'append' + , name = captures[1] + , tok = this.tok('block', name); + tok.mode = mode; + return tok; + } + }, + + /** + * Block. + */ + + block: function() { + var captures; + if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = captures[1] || 'replace' + , name = captures[2] + , tok = this.tok('block', name); + + tok.mode = mode; + return tok; + } + }, + + /** + * Yield. + */ + + yield: function() { + return this.scan(/^yield */, 'yield'); + }, + + /** + * Include. + */ + + include: function() { + return this.scan(/^include +([^\n]+)/, 'include'); + }, + + /** + * Case. + */ + + "case": function() { + return this.scan(/^case +([^\n]+)/, 'case'); + }, + + /** + * When. + */ + + when: function() { + return this.scan(/^when +([^:\n]+)/, 'when'); + }, + + /** + * Default. + */ + + "default": function() { + return this.scan(/^default */, 'default'); + }, + + /** + * Assignment. + */ + + assignment: function() { + var captures; + if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { + this.consume(captures[0].length); + var name = captures[1] + , val = captures[2]; + return this.tok('code', 'var ' + name + ' = (' + val + ');'); + } + }, + + /** + * Call mixin. + */ + + call: function(){ + var captures; + if (captures = /^\+([-\w]+)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('call', captures[1]); + + // Check for args (not attributes) + if (captures = /^ *\((.*?)\)/.exec(this.input)) { + if (!/^ *[-\w]+ *=/.test(captures[1])) { + this.consume(captures[0].length); + tok.args = captures[1]; + } + } + + return tok; + } + }, + + /** + * Mixin. + */ + + mixin: function(){ + var captures; + if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('mixin', captures[1]); + tok.args = captures[2]; + return tok; + } + }, + + /** + * Conditional. + */ + + conditional: function() { + var captures; + if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var type = captures[1] + , js = captures[2]; + + switch (type) { + case 'if': js = 'if (' + js + ')'; break; + case 'unless': js = 'if (!(' + js + '))'; break; + case 'else if': js = 'else if (' + js + ')'; break; + case 'else': js = 'else'; break; + } + + return this.tok('code', js); + } + }, + + /** + * While. + */ + + "while": function() { + var captures; + if (captures = /^while +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + return this.tok('code', 'while (' + captures[1] + ')'); + } + }, + + /** + * Each. + */ + + each: function() { + var captures; + if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('each', captures[1]); + tok.key = captures[2] || '$index'; + tok.code = captures[3]; + return tok; + } + }, + + /** + * Code. + */ + + code: function() { + var captures; + if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var flags = captures[1]; + captures[1] = captures[2]; + var tok = this.tok('code', captures[1]); + tok.escape = flags.charAt(0) === '='; + tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; + return tok; + } + }, + + /** + * Attributes. + */ + + attrs: function() { + if ('(' == this.input.charAt(0)) { + var index = this.indexOfDelimiters('(', ')') + , str = this.input.substr(1, index-1) + , tok = this.tok('attrs') + , len = str.length + , colons = this.colons + , states = ['key'] + , escapedAttr + , key = '' + , val = '' + , quote + , c + , p; + + function state(){ + return states[states.length - 1]; + } + + function interpolate(attr) { + return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ + return escape + ? _ + : quote + " + (" + expr + ") + " + quote; + }); + } + + this.consume(index + 1); + tok.attrs = {}; + tok.escaped = {}; + + function parse(c) { + var real = c; + // TODO: remove when people fix ":" + if (colons && ':' == c) c = '='; + switch (c) { + case ',': + case '\n': + switch (state()) { + case 'expr': + case 'array': + case 'string': + case 'object': + val += c; + break; + default: + states.push('key'); + val = val.trim(); + key = key.trim(); + if ('' == key) return; + key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); + tok.escaped[key] = escapedAttr; + tok.attrs[key] = '' == val + ? true + : interpolate(val); + key = val = ''; + } + break; + case '=': + switch (state()) { + case 'key char': + key += real; + break; + case 'val': + case 'expr': + case 'array': + case 'string': + case 'object': + val += real; + break; + default: + escapedAttr = '!' != p; + states.push('val'); + } + break; + case '(': + if ('val' == state() + || 'expr' == state()) states.push('expr'); + val += c; + break; + case ')': + if ('expr' == state() + || 'val' == state()) states.pop(); + val += c; + break; + case '{': + if ('val' == state()) states.push('object'); + val += c; + break; + case '}': + if ('object' == state()) states.pop(); + val += c; + break; + case '[': + if ('val' == state()) states.push('array'); + val += c; + break; + case ']': + if ('array' == state()) states.pop(); + val += c; + break; + case '"': + case "'": + switch (state()) { + case 'key': + states.push('key char'); + break; + case 'key char': + states.pop(); + break; + case 'string': + if (c == quote) states.pop(); + val += c; + break; + default: + states.push('string'); + val += c; + quote = c; + } + break; + case '': + break; + default: + switch (state()) { + case 'key': + case 'key char': + key += c; + break; + default: + val += c; + } + } + p = c; + } + + for (var i = 0; i < len; ++i) { + parse(str.charAt(i)); + } + + parse(','); + + if ('/' == this.input.charAt(0)) { + this.consume(1); + tok.selfClosing = true; + } + + return tok; + } + }, + + /** + * Indent | Outdent | Newline. + */ + + indent: function() { + var captures, re; + + // established regexp + if (this.indentRe) { + captures = this.indentRe.exec(this.input); + // determine regexp + } else { + // tabs + re = /^\n(\t*) */; + captures = re.exec(this.input); + + // spaces + if (captures && !captures[1].length) { + re = /^\n( *)/; + captures = re.exec(this.input); + } + + // established + if (captures && captures[1].length) this.indentRe = re; + } + + if (captures) { + var tok + , indents = captures[1].length; + + ++this.lineno; + this.consume(indents + 1); + + if (' ' == this.input[0] || '\t' == this.input[0]) { + throw new Error('Invalid indentation, you can use tabs or spaces but not both'); + } + + // blank line + if ('\n' == this.input[0]) return this.tok('newline'); + + // outdent + if (this.indentStack.length && indents < this.indentStack[0]) { + while (this.indentStack.length && this.indentStack[0] > indents) { + this.stash.push(this.tok('outdent')); + this.indentStack.shift(); + } + tok = this.stash.pop(); + // indent + } else if (indents && indents != this.indentStack[0]) { + this.indentStack.unshift(indents); + tok = this.tok('indent', indents); + // newline + } else { + tok = this.tok('newline'); + } + + return tok; + } + }, + + /** + * Pipe-less text consumed only when + * pipeless is true; + */ + + pipelessText: function() { + if (this.pipeless) { + if ('\n' == this.input[0]) return; + var i = this.input.indexOf('\n'); + if (-1 == i) i = this.input.length; + var str = this.input.substr(0, i); + this.consume(str.length); + return this.tok('text', str); + } + }, + + /** + * ':' + */ + + colon: function() { + return this.scan(/^: */, ':'); + }, + + /** + * Return the next token object, or those + * previously stashed by lookahead. + * + * @return {Object} + * @api private + */ + + advance: function(){ + return this.stashed() + || this.next(); + }, + + /** + * Return the next token object. + * + * @return {Object} + * @api private + */ + + next: function() { + return this.deferred() + || this.blank() + || this.eos() + || this.pipelessText() + || this.yield() + || this.doctype() + || this.interpolation() + || this["case"]() + || this.when() + || this["default"]() + || this["extends"]() + || this.append() + || this.prepend() + || this.block() + || this.include() + || this.mixin() + || this.call() + || this.conditional() + || this.each() + || this["while"]() + || this.assignment() + || this.tag() + || this.filter() + || this.code() + || this.id() + || this.className() + || this.attrs() + || this.indent() + || this.comment() + || this.colon() + || this.text(); + } +}; + +}); // module: lexer.js + +require.register("nodes/attrs.js", function(module, exports, require){ + +/*! + * Jade - nodes - Attrs + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'), + Block = require('./block'); + +/** + * Initialize a `Attrs` node. + * + * @api public + */ + +var Attrs = module.exports = function Attrs() { + this.attrs = []; +}; + +/** + * Inherit from `Node`. + */ + +Attrs.prototype = new Node; +Attrs.prototype.constructor = Attrs; + + +/** + * Set attribute `name` to `val`, keep in mind these become + * part of a raw js object literal, so to quote a value you must + * '"quote me"', otherwise or example 'user.name' is literal JavaScript. + * + * @param {String} name + * @param {String} val + * @param {Boolean} escaped + * @return {Tag} for chaining + * @api public + */ + +Attrs.prototype.setAttribute = function(name, val, escaped){ + this.attrs.push({ name: name, val: val, escaped: escaped }); + return this; +}; + +/** + * Remove attribute `name` when present. + * + * @param {String} name + * @api public + */ + +Attrs.prototype.removeAttribute = function(name){ + for (var i = 0, len = this.attrs.length; i < len; ++i) { + if (this.attrs[i] && this.attrs[i].name == name) { + delete this.attrs[i]; + } + } +}; + +/** + * Get attribute value by `name`. + * + * @param {String} name + * @return {String} + * @api public + */ + +Attrs.prototype.getAttribute = function(name){ + for (var i = 0, len = this.attrs.length; i < len; ++i) { + if (this.attrs[i] && this.attrs[i].name == name) { + return this.attrs[i].val; + } + } +}; + +}); // module: nodes/attrs.js + +require.register("nodes/block-comment.js", function(module, exports, require){ + +/*! + * Jade - nodes - BlockComment + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `BlockComment` with the given `block`. + * + * @param {String} val + * @param {Block} block + * @param {Boolean} buffer + * @api public + */ + +var BlockComment = module.exports = function BlockComment(val, block, buffer) { + this.block = block; + this.val = val; + this.buffer = buffer; +}; + +/** + * Inherit from `Node`. + */ + +BlockComment.prototype = new Node; +BlockComment.prototype.constructor = BlockComment; + +}); // module: nodes/block-comment.js + +require.register("nodes/block.js", function(module, exports, require){ + +/*! + * Jade - nodes - Block + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a new `Block` with an optional `node`. + * + * @param {Node} node + * @api public + */ + +var Block = module.exports = function Block(node){ + this.nodes = []; + if (node) this.push(node); +}; + +/** + * Inherit from `Node`. + */ + +Block.prototype = new Node; +Block.prototype.constructor = Block; + + +/** + * Block flag. + */ + +Block.prototype.isBlock = true; + +/** + * Replace the nodes in `other` with the nodes + * in `this` block. + * + * @param {Block} other + * @api private + */ + +Block.prototype.replace = function(other){ + other.nodes = this.nodes; +}; + +/** + * Pust the given `node`. + * + * @param {Node} node + * @return {Number} + * @api public + */ + +Block.prototype.push = function(node){ + return this.nodes.push(node); +}; + +/** + * Check if this block is empty. + * + * @return {Boolean} + * @api public + */ + +Block.prototype.isEmpty = function(){ + return 0 == this.nodes.length; +}; + +/** + * Unshift the given `node`. + * + * @param {Node} node + * @return {Number} + * @api public + */ + +Block.prototype.unshift = function(node){ + return this.nodes.unshift(node); +}; + +/** + * Return the "last" block, or the first `yield` node. + * + * @return {Block} + * @api private + */ + +Block.prototype.includeBlock = function(){ + var ret = this + , node; + + for (var i = 0, len = this.nodes.length; i < len; ++i) { + node = this.nodes[i]; + if (node.yield) return node; + else if (node.textOnly) continue; + else if (node.includeBlock) ret = node.includeBlock(); + else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); + if (ret.yield) return ret; + } + + return ret; +}; + +/** + * Return a clone of this block. + * + * @return {Block} + * @api private + */ + +Block.prototype.clone = function(){ + var clone = new Block; + for (var i = 0, len = this.nodes.length; i < len; ++i) { + clone.push(this.nodes[i].clone()); + } + return clone; +}; + + +}); // module: nodes/block.js + +require.register("nodes/case.js", function(module, exports, require){ + +/*! + * Jade - nodes - Case + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a new `Case` with `expr`. + * + * @param {String} expr + * @api public + */ + +var Case = exports = module.exports = function Case(expr, block){ + this.expr = expr; + this.block = block; +}; + +/** + * Inherit from `Node`. + */ + +Case.prototype = new Node; +Case.prototype.constructor = Case; + + +var When = exports.When = function When(expr, block){ + this.expr = expr; + this.block = block; + this.debug = false; +}; + +/** + * Inherit from `Node`. + */ + +When.prototype = new Node; +When.prototype.constructor = When; + + + +}); // module: nodes/case.js + +require.register("nodes/code.js", function(module, exports, require){ + +/*! + * Jade - nodes - Code + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Code` node with the given code `val`. + * Code may also be optionally buffered and escaped. + * + * @param {String} val + * @param {Boolean} buffer + * @param {Boolean} escape + * @api public + */ + +var Code = module.exports = function Code(val, buffer, escape) { + this.val = val; + this.buffer = buffer; + this.escape = escape; + if (val.match(/^ *else/)) this.debug = false; +}; + +/** + * Inherit from `Node`. + */ + +Code.prototype = new Node; +Code.prototype.constructor = Code; + +}); // module: nodes/code.js + +require.register("nodes/comment.js", function(module, exports, require){ + +/*! + * Jade - nodes - Comment + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Comment` with the given `val`, optionally `buffer`, + * otherwise the comment may render in the output. + * + * @param {String} val + * @param {Boolean} buffer + * @api public + */ + +var Comment = module.exports = function Comment(val, buffer) { + this.val = val; + this.buffer = buffer; +}; + +/** + * Inherit from `Node`. + */ + +Comment.prototype = new Node; +Comment.prototype.constructor = Comment; + +}); // module: nodes/comment.js + +require.register("nodes/doctype.js", function(module, exports, require){ + +/*! + * Jade - nodes - Doctype + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Doctype` with the given `val`. + * + * @param {String} val + * @api public + */ + +var Doctype = module.exports = function Doctype(val) { + this.val = val; +}; + +/** + * Inherit from `Node`. + */ + +Doctype.prototype = new Node; +Doctype.prototype.constructor = Doctype; + +}); // module: nodes/doctype.js + +require.register("nodes/each.js", function(module, exports, require){ + +/*! + * Jade - nodes - Each + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize an `Each` node, representing iteration + * + * @param {String} obj + * @param {String} val + * @param {String} key + * @param {Block} block + * @api public + */ + +var Each = module.exports = function Each(obj, val, key, block) { + this.obj = obj; + this.val = val; + this.key = key; + this.block = block; +}; + +/** + * Inherit from `Node`. + */ + +Each.prototype = new Node; +Each.prototype.constructor = Each; + +}); // module: nodes/each.js + +require.register("nodes/filter.js", function(module, exports, require){ + +/*! + * Jade - nodes - Filter + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node') + , Block = require('./block'); + +/** + * Initialize a `Filter` node with the given + * filter `name` and `block`. + * + * @param {String} name + * @param {Block|Node} block + * @api public + */ + +var Filter = module.exports = function Filter(name, block, attrs) { + this.name = name; + this.block = block; + this.attrs = attrs; + this.isASTFilter = !block.nodes.every(function(node){ return node.isText }); +}; + +/** + * Inherit from `Node`. + */ + +Filter.prototype = new Node; +Filter.prototype.constructor = Filter; + +}); // module: nodes/filter.js + +require.register("nodes/index.js", function(module, exports, require){ + +/*! + * Jade - nodes + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +exports.Node = require('./node'); +exports.Tag = require('./tag'); +exports.Code = require('./code'); +exports.Each = require('./each'); +exports.Case = require('./case'); +exports.Text = require('./text'); +exports.Block = require('./block'); +exports.Mixin = require('./mixin'); +exports.Filter = require('./filter'); +exports.Comment = require('./comment'); +exports.Literal = require('./literal'); +exports.BlockComment = require('./block-comment'); +exports.Doctype = require('./doctype'); + +}); // module: nodes/index.js + +require.register("nodes/literal.js", function(module, exports, require){ + +/*! + * Jade - nodes - Literal + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Literal` node with the given `str. + * + * @param {String} str + * @api public + */ + +var Literal = module.exports = function Literal(str) { + this.str = str + .replace(/\\/g, "\\\\") + .replace(/\n|\r\n/g, "\\n") + .replace(/'/g, "\\'"); +}; + +/** + * Inherit from `Node`. + */ + +Literal.prototype = new Node; +Literal.prototype.constructor = Literal; + + +}); // module: nodes/literal.js + +require.register("nodes/mixin.js", function(module, exports, require){ + +/*! + * Jade - nodes - Mixin + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Attrs = require('./attrs'); + +/** + * Initialize a new `Mixin` with `name` and `block`. + * + * @param {String} name + * @param {String} args + * @param {Block} block + * @api public + */ + +var Mixin = module.exports = function Mixin(name, args, block, call){ + this.name = name; + this.args = args; + this.block = block; + this.attrs = []; + this.call = call; +}; + +/** + * Inherit from `Attrs`. + */ + +Mixin.prototype = new Attrs; +Mixin.prototype.constructor = Mixin; + + + +}); // module: nodes/mixin.js + +require.register("nodes/node.js", function(module, exports, require){ + +/*! + * Jade - nodes - Node + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Initialize a `Node`. + * + * @api public + */ + +var Node = module.exports = function Node(){}; + +/** + * Clone this node (return itself) + * + * @return {Node} + * @api private + */ + +Node.prototype.clone = function(){ + return this; +}; + +}); // module: nodes/node.js + +require.register("nodes/tag.js", function(module, exports, require){ + +/*! + * Jade - nodes - Tag + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Attrs = require('./attrs'), + Block = require('./block'), + inlineTags = require('../inline-tags'); + +/** + * Initialize a `Tag` node with the given tag `name` and optional `block`. + * + * @param {String} name + * @param {Block} block + * @api public + */ + +var Tag = module.exports = function Tag(name, block) { + this.name = name; + this.attrs = []; + this.block = block || new Block; +}; + +/** + * Inherit from `Attrs`. + */ + +Tag.prototype = new Attrs; +Tag.prototype.constructor = Tag; + + +/** + * Clone this tag. + * + * @return {Tag} + * @api private + */ + +Tag.prototype.clone = function(){ + var clone = new Tag(this.name, this.block.clone()); + clone.line = this.line; + clone.attrs = this.attrs; + clone.textOnly = this.textOnly; + return clone; +}; + +/** + * Check if this tag is an inline tag. + * + * @return {Boolean} + * @api private + */ + +Tag.prototype.isInline = function(){ + return ~inlineTags.indexOf(this.name); +}; + +/** + * Check if this tag's contents can be inlined. Used for pretty printing. + * + * @return {Boolean} + * @api private + */ + +Tag.prototype.canInline = function(){ + var nodes = this.block.nodes; + + function isInline(node){ + // Recurse if the node is a block + if (node.isBlock) return node.nodes.every(isInline); + return node.isText || (node.isInline && node.isInline()); + } + + // Empty tag + if (!nodes.length) return true; + + // Text-only or inline-only tag + if (1 == nodes.length) return isInline(nodes[0]); + + // Multi-line inline-only tag + if (this.block.nodes.every(isInline)) { + for (var i = 1, len = nodes.length; i < len; ++i) { + if (nodes[i-1].isText && nodes[i].isText) + return false; + } + return true; + } + + // Mixed tag + return false; +}; +}); // module: nodes/tag.js + +require.register("nodes/text.js", function(module, exports, require){ + +/*! + * Jade - nodes - Text + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Text` node with optional `line`. + * + * @param {String} line + * @api public + */ + +var Text = module.exports = function Text(line) { + this.val = ''; + if ('string' == typeof line) this.val = line; +}; + +/** + * Inherit from `Node`. + */ + +Text.prototype = new Node; +Text.prototype.constructor = Text; + + +/** + * Flag as text. + */ + +Text.prototype.isText = true; +}); // module: nodes/text.js + +require.register("parser.js", function(module, exports, require){ + +/*! + * Jade - Parser + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Lexer = require('./lexer') + , nodes = require('./nodes') + , utils = require('./utils'); + +/** + * Initialize `Parser` with the given input `str` and `filename`. + * + * @param {String} str + * @param {String} filename + * @param {Object} options + * @api public + */ + +var Parser = exports = module.exports = function Parser(str, filename, options){ + this.input = str; + this.lexer = new Lexer(str, options); + this.filename = filename; + this.blocks = {}; + this.mixins = {}; + this.options = options; + this.contexts = [this]; +}; + +/** + * Tags that may not contain tags. + */ + +var textOnly = exports.textOnly = ['script', 'style']; + +/** + * Parser prototype. + */ + +Parser.prototype = { + + /** + * Push `parser` onto the context stack, + * or pop and return a `Parser`. + */ + + context: function(parser){ + if (parser) { + this.contexts.push(parser); + } else { + return this.contexts.pop(); + } + }, + + /** + * Return the next token object. + * + * @return {Object} + * @api private + */ + + advance: function(){ + return this.lexer.advance(); + }, + + /** + * Skip `n` tokens. + * + * @param {Number} n + * @api private + */ + + skip: function(n){ + while (n--) this.advance(); + }, + + /** + * Single token lookahead. + * + * @return {Object} + * @api private + */ + + peek: function() { + return this.lookahead(1); + }, + + /** + * Return lexer lineno. + * + * @return {Number} + * @api private + */ + + line: function() { + return this.lexer.lineno; + }, + + /** + * `n` token lookahead. + * + * @param {Number} n + * @return {Object} + * @api private + */ + + lookahead: function(n){ + return this.lexer.lookahead(n); + }, + + /** + * Parse input returning a string of js for evaluation. + * + * @return {String} + * @api public + */ + + parse: function(){ + var block = new nodes.Block, parser; + block.line = this.line(); + + while ('eos' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else { + block.push(this.parseExpr()); + } + } + + if (parser = this.extending) { + this.context(parser); + var ast = parser.parse(); + this.context(); + // hoist mixins + for (var name in this.mixins) + ast.unshift(this.mixins[name]); + return ast; + } + + return block; + }, + + /** + * Expect the given type, or throw an exception. + * + * @param {String} type + * @api private + */ + + expect: function(type){ + if (this.peek().type === type) { + return this.advance(); + } else { + throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); + } + }, + + /** + * Accept the given `type`. + * + * @param {String} type + * @api private + */ + + accept: function(type){ + if (this.peek().type === type) { + return this.advance(); + } + }, + + /** + * tag + * | doctype + * | mixin + * | include + * | filter + * | comment + * | text + * | each + * | code + * | yield + * | id + * | class + * | interpolation + */ + + parseExpr: function(){ + switch (this.peek().type) { + case 'tag': + return this.parseTag(); + case 'mixin': + return this.parseMixin(); + case 'block': + return this.parseBlock(); + case 'case': + return this.parseCase(); + case 'when': + return this.parseWhen(); + case 'default': + return this.parseDefault(); + case 'extends': + return this.parseExtends(); + case 'include': + return this.parseInclude(); + case 'doctype': + return this.parseDoctype(); + case 'filter': + return this.parseFilter(); + case 'comment': + return this.parseComment(); + case 'text': + return this.parseText(); + case 'each': + return this.parseEach(); + case 'code': + return this.parseCode(); + case 'call': + return this.parseCall(); + case 'interpolation': + return this.parseInterpolation(); + case 'yield': + this.advance(); + var block = new nodes.Block; + block.yield = true; + return block; + case 'id': + case 'class': + var tok = this.advance(); + this.lexer.defer(this.lexer.tok('tag', 'div')); + this.lexer.defer(tok); + return this.parseExpr(); + default: + throw new Error('unexpected token "' + this.peek().type + '"'); + } + }, + + /** + * Text + */ + + parseText: function(){ + var tok = this.expect('text') + , node = new nodes.Text(tok.val); + node.line = this.line(); + return node; + }, + + /** + * ':' expr + * | block + */ + + parseBlockExpansion: function(){ + if (':' == this.peek().type) { + this.advance(); + return new nodes.Block(this.parseExpr()); + } else { + return this.block(); + } + }, + + /** + * case + */ + + parseCase: function(){ + var val = this.expect('case').val + , node = new nodes.Case(val); + node.line = this.line(); + node.block = this.block(); + return node; + }, + + /** + * when + */ + + parseWhen: function(){ + var val = this.expect('when').val + return new nodes.Case.When(val, this.parseBlockExpansion()); + }, + + /** + * default + */ + + parseDefault: function(){ + this.expect('default'); + return new nodes.Case.When('default', this.parseBlockExpansion()); + }, + + /** + * code + */ + + parseCode: function(){ + var tok = this.expect('code') + , node = new nodes.Code(tok.val, tok.buffer, tok.escape) + , block + , i = 1; + node.line = this.line(); + while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; + block = 'indent' == this.lookahead(i).type; + if (block) { + this.skip(i-1); + node.block = this.block(); + } + return node; + }, + + /** + * comment + */ + + parseComment: function(){ + var tok = this.expect('comment') + , node; + + if ('indent' == this.peek().type) { + node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); + } else { + node = new nodes.Comment(tok.val, tok.buffer); + } + + node.line = this.line(); + return node; + }, + + /** + * doctype + */ + + parseDoctype: function(){ + var tok = this.expect('doctype') + , node = new nodes.Doctype(tok.val); + node.line = this.line(); + return node; + }, + + /** + * filter attrs? text-block + */ + + parseFilter: function(){ + var block + , tok = this.expect('filter') + , attrs = this.accept('attrs'); + + this.lexer.pipeless = true; + block = this.parseTextBlock(); + this.lexer.pipeless = false; + + var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); + node.line = this.line(); + return node; + }, + + /** + * tag ':' attrs? block + */ + + parseASTFilter: function(){ + var block + , tok = this.expect('tag') + , attrs = this.accept('attrs'); + + this.expect(':'); + block = this.block(); + + var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); + node.line = this.line(); + return node; + }, + + /** + * each block + */ + + parseEach: function(){ + var tok = this.expect('each') + , node = new nodes.Each(tok.code, tok.val, tok.key); + node.line = this.line(); + node.block = this.block(); + if (this.peek().type == 'code' && this.peek().val == 'else') { + this.advance(); + node.alternative = this.block(); + } + return node; + }, + + /** + * 'extends' name + */ + + parseExtends: function(){ + var path = require('path') + , fs = require('fs') + , dirname = path.dirname + , basename = path.basename + , join = path.join; + + if (!this.filename) + throw new Error('the "filename" option is required to extend templates'); + + var path = this.expect('extends').val.trim() + , dir = dirname(this.filename); + + var path = join(dir, path + '.jade') + , str = fs.readFileSync(path, 'utf8') + , parser = new Parser(str, path, this.options); + + parser.blocks = this.blocks; + parser.contexts = this.contexts; + this.extending = parser; + + // TODO: null node + return new nodes.Literal(''); + }, + + /** + * 'block' name block + */ + + parseBlock: function(){ + var block = this.expect('block') + , mode = block.mode + , name = block.val.trim(); + + block = 'indent' == this.peek().type + ? this.block() + : new nodes.Block(new nodes.Literal('')); + + var prev = this.blocks[name]; + + if (prev) { + switch (prev.mode) { + case 'append': + block.nodes = block.nodes.concat(prev.nodes); + prev = block; + break; + case 'prepend': + block.nodes = prev.nodes.concat(block.nodes); + prev = block; + break; + } + } + + block.mode = mode; + return this.blocks[name] = prev || block; + }, + + /** + * include block? + */ + + parseInclude: function(){ + var path = require('path') + , fs = require('fs') + , dirname = path.dirname + , basename = path.basename + , join = path.join; + + var path = this.expect('include').val.trim() + , dir = dirname(this.filename); + + if (!this.filename) + throw new Error('the "filename" option is required to use includes'); + + // no extension + if (!~basename(path).indexOf('.')) { + path += '.jade'; + } + + // non-jade + if ('.jade' != path.substr(-5)) { + var path = join(dir, path) + , str = fs.readFileSync(path, 'utf8'); + return new nodes.Literal(str); + } + + var path = join(dir, path) + , str = fs.readFileSync(path, 'utf8') + , parser = new Parser(str, path, this.options); + parser.blocks = utils.merge({}, this.blocks); + parser.mixins = this.mixins; + + this.context(parser); + var ast = parser.parse(); + this.context(); + ast.filename = path; + + if ('indent' == this.peek().type) { + ast.includeBlock().push(this.block()); + } + + return ast; + }, + + /** + * call ident block + */ + + parseCall: function(){ + var tok = this.expect('call') + , name = tok.val + , args = tok.args + , mixin = new nodes.Mixin(name, args, new nodes.Block, true); + + this.tag(mixin); + if (mixin.block.isEmpty()) mixin.block = null; + return mixin; + }, + + /** + * mixin block + */ + + parseMixin: function(){ + var tok = this.expect('mixin') + , name = tok.val + , args = tok.args + , mixin; + + // definition + if ('indent' == this.peek().type) { + mixin = new nodes.Mixin(name, args, this.block(), false); + this.mixins[name] = mixin; + return mixin; + // call + } else { + return new nodes.Mixin(name, args, null, true); + } + }, + + /** + * indent (text | newline)* outdent + */ + + parseTextBlock: function(){ + var block = new nodes.Block; + block.line = this.line(); + var spaces = this.expect('indent').val; + if (null == this._spaces) this._spaces = spaces; + var indent = Array(spaces - this._spaces + 1).join(' '); + while ('outdent' != this.peek().type) { + switch (this.peek().type) { + case 'newline': + this.advance(); + break; + case 'indent': + this.parseTextBlock().nodes.forEach(function(node){ + block.push(node); + }); + break; + default: + var text = new nodes.Text(indent + this.advance().val); + text.line = this.line(); + block.push(text); + } + } + + if (spaces == this._spaces) this._spaces = null; + this.expect('outdent'); + return block; + }, + + /** + * indent expr* outdent + */ + + block: function(){ + var block = new nodes.Block; + block.line = this.line(); + this.expect('indent'); + while ('outdent' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else { + block.push(this.parseExpr()); + } + } + this.expect('outdent'); + return block; + }, + + /** + * interpolation (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseInterpolation: function(){ + var tok = this.advance(); + var tag = new nodes.Tag(tok.val); + tag.buffer = true; + return this.tag(tag); + }, + + /** + * tag (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseTag: function(){ + // ast-filter look-ahead + var i = 2; + if ('attrs' == this.lookahead(i).type) ++i; + if (':' == this.lookahead(i).type) { + if ('indent' == this.lookahead(++i).type) { + return this.parseASTFilter(); + } + } + + var tok = this.advance() + , tag = new nodes.Tag(tok.val); + + tag.selfClosing = tok.selfClosing; + + return this.tag(tag); + }, + + /** + * Parse tag. + */ + + tag: function(tag){ + var dot; + + tag.line = this.line(); + + // (attrs | class | id)* + out: + while (true) { + switch (this.peek().type) { + case 'id': + case 'class': + var tok = this.advance(); + tag.setAttribute(tok.type, "'" + tok.val + "'"); + continue; + case 'attrs': + var tok = this.advance() + , obj = tok.attrs + , escaped = tok.escaped + , names = Object.keys(obj); + + if (tok.selfClosing) tag.selfClosing = true; + + for (var i = 0, len = names.length; i < len; ++i) { + var name = names[i] + , val = obj[name]; + tag.setAttribute(name, val, escaped[name]); + } + continue; + default: + break out; + } + } + + // check immediate '.' + if ('.' == this.peek().val) { + dot = tag.textOnly = true; + this.advance(); + } + + // (text | code | ':')? + switch (this.peek().type) { + case 'text': + tag.block.push(this.parseText()); + break; + case 'code': + tag.code = this.parseCode(); + break; + case ':': + this.advance(); + tag.block = new nodes.Block; + tag.block.push(this.parseExpr()); + break; + } + + // newline* + while ('newline' == this.peek().type) this.advance(); + + tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); + + // script special-case + if ('script' == tag.name) { + var type = tag.getAttribute('type'); + if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { + tag.textOnly = false; + } + } + + // block? + if ('indent' == this.peek().type) { + if (tag.textOnly) { + this.lexer.pipeless = true; + tag.block = this.parseTextBlock(); + this.lexer.pipeless = false; + } else { + var block = this.block(); + if (tag.block) { + for (var i = 0, len = block.nodes.length; i < len; ++i) { + tag.block.push(block.nodes[i]); + } + } else { + tag.block = block; + } + } + } + + return tag; + } +}; + +}); // module: parser.js + +require.register("runtime.js", function(module, exports, require){ + +/*! + * Jade - runtime + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Lame Array.isArray() polyfill for now. + */ + +if (!Array.isArray) { + Array.isArray = function(arr){ + return '[object Array]' == Object.prototype.toString.call(arr); + }; +} + +/** + * Lame Object.keys() polyfill for now. + */ + +if (!Object.keys) { + Object.keys = function(obj){ + var arr = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + arr.push(key); + } + } + return arr; + } +} + +/** + * Merge two attribute objects giving precedence + * to values in object `b`. Classes are special-cased + * allowing for arrays and merging/joining appropriately + * resulting in a string. + * + * @param {Object} a + * @param {Object} b + * @return {Object} a + * @api private + */ + +exports.merge = function merge(a, b) { + var ac = a['class']; + var bc = b['class']; + + if (ac || bc) { + ac = ac || []; + bc = bc || []; + if (!Array.isArray(ac)) ac = [ac]; + if (!Array.isArray(bc)) bc = [bc]; + ac = ac.filter(nulls); + bc = bc.filter(nulls); + a['class'] = ac.concat(bc).join(' '); + } + + for (var key in b) { + if (key != 'class') { + a[key] = b[key]; + } + } + + return a; +}; + +/** + * Filter null `val`s. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function nulls(val) { + return val != null; +} + +/** + * Render the given attributes object. + * + * @param {Object} obj + * @param {Object} escaped + * @return {String} + * @api private + */ + +exports.attrs = function attrs(obj, escaped){ + var buf = [] + , terse = obj.terse; + + delete obj.terse; + var keys = Object.keys(obj) + , len = keys.length; + + if (len) { + buf.push(''); + for (var i = 0; i < len; ++i) { + var key = keys[i] + , val = obj[key]; + + if ('boolean' == typeof val || null == val) { + if (val) { + terse + ? buf.push(key) + : buf.push(key + '="' + key + '"'); + } + } else if (0 == key.indexOf('data') && 'string' != typeof val) { + buf.push(key + "='" + JSON.stringify(val) + "'"); + } else if ('class' == key && Array.isArray(val)) { + buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); + } else if (escaped && escaped[key]) { + buf.push(key + '="' + exports.escape(val) + '"'); + } else { + buf.push(key + '="' + val + '"'); + } + } + } + + return buf.join(' '); +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function escape(html){ + return String(html) + .replace(/&(?!(\w+|\#\d+);)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +}; + +/** + * Re-throw the given `err` in context to the + * the jade in `filename` at the given `lineno`. + * + * @param {Error} err + * @param {String} filename + * @param {String} lineno + * @api private + */ + +exports.rethrow = function rethrow(err, filename, lineno){ + if (!filename) throw err; + + var context = 3 + , str = require('fs').readFileSync(filename, 'utf8') + , lines = str.split('\n') + , start = Math.max(lineno - context, 0) + , end = Math.min(lines.length, lineno + context); + + // 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 || 'Jade') + ':' + lineno + + '\n' + context + '\n\n' + err.message; + throw err; +}; + +}); // module: runtime.js + +require.register("self-closing.js", function(module, exports, require){ + +/*! + * Jade - self closing tags + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = [ + 'meta' + , 'img' + , 'link' + , 'input' + , 'source' + , 'area' + , 'base' + , 'col' + , 'br' + , 'hr' +]; +}); // module: self-closing.js + +require.register("utils.js", function(module, exports, require){ + +/*! + * Jade - utils + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Convert interpolation in the given string to JavaScript. + * + * @param {String} str + * @return {String} + * @api private + */ + +var interpolate = exports.interpolate = function(str){ + return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ + code = code + .replace(/\\'/g, "'") + .replace(/_SLASH_/g, '\\'); + + return escape + ? str.slice(7) + : "' + " + + ('!' == flag ? '' : 'escape') + + "((interp = " + code + + ") == null ? '' : interp) + '"; + }); +}; + +/** + * Escape single quotes in `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +var escape = exports.escape = function(str) { + return str.replace(/'/g, "\\'"); +}; + +/** + * Interpolate, and escape the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +exports.text = function(str){ + return interpolate(escape(str)); +}; + +/** + * Merge `b` into `a`. + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports.merge = function(a, b) { + for (var key in b) a[key] = b[key]; + return a; +}; + + +}); // module: utils.js + +window.jade = require("jade"); +})(); diff --git a/node_modules/jade/jade.md b/node_modules/jade/jade.md new file mode 100644 index 0000000..051dc03 --- /dev/null +++ b/node_modules/jade/jade.md @@ -0,0 +1,510 @@ + +# Jade + + The jade template engine for node.js + +## Synopsis + + jade [-h|--help] [-v|--version] [-o|--obj STR] + [-O|--out DIR] [-p|--path PATH] [-P|--pretty] + [-c|--client] [-D|--no-debug] + +## Examples + + translate jade the templates dir + + $ jade templates + + create {foo,bar}.html + + $ jade {foo,bar}.jade + + jade over stdio + + $ jade < my.jade > my.html + + jade over s + + $ echo "h1 Jade!" | jade + + foo, bar dirs rendering to /tmp + + $ jade foo bar --out /tmp + + compile client-side templates without debugging + instrumentation, making the output javascript + very light-weight. This requires runtime.js + in your projects. + + $ jade --client --no-debug < my.jade + +## Tags + + Tags are simply nested via whitespace, closing + tags defined for you. These indents are called "blocks". + + ul + li + a Foo + li + a Bar + + You may have several tags in one "block": + + ul + li + a Foo + a Bar + a Baz + +## Self-closing Tags + + Some tags are flagged as self-closing by default, such + as `meta`, `link`, and so on. To explicitly self-close + a tag simply append the `/` character: + + foo/ + foo(bar='baz')/ + + Would yield: + + + + +## Attributes + + Tag attributes look similar to HTML, however + the values are regular JavaScript, here are + some examples: + + a(href='http://github.com/google.com') Google + a(class='button', href='http://github.com/google.com') Google + + As mentioned the attribute values are just JavaScript, + this means ternary operations and other JavaScript expressions + work just fine: + + body(class=user.authenticated ? 'authenticated' : 'anonymous') + a(href=user.website || 'http://google.com/') + + Multiple lines work too: + + input(type='checkbox', + name='agreement', + checked) + + Multiple lines without the comma work fine: + + input(type='checkbox' + name='agreement' + checked) + + Funky whitespace? fine: + + input( + type='checkbox' + name='agreement' + checked) + +## Boolean attributes + + Boolean attributes are mirrored by Jade, and accept + bools, aka _true_ or _false_. When no value is specified + _true_ is assumed. For example: + + input(type="checkbox", checked) + // => "" + + For example if the checkbox was for an agreement, perhaps `user.agreed` + was _true_ the following would also output 'checked="checked"': + + input(type="checkbox", checked=user.agreed) + +## Class attributes + + The _class_ attribute accepts an array of classes, + this can be handy when generated from a javascript + function etc: + + classes = ['foo', 'bar', 'baz'] + a(class=classes) + // => "" + +## Class literal + + Classes may be defined using a ".CLASSNAME" syntax: + + .button + // => "
    " + + Or chained: + + .large.button + // => "
    " + + The previous defaulted to divs, however you + may also specify the tag type: + + h1.title My Title + // => "

    My Title

    " + +## Id literal + + Much like the class literal there's an id literal: + + #user-1 + // => "
    " + + Again we may specify the tag as well: + + ul#menu + li: a(href='http://github.com/home') Home + li: a(href='http://github.com/store') Store + li: a(href='http://github.com/contact') Contact + + Finally all of these may be used in any combination, + the following are all valid tags: + + a.button#contact(style: 'color: red') Contact + a.button(style: 'color: red')#contact Contact + a(style: 'color: red').button#contact Contact + +## Block expansion + + Jade supports the concept of "block expansion", in which + using a trailing ":" after a tag will inject a block: + + ul + li: a Foo + li: a Bar + li: a Baz + +## Text + + Arbitrary text may follow tags: + + p Welcome to my site + + yields: + +

    Welcome to my site

    + +## Pipe text + + Another form of text is "pipe" text. Pipes act + as the text margin for large bodies of text. + + p + | This is a large + | body of text for + | this tag. + | + | Nothing too + | exciting. + + yields: + +

    This is a large + body of text for + this tag. + + Nothing too + exciting. +

    + + Using pipes we can also specify regular Jade tags + within the text: + + p + | Click to visit + a(href='http://google.com/') Google + | if you want. + +## Text only tags + + As an alternative to pipe text you may add + a trailing "." to indicate that the block + contains nothing but plain-text, no tags: + + p. + This is a large + body of text for + this tag. + + Nothing too + exciting. + + Some tags are text-only by default, for example + _script_, _textarea_, and _style_ tags do not + contain nested HTML so Jade implies the trailing ".": + + script + if (foo) { + bar(); + } + + style + body { + padding: 50px; + font: 14px Helvetica; + } + +## Template script tags + + Sometimes it's useful to define HTML in script + tags using Jade, typically for client-side templates. + + To do this simply give the _script_ tag an arbitrary + _type_ attribute such as _text/x-template_: + + script(type='text/template') + h1 Look! + p Jade still works in here! + +## Interpolation + + Both plain-text and piped-text support interpolation, + which comes in two forms, escapes and non-escaped. The + following will output the _user.name_ in the paragraph + but HTML within it will be escaped to prevent XSS attacks: + + p Welcome #{user.name} + + The following syntax is identical however it will _not_ escape + HTML, and should only be used with strings that you trust: + + p Welcome !{user.name} + +## Inline HTML + + Sometimes constructing small inline snippets of HTML + in Jade can be annoying, luckily we can add plain + HTML as well: + + p Welcome #{user.name} + +## Code + + To buffer output with Jade simply use _=_ at the beginning + of a line or after a tag. This method escapes any HTML + present in the string. + + p= user.description + + To buffer output unescaped use the _!=_ variant, but again + be careful of XSS. + + p!= user.description + + The final way to mess with JavaScript code in Jade is the unbuffered + _-_, which can be used for conditionals, defining variables etc: + + - var user = { description: 'foo bar baz' } + #user + - if (user.description) { + h2 Description + p.description= user.description + - } + + When compiled blocks are wrapped in anonymous functions, so the + following is also valid, without braces: + + - var user = { description: 'foo bar baz' } + #user + - if (user.description) + h2 Description + p.description= user.description + + If you really want you could even use `.forEach()` and others: + + - users.forEach(function(user){ + .user + h2= user.name + p User #{user.name} is #{user.age} years old + - }) + + Taking this further Jade provides some syntax for conditionals, + iteration, switch statements etc. Let's look at those next! + +## Assignment + + Jade's first-class assignment is simple, simply use the _=_ + operator and Jade will _var_ it for you. The following are equivalent: + + - var user = { name: 'tobi' } + user = { name: 'tobi' } + +## Conditionals + + Jade's first-class conditional syntax allows for optional + parenthesis, and you may now omit the leading _-_ otherwise + it's identical, still just regular javascript: + + user = { description: 'foo bar baz' } + #user + if user.description + h2 Description + p.description= user.description + + Jade provides the negated version, _unless_ as well, the following + are equivalent: + + - if (!(user.isAnonymous)) + p You're logged in as #{user.name} + + unless user.isAnonymous + p You're logged in as #{user.name} + +## Iteration + + JavaScript's _for_ loops don't look very declarative, so Jade + also provides its own _for_ loop construct, aliased as _each_: + + for user in users + .user + h2= user.name + p user #{user.name} is #{user.age} year old + + As mentioned _each_ is identical: + + each user in users + .user + h2= user.name + + If necessary the index is available as well: + + for user, i in users + .user(class='user-#{i}') + h2= user.name + + Remember, it's just JavaScript: + + ul#letters + for letter in ['a', 'b', 'c'] + li= letter + +## Mixins + + Mixins provide a way to define jade "functions" which "mix in" + their contents when called. This is useful for abstracting + out large fragments of Jade. + + The simplest possible mixin which accepts no arguments might + look like this: + + mixin hello + p Hello + + You use a mixin by placing `+` before the name: + + +hello + + For something a little more dynamic, mixins can take + arguments, the mixin itself is converted to a javascript + function internally: + + mixin hello(user) + p Hello #{user} + + +hello('Tobi') + + Yields: + +

    Hello Tobi

    + + Mixins may optionally take blocks, when a block is passed + its contents becomes the implicit `block` argument. For + example here is a mixin passed a block, and also invoked + without passing a block: + + mixin article(title) + .article + .article-wrapper + h1= title + if block + block + else + p No content provided + + +article('Hello world') + + +article('Hello world') + p This is my + p Amazing article + + yields: + +
    +
    +

    Hello world

    +

    No content provided

    +
    +
    + +
    +
    +

    Hello world

    +

    This is my

    +

    Amazing article

    +
    +
    + + Mixins can even take attributes, just like a tag. When + attributes are passed they become the implicit `attributes` + argument. Individual attributes can be accessed just like + normal object properties: + + mixin centered + .centered(class=attributes.class) + block + + +centered.bold Hello world + + +centered.red + p This is my + p Amazing article + + yields: + +
    Hello world
    +
    +

    This is my

    +

    Amazing article

    +
    + + If you use `attributes` directly, *all* passed attributes + get used: + + mixin link + a.menu(attributes) + block + + +link.highlight(href='#top') Top + +link#sec1.plain(href='#section1') Section 1 + +link#sec2.plain(href='#section2') Section 2 + + yields: + + Top + Section 1 + Section 2 + + If you pass arguments, they must directly follow the mixin: + + mixin list(arr) + if block + .title + block + ul(attributes) + each item in arr + li= item + + +list(['foo', 'bar', 'baz'])(id='myList', class='bold') + + yields: + +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    diff --git a/node_modules/jade/jade.min.js b/node_modules/jade/jade.min.js new file mode 100644 index 0000000..93f3b3d --- /dev/null +++ b/node_modules/jade/jade.min.js @@ -0,0 +1,2 @@ +(function(){function require(p){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}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.charAt(0))return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i/g,">").replace(/"/g,""")}var nodes=require("./nodes"),filters=require("./filters"),doctypes=require("./doctypes"),selfClosing=require("./self-closing"),runtime=require("./runtime"),utils=require("./utils");Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")});var Compiler=module.exports=function Compiler(node,options){this.options=options=options||{},this.node=node,this.hasCompiledDoctype=!1,this.hasCompiledTag=!1,this.pp=options.pretty||!1,this.debug=!1!==options.compileDebug,this.indents=0,this.parentIndents=0,options.doctype&&this.setDoctype(options.doctype)};Compiler.prototype={compile:function(){return this.buf=["var interp;"],this.pp&&this.buf.push("var __indent = [];"),this.lastBufferedIdx=-1,this.visit(this.node),this.buf.join("\n")},setDoctype:function(name){name=name&&name.toLowerCase()||"default",this.doctype=doctypes[name]||"",this.terse=this.doctype.toLowerCase()=="",this.xml=0==this.doctype.indexOf("1&&!escape&&block.nodes[0].isText&&block.nodes[1].isText&&this.prettyIndent(1,!0);for(var i=0;i0&&!escape&&block.nodes[i].isText&&block.nodes[i-1].isText&&this.prettyIndent(1,!1),this.visit(block.nodes[i]),block.nodes[i+1]&&block.nodes[i].isText&&block.nodes[i+1].isText&&this.buffer("\\n")},visitDoctype:function(doctype){doctype&&(doctype.val||!this.doctype)&&this.setDoctype(doctype.val||"default"),this.doctype&&this.buffer(this.doctype),this.hasCompiledDoctype=!0},visitMixin:function(mixin){var name=mixin.name.replace(/-/g,"_")+"_mixin",args=mixin.args||"",block=mixin.block,attrs=mixin.attrs,pp=this.pp;if(mixin.call){pp&&this.buf.push("__indent.push('"+Array(this.indents+1).join(" ")+"');");if(block||attrs.length){this.buf.push(name+".call({");if(block){this.buf.push("block: function(){"),this.parentIndents++;var _indents=this.indents;this.indents=0,this.visit(mixin.block),this.indents=_indents,this.parentIndents--,attrs.length?this.buf.push("},"):this.buf.push("}")}if(attrs.length){var val=this.attrs(attrs);val.inherits?this.buf.push("attributes: merge({"+val.buf+"}, attributes), escaped: merge("+val.escaped+", escaped, true)"):this.buf.push("attributes: {"+val.buf+"}, escaped: "+val.escaped)}args?this.buf.push("}, "+args+");"):this.buf.push("});")}else this.buf.push(name+"("+args+");");pp&&this.buf.push("__indent.pop();")}else this.buf.push("var "+name+" = function("+args+"){"),this.buf.push("var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};"),this.parentIndents++,this.visit(block),this.parentIndents--,this.buf.push("};")},visitTag:function(tag){this.indents++;var name=tag.name,pp=this.pp;tag.buffer&&(name="' + ("+name+") + '"),this.hasCompiledTag||(!this.hasCompiledDoctype&&"html"==name&&this.visitDoctype(),this.hasCompiledTag=!0),pp&&!tag.isInline()&&this.prettyIndent(0,!0),(~selfClosing.indexOf(name)||tag.selfClosing)&&!this.xml?(this.buffer("<"+name),this.visitAttributes(tag.attrs),this.terse?this.buffer(">"):this.buffer("/>")):(tag.attrs.length?(this.buffer("<"+name),tag.attrs.length&&this.visitAttributes(tag.attrs),this.buffer(">")):this.buffer("<"+name+">"),tag.code&&this.visitCode(tag.code),this.escape="pre"==tag.name,this.visit(tag.block),pp&&!tag.isInline()&&"pre"!=tag.name&&!tag.canInline()&&this.prettyIndent(0,!0),this.buffer("")),this.indents--},visitFilter:function(filter){var fn=filters[filter.name];if(!fn)throw filter.isASTFilter?new Error('unknown ast filter "'+filter.name+':"'):new Error('unknown filter ":'+filter.name+'"');if(filter.isASTFilter)this.buf.push(fn(filter.block,this,filter.attrs));else{var text=filter.block.nodes.map(function(node){return node.val}).join("\n");filter.attrs=filter.attrs||{},filter.attrs.filename=this.options.filename,this.buffer(utils.text(fn(text,filter.attrs)))}},visitText:function(text){text=utils.text(text.val.replace(/\\/g,"_SLASH_")),this.escape&&(text=escape(text)),text=text.replace(/_SLASH_/g,"\\\\"),this.buffer(text)},visitComment:function(comment){if(!comment.buffer)return;this.pp&&this.prettyIndent(1,!0),this.buffer("")},visitBlockComment:function(comment){if(!comment.buffer)return;0==comment.val.trim().indexOf("if")?(this.buffer("")):(this.buffer(""))},visitCode:function(code){if(code.buffer){var val=code.val.trimLeft();this.buf.push("var __val__ = "+val),val='null == __val__ ? "" : __val__',code.escape&&(val="escape("+val+")"),this.buf.push("buf.push("+val+");")}else this.buf.push(code.val);code.block&&(code.buffer||this.buf.push("{"),this.visit(code.block),code.buffer||this.buf.push("}"))},visitEach:function(each){this.buf.push("// iterate "+each.obj+"\n"+";(function(){\n"+" if ('number' == typeof "+each.obj+".length) {\n"),each.alternative&&this.buf.push(" if ("+each.obj+".length) {"),this.buf.push(" for (var "+each.key+" = 0, $$l = "+each.obj+".length; "+each.key+" < $$l; "+each.key+"++) {\n"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" } else {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" } else {\n var $$l = 0;\n for (var "+each.key+" in "+each.obj+") {\n"+" $$l++;"+" if ("+each.obj+".hasOwnProperty("+each.key+")){"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" if ($$l === 0) {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" }\n}).call(this);\n")},visitAttributes:function(attrs){var val=this.attrs(attrs);val.inherits?this.buf.push("buf.push(attrs(merge({ "+val.buf+" }, attributes), merge("+val.escaped+", escaped, true)));"):val.constant?(eval("var buf={"+val.buf+"};"),this.buffer(runtime.attrs(buf,JSON.parse(val.escaped)),!0)):this.buf.push("buf.push(attrs({ "+val.buf+" }, "+val.escaped+"));")},attrs:function(attrs){var buf=[],classes=[],escaped={},constant=attrs.every(function(attr){return isConstant(attr.val)}),inherits=!1;return this.terse&&buf.push("terse: true"),attrs.forEach(function(attr){if(attr.name=="attributes")return inherits=!0;escaped[attr.name]=attr.escaped;if(attr.name=="class")classes.push("("+attr.val+")");else{var pair="'"+attr.name+"':("+attr.val+")";buf.push(pair)}}),classes.length&&(classes=classes.join(" + ' ' + "),buf.push("class: "+classes)),{buf:buf.join(", ").replace("class:",'"class":'),escaped:JSON.stringify(escaped),inherits:inherits,constant:constant}}}}),require.register("doctypes.js",function(module,exports,require){module.exports={5:"","default":"",xml:'',transitional:'',strict:'',frameset:'',1.1:'',basic:'',mobile:''}}),require.register("filters.js",function(module,exports,require){module.exports={cdata:function(str){return""},sass:function(str){str=str.replace(/\\n/g,"\n");var sass=require("sass").render(str).replace(/\n/g,"\\n");return'"},stylus:function(str,options){var ret;str=str.replace(/\\n/g,"\n");var stylus=require("stylus");return stylus(str,options).render(function(err,css){if(err)throw err;ret=css.replace(/\n/g,"\\n")}),'"},less:function(str){var ret;return str=str.replace(/\\n/g,"\n"),require("less").render(str,function(err,css){if(err)throw err;ret='"}),ret},markdown:function(str){var md;try{md=require("markdown")}catch(err){try{md=require("discount")}catch(err){try{md=require("markdown-js")}catch(err){try{md=require("marked")}catch(err){throw new Error("Cannot find markdown library, install markdown, discount, or marked.")}}}}return str=str.replace(/\\n/g,"\n"),md.parse(str).replace(/\n/g,"\\n").replace(/'/g,"'")},coffeescript:function(str){var js=require("coffee-script").compile(str).replace(/\\/g,"\\\\").replace(/\n/g,"\\n");return'"}}}),require.register("inline-tags.js",function(module,exports,require){module.exports=["a","abbr","acronym","b","br","code","em","font","i","img","ins","kbd","map","samp","small","span","strong","sub","sup"]}),require.register("jade.js",function(module,exports,require){function parse(str,options){try{var parser=new Parser(str,options.filename,options),compiler=new(options.compiler||Compiler)(parser.parse(),options),js=compiler.compile();return options.debug&&console.error("\nCompiled Function:\n\n%s",js.replace(/^/gm," ")),"var buf = [];\n"+(options.self?"var self = locals || {};\n"+js:"with (locals || {}) {\n"+js+"\n}\n")+'return buf.join("");'}catch(err){parser=parser.context(),runtime.rethrow(err,parser.filename,parser.lexer.lineno)}}function stripBOM(str){return 65279==str.charCodeAt(0)?str.substring(1):str}var Parser=require("./parser"),Lexer=require("./lexer"),Compiler=require("./compiler"),runtime=require("./runtime");exports.version="0.27.6",exports.selfClosing=require("./self-closing"),exports.doctypes=require("./doctypes"),exports.filters=require("./filters"),exports.utils=require("./utils"),exports.Compiler=Compiler,exports.Parser=Parser,exports.Lexer=Lexer,exports.nodes=require("./nodes"),exports.runtime=runtime,exports.cache={},exports.compile=function(str,options){var options=options||{},client=options.client,filename=options.filename?JSON.stringify(options.filename):"undefined",fn;return str=stripBOM(String(str)),options.compileDebug!==!1?fn=["var __jade = [{ lineno: 1, filename: "+filename+" }];","try {",parse(str,options),"} catch (err) {"," rethrow(err, __jade[0].filename, __jade[0].lineno);","}"].join("\n"):fn=parse(str,options),client&&(fn="attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n"+fn),fn=new Function("locals, attrs, escape, rethrow, merge",fn),client?fn:function(locals){return fn(locals,runtime.attrs,runtime.escape,runtime.rethrow,runtime.merge)}},exports.render=function(str,options,fn){"function"==typeof options&&(fn=options,options={});if(options.cache&&!options.filename)return fn(new Error('the "filename" option is required for caching'));try{var path=options.filename,tmpl=options.cache?exports.cache[path]||(exports.cache[path]=exports.compile(str,options)):exports.compile(str,options);fn(null,tmpl(options))}catch(err){fn(err)}},exports.renderFile=function(path,options,fn){var key=path+":string";"function"==typeof options&&(fn=options,options={});try{options.filename=path;var str=options.cache?exports.cache[key]||(exports.cache[key]=fs.readFileSync(path,"utf8")):fs.readFileSync(path,"utf8");exports.render(str,options,fn)}catch(err){fn(err)}},exports.__express=exports.renderFile}),require.register("lexer.js",function(module,exports,require){var utils=require("./utils"),Lexer=module.exports=function Lexer(str,options){options=options||{},this.input=str.replace(/\r\n|\r/g,"\n"),this.colons=options.colons,this.deferredTokens=[],this.lastIndents=0,this.lineno=1,this.stash=[],this.indentStack=[],this.indentRe=null,this.pipeless=!1};Lexer.prototype={tok:function(type,val){return{type:type,line:this.lineno,val:val}},consume:function(len){this.input=this.input.substr(len)},scan:function(regexp,type){var captures;if(captures=regexp.exec(this.input))return this.consume(captures[0].length),this.tok(type,captures[1])},defer:function(tok){this.deferredTokens.push(tok)},lookahead:function(n){var fetch=n-this.stash.length;while(fetch-->0)this.stash.push(this.next());return this.stash[--n]},indexOfDelimiters:function(start,end){var str=this.input,nstart=0,nend=0,pos=0;for(var i=0,len=str.length;iindents)this.stash.push(this.tok("outdent")),this.indentStack.shift();tok=this.stash.pop()}else indents&&indents!=this.indentStack[0]?(this.indentStack.unshift(indents),tok=this.tok("indent",indents)):tok=this.tok("newline");return tok}},pipelessText:function(){if(this.pipeless){if("\n"==this.input[0])return;var i=this.input.indexOf("\n");-1==i&&(i=this.input.length);var str=this.input.substr(0,i);return this.consume(str.length),this.tok("text",str)}},colon:function(){return this.scan(/^: */,":")},advance:function(){return this.stashed()||this.next()},next:function(){return this.deferred()||this.blank()||this.eos()||this.pipelessText()||this.yield()||this.doctype()||this.interpolation()||this["case"]()||this.when()||this["default"]()||this["extends"]()||this.append()||this.prepend()||this.block()||this.include()||this.mixin()||this.call()||this.conditional()||this.each()||this["while"]()||this.assignment()||this.tag()||this.filter()||this.code()||this.id()||this.className()||this.attrs()||this.indent()||this.comment()||this.colon()||this.text()}}}),require.register("nodes/attrs.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Attrs=module.exports=function Attrs(){this.attrs=[]};Attrs.prototype=new Node,Attrs.prototype.constructor=Attrs,Attrs.prototype.setAttribute=function(name,val,escaped){return this.attrs.push({name:name,val:val,escaped:escaped}),this},Attrs.prototype.removeAttribute=function(name){for(var i=0,len=this.attrs.length;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err}}),require.register("self-closing.js",function(module,exports,require){module.exports=["meta","img","link","input","source","area","base","col","br","hr"]}),require.register("utils.js",function(module,exports,require){var interpolate=exports.interpolate=function(str){return str.replace(/(_SLASH_)?([#!]){(.*?)}/g,function(str,escape,flag,code){return code=code.replace(/\\'/g,"'").replace(/_SLASH_/g,"\\"),escape?str.slice(7):"' + "+("!"==flag?"":"escape")+"((interp = "+code+") == null ? '' : interp) + '"})},escape=exports.escape=function(str){return str.replace(/'/g,"\\'")};exports.text=function(str){return interpolate(escape(str))},exports.merge=function(a,b){for(var key in b)a[key]=b[key];return a}}),window.jade=require("jade")})(); \ No newline at end of file diff --git a/node_modules/jade/lib/compiler.js b/node_modules/jade/lib/compiler.js new file mode 100644 index 0000000..bb56142 --- /dev/null +++ b/node_modules/jade/lib/compiler.js @@ -0,0 +1,655 @@ + +/*! + * Jade - Compiler + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var nodes = require('./nodes') + , filters = require('./filters') + , doctypes = require('./doctypes') + , selfClosing = require('./self-closing') + , runtime = require('./runtime') + , utils = require('./utils'); + +// if browser +// +// if (!Object.keys) { +// Object.keys = function(obj){ +// var arr = []; +// for (var key in obj) { +// if (obj.hasOwnProperty(key)) { +// arr.push(key); +// } +// } +// return arr; +// } +// } +// +// if (!String.prototype.trimLeft) { +// String.prototype.trimLeft = function(){ +// return this.replace(/^\s+/, ''); +// } +// } +// +// end + + +/** + * Initialize `Compiler` with the given `node`. + * + * @param {Node} node + * @param {Object} options + * @api public + */ + +var Compiler = module.exports = function Compiler(node, options) { + this.options = options = options || {}; + this.node = node; + this.hasCompiledDoctype = false; + this.hasCompiledTag = false; + this.pp = options.pretty || false; + this.debug = false !== options.compileDebug; + this.indents = 0; + this.parentIndents = 0; + if (options.doctype) this.setDoctype(options.doctype); +}; + +/** + * Compiler prototype. + */ + +Compiler.prototype = { + + /** + * Compile parse tree to JavaScript. + * + * @api public + */ + + compile: function(){ + this.buf = ['var interp;']; + if (this.pp) this.buf.push("var __indent = [];"); + this.lastBufferedIdx = -1; + this.visit(this.node); + return this.buf.join('\n'); + }, + + /** + * Sets the default doctype `name`. Sets terse mode to `true` when + * html 5 is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {string} name + * @api public + */ + + setDoctype: function(name){ + name = (name && name.toLowerCase()) || 'default'; + this.doctype = doctypes[name] || ''; + this.terse = this.doctype.toLowerCase() == ''; + this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) + this.prettyIndent(1, true); + + for (var i = 0; i < len; ++i) { + // Pretty print text + if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) + this.prettyIndent(1, false); + + this.visit(block.nodes[i]); + // Multiple text nodes are separated by newlines + if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) + this.buffer('\\n'); + } + }, + + /** + * Visit `doctype`. Sets terse mode to `true` when html 5 + * is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {Doctype} doctype + * @api public + */ + + visitDoctype: function(doctype){ + if (doctype && (doctype.val || !this.doctype)) { + this.setDoctype(doctype.val || 'default'); + } + + if (this.doctype) this.buffer(this.doctype); + this.hasCompiledDoctype = true; + }, + + /** + * Visit `mixin`, generating a function that + * may be called within the template. + * + * @param {Mixin} mixin + * @api public + */ + + visitMixin: function(mixin){ + var name = mixin.name.replace(/-/g, '_') + '_mixin' + , args = mixin.args || '' + , block = mixin.block + , attrs = mixin.attrs + , pp = this.pp; + + if (mixin.call) { + if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") + if (block || attrs.length) { + + this.buf.push(name + '.call({'); + + if (block) { + this.buf.push('block: function(){'); + + // Render block with no indents, dynamically added when rendered + this.parentIndents++; + var _indents = this.indents; + this.indents = 0; + this.visit(mixin.block); + this.indents = _indents; + this.parentIndents--; + + if (attrs.length) { + this.buf.push('},'); + } else { + this.buf.push('}'); + } + } + + if (attrs.length) { + var val = this.attrs(attrs); + if (val.inherits) { + this.buf.push('attributes: merge({' + val.buf + + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); + } else { + this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); + } + } + + if (args) { + this.buf.push('}, ' + args + ');'); + } else { + this.buf.push('});'); + } + + } else { + this.buf.push(name + '(' + args + ');'); + } + if (pp) this.buf.push("__indent.pop();") + } else { + this.buf.push('var ' + name + ' = function(' + args + '){'); + this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); + this.parentIndents++; + this.visit(block); + this.parentIndents--; + this.buf.push('};'); + } + }, + + /** + * Visit `tag` buffering tag markup, generating + * attributes, visiting the `tag`'s code and block. + * + * @param {Tag} tag + * @api public + */ + + visitTag: function(tag){ + this.indents++; + var name = tag.name + , pp = this.pp; + + if (tag.buffer) name = "' + (" + name + ") + '"; + + if (!this.hasCompiledTag) { + if (!this.hasCompiledDoctype && 'html' == name) { + this.visitDoctype(); + } + this.hasCompiledTag = true; + } + + // pretty print + if (pp && !tag.isInline()) + this.prettyIndent(0, true); + + if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { + this.buffer('<' + name); + this.visitAttributes(tag.attrs); + this.terse + ? this.buffer('>') + : this.buffer('/>'); + } else { + // Optimize attributes buffering + if (tag.attrs.length) { + this.buffer('<' + name); + if (tag.attrs.length) this.visitAttributes(tag.attrs); + this.buffer('>'); + } else { + this.buffer('<' + name + '>'); + } + if (tag.code) this.visitCode(tag.code); + this.escape = 'pre' == tag.name; + this.visit(tag.block); + + // pretty print + if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) + this.prettyIndent(0, true); + + this.buffer(''); + } + this.indents--; + }, + + /** + * Visit `filter`, throwing when the filter does not exist. + * + * @param {Filter} filter + * @api public + */ + + visitFilter: function(filter){ + var fn = filters[filter.name]; + + // unknown filter + if (!fn) throw new Error('unknown filter ":' + filter.name + '"'); + + var text = filter.block.nodes.map( + function(node){ return node.val; } + ).join('\n'); + filter.attrs = filter.attrs || {}; + filter.attrs.filename = this.options.filename; + this.buffer(utils.text(fn(text, filter.attrs))); + }, + + /** + * Visit `text` node. + * + * @param {Text} text + * @api public + */ + + visitText: function(text){ + text = utils.text(text.val.replace(/\\/g, '_SLASH_')); + if (this.escape) text = escape(text); + text = text.replace(/_SLASH_/g, '\\\\'); + this.buffer(text); + }, + + /** + * Visit a `comment`, only buffering when the buffer flag is set. + * + * @param {Comment} comment + * @api public + */ + + visitComment: function(comment){ + if (!comment.buffer) return; + if (this.pp) this.prettyIndent(1, true); + this.buffer(''); + }, + + /** + * Visit a `BlockComment`. + * + * @param {Comment} comment + * @api public + */ + + visitBlockComment: function(comment){ + if (!comment.buffer) return; + if (0 == comment.val.trim().indexOf('if')) { + this.buffer(''); + } else { + this.buffer(''); + } + }, + + /** + * Visit `code`, respecting buffer / escape flags. + * If the code is followed by a block, wrap it in + * a self-calling function. + * + * @param {Code} code + * @api public + */ + + visitCode: function(code){ + // Wrap code blocks with {}. + // we only wrap unbuffered code blocks ATM + // since they are usually flow control + + // Buffer code + if (code.buffer) { + var val = code.val.trimLeft(); + this.buf.push('var __val__ = ' + val); + val = 'null == __val__ ? "" : __val__'; + if (code.escape) val = 'escape(' + val + ')'; + this.buf.push("buf.push(" + val + ");"); + } else { + this.buf.push(code.val); + } + + // Block support + if (code.block) { + if (!code.buffer) this.buf.push('{'); + this.visit(code.block); + if (!code.buffer) this.buf.push('}'); + } + }, + + /** + * Visit `each` block. + * + * @param {Each} each + * @api public + */ + + visitEach: function(each){ + this.buf.push('' + + '// iterate ' + each.obj + '\n' + + ';(function(){\n' + + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); + + if (each.alternative) { + this.buf.push(' if (' + each.obj + '.length) {'); + } + + this.buf.push('' + + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' + + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); + + this.visit(each.block); + + this.buf.push(' }\n'); + + if (each.alternative) { + this.buf.push(' } else {'); + this.visit(each.alternative); + this.buf.push(' }'); + } + + this.buf.push('' + + ' } else {\n' + + ' var $$l = 0;\n' + + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' + + ' $$l++;' + // if browser + // + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' + // end + + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); + + this.visit(each.block); + + // if browser + // this.buf.push(' }\n'); + // end + + this.buf.push(' }\n'); + if (each.alternative) { + this.buf.push(' if ($$l === 0) {'); + this.visit(each.alternative); + this.buf.push(' }'); + } + this.buf.push(' }\n}).call(this);\n'); + }, + + /** + * Visit `attrs`. + * + * @param {Array} attrs + * @api public + */ + + visitAttributes: function(attrs){ + var val = this.attrs(attrs); + if (val.inherits) { + this.buf.push("buf.push(attrs(merge({ " + val.buf + + " }, attributes), merge(" + val.escaped + ", escaped, true)));"); + } else if (val.constant) { + eval('var buf={' + val.buf + '};'); + this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); + } else { + this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); + } + }, + + /** + * Compile attributes. + */ + + attrs: function(attrs){ + var buf = [] + , classes = [] + , escaped = {} + , constant = attrs.every(function(attr){ return isConstant(attr.val) }) + , inherits = false; + + if (this.terse) buf.push('terse: true'); + + attrs.forEach(function(attr){ + if (attr.name == 'attributes') return inherits = true; + escaped[attr.name] = attr.escaped; + if (attr.name == 'class') { + classes.push('(' + attr.val + ')'); + } else { + var pair = "'" + attr.name + "':(" + attr.val + ')'; + buf.push(pair); + } + }); + + if (classes.length) { + classes = classes.join(" + ' ' + "); + buf.push('"class": ' + classes); + } + + return { + buf: buf.join(', '), + escaped: JSON.stringify(escaped), + inherits: inherits, + constant: constant + }; + } +}; + +/** + * Check if expression can be evaluated to a constant + * + * @param {String} expression + * @return {Boolean} + * @api private + */ + +function isConstant(val){ + // Check strings/literals + if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) + return true; + + // Check numbers + if (!isNaN(Number(val))) + return true; + + // Check arrays + var matches; + if (matches = /^ *\[(.*)\] *$/.exec(val)) + return matches[1].split(',').every(isConstant); + + return false; +} + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +function escape(html){ + return String(html) + .replace(/&(?!\w+;)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +} diff --git a/node_modules/jade/lib/doctypes.js b/node_modules/jade/lib/doctypes.js new file mode 100644 index 0000000..e87ca1e --- /dev/null +++ b/node_modules/jade/lib/doctypes.js @@ -0,0 +1,18 @@ + +/*! + * Jade - doctypes + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = { + '5': '' + , 'default': '' + , 'xml': '' + , 'transitional': '' + , 'strict': '' + , 'frameset': '' + , '1.1': '' + , 'basic': '' + , 'mobile': '' +}; \ No newline at end of file diff --git a/node_modules/jade/lib/filters.js b/node_modules/jade/lib/filters.js new file mode 100644 index 0000000..d633559 --- /dev/null +++ b/node_modules/jade/lib/filters.js @@ -0,0 +1,105 @@ + +/*! + * Jade - filters + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Wrap text with CDATA block. + */ + +exports.cdata = function(str){ + return ''; +}; + +/** + * Wrap text in script tags. + */ + +exports.js = function(str){ + return ''; +}; + +/** + * Wrap text in style tags. + */ + +exports.css = function(str){ + return ''; +}; + +/** + * Transform stylus to css, wrapped in style tags. + */ + +exports.stylus = function(str, options){ + var ret; + str = str.replace(/\\n/g, '\n'); + var stylus = require('stylus'); + stylus(str, options).render(function(err, css){ + if (err) throw err; + ret = css.replace(/\n/g, '\\n'); + }); + return ''; +}; + +/** + * Transform less to css, wrapped in style tags. + */ + +exports.less = function(str){ + var ret; + str = str.replace(/\\n/g, '\n'); + require('less').render(str, function(err, css){ + if (err) throw err; + ret = ''; + }); + return ret; +}; + +/** + * Transform markdown to html. + */ + +exports.markdown = function(str){ + var md; + + // support markdown / discount + try { + md = require('markdown'); + } catch (err){ + try { + md = require('discount'); + } catch (err) { + try { + md = require('markdown-js'); + } catch (err) { + try { + md = require('marked'); + } catch (err) { + throw new + Error('Cannot find markdown library, install markdown, discount, or marked.'); + } + } + } + } + + str = str.replace(/\\n/g, '\n'); + return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); +}; + +/** + * Transform coffeescript to javascript. + */ + +exports.coffeescript = function(str){ + var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); + return ''; +}; + +// aliases + +exports.md = exports.markdown; +exports.styl = exports.stylus; +exports.coffee = exports.coffeescript; diff --git a/node_modules/jade/lib/inline-tags.js b/node_modules/jade/lib/inline-tags.js new file mode 100644 index 0000000..491de0b --- /dev/null +++ b/node_modules/jade/lib/inline-tags.js @@ -0,0 +1,28 @@ + +/*! + * Jade - inline tags + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = [ + 'a' + , 'abbr' + , 'acronym' + , 'b' + , 'br' + , 'code' + , 'em' + , 'font' + , 'i' + , 'img' + , 'ins' + , 'kbd' + , 'map' + , 'samp' + , 'small' + , 'span' + , 'strong' + , 'sub' + , 'sup' +]; \ No newline at end of file diff --git a/node_modules/jade/lib/jade.js b/node_modules/jade/lib/jade.js new file mode 100644 index 0000000..09d61e6 --- /dev/null +++ b/node_modules/jade/lib/jade.js @@ -0,0 +1,253 @@ +/*! + * Jade + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Parser = require('./parser') + , Lexer = require('./lexer') + , Compiler = require('./compiler') + , runtime = require('./runtime') +// if node + , fs = require('fs'); +// end + +/** + * Library version. + */ + +exports.version = '0.28.0'; + +/** + * Expose self closing tags. + */ + +exports.selfClosing = require('./self-closing'); + +/** + * Default supported doctypes. + */ + +exports.doctypes = require('./doctypes'); + +/** + * Text filters. + */ + +exports.filters = require('./filters'); + +/** + * Utilities. + */ + +exports.utils = require('./utils'); + +/** + * Expose `Compiler`. + */ + +exports.Compiler = Compiler; + +/** + * Expose `Parser`. + */ + +exports.Parser = Parser; + +/** + * Expose `Lexer`. + */ + +exports.Lexer = Lexer; + +/** + * Nodes. + */ + +exports.nodes = require('./nodes'); + +/** + * Jade runtime helpers. + */ + +exports.runtime = runtime; + +/** + * Template function cache. + */ + +exports.cache = {}; + +/** + * Parse the given `str` of jade and return a function body. + * + * @param {String} str + * @param {Object} options + * @return {String} + * @api private + */ + +function parse(str, options){ + try { + // Parse + var parser = new Parser(str, options.filename, options); + + // Compile + var compiler = new (options.compiler || Compiler)(parser.parse(), options) + , js = compiler.compile(); + + // Debug compiler + if (options.debug) { + console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); + } + + return '' + + 'var buf = [];\n' + + (options.self + ? 'var self = locals || {};\n' + js + : 'with (locals || {}) {\n' + js + '\n}\n') + + 'return buf.join("");'; + } catch (err) { + parser = parser.context(); + runtime.rethrow(err, parser.filename, parser.lexer.lineno); + } +} + +/** + * Strip any UTF-8 BOM off of the start of `str`, if it exists. + * + * @param {String} str + * @return {String} + * @api private + */ + +function stripBOM(str){ + return 0xFEFF == str.charCodeAt(0) + ? str.substring(1) + : str; +} + +/** + * Compile a `Function` representation of the given jade `str`. + * + * Options: + * + * - `compileDebug` when `false` debugging code is stripped from the compiled template + * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` + * for use with the Jade client-side runtime.js + * + * @param {String} str + * @param {Options} options + * @return {Function} + * @api public + */ + +exports.compile = function(str, options){ + var options = options || {} + , client = options.client + , filename = options.filename + ? JSON.stringify(options.filename) + : 'undefined' + , fn; + + str = stripBOM(String(str)); + + if (options.compileDebug !== false) { + fn = [ + 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' + , 'try {' + , parse(str, options) + , '} catch (err) {' + , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' + , '}' + ].join('\n'); + } else { + fn = parse(str, options); + } + + if (client) { + fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; + } + + fn = new Function('locals, attrs, escape, rethrow, merge', fn); + + if (client) return fn; + + return function(locals){ + return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); + }; +}; + +/** + * Render the given `str` of jade and invoke + * the callback `fn(err, str)`. + * + * Options: + * + * - `cache` enable template caching + * - `filename` filename required for `include` / `extends` and caching + * + * @param {String} str + * @param {Object|Function} options or fn + * @param {Function} fn + * @api public + */ + +exports.render = function(str, options, fn){ + // swap args + if ('function' == typeof options) { + fn = options, options = {}; + } + + // cache requires .filename + if (options.cache && !options.filename) { + return fn(new Error('the "filename" option is required for caching')); + } + + try { + var path = options.filename; + var tmpl = options.cache + ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) + : exports.compile(str, options); + fn(null, tmpl(options)); + } catch (err) { + fn(err); + } +}; + +/** + * Render a Jade 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 = {}; + } + + try { + options.filename = path; + var str = options.cache + ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) + : fs.readFileSync(path, 'utf8'); + exports.render(str, options, fn); + } catch (err) { + fn(err); + } +}; + +/** + * Express support. + */ + +exports.__express = exports.renderFile; diff --git a/node_modules/jade/lib/lexer.js b/node_modules/jade/lib/lexer.js new file mode 100644 index 0000000..1e0bfff --- /dev/null +++ b/node_modules/jade/lib/lexer.js @@ -0,0 +1,775 @@ +/*! + * Jade - Lexer + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +var utils = require('./utils'); + +/** + * Initialize `Lexer` with the given `str`. + * + * Options: + * + * - `colons` allow colons for attr delimiters + * + * @param {String} str + * @param {Object} options + * @api private + */ + +var Lexer = module.exports = function Lexer(str, options) { + options = options || {}; + this.input = str.replace(/\r\n|\r/g, '\n'); + this.colons = options.colons; + this.deferredTokens = []; + this.lastIndents = 0; + this.lineno = 1; + this.stash = []; + this.indentStack = []; + this.indentRe = null; + this.pipeless = false; +}; + +/** + * Lexer prototype. + */ + +Lexer.prototype = { + + /** + * Construct a token with the given `type` and `val`. + * + * @param {String} type + * @param {String} val + * @return {Object} + * @api private + */ + + tok: function(type, val){ + return { + type: type + , line: this.lineno + , val: val + } + }, + + /** + * Consume the given `len` of input. + * + * @param {Number} len + * @api private + */ + + consume: function(len){ + this.input = this.input.substr(len); + }, + + /** + * Scan for `type` with the given `regexp`. + * + * @param {String} type + * @param {RegExp} regexp + * @return {Object} + * @api private + */ + + scan: function(regexp, type){ + var captures; + if (captures = regexp.exec(this.input)) { + this.consume(captures[0].length); + return this.tok(type, captures[1]); + } + }, + + /** + * Defer the given `tok`. + * + * @param {Object} tok + * @api private + */ + + defer: function(tok){ + this.deferredTokens.push(tok); + }, + + /** + * Lookahead `n` tokens. + * + * @param {Number} n + * @return {Object} + * @api private + */ + + lookahead: function(n){ + var fetch = n - this.stash.length; + while (fetch-- > 0) this.stash.push(this.next()); + return this.stash[--n]; + }, + + /** + * Return the indexOf `start` / `end` delimiters. + * + * @param {String} start + * @param {String} end + * @return {Number} + * @api private + */ + + indexOfDelimiters: function(start, end){ + var str = this.input + , nstart = 0 + , nend = 0 + , pos = 0; + for (var i = 0, len = str.length; i < len; ++i) { + if (start == str.charAt(i)) { + ++nstart; + } else if (end == str.charAt(i)) { + if (++nend == nstart) { + pos = i; + break; + } + } + } + return pos; + }, + + /** + * Stashed token. + */ + + stashed: function() { + return this.stash.length + && this.stash.shift(); + }, + + /** + * Deferred token. + */ + + deferred: function() { + return this.deferredTokens.length + && this.deferredTokens.shift(); + }, + + /** + * end-of-source. + */ + + eos: function() { + if (this.input.length) return; + if (this.indentStack.length) { + this.indentStack.shift(); + return this.tok('outdent'); + } else { + return this.tok('eos'); + } + }, + + /** + * Blank line. + */ + + blank: function() { + var captures; + if (captures = /^\n *\n/.exec(this.input)) { + this.consume(captures[0].length - 1); + ++this.lineno; + if (this.pipeless) return this.tok('text', ''); + return this.next(); + } + }, + + /** + * Comment. + */ + + comment: function() { + var captures; + if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('comment', captures[2]); + tok.buffer = '-' != captures[1]; + return tok; + } + }, + + /** + * Interpolated tag. + */ + + interpolation: function() { + var captures; + if (captures = /^#\{(.*?)\}/.exec(this.input)) { + this.consume(captures[0].length); + return this.tok('interpolation', captures[1]); + } + }, + + /** + * Tag. + */ + + tag: function() { + var captures; + if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { + this.consume(captures[0].length); + var tok, name = captures[1]; + if (':' == name[name.length - 1]) { + name = name.slice(0, -1); + tok = this.tok('tag', name); + this.defer(this.tok(':')); + while (' ' == this.input[0]) this.input = this.input.substr(1); + } else { + tok = this.tok('tag', name); + } + tok.selfClosing = !! captures[2]; + return tok; + } + }, + + /** + * Filter. + */ + + filter: function() { + return this.scan(/^:(\w+)/, 'filter'); + }, + + /** + * Doctype. + */ + + doctype: function() { + return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); + }, + + /** + * Id. + */ + + id: function() { + return this.scan(/^#([\w-]+)/, 'id'); + }, + + /** + * Class. + */ + + className: function() { + return this.scan(/^\.([\w-]+)/, 'class'); + }, + + /** + * Text. + */ + + text: function() { + return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); + }, + + /** + * Extends. + */ + + "extends": function() { + return this.scan(/^extends? +([^\n]+)/, 'extends'); + }, + + /** + * Block prepend. + */ + + prepend: function() { + var captures; + if (captures = /^prepend +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = 'prepend' + , name = captures[1] + , tok = this.tok('block', name); + tok.mode = mode; + return tok; + } + }, + + /** + * Block append. + */ + + append: function() { + var captures; + if (captures = /^append +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = 'append' + , name = captures[1] + , tok = this.tok('block', name); + tok.mode = mode; + return tok; + } + }, + + /** + * Block. + */ + + block: function() { + var captures; + if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var mode = captures[1] || 'replace' + , name = captures[2] + , tok = this.tok('block', name); + + tok.mode = mode; + return tok; + } + }, + + /** + * Yield. + */ + + yield: function() { + return this.scan(/^yield */, 'yield'); + }, + + /** + * Include. + */ + + include: function() { + return this.scan(/^include +([^\n]+)/, 'include'); + }, + + /** + * Case. + */ + + "case": function() { + return this.scan(/^case +([^\n]+)/, 'case'); + }, + + /** + * When. + */ + + when: function() { + return this.scan(/^when +([^:\n]+)/, 'when'); + }, + + /** + * Default. + */ + + "default": function() { + return this.scan(/^default */, 'default'); + }, + + /** + * Assignment. + */ + + assignment: function() { + var captures; + if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { + this.consume(captures[0].length); + var name = captures[1] + , val = captures[2]; + return this.tok('code', 'var ' + name + ' = (' + val + ');'); + } + }, + + /** + * Call mixin. + */ + + call: function(){ + var captures; + if (captures = /^\+([-\w]+)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('call', captures[1]); + + // Check for args (not attributes) + if (captures = /^ *\((.*?)\)/.exec(this.input)) { + if (!/^ *[-\w]+ *=/.test(captures[1])) { + this.consume(captures[0].length); + tok.args = captures[1]; + } + } + + return tok; + } + }, + + /** + * Mixin. + */ + + mixin: function(){ + var captures; + if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('mixin', captures[1]); + tok.args = captures[2]; + return tok; + } + }, + + /** + * Conditional. + */ + + conditional: function() { + var captures; + if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var type = captures[1] + , js = captures[2]; + + switch (type) { + case 'if': js = 'if (' + js + ')'; break; + case 'unless': js = 'if (!(' + js + '))'; break; + case 'else if': js = 'else if (' + js + ')'; break; + case 'else': js = 'else'; break; + } + + return this.tok('code', js); + } + }, + + /** + * While. + */ + + "while": function() { + var captures; + if (captures = /^while +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + return this.tok('code', 'while (' + captures[1] + ')'); + } + }, + + /** + * Each. + */ + + each: function() { + var captures; + if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('each', captures[1]); + tok.key = captures[2] || '$index'; + tok.code = captures[3]; + return tok; + } + }, + + /** + * Code. + */ + + code: function() { + var captures; + if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var flags = captures[1]; + captures[1] = captures[2]; + var tok = this.tok('code', captures[1]); + tok.escape = flags.charAt(0) === '='; + tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; + return tok; + } + }, + + /** + * Attributes. + */ + + attrs: function() { + if ('(' == this.input.charAt(0)) { + var index = this.indexOfDelimiters('(', ')') + , str = this.input.substr(1, index-1) + , tok = this.tok('attrs') + , len = str.length + , colons = this.colons + , states = ['key'] + , escapedAttr + , key = '' + , val = '' + , quote + , c + , p; + + function state(){ + return states[states.length - 1]; + } + + function interpolate(attr) { + return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ + return escape + ? _ + : quote + " + (" + expr + ") + " + quote; + }); + } + + this.consume(index + 1); + tok.attrs = {}; + tok.escaped = {}; + + function parse(c) { + var real = c; + // TODO: remove when people fix ":" + if (colons && ':' == c) c = '='; + switch (c) { + case ',': + case '\n': + switch (state()) { + case 'expr': + case 'array': + case 'string': + case 'object': + val += c; + break; + default: + states.push('key'); + val = val.trim(); + key = key.trim(); + if ('' == key) return; + key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); + tok.escaped[key] = escapedAttr; + tok.attrs[key] = '' == val + ? true + : interpolate(val); + key = val = ''; + } + break; + case '=': + switch (state()) { + case 'key char': + key += real; + break; + case 'val': + case 'expr': + case 'array': + case 'string': + case 'object': + val += real; + break; + default: + escapedAttr = '!' != p; + states.push('val'); + } + break; + case '(': + if ('val' == state() + || 'expr' == state()) states.push('expr'); + val += c; + break; + case ')': + if ('expr' == state() + || 'val' == state()) states.pop(); + val += c; + break; + case '{': + if ('val' == state()) states.push('object'); + val += c; + break; + case '}': + if ('object' == state()) states.pop(); + val += c; + break; + case '[': + if ('val' == state()) states.push('array'); + val += c; + break; + case ']': + if ('array' == state()) states.pop(); + val += c; + break; + case '"': + case "'": + switch (state()) { + case 'key': + states.push('key char'); + break; + case 'key char': + states.pop(); + break; + case 'string': + if (c == quote) states.pop(); + val += c; + break; + default: + states.push('string'); + val += c; + quote = c; + } + break; + case '': + break; + default: + switch (state()) { + case 'key': + case 'key char': + key += c; + break; + default: + val += c; + } + } + p = c; + } + + for (var i = 0; i < len; ++i) { + parse(str.charAt(i)); + } + + parse(','); + + if ('/' == this.input.charAt(0)) { + this.consume(1); + tok.selfClosing = true; + } + + return tok; + } + }, + + /** + * Indent | Outdent | Newline. + */ + + indent: function() { + var captures, re; + + // established regexp + if (this.indentRe) { + captures = this.indentRe.exec(this.input); + // determine regexp + } else { + // tabs + re = /^\n(\t*) */; + captures = re.exec(this.input); + + // spaces + if (captures && !captures[1].length) { + re = /^\n( *)/; + captures = re.exec(this.input); + } + + // established + if (captures && captures[1].length) this.indentRe = re; + } + + if (captures) { + var tok + , indents = captures[1].length; + + ++this.lineno; + this.consume(indents + 1); + + if (' ' == this.input[0] || '\t' == this.input[0]) { + throw new Error('Invalid indentation, you can use tabs or spaces but not both'); + } + + // blank line + if ('\n' == this.input[0]) return this.tok('newline'); + + // outdent + if (this.indentStack.length && indents < this.indentStack[0]) { + while (this.indentStack.length && this.indentStack[0] > indents) { + this.stash.push(this.tok('outdent')); + this.indentStack.shift(); + } + tok = this.stash.pop(); + // indent + } else if (indents && indents != this.indentStack[0]) { + this.indentStack.unshift(indents); + tok = this.tok('indent', indents); + // newline + } else { + tok = this.tok('newline'); + } + + return tok; + } + }, + + /** + * Pipe-less text consumed only when + * pipeless is true; + */ + + pipelessText: function() { + if (this.pipeless) { + if ('\n' == this.input[0]) return; + var i = this.input.indexOf('\n'); + if (-1 == i) i = this.input.length; + var str = this.input.substr(0, i); + this.consume(str.length); + return this.tok('text', str); + } + }, + + /** + * ':' + */ + + colon: function() { + return this.scan(/^: */, ':'); + }, + + /** + * Return the next token object, or those + * previously stashed by lookahead. + * + * @return {Object} + * @api private + */ + + advance: function(){ + return this.stashed() + || this.next(); + }, + + /** + * Return the next token object. + * + * @return {Object} + * @api private + */ + + next: function() { + return this.deferred() + || this.blank() + || this.eos() + || this.pipelessText() + || this.yield() + || this.doctype() + || this.interpolation() + || this["case"]() + || this.when() + || this["default"]() + || this["extends"]() + || this.append() + || this.prepend() + || this.block() + || this.include() + || this.mixin() + || this.call() + || this.conditional() + || this.each() + || this["while"]() + || this.assignment() + || this.tag() + || this.filter() + || this.code() + || this.id() + || this.className() + || this.attrs() + || this.indent() + || this.comment() + || this.colon() + || this.text(); + } +}; diff --git a/node_modules/jade/lib/nodes/attrs.js b/node_modules/jade/lib/nodes/attrs.js new file mode 100644 index 0000000..5de9b59 --- /dev/null +++ b/node_modules/jade/lib/nodes/attrs.js @@ -0,0 +1,77 @@ + +/*! + * Jade - nodes - Attrs + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'), + Block = require('./block'); + +/** + * Initialize a `Attrs` node. + * + * @api public + */ + +var Attrs = module.exports = function Attrs() { + this.attrs = []; +}; + +/** + * Inherit from `Node`. + */ + +Attrs.prototype.__proto__ = Node.prototype; + +/** + * Set attribute `name` to `val`, keep in mind these become + * part of a raw js object literal, so to quote a value you must + * '"quote me"', otherwise or example 'user.name' is literal JavaScript. + * + * @param {String} name + * @param {String} val + * @param {Boolean} escaped + * @return {Tag} for chaining + * @api public + */ + +Attrs.prototype.setAttribute = function(name, val, escaped){ + this.attrs.push({ name: name, val: val, escaped: escaped }); + return this; +}; + +/** + * Remove attribute `name` when present. + * + * @param {String} name + * @api public + */ + +Attrs.prototype.removeAttribute = function(name){ + for (var i = 0, len = this.attrs.length; i < len; ++i) { + if (this.attrs[i] && this.attrs[i].name == name) { + delete this.attrs[i]; + } + } +}; + +/** + * Get attribute value by `name`. + * + * @param {String} name + * @return {String} + * @api public + */ + +Attrs.prototype.getAttribute = function(name){ + for (var i = 0, len = this.attrs.length; i < len; ++i) { + if (this.attrs[i] && this.attrs[i].name == name) { + return this.attrs[i].val; + } + } +}; diff --git a/node_modules/jade/lib/nodes/block-comment.js b/node_modules/jade/lib/nodes/block-comment.js new file mode 100644 index 0000000..4f41e4a --- /dev/null +++ b/node_modules/jade/lib/nodes/block-comment.js @@ -0,0 +1,33 @@ + +/*! + * Jade - nodes - BlockComment + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `BlockComment` with the given `block`. + * + * @param {String} val + * @param {Block} block + * @param {Boolean} buffer + * @api public + */ + +var BlockComment = module.exports = function BlockComment(val, block, buffer) { + this.block = block; + this.val = val; + this.buffer = buffer; +}; + +/** + * Inherit from `Node`. + */ + +BlockComment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/block.js b/node_modules/jade/lib/nodes/block.js new file mode 100644 index 0000000..6bb18c9 --- /dev/null +++ b/node_modules/jade/lib/nodes/block.js @@ -0,0 +1,122 @@ + +/*! + * Jade - nodes - Block + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a new `Block` with an optional `node`. + * + * @param {Node} node + * @api public + */ + +var Block = module.exports = function Block(node){ + this.nodes = []; + if (node) this.push(node); +}; + +/** + * Inherit from `Node`. + */ + +Block.prototype.__proto__ = Node.prototype; + +/** + * Block flag. + */ + +Block.prototype.isBlock = true; + +/** + * Replace the nodes in `other` with the nodes + * in `this` block. + * + * @param {Block} other + * @api private + */ + +Block.prototype.replace = function(other){ + other.nodes = this.nodes; +}; + +/** + * Pust the given `node`. + * + * @param {Node} node + * @return {Number} + * @api public + */ + +Block.prototype.push = function(node){ + return this.nodes.push(node); +}; + +/** + * Check if this block is empty. + * + * @return {Boolean} + * @api public + */ + +Block.prototype.isEmpty = function(){ + return 0 == this.nodes.length; +}; + +/** + * Unshift the given `node`. + * + * @param {Node} node + * @return {Number} + * @api public + */ + +Block.prototype.unshift = function(node){ + return this.nodes.unshift(node); +}; + +/** + * Return the "last" block, or the first `yield` node. + * + * @return {Block} + * @api private + */ + +Block.prototype.includeBlock = function(){ + var ret = this + , node; + + for (var i = 0, len = this.nodes.length; i < len; ++i) { + node = this.nodes[i]; + if (node.yield) return node; + else if (node.textOnly) continue; + else if (node.includeBlock) ret = node.includeBlock(); + else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); + if (ret.yield) return ret; + } + + return ret; +}; + +/** + * Return a clone of this block. + * + * @return {Block} + * @api private + */ + +Block.prototype.clone = function(){ + var clone = new Block; + for (var i = 0, len = this.nodes.length; i < len; ++i) { + clone.push(this.nodes[i].clone()); + } + return clone; +}; + diff --git a/node_modules/jade/lib/nodes/case.js b/node_modules/jade/lib/nodes/case.js new file mode 100644 index 0000000..08ff033 --- /dev/null +++ b/node_modules/jade/lib/nodes/case.js @@ -0,0 +1,43 @@ + +/*! + * Jade - nodes - Case + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a new `Case` with `expr`. + * + * @param {String} expr + * @api public + */ + +var Case = exports = module.exports = function Case(expr, block){ + this.expr = expr; + this.block = block; +}; + +/** + * Inherit from `Node`. + */ + +Case.prototype.__proto__ = Node.prototype; + +var When = exports.When = function When(expr, block){ + this.expr = expr; + this.block = block; + this.debug = false; +}; + +/** + * Inherit from `Node`. + */ + +When.prototype.__proto__ = Node.prototype; + diff --git a/node_modules/jade/lib/nodes/code.js b/node_modules/jade/lib/nodes/code.js new file mode 100644 index 0000000..babc675 --- /dev/null +++ b/node_modules/jade/lib/nodes/code.js @@ -0,0 +1,35 @@ + +/*! + * Jade - nodes - Code + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Code` node with the given code `val`. + * Code may also be optionally buffered and escaped. + * + * @param {String} val + * @param {Boolean} buffer + * @param {Boolean} escape + * @api public + */ + +var Code = module.exports = function Code(val, buffer, escape) { + this.val = val; + this.buffer = buffer; + this.escape = escape; + if (val.match(/^ *else/)) this.debug = false; +}; + +/** + * Inherit from `Node`. + */ + +Code.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/comment.js b/node_modules/jade/lib/nodes/comment.js new file mode 100644 index 0000000..2e1469e --- /dev/null +++ b/node_modules/jade/lib/nodes/comment.js @@ -0,0 +1,32 @@ + +/*! + * Jade - nodes - Comment + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Comment` with the given `val`, optionally `buffer`, + * otherwise the comment may render in the output. + * + * @param {String} val + * @param {Boolean} buffer + * @api public + */ + +var Comment = module.exports = function Comment(val, buffer) { + this.val = val; + this.buffer = buffer; +}; + +/** + * Inherit from `Node`. + */ + +Comment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/doctype.js b/node_modules/jade/lib/nodes/doctype.js new file mode 100644 index 0000000..b8f33e5 --- /dev/null +++ b/node_modules/jade/lib/nodes/doctype.js @@ -0,0 +1,29 @@ + +/*! + * Jade - nodes - Doctype + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Doctype` with the given `val`. + * + * @param {String} val + * @api public + */ + +var Doctype = module.exports = function Doctype(val) { + this.val = val; +}; + +/** + * Inherit from `Node`. + */ + +Doctype.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/each.js b/node_modules/jade/lib/nodes/each.js new file mode 100644 index 0000000..f54101f --- /dev/null +++ b/node_modules/jade/lib/nodes/each.js @@ -0,0 +1,35 @@ + +/*! + * Jade - nodes - Each + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize an `Each` node, representing iteration + * + * @param {String} obj + * @param {String} val + * @param {String} key + * @param {Block} block + * @api public + */ + +var Each = module.exports = function Each(obj, val, key, block) { + this.obj = obj; + this.val = val; + this.key = key; + this.block = block; +}; + +/** + * Inherit from `Node`. + */ + +Each.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/filter.js b/node_modules/jade/lib/nodes/filter.js new file mode 100644 index 0000000..0d7ff6e --- /dev/null +++ b/node_modules/jade/lib/nodes/filter.js @@ -0,0 +1,34 @@ + +/*! + * Jade - nodes - Filter + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node') + , Block = require('./block'); + +/** + * Initialize a `Filter` node with the given + * filter `name` and `block`. + * + * @param {String} name + * @param {Block|Node} block + * @api public + */ + +var Filter = module.exports = function Filter(name, block, attrs) { + this.name = name; + this.block = block; + this.attrs = attrs; +}; + +/** + * Inherit from `Node`. + */ + +Filter.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/index.js b/node_modules/jade/lib/nodes/index.js new file mode 100644 index 0000000..386ad2f --- /dev/null +++ b/node_modules/jade/lib/nodes/index.js @@ -0,0 +1,20 @@ + +/*! + * Jade - nodes + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +exports.Node = require('./node'); +exports.Tag = require('./tag'); +exports.Code = require('./code'); +exports.Each = require('./each'); +exports.Case = require('./case'); +exports.Text = require('./text'); +exports.Block = require('./block'); +exports.Mixin = require('./mixin'); +exports.Filter = require('./filter'); +exports.Comment = require('./comment'); +exports.Literal = require('./literal'); +exports.BlockComment = require('./block-comment'); +exports.Doctype = require('./doctype'); diff --git a/node_modules/jade/lib/nodes/literal.js b/node_modules/jade/lib/nodes/literal.js new file mode 100644 index 0000000..fde586b --- /dev/null +++ b/node_modules/jade/lib/nodes/literal.js @@ -0,0 +1,32 @@ + +/*! + * Jade - nodes - Literal + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Literal` node with the given `str. + * + * @param {String} str + * @api public + */ + +var Literal = module.exports = function Literal(str) { + this.str = str + .replace(/\\/g, "\\\\") + .replace(/\n|\r\n/g, "\\n") + .replace(/'/g, "\\'"); +}; + +/** + * Inherit from `Node`. + */ + +Literal.prototype.__proto__ = Node.prototype; diff --git a/node_modules/jade/lib/nodes/mixin.js b/node_modules/jade/lib/nodes/mixin.js new file mode 100644 index 0000000..8407bc7 --- /dev/null +++ b/node_modules/jade/lib/nodes/mixin.js @@ -0,0 +1,36 @@ + +/*! + * Jade - nodes - Mixin + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Attrs = require('./attrs'); + +/** + * Initialize a new `Mixin` with `name` and `block`. + * + * @param {String} name + * @param {String} args + * @param {Block} block + * @api public + */ + +var Mixin = module.exports = function Mixin(name, args, block, call){ + this.name = name; + this.args = args; + this.block = block; + this.attrs = []; + this.call = call; +}; + +/** + * Inherit from `Attrs`. + */ + +Mixin.prototype.__proto__ = Attrs.prototype; + diff --git a/node_modules/jade/lib/nodes/node.js b/node_modules/jade/lib/nodes/node.js new file mode 100644 index 0000000..e98f042 --- /dev/null +++ b/node_modules/jade/lib/nodes/node.js @@ -0,0 +1,25 @@ + +/*! + * Jade - nodes - Node + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Initialize a `Node`. + * + * @api public + */ + +var Node = module.exports = function Node(){}; + +/** + * Clone this node (return itself) + * + * @return {Node} + * @api private + */ + +Node.prototype.clone = function(){ + return this; +}; diff --git a/node_modules/jade/lib/nodes/tag.js b/node_modules/jade/lib/nodes/tag.js new file mode 100644 index 0000000..4b6728a --- /dev/null +++ b/node_modules/jade/lib/nodes/tag.js @@ -0,0 +1,95 @@ + +/*! + * Jade - nodes - Tag + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Attrs = require('./attrs'), + Block = require('./block'), + inlineTags = require('../inline-tags'); + +/** + * Initialize a `Tag` node with the given tag `name` and optional `block`. + * + * @param {String} name + * @param {Block} block + * @api public + */ + +var Tag = module.exports = function Tag(name, block) { + this.name = name; + this.attrs = []; + this.block = block || new Block; +}; + +/** + * Inherit from `Attrs`. + */ + +Tag.prototype.__proto__ = Attrs.prototype; + +/** + * Clone this tag. + * + * @return {Tag} + * @api private + */ + +Tag.prototype.clone = function(){ + var clone = new Tag(this.name, this.block.clone()); + clone.line = this.line; + clone.attrs = this.attrs; + clone.textOnly = this.textOnly; + return clone; +}; + +/** + * Check if this tag is an inline tag. + * + * @return {Boolean} + * @api private + */ + +Tag.prototype.isInline = function(){ + return ~inlineTags.indexOf(this.name); +}; + +/** + * Check if this tag's contents can be inlined. Used for pretty printing. + * + * @return {Boolean} + * @api private + */ + +Tag.prototype.canInline = function(){ + var nodes = this.block.nodes; + + function isInline(node){ + // Recurse if the node is a block + if (node.isBlock) return node.nodes.every(isInline); + return node.isText || (node.isInline && node.isInline()); + } + + // Empty tag + if (!nodes.length) return true; + + // Text-only or inline-only tag + if (1 == nodes.length) return isInline(nodes[0]); + + // Multi-line inline-only tag + if (this.block.nodes.every(isInline)) { + for (var i = 1, len = nodes.length; i < len; ++i) { + if (nodes[i-1].isText && nodes[i].isText) + return false; + } + return true; + } + + // Mixed tag + return false; +}; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/text.js b/node_modules/jade/lib/nodes/text.js new file mode 100644 index 0000000..3b5dd55 --- /dev/null +++ b/node_modules/jade/lib/nodes/text.js @@ -0,0 +1,36 @@ + +/*! + * Jade - nodes - Text + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Node = require('./node'); + +/** + * Initialize a `Text` node with optional `line`. + * + * @param {String} line + * @api public + */ + +var Text = module.exports = function Text(line) { + this.val = ''; + if ('string' == typeof line) this.val = line; +}; + +/** + * Inherit from `Node`. + */ + +Text.prototype.__proto__ = Node.prototype; + +/** + * Flag as text. + */ + +Text.prototype.isText = true; \ No newline at end of file diff --git a/node_modules/jade/lib/parser.js b/node_modules/jade/lib/parser.js new file mode 100644 index 0000000..5039c90 --- /dev/null +++ b/node_modules/jade/lib/parser.js @@ -0,0 +1,699 @@ + +/*! + * Jade - Parser + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Lexer = require('./lexer') + , nodes = require('./nodes') + , utils = require('./utils') + , filters = require('./filters') + , path = require('path') + , extname = path.extname; + +/** + * Initialize `Parser` with the given input `str` and `filename`. + * + * @param {String} str + * @param {String} filename + * @param {Object} options + * @api public + */ + +var Parser = exports = module.exports = function Parser(str, filename, options){ + this.input = str; + this.lexer = new Lexer(str, options); + this.filename = filename; + this.blocks = {}; + this.mixins = {}; + this.options = options; + this.contexts = [this]; +}; + +/** + * Tags that may not contain tags. + */ + +var textOnly = exports.textOnly = ['script', 'style']; + +/** + * Parser prototype. + */ + +Parser.prototype = { + + /** + * Push `parser` onto the context stack, + * or pop and return a `Parser`. + */ + + context: function(parser){ + if (parser) { + this.contexts.push(parser); + } else { + return this.contexts.pop(); + } + }, + + /** + * Return the next token object. + * + * @return {Object} + * @api private + */ + + advance: function(){ + return this.lexer.advance(); + }, + + /** + * Skip `n` tokens. + * + * @param {Number} n + * @api private + */ + + skip: function(n){ + while (n--) this.advance(); + }, + + /** + * Single token lookahead. + * + * @return {Object} + * @api private + */ + + peek: function() { + return this.lookahead(1); + }, + + /** + * Return lexer lineno. + * + * @return {Number} + * @api private + */ + + line: function() { + return this.lexer.lineno; + }, + + /** + * `n` token lookahead. + * + * @param {Number} n + * @return {Object} + * @api private + */ + + lookahead: function(n){ + return this.lexer.lookahead(n); + }, + + /** + * Parse input returning a string of js for evaluation. + * + * @return {String} + * @api public + */ + + parse: function(){ + var block = new nodes.Block, parser; + block.line = this.line(); + + while ('eos' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else { + block.push(this.parseExpr()); + } + } + + if (parser = this.extending) { + this.context(parser); + var ast = parser.parse(); + this.context(); + // hoist mixins + for (var name in this.mixins) + ast.unshift(this.mixins[name]); + return ast; + } + + return block; + }, + + /** + * Expect the given type, or throw an exception. + * + * @param {String} type + * @api private + */ + + expect: function(type){ + if (this.peek().type === type) { + return this.advance(); + } else { + throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); + } + }, + + /** + * Accept the given `type`. + * + * @param {String} type + * @api private + */ + + accept: function(type){ + if (this.peek().type === type) { + return this.advance(); + } + }, + + /** + * tag + * | doctype + * | mixin + * | include + * | filter + * | comment + * | text + * | each + * | code + * | yield + * | id + * | class + * | interpolation + */ + + parseExpr: function(){ + switch (this.peek().type) { + case 'tag': + return this.parseTag(); + case 'mixin': + return this.parseMixin(); + case 'block': + return this.parseBlock(); + case 'case': + return this.parseCase(); + case 'when': + return this.parseWhen(); + case 'default': + return this.parseDefault(); + case 'extends': + return this.parseExtends(); + case 'include': + return this.parseInclude(); + case 'doctype': + return this.parseDoctype(); + case 'filter': + return this.parseFilter(); + case 'comment': + return this.parseComment(); + case 'text': + return this.parseText(); + case 'each': + return this.parseEach(); + case 'code': + return this.parseCode(); + case 'call': + return this.parseCall(); + case 'interpolation': + return this.parseInterpolation(); + case 'yield': + this.advance(); + var block = new nodes.Block; + block.yield = true; + return block; + case 'id': + case 'class': + var tok = this.advance(); + this.lexer.defer(this.lexer.tok('tag', 'div')); + this.lexer.defer(tok); + return this.parseExpr(); + default: + throw new Error('unexpected token "' + this.peek().type + '"'); + } + }, + + /** + * Text + */ + + parseText: function(){ + var tok = this.expect('text'); + var node = new nodes.Text(tok.val); + node.line = this.line(); + return node; + }, + + /** + * ':' expr + * | block + */ + + parseBlockExpansion: function(){ + if (':' == this.peek().type) { + this.advance(); + return new nodes.Block(this.parseExpr()); + } else { + return this.block(); + } + }, + + /** + * case + */ + + parseCase: function(){ + var val = this.expect('case').val; + var node = new nodes.Case(val); + node.line = this.line(); + node.block = this.block(); + return node; + }, + + /** + * when + */ + + parseWhen: function(){ + var val = this.expect('when').val + return new nodes.Case.When(val, this.parseBlockExpansion()); + }, + + /** + * default + */ + + parseDefault: function(){ + this.expect('default'); + return new nodes.Case.When('default', this.parseBlockExpansion()); + }, + + /** + * code + */ + + parseCode: function(){ + var tok = this.expect('code'); + var node = new nodes.Code(tok.val, tok.buffer, tok.escape); + var block; + var i = 1; + node.line = this.line(); + while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; + block = 'indent' == this.lookahead(i).type; + if (block) { + this.skip(i-1); + node.block = this.block(); + } + return node; + }, + + /** + * comment + */ + + parseComment: function(){ + var tok = this.expect('comment'); + var node; + + if ('indent' == this.peek().type) { + node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); + } else { + node = new nodes.Comment(tok.val, tok.buffer); + } + + node.line = this.line(); + return node; + }, + + /** + * doctype + */ + + parseDoctype: function(){ + var tok = this.expect('doctype'); + var node = new nodes.Doctype(tok.val); + node.line = this.line(); + return node; + }, + + /** + * filter attrs? text-block + */ + + parseFilter: function(){ + var tok = this.expect('filter'); + var attrs = this.accept('attrs'); + var block; + + this.lexer.pipeless = true; + block = this.parseTextBlock(); + this.lexer.pipeless = false; + + var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); + node.line = this.line(); + return node; + }, + + /** + * each block + */ + + parseEach: function(){ + var tok = this.expect('each'); + var node = new nodes.Each(tok.code, tok.val, tok.key); + node.line = this.line(); + node.block = this.block(); + if (this.peek().type == 'code' && this.peek().val == 'else') { + this.advance(); + node.alternative = this.block(); + } + return node; + }, + + /** + * 'extends' name + */ + + parseExtends: function(){ + var path = require('path'); + var fs = require('fs'); + var dirname = path.dirname; + var basename = path.basename; + var join = path.join; + + if (!this.filename) + throw new Error('the "filename" option is required to extend templates'); + + var path = this.expect('extends').val.trim(); + var dir = dirname(this.filename); + + var path = join(dir, path + '.jade'); + var str = fs.readFileSync(path, 'utf8'); + var parser = new Parser(str, path, this.options); + + parser.blocks = this.blocks; + parser.contexts = this.contexts; + this.extending = parser; + + // TODO: null node + return new nodes.Literal(''); + }, + + /** + * 'block' name block + */ + + parseBlock: function(){ + var block = this.expect('block'); + var mode = block.mode; + var name = block.val.trim(); + + block = 'indent' == this.peek().type + ? this.block() + : new nodes.Block(new nodes.Literal('')); + + var prev = this.blocks[name]; + + if (prev) { + switch (prev.mode) { + case 'append': + block.nodes = block.nodes.concat(prev.nodes); + prev = block; + break; + case 'prepend': + block.nodes = prev.nodes.concat(block.nodes); + prev = block; + break; + } + } + + block.mode = mode; + return this.blocks[name] = prev || block; + }, + + /** + * include block? + */ + + parseInclude: function(){ + var path = require('path'); + var fs = require('fs'); + var dirname = path.dirname; + var basename = path.basename; + var join = path.join; + + var path = this.expect('include').val.trim(); + var dir = dirname(this.filename); + + if (!this.filename) + throw new Error('the "filename" option is required to use includes'); + + // no extension + if (!~basename(path).indexOf('.')) { + path += '.jade'; + } + + // non-jade + if ('.jade' != path.substr(-5)) { + var path = join(dir, path); + var str = fs.readFileSync(path, 'utf8'); + var ext = extname(path).slice(1); + var filter = filters[ext]; + if (filter) str = filter(str, { filename: path }).replace(/\\n/g, '\n'); + return new nodes.Literal(str); + } + + var path = join(dir, path); + var str = fs.readFileSync(path, 'utf8'); + var parser = new Parser(str, path, this.options); + parser.blocks = utils.merge({}, this.blocks); + parser.mixins = this.mixins; + + this.context(parser); + var ast = parser.parse(); + this.context(); + ast.filename = path; + + if ('indent' == this.peek().type) { + ast.includeBlock().push(this.block()); + } + + return ast; + }, + + /** + * call ident block + */ + + parseCall: function(){ + var tok = this.expect('call'); + var name = tok.val; + var args = tok.args; + var mixin = new nodes.Mixin(name, args, new nodes.Block, true); + + this.tag(mixin); + if (mixin.block.isEmpty()) mixin.block = null; + return mixin; + }, + + /** + * mixin block + */ + + parseMixin: function(){ + var tok = this.expect('mixin'); + var name = tok.val; + var args = tok.args; + var mixin; + + // definition + if ('indent' == this.peek().type) { + mixin = new nodes.Mixin(name, args, this.block(), false); + this.mixins[name] = mixin; + return mixin; + // call + } else { + return new nodes.Mixin(name, args, null, true); + } + }, + + /** + * indent (text | newline)* outdent + */ + + parseTextBlock: function(){ + var block = new nodes.Block; + block.line = this.line(); + var spaces = this.expect('indent').val; + if (null == this._spaces) this._spaces = spaces; + var indent = Array(spaces - this._spaces + 1).join(' '); + while ('outdent' != this.peek().type) { + switch (this.peek().type) { + case 'newline': + this.advance(); + break; + case 'indent': + this.parseTextBlock().nodes.forEach(function(node){ + block.push(node); + }); + break; + default: + var text = new nodes.Text(indent + this.advance().val); + text.line = this.line(); + block.push(text); + } + } + + if (spaces == this._spaces) this._spaces = null; + this.expect('outdent'); + return block; + }, + + /** + * indent expr* outdent + */ + + block: function(){ + var block = new nodes.Block; + block.line = this.line(); + this.expect('indent'); + while ('outdent' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else { + block.push(this.parseExpr()); + } + } + this.expect('outdent'); + return block; + }, + + /** + * interpolation (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseInterpolation: function(){ + var tok = this.advance(); + var tag = new nodes.Tag(tok.val); + tag.buffer = true; + return this.tag(tag); + }, + + /** + * tag (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseTag: function(){ + // ast-filter look-ahead + var i = 2; + if ('attrs' == this.lookahead(i).type) ++i; + + var tok = this.advance(); + var tag = new nodes.Tag(tok.val); + + tag.selfClosing = tok.selfClosing; + + return this.tag(tag); + }, + + /** + * Parse tag. + */ + + tag: function(tag){ + var dot; + + tag.line = this.line(); + + // (attrs | class | id)* + out: + while (true) { + switch (this.peek().type) { + case 'id': + case 'class': + var tok = this.advance(); + tag.setAttribute(tok.type, "'" + tok.val + "'"); + continue; + case 'attrs': + var tok = this.advance() + , obj = tok.attrs + , escaped = tok.escaped + , names = Object.keys(obj); + + if (tok.selfClosing) tag.selfClosing = true; + + for (var i = 0, len = names.length; i < len; ++i) { + var name = names[i] + , val = obj[name]; + tag.setAttribute(name, val, escaped[name]); + } + continue; + default: + break out; + } + } + + // check immediate '.' + if ('.' == this.peek().val) { + dot = tag.textOnly = true; + this.advance(); + } + + // (text | code | ':')? + switch (this.peek().type) { + case 'text': + tag.block.push(this.parseText()); + break; + case 'code': + tag.code = this.parseCode(); + break; + case ':': + this.advance(); + tag.block = new nodes.Block; + tag.block.push(this.parseExpr()); + break; + } + + // newline* + while ('newline' == this.peek().type) this.advance(); + + tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); + + // script special-case + if ('script' == tag.name) { + var type = tag.getAttribute('type'); + if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { + tag.textOnly = false; + } + } + + // block? + if ('indent' == this.peek().type) { + if (tag.textOnly) { + this.lexer.pipeless = true; + tag.block = this.parseTextBlock(); + this.lexer.pipeless = false; + } else { + var block = this.block(); + if (tag.block) { + for (var i = 0, len = block.nodes.length; i < len; ++i) { + tag.block.push(block.nodes[i]); + } + } else { + tag.block = block; + } + } + } + + return tag; + } +}; diff --git a/node_modules/jade/lib/runtime.js b/node_modules/jade/lib/runtime.js new file mode 100644 index 0000000..fb711f5 --- /dev/null +++ b/node_modules/jade/lib/runtime.js @@ -0,0 +1,174 @@ + +/*! + * Jade - runtime + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Lame Array.isArray() polyfill for now. + */ + +if (!Array.isArray) { + Array.isArray = function(arr){ + return '[object Array]' == Object.prototype.toString.call(arr); + }; +} + +/** + * Lame Object.keys() polyfill for now. + */ + +if (!Object.keys) { + Object.keys = function(obj){ + var arr = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + arr.push(key); + } + } + return arr; + } +} + +/** + * Merge two attribute objects giving precedence + * to values in object `b`. Classes are special-cased + * allowing for arrays and merging/joining appropriately + * resulting in a string. + * + * @param {Object} a + * @param {Object} b + * @return {Object} a + * @api private + */ + +exports.merge = function merge(a, b) { + var ac = a['class']; + var bc = b['class']; + + if (ac || bc) { + ac = ac || []; + bc = bc || []; + if (!Array.isArray(ac)) ac = [ac]; + if (!Array.isArray(bc)) bc = [bc]; + ac = ac.filter(nulls); + bc = bc.filter(nulls); + a['class'] = ac.concat(bc).join(' '); + } + + for (var key in b) { + if (key != 'class') { + a[key] = b[key]; + } + } + + return a; +}; + +/** + * Filter null `val`s. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function nulls(val) { + return val != null; +} + +/** + * Render the given attributes object. + * + * @param {Object} obj + * @param {Object} escaped + * @return {String} + * @api private + */ + +exports.attrs = function attrs(obj, escaped){ + var buf = [] + , terse = obj.terse; + + delete obj.terse; + var keys = Object.keys(obj) + , len = keys.length; + + if (len) { + buf.push(''); + for (var i = 0; i < len; ++i) { + var key = keys[i] + , val = obj[key]; + + if ('boolean' == typeof val || null == val) { + if (val) { + terse + ? buf.push(key) + : buf.push(key + '="' + key + '"'); + } + } else if (0 == key.indexOf('data') && 'string' != typeof val) { + buf.push(key + "='" + JSON.stringify(val) + "'"); + } else if ('class' == key && Array.isArray(val)) { + buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); + } else if (escaped && escaped[key]) { + buf.push(key + '="' + exports.escape(val) + '"'); + } else { + buf.push(key + '="' + val + '"'); + } + } + } + + return buf.join(' '); +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function escape(html){ + return String(html) + .replace(/&(?!(\w+|\#\d+);)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +}; + +/** + * Re-throw the given `err` in context to the + * the jade in `filename` at the given `lineno`. + * + * @param {Error} err + * @param {String} filename + * @param {String} lineno + * @api private + */ + +exports.rethrow = function rethrow(err, filename, lineno){ + if (!filename) throw err; + + var context = 3 + , str = require('fs').readFileSync(filename, 'utf8') + , lines = str.split('\n') + , start = Math.max(lineno - context, 0) + , end = Math.min(lines.length, lineno + context); + + // 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 || 'Jade') + ':' + lineno + + '\n' + context + '\n\n' + err.message; + throw err; +}; diff --git a/node_modules/jade/lib/self-closing.js b/node_modules/jade/lib/self-closing.js new file mode 100644 index 0000000..0548771 --- /dev/null +++ b/node_modules/jade/lib/self-closing.js @@ -0,0 +1,19 @@ + +/*! + * Jade - self closing tags + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +module.exports = [ + 'meta' + , 'img' + , 'link' + , 'input' + , 'source' + , 'area' + , 'base' + , 'col' + , 'br' + , 'hr' +]; \ No newline at end of file diff --git a/node_modules/jade/lib/utils.js b/node_modules/jade/lib/utils.js new file mode 100644 index 0000000..ca4a7fa --- /dev/null +++ b/node_modules/jade/lib/utils.js @@ -0,0 +1,68 @@ + +/*! + * Jade - utils + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Convert interpolation in the given string to JavaScript. + * + * @param {String} str + * @return {String} + * @api private + */ + +var interpolate = exports.interpolate = function(str){ + return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ + code = code + .replace(/\\'/g, "'") + .replace(/_SLASH_/g, '\\'); + + return escape + ? str.slice(7) + : "' + " + + ('!' == flag ? '' : 'escape') + + "((interp = " + code + + ") == null ? '' : interp) + '"; + }); +}; + +/** + * Escape single quotes in `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +var escape = exports.escape = function(str) { + return str.replace(/'/g, "\\'"); +}; + +/** + * Interpolate, and escape the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +exports.text = function(str){ + return interpolate(escape(str)); +}; + +/** + * Merge `b` into `a`. + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports.merge = function(a, b) { + for (var key in b) a[key] = b[key]; + return a; +}; + diff --git a/node_modules/jade/node_modules/.bin/cake b/node_modules/jade/node_modules/.bin/cake new file mode 120000 index 0000000..d95f32a --- /dev/null +++ b/node_modules/jade/node_modules/.bin/cake @@ -0,0 +1 @@ +../coffee-script/bin/cake \ No newline at end of file diff --git a/node_modules/jade/node_modules/.bin/coffee b/node_modules/jade/node_modules/.bin/coffee new file mode 120000 index 0000000..b57f275 --- /dev/null +++ b/node_modules/jade/node_modules/.bin/coffee @@ -0,0 +1 @@ +../coffee-script/bin/coffee \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/.npmignore b/node_modules/jade/node_modules/coffee-script/.npmignore new file mode 100644 index 0000000..21e430d --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/.npmignore @@ -0,0 +1,11 @@ +*.coffee +*.html +.DS_Store +.git* +Cakefile +documentation/ +examples/ +extras/coffee-script.js +raw/ +src/ +test/ diff --git a/node_modules/jade/node_modules/coffee-script/CNAME b/node_modules/jade/node_modules/coffee-script/CNAME new file mode 100644 index 0000000..faadabe --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/CNAME @@ -0,0 +1 @@ +coffeescript.org \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md b/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md new file mode 100644 index 0000000..6390c68 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md @@ -0,0 +1,9 @@ +## How to contribute to CoffeeScript + +* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffee-script/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. + +* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffee-script/tree/master/test). + +* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffee-script/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). + +* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/LICENSE b/node_modules/jade/node_modules/coffee-script/LICENSE new file mode 100644 index 0000000..dbe6b4e --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2009-2012 Jeremy Ashkenas + +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/jade/node_modules/coffee-script/README b/node_modules/jade/node_modules/coffee-script/README new file mode 100644 index 0000000..69ee6f4 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/README @@ -0,0 +1,51 @@ + + { + } } { + { { } } + } }{ { + { }{ } } _____ __ __ + ( }{ }{ { ) / ____| / _|/ _| + .- { { } { }} -. | | ___ | |_| |_ ___ ___ + ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ + |`-..________ ..-'| | |___| (_) | | | || __/ __/ + | | \_____\___/|_| |_| \___|\___| + | ;--. + | (__ \ _____ _ _ + | | ) ) / ____| (_) | | + | |/ / | (___ ___ _ __ _ _ __ | |_ + | ( / \___ \ / __| '__| | '_ \| __| + | |/ ____) | (__| | | | |_) | |_ + | | |_____/ \___|_| |_| .__/ \__| + `-.._________..-' | | + |_| + + + CoffeeScript is a little language that compiles into JavaScript. + + Install Node.js, and then the CoffeeScript compiler: + sudo bin/cake install + + Or, if you have the Node Package Manager installed: + npm install -g coffee-script + (Leave off the -g if you don't wish to install globally.) + + Execute a script: + coffee /path/to/script.coffee + + Compile a script: + coffee -c /path/to/script.coffee + + For documentation, usage, and examples, see: + http://coffeescript.org/ + + To suggest a feature, report a bug, or general discussion: + http://github.com/jashkenas/coffee-script/issues/ + + If you'd like to chat, drop by #coffeescript on Freenode IRC, + or on webchat.freenode.net. + + The source repository: + git://github.com/jashkenas/coffee-script.git + + All contributors are listed here: + http://github.com/jashkenas/coffee-script/contributors diff --git a/node_modules/jade/node_modules/coffee-script/Rakefile b/node_modules/jade/node_modules/coffee-script/Rakefile new file mode 100644 index 0000000..dfb85da --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/Rakefile @@ -0,0 +1,78 @@ +require 'rubygems' +require 'erb' +require 'fileutils' +require 'rake/testtask' +require 'json' + +desc "Build the documentation page" +task :doc do + source = 'documentation/index.html.erb' + child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" } + at_exit { Process.kill("INT", child) } + Signal.trap("INT") { exit } + loop do + mtime = File.stat(source).mtime + if !@mtime || mtime > @mtime + rendered = ERB.new(File.read(source)).result(binding) + File.open('index.html', 'w+') {|f| f.write(rendered) } + end + @mtime = mtime + sleep 1 + end +end + +desc "Build coffee-script-source gem" +task :gem do + require 'rubygems' + require 'rubygems/package' + + gemspec = Gem::Specification.new do |s| + s.name = 'coffee-script-source' + s.version = JSON.parse(File.read('package.json'))["version"] + s.date = Time.now.strftime("%Y-%m-%d") + + s.homepage = "http://jashkenas.github.com/coffee-script/" + s.summary = "The CoffeeScript Compiler" + s.description = <<-EOS + CoffeeScript is a little language that compiles into JavaScript. + Underneath all of those embarrassing braces and semicolons, + JavaScript has always had a gorgeous object model at its heart. + CoffeeScript is an attempt to expose the good parts of JavaScript + in a simple way. + EOS + + s.files = [ + 'lib/coffee_script/coffee-script.js', + 'lib/coffee_script/source.rb' + ] + + s.authors = ['Jeremy Ashkenas'] + s.email = 'jashkenas@gmail.com' + s.rubyforge_project = 'coffee-script-source' + end + + file = File.open("coffee-script-source.gem", "w") + Gem::Package.open(file, 'w') do |pkg| + pkg.metadata = gemspec.to_yaml + + path = "lib/coffee_script/source.rb" + contents = <<-ERUBY +module CoffeeScript + module Source + def self.bundled_path + File.expand_path("../coffee-script.js", __FILE__) + end + end +end + ERUBY + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| + tar_io.write(contents) + end + + contents = File.read("extras/coffee-script.js") + path = "lib/coffee_script/coffee-script.js" + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| + tar_io.write(contents) + end + end +end diff --git a/node_modules/jade/node_modules/coffee-script/bin/cake b/node_modules/jade/node_modules/coffee-script/bin/cake new file mode 100755 index 0000000..5965f4e --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/bin/cake @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var path = require('path'); +var fs = require('fs'); +var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); + +require(lib + '/coffee-script/cake').run(); diff --git a/node_modules/jade/node_modules/coffee-script/bin/coffee b/node_modules/jade/node_modules/coffee-script/bin/coffee new file mode 100755 index 0000000..3d1d71c --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/bin/coffee @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var path = require('path'); +var fs = require('fs'); +var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); + +require(lib + '/coffee-script/command').run(); diff --git a/node_modules/jade/node_modules/coffee-script/extras/jsl.conf b/node_modules/jade/node_modules/coffee-script/extras/jsl.conf new file mode 100644 index 0000000..1190da5 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/extras/jsl.conf @@ -0,0 +1,44 @@ +# JavaScriptLint configuration file for CoffeeScript. + ++no_return_value # function {0} does not always return a value ++duplicate_formal # duplicate formal argument {0} +-equal_as_assign # test for equality (==) mistyped as assignment (=)?{0} ++var_hides_arg # variable {0} hides argument ++redeclared_var # redeclaration of {0} {1} +-anon_no_return_value # anonymous function does not always return a value ++missing_semicolon # missing semicolon ++meaningless_block # meaningless block; curly braces have no impact +-comma_separated_stmts # multiple statements separated by commas (use semicolons?) ++unreachable_code # unreachable code ++missing_break # missing break statement +-missing_break_for_last_case # missing break statement for last case in switch +-comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) +-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement +-useless_void # use of the void type may be unnecessary (void is always undefined) ++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs ++use_of_label # use of label +-block_without_braces # block statement without curly braces ++leading_decimal_point # leading decimal point may indicate a number or an object member ++trailing_decimal_point # trailing decimal point may indicate a number or an object member ++octal_number # leading zeros make an octal number ++nested_comment # nested comment ++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma ++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement ++empty_statement # empty statement or extra semicolon +-missing_option_explicit # the "option explicit" control comment is missing ++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag ++dup_option_explicit # duplicate "option explicit" control comment ++useless_assign # useless assignment ++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity ++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent) +-missing_default_case # missing default case in switch statement ++duplicate_case_in_switch # duplicate case in switch statements ++default_not_at_end # the default case is not at the end of the switch statement ++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax ++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax ++useless_comparison # useless comparison; comparing identical expressions ++with_statement # with statement hides undeclared variables; use temporary variable instead ++trailing_comma_in_array # extra comma is not recommended in array initializers ++assign_to_function_call # assignment to a function call ++parseint_missing_radix # parseInt missing radix parameter ++lambda_assign_requires_semicolon diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js new file mode 100644 index 0000000..045156f --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js @@ -0,0 +1,92 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var CoffeeScript, runScripts; + + CoffeeScript = require('./coffee-script'); + + CoffeeScript.require = require; + + CoffeeScript["eval"] = function(code, options) { + var _ref; + if (options == null) { + options = {}; + } + if ((_ref = options.bare) == null) { + options.bare = true; + } + return eval(CoffeeScript.compile(code, options)); + }; + + CoffeeScript.run = function(code, options) { + if (options == null) { + options = {}; + } + options.bare = true; + return Function(CoffeeScript.compile(code, options))(); + }; + + if (typeof window === "undefined" || window === null) { + return; + } + + CoffeeScript.load = function(url, callback) { + var xhr; + xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); + xhr.open('GET', url, true); + if ('overrideMimeType' in xhr) { + xhr.overrideMimeType('text/plain'); + } + xhr.onreadystatechange = function() { + var _ref; + if (xhr.readyState === 4) { + if ((_ref = xhr.status) === 0 || _ref === 200) { + CoffeeScript.run(xhr.responseText); + } else { + throw new Error("Could not load " + url); + } + if (callback) { + return callback(); + } + } + }; + return xhr.send(null); + }; + + runScripts = function() { + var coffees, execute, index, length, s, scripts; + scripts = document.getElementsByTagName('script'); + coffees = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = scripts.length; _i < _len; _i++) { + s = scripts[_i]; + if (s.type === 'text/coffeescript') { + _results.push(s); + } + } + return _results; + })(); + index = 0; + length = coffees.length; + (execute = function() { + var script; + script = coffees[index++]; + if ((script != null ? script.type : void 0) === 'text/coffeescript') { + if (script.src) { + return CoffeeScript.load(script.src, execute); + } else { + CoffeeScript.run(script.innerHTML); + return execute(); + } + } + })(); + return null; + }; + + if (window.addEventListener) { + addEventListener('DOMContentLoaded', runScripts, false); + } else { + attachEvent('onload', runScripts); + } + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js new file mode 100644 index 0000000..0e7f1cc --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js @@ -0,0 +1,113 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; + + fs = require('fs'); + + path = require('path'); + + helpers = require('./helpers'); + + optparse = require('./optparse'); + + CoffeeScript = require('./coffee-script'); + + existsSync = fs.existsSync || path.existsSync; + + tasks = {}; + + options = {}; + + switches = []; + + oparse = null; + + helpers.extend(global, { + task: function(name, description, action) { + var _ref; + if (!action) { + _ref = [description, action], action = _ref[0], description = _ref[1]; + } + return tasks[name] = { + name: name, + description: description, + action: action + }; + }, + option: function(letter, flag, description) { + return switches.push([letter, flag, description]); + }, + invoke: function(name) { + if (!tasks[name]) { + missingTask(name); + } + return tasks[name].action(options); + } + }); + + exports.run = function() { + var arg, args, _i, _len, _ref, _results; + global.__originalDirname = fs.realpathSync('.'); + process.chdir(cakefileDirectory(__originalDirname)); + args = process.argv.slice(2); + CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { + filename: 'Cakefile' + }); + oparse = new optparse.OptionParser(switches); + if (!args.length) { + return printTasks(); + } + try { + options = oparse.parse(args); + } catch (e) { + return fatalError("" + e); + } + _ref = options["arguments"]; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + arg = _ref[_i]; + _results.push(invoke(arg)); + } + return _results; + }; + + printTasks = function() { + var cakefilePath, desc, name, relative, spaces, task; + relative = path.relative || path.resolve; + cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile'); + console.log("" + cakefilePath + " defines the following tasks:\n"); + for (name in tasks) { + task = tasks[name]; + spaces = 20 - name.length; + spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; + desc = task.description ? "# " + task.description : ''; + console.log("cake " + name + spaces + " " + desc); + } + if (switches.length) { + return console.log(oparse.help()); + } + }; + + fatalError = function(message) { + console.error(message + '\n'); + console.log('To see a list of all tasks/options, run "cake"'); + return process.exit(1); + }; + + missingTask = function(task) { + return fatalError("No such task: " + task); + }; + + cakefileDirectory = function(dir) { + var parent; + if (existsSync(path.join(dir, 'Cakefile'))) { + return dir; + } + parent = path.normalize(path.join(dir, '..')); + if (parent !== dir) { + return cakefileDirectory(parent); + } + throw new Error("Cakefile not found in " + (process.cwd())); + }; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js new file mode 100644 index 0000000..7ee55cd --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js @@ -0,0 +1,171 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var Lexer, RESERVED, compile, fs, lexer, parser, path, stripBOM, vm, _ref, + __hasProp = {}.hasOwnProperty; + + fs = require('fs'); + + path = require('path'); + + _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED; + + parser = require('./parser').parser; + + vm = require('vm'); + + stripBOM = function(content) { + if (content.charCodeAt(0) === 0xFEFF) { + return content.substring(1); + } else { + return content; + } + }; + + if (require.extensions) { + require.extensions['.coffee'] = function(module, filename) { + var content; + content = compile(stripBOM(fs.readFileSync(filename, 'utf8')), { + filename: filename + }); + return module._compile(content, filename); + }; + } + + exports.VERSION = '1.4.0'; + + exports.RESERVED = RESERVED; + + exports.helpers = require('./helpers'); + + exports.compile = compile = function(code, options) { + var header, js, merge; + if (options == null) { + options = {}; + } + merge = exports.helpers.merge; + try { + js = (parser.parse(lexer.tokenize(code))).compile(options); + if (!options.header) { + return js; + } + } catch (err) { + if (options.filename) { + err.message = "In " + options.filename + ", " + err.message; + } + throw err; + } + header = "Generated by CoffeeScript " + this.VERSION; + return "// " + header + "\n" + js; + }; + + exports.tokens = function(code, options) { + return lexer.tokenize(code, options); + }; + + exports.nodes = function(source, options) { + if (typeof source === 'string') { + return parser.parse(lexer.tokenize(source, options)); + } else { + return parser.parse(source); + } + }; + + exports.run = function(code, options) { + var mainModule; + if (options == null) { + options = {}; + } + mainModule = require.main; + mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; + mainModule.moduleCache && (mainModule.moduleCache = {}); + mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename))); + if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { + return mainModule._compile(compile(code, options), mainModule.filename); + } else { + return mainModule._compile(code, mainModule.filename); + } + }; + + exports["eval"] = function(code, options) { + var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require; + if (options == null) { + options = {}; + } + if (!(code = code.trim())) { + return; + } + Script = vm.Script; + if (Script) { + if (options.sandbox != null) { + if (options.sandbox instanceof Script.createContext().constructor) { + sandbox = options.sandbox; + } else { + sandbox = Script.createContext(); + _ref1 = options.sandbox; + for (k in _ref1) { + if (!__hasProp.call(_ref1, k)) continue; + v = _ref1[k]; + sandbox[k] = v; + } + } + sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; + } else { + sandbox = global; + } + sandbox.__filename = options.filename || 'eval'; + sandbox.__dirname = path.dirname(sandbox.__filename); + if (!(sandbox !== global || sandbox.module || sandbox.require)) { + Module = require('module'); + sandbox.module = _module = new Module(options.modulename || 'eval'); + sandbox.require = _require = function(path) { + return Module._load(path, _module, true); + }; + _module.filename = sandbox.__filename; + _ref2 = Object.getOwnPropertyNames(require); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + r = _ref2[_i]; + if (r !== 'paths') { + _require[r] = require[r]; + } + } + _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); + _require.resolve = function(request) { + return Module._resolveFilename(request, _module); + }; + } + } + o = {}; + for (k in options) { + if (!__hasProp.call(options, k)) continue; + v = options[k]; + o[k] = v; + } + o.bare = true; + js = compile(code, o); + if (sandbox === global) { + return vm.runInThisContext(js); + } else { + return vm.runInContext(js, sandbox); + } + }; + + lexer = new Lexer; + + parser.lexer = { + lex: function() { + var tag, _ref1; + _ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2]; + return tag; + }, + setInput: function(tokens) { + this.tokens = tokens; + return this.pos = 0; + }, + upcomingInput: function() { + return ""; + } + }; + + parser.yy = require('./nodes'); + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js new file mode 100644 index 0000000..b0bcfe1 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js @@ -0,0 +1,502 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref; + + fs = require('fs'); + + path = require('path'); + + helpers = require('./helpers'); + + optparse = require('./optparse'); + + CoffeeScript = require('./coffee-script'); + + _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; + + EventEmitter = require('events').EventEmitter; + + exists = fs.exists || path.exists; + + helpers.extend(CoffeeScript, new EventEmitter); + + printLine = function(line) { + return process.stdout.write(line + '\n'); + }; + + printWarn = function(line) { + return process.stderr.write(line + '\n'); + }; + + hidden = function(file) { + return /^\.|~$/.test(file); + }; + + BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.'; + + SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']]; + + opts = {}; + + sources = []; + + sourceCode = []; + + notSources = {}; + + watchers = {}; + + optionParser = null; + + exports.run = function() { + var literals, source, _i, _len, _results; + parseOptions(); + if (opts.nodejs) { + return forkNode(); + } + if (opts.help) { + return usage(); + } + if (opts.version) { + return version(); + } + if (opts.require) { + loadRequires(); + } + if (opts.interactive) { + return require('./repl'); + } + if (opts.watch && !fs.watch) { + return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + "."); + } + if (opts.stdio) { + return compileStdio(); + } + if (opts["eval"]) { + return compileScript(null, sources[0]); + } + if (!sources.length) { + return require('./repl'); + } + literals = opts.run ? sources.splice(1) : []; + process.argv = process.argv.slice(0, 2).concat(literals); + process.argv[0] = 'coffee'; + process.execPath = require.main.filename; + _results = []; + for (_i = 0, _len = sources.length; _i < _len; _i++) { + source = sources[_i]; + _results.push(compilePath(source, true, path.normalize(source))); + } + return _results; + }; + + compilePath = function(source, topLevel, base) { + return fs.stat(source, function(err, stats) { + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + if (topLevel && source.slice(-7) !== '.coffee') { + source = sources[sources.indexOf(source)] = "" + source + ".coffee"; + return compilePath(source, topLevel, base); + } + if (topLevel) { + console.error("File not found: " + source); + process.exit(1); + } + return; + } + if (stats.isDirectory()) { + if (opts.watch) { + watchDir(source, base); + } + return fs.readdir(source, function(err, files) { + var file, index, _ref1, _ref2; + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + return; + } + index = sources.indexOf(source); + files = files.filter(function(file) { + return !hidden(file); + }); + [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + _results.push(path.join(source, file)); + } + return _results; + })())), _ref1; + [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() { + return null; + }))), _ref2; + return files.forEach(function(file) { + return compilePath(path.join(source, file), false, base); + }); + }); + } else if (topLevel || path.extname(source) === '.coffee') { + if (opts.watch) { + watch(source, base); + } + return fs.readFile(source, function(err, code) { + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + return; + } + return compileScript(source, code.toString(), base); + }); + } else { + notSources[source] = true; + return removeSource(source, base); + } + }); + }; + + compileScript = function(file, input, base) { + var o, options, t, task; + o = opts; + options = compileOptions(file); + try { + t = task = { + file: file, + input: input, + options: options + }; + CoffeeScript.emit('compile', task); + if (o.tokens) { + return printTokens(CoffeeScript.tokens(t.input)); + } else if (o.nodes) { + return printLine(CoffeeScript.nodes(t.input).toString().trim()); + } else if (o.run) { + return CoffeeScript.run(t.input, t.options); + } else if (o.join && t.file !== o.join) { + sourceCode[sources.indexOf(t.file)] = t.input; + return compileJoin(); + } else { + t.output = CoffeeScript.compile(t.input, t.options); + CoffeeScript.emit('success', task); + if (o.print) { + return printLine(t.output.trim()); + } else if (o.compile) { + return writeJs(t.file, t.output, base); + } else if (o.lint) { + return lint(t.file, t.output); + } + } + } catch (err) { + CoffeeScript.emit('failure', err, task); + if (CoffeeScript.listeners('failure').length) { + return; + } + if (o.watch) { + return printLine(err.message + '\x07'); + } + printWarn(err instanceof Error && err.stack || ("ERROR: " + err)); + return process.exit(1); + } + }; + + compileStdio = function() { + var code, stdin; + code = ''; + stdin = process.openStdin(); + stdin.on('data', function(buffer) { + if (buffer) { + return code += buffer.toString(); + } + }); + return stdin.on('end', function() { + return compileScript(null, code); + }); + }; + + joinTimeout = null; + + compileJoin = function() { + if (!opts.join) { + return; + } + if (!sourceCode.some(function(code) { + return code === null; + })) { + clearTimeout(joinTimeout); + return joinTimeout = wait(100, function() { + return compileScript(opts.join, sourceCode.join('\n'), opts.join); + }); + } + }; + + loadRequires = function() { + var realFilename, req, _i, _len, _ref1; + realFilename = module.filename; + module.filename = '.'; + _ref1 = opts.require; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + req = _ref1[_i]; + require(req); + } + return module.filename = realFilename; + }; + + watch = function(source, base) { + var compile, compileTimeout, prevStats, rewatch, watchErr, watcher; + prevStats = null; + compileTimeout = null; + watchErr = function(e) { + if (e.code === 'ENOENT') { + if (sources.indexOf(source) === -1) { + return; + } + try { + rewatch(); + return compile(); + } catch (e) { + removeSource(source, base, true); + return compileJoin(); + } + } else { + throw e; + } + }; + compile = function() { + clearTimeout(compileTimeout); + return compileTimeout = wait(25, function() { + return fs.stat(source, function(err, stats) { + if (err) { + return watchErr(err); + } + if (prevStats && stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) { + return rewatch(); + } + prevStats = stats; + return fs.readFile(source, function(err, code) { + if (err) { + return watchErr(err); + } + compileScript(source, code.toString(), base); + return rewatch(); + }); + }); + }); + }; + try { + watcher = fs.watch(source, compile); + } catch (e) { + watchErr(e); + } + return rewatch = function() { + if (watcher != null) { + watcher.close(); + } + return watcher = fs.watch(source, compile); + }; + }; + + watchDir = function(source, base) { + var readdirTimeout, watcher; + readdirTimeout = null; + try { + return watcher = fs.watch(source, function() { + clearTimeout(readdirTimeout); + return readdirTimeout = wait(25, function() { + return fs.readdir(source, function(err, files) { + var file, _i, _len, _results; + if (err) { + if (err.code !== 'ENOENT') { + throw err; + } + watcher.close(); + return unwatchDir(source, base); + } + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + if (!(!hidden(file) && !notSources[file])) { + continue; + } + file = path.join(source, file); + if (sources.some(function(s) { + return s.indexOf(file) >= 0; + })) { + continue; + } + sources.push(file); + sourceCode.push(null); + _results.push(compilePath(file, false, base)); + } + return _results; + }); + }); + }); + } catch (e) { + if (e.code !== 'ENOENT') { + throw e; + } + } + }; + + unwatchDir = function(source, base) { + var file, prevSources, toRemove, _i, _len; + prevSources = sources.slice(0); + toRemove = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = sources.length; _i < _len; _i++) { + file = sources[_i]; + if (file.indexOf(source) >= 0) { + _results.push(file); + } + } + return _results; + })(); + for (_i = 0, _len = toRemove.length; _i < _len; _i++) { + file = toRemove[_i]; + removeSource(file, base, true); + } + if (!sources.some(function(s, i) { + return prevSources[i] !== s; + })) { + return; + } + return compileJoin(); + }; + + removeSource = function(source, base, removeJs) { + var index, jsPath; + index = sources.indexOf(source); + sources.splice(index, 1); + sourceCode.splice(index, 1); + if (removeJs && !opts.join) { + jsPath = outputPath(source, base); + return exists(jsPath, function(itExists) { + if (itExists) { + return fs.unlink(jsPath, function(err) { + if (err && err.code !== 'ENOENT') { + throw err; + } + return timeLog("removed " + source); + }); + } + }); + } + }; + + outputPath = function(source, base) { + var baseDir, dir, filename, srcDir; + filename = path.basename(source, path.extname(source)) + '.js'; + srcDir = path.dirname(source); + baseDir = base === '.' ? srcDir : srcDir.substring(base.length); + dir = opts.output ? path.join(opts.output, baseDir) : srcDir; + return path.join(dir, filename); + }; + + writeJs = function(source, js, base) { + var compile, jsDir, jsPath; + jsPath = outputPath(source, base); + jsDir = path.dirname(jsPath); + compile = function() { + if (js.length <= 0) { + js = ' '; + } + return fs.writeFile(jsPath, js, function(err) { + if (err) { + return printLine(err.message); + } else if (opts.compile && opts.watch) { + return timeLog("compiled " + source); + } + }); + }; + return exists(jsDir, function(itExists) { + if (itExists) { + return compile(); + } else { + return exec("mkdir -p " + jsDir, compile); + } + }); + }; + + wait = function(milliseconds, func) { + return setTimeout(func, milliseconds); + }; + + timeLog = function(message) { + return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); + }; + + lint = function(file, js) { + var conf, jsl, printIt; + printIt = function(buffer) { + return printLine(file + ':\t' + buffer.toString().trim()); + }; + conf = __dirname + '/../../extras/jsl.conf'; + jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]); + jsl.stdout.on('data', printIt); + jsl.stderr.on('data', printIt); + jsl.stdin.write(js); + return jsl.stdin.end(); + }; + + printTokens = function(tokens) { + var strings, tag, token, value; + strings = (function() { + var _i, _len, _ref1, _results; + _results = []; + for (_i = 0, _len = tokens.length; _i < _len; _i++) { + token = tokens[_i]; + _ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1]; + _results.push("[" + tag + " " + value + "]"); + } + return _results; + })(); + return printLine(strings.join(' ')); + }; + + parseOptions = function() { + var i, o, source, _i, _len; + optionParser = new optparse.OptionParser(SWITCHES, BANNER); + o = opts = optionParser.parse(process.argv.slice(2)); + o.compile || (o.compile = !!o.output); + o.run = !(o.compile || o.print || o.lint); + o.print = !!(o.print || (o["eval"] || o.stdio && o.compile)); + sources = o["arguments"]; + for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) { + source = sources[i]; + sourceCode[i] = null; + } + }; + + compileOptions = function(filename) { + return { + filename: filename, + bare: opts.bare, + header: opts.compile + }; + }; + + forkNode = function() { + var args, nodeArgs; + nodeArgs = opts.nodejs.split(/\s+/); + args = process.argv.slice(1); + args.splice(args.indexOf('--nodejs'), 2); + return spawn(process.execPath, nodeArgs.concat(args), { + cwd: process.cwd(), + env: process.env, + customFds: [0, 1, 2] + }); + }; + + usage = function() { + return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help()); + }; + + version = function() { + return printLine("CoffeeScript version " + CoffeeScript.VERSION); + }; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js new file mode 100644 index 0000000..e3513e5 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js @@ -0,0 +1,606 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; + + Parser = require('jison').Parser; + + unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; + + o = function(patternString, action, options) { + var match; + patternString = patternString.replace(/\s{2,}/g, ' '); + if (!action) { + return [patternString, '$$ = $1;', options]; + } + action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; + action = action.replace(/\bnew /g, '$&yy.'); + action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&'); + return [patternString, "$$ = " + action + ";", options]; + }; + + grammar = { + Root: [ + o('', function() { + return new Block; + }), o('Body'), o('Block TERMINATOR') + ], + Body: [ + o('Line', function() { + return Block.wrap([$1]); + }), o('Body TERMINATOR Line', function() { + return $1.push($3); + }), o('Body TERMINATOR') + ], + Line: [o('Expression'), o('Statement')], + Statement: [ + o('Return'), o('Comment'), o('STATEMENT', function() { + return new Literal($1); + }) + ], + Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')], + Block: [ + o('INDENT OUTDENT', function() { + return new Block; + }), o('INDENT Body OUTDENT', function() { + return $2; + }) + ], + Identifier: [ + o('IDENTIFIER', function() { + return new Literal($1); + }) + ], + AlphaNumeric: [ + o('NUMBER', function() { + return new Literal($1); + }), o('STRING', function() { + return new Literal($1); + }) + ], + Literal: [ + o('AlphaNumeric'), o('JS', function() { + return new Literal($1); + }), o('REGEX', function() { + return new Literal($1); + }), o('DEBUGGER', function() { + return new Literal($1); + }), o('UNDEFINED', function() { + return new Undefined; + }), o('NULL', function() { + return new Null; + }), o('BOOL', function() { + return new Bool($1); + }) + ], + Assign: [ + o('Assignable = Expression', function() { + return new Assign($1, $3); + }), o('Assignable = TERMINATOR Expression', function() { + return new Assign($1, $4); + }), o('Assignable = INDENT Expression OUTDENT', function() { + return new Assign($1, $4); + }) + ], + AssignObj: [ + o('ObjAssignable', function() { + return new Value($1); + }), o('ObjAssignable : Expression', function() { + return new Assign(new Value($1), $3, 'object'); + }), o('ObjAssignable :\ + INDENT Expression OUTDENT', function() { + return new Assign(new Value($1), $4, 'object'); + }), o('Comment') + ], + ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')], + Return: [ + o('RETURN Expression', function() { + return new Return($2); + }), o('RETURN', function() { + return new Return; + }) + ], + Comment: [ + o('HERECOMMENT', function() { + return new Comment($1); + }) + ], + Code: [ + o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() { + return new Code($2, $5, $4); + }), o('FuncGlyph Block', function() { + return new Code([], $2, $1); + }) + ], + FuncGlyph: [ + o('->', function() { + return 'func'; + }), o('=>', function() { + return 'boundfunc'; + }) + ], + OptComma: [o(''), o(',')], + ParamList: [ + o('', function() { + return []; + }), o('Param', function() { + return [$1]; + }), o('ParamList , Param', function() { + return $1.concat($3); + }), o('ParamList OptComma TERMINATOR Param', function() { + return $1.concat($4); + }), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Param: [ + o('ParamVar', function() { + return new Param($1); + }), o('ParamVar ...', function() { + return new Param($1, null, true); + }), o('ParamVar = Expression', function() { + return new Param($1, $3); + }) + ], + ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')], + Splat: [ + o('Expression ...', function() { + return new Splat($1); + }) + ], + SimpleAssignable: [ + o('Identifier', function() { + return new Value($1); + }), o('Value Accessor', function() { + return $1.add($2); + }), o('Invocation Accessor', function() { + return new Value($1, [].concat($2)); + }), o('ThisProperty') + ], + Assignable: [ + o('SimpleAssignable'), o('Array', function() { + return new Value($1); + }), o('Object', function() { + return new Value($1); + }) + ], + Value: [ + o('Assignable'), o('Literal', function() { + return new Value($1); + }), o('Parenthetical', function() { + return new Value($1); + }), o('Range', function() { + return new Value($1); + }), o('This') + ], + Accessor: [ + o('. Identifier', function() { + return new Access($2); + }), o('?. Identifier', function() { + return new Access($2, 'soak'); + }), o(':: Identifier', function() { + return [new Access(new Literal('prototype')), new Access($2)]; + }), o('::', function() { + return new Access(new Literal('prototype')); + }), o('Index') + ], + Index: [ + o('INDEX_START IndexValue INDEX_END', function() { + return $2; + }), o('INDEX_SOAK Index', function() { + return extend($2, { + soak: true + }); + }) + ], + IndexValue: [ + o('Expression', function() { + return new Index($1); + }), o('Slice', function() { + return new Slice($1); + }) + ], + Object: [ + o('{ AssignList OptComma }', function() { + return new Obj($2, $1.generated); + }) + ], + AssignList: [ + o('', function() { + return []; + }), o('AssignObj', function() { + return [$1]; + }), o('AssignList , AssignObj', function() { + return $1.concat($3); + }), o('AssignList OptComma TERMINATOR AssignObj', function() { + return $1.concat($4); + }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Class: [ + o('CLASS', function() { + return new Class; + }), o('CLASS Block', function() { + return new Class(null, null, $2); + }), o('CLASS EXTENDS Expression', function() { + return new Class(null, $3); + }), o('CLASS EXTENDS Expression Block', function() { + return new Class(null, $3, $4); + }), o('CLASS SimpleAssignable', function() { + return new Class($2); + }), o('CLASS SimpleAssignable Block', function() { + return new Class($2, null, $3); + }), o('CLASS SimpleAssignable EXTENDS Expression', function() { + return new Class($2, $4); + }), o('CLASS SimpleAssignable EXTENDS Expression Block', function() { + return new Class($2, $4, $5); + }) + ], + Invocation: [ + o('Value OptFuncExist Arguments', function() { + return new Call($1, $3, $2); + }), o('Invocation OptFuncExist Arguments', function() { + return new Call($1, $3, $2); + }), o('SUPER', function() { + return new Call('super', [new Splat(new Literal('arguments'))]); + }), o('SUPER Arguments', function() { + return new Call('super', $2); + }) + ], + OptFuncExist: [ + o('', function() { + return false; + }), o('FUNC_EXIST', function() { + return true; + }) + ], + Arguments: [ + o('CALL_START CALL_END', function() { + return []; + }), o('CALL_START ArgList OptComma CALL_END', function() { + return $2; + }) + ], + This: [ + o('THIS', function() { + return new Value(new Literal('this')); + }), o('@', function() { + return new Value(new Literal('this')); + }) + ], + ThisProperty: [ + o('@ Identifier', function() { + return new Value(new Literal('this'), [new Access($2)], 'this'); + }) + ], + Array: [ + o('[ ]', function() { + return new Arr([]); + }), o('[ ArgList OptComma ]', function() { + return new Arr($2); + }) + ], + RangeDots: [ + o('..', function() { + return 'inclusive'; + }), o('...', function() { + return 'exclusive'; + }) + ], + Range: [ + o('[ Expression RangeDots Expression ]', function() { + return new Range($2, $4, $3); + }) + ], + Slice: [ + o('Expression RangeDots Expression', function() { + return new Range($1, $3, $2); + }), o('Expression RangeDots', function() { + return new Range($1, null, $2); + }), o('RangeDots Expression', function() { + return new Range(null, $2, $1); + }), o('RangeDots', function() { + return new Range(null, null, $1); + }) + ], + ArgList: [ + o('Arg', function() { + return [$1]; + }), o('ArgList , Arg', function() { + return $1.concat($3); + }), o('ArgList OptComma TERMINATOR Arg', function() { + return $1.concat($4); + }), o('INDENT ArgList OptComma OUTDENT', function() { + return $2; + }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Arg: [o('Expression'), o('Splat')], + SimpleArgs: [ + o('Expression'), o('SimpleArgs , Expression', function() { + return [].concat($1, $3); + }) + ], + Try: [ + o('TRY Block', function() { + return new Try($2); + }), o('TRY Block Catch', function() { + return new Try($2, $3[0], $3[1]); + }), o('TRY Block FINALLY Block', function() { + return new Try($2, null, null, $4); + }), o('TRY Block Catch FINALLY Block', function() { + return new Try($2, $3[0], $3[1], $5); + }) + ], + Catch: [ + o('CATCH Identifier Block', function() { + return [$2, $3]; + }) + ], + Throw: [ + o('THROW Expression', function() { + return new Throw($2); + }) + ], + Parenthetical: [ + o('( Body )', function() { + return new Parens($2); + }), o('( INDENT Body OUTDENT )', function() { + return new Parens($3); + }) + ], + WhileSource: [ + o('WHILE Expression', function() { + return new While($2); + }), o('WHILE Expression WHEN Expression', function() { + return new While($2, { + guard: $4 + }); + }), o('UNTIL Expression', function() { + return new While($2, { + invert: true + }); + }), o('UNTIL Expression WHEN Expression', function() { + return new While($2, { + invert: true, + guard: $4 + }); + }) + ], + While: [ + o('WhileSource Block', function() { + return $1.addBody($2); + }), o('Statement WhileSource', function() { + return $2.addBody(Block.wrap([$1])); + }), o('Expression WhileSource', function() { + return $2.addBody(Block.wrap([$1])); + }), o('Loop', function() { + return $1; + }) + ], + Loop: [ + o('LOOP Block', function() { + return new While(new Literal('true')).addBody($2); + }), o('LOOP Expression', function() { + return new While(new Literal('true')).addBody(Block.wrap([$2])); + }) + ], + For: [ + o('Statement ForBody', function() { + return new For($1, $2); + }), o('Expression ForBody', function() { + return new For($1, $2); + }), o('ForBody Block', function() { + return new For($2, $1); + }) + ], + ForBody: [ + o('FOR Range', function() { + return { + source: new Value($2) + }; + }), o('ForStart ForSource', function() { + $2.own = $1.own; + $2.name = $1[0]; + $2.index = $1[1]; + return $2; + }) + ], + ForStart: [ + o('FOR ForVariables', function() { + return $2; + }), o('FOR OWN ForVariables', function() { + $3.own = true; + return $3; + }) + ], + ForValue: [ + o('Identifier'), o('ThisProperty'), o('Array', function() { + return new Value($1); + }), o('Object', function() { + return new Value($1); + }) + ], + ForVariables: [ + o('ForValue', function() { + return [$1]; + }), o('ForValue , ForValue', function() { + return [$1, $3]; + }) + ], + ForSource: [ + o('FORIN Expression', function() { + return { + source: $2 + }; + }), o('FOROF Expression', function() { + return { + source: $2, + object: true + }; + }), o('FORIN Expression WHEN Expression', function() { + return { + source: $2, + guard: $4 + }; + }), o('FOROF Expression WHEN Expression', function() { + return { + source: $2, + guard: $4, + object: true + }; + }), o('FORIN Expression BY Expression', function() { + return { + source: $2, + step: $4 + }; + }), o('FORIN Expression WHEN Expression BY Expression', function() { + return { + source: $2, + guard: $4, + step: $6 + }; + }), o('FORIN Expression BY Expression WHEN Expression', function() { + return { + source: $2, + step: $4, + guard: $6 + }; + }) + ], + Switch: [ + o('SWITCH Expression INDENT Whens OUTDENT', function() { + return new Switch($2, $4); + }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() { + return new Switch($2, $4, $6); + }), o('SWITCH INDENT Whens OUTDENT', function() { + return new Switch(null, $3); + }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() { + return new Switch(null, $3, $5); + }) + ], + Whens: [ + o('When'), o('Whens When', function() { + return $1.concat($2); + }) + ], + When: [ + o('LEADING_WHEN SimpleArgs Block', function() { + return [[$2, $3]]; + }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() { + return [[$2, $3]]; + }) + ], + IfBlock: [ + o('IF Expression Block', function() { + return new If($2, $3, { + type: $1 + }); + }), o('IfBlock ELSE IF Expression Block', function() { + return $1.addElse(new If($4, $5, { + type: $3 + })); + }) + ], + If: [ + o('IfBlock'), o('IfBlock ELSE Block', function() { + return $1.addElse($3); + }), o('Statement POST_IF Expression', function() { + return new If($3, Block.wrap([$1]), { + type: $2, + statement: true + }); + }), o('Expression POST_IF Expression', function() { + return new If($3, Block.wrap([$1]), { + type: $2, + statement: true + }); + }) + ], + Operation: [ + o('UNARY Expression', function() { + return new Op($1, $2); + }), o('- Expression', (function() { + return new Op('-', $2); + }), { + prec: 'UNARY' + }), o('+ Expression', (function() { + return new Op('+', $2); + }), { + prec: 'UNARY' + }), o('-- SimpleAssignable', function() { + return new Op('--', $2); + }), o('++ SimpleAssignable', function() { + return new Op('++', $2); + }), o('SimpleAssignable --', function() { + return new Op('--', $1, null, true); + }), o('SimpleAssignable ++', function() { + return new Op('++', $1, null, true); + }), o('Expression ?', function() { + return new Existence($1); + }), o('Expression + Expression', function() { + return new Op('+', $1, $3); + }), o('Expression - Expression', function() { + return new Op('-', $1, $3); + }), o('Expression MATH Expression', function() { + return new Op($2, $1, $3); + }), o('Expression SHIFT Expression', function() { + return new Op($2, $1, $3); + }), o('Expression COMPARE Expression', function() { + return new Op($2, $1, $3); + }), o('Expression LOGIC Expression', function() { + return new Op($2, $1, $3); + }), o('Expression RELATION Expression', function() { + if ($2.charAt(0) === '!') { + return new Op($2.slice(1), $1, $3).invert(); + } else { + return new Op($2, $1, $3); + } + }), o('SimpleAssignable COMPOUND_ASSIGN\ + Expression', function() { + return new Assign($1, $3, $2); + }), o('SimpleAssignable COMPOUND_ASSIGN\ + INDENT Expression OUTDENT', function() { + return new Assign($1, $4, $2); + }), o('SimpleAssignable EXTENDS Expression', function() { + return new Extends($1, $3); + }) + ] + }; + + operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']]; + + tokens = []; + + for (name in grammar) { + alternatives = grammar[name]; + grammar[name] = (function() { + var _i, _j, _len, _len1, _ref, _results; + _results = []; + for (_i = 0, _len = alternatives.length; _i < _len; _i++) { + alt = alternatives[_i]; + _ref = alt[0].split(' '); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + token = _ref[_j]; + if (!grammar[token]) { + tokens.push(token); + } + } + if (name === 'Root') { + alt[1] = "return " + alt[1]; + } + _results.push(alt); + } + return _results; + })(); + } + + exports.parser = new Parser({ + tokens: tokens.join(' '), + bnf: grammar, + operators: operators.reverse(), + startSymbol: 'Root' + }); + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js new file mode 100644 index 0000000..f9929f7 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js @@ -0,0 +1,88 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var extend, flatten, _ref; + + exports.starts = function(string, literal, start) { + return literal === string.substr(start, literal.length); + }; + + exports.ends = function(string, literal, back) { + var len; + len = literal.length; + return literal === string.substr(string.length - len - (back || 0), len); + }; + + exports.compact = function(array) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + item = array[_i]; + if (item) { + _results.push(item); + } + } + return _results; + }; + + exports.count = function(string, substr) { + var num, pos; + num = pos = 0; + if (!substr.length) { + return 1 / 0; + } + while (pos = 1 + string.indexOf(substr, pos)) { + num++; + } + return num; + }; + + exports.merge = function(options, overrides) { + return extend(extend({}, options), overrides); + }; + + extend = exports.extend = function(object, properties) { + var key, val; + for (key in properties) { + val = properties[key]; + object[key] = val; + } + return object; + }; + + exports.flatten = flatten = function(array) { + var element, flattened, _i, _len; + flattened = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + element = array[_i]; + if (element instanceof Array) { + flattened = flattened.concat(flatten(element)); + } else { + flattened.push(element); + } + } + return flattened; + }; + + exports.del = function(obj, key) { + var val; + val = obj[key]; + delete obj[key]; + return val; + }; + + exports.last = function(array, back) { + return array[array.length - (back || 0) - 1]; + }; + + exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) { + var e, _i, _len; + for (_i = 0, _len = this.length; _i < _len; _i++) { + e = this[_i]; + if (fn(e)) { + return true; + } + } + return false; + }; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js new file mode 100644 index 0000000..b1c1765 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js @@ -0,0 +1,11 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var key, val, _ref; + + _ref = require('./coffee-script'); + for (key in _ref) { + val = _ref[key]; + exports[key] = val; + } + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js new file mode 100644 index 0000000..1b777cb --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js @@ -0,0 +1,788 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; + + _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last; + + exports.Lexer = Lexer = (function() { + + function Lexer() {} + + Lexer.prototype.tokenize = function(code, opts) { + var i, tag; + if (opts == null) { + opts = {}; + } + if (WHITESPACE.test(code)) { + code = "\n" + code; + } + code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); + this.code = code; + this.line = opts.line || 0; + this.indent = 0; + this.indebt = 0; + this.outdebt = 0; + this.indents = []; + this.ends = []; + this.tokens = []; + i = 0; + while (this.chunk = code.slice(i)) { + i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); + } + this.closeIndentation(); + if (tag = this.ends.pop()) { + this.error("missing " + tag); + } + if (opts.rewrite === false) { + return this.tokens; + } + return (new Rewriter).rewrite(this.tokens); + }; + + Lexer.prototype.identifierToken = function() { + var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; + if (!(match = IDENTIFIER.exec(this.chunk))) { + return 0; + } + input = match[0], id = match[1], colon = match[2]; + if (id === 'own' && this.tag() === 'FOR') { + this.token('OWN', id); + return id.length; + } + forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); + tag = 'IDENTIFIER'; + if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { + tag = id.toUpperCase(); + if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { + tag = 'LEADING_WHEN'; + } else if (tag === 'FOR') { + this.seenFor = true; + } else if (tag === 'UNLESS') { + tag = 'IF'; + } else if (__indexOf.call(UNARY, tag) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(RELATION, tag) >= 0) { + if (tag !== 'INSTANCEOF' && this.seenFor) { + tag = 'FOR' + tag; + this.seenFor = false; + } else { + tag = 'RELATION'; + if (this.value() === '!') { + this.tokens.pop(); + id = '!' + id; + } + } + } + } + if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { + if (forcedIdentifier) { + tag = 'IDENTIFIER'; + id = new String(id); + id.reserved = true; + } else if (__indexOf.call(RESERVED, id) >= 0) { + this.error("reserved word \"" + id + "\""); + } + } + if (!forcedIdentifier) { + if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { + id = COFFEE_ALIAS_MAP[id]; + } + tag = (function() { + switch (id) { + case '!': + return 'UNARY'; + case '==': + case '!=': + return 'COMPARE'; + case '&&': + case '||': + return 'LOGIC'; + case 'true': + case 'false': + return 'BOOL'; + case 'break': + case 'continue': + return 'STATEMENT'; + default: + return tag; + } + })(); + } + this.token(tag, id); + if (colon) { + this.token(':', ':'); + } + return input.length; + }; + + Lexer.prototype.numberToken = function() { + var binaryLiteral, lexedLength, match, number, octalLiteral; + if (!(match = NUMBER.exec(this.chunk))) { + return 0; + } + number = match[0]; + if (/^0[BOX]/.test(number)) { + this.error("radix prefix '" + number + "' must be lowercase"); + } else if (/E/.test(number) && !/^0x/.test(number)) { + this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'"); + } else if (/^0\d*[89]/.test(number)) { + this.error("decimal literal '" + number + "' must not be prefixed with '0'"); + } else if (/^0\d+/.test(number)) { + this.error("octal literal '" + number + "' must be prefixed with '0o'"); + } + lexedLength = number.length; + if (octalLiteral = /^0o([0-7]+)/.exec(number)) { + number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16); + } + if (binaryLiteral = /^0b([01]+)/.exec(number)) { + number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16); + } + this.token('NUMBER', number); + return lexedLength; + }; + + Lexer.prototype.stringToken = function() { + var match, octalEsc, string; + switch (this.chunk.charAt(0)) { + case "'": + if (!(match = SIMPLESTR.exec(this.chunk))) { + return 0; + } + this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n')); + break; + case '"': + if (!(string = this.balancedString(this.chunk, '"'))) { + return 0; + } + if (0 < string.indexOf('#{', 1)) { + this.interpolateString(string.slice(1, -1)); + } else { + this.token('STRING', this.escapeLines(string)); + } + break; + default: + return 0; + } + if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { + this.error("octal escape sequences " + string + " are not allowed"); + } + this.line += count(string, '\n'); + return string.length; + }; + + Lexer.prototype.heredocToken = function() { + var doc, heredoc, match, quote; + if (!(match = HEREDOC.exec(this.chunk))) { + return 0; + } + heredoc = match[0]; + quote = heredoc.charAt(0); + doc = this.sanitizeHeredoc(match[2], { + quote: quote, + indent: null + }); + if (quote === '"' && 0 <= doc.indexOf('#{')) { + this.interpolateString(doc, { + heredoc: true + }); + } else { + this.token('STRING', this.makeString(doc, quote, true)); + } + this.line += count(heredoc, '\n'); + return heredoc.length; + }; + + Lexer.prototype.commentToken = function() { + var comment, here, match; + if (!(match = this.chunk.match(COMMENT))) { + return 0; + } + comment = match[0], here = match[1]; + if (here) { + this.token('HERECOMMENT', this.sanitizeHeredoc(here, { + herecomment: true, + indent: Array(this.indent + 1).join(' ') + })); + } + this.line += count(comment, '\n'); + return comment.length; + }; + + Lexer.prototype.jsToken = function() { + var match, script; + if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { + return 0; + } + this.token('JS', (script = match[0]).slice(1, -1)); + this.line += count(script, '\n'); + return script.length; + }; + + Lexer.prototype.regexToken = function() { + var flags, length, match, prev, regex, _ref2, _ref3; + if (this.chunk.charAt(0) !== '/') { + return 0; + } + if (match = HEREGEX.exec(this.chunk)) { + length = this.heregexToken(match); + this.line += count(match[0], '\n'); + return length; + } + prev = last(this.tokens); + if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { + return 0; + } + if (!(match = REGEX.exec(this.chunk))) { + return 0; + } + _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; + if (regex.slice(0, 2) === '/*') { + this.error('regular expressions cannot begin with `*`'); + } + if (regex === '//') { + regex = '/(?:)/'; + } + this.token('REGEX', "" + regex + flags); + return match.length; + }; + + Lexer.prototype.heregexToken = function(match) { + var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5; + heregex = match[0], body = match[1], flags = match[2]; + if (0 > body.indexOf('#{')) { + re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); + if (re.match(/^\*/)) { + this.error('regular expressions cannot begin with `*`'); + } + this.token('REGEX', "/" + (re || '(?:)') + "/" + flags); + return heregex.length; + } + this.token('IDENTIFIER', 'RegExp'); + this.tokens.push(['CALL_START', '(']); + tokens = []; + _ref2 = this.interpolateString(body, { + regex: true + }); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1]; + if (tag === 'TOKENS') { + tokens.push.apply(tokens, value); + } else { + if (!(value = value.replace(HEREGEX_OMIT, ''))) { + continue; + } + value = value.replace(/\\/g, '\\\\'); + tokens.push(['STRING', this.makeString(value, '"', true)]); + } + tokens.push(['+', '+']); + } + tokens.pop(); + if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { + this.tokens.push(['STRING', '""'], ['+', '+']); + } + (_ref5 = this.tokens).push.apply(_ref5, tokens); + if (flags) { + this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); + } + this.token(')', ')'); + return heregex.length; + }; + + Lexer.prototype.lineToken = function() { + var diff, indent, match, noNewlines, size; + if (!(match = MULTI_DENT.exec(this.chunk))) { + return 0; + } + indent = match[0]; + this.line += count(indent, '\n'); + this.seenFor = false; + size = indent.length - 1 - indent.lastIndexOf('\n'); + noNewlines = this.unfinished(); + if (size - this.indebt === this.indent) { + if (noNewlines) { + this.suppressNewlines(); + } else { + this.newlineToken(); + } + return indent.length; + } + if (size > this.indent) { + if (noNewlines) { + this.indebt = size - this.indent; + this.suppressNewlines(); + return indent.length; + } + diff = size - this.indent + this.outdebt; + this.token('INDENT', diff); + this.indents.push(diff); + this.ends.push('OUTDENT'); + this.outdebt = this.indebt = 0; + } else { + this.indebt = 0; + this.outdentToken(this.indent - size, noNewlines); + } + this.indent = size; + return indent.length; + }; + + Lexer.prototype.outdentToken = function(moveOut, noNewlines) { + var dent, len; + while (moveOut > 0) { + len = this.indents.length - 1; + if (this.indents[len] === void 0) { + moveOut = 0; + } else if (this.indents[len] === this.outdebt) { + moveOut -= this.outdebt; + this.outdebt = 0; + } else if (this.indents[len] < this.outdebt) { + this.outdebt -= this.indents[len]; + moveOut -= this.indents[len]; + } else { + dent = this.indents.pop() - this.outdebt; + moveOut -= dent; + this.outdebt = 0; + this.pair('OUTDENT'); + this.token('OUTDENT', dent); + } + } + if (dent) { + this.outdebt -= moveOut; + } + while (this.value() === ';') { + this.tokens.pop(); + } + if (!(this.tag() === 'TERMINATOR' || noNewlines)) { + this.token('TERMINATOR', '\n'); + } + return this; + }; + + Lexer.prototype.whitespaceToken = function() { + var match, nline, prev; + if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { + return 0; + } + prev = last(this.tokens); + if (prev) { + prev[match ? 'spaced' : 'newLine'] = true; + } + if (match) { + return match[0].length; + } else { + return 0; + } + }; + + Lexer.prototype.newlineToken = function() { + while (this.value() === ';') { + this.tokens.pop(); + } + if (this.tag() !== 'TERMINATOR') { + this.token('TERMINATOR', '\n'); + } + return this; + }; + + Lexer.prototype.suppressNewlines = function() { + if (this.value() === '\\') { + this.tokens.pop(); + } + return this; + }; + + Lexer.prototype.literalToken = function() { + var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; + if (match = OPERATOR.exec(this.chunk)) { + value = match[0]; + if (CODE.test(value)) { + this.tagParameters(); + } + } else { + value = this.chunk.charAt(0); + } + tag = value; + prev = last(this.tokens); + if (value === '=' && prev) { + if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { + this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); + } + if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { + prev[0] = 'COMPOUND_ASSIGN'; + prev[1] += '='; + return value.length; + } + } + if (value === ';') { + this.seenFor = false; + tag = 'TERMINATOR'; + } else if (__indexOf.call(MATH, value) >= 0) { + tag = 'MATH'; + } else if (__indexOf.call(COMPARE, value) >= 0) { + tag = 'COMPARE'; + } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { + tag = 'COMPOUND_ASSIGN'; + } else if (__indexOf.call(UNARY, value) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(SHIFT, value) >= 0) { + tag = 'SHIFT'; + } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { + tag = 'LOGIC'; + } else if (prev && !prev.spaced) { + if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { + if (prev[0] === '?') { + prev[0] = 'FUNC_EXIST'; + } + tag = 'CALL_START'; + } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { + tag = 'INDEX_START'; + switch (prev[0]) { + case '?': + prev[0] = 'INDEX_SOAK'; + } + } + } + switch (value) { + case '(': + case '{': + case '[': + this.ends.push(INVERSES[value]); + break; + case ')': + case '}': + case ']': + this.pair(value); + } + this.token(tag, value); + return value.length; + }; + + Lexer.prototype.sanitizeHeredoc = function(doc, options) { + var attempt, herecomment, indent, match, _ref2; + indent = options.indent, herecomment = options.herecomment; + if (herecomment) { + if (HEREDOC_ILLEGAL.test(doc)) { + this.error("block comment cannot contain \"*/\", starting"); + } + if (doc.indexOf('\n') <= 0) { + return doc; + } + } else { + while (match = HEREDOC_INDENT.exec(doc)) { + attempt = match[1]; + if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { + indent = attempt; + } + } + } + if (indent) { + doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); + } + if (!herecomment) { + doc = doc.replace(/^\n/, ''); + } + return doc; + }; + + Lexer.prototype.tagParameters = function() { + var i, stack, tok, tokens; + if (this.tag() !== ')') { + return this; + } + stack = []; + tokens = this.tokens; + i = tokens.length; + tokens[--i][0] = 'PARAM_END'; + while (tok = tokens[--i]) { + switch (tok[0]) { + case ')': + stack.push(tok); + break; + case '(': + case 'CALL_START': + if (stack.length) { + stack.pop(); + } else if (tok[0] === '(') { + tok[0] = 'PARAM_START'; + return this; + } else { + return this; + } + } + } + return this; + }; + + Lexer.prototype.closeIndentation = function() { + return this.outdentToken(this.indent); + }; + + Lexer.prototype.balancedString = function(str, end) { + var continueCount, i, letter, match, prev, stack, _i, _ref2; + continueCount = 0; + stack = [end]; + for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { + if (continueCount) { + --continueCount; + continue; + } + switch (letter = str.charAt(i)) { + case '\\': + ++continueCount; + continue; + case end: + stack.pop(); + if (!stack.length) { + return str.slice(0, +i + 1 || 9e9); + } + end = stack[stack.length - 1]; + continue; + } + if (end === '}' && (letter === '"' || letter === "'")) { + stack.push(end = letter); + } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { + continueCount += match[0].length - 1; + } else if (end === '}' && letter === '{') { + stack.push(end = '}'); + } else if (end === '"' && prev === '#' && letter === '{') { + stack.push(end = '}'); + } + prev = letter; + } + return this.error("missing " + (stack.pop()) + ", starting"); + }; + + Lexer.prototype.interpolateString = function(str, options) { + var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4; + if (options == null) { + options = {}; + } + heredoc = options.heredoc, regex = options.regex; + tokens = []; + pi = 0; + i = -1; + while (letter = str.charAt(i += 1)) { + if (letter === '\\') { + i += 1; + continue; + } + if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { + continue; + } + if (pi < i) { + tokens.push(['NEOSTRING', str.slice(pi, i)]); + } + inner = expr.slice(1, -1); + if (inner.length) { + nested = new Lexer().tokenize(inner, { + line: this.line, + rewrite: false + }); + nested.pop(); + if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { + nested.shift(); + } + if (len = nested.length) { + if (len > 1) { + nested.unshift(['(', '(', this.line]); + nested.push([')', ')', this.line]); + } + tokens.push(['TOKENS', nested]); + } + } + i += expr.length; + pi = i + 1; + } + if ((i > pi && pi < str.length)) { + tokens.push(['NEOSTRING', str.slice(pi)]); + } + if (regex) { + return tokens; + } + if (!tokens.length) { + return this.token('STRING', '""'); + } + if (tokens[0][0] !== 'NEOSTRING') { + tokens.unshift(['', '']); + } + if (interpolated = tokens.length > 1) { + this.token('(', '('); + } + for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { + _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; + if (i) { + this.token('+', '+'); + } + if (tag === 'TOKENS') { + (_ref4 = this.tokens).push.apply(_ref4, value); + } else { + this.token('STRING', this.makeString(value, '"', heredoc)); + } + } + if (interpolated) { + this.token(')', ')'); + } + return tokens; + }; + + Lexer.prototype.pair = function(tag) { + var size, wanted; + if (tag !== (wanted = last(this.ends))) { + if ('OUTDENT' !== wanted) { + this.error("unmatched " + tag); + } + this.indent -= size = last(this.indents); + this.outdentToken(size, true); + return this.pair(tag); + } + return this.ends.pop(); + }; + + Lexer.prototype.token = function(tag, value) { + return this.tokens.push([tag, value, this.line]); + }; + + Lexer.prototype.tag = function(index, tag) { + var tok; + return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); + }; + + Lexer.prototype.value = function(index, val) { + var tok; + return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); + }; + + Lexer.prototype.unfinished = function() { + var _ref2; + return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); + }; + + Lexer.prototype.escapeLines = function(str, heredoc) { + return str.replace(MULTILINER, heredoc ? '\\n' : ''); + }; + + Lexer.prototype.makeString = function(body, quote, heredoc) { + if (!body) { + return quote + quote; + } + body = body.replace(/\\([\s\S])/g, function(match, contents) { + if (contents === '\n' || contents === quote) { + return contents; + } else { + return match; + } + }); + body = body.replace(RegExp("" + quote, "g"), '\\$&'); + return quote + this.escapeLines(body, heredoc) + quote; + }; + + Lexer.prototype.error = function(message) { + throw SyntaxError("" + message + " on line " + (this.line + 1)); + }; + + return Lexer; + + })(); + + JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; + + COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; + + COFFEE_ALIAS_MAP = { + and: '&&', + or: '||', + is: '==', + isnt: '!=', + not: '!', + yes: 'true', + no: 'false', + on: 'true', + off: 'false' + }; + + COFFEE_ALIASES = (function() { + var _results; + _results = []; + for (key in COFFEE_ALIAS_MAP) { + _results.push(key); + } + return _results; + })(); + + COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); + + RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield']; + + STRICT_PROSCRIBED = ['arguments', 'eval']; + + JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); + + exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); + + exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; + + IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; + + NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; + + HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; + + OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/; + + WHITESPACE = /^[^\n\S]+/; + + COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/; + + CODE = /^[-=]>/; + + MULTI_DENT = /^(?:\n[^\n\S]*)+/; + + SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; + + JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; + + REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; + + HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; + + HEREGEX_OMIT = /\s+(?:#.*)?/g; + + MULTILINER = /\n/g; + + HEREDOC_INDENT = /\n+([^\n\S]*)/g; + + HEREDOC_ILLEGAL = /\*\//; + + LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; + + TRAILING_SPACES = /\s+$/; + + COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; + + UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; + + LOGIC = ['&&', '||', '&', '|', '^']; + + SHIFT = ['<<', '>>', '>>>']; + + COMPARE = ['==', '!=', '<', '>', '<=', '>=']; + + MATH = ['*', '/', '%']; + + RELATION = ['IN', 'OF', 'INSTANCEOF']; + + BOOL = ['TRUE', 'FALSE']; + + NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']']; + + NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING'); + + CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; + + INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED'); + + LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js new file mode 100644 index 0000000..f8e0777 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js @@ -0,0 +1,2971 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, some, starts, unfoldSoak, utility, _ref, _ref1, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + Scope = require('./scope').Scope; + + _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; + + _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some; + + exports.extend = extend; + + YES = function() { + return true; + }; + + NO = function() { + return false; + }; + + THIS = function() { + return this; + }; + + NEGATE = function() { + this.negated = !this.negated; + return this; + }; + + exports.Base = Base = (function() { + + function Base() {} + + Base.prototype.compile = function(o, lvl) { + var node; + o = extend({}, o); + if (lvl) { + o.level = lvl; + } + node = this.unfoldSoak(o) || this; + node.tab = o.indent; + if (o.level === LEVEL_TOP || !node.isStatement(o)) { + return node.compileNode(o); + } else { + return node.compileClosure(o); + } + }; + + Base.prototype.compileClosure = function(o) { + if (this.jumps()) { + throw SyntaxError('cannot use a pure statement in an expression.'); + } + o.sharedScope = true; + return Closure.wrap(this).compileNode(o); + }; + + Base.prototype.cache = function(o, level, reused) { + var ref, sub; + if (!this.isComplex()) { + ref = level ? this.compile(o, level) : this; + return [ref, ref]; + } else { + ref = new Literal(reused || o.scope.freeVariable('ref')); + sub = new Assign(ref, this); + if (level) { + return [sub.compile(o, level), ref.value]; + } else { + return [sub, ref]; + } + } + }; + + Base.prototype.compileLoopReference = function(o, name) { + var src, tmp; + src = tmp = this.compile(o, LEVEL_LIST); + if (!((-Infinity < +src && +src < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { + src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; + } + return [src, tmp]; + }; + + Base.prototype.makeReturn = function(res) { + var me; + me = this.unwrapAll(); + if (res) { + return new Call(new Literal("" + res + ".push"), [me]); + } else { + return new Return(me); + } + }; + + Base.prototype.contains = function(pred) { + var contains; + contains = false; + this.traverseChildren(false, function(node) { + if (pred(node)) { + contains = true; + return false; + } + }); + return contains; + }; + + Base.prototype.containsType = function(type) { + return this instanceof type || this.contains(function(node) { + return node instanceof type; + }); + }; + + Base.prototype.lastNonComment = function(list) { + var i; + i = list.length; + while (i--) { + if (!(list[i] instanceof Comment)) { + return list[i]; + } + } + return null; + }; + + Base.prototype.toString = function(idt, name) { + var tree; + if (idt == null) { + idt = ''; + } + if (name == null) { + name = this.constructor.name; + } + tree = '\n' + idt + name; + if (this.soak) { + tree += '?'; + } + this.eachChild(function(node) { + return tree += node.toString(idt + TAB); + }); + return tree; + }; + + Base.prototype.eachChild = function(func) { + var attr, child, _i, _j, _len, _len1, _ref2, _ref3; + if (!this.children) { + return this; + } + _ref2 = this.children; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + attr = _ref2[_i]; + if (this[attr]) { + _ref3 = flatten([this[attr]]); + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + child = _ref3[_j]; + if (func(child) === false) { + return this; + } + } + } + } + return this; + }; + + Base.prototype.traverseChildren = function(crossScope, func) { + return this.eachChild(function(child) { + if (func(child) === false) { + return false; + } + return child.traverseChildren(crossScope, func); + }); + }; + + Base.prototype.invert = function() { + return new Op('!', this); + }; + + Base.prototype.unwrapAll = function() { + var node; + node = this; + while (node !== (node = node.unwrap())) { + continue; + } + return node; + }; + + Base.prototype.children = []; + + Base.prototype.isStatement = NO; + + Base.prototype.jumps = NO; + + Base.prototype.isComplex = YES; + + Base.prototype.isChainable = NO; + + Base.prototype.isAssignable = NO; + + Base.prototype.unwrap = THIS; + + Base.prototype.unfoldSoak = NO; + + Base.prototype.assigns = NO; + + return Base; + + })(); + + exports.Block = Block = (function(_super) { + + __extends(Block, _super); + + function Block(nodes) { + this.expressions = compact(flatten(nodes || [])); + } + + Block.prototype.children = ['expressions']; + + Block.prototype.push = function(node) { + this.expressions.push(node); + return this; + }; + + Block.prototype.pop = function() { + return this.expressions.pop(); + }; + + Block.prototype.unshift = function(node) { + this.expressions.unshift(node); + return this; + }; + + Block.prototype.unwrap = function() { + if (this.expressions.length === 1) { + return this.expressions[0]; + } else { + return this; + } + }; + + Block.prototype.isEmpty = function() { + return !this.expressions.length; + }; + + Block.prototype.isStatement = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.isStatement(o)) { + return true; + } + } + return false; + }; + + Block.prototype.jumps = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.jumps(o)) { + return exp; + } + } + }; + + Block.prototype.makeReturn = function(res) { + var expr, len; + len = this.expressions.length; + while (len--) { + expr = this.expressions[len]; + if (!(expr instanceof Comment)) { + this.expressions[len] = expr.makeReturn(res); + if (expr instanceof Return && !expr.expression) { + this.expressions.splice(len, 1); + } + break; + } + } + return this; + }; + + Block.prototype.compile = function(o, level) { + if (o == null) { + o = {}; + } + if (o.scope) { + return Block.__super__.compile.call(this, o, level); + } else { + return this.compileRoot(o); + } + }; + + Block.prototype.compileNode = function(o) { + var code, codes, node, top, _i, _len, _ref2; + this.tab = o.indent; + top = o.level === LEVEL_TOP; + codes = []; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; + node = node.unwrapAll(); + node = node.unfoldSoak(o) || node; + if (node instanceof Block) { + codes.push(node.compileNode(o)); + } else if (top) { + node.front = true; + code = node.compile(o); + if (!node.isStatement(o)) { + code = "" + this.tab + code + ";"; + if (node instanceof Literal) { + code = "" + code + "\n"; + } + } + codes.push(code); + } else { + codes.push(node.compile(o, LEVEL_LIST)); + } + } + if (top) { + if (this.spaced) { + return "\n" + (codes.join('\n\n')) + "\n"; + } else { + return codes.join('\n'); + } + } + code = codes.join(', ') || 'void 0'; + if (codes.length > 1 && o.level >= LEVEL_LIST) { + return "(" + code + ")"; + } else { + return code; + } + }; + + Block.prototype.compileRoot = function(o) { + var code, exp, i, prelude, preludeExps, rest; + o.indent = o.bare ? '' : TAB; + o.scope = new Scope(null, this, null); + o.level = LEVEL_TOP; + this.spaced = true; + prelude = ""; + if (!o.bare) { + preludeExps = (function() { + var _i, _len, _ref2, _results; + _ref2 = this.expressions; + _results = []; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; + if (!(exp.unwrap() instanceof Comment)) { + break; + } + _results.push(exp); + } + return _results; + }).call(this); + rest = this.expressions.slice(preludeExps.length); + this.expressions = preludeExps; + if (preludeExps.length) { + prelude = "" + (this.compileNode(merge(o, { + indent: '' + }))) + "\n"; + } + this.expressions = rest; + } + code = this.compileWithDeclarations(o); + if (o.bare) { + return code; + } + return "" + prelude + "(function() {\n" + code + "\n}).call(this);\n"; + }; + + Block.prototype.compileWithDeclarations = function(o) { + var assigns, code, declars, exp, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; + code = post = ''; + _ref2 = this.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; + exp = exp.unwrap(); + if (!(exp instanceof Comment || exp instanceof Literal)) { + break; + } + } + o = merge(o, { + level: LEVEL_TOP + }); + if (i) { + rest = this.expressions.splice(i, 9e9); + _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; + _ref4 = [this.compileNode(o), spaced], code = _ref4[0], this.spaced = _ref4[1]; + this.expressions = rest; + } + post = this.compileNode(o); + scope = o.scope; + if (scope.expressions === this) { + declars = o.scope.hasDeclarations(); + assigns = scope.hasAssignments; + if (declars || assigns) { + if (i) { + code += '\n'; + } + code += "" + this.tab + "var "; + if (declars) { + code += scope.declaredVariables().join(', '); + } + if (assigns) { + if (declars) { + code += ",\n" + (this.tab + TAB); + } + code += scope.assignedVariables().join(",\n" + (this.tab + TAB)); + } + code += ';\n'; + } + } + return code + post; + }; + + Block.wrap = function(nodes) { + if (nodes.length === 1 && nodes[0] instanceof Block) { + return nodes[0]; + } + return new Block(nodes); + }; + + return Block; + + })(Base); + + exports.Literal = Literal = (function(_super) { + + __extends(Literal, _super); + + function Literal(value) { + this.value = value; + } + + Literal.prototype.makeReturn = function() { + if (this.isStatement()) { + return this; + } else { + return Literal.__super__.makeReturn.apply(this, arguments); + } + }; + + Literal.prototype.isAssignable = function() { + return IDENTIFIER.test(this.value); + }; + + Literal.prototype.isStatement = function() { + var _ref2; + return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; + }; + + Literal.prototype.isComplex = NO; + + Literal.prototype.assigns = function(name) { + return name === this.value; + }; + + Literal.prototype.jumps = function(o) { + if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { + return this; + } + if (this.value === 'continue' && !(o != null ? o.loop : void 0)) { + return this; + } + }; + + Literal.prototype.compileNode = function(o) { + var code, _ref2; + code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; + if (this.isStatement()) { + return "" + this.tab + code + ";"; + } else { + return code; + } + }; + + Literal.prototype.toString = function() { + return ' "' + this.value + '"'; + }; + + return Literal; + + })(Base); + + exports.Undefined = (function(_super) { + + __extends(Undefined, _super); + + function Undefined() { + return Undefined.__super__.constructor.apply(this, arguments); + } + + Undefined.prototype.isAssignable = NO; + + Undefined.prototype.isComplex = NO; + + Undefined.prototype.compileNode = function(o) { + if (o.level >= LEVEL_ACCESS) { + return '(void 0)'; + } else { + return 'void 0'; + } + }; + + return Undefined; + + })(Base); + + exports.Null = (function(_super) { + + __extends(Null, _super); + + function Null() { + return Null.__super__.constructor.apply(this, arguments); + } + + Null.prototype.isAssignable = NO; + + Null.prototype.isComplex = NO; + + Null.prototype.compileNode = function() { + return "null"; + }; + + return Null; + + })(Base); + + exports.Bool = (function(_super) { + + __extends(Bool, _super); + + Bool.prototype.isAssignable = NO; + + Bool.prototype.isComplex = NO; + + Bool.prototype.compileNode = function() { + return this.val; + }; + + function Bool(val) { + this.val = val; + } + + return Bool; + + })(Base); + + exports.Return = Return = (function(_super) { + + __extends(Return, _super); + + function Return(expr) { + if (expr && !expr.unwrap().isUndefined) { + this.expression = expr; + } + } + + Return.prototype.children = ['expression']; + + Return.prototype.isStatement = YES; + + Return.prototype.makeReturn = THIS; + + Return.prototype.jumps = THIS; + + Return.prototype.compile = function(o, level) { + var expr, _ref2; + expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; + if (expr && !(expr instanceof Return)) { + return expr.compile(o, level); + } else { + return Return.__super__.compile.call(this, o, level); + } + }; + + Return.prototype.compileNode = function(o) { + return this.tab + ("return" + [this.expression ? " " + (this.expression.compile(o, LEVEL_PAREN)) : void 0] + ";"); + }; + + return Return; + + })(Base); + + exports.Value = Value = (function(_super) { + + __extends(Value, _super); + + function Value(base, props, tag) { + if (!props && base instanceof Value) { + return base; + } + this.base = base; + this.properties = props || []; + if (tag) { + this[tag] = true; + } + return this; + } + + Value.prototype.children = ['base', 'properties']; + + Value.prototype.add = function(props) { + this.properties = this.properties.concat(props); + return this; + }; + + Value.prototype.hasProperties = function() { + return !!this.properties.length; + }; + + Value.prototype.isArray = function() { + return !this.properties.length && this.base instanceof Arr; + }; + + Value.prototype.isComplex = function() { + return this.hasProperties() || this.base.isComplex(); + }; + + Value.prototype.isAssignable = function() { + return this.hasProperties() || this.base.isAssignable(); + }; + + Value.prototype.isSimpleNumber = function() { + return this.base instanceof Literal && SIMPLENUM.test(this.base.value); + }; + + Value.prototype.isString = function() { + return this.base instanceof Literal && IS_STRING.test(this.base.value); + }; + + Value.prototype.isAtomic = function() { + var node, _i, _len, _ref2; + _ref2 = this.properties.concat(this.base); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; + if (node.soak || node instanceof Call) { + return false; + } + } + return true; + }; + + Value.prototype.isStatement = function(o) { + return !this.properties.length && this.base.isStatement(o); + }; + + Value.prototype.assigns = function(name) { + return !this.properties.length && this.base.assigns(name); + }; + + Value.prototype.jumps = function(o) { + return !this.properties.length && this.base.jumps(o); + }; + + Value.prototype.isObject = function(onlyGenerated) { + if (this.properties.length) { + return false; + } + return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); + }; + + Value.prototype.isSplice = function() { + return last(this.properties) instanceof Slice; + }; + + Value.prototype.unwrap = function() { + if (this.properties.length) { + return this; + } else { + return this.base; + } + }; + + Value.prototype.cacheReference = function(o) { + var base, bref, name, nref; + name = last(this.properties); + if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { + return [this, this]; + } + base = new Value(this.base, this.properties.slice(0, -1)); + if (base.isComplex()) { + bref = new Literal(o.scope.freeVariable('base')); + base = new Value(new Parens(new Assign(bref, base))); + } + if (!name) { + return [base, bref]; + } + if (name.isComplex()) { + nref = new Literal(o.scope.freeVariable('name')); + name = new Index(new Assign(nref, name.index)); + nref = new Index(nref); + } + return [base.add(name), new Value(bref || base.base, [nref || name])]; + }; + + Value.prototype.compileNode = function(o) { + var code, prop, props, _i, _len; + this.base.front = this.front; + props = this.properties; + code = this.base.compile(o, props.length ? LEVEL_ACCESS : null); + if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(code)) { + code = "" + code + "."; + } + for (_i = 0, _len = props.length; _i < _len; _i++) { + prop = props[_i]; + code += prop.compile(o); + } + return code; + }; + + Value.prototype.unfoldSoak = function(o) { + var result, + _this = this; + if (this.unfoldedSoak != null) { + return this.unfoldedSoak; + } + result = (function() { + var fst, i, ifn, prop, ref, snd, _i, _len, _ref2; + if (ifn = _this.base.unfoldSoak(o)) { + Array.prototype.push.apply(ifn.body.properties, _this.properties); + return ifn; + } + _ref2 = _this.properties; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + prop = _ref2[i]; + if (!prop.soak) { + continue; + } + prop.soak = false; + fst = new Value(_this.base, _this.properties.slice(0, i)); + snd = new Value(_this.base, _this.properties.slice(i)); + if (fst.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, fst)); + snd.base = ref; + } + return new If(new Existence(fst), snd, { + soak: true + }); + } + return null; + })(); + return this.unfoldedSoak = result || false; + }; + + return Value; + + })(Base); + + exports.Comment = Comment = (function(_super) { + + __extends(Comment, _super); + + function Comment(comment) { + this.comment = comment; + } + + Comment.prototype.isStatement = YES; + + Comment.prototype.makeReturn = THIS; + + Comment.prototype.compileNode = function(o, level) { + var code; + code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/\n"); + if ((level || o.level) === LEVEL_TOP) { + code = o.indent + code; + } + return code; + }; + + return Comment; + + })(Base); + + exports.Call = Call = (function(_super) { + + __extends(Call, _super); + + function Call(variable, args, soak) { + this.args = args != null ? args : []; + this.soak = soak; + this.isNew = false; + this.isSuper = variable === 'super'; + this.variable = this.isSuper ? null : variable; + } + + Call.prototype.children = ['variable', 'args']; + + Call.prototype.newInstance = function() { + var base, _ref2; + base = ((_ref2 = this.variable) != null ? _ref2.base : void 0) || this.variable; + if (base instanceof Call && !base.isNew) { + base.newInstance(); + } else { + this.isNew = true; + } + return this; + }; + + Call.prototype.superReference = function(o) { + var accesses, method, name; + method = o.scope.namedMethod(); + if (!method) { + throw SyntaxError('cannot call super outside of a function.'); + } + name = method.name; + if (name == null) { + throw SyntaxError('cannot call super on an anonymous function.'); + } + if (method.klass) { + accesses = [new Access(new Literal('__super__'))]; + if (method["static"]) { + accesses.push(new Access(new Literal('constructor'))); + } + accesses.push(new Access(new Literal(name))); + return (new Value(new Literal(method.klass), accesses)).compile(o); + } else { + return "" + name + ".__super__.constructor"; + } + }; + + Call.prototype.superThis = function(o) { + var method; + method = o.scope.method; + return (method && !method.klass && method.context) || "this"; + }; + + Call.prototype.unfoldSoak = function(o) { + var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; + if (this.soak) { + if (this.variable) { + if (ifn = unfoldSoak(o, this, 'variable')) { + return ifn; + } + _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; + } else { + left = new Literal(this.superReference(o)); + rite = new Value(left); + } + rite = new Call(rite, this.args); + rite.isNew = this.isNew; + left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); + return new If(left, new Value(rite), { + soak: true + }); + } + call = this; + list = []; + while (true) { + if (call.variable instanceof Call) { + list.push(call); + call = call.variable; + continue; + } + if (!(call.variable instanceof Value)) { + break; + } + list.push(call); + if (!((call = call.variable.base) instanceof Call)) { + break; + } + } + _ref3 = list.reverse(); + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + call = _ref3[_i]; + if (ifn) { + if (call.variable instanceof Call) { + call.variable = ifn; + } else { + call.variable.base = ifn; + } + } + ifn = unfoldSoak(o, call, 'variable'); + } + return ifn; + }; + + Call.prototype.filterImplicitObjects = function(list) { + var node, nodes, obj, prop, properties, _i, _j, _len, _len1, _ref2; + nodes = []; + for (_i = 0, _len = list.length; _i < _len; _i++) { + node = list[_i]; + if (!((typeof node.isObject === "function" ? node.isObject() : void 0) && node.base.generated)) { + nodes.push(node); + continue; + } + obj = null; + _ref2 = node.base.properties; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + prop = _ref2[_j]; + if (prop instanceof Assign || prop instanceof Comment) { + if (!obj) { + nodes.push(obj = new Obj(properties = [], true)); + } + properties.push(prop); + } else { + nodes.push(prop); + obj = null; + } + } + } + return nodes; + }; + + Call.prototype.compileNode = function(o) { + var arg, args, code, _ref2; + if ((_ref2 = this.variable) != null) { + _ref2.front = this.front; + } + if (code = Splat.compileSplattedArray(o, this.args, true)) { + return this.compileSplat(o, code); + } + args = this.filterImplicitObjects(this.args); + args = ((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = args.length; _i < _len; _i++) { + arg = args[_i]; + _results.push(arg.compile(o, LEVEL_LIST)); + } + return _results; + })()).join(', '); + if (this.isSuper) { + return this.superReference(o) + (".call(" + (this.superThis(o)) + (args && ', ' + args) + ")"); + } else { + return (this.isNew ? 'new ' : '') + this.variable.compile(o, LEVEL_ACCESS) + ("(" + args + ")"); + } + }; + + Call.prototype.compileSuper = function(args, o) { + return "" + (this.superReference(o)) + ".call(" + (this.superThis(o)) + (args.length ? ', ' : '') + args + ")"; + }; + + Call.prototype.compileSplat = function(o, splatArgs) { + var base, fun, idt, name, ref; + if (this.isSuper) { + return "" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", " + splatArgs + ")"; + } + if (this.isNew) { + idt = this.tab + TAB; + return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function(){})"; + } + base = new Value(this.variable); + if ((name = base.properties.pop()) && base.isComplex()) { + ref = o.scope.freeVariable('ref'); + fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o)); + } else { + fun = base.compile(o, LEVEL_ACCESS); + if (SIMPLENUM.test(fun)) { + fun = "(" + fun + ")"; + } + if (name) { + ref = fun; + fun += name.compile(o); + } else { + ref = 'null'; + } + } + return "" + fun + ".apply(" + ref + ", " + splatArgs + ")"; + }; + + return Call; + + })(Base); + + exports.Extends = Extends = (function(_super) { + + __extends(Extends, _super); + + function Extends(child, parent) { + this.child = child; + this.parent = parent; + } + + Extends.prototype.children = ['child', 'parent']; + + Extends.prototype.compile = function(o) { + return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o); + }; + + return Extends; + + })(Base); + + exports.Access = Access = (function(_super) { + + __extends(Access, _super); + + function Access(name, tag) { + this.name = name; + this.name.asKey = true; + this.soak = tag === 'soak'; + } + + Access.prototype.children = ['name']; + + Access.prototype.compile = function(o) { + var name; + name = this.name.compile(o); + if (IDENTIFIER.test(name)) { + return "." + name; + } else { + return "[" + name + "]"; + } + }; + + Access.prototype.isComplex = NO; + + return Access; + + })(Base); + + exports.Index = Index = (function(_super) { + + __extends(Index, _super); + + function Index(index) { + this.index = index; + } + + Index.prototype.children = ['index']; + + Index.prototype.compile = function(o) { + return "[" + (this.index.compile(o, LEVEL_PAREN)) + "]"; + }; + + Index.prototype.isComplex = function() { + return this.index.isComplex(); + }; + + return Index; + + })(Base); + + exports.Range = Range = (function(_super) { + + __extends(Range, _super); + + Range.prototype.children = ['from', 'to']; + + function Range(from, to, tag) { + this.from = from; + this.to = to; + this.exclusive = tag === 'exclusive'; + this.equals = this.exclusive ? '' : '='; + } + + Range.prototype.compileVariables = function(o) { + var step, _ref2, _ref3, _ref4, _ref5; + o = merge(o, { + top: true + }); + _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; + _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; + if (step = del(o, 'step')) { + _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; + } + _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; + if (this.stepVar) { + return this.stepNum = this.stepVar.match(SIMPLENUM); + } + }; + + Range.prototype.compileNode = function(o) { + var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref2, _ref3; + if (!this.fromVar) { + this.compileVariables(o); + } + if (!o.index) { + return this.compileArray(o); + } + known = this.fromNum && this.toNum; + idx = del(o, 'index'); + idxName = del(o, 'name'); + namedIndex = idxName && idxName !== idx; + varPart = "" + idx + " = " + this.fromC; + if (this.toC !== this.toVar) { + varPart += ", " + this.toC; + } + if (this.step !== this.stepVar) { + varPart += ", " + this.step; + } + _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; + condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); + stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; + if (namedIndex) { + varPart = "" + idxName + " = " + varPart; + } + if (namedIndex) { + stepPart = "" + idxName + " = " + stepPart; + } + return "" + varPart + "; " + condPart + "; " + stepPart; + }; + + Range.prototype.compileArray = function(o) { + var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; + if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { + range = (function() { + _results = []; + for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } + return _results; + }).apply(this); + if (this.exclusive) { + range.pop(); + } + return "[" + (range.join(', ')) + "]"; + } + idt = this.tab + TAB; + i = o.scope.freeVariable('i'); + result = o.scope.freeVariable('results'); + pre = "\n" + idt + result + " = [];"; + if (this.fromNum && this.toNum) { + o.index = i; + body = this.compileNode(o); + } else { + vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); + cond = "" + this.fromVar + " <= " + this.toVar; + body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; + } + post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; + hasArgs = function(node) { + return node != null ? node.contains(function(n) { + return n instanceof Literal && n.value === 'arguments' && !n.asKey; + }) : void 0; + }; + if (hasArgs(this.from) || hasArgs(this.to)) { + args = ', arguments'; + } + return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")"; + }; + + return Range; + + })(Base); + + exports.Slice = Slice = (function(_super) { + + __extends(Slice, _super); + + Slice.prototype.children = ['range']; + + function Slice(range) { + this.range = range; + Slice.__super__.constructor.call(this); + } + + Slice.prototype.compileNode = function(o) { + var compiled, from, fromStr, to, toStr, _ref2; + _ref2 = this.range, to = _ref2.to, from = _ref2.from; + fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; + compiled = to && to.compile(o, LEVEL_PAREN); + if (to && !(!this.range.exclusive && +compiled === -1)) { + toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? "" + (+compiled + 1) : (compiled = to.compile(o, LEVEL_ACCESS), "+" + compiled + " + 1 || 9e9")); + } + return ".slice(" + fromStr + (toStr || '') + ")"; + }; + + return Slice; + + })(Base); + + exports.Obj = Obj = (function(_super) { + + __extends(Obj, _super); + + function Obj(props, generated) { + this.generated = generated != null ? generated : false; + this.objects = this.properties = props || []; + } + + Obj.prototype.children = ['properties']; + + Obj.prototype.compileNode = function(o) { + var i, idt, indent, join, lastNoncom, node, obj, prop, props, _i, _len; + props = this.properties; + if (!props.length) { + return (this.front ? '({})' : '{}'); + } + if (this.generated) { + for (_i = 0, _len = props.length; _i < _len; _i++) { + node = props[_i]; + if (node instanceof Value) { + throw new Error('cannot have an implicit value in an implicit object'); + } + } + } + idt = o.indent += TAB; + lastNoncom = this.lastNonComment(this.properties); + props = (function() { + var _j, _len1, _results; + _results = []; + for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) { + prop = props[i]; + join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; + indent = prop instanceof Comment ? '' : idt; + if (prop instanceof Value && prop["this"]) { + prop = new Assign(prop.properties[0].name, prop, 'object'); + } + if (!(prop instanceof Comment)) { + if (!(prop instanceof Assign)) { + prop = new Assign(prop, prop, 'object'); + } + (prop.variable.base || prop.variable).asKey = true; + } + _results.push(indent + prop.compile(o, LEVEL_TOP) + join); + } + return _results; + })(); + props = props.join(''); + obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}"; + if (this.front) { + return "(" + obj + ")"; + } else { + return obj; + } + }; + + Obj.prototype.assigns = function(name) { + var prop, _i, _len, _ref2; + _ref2 = this.properties; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + prop = _ref2[_i]; + if (prop.assigns(name)) { + return true; + } + } + return false; + }; + + return Obj; + + })(Base); + + exports.Arr = Arr = (function(_super) { + + __extends(Arr, _super); + + function Arr(objs) { + this.objects = objs || []; + } + + Arr.prototype.children = ['objects']; + + Arr.prototype.filterImplicitObjects = Call.prototype.filterImplicitObjects; + + Arr.prototype.compileNode = function(o) { + var code, obj, objs; + if (!this.objects.length) { + return '[]'; + } + o.indent += TAB; + objs = this.filterImplicitObjects(this.objects); + if (code = Splat.compileSplattedArray(o, objs)) { + return code; + } + code = ((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = objs.length; _i < _len; _i++) { + obj = objs[_i]; + _results.push(obj.compile(o, LEVEL_LIST)); + } + return _results; + })()).join(', '); + if (code.indexOf('\n') >= 0) { + return "[\n" + o.indent + code + "\n" + this.tab + "]"; + } else { + return "[" + code + "]"; + } + }; + + Arr.prototype.assigns = function(name) { + var obj, _i, _len, _ref2; + _ref2 = this.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (obj.assigns(name)) { + return true; + } + } + return false; + }; + + return Arr; + + })(Base); + + exports.Class = Class = (function(_super) { + + __extends(Class, _super); + + function Class(variable, parent, body) { + this.variable = variable; + this.parent = parent; + this.body = body != null ? body : new Block; + this.boundFuncs = []; + this.body.classBody = true; + } + + Class.prototype.children = ['variable', 'parent', 'body']; + + Class.prototype.determineName = function() { + var decl, tail; + if (!this.variable) { + return null; + } + decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; + if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) { + throw SyntaxError("variable name may not be " + decl); + } + return decl && (decl = IDENTIFIER.test(decl) && decl); + }; + + Class.prototype.setContext = function(name) { + return this.body.traverseChildren(false, function(node) { + if (node.classBody) { + return false; + } + if (node instanceof Literal && node.value === 'this') { + return node.value = name; + } else if (node instanceof Code) { + node.klass = name; + if (node.bound) { + return node.context = name; + } + } + }); + }; + + Class.prototype.addBoundFunctions = function(o) { + var bvar, lhs, _i, _len, _ref2, _results; + if (this.boundFuncs.length) { + _ref2 = this.boundFuncs; + _results = []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + bvar = _ref2[_i]; + lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); + _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); + } + return _results; + } + }; + + Class.prototype.addProperties = function(node, name, o) { + var assign, base, exprs, func, props; + props = node.base.properties.slice(0); + exprs = (function() { + var _results; + _results = []; + while (assign = props.shift()) { + if (assign instanceof Assign) { + base = assign.variable.base; + delete assign.context; + func = assign.value; + if (base.value === 'constructor') { + if (this.ctor) { + throw new Error('cannot define more than one constructor in a class'); + } + if (func.bound) { + throw new Error('cannot define a constructor as a bound function'); + } + if (func instanceof Code) { + assign = this.ctor = func; + } else { + this.externalCtor = o.scope.freeVariable('class'); + assign = new Assign(new Literal(this.externalCtor), func); + } + } else { + if (assign.variable["this"]) { + func["static"] = true; + if (func.bound) { + func.context = name; + } + } else { + assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); + if (func instanceof Code && func.bound) { + this.boundFuncs.push(base); + func.bound = false; + } + } + } + } + _results.push(assign); + } + return _results; + }).call(this); + return compact(exprs); + }; + + Class.prototype.walkBody = function(name, o) { + var _this = this; + return this.traverseChildren(false, function(child) { + var exps, i, node, _i, _len, _ref2; + if (child instanceof Class) { + return false; + } + if (child instanceof Block) { + _ref2 = exps = child.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + node = _ref2[i]; + if (node instanceof Value && node.isObject(true)) { + exps[i] = _this.addProperties(node, name, o); + } + } + return child.expressions = exps = flatten(exps); + } + }); + }; + + Class.prototype.hoistDirectivePrologue = function() { + var expressions, index, node; + index = 0; + expressions = this.body.expressions; + while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { + ++index; + } + return this.directives = expressions.splice(0, index); + }; + + Class.prototype.ensureConstructor = function(name) { + if (!this.ctor) { + this.ctor = new Code; + if (this.parent) { + this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); + } + if (this.externalCtor) { + this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); + } + this.ctor.body.makeReturn(); + this.body.expressions.unshift(this.ctor); + } + this.ctor.ctor = this.ctor.name = name; + this.ctor.klass = null; + return this.ctor.noReturn = true; + }; + + Class.prototype.compileNode = function(o) { + var call, decl, klass, lname, name, params, _ref2; + decl = this.determineName(); + name = decl || '_Class'; + if (name.reserved) { + name = "_" + name; + } + lname = new Literal(name); + this.hoistDirectivePrologue(); + this.setContext(name); + this.walkBody(name, o); + this.ensureConstructor(name); + this.body.spaced = true; + if (!(this.ctor instanceof Code)) { + this.body.expressions.unshift(this.ctor); + } + this.body.expressions.push(lname); + (_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives); + this.addBoundFunctions(o); + call = Closure.wrap(this.body); + if (this.parent) { + this.superClass = new Literal(o.scope.freeVariable('super', false)); + this.body.expressions.unshift(new Extends(lname, this.superClass)); + call.args.push(this.parent); + params = call.variable.params || call.variable.base.params; + params.push(new Param(this.superClass)); + } + klass = new Parens(call, true); + if (this.variable) { + klass = new Assign(this.variable, klass); + } + return klass.compile(o); + }; + + return Class; + + })(Base); + + exports.Assign = Assign = (function(_super) { + + __extends(Assign, _super); + + function Assign(variable, value, context, options) { + var forbidden, name, _ref2; + this.variable = variable; + this.value = value; + this.context = context; + this.param = options && options.param; + this.subpattern = options && options.subpattern; + forbidden = (_ref2 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0); + if (forbidden && this.context !== 'object') { + throw SyntaxError("variable name may not be \"" + name + "\""); + } + } + + Assign.prototype.children = ['variable', 'value']; + + Assign.prototype.isStatement = function(o) { + return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; + }; + + Assign.prototype.assigns = function(name) { + return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); + }; + + Assign.prototype.unfoldSoak = function(o) { + return unfoldSoak(o, this, 'variable'); + }; + + Assign.prototype.compileNode = function(o) { + var isValue, match, name, val, varBase, _ref2, _ref3, _ref4, _ref5; + if (isValue = this.variable instanceof Value) { + if (this.variable.isArray() || this.variable.isObject()) { + return this.compilePatternMatch(o); + } + if (this.variable.isSplice()) { + return this.compileSplice(o); + } + if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { + return this.compileConditional(o); + } + } + name = this.variable.compile(o, LEVEL_LIST); + if (!this.context) { + if (!(varBase = this.variable.unwrapAll()).isAssignable()) { + throw SyntaxError("\"" + (this.variable.compile(o)) + "\" cannot be assigned."); + } + if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { + if (this.param) { + o.scope.add(name, 'var'); + } else { + o.scope.find(name); + } + } + } + if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { + if (match[1]) { + this.value.klass = match[1]; + } + this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; + } + val = this.value.compile(o, LEVEL_LIST); + if (this.context === 'object') { + return "" + name + ": " + val; + } + val = name + (" " + (this.context || '=') + " ") + val; + if (o.level <= LEVEL_LIST) { + return val; + } else { + return "(" + val + ")"; + } + }; + + Assign.prototype.compilePatternMatch = function(o) { + var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + top = o.level === LEVEL_TOP; + value = this.value; + objects = this.variable.base.objects; + if (!(olen = objects.length)) { + code = value.compile(o); + if (o.level >= LEVEL_OP) { + return "(" + code + ")"; + } else { + return code; + } + } + isObject = this.variable.isObject(); + if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { + if (obj instanceof Assign) { + _ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value; + } else { + if (obj.base instanceof Parens) { + _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; + } else { + idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); + } + } + acc = IDENTIFIER.test(idx.unwrap().value || 0); + value = new Value(value); + value.properties.push(new (acc ? Access : Index)(idx)); + if (_ref5 = obj.unwrap().value, __indexOf.call(RESERVED, _ref5) >= 0) { + throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o))); + } + return new Assign(obj, value, null, { + param: this.param + }).compile(o, LEVEL_TOP); + } + vvar = value.compile(o, LEVEL_LIST); + assigns = []; + splat = false; + if (!IDENTIFIER.test(vvar) || this.variable.assigns(vvar)) { + assigns.push("" + (ref = o.scope.freeVariable('ref')) + " = " + vvar); + vvar = ref; + } + for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { + obj = objects[i]; + idx = i; + if (isObject) { + if (obj instanceof Assign) { + _ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value; + } else { + if (obj.base instanceof Parens) { + _ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1]; + } else { + idx = obj["this"] ? obj.properties[0].name : obj; + } + } + } + if (!splat && obj instanceof Splat) { + name = obj.name.unwrap().value; + obj = obj.unwrap(); + val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i; + if (rest = olen - i - 1) { + ivar = o.scope.freeVariable('i'); + val += ", " + ivar + " = " + vvar + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; + } else { + val += ") : []"; + } + val = new Literal(val); + splat = "" + ivar + "++"; + } else { + name = obj.unwrap().value; + if (obj instanceof Splat) { + obj = obj.name.compile(o); + throw new SyntaxError("multiple splats are disallowed in an assignment: " + obj + "..."); + } + if (typeof idx === 'number') { + idx = new Literal(splat || idx); + acc = false; + } else { + acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); + } + val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]); + } + if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { + throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (val.compile(o))); + } + assigns.push(new Assign(obj, val, null, { + param: this.param, + subpattern: true + }).compile(o, LEVEL_LIST)); + } + if (!(top || this.subpattern)) { + assigns.push(vvar); + } + code = assigns.join(', '); + if (o.level < LEVEL_LIST) { + return code; + } else { + return "(" + code + ")"; + } + }; + + Assign.prototype.compileConditional = function(o) { + var left, right, _ref2; + _ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1]; + if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { + throw new Error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been defined."); + } + if (__indexOf.call(this.context, "?") >= 0) { + o.isExistentialEquals = true; + } + return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compile(o); + }; + + Assign.prototype.compileSplice = function(o) { + var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; + _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; + name = this.variable.compile(o); + _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; + if (to) { + if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { + to = +to.compile(o) - +fromRef; + if (!exclusive) { + to += 1; + } + } else { + to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; + if (!exclusive) { + to += ' + 1'; + } + } + } else { + to = "9e9"; + } + _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; + code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; + if (o.level > LEVEL_TOP) { + return "(" + code + ")"; + } else { + return code; + } + }; + + return Assign; + + })(Base); + + exports.Code = Code = (function(_super) { + + __extends(Code, _super); + + function Code(params, body, tag) { + this.params = params || []; + this.body = body || new Block; + this.bound = tag === 'boundfunc'; + if (this.bound) { + this.context = '_this'; + } + } + + Code.prototype.children = ['params', 'body']; + + Code.prototype.isStatement = function() { + return !!this.ctor; + }; + + Code.prototype.jumps = NO; + + Code.prototype.compileNode = function(o) { + var code, exprs, i, idt, lit, name, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + o.scope = new Scope(o.scope, this.body, this); + o.scope.shared = del(o, 'sharedScope'); + o.indent += TAB; + delete o.bare; + delete o.isExistentialEquals; + params = []; + exprs = []; + _ref2 = this.paramNames(); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + name = _ref2[_i]; + if (!o.scope.check(name)) { + o.scope.parameter(name); + } + } + _ref3 = this.params; + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + param = _ref3[_j]; + if (!param.splat) { + continue; + } + _ref4 = this.params; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + p = _ref4[_k].name; + if (p["this"]) { + p = p.properties[0].name; + } + if (p.value) { + o.scope.add(p.value, 'var', true); + } + } + splats = new Assign(new Value(new Arr((function() { + var _l, _len3, _ref5, _results; + _ref5 = this.params; + _results = []; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + p = _ref5[_l]; + _results.push(p.asReference(o)); + } + return _results; + }).call(this))), new Value(new Literal('arguments'))); + break; + } + _ref5 = this.params; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + param = _ref5[_l]; + if (param.isComplex()) { + val = ref = param.asReference(o); + if (param.value) { + val = new Op('?', ref, param.value); + } + exprs.push(new Assign(new Value(param.name), val, '=', { + param: true + })); + } else { + ref = param; + if (param.value) { + lit = new Literal(ref.name.value + ' == null'); + val = new Assign(new Value(param.name), param.value, '='); + exprs.push(new If(lit, val)); + } + } + if (!splats) { + params.push(ref); + } + } + wasEmpty = this.body.isEmpty(); + if (splats) { + exprs.unshift(splats); + } + if (exprs.length) { + (_ref6 = this.body.expressions).unshift.apply(_ref6, exprs); + } + for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { + p = params[i]; + o.scope.parameter(params[i] = p.compile(o)); + } + uniqs = []; + _ref7 = this.paramNames(); + for (_n = 0, _len5 = _ref7.length; _n < _len5; _n++) { + name = _ref7[_n]; + if (__indexOf.call(uniqs, name) >= 0) { + throw SyntaxError("multiple parameters named '" + name + "'"); + } + uniqs.push(name); + } + if (!(wasEmpty || this.noReturn)) { + this.body.makeReturn(); + } + if (this.bound) { + if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { + this.bound = this.context = o.scope.parent.method.context; + } else if (!this["static"]) { + o.scope.parent.assign('_this', 'this'); + } + } + idt = o.indent; + code = 'function'; + if (this.ctor) { + code += ' ' + this.name; + } + code += '(' + params.join(', ') + ') {'; + if (!this.body.isEmpty()) { + code += "\n" + (this.body.compileWithDeclarations(o)) + "\n" + this.tab; + } + code += '}'; + if (this.ctor) { + return this.tab + code; + } + if (this.front || (o.level >= LEVEL_ACCESS)) { + return "(" + code + ")"; + } else { + return code; + } + }; + + Code.prototype.paramNames = function() { + var names, param, _i, _len, _ref2; + names = []; + _ref2 = this.params; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; + names.push.apply(names, param.names()); + } + return names; + }; + + Code.prototype.traverseChildren = function(crossScope, func) { + if (crossScope) { + return Code.__super__.traverseChildren.call(this, crossScope, func); + } + }; + + return Code; + + })(Base); + + exports.Param = Param = (function(_super) { + + __extends(Param, _super); + + function Param(name, value, splat) { + var _ref2; + this.name = name; + this.value = value; + this.splat = splat; + if (_ref2 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { + throw SyntaxError("parameter name \"" + name + "\" is not allowed"); + } + } + + Param.prototype.children = ['name', 'value']; + + Param.prototype.compile = function(o) { + return this.name.compile(o, LEVEL_LIST); + }; + + Param.prototype.asReference = function(o) { + var node; + if (this.reference) { + return this.reference; + } + node = this.name; + if (node["this"]) { + node = node.properties[0].name; + if (node.value.reserved) { + node = new Literal(o.scope.freeVariable(node.value)); + } + } else if (node.isComplex()) { + node = new Literal(o.scope.freeVariable('arg')); + } + node = new Value(node); + if (this.splat) { + node = new Splat(node); + } + return this.reference = node; + }; + + Param.prototype.isComplex = function() { + return this.name.isComplex(); + }; + + Param.prototype.names = function(name) { + var atParam, names, obj, _i, _len, _ref2; + if (name == null) { + name = this.name; + } + atParam = function(obj) { + var value; + value = obj.properties[0].name.value; + if (value.reserved) { + return []; + } else { + return [value]; + } + }; + if (name instanceof Literal) { + return [name.value]; + } + if (name instanceof Value) { + return atParam(name); + } + names = []; + _ref2 = name.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (obj instanceof Assign) { + names.push(obj.value.unwrap().value); + } else if (obj instanceof Splat) { + names.push(obj.name.unwrap().value); + } else if (obj instanceof Value) { + if (obj.isArray() || obj.isObject()) { + names.push.apply(names, this.names(obj.base)); + } else if (obj["this"]) { + names.push.apply(names, atParam(obj)); + } else { + names.push(obj.base.value); + } + } else { + throw SyntaxError("illegal parameter " + (obj.compile())); + } + } + return names; + }; + + return Param; + + })(Base); + + exports.Splat = Splat = (function(_super) { + + __extends(Splat, _super); + + Splat.prototype.children = ['name']; + + Splat.prototype.isAssignable = YES; + + function Splat(name) { + this.name = name.compile ? name : new Literal(name); + } + + Splat.prototype.assigns = function(name) { + return this.name.assigns(name); + }; + + Splat.prototype.compile = function(o) { + if (this.index != null) { + return this.compileParam(o); + } else { + return this.name.compile(o); + } + }; + + Splat.prototype.unwrap = function() { + return this.name; + }; + + Splat.compileSplattedArray = function(o, list, apply) { + var args, base, code, i, index, node, _i, _len; + index = -1; + while ((node = list[++index]) && !(node instanceof Splat)) { + continue; + } + if (index >= list.length) { + return ''; + } + if (list.length === 1) { + code = list[0].compile(o, LEVEL_LIST); + if (apply) { + return code; + } + return "" + (utility('slice')) + ".call(" + code + ")"; + } + args = list.slice(index); + for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { + node = args[i]; + code = node.compile(o, LEVEL_LIST); + args[i] = node instanceof Splat ? "" + (utility('slice')) + ".call(" + code + ")" : "[" + code + "]"; + } + if (index === 0) { + return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); + } + base = (function() { + var _j, _len1, _ref2, _results; + _ref2 = list.slice(0, index); + _results = []; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + node = _ref2[_j]; + _results.push(node.compile(o, LEVEL_LIST)); + } + return _results; + })(); + return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")"; + }; + + return Splat; + + })(Base); + + exports.While = While = (function(_super) { + + __extends(While, _super); + + function While(condition, options) { + this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; + this.guard = options != null ? options.guard : void 0; + } + + While.prototype.children = ['condition', 'guard', 'body']; + + While.prototype.isStatement = YES; + + While.prototype.makeReturn = function(res) { + if (res) { + return While.__super__.makeReturn.apply(this, arguments); + } else { + this.returns = !this.jumps({ + loop: true + }); + return this; + } + }; + + While.prototype.addBody = function(body) { + this.body = body; + return this; + }; + + While.prototype.jumps = function() { + var expressions, node, _i, _len; + expressions = this.body.expressions; + if (!expressions.length) { + return false; + } + for (_i = 0, _len = expressions.length; _i < _len; _i++) { + node = expressions[_i]; + if (node.jumps({ + loop: true + })) { + return node; + } + } + return false; + }; + + While.prototype.compileNode = function(o) { + var body, code, rvar, set; + o.indent += TAB; + set = ''; + body = this.body; + if (body.isEmpty()) { + body = ''; + } else { + if (this.returns) { + body.makeReturn(rvar = o.scope.freeVariable('results')); + set = "" + this.tab + rvar + " = [];\n"; + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + body = "\n" + (body.compile(o, LEVEL_TOP)) + "\n" + this.tab; + } + code = set + this.tab + ("while (" + (this.condition.compile(o, LEVEL_PAREN)) + ") {" + body + "}"); + if (this.returns) { + code += "\n" + this.tab + "return " + rvar + ";"; + } + return code; + }; + + return While; + + })(Base); + + exports.Op = Op = (function(_super) { + var CONVERSIONS, INVERSIONS; + + __extends(Op, _super); + + function Op(op, first, second, flip) { + if (op === 'in') { + return new In(first, second); + } + if (op === 'do') { + return this.generateDo(first); + } + if (op === 'new') { + if (first instanceof Call && !first["do"] && !first.isNew) { + return first.newInstance(); + } + if (first instanceof Code && first.bound || first["do"]) { + first = new Parens(first); + } + } + this.operator = CONVERSIONS[op] || op; + this.first = first; + this.second = second; + this.flip = !!flip; + return this; + } + + CONVERSIONS = { + '==': '===', + '!=': '!==', + 'of': 'in' + }; + + INVERSIONS = { + '!==': '===', + '===': '!==' + }; + + Op.prototype.children = ['first', 'second']; + + Op.prototype.isSimpleNumber = NO; + + Op.prototype.isUnary = function() { + return !this.second; + }; + + Op.prototype.isComplex = function() { + var _ref2; + return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); + }; + + Op.prototype.isChainable = function() { + var _ref2; + return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; + }; + + Op.prototype.invert = function() { + var allInvertable, curr, fst, op, _ref2; + if (this.isChainable() && this.first.isChainable()) { + allInvertable = true; + curr = this; + while (curr && curr.operator) { + allInvertable && (allInvertable = curr.operator in INVERSIONS); + curr = curr.first; + } + if (!allInvertable) { + return new Parens(this).invert(); + } + curr = this; + while (curr && curr.operator) { + curr.invert = !curr.invert; + curr.operator = INVERSIONS[curr.operator]; + curr = curr.first; + } + return this; + } else if (op = INVERSIONS[this.operator]) { + this.operator = op; + if (this.first.unwrap() instanceof Op) { + this.first.invert(); + } + return this; + } else if (this.second) { + return new Parens(this).invert(); + } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { + return fst; + } else { + return new Op('!', this); + } + }; + + Op.prototype.unfoldSoak = function(o) { + var _ref2; + return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); + }; + + Op.prototype.generateDo = function(exp) { + var call, func, param, passedParams, ref, _i, _len, _ref2; + passedParams = []; + func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; + _ref2 = func.params || []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; + if (param.value) { + passedParams.push(param.value); + delete param.value; + } else { + passedParams.push(param); + } + } + call = new Call(exp, passedParams); + call["do"] = true; + return call; + }; + + Op.prototype.compileNode = function(o) { + var code, isChain, _ref2, _ref3; + isChain = this.isChainable() && this.first.isChainable(); + if (!isChain) { + this.first.front = this.front; + } + if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { + throw SyntaxError('delete operand may not be argument or var'); + } + if (((_ref2 = this.operator) === '--' || _ref2 === '++') && (_ref3 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0)) { + throw SyntaxError('prefix increment/decrement may not have eval or arguments operand'); + } + if (this.isUnary()) { + return this.compileUnary(o); + } + if (isChain) { + return this.compileChain(o); + } + if (this.operator === '?') { + return this.compileExistence(o); + } + code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP); + if (o.level <= LEVEL_OP) { + return code; + } else { + return "(" + code + ")"; + } + }; + + Op.prototype.compileChain = function(o) { + var code, fst, shared, _ref2; + _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; + fst = this.first.compile(o, LEVEL_OP); + code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); + return "(" + code + ")"; + }; + + Op.prototype.compileExistence = function(o) { + var fst, ref; + if (this.first.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, this.first)); + } else { + fst = this.first; + ref = fst; + } + return new If(new Existence(fst), ref, { + type: 'if' + }).addElse(this.second).compile(o); + }; + + Op.prototype.compileUnary = function(o) { + var op, parts, plusMinus; + if (o.level >= LEVEL_ACCESS) { + return (new Parens(this)).compile(o); + } + parts = [op = this.operator]; + plusMinus = op === '+' || op === '-'; + if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { + parts.push(' '); + } + if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { + this.first = new Parens(this.first); + } + parts.push(this.first.compile(o, LEVEL_OP)); + if (this.flip) { + parts.reverse(); + } + return parts.join(''); + }; + + Op.prototype.toString = function(idt) { + return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); + }; + + return Op; + + })(Base); + + exports.In = In = (function(_super) { + + __extends(In, _super); + + function In(object, array) { + this.object = object; + this.array = array; + } + + In.prototype.children = ['object', 'array']; + + In.prototype.invert = NEGATE; + + In.prototype.compileNode = function(o) { + var hasSplat, obj, _i, _len, _ref2; + if (this.array instanceof Value && this.array.isArray()) { + _ref2 = this.array.base.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (!(obj instanceof Splat)) { + continue; + } + hasSplat = true; + break; + } + if (!hasSplat) { + return this.compileOrTest(o); + } + } + return this.compileLoopTest(o); + }; + + In.prototype.compileOrTest = function(o) { + var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; + if (this.array.base.objects.length === 0) { + return "" + (!!this.negated); + } + _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; + _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; + tests = (function() { + var _i, _len, _ref4, _results; + _ref4 = this.array.base.objects; + _results = []; + for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { + item = _ref4[i]; + _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_ACCESS)); + } + return _results; + }).call(this); + tests = tests.join(cnj); + if (o.level < LEVEL_OP) { + return tests; + } else { + return "(" + tests + ")"; + } + }; + + In.prototype.compileLoopTest = function(o) { + var code, ref, sub, _ref2; + _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; + code = utility('indexOf') + (".call(" + (this.array.compile(o, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); + if (sub === ref) { + return code; + } + code = sub + ', ' + code; + if (o.level < LEVEL_LIST) { + return code; + } else { + return "(" + code + ")"; + } + }; + + In.prototype.toString = function(idt) { + return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); + }; + + return In; + + })(Base); + + exports.Try = Try = (function(_super) { + + __extends(Try, _super); + + function Try(attempt, error, recovery, ensure) { + this.attempt = attempt; + this.error = error; + this.recovery = recovery; + this.ensure = ensure; + } + + Try.prototype.children = ['attempt', 'recovery', 'ensure']; + + Try.prototype.isStatement = YES; + + Try.prototype.jumps = function(o) { + var _ref2; + return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); + }; + + Try.prototype.makeReturn = function(res) { + if (this.attempt) { + this.attempt = this.attempt.makeReturn(res); + } + if (this.recovery) { + this.recovery = this.recovery.makeReturn(res); + } + return this; + }; + + Try.prototype.compileNode = function(o) { + var catchPart, ensurePart, errorPart, tryPart; + o.indent += TAB; + errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; + tryPart = this.attempt.compile(o, LEVEL_TOP); + catchPart = (function() { + var _ref2; + if (this.recovery) { + if (_ref2 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { + throw SyntaxError("catch variable may not be \"" + this.error.value + "\""); + } + if (!o.scope.check(this.error.value)) { + o.scope.add(this.error.value, 'param'); + } + return " catch" + errorPart + "{\n" + (this.recovery.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"; + } else if (!(this.ensure || this.recovery)) { + return ' catch (_error) {}'; + } + }).call(this); + ensurePart = this.ensure ? " finally {\n" + (this.ensure.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" : ''; + return "" + this.tab + "try {\n" + tryPart + "\n" + this.tab + "}" + (catchPart || '') + ensurePart; + }; + + return Try; + + })(Base); + + exports.Throw = Throw = (function(_super) { + + __extends(Throw, _super); + + function Throw(expression) { + this.expression = expression; + } + + Throw.prototype.children = ['expression']; + + Throw.prototype.isStatement = YES; + + Throw.prototype.jumps = NO; + + Throw.prototype.makeReturn = THIS; + + Throw.prototype.compileNode = function(o) { + return this.tab + ("throw " + (this.expression.compile(o)) + ";"); + }; + + return Throw; + + })(Base); + + exports.Existence = Existence = (function(_super) { + + __extends(Existence, _super); + + function Existence(expression) { + this.expression = expression; + } + + Existence.prototype.children = ['expression']; + + Existence.prototype.invert = NEGATE; + + Existence.prototype.compileNode = function(o) { + var cmp, cnj, code, _ref2; + this.expression.front = this.front; + code = this.expression.compile(o, LEVEL_OP); + if (IDENTIFIER.test(code) && !o.scope.check(code)) { + _ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1]; + code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; + } else { + code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; + } + if (o.level <= LEVEL_COND) { + return code; + } else { + return "(" + code + ")"; + } + }; + + return Existence; + + })(Base); + + exports.Parens = Parens = (function(_super) { + + __extends(Parens, _super); + + function Parens(body) { + this.body = body; + } + + Parens.prototype.children = ['body']; + + Parens.prototype.unwrap = function() { + return this.body; + }; + + Parens.prototype.isComplex = function() { + return this.body.isComplex(); + }; + + Parens.prototype.compileNode = function(o) { + var bare, code, expr; + expr = this.body.unwrap(); + if (expr instanceof Value && expr.isAtomic()) { + expr.front = this.front; + return expr.compile(o); + } + code = expr.compile(o, LEVEL_PAREN); + bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); + if (bare) { + return code; + } else { + return "(" + code + ")"; + } + }; + + return Parens; + + })(Base); + + exports.For = For = (function(_super) { + + __extends(For, _super); + + function For(body, source) { + var _ref2; + this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; + this.body = Block.wrap([body]); + this.own = !!source.own; + this.object = !!source.object; + if (this.object) { + _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; + } + if (this.index instanceof Value) { + throw SyntaxError('index cannot be a pattern matching expression'); + } + this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; + this.pattern = this.name instanceof Value; + if (this.range && this.index) { + throw SyntaxError('indexes do not apply to range loops'); + } + if (this.range && this.pattern) { + throw SyntaxError('cannot pattern match over range loops'); + } + this.returns = false; + } + + For.prototype.children = ['body', 'source', 'guard', 'step']; + + For.prototype.compileNode = function(o) { + var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; + body = Block.wrap([this.body]); + lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; + if (lastJumps && lastJumps instanceof Return) { + this.returns = false; + } + source = this.range ? this.source.base : this.source; + scope = o.scope; + name = this.name && this.name.compile(o, LEVEL_LIST); + index = this.index && this.index.compile(o, LEVEL_LIST); + if (name && !this.pattern) { + scope.find(name); + } + if (index) { + scope.find(index); + } + if (this.returns) { + rvar = scope.freeVariable('results'); + } + ivar = (this.object && index) || scope.freeVariable('i'); + kvar = (this.range && name) || index || ivar; + kvarAssign = kvar !== ivar ? "" + kvar + " = " : ""; + if (this.step && !this.range) { + stepvar = scope.freeVariable("step"); + } + if (this.pattern) { + name = ivar; + } + varPart = ''; + guardPart = ''; + defPart = ''; + idt1 = this.tab + TAB; + if (this.range) { + forPart = source.compile(merge(o, { + index: ivar, + name: name, + step: this.step + })); + } else { + svar = this.source.compile(o, LEVEL_LIST); + if ((name || this.own) && !IDENTIFIER.test(svar)) { + defPart = "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; + svar = ref; + } + if (name && !this.pattern) { + namePart = "" + name + " = " + svar + "[" + kvar + "]"; + } + if (!this.object) { + lvar = scope.freeVariable('len'); + forVarPart = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; + if (this.step) { + forVarPart += ", " + stepvar + " = " + (this.step.compile(o, LEVEL_OP)); + } + stepPart = "" + kvarAssign + (this.step ? "" + ivar + " += " + stepvar : (kvar !== ivar ? "++" + ivar : "" + ivar + "++")); + forPart = "" + forVarPart + "; " + ivar + " < " + lvar + "; " + stepPart; + } + } + if (this.returns) { + resultPart = "" + this.tab + rvar + " = [];\n"; + returnResult = "\n" + this.tab + "return " + rvar + ";"; + body.makeReturn(rvar); + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + if (this.pattern) { + body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]"))); + } + defPart += this.pluckDirectCall(o, body); + if (namePart) { + varPart = "\n" + idt1 + namePart + ";"; + } + if (this.object) { + forPart = "" + kvar + " in " + svar; + if (this.own) { + guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; + } + } + body = body.compile(merge(o, { + indent: idt1 + }), LEVEL_TOP); + if (body) { + body = '\n' + body + '\n'; + } + return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); + }; + + For.prototype.pluckDirectCall = function(o, body) { + var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; + defs = ''; + _ref2 = body.expressions; + for (idx = _i = 0, _len = _ref2.length; _i < _len; idx = ++_i) { + expr = _ref2[idx]; + expr = expr.unwrapAll(); + if (!(expr instanceof Call)) { + continue; + } + val = expr.variable.unwrapAll(); + if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { + continue; + } + fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; + ref = new Literal(o.scope.freeVariable('fn')); + base = new Value(ref); + if (val.base) { + _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; + } + body.expressions[idx] = new Call(base, expr.args); + defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; + } + return defs; + }; + + return For; + + })(While); + + exports.Switch = Switch = (function(_super) { + + __extends(Switch, _super); + + function Switch(subject, cases, otherwise) { + this.subject = subject; + this.cases = cases; + this.otherwise = otherwise; + } + + Switch.prototype.children = ['subject', 'cases', 'otherwise']; + + Switch.prototype.isStatement = YES; + + Switch.prototype.jumps = function(o) { + var block, conds, _i, _len, _ref2, _ref3, _ref4; + if (o == null) { + o = { + block: true + }; + } + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; + if (block.jumps(o)) { + return block; + } + } + return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; + }; + + Switch.prototype.makeReturn = function(res) { + var pair, _i, _len, _ref2, _ref3; + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + pair = _ref2[_i]; + pair[1].makeReturn(res); + } + if (res) { + this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); + } + if ((_ref3 = this.otherwise) != null) { + _ref3.makeReturn(res); + } + return this; + }; + + Switch.prototype.compileNode = function(o) { + var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len1, _ref2, _ref3, _ref4, _ref5; + idt1 = o.indent + TAB; + idt2 = o.indent = idt1 + TAB; + code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); + _ref3 = this.cases; + for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { + _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; + _ref5 = flatten([conditions]); + for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { + cond = _ref5[_j]; + if (!this.subject) { + cond = cond.invert(); + } + code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); + } + if (body = block.compile(o, LEVEL_TOP)) { + code += body + '\n'; + } + if (i === this.cases.length - 1 && !this.otherwise) { + break; + } + expr = this.lastNonComment(block.expressions); + if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { + continue; + } + code += idt2 + 'break;\n'; + } + if (this.otherwise && this.otherwise.expressions.length) { + code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); + } + return code + this.tab + '}'; + }; + + return Switch; + + })(Base); + + exports.If = If = (function(_super) { + + __extends(If, _super); + + function If(condition, body, options) { + this.body = body; + if (options == null) { + options = {}; + } + this.condition = options.type === 'unless' ? condition.invert() : condition; + this.elseBody = null; + this.isChain = false; + this.soak = options.soak; + } + + If.prototype.children = ['condition', 'body', 'elseBody']; + + If.prototype.bodyNode = function() { + var _ref2; + return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; + }; + + If.prototype.elseBodyNode = function() { + var _ref2; + return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; + }; + + If.prototype.addElse = function(elseBody) { + if (this.isChain) { + this.elseBodyNode().addElse(elseBody); + } else { + this.isChain = elseBody instanceof If; + this.elseBody = this.ensureBlock(elseBody); + } + return this; + }; + + If.prototype.isStatement = function(o) { + var _ref2; + return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); + }; + + If.prototype.jumps = function(o) { + var _ref2; + return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); + }; + + If.prototype.compileNode = function(o) { + if (this.isStatement(o)) { + return this.compileStatement(o); + } else { + return this.compileExpression(o); + } + }; + + If.prototype.makeReturn = function(res) { + if (res) { + this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); + } + this.body && (this.body = new Block([this.body.makeReturn(res)])); + this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); + return this; + }; + + If.prototype.ensureBlock = function(node) { + if (node instanceof Block) { + return node; + } else { + return new Block([node]); + } + }; + + If.prototype.compileStatement = function(o) { + var body, child, cond, exeq, ifPart; + child = del(o, 'chainChild'); + exeq = del(o, 'isExistentialEquals'); + if (exeq) { + return new If(this.condition.invert(), this.elseBodyNode(), { + type: 'if' + }).compile(o); + } + cond = this.condition.compile(o, LEVEL_PAREN); + o.indent += TAB; + body = this.ensureBlock(this.body); + ifPart = "if (" + cond + ") {\n" + (body.compile(o)) + "\n" + this.tab + "}"; + if (!child) { + ifPart = this.tab + ifPart; + } + if (!this.elseBody) { + return ifPart; + } + return ifPart + ' else ' + (this.isChain ? (o.indent = this.tab, o.chainChild = true, this.elseBody.unwrap().compile(o, LEVEL_TOP)) : "{\n" + (this.elseBody.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"); + }; + + If.prototype.compileExpression = function(o) { + var alt, body, code, cond; + cond = this.condition.compile(o, LEVEL_COND); + body = this.bodyNode().compile(o, LEVEL_LIST); + alt = this.elseBodyNode() ? this.elseBodyNode().compile(o, LEVEL_LIST) : 'void 0'; + code = "" + cond + " ? " + body + " : " + alt; + if (o.level >= LEVEL_COND) { + return "(" + code + ")"; + } else { + return code; + } + }; + + If.prototype.unfoldSoak = function() { + return this.soak && this; + }; + + return If; + + })(Base); + + Closure = { + wrap: function(expressions, statement, noReturn) { + var args, call, func, mentionsArgs, meth; + if (expressions.jumps()) { + return expressions; + } + func = new Code([], Block.wrap([expressions])); + args = []; + if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) { + meth = new Literal(mentionsArgs ? 'apply' : 'call'); + args = [new Literal('this')]; + if (mentionsArgs) { + args.push(new Literal('arguments')); + } + func = new Value(func, [new Access(meth)]); + } + func.noReturn = noReturn; + call = new Call(func, args); + if (statement) { + return Block.wrap([call]); + } else { + return call; + } + }, + literalArgs: function(node) { + return node instanceof Literal && node.value === 'arguments' && !node.asKey; + }, + literalThis: function(node) { + return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper); + } + }; + + unfoldSoak = function(o, parent, name) { + var ifn; + if (!(ifn = parent[name].unfoldSoak(o))) { + return; + } + parent[name] = ifn.body; + ifn.body = new Value(parent); + return ifn; + }; + + UTILITIES = { + "extends": function() { + return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"; + }, + bind: function() { + return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; + }, + indexOf: function() { + return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; + }, + hasProp: function() { + return '{}.hasOwnProperty'; + }, + slice: function() { + return '[].slice'; + } + }; + + LEVEL_TOP = 1; + + LEVEL_PAREN = 2; + + LEVEL_LIST = 3; + + LEVEL_COND = 4; + + LEVEL_OP = 5; + + LEVEL_ACCESS = 6; + + TAB = ' '; + + IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; + + IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); + + SIMPLENUM = /^[+-]?\d+$/; + + METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); + + IS_STRING = /^['"]/; + + utility = function(name) { + var ref; + ref = "__" + name; + Scope.root.assign(ref, UTILITIES[name]()); + return ref; + }; + + multident = function(code, tab) { + code = code.replace(/\n/g, '$&' + tab); + return code.replace(/\s+$/, ''); + }; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js new file mode 100644 index 0000000..d9bab41 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js @@ -0,0 +1,138 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; + + exports.OptionParser = OptionParser = (function() { + + function OptionParser(rules, banner) { + this.banner = banner; + this.rules = buildRules(rules); + } + + OptionParser.prototype.parse = function(args) { + var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref; + options = { + "arguments": [] + }; + skippingArgument = false; + originalArgs = args; + args = normalizeArguments(args); + for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { + arg = args[i]; + if (skippingArgument) { + skippingArgument = false; + continue; + } + if (arg === '--') { + pos = originalArgs.indexOf('--'); + options["arguments"] = options["arguments"].concat(originalArgs.slice(pos + 1)); + break; + } + isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); + seenNonOptionArg = options["arguments"].length > 0; + if (!seenNonOptionArg) { + matchedRule = false; + _ref = this.rules; + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + rule = _ref[_j]; + if (rule.shortFlag === arg || rule.longFlag === arg) { + value = true; + if (rule.hasArgument) { + skippingArgument = true; + value = args[i + 1]; + } + options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; + matchedRule = true; + break; + } + } + if (isOption && !matchedRule) { + throw new Error("unrecognized option: " + arg); + } + } + if (seenNonOptionArg || !isOption) { + options["arguments"].push(arg); + } + } + return options; + }; + + OptionParser.prototype.help = function() { + var letPart, lines, rule, spaces, _i, _len, _ref; + lines = []; + if (this.banner) { + lines.unshift("" + this.banner + "\n"); + } + _ref = this.rules; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + rule = _ref[_i]; + spaces = 15 - rule.longFlag.length; + spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; + letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; + lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); + } + return "\n" + (lines.join('\n')) + "\n"; + }; + + return OptionParser; + + })(); + + LONG_FLAG = /^(--\w[\w\-]*)/; + + SHORT_FLAG = /^(-\w)$/; + + MULTI_FLAG = /^-(\w{2,})/; + + OPTIONAL = /\[(\w+(\*?))\]/; + + buildRules = function(rules) { + var tuple, _i, _len, _results; + _results = []; + for (_i = 0, _len = rules.length; _i < _len; _i++) { + tuple = rules[_i]; + if (tuple.length < 3) { + tuple.unshift(null); + } + _results.push(buildRule.apply(null, tuple)); + } + return _results; + }; + + buildRule = function(shortFlag, longFlag, description, options) { + var match; + if (options == null) { + options = {}; + } + match = longFlag.match(OPTIONAL); + longFlag = longFlag.match(LONG_FLAG)[1]; + return { + name: longFlag.substr(2), + shortFlag: shortFlag, + longFlag: longFlag, + description: description, + hasArgument: !!(match && match[1]), + isList: !!(match && match[2]) + }; + }; + + normalizeArguments = function(args) { + var arg, l, match, result, _i, _j, _len, _len1, _ref; + args = args.slice(0); + result = []; + for (_i = 0, _len = args.length; _i < _len; _i++) { + arg = args[_i]; + if (match = arg.match(MULTI_FLAG)) { + _ref = match[1].split(''); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + l = _ref[_j]; + result.push('-' + l); + } + } else { + result.push(arg); + } + } + return result; + }; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js new file mode 100755 index 0000000..f049903 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js @@ -0,0 +1,683 @@ +/* Jison generated parser */ +var parser = (function(){ +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"Index":69,"INDEX_START":70,"IndexValue":71,"INDEX_END":72,"INDEX_SOAK":73,"Slice":74,"{":75,"AssignList":76,"}":77,"CLASS":78,"EXTENDS":79,"OptFuncExist":80,"Arguments":81,"SUPER":82,"FUNC_EXIST":83,"CALL_START":84,"CALL_END":85,"ArgList":86,"THIS":87,"@":88,"[":89,"]":90,"RangeDots":91,"..":92,"Arg":93,"SimpleArgs":94,"TRY":95,"Catch":96,"FINALLY":97,"CATCH":98,"THROW":99,"(":100,")":101,"WhileSource":102,"WHILE":103,"WHEN":104,"UNTIL":105,"Loop":106,"LOOP":107,"ForBody":108,"FOR":109,"ForStart":110,"ForSource":111,"ForVariables":112,"OWN":113,"ForValue":114,"FORIN":115,"FOROF":116,"BY":117,"SWITCH":118,"Whens":119,"ELSE":120,"When":121,"LEADING_WHEN":122,"IfBlock":123,"IF":124,"POST_IF":125,"UNARY":126,"-":127,"+":128,"--":129,"++":130,"?":131,"MATH":132,"SHIFT":133,"COMPARE":134,"LOGIC":135,"RELATION":136,"COMPOUND_ASSIGN":137,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"}, +productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]], +performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + +var $0 = $$.length - 1; +switch (yystate) { +case 1:return this.$ = new yy.Block; +break; +case 2:return this.$ = $$[$0]; +break; +case 3:return this.$ = $$[$0-1]; +break; +case 4:this.$ = yy.Block.wrap([$$[$0]]); +break; +case 5:this.$ = $$[$0-2].push($$[$0]); +break; +case 6:this.$ = $$[$0-1]; +break; +case 7:this.$ = $$[$0]; +break; +case 8:this.$ = $$[$0]; +break; +case 9:this.$ = $$[$0]; +break; +case 10:this.$ = $$[$0]; +break; +case 11:this.$ = new yy.Literal($$[$0]); +break; +case 12:this.$ = $$[$0]; +break; +case 13:this.$ = $$[$0]; +break; +case 14:this.$ = $$[$0]; +break; +case 15:this.$ = $$[$0]; +break; +case 16:this.$ = $$[$0]; +break; +case 17:this.$ = $$[$0]; +break; +case 18:this.$ = $$[$0]; +break; +case 19:this.$ = $$[$0]; +break; +case 20:this.$ = $$[$0]; +break; +case 21:this.$ = $$[$0]; +break; +case 22:this.$ = $$[$0]; +break; +case 23:this.$ = $$[$0]; +break; +case 24:this.$ = new yy.Block; +break; +case 25:this.$ = $$[$0-1]; +break; +case 26:this.$ = new yy.Literal($$[$0]); +break; +case 27:this.$ = new yy.Literal($$[$0]); +break; +case 28:this.$ = new yy.Literal($$[$0]); +break; +case 29:this.$ = $$[$0]; +break; +case 30:this.$ = new yy.Literal($$[$0]); +break; +case 31:this.$ = new yy.Literal($$[$0]); +break; +case 32:this.$ = new yy.Literal($$[$0]); +break; +case 33:this.$ = new yy.Undefined; +break; +case 34:this.$ = new yy.Null; +break; +case 35:this.$ = new yy.Bool($$[$0]); +break; +case 36:this.$ = new yy.Assign($$[$0-2], $$[$0]); +break; +case 37:this.$ = new yy.Assign($$[$0-3], $$[$0]); +break; +case 38:this.$ = new yy.Assign($$[$0-4], $$[$0-1]); +break; +case 39:this.$ = new yy.Value($$[$0]); +break; +case 40:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object'); +break; +case 41:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object'); +break; +case 42:this.$ = $$[$0]; +break; +case 43:this.$ = $$[$0]; +break; +case 44:this.$ = $$[$0]; +break; +case 45:this.$ = $$[$0]; +break; +case 46:this.$ = new yy.Return($$[$0]); +break; +case 47:this.$ = new yy.Return; +break; +case 48:this.$ = new yy.Comment($$[$0]); +break; +case 49:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]); +break; +case 50:this.$ = new yy.Code([], $$[$0], $$[$0-1]); +break; +case 51:this.$ = 'func'; +break; +case 52:this.$ = 'boundfunc'; +break; +case 53:this.$ = $$[$0]; +break; +case 54:this.$ = $$[$0]; +break; +case 55:this.$ = []; +break; +case 56:this.$ = [$$[$0]]; +break; +case 57:this.$ = $$[$0-2].concat($$[$0]); +break; +case 58:this.$ = $$[$0-3].concat($$[$0]); +break; +case 59:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 60:this.$ = new yy.Param($$[$0]); +break; +case 61:this.$ = new yy.Param($$[$0-1], null, true); +break; +case 62:this.$ = new yy.Param($$[$0-2], $$[$0]); +break; +case 63:this.$ = $$[$0]; +break; +case 64:this.$ = $$[$0]; +break; +case 65:this.$ = $$[$0]; +break; +case 66:this.$ = $$[$0]; +break; +case 67:this.$ = new yy.Splat($$[$0-1]); +break; +case 68:this.$ = new yy.Value($$[$0]); +break; +case 69:this.$ = $$[$0-1].add($$[$0]); +break; +case 70:this.$ = new yy.Value($$[$0-1], [].concat($$[$0])); +break; +case 71:this.$ = $$[$0]; +break; +case 72:this.$ = $$[$0]; +break; +case 73:this.$ = new yy.Value($$[$0]); +break; +case 74:this.$ = new yy.Value($$[$0]); +break; +case 75:this.$ = $$[$0]; +break; +case 76:this.$ = new yy.Value($$[$0]); +break; +case 77:this.$ = new yy.Value($$[$0]); +break; +case 78:this.$ = new yy.Value($$[$0]); +break; +case 79:this.$ = $$[$0]; +break; +case 80:this.$ = new yy.Access($$[$0]); +break; +case 81:this.$ = new yy.Access($$[$0], 'soak'); +break; +case 82:this.$ = [new yy.Access(new yy.Literal('prototype')), new yy.Access($$[$0])]; +break; +case 83:this.$ = new yy.Access(new yy.Literal('prototype')); +break; +case 84:this.$ = $$[$0]; +break; +case 85:this.$ = $$[$0-1]; +break; +case 86:this.$ = yy.extend($$[$0], { + soak: true + }); +break; +case 87:this.$ = new yy.Index($$[$0]); +break; +case 88:this.$ = new yy.Slice($$[$0]); +break; +case 89:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated); +break; +case 90:this.$ = []; +break; +case 91:this.$ = [$$[$0]]; +break; +case 92:this.$ = $$[$0-2].concat($$[$0]); +break; +case 93:this.$ = $$[$0-3].concat($$[$0]); +break; +case 94:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 95:this.$ = new yy.Class; +break; +case 96:this.$ = new yy.Class(null, null, $$[$0]); +break; +case 97:this.$ = new yy.Class(null, $$[$0]); +break; +case 98:this.$ = new yy.Class(null, $$[$0-1], $$[$0]); +break; +case 99:this.$ = new yy.Class($$[$0]); +break; +case 100:this.$ = new yy.Class($$[$0-1], null, $$[$0]); +break; +case 101:this.$ = new yy.Class($$[$0-2], $$[$0]); +break; +case 102:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]); +break; +case 103:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); +break; +case 104:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); +break; +case 105:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]); +break; +case 106:this.$ = new yy.Call('super', $$[$0]); +break; +case 107:this.$ = false; +break; +case 108:this.$ = true; +break; +case 109:this.$ = []; +break; +case 110:this.$ = $$[$0-2]; +break; +case 111:this.$ = new yy.Value(new yy.Literal('this')); +break; +case 112:this.$ = new yy.Value(new yy.Literal('this')); +break; +case 113:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this'); +break; +case 114:this.$ = new yy.Arr([]); +break; +case 115:this.$ = new yy.Arr($$[$0-2]); +break; +case 116:this.$ = 'inclusive'; +break; +case 117:this.$ = 'exclusive'; +break; +case 118:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]); +break; +case 119:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]); +break; +case 120:this.$ = new yy.Range($$[$0-1], null, $$[$0]); +break; +case 121:this.$ = new yy.Range(null, $$[$0], $$[$0-1]); +break; +case 122:this.$ = new yy.Range(null, null, $$[$0]); +break; +case 123:this.$ = [$$[$0]]; +break; +case 124:this.$ = $$[$0-2].concat($$[$0]); +break; +case 125:this.$ = $$[$0-3].concat($$[$0]); +break; +case 126:this.$ = $$[$0-2]; +break; +case 127:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 128:this.$ = $$[$0]; +break; +case 129:this.$ = $$[$0]; +break; +case 130:this.$ = $$[$0]; +break; +case 131:this.$ = [].concat($$[$0-2], $$[$0]); +break; +case 132:this.$ = new yy.Try($$[$0]); +break; +case 133:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]); +break; +case 134:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]); +break; +case 135:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]); +break; +case 136:this.$ = [$$[$0-1], $$[$0]]; +break; +case 137:this.$ = new yy.Throw($$[$0]); +break; +case 138:this.$ = new yy.Parens($$[$0-1]); +break; +case 139:this.$ = new yy.Parens($$[$0-2]); +break; +case 140:this.$ = new yy.While($$[$0]); +break; +case 141:this.$ = new yy.While($$[$0-2], { + guard: $$[$0] + }); +break; +case 142:this.$ = new yy.While($$[$0], { + invert: true + }); +break; +case 143:this.$ = new yy.While($$[$0-2], { + invert: true, + guard: $$[$0] + }); +break; +case 144:this.$ = $$[$0-1].addBody($$[$0]); +break; +case 145:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); +break; +case 146:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); +break; +case 147:this.$ = $$[$0]; +break; +case 148:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]); +break; +case 149:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]])); +break; +case 150:this.$ = new yy.For($$[$0-1], $$[$0]); +break; +case 151:this.$ = new yy.For($$[$0-1], $$[$0]); +break; +case 152:this.$ = new yy.For($$[$0], $$[$0-1]); +break; +case 153:this.$ = { + source: new yy.Value($$[$0]) + }; +break; +case 154:this.$ = (function () { + $$[$0].own = $$[$0-1].own; + $$[$0].name = $$[$0-1][0]; + $$[$0].index = $$[$0-1][1]; + return $$[$0]; + }()); +break; +case 155:this.$ = $$[$0]; +break; +case 156:this.$ = (function () { + $$[$0].own = true; + return $$[$0]; + }()); +break; +case 157:this.$ = $$[$0]; +break; +case 158:this.$ = $$[$0]; +break; +case 159:this.$ = new yy.Value($$[$0]); +break; +case 160:this.$ = new yy.Value($$[$0]); +break; +case 161:this.$ = [$$[$0]]; +break; +case 162:this.$ = [$$[$0-2], $$[$0]]; +break; +case 163:this.$ = { + source: $$[$0] + }; +break; +case 164:this.$ = { + source: $$[$0], + object: true + }; +break; +case 165:this.$ = { + source: $$[$0-2], + guard: $$[$0] + }; +break; +case 166:this.$ = { + source: $$[$0-2], + guard: $$[$0], + object: true + }; +break; +case 167:this.$ = { + source: $$[$0-2], + step: $$[$0] + }; +break; +case 168:this.$ = { + source: $$[$0-4], + guard: $$[$0-2], + step: $$[$0] + }; +break; +case 169:this.$ = { + source: $$[$0-4], + step: $$[$0-2], + guard: $$[$0] + }; +break; +case 170:this.$ = new yy.Switch($$[$0-3], $$[$0-1]); +break; +case 171:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]); +break; +case 172:this.$ = new yy.Switch(null, $$[$0-1]); +break; +case 173:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]); +break; +case 174:this.$ = $$[$0]; +break; +case 175:this.$ = $$[$0-1].concat($$[$0]); +break; +case 176:this.$ = [[$$[$0-1], $$[$0]]]; +break; +case 177:this.$ = [[$$[$0-2], $$[$0-1]]]; +break; +case 178:this.$ = new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + }); +break; +case 179:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + })); +break; +case 180:this.$ = $$[$0]; +break; +case 181:this.$ = $$[$0-2].addElse($$[$0]); +break; +case 182:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { + type: $$[$0-1], + statement: true + }); +break; +case 183:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { + type: $$[$0-1], + statement: true + }); +break; +case 184:this.$ = new yy.Op($$[$0-1], $$[$0]); +break; +case 185:this.$ = new yy.Op('-', $$[$0]); +break; +case 186:this.$ = new yy.Op('+', $$[$0]); +break; +case 187:this.$ = new yy.Op('--', $$[$0]); +break; +case 188:this.$ = new yy.Op('++', $$[$0]); +break; +case 189:this.$ = new yy.Op('--', $$[$0-1], null, true); +break; +case 190:this.$ = new yy.Op('++', $$[$0-1], null, true); +break; +case 191:this.$ = new yy.Existence($$[$0-1]); +break; +case 192:this.$ = new yy.Op('+', $$[$0-2], $$[$0]); +break; +case 193:this.$ = new yy.Op('-', $$[$0-2], $$[$0]); +break; +case 194:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 195:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 196:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 197:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 198:this.$ = (function () { + if ($$[$0-1].charAt(0) === '!') { + return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); + } else { + return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); + } + }()); +break; +case 199:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]); +break; +case 200:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]); +break; +case 201:this.$ = new yy.Extends($$[$0-2], $$[$0]); +break; +} +}, +table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2,20],85:[2,20],90:[2,20],92:[2,20],101:[2,20],103:[2,20],104:[2,20],105:[2,20],109:[2,20],117:[2,20],125:[2,20],127:[2,20],128:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],72:[2,21],77:[2,21],85:[2,21],90:[2,21],92:[2,21],101:[2,21],103:[2,21],104:[2,21],105:[2,21],109:[2,21],117:[2,21],125:[2,21],127:[2,21],128:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],72:[2,22],77:[2,22],85:[2,22],90:[2,22],92:[2,22],101:[2,22],103:[2,22],104:[2,22],105:[2,22],109:[2,22],117:[2,22],125:[2,22],127:[2,22],128:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],72:[2,23],77:[2,23],85:[2,23],90:[2,23],92:[2,23],101:[2,23],103:[2,23],104:[2,23],105:[2,23],109:[2,23],117:[2,23],125:[2,23],127:[2,23],128:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23]},{1:[2,9],6:[2,9],26:[2,9],101:[2,9],103:[2,9],105:[2,9],109:[2,9],125:[2,9]},{1:[2,10],6:[2,10],26:[2,10],101:[2,10],103:[2,10],105:[2,10],109:[2,10],125:[2,10]},{1:[2,11],6:[2,11],26:[2,11],101:[2,11],103:[2,11],105:[2,11],109:[2,11],125:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,103],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],70:[2,75],72:[2,75],73:[2,75],77:[2,75],83:[2,75],84:[2,75],85:[2,75],90:[2,75],92:[2,75],101:[2,75],103:[2,75],104:[2,75],105:[2,75],109:[2,75],117:[2,75],125:[2,75],127:[2,75],128:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],70:[2,76],72:[2,76],73:[2,76],77:[2,76],83:[2,76],84:[2,76],85:[2,76],90:[2,76],92:[2,76],101:[2,76],103:[2,76],104:[2,76],105:[2,76],109:[2,76],117:[2,76],125:[2,76],127:[2,76],128:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],70:[2,77],72:[2,77],73:[2,77],77:[2,77],83:[2,77],84:[2,77],85:[2,77],90:[2,77],92:[2,77],101:[2,77],103:[2,77],104:[2,77],105:[2,77],109:[2,77],117:[2,77],125:[2,77],127:[2,77],128:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],70:[2,78],72:[2,78],73:[2,78],77:[2,78],83:[2,78],84:[2,78],85:[2,78],90:[2,78],92:[2,78],101:[2,78],103:[2,78],104:[2,78],105:[2,78],109:[2,78],117:[2,78],125:[2,78],127:[2,78],128:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],70:[2,79],72:[2,79],73:[2,79],77:[2,79],83:[2,79],84:[2,79],85:[2,79],90:[2,79],92:[2,79],101:[2,79],103:[2,79],104:[2,79],105:[2,79],109:[2,79],117:[2,79],125:[2,79],127:[2,79],128:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],70:[2,105],72:[2,105],73:[2,105],77:[2,105],81:104,83:[2,105],84:[1,105],85:[2,105],90:[2,105],92:[2,105],101:[2,105],103:[2,105],104:[2,105],105:[2,105],109:[2,105],117:[2,105],125:[2,105],127:[2,105],128:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105]},{6:[2,55],25:[2,55],27:109,28:[1,73],44:110,48:106,49:[2,55],54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{5:115,25:[1,5]},{8:116,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:118,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:119,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:120,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:124,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,72],73:[2,72],77:[2,72],79:[1,128],83:[2,72],84:[2,72],85:[2,72],90:[2,72],92:[2,72],101:[2,72],103:[2,72],104:[2,72],105:[2,72],109:[2,72],117:[2,72],125:[2,72],127:[2,72],128:[2,72],129:[1,125],130:[1,126],131:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[1,127]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],72:[2,180],77:[2,180],85:[2,180],90:[2,180],92:[2,180],101:[2,180],103:[2,180],104:[2,180],105:[2,180],109:[2,180],117:[2,180],120:[1,129],125:[2,180],127:[2,180],128:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180]},{5:130,25:[1,5]},{5:131,25:[1,5]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],72:[2,147],77:[2,147],85:[2,147],90:[2,147],92:[2,147],101:[2,147],103:[2,147],104:[2,147],105:[2,147],109:[2,147],117:[2,147],125:[2,147],127:[2,147],128:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147]},{5:132,25:[1,5]},{8:133,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,134],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,95],5:135,6:[2,95],13:121,14:122,25:[1,5],26:[2,95],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,49:[2,95],54:[2,95],57:[2,95],58:47,59:48,61:137,63:25,64:26,65:27,72:[2,95],75:[1,70],77:[2,95],79:[1,136],82:[1,28],85:[2,95],87:[1,58],88:[1,59],89:[1,57],90:[2,95],92:[2,95],100:[1,56],101:[2,95],103:[2,95],104:[2,95],105:[2,95],109:[2,95],117:[2,95],125:[2,95],127:[2,95],128:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95]},{8:138,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,47],6:[2,47],8:139,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,47],102:39,103:[2,47],105:[2,47],106:40,107:[1,67],108:41,109:[2,47],110:69,118:[1,42],123:37,124:[1,64],125:[2,47],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],77:[2,48],101:[2,48],103:[2,48],105:[2,48],109:[2,48],125:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],70:[2,73],72:[2,73],73:[2,73],77:[2,73],83:[2,73],84:[2,73],85:[2,73],90:[2,73],92:[2,73],101:[2,73],103:[2,73],104:[2,73],105:[2,73],109:[2,73],117:[2,73],125:[2,73],127:[2,73],128:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],70:[2,74],72:[2,74],73:[2,74],77:[2,74],83:[2,74],84:[2,74],85:[2,74],90:[2,74],92:[2,74],101:[2,74],103:[2,74],104:[2,74],105:[2,74],109:[2,74],117:[2,74],125:[2,74],127:[2,74],128:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],70:[2,29],72:[2,29],73:[2,29],77:[2,29],83:[2,29],84:[2,29],85:[2,29],90:[2,29],92:[2,29],101:[2,29],103:[2,29],104:[2,29],105:[2,29],109:[2,29],117:[2,29],125:[2,29],127:[2,29],128:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],70:[2,30],72:[2,30],73:[2,30],77:[2,30],83:[2,30],84:[2,30],85:[2,30],90:[2,30],92:[2,30],101:[2,30],103:[2,30],104:[2,30],105:[2,30],109:[2,30],117:[2,30],125:[2,30],127:[2,30],128:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],70:[2,31],72:[2,31],73:[2,31],77:[2,31],83:[2,31],84:[2,31],85:[2,31],90:[2,31],92:[2,31],101:[2,31],103:[2,31],104:[2,31],105:[2,31],109:[2,31],117:[2,31],125:[2,31],127:[2,31],128:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],70:[2,32],72:[2,32],73:[2,32],77:[2,32],83:[2,32],84:[2,32],85:[2,32],90:[2,32],92:[2,32],101:[2,32],103:[2,32],104:[2,32],105:[2,32],109:[2,32],117:[2,32],125:[2,32],127:[2,32],128:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],70:[2,33],72:[2,33],73:[2,33],77:[2,33],83:[2,33],84:[2,33],85:[2,33],90:[2,33],92:[2,33],101:[2,33],103:[2,33],104:[2,33],105:[2,33],109:[2,33],117:[2,33],125:[2,33],127:[2,33],128:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],70:[2,34],72:[2,34],73:[2,34],77:[2,34],83:[2,34],84:[2,34],85:[2,34],90:[2,34],92:[2,34],101:[2,34],103:[2,34],104:[2,34],105:[2,34],109:[2,34],117:[2,34],125:[2,34],127:[2,34],128:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],70:[2,35],72:[2,35],73:[2,35],77:[2,35],83:[2,35],84:[2,35],85:[2,35],90:[2,35],92:[2,35],101:[2,35],103:[2,35],104:[2,35],105:[2,35],109:[2,35],117:[2,35],125:[2,35],127:[2,35],128:[2,35],131:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35]},{4:140,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,141],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:142,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],70:[2,111],72:[2,111],73:[2,111],77:[2,111],83:[2,111],84:[2,111],85:[2,111],90:[2,111],92:[2,111],101:[2,111],103:[2,111],104:[2,111],105:[2,111],109:[2,111],117:[2,111],125:[2,111],127:[2,111],128:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:148,28:[1,73],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],70:[2,112],72:[2,112],73:[2,112],77:[2,112],83:[2,112],84:[2,112],85:[2,112],90:[2,112],92:[2,112],101:[2,112],103:[2,112],104:[2,112],105:[2,112],109:[2,112],117:[2,112],125:[2,112],127:[2,112],128:[2,112],131:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],70:[2,68],72:[2,68],73:[2,68],77:[2,68],79:[2,68],83:[2,68],84:[2,68],85:[2,68],90:[2,68],92:[2,68],101:[2,68],103:[2,68],104:[2,68],105:[2,68],109:[2,68],117:[2,68],125:[2,68],127:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],70:[2,71],72:[2,71],73:[2,71],77:[2,71],79:[2,71],83:[2,71],84:[2,71],85:[2,71],90:[2,71],92:[2,71],101:[2,71],103:[2,71],104:[2,71],105:[2,71],109:[2,71],117:[2,71],125:[2,71],127:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71]},{8:149,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:150,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:151,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:152,8:153,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{27:158,28:[1,73],44:159,58:160,59:161,64:154,75:[1,70],88:[1,113],89:[1,57],112:155,113:[1,156],114:157},{111:162,115:[1,163],116:[1,164]},{6:[2,90],11:168,25:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:165,77:[2,90],88:[1,113]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],70:[2,27],72:[2,27],73:[2,27],77:[2,27],83:[2,27],84:[2,27],85:[2,27],90:[2,27],92:[2,27],101:[2,27],103:[2,27],104:[2,27],105:[2,27],109:[2,27],117:[2,27],125:[2,27],127:[2,27],128:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],70:[2,28],72:[2,28],73:[2,28],77:[2,28],83:[2,28],84:[2,28],85:[2,28],90:[2,28],92:[2,28],101:[2,28],103:[2,28],104:[2,28],105:[2,28],109:[2,28],117:[2,28],125:[2,28],127:[2,28],128:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],70:[2,26],72:[2,26],73:[2,26],77:[2,26],79:[2,26],83:[2,26],84:[2,26],85:[2,26],90:[2,26],92:[2,26],101:[2,26],103:[2,26],104:[2,26],105:[2,26],109:[2,26],115:[2,26],116:[2,26],117:[2,26],125:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,6],6:[2,6],7:172,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,6],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],72:[2,24],77:[2,24],85:[2,24],90:[2,24],92:[2,24],97:[2,24],98:[2,24],101:[2,24],103:[2,24],104:[2,24],105:[2,24],109:[2,24],117:[2,24],120:[2,24],122:[2,24],125:[2,24],127:[2,24],128:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24]},{6:[1,74],26:[1,173]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],72:[2,191],77:[2,191],85:[2,191],90:[2,191],92:[2,191],101:[2,191],103:[2,191],104:[2,191],105:[2,191],109:[2,191],117:[2,191],125:[2,191],127:[2,191],128:[2,191],131:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191]},{8:174,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:175,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:176,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:177,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:178,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:179,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:180,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:181,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],72:[2,146],77:[2,146],85:[2,146],90:[2,146],92:[2,146],101:[2,146],103:[2,146],104:[2,146],105:[2,146],109:[2,146],117:[2,146],125:[2,146],127:[2,146],128:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],72:[2,151],77:[2,151],85:[2,151],90:[2,151],92:[2,151],101:[2,151],103:[2,151],104:[2,151],105:[2,151],109:[2,151],117:[2,151],125:[2,151],127:[2,151],128:[2,151],131:[2,151],132:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151]},{8:182,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],72:[2,145],77:[2,145],85:[2,145],90:[2,145],92:[2,145],101:[2,145],103:[2,145],104:[2,145],105:[2,145],109:[2,145],117:[2,145],125:[2,145],127:[2,145],128:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145],135:[2,145],136:[2,145]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],72:[2,150],77:[2,150],85:[2,150],90:[2,150],92:[2,150],101:[2,150],103:[2,150],104:[2,150],105:[2,150],109:[2,150],117:[2,150],125:[2,150],127:[2,150],128:[2,150],131:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150]},{81:183,84:[1,105]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],70:[2,69],72:[2,69],73:[2,69],77:[2,69],79:[2,69],83:[2,69],84:[2,69],85:[2,69],90:[2,69],92:[2,69],101:[2,69],103:[2,69],104:[2,69],105:[2,69],109:[2,69],117:[2,69],125:[2,69],127:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69]},{84:[2,108]},{27:184,28:[1,73]},{27:185,28:[1,73]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:186,28:[1,73],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],70:[2,83],72:[2,83],73:[2,83],77:[2,83],79:[2,83],83:[2,83],84:[2,83],85:[2,83],90:[2,83],92:[2,83],101:[2,83],103:[2,83],104:[2,83],105:[2,83],109:[2,83],117:[2,83],125:[2,83],127:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],70:[2,84],72:[2,84],73:[2,84],77:[2,84],79:[2,84],83:[2,84],84:[2,84],85:[2,84],90:[2,84],92:[2,84],101:[2,84],103:[2,84],104:[2,84],105:[2,84],109:[2,84],117:[2,84],125:[2,84],127:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84]},{8:188,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],57:[1,192],58:47,59:48,61:36,63:25,64:26,65:27,71:187,74:189,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],91:190,92:[1,191],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{69:193,70:[1,99],73:[1,100]},{81:194,84:[1,105]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],70:[2,70],72:[2,70],73:[2,70],77:[2,70],79:[2,70],83:[2,70],84:[2,70],85:[2,70],90:[2,70],92:[2,70],101:[2,70],103:[2,70],104:[2,70],105:[2,70],109:[2,70],117:[2,70],125:[2,70],127:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70]},{6:[1,196],8:195,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,197],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],70:[2,106],72:[2,106],73:[2,106],77:[2,106],83:[2,106],84:[2,106],85:[2,106],90:[2,106],92:[2,106],101:[2,106],103:[2,106],104:[2,106],105:[2,106],109:[2,106],117:[2,106],125:[2,106],127:[2,106],128:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[1,198],86:199,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],49:[1,201],53:203,54:[1,202]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{6:[2,60],25:[2,60],26:[2,60],40:[1,205],49:[2,60],54:[2,60],57:[1,204]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{6:[2,66],25:[2,66],26:[2,66],40:[2,66],49:[2,66],54:[2,66],57:[2,66]},{27:148,28:[1,73]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,50],6:[2,50],25:[2,50],26:[2,50],49:[2,50],54:[2,50],57:[2,50],72:[2,50],77:[2,50],85:[2,50],90:[2,50],92:[2,50],101:[2,50],103:[2,50],104:[2,50],105:[2,50],109:[2,50],117:[2,50],125:[2,50],127:[2,50],128:[2,50],131:[2,50],132:[2,50],133:[2,50],134:[2,50],135:[2,50],136:[2,50]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],72:[2,184],77:[2,184],85:[2,184],90:[2,184],92:[2,184],101:[2,184],102:87,103:[2,184],104:[2,184],105:[2,184],108:88,109:[2,184],110:69,117:[2,184],125:[2,184],127:[2,184],128:[2,184],131:[1,78],132:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184]},{102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],72:[2,185],77:[2,185],85:[2,185],90:[2,185],92:[2,185],101:[2,185],102:87,103:[2,185],104:[2,185],105:[2,185],108:88,109:[2,185],110:69,117:[2,185],125:[2,185],127:[2,185],128:[2,185],131:[1,78],132:[2,185],133:[2,185],134:[2,185],135:[2,185],136:[2,185]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],72:[2,186],77:[2,186],85:[2,186],90:[2,186],92:[2,186],101:[2,186],102:87,103:[2,186],104:[2,186],105:[2,186],108:88,109:[2,186],110:69,117:[2,186],125:[2,186],127:[2,186],128:[2,186],131:[1,78],132:[2,186],133:[2,186],134:[2,186],135:[2,186],136:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,187],73:[2,72],77:[2,187],83:[2,72],84:[2,72],85:[2,187],90:[2,187],92:[2,187],101:[2,187],103:[2,187],104:[2,187],105:[2,187],109:[2,187],117:[2,187],125:[2,187],127:[2,187],128:[2,187],131:[2,187],132:[2,187],133:[2,187],134:[2,187],135:[2,187],136:[2,187]},{62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:92,83:[1,94],84:[2,107]},{62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:101,83:[1,94],84:[2,107]},{66:[2,75],67:[2,75],68:[2,75],70:[2,75],73:[2,75],83:[2,75],84:[2,75]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,188],73:[2,72],77:[2,188],83:[2,72],84:[2,72],85:[2,188],90:[2,188],92:[2,188],101:[2,188],103:[2,188],104:[2,188],105:[2,188],109:[2,188],117:[2,188],125:[2,188],127:[2,188],128:[2,188],131:[2,188],132:[2,188],133:[2,188],134:[2,188],135:[2,188],136:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],72:[2,189],77:[2,189],85:[2,189],90:[2,189],92:[2,189],101:[2,189],103:[2,189],104:[2,189],105:[2,189],109:[2,189],117:[2,189],125:[2,189],127:[2,189],128:[2,189],131:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],72:[2,190],77:[2,190],85:[2,190],90:[2,190],92:[2,190],101:[2,190],103:[2,190],104:[2,190],105:[2,190],109:[2,190],117:[2,190],125:[2,190],127:[2,190],128:[2,190],131:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190]},{8:206,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,207],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:208,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:209,25:[1,5],124:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],72:[2,132],77:[2,132],85:[2,132],90:[2,132],92:[2,132],96:211,97:[1,212],98:[1,213],101:[2,132],103:[2,132],104:[2,132],105:[2,132],109:[2,132],117:[2,132],125:[2,132],127:[2,132],128:[2,132],131:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],72:[2,144],77:[2,144],85:[2,144],90:[2,144],92:[2,144],101:[2,144],103:[2,144],104:[2,144],105:[2,144],109:[2,144],117:[2,144],125:[2,144],127:[2,144],128:[2,144],131:[2,144],132:[2,144],133:[2,144],134:[2,144],135:[2,144],136:[2,144]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],72:[2,152],77:[2,152],85:[2,152],90:[2,152],92:[2,152],101:[2,152],103:[2,152],104:[2,152],105:[2,152],109:[2,152],117:[2,152],125:[2,152],127:[2,152],128:[2,152],131:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152]},{25:[1,214],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{119:215,121:216,122:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],72:[2,96],77:[2,96],85:[2,96],90:[2,96],92:[2,96],101:[2,96],103:[2,96],104:[2,96],105:[2,96],109:[2,96],117:[2,96],125:[2,96],127:[2,96],128:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96]},{8:218,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,99],5:219,6:[2,99],25:[1,5],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,99],73:[2,72],77:[2,99],79:[1,220],83:[2,72],84:[2,72],85:[2,99],90:[2,99],92:[2,99],101:[2,99],103:[2,99],104:[2,99],105:[2,99],109:[2,99],117:[2,99],125:[2,99],127:[2,99],128:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],72:[2,137],77:[2,137],85:[2,137],90:[2,137],92:[2,137],101:[2,137],102:87,103:[2,137],104:[2,137],105:[2,137],108:88,109:[2,137],110:69,117:[2,137],125:[2,137],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,46],6:[2,46],26:[2,46],101:[2,46],102:87,103:[2,46],105:[2,46],108:88,109:[2,46],110:69,125:[2,46],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,74],101:[1,221]},{4:222,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],90:[2,128],91:223,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],70:[2,114],72:[2,114],73:[2,114],77:[2,114],83:[2,114],84:[2,114],85:[2,114],90:[2,114],92:[2,114],101:[2,114],103:[2,114],104:[2,114],105:[2,114],109:[2,114],115:[2,114],116:[2,114],117:[2,114],125:[2,114],127:[2,114],128:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114]},{6:[2,53],25:[2,53],53:225,54:[1,226],90:[2,53]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],85:[2,123],90:[2,123]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:227,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],85:[2,129],90:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],70:[2,113],72:[2,113],73:[2,113],77:[2,113],79:[2,113],83:[2,113],84:[2,113],85:[2,113],90:[2,113],92:[2,113],101:[2,113],103:[2,113],104:[2,113],105:[2,113],109:[2,113],115:[2,113],116:[2,113],117:[2,113],125:[2,113],127:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113]},{5:228,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],72:[2,140],77:[2,140],85:[2,140],90:[2,140],92:[2,140],101:[2,140],102:87,103:[1,65],104:[1,229],105:[1,66],108:88,109:[1,68],110:69,117:[2,140],125:[2,140],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],72:[2,142],77:[2,142],85:[2,142],90:[2,142],92:[2,142],101:[2,142],102:87,103:[1,65],104:[1,230],105:[1,66],108:88,109:[1,68],110:69,117:[2,142],125:[2,142],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],72:[2,148],77:[2,148],85:[2,148],90:[2,148],92:[2,148],101:[2,148],103:[2,148],104:[2,148],105:[2,148],109:[2,148],117:[2,148],125:[2,148],127:[2,148],128:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],72:[2,149],77:[2,149],85:[2,149],90:[2,149],92:[2,149],101:[2,149],102:87,103:[1,65],104:[2,149],105:[1,66],108:88,109:[1,68],110:69,117:[2,149],125:[2,149],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],72:[2,153],77:[2,153],85:[2,153],90:[2,153],92:[2,153],101:[2,153],103:[2,153],104:[2,153],105:[2,153],109:[2,153],117:[2,153],125:[2,153],127:[2,153],128:[2,153],131:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153]},{115:[2,155],116:[2,155]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],112:231,114:157},{54:[1,232],115:[2,161],116:[2,161]},{54:[2,157],115:[2,157],116:[2,157]},{54:[2,158],115:[2,158],116:[2,158]},{54:[2,159],115:[2,159],116:[2,159]},{54:[2,160],115:[2,160],116:[2,160]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],72:[2,154],77:[2,154],85:[2,154],90:[2,154],92:[2,154],101:[2,154],103:[2,154],104:[2,154],105:[2,154],109:[2,154],117:[2,154],125:[2,154],127:[2,154],128:[2,154],131:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154]},{8:233,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:234,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],53:235,54:[1,236],77:[2,53]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],77:[2,91]},{6:[2,39],25:[2,39],26:[2,39],43:[1,237],54:[2,39],77:[2,39]},{6:[2,42],25:[2,42],26:[2,42],54:[2,42],77:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],77:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],77:[2,44]},{6:[2,45],25:[2,45],26:[2,45],43:[2,45],54:[2,45],77:[2,45]},{1:[2,5],6:[2,5],26:[2,5],101:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],49:[2,25],54:[2,25],57:[2,25],72:[2,25],77:[2,25],85:[2,25],90:[2,25],92:[2,25],97:[2,25],98:[2,25],101:[2,25],103:[2,25],104:[2,25],105:[2,25],109:[2,25],117:[2,25],120:[2,25],122:[2,25],125:[2,25],127:[2,25],128:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],72:[2,192],77:[2,192],85:[2,192],90:[2,192],92:[2,192],101:[2,192],102:87,103:[2,192],104:[2,192],105:[2,192],108:88,109:[2,192],110:69,117:[2,192],125:[2,192],127:[2,192],128:[2,192],131:[1,78],132:[1,81],133:[2,192],134:[2,192],135:[2,192],136:[2,192]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],72:[2,193],77:[2,193],85:[2,193],90:[2,193],92:[2,193],101:[2,193],102:87,103:[2,193],104:[2,193],105:[2,193],108:88,109:[2,193],110:69,117:[2,193],125:[2,193],127:[2,193],128:[2,193],131:[1,78],132:[1,81],133:[2,193],134:[2,193],135:[2,193],136:[2,193]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],72:[2,194],77:[2,194],85:[2,194],90:[2,194],92:[2,194],101:[2,194],102:87,103:[2,194],104:[2,194],105:[2,194],108:88,109:[2,194],110:69,117:[2,194],125:[2,194],127:[2,194],128:[2,194],131:[1,78],132:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],72:[2,195],77:[2,195],85:[2,195],90:[2,195],92:[2,195],101:[2,195],102:87,103:[2,195],104:[2,195],105:[2,195],108:88,109:[2,195],110:69,117:[2,195],125:[2,195],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[2,195],134:[2,195],135:[2,195],136:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],72:[2,196],77:[2,196],85:[2,196],90:[2,196],92:[2,196],101:[2,196],102:87,103:[2,196],104:[2,196],105:[2,196],108:88,109:[2,196],110:69,117:[2,196],125:[2,196],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,196],135:[2,196],136:[1,85]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],72:[2,197],77:[2,197],85:[2,197],90:[2,197],92:[2,197],101:[2,197],102:87,103:[2,197],104:[2,197],105:[2,197],108:88,109:[2,197],110:69,117:[2,197],125:[2,197],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[2,197],136:[1,85]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],72:[2,198],77:[2,198],85:[2,198],90:[2,198],92:[2,198],101:[2,198],102:87,103:[2,198],104:[2,198],105:[2,198],108:88,109:[2,198],110:69,117:[2,198],125:[2,198],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,198],135:[2,198],136:[2,198]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],72:[2,183],77:[2,183],85:[2,183],90:[2,183],92:[2,183],101:[2,183],102:87,103:[1,65],104:[2,183],105:[1,66],108:88,109:[1,68],110:69,117:[2,183],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],72:[2,182],77:[2,182],85:[2,182],90:[2,182],92:[2,182],101:[2,182],102:87,103:[1,65],104:[2,182],105:[1,66],108:88,109:[1,68],110:69,117:[2,182],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],70:[2,103],72:[2,103],73:[2,103],77:[2,103],83:[2,103],84:[2,103],85:[2,103],90:[2,103],92:[2,103],101:[2,103],103:[2,103],104:[2,103],105:[2,103],109:[2,103],117:[2,103],125:[2,103],127:[2,103],128:[2,103],131:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],70:[2,80],72:[2,80],73:[2,80],77:[2,80],79:[2,80],83:[2,80],84:[2,80],85:[2,80],90:[2,80],92:[2,80],101:[2,80],103:[2,80],104:[2,80],105:[2,80],109:[2,80],117:[2,80],125:[2,80],127:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],70:[2,81],72:[2,81],73:[2,81],77:[2,81],79:[2,81],83:[2,81],84:[2,81],85:[2,81],90:[2,81],92:[2,81],101:[2,81],103:[2,81],104:[2,81],105:[2,81],109:[2,81],117:[2,81],125:[2,81],127:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],70:[2,82],72:[2,82],73:[2,82],77:[2,82],79:[2,82],83:[2,82],84:[2,82],85:[2,82],90:[2,82],92:[2,82],101:[2,82],103:[2,82],104:[2,82],105:[2,82],109:[2,82],117:[2,82],125:[2,82],127:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82]},{72:[1,238]},{57:[1,192],72:[2,87],91:239,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{72:[2,88]},{8:240,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,122],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{12:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],72:[2,116],75:[2,116],78:[2,116],82:[2,116],87:[2,116],88:[2,116],89:[2,116],95:[2,116],99:[2,116],100:[2,116],103:[2,116],105:[2,116],107:[2,116],109:[2,116],118:[2,116],124:[2,116],126:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116]},{12:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],72:[2,117],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],70:[2,86],72:[2,86],73:[2,86],77:[2,86],79:[2,86],83:[2,86],84:[2,86],85:[2,86],90:[2,86],92:[2,86],101:[2,86],103:[2,86],104:[2,86],105:[2,86],109:[2,86],117:[2,86],125:[2,86],127:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],70:[2,104],72:[2,104],73:[2,104],77:[2,104],83:[2,104],84:[2,104],85:[2,104],90:[2,104],92:[2,104],101:[2,104],103:[2,104],104:[2,104],105:[2,104],109:[2,104],117:[2,104],125:[2,104],127:[2,104],128:[2,104],131:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],72:[2,36],77:[2,36],85:[2,36],90:[2,36],92:[2,36],101:[2,36],102:87,103:[2,36],104:[2,36],105:[2,36],108:88,109:[2,36],110:69,117:[2,36],125:[2,36],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:241,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:242,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],70:[2,109],72:[2,109],73:[2,109],77:[2,109],83:[2,109],84:[2,109],85:[2,109],90:[2,109],92:[2,109],101:[2,109],103:[2,109],104:[2,109],105:[2,109],109:[2,109],117:[2,109],125:[2,109],127:[2,109],128:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109]},{6:[2,53],25:[2,53],53:243,54:[1,226],85:[2,53]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],85:[2,128],90:[2,128],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{50:245,51:[1,60],52:[1,61]},{6:[2,54],25:[2,54],26:[2,54],27:109,28:[1,73],44:110,55:246,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[1,247],25:[1,248]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61]},{8:249,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],72:[2,199],77:[2,199],85:[2,199],90:[2,199],92:[2,199],101:[2,199],102:87,103:[2,199],104:[2,199],105:[2,199],108:88,109:[2,199],110:69,117:[2,199],125:[2,199],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:250,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],72:[2,201],77:[2,201],85:[2,201],90:[2,201],92:[2,201],101:[2,201],102:87,103:[2,201],104:[2,201],105:[2,201],108:88,109:[2,201],110:69,117:[2,201],125:[2,201],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],72:[2,181],77:[2,181],85:[2,181],90:[2,181],92:[2,181],101:[2,181],103:[2,181],104:[2,181],105:[2,181],109:[2,181],117:[2,181],125:[2,181],127:[2,181],128:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181]},{8:251,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],72:[2,133],77:[2,133],85:[2,133],90:[2,133],92:[2,133],97:[1,252],101:[2,133],103:[2,133],104:[2,133],105:[2,133],109:[2,133],117:[2,133],125:[2,133],127:[2,133],128:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133]},{5:253,25:[1,5]},{27:254,28:[1,73]},{119:255,121:216,122:[1,217]},{26:[1,256],120:[1,257],121:258,122:[1,217]},{26:[2,174],120:[2,174],122:[2,174]},{8:260,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],94:259,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,97],5:261,6:[2,97],25:[1,5],26:[2,97],49:[2,97],54:[2,97],57:[2,97],72:[2,97],77:[2,97],85:[2,97],90:[2,97],92:[2,97],101:[2,97],102:87,103:[1,65],104:[2,97],105:[1,66],108:88,109:[1,68],110:69,117:[2,97],125:[2,97],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],72:[2,100],77:[2,100],85:[2,100],90:[2,100],92:[2,100],101:[2,100],103:[2,100],104:[2,100],105:[2,100],109:[2,100],117:[2,100],125:[2,100],127:[2,100],128:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100]},{8:262,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],66:[2,138],67:[2,138],68:[2,138],70:[2,138],72:[2,138],73:[2,138],77:[2,138],83:[2,138],84:[2,138],85:[2,138],90:[2,138],92:[2,138],101:[2,138],103:[2,138],104:[2,138],105:[2,138],109:[2,138],117:[2,138],125:[2,138],127:[2,138],128:[2,138],131:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138]},{6:[1,74],26:[1,263]},{8:264,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,67],12:[2,117],25:[2,67],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,67],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],90:[2,67],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{6:[1,266],25:[1,267],90:[1,265]},{6:[2,54],8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,54],26:[2,54],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[2,54],87:[1,58],88:[1,59],89:[1,57],90:[2,54],93:268,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],26:[2,53],53:269,54:[1,226]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],49:[2,178],54:[2,178],57:[2,178],72:[2,178],77:[2,178],85:[2,178],90:[2,178],92:[2,178],101:[2,178],103:[2,178],104:[2,178],105:[2,178],109:[2,178],117:[2,178],120:[2,178],125:[2,178],127:[2,178],128:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178],135:[2,178],136:[2,178]},{8:270,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:271,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{115:[2,156],116:[2,156]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],114:272},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],49:[2,163],54:[2,163],57:[2,163],72:[2,163],77:[2,163],85:[2,163],90:[2,163],92:[2,163],101:[2,163],102:87,103:[2,163],104:[1,273],105:[2,163],108:88,109:[2,163],110:69,117:[1,274],125:[2,163],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],49:[2,164],54:[2,164],57:[2,164],72:[2,164],77:[2,164],85:[2,164],90:[2,164],92:[2,164],101:[2,164],102:87,103:[2,164],104:[1,275],105:[2,164],108:88,109:[2,164],110:69,117:[2,164],125:[2,164],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,277],25:[1,278],77:[1,276]},{6:[2,54],11:168,25:[2,54],26:[2,54],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:279,42:167,44:171,46:[1,46],77:[2,54],88:[1,113]},{8:280,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,281],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],70:[2,85],72:[2,85],73:[2,85],77:[2,85],79:[2,85],83:[2,85],84:[2,85],85:[2,85],90:[2,85],92:[2,85],101:[2,85],103:[2,85],104:[2,85],105:[2,85],109:[2,85],117:[2,85],125:[2,85],127:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85]},{8:282,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,120],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,121],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],72:[2,37],77:[2,37],85:[2,37],90:[2,37],92:[2,37],101:[2,37],102:87,103:[2,37],104:[2,37],105:[2,37],108:88,109:[2,37],110:69,117:[2,37],125:[2,37],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,283],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],85:[1,284]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],85:[2,67],90:[2,67]},{5:285,25:[1,5]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{27:109,28:[1,73],44:110,55:286,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,55],25:[2,55],26:[2,55],27:109,28:[1,73],44:110,48:287,54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,288],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:289,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:290,25:[1,5]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],72:[2,134],77:[2,134],85:[2,134],90:[2,134],92:[2,134],101:[2,134],103:[2,134],104:[2,134],105:[2,134],109:[2,134],117:[2,134],125:[2,134],127:[2,134],128:[2,134],131:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134]},{5:291,25:[1,5]},{26:[1,292],120:[1,293],121:258,122:[1,217]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],72:[2,172],77:[2,172],85:[2,172],90:[2,172],92:[2,172],101:[2,172],103:[2,172],104:[2,172],105:[2,172],109:[2,172],117:[2,172],125:[2,172],127:[2,172],128:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172]},{5:294,25:[1,5]},{26:[2,175],120:[2,175],122:[2,175]},{5:295,25:[1,5],54:[1,296]},{25:[2,130],54:[2,130],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],72:[2,98],77:[2,98],85:[2,98],90:[2,98],92:[2,98],101:[2,98],103:[2,98],104:[2,98],105:[2,98],109:[2,98],117:[2,98],125:[2,98],127:[2,98],128:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98]},{1:[2,101],5:297,6:[2,101],25:[1,5],26:[2,101],49:[2,101],54:[2,101],57:[2,101],72:[2,101],77:[2,101],85:[2,101],90:[2,101],92:[2,101],101:[2,101],102:87,103:[1,65],104:[2,101],105:[1,66],108:88,109:[1,68],110:69,117:[2,101],125:[2,101],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{101:[1,298]},{90:[1,299],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],70:[2,115],72:[2,115],73:[2,115],77:[2,115],83:[2,115],84:[2,115],85:[2,115],90:[2,115],92:[2,115],101:[2,115],103:[2,115],104:[2,115],105:[2,115],109:[2,115],115:[2,115],116:[2,115],117:[2,115],125:[2,115],127:[2,115],128:[2,115],131:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],93:300,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:301,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],85:[2,124],90:[2,124]},{6:[1,266],25:[1,267],26:[1,302]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],72:[2,141],77:[2,141],85:[2,141],90:[2,141],92:[2,141],101:[2,141],102:87,103:[1,65],104:[2,141],105:[1,66],108:88,109:[1,68],110:69,117:[2,141],125:[2,141],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],72:[2,143],77:[2,143],85:[2,143],90:[2,143],92:[2,143],101:[2,143],102:87,103:[1,65],104:[2,143],105:[1,66],108:88,109:[1,68],110:69,117:[2,143],125:[2,143],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{115:[2,162],116:[2,162]},{8:303,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:304,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:305,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],70:[2,89],72:[2,89],73:[2,89],77:[2,89],83:[2,89],84:[2,89],85:[2,89],90:[2,89],92:[2,89],101:[2,89],103:[2,89],104:[2,89],105:[2,89],109:[2,89],115:[2,89],116:[2,89],117:[2,89],125:[2,89],127:[2,89],128:[2,89],131:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89]},{11:168,27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:306,42:167,44:171,46:[1,46],88:[1,113]},{6:[2,90],11:168,25:[2,90],26:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:307,88:[1,113]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],77:[2,92]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],77:[2,40],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:308,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,119],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,38],6:[2,38],25:[2,38],26:[2,38],49:[2,38],54:[2,38],57:[2,38],72:[2,38],77:[2,38],85:[2,38],90:[2,38],92:[2,38],101:[2,38],103:[2,38],104:[2,38],105:[2,38],109:[2,38],117:[2,38],125:[2,38],127:[2,38],128:[2,38],131:[2,38],132:[2,38],133:[2,38],134:[2,38],135:[2,38],136:[2,38]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],70:[2,110],72:[2,110],73:[2,110],77:[2,110],83:[2,110],84:[2,110],85:[2,110],90:[2,110],92:[2,110],101:[2,110],103:[2,110],104:[2,110],105:[2,110],109:[2,110],117:[2,110],125:[2,110],127:[2,110],128:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],72:[2,49],77:[2,49],85:[2,49],90:[2,49],92:[2,49],101:[2,49],103:[2,49],104:[2,49],105:[2,49],109:[2,49],117:[2,49],125:[2,49],127:[2,49],128:[2,49],131:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{6:[2,53],25:[2,53],26:[2,53],53:309,54:[1,202]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],72:[2,200],77:[2,200],85:[2,200],90:[2,200],92:[2,200],101:[2,200],103:[2,200],104:[2,200],105:[2,200],109:[2,200],117:[2,200],125:[2,200],127:[2,200],128:[2,200],131:[2,200],132:[2,200],133:[2,200],134:[2,200],135:[2,200],136:[2,200]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],49:[2,179],54:[2,179],57:[2,179],72:[2,179],77:[2,179],85:[2,179],90:[2,179],92:[2,179],101:[2,179],103:[2,179],104:[2,179],105:[2,179],109:[2,179],117:[2,179],120:[2,179],125:[2,179],127:[2,179],128:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179],135:[2,179],136:[2,179]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],72:[2,135],77:[2,135],85:[2,135],90:[2,135],92:[2,135],101:[2,135],103:[2,135],104:[2,135],105:[2,135],109:[2,135],117:[2,135],125:[2,135],127:[2,135],128:[2,135],131:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],72:[2,136],77:[2,136],85:[2,136],90:[2,136],92:[2,136],97:[2,136],101:[2,136],103:[2,136],104:[2,136],105:[2,136],109:[2,136],117:[2,136],125:[2,136],127:[2,136],128:[2,136],131:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],72:[2,170],77:[2,170],85:[2,170],90:[2,170],92:[2,170],101:[2,170],103:[2,170],104:[2,170],105:[2,170],109:[2,170],117:[2,170],125:[2,170],127:[2,170],128:[2,170],131:[2,170],132:[2,170],133:[2,170],134:[2,170],135:[2,170],136:[2,170]},{5:310,25:[1,5]},{26:[1,311]},{6:[1,312],26:[2,176],120:[2,176],122:[2,176]},{8:313,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],72:[2,102],77:[2,102],85:[2,102],90:[2,102],92:[2,102],101:[2,102],103:[2,102],104:[2,102],105:[2,102],109:[2,102],117:[2,102],125:[2,102],127:[2,102],128:[2,102],131:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],66:[2,139],67:[2,139],68:[2,139],70:[2,139],72:[2,139],73:[2,139],77:[2,139],83:[2,139],84:[2,139],85:[2,139],90:[2,139],92:[2,139],101:[2,139],103:[2,139],104:[2,139],105:[2,139],109:[2,139],117:[2,139],125:[2,139],127:[2,139],128:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],70:[2,118],72:[2,118],73:[2,118],77:[2,118],83:[2,118],84:[2,118],85:[2,118],90:[2,118],92:[2,118],101:[2,118],103:[2,118],104:[2,118],105:[2,118],109:[2,118],117:[2,118],125:[2,118],127:[2,118],128:[2,118],131:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],85:[2,125],90:[2,125]},{6:[2,53],25:[2,53],26:[2,53],53:314,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],85:[2,126],90:[2,126]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],72:[2,165],77:[2,165],85:[2,165],90:[2,165],92:[2,165],101:[2,165],102:87,103:[2,165],104:[2,165],105:[2,165],108:88,109:[2,165],110:69,117:[1,315],125:[2,165],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],72:[2,167],77:[2,167],85:[2,167],90:[2,167],92:[2,167],101:[2,167],102:87,103:[2,167],104:[1,316],105:[2,167],108:88,109:[2,167],110:69,117:[2,167],125:[2,167],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],72:[2,166],77:[2,166],85:[2,166],90:[2,166],92:[2,166],101:[2,166],102:87,103:[2,166],104:[2,166],105:[2,166],108:88,109:[2,166],110:69,117:[2,166],125:[2,166],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],77:[2,93]},{6:[2,53],25:[2,53],26:[2,53],53:317,54:[1,236]},{26:[1,318],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,247],25:[1,248],26:[1,319]},{26:[1,320]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],72:[2,173],77:[2,173],85:[2,173],90:[2,173],92:[2,173],101:[2,173],103:[2,173],104:[2,173],105:[2,173],109:[2,173],117:[2,173],125:[2,173],127:[2,173],128:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173]},{26:[2,177],120:[2,177],122:[2,177]},{25:[2,131],54:[2,131],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],26:[1,321]},{8:322,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:323,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[1,277],25:[1,278],26:[1,324]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],77:[2,41]},{6:[2,59],25:[2,59],26:[2,59],49:[2,59],54:[2,59]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],72:[2,171],77:[2,171],85:[2,171],90:[2,171],92:[2,171],101:[2,171],103:[2,171],104:[2,171],105:[2,171],109:[2,171],117:[2,171],125:[2,171],127:[2,171],128:[2,171],131:[2,171],132:[2,171],133:[2,171],134:[2,171],135:[2,171],136:[2,171]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],85:[2,127],90:[2,127]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],72:[2,168],77:[2,168],85:[2,168],90:[2,168],92:[2,168],101:[2,168],102:87,103:[2,168],104:[2,168],105:[2,168],108:88,109:[2,168],110:69,117:[2,168],125:[2,168],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],72:[2,169],77:[2,169],85:[2,169],90:[2,169],92:[2,169],101:[2,169],102:87,103:[2,169],104:[2,169],105:[2,169],108:88,109:[2,169],110:69,117:[2,169],125:[2,169],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],77:[2,94]}], +defaultActions: {60:[2,51],61:[2,52],75:[2,3],94:[2,108],189:[2,88]}, +parseError: function parseError(str, hash) { + throw new Error(str); +}, +parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + + //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + if (typeof this.lexer.yylloc == 'undefined') + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + + if (typeof this.yy.parseError === 'function') + this.parseError = this.yy.parseError; + + function popStack (n) { + stack.length = stack.length - 2*n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || 1; // $end = 1 + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + + var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; + while (true) { + // retreive state number from top of stack + state = stack[stack.length-1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol == null) + symbol = lex(); + // read action for current state and first input + action = table[state] && table[state][symbol]; + } + + // handle parse error + _handle_error: + if (typeof action === 'undefined' || !action.length || !action[0]) { + + if (!recovering) { + // Report error + expected = []; + for (p in table[state]) if (this.terminals_[p] && p > 2) { + expected.push("'"+this.terminals_[p]+"'"); + } + var errStr = ''; + if (this.lexer.showPosition) { + errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; + } else { + errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + + (symbol == 1 /*EOF*/ ? "end of input" : + ("'"+(this.terminals_[symbol] || symbol)+"'")); + } + this.parseError(errStr, + {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + + // just recovered from another error + if (recovering == 3) { + if (symbol == EOF) { + throw new Error(errStr || 'Parsing halted.'); + } + + // discard current lookahead and grab another + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + while (1) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + break; + } + if (state == 0) { + throw new Error(errStr || 'Parsing halted.'); + } + popStack(1); + state = stack[stack.length-1]; + } + + preErrorSymbol = symbol; // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); + } + + switch (action[0]) { + + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution/no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + + case 2: // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length-(len||1)].first_line, + last_line: lstack[lstack.length-1].last_line, + first_column: lstack[lstack.length-(len||1)].first_column, + last_column: lstack[lstack.length-1].last_column + }; + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + + if (typeof r !== 'undefined') { + return r; + } + + // pop off stack + if (len) { + stack = stack.slice(0,-1*len*2); + vstack = vstack.slice(0, -1*len); + lstack = lstack.slice(0, -1*len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length-2]][stack[stack.length-1]]; + stack.push(newState); + break; + + case 3: // accept + return true; + } + + } + + return true; +}}; +undefined +return parser; +})(); +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); } +exports.main = function commonjsMain(args) { + if (!args[1]) + throw new Error('Usage: '+args[0]+' FILE'); + if (typeof process !== 'undefined') { + var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); + } else { + var cwd = require("file").path(require("file").cwd()); + var source = cwd.join(args[1]).read({charset: "utf-8"}); + } + return exports.parser.parse(source); +} +if (typeof module !== 'undefined' && require.main === module) { + exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); +} +} \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js new file mode 100644 index 0000000..578dc59 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js @@ -0,0 +1,276 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + stdin = process.openStdin(); + + stdout = process.stdout; + + CoffeeScript = require('./coffee-script'); + + readline = require('readline'); + + inspect = require('util').inspect; + + Script = require('vm').Script; + + Module = require('module'); + + REPL_PROMPT = 'coffee> '; + + REPL_PROMPT_MULTILINE = '------> '; + + REPL_PROMPT_CONTINUATION = '......> '; + + enableColours = false; + + if (process.platform !== 'win32') { + enableColours = !process.env.NODE_DISABLE_COLORS; + } + + error = function(err) { + return stdout.write((err.stack || err.toString()) + '\n'); + }; + + ACCESSOR = /\s*([\w\.]+)(?:\.(\w*))$/; + + SIMPLEVAR = /(\w+)$/i; + + autocomplete = function(text) { + return completeAttribute(text) || completeVariable(text) || [[], text]; + }; + + completeAttribute = function(text) { + var all, candidates, completions, key, match, obj, prefix, _i, _len, _ref; + if (match = text.match(ACCESSOR)) { + all = match[0], obj = match[1], prefix = match[2]; + try { + obj = Script.runInThisContext(obj); + } catch (e) { + return; + } + if (obj == null) { + return; + } + obj = Object(obj); + candidates = Object.getOwnPropertyNames(obj); + while (obj = Object.getPrototypeOf(obj)) { + _ref = Object.getOwnPropertyNames(obj); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + key = _ref[_i]; + if (__indexOf.call(candidates, key) < 0) { + candidates.push(key); + } + } + } + completions = getCompletions(prefix, candidates); + return [completions, prefix]; + } + }; + + completeVariable = function(text) { + var candidates, completions, free, key, keywords, r, vars, _i, _len, _ref; + free = (_ref = text.match(SIMPLEVAR)) != null ? _ref[1] : void 0; + if (text === "") { + free = ""; + } + if (free != null) { + vars = Script.runInThisContext('Object.getOwnPropertyNames(Object(this))'); + keywords = (function() { + var _i, _len, _ref1, _results; + _ref1 = CoffeeScript.RESERVED; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + r = _ref1[_i]; + if (r.slice(0, 2) !== '__') { + _results.push(r); + } + } + return _results; + })(); + candidates = vars; + for (_i = 0, _len = keywords.length; _i < _len; _i++) { + key = keywords[_i]; + if (__indexOf.call(candidates, key) < 0) { + candidates.push(key); + } + } + completions = getCompletions(free, candidates); + return [completions, free]; + } + }; + + getCompletions = function(prefix, candidates) { + var el, _i, _len, _results; + _results = []; + for (_i = 0, _len = candidates.length; _i < _len; _i++) { + el = candidates[_i]; + if (0 === el.indexOf(prefix)) { + _results.push(el); + } + } + return _results; + }; + + process.on('uncaughtException', error); + + backlog = ''; + + run = function(buffer) { + var code, returnValue, _; + buffer = buffer.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, "$1$2$3"); + buffer = buffer.replace(/[\r\n]+$/, ""); + if (multilineMode) { + backlog += "" + buffer + "\n"; + repl.setPrompt(REPL_PROMPT_CONTINUATION); + repl.prompt(); + return; + } + if (!buffer.toString().trim() && !backlog) { + repl.prompt(); + return; + } + code = backlog += buffer; + if (code[code.length - 1] === '\\') { + backlog = "" + backlog.slice(0, -1) + "\n"; + repl.setPrompt(REPL_PROMPT_CONTINUATION); + repl.prompt(); + return; + } + repl.setPrompt(REPL_PROMPT); + backlog = ''; + try { + _ = global._; + returnValue = CoffeeScript["eval"]("_=(" + code + "\n)", { + filename: 'repl', + modulename: 'repl' + }); + if (returnValue === void 0) { + global._ = _; + } + repl.output.write("" + (inspect(returnValue, false, 2, enableColours)) + "\n"); + } catch (err) { + error(err); + } + return repl.prompt(); + }; + + if (stdin.readable && stdin.isRaw) { + pipedInput = ''; + repl = { + prompt: function() { + return stdout.write(this._prompt); + }, + setPrompt: function(p) { + return this._prompt = p; + }, + input: stdin, + output: stdout, + on: function() {} + }; + stdin.on('data', function(chunk) { + var line, lines, _i, _len, _ref; + pipedInput += chunk; + if (!/\n/.test(pipedInput)) { + return; + } + lines = pipedInput.split("\n"); + pipedInput = lines[lines.length - 1]; + _ref = lines.slice(0, -1); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + line = _ref[_i]; + if (!(line)) { + continue; + } + stdout.write("" + line + "\n"); + run(line); + } + }); + stdin.on('end', function() { + var line, _i, _len, _ref; + _ref = pipedInput.trim().split("\n"); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + line = _ref[_i]; + if (!(line)) { + continue; + } + stdout.write("" + line + "\n"); + run(line); + } + stdout.write('\n'); + return process.exit(0); + }); + } else { + if (readline.createInterface.length < 3) { + repl = readline.createInterface(stdin, autocomplete); + stdin.on('data', function(buffer) { + return repl.write(buffer); + }); + } else { + repl = readline.createInterface(stdin, stdout, autocomplete); + } + } + + multilineMode = false; + + repl.input.on('keypress', function(char, key) { + var cursorPos, newPrompt; + if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { + return; + } + cursorPos = repl.cursor; + repl.output.cursorTo(0); + repl.output.clearLine(1); + multilineMode = !multilineMode; + if (!multilineMode && backlog) { + repl._line(); + } + backlog = ''; + repl.setPrompt((newPrompt = multilineMode ? REPL_PROMPT_MULTILINE : REPL_PROMPT)); + repl.prompt(); + return repl.output.cursorTo(newPrompt.length + (repl.cursor = cursorPos)); + }); + + repl.input.on('keypress', function(char, key) { + if (!(multilineMode && repl.line)) { + return; + } + if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'd')) { + return; + } + multilineMode = false; + return repl._line(); + }); + + repl.on('attemptClose', function() { + if (multilineMode) { + multilineMode = false; + repl.output.cursorTo(0); + repl.output.clearLine(1); + repl._onLine(repl.line); + return; + } + if (backlog || repl.line) { + backlog = ''; + repl.historyIndex = -1; + repl.setPrompt(REPL_PROMPT); + repl.output.write('\n(^C again to quit)'); + return repl._line((repl.line = '')); + } else { + return repl.close(); + } + }); + + repl.on('close', function() { + repl.output.write('\n'); + return repl.input.destroy(); + }); + + repl.on('line', run); + + repl.setPrompt(REPL_PROMPT); + + repl.prompt(); + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js new file mode 100644 index 0000000..fdfeffc --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js @@ -0,0 +1,349 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + exports.Rewriter = (function() { + + function Rewriter() {} + + Rewriter.prototype.rewrite = function(tokens) { + this.tokens = tokens; + this.removeLeadingNewlines(); + this.removeMidExpressionNewlines(); + this.closeOpenCalls(); + this.closeOpenIndexes(); + this.addImplicitIndentation(); + this.tagPostfixConditionals(); + this.addImplicitBraces(); + this.addImplicitParentheses(); + return this.tokens; + }; + + Rewriter.prototype.scanTokens = function(block) { + var i, token, tokens; + tokens = this.tokens; + i = 0; + while (token = tokens[i]) { + i += block.call(this, token, i, tokens); + } + return true; + }; + + Rewriter.prototype.detectEnd = function(i, condition, action) { + var levels, token, tokens, _ref, _ref1; + tokens = this.tokens; + levels = 0; + while (token = tokens[i]) { + if (levels === 0 && condition.call(this, token, i)) { + return action.call(this, token, i); + } + if (!token || levels < 0) { + return action.call(this, token, i - 1); + } + if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { + levels += 1; + } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { + levels -= 1; + } + i += 1; + } + return i - 1; + }; + + Rewriter.prototype.removeLeadingNewlines = function() { + var i, tag, _i, _len, _ref; + _ref = this.tokens; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + tag = _ref[i][0]; + if (tag !== 'TERMINATOR') { + break; + } + } + if (i) { + return this.tokens.splice(0, i); + } + }; + + Rewriter.prototype.removeMidExpressionNewlines = function() { + return this.scanTokens(function(token, i, tokens) { + var _ref; + if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { + return 1; + } + tokens.splice(i, 1); + return 0; + }); + }; + + Rewriter.prototype.closeOpenCalls = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; + }; + action = function(token, i) { + return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'CALL_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.closeOpenIndexes = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; + }; + action = function(token, i) { + return token[0] = 'INDEX_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'INDEX_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.addImplicitBraces = function() { + var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine; + stack = []; + start = null; + startsLine = null; + sameLine = true; + startIndent = 0; + startIndex = 0; + condition = function(token, i) { + var one, tag, three, two, _ref, _ref1; + _ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; + if ('HERECOMMENT' === (one != null ? one[0] : void 0)) { + return false; + } + tag = token[0]; + if (__indexOf.call(LINEBREAKS, tag) >= 0) { + sameLine = false; + } + return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT')); + }; + action = function(token, i) { + var tok; + tok = this.generate('}', '}', token[2]); + return this.tokens.splice(i, 0, tok); + }; + return this.scanTokens(function(token, i, tokens) { + var ago, idx, prevTag, tag, tok, value, _ref, _ref1; + if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { + stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); + return 1; + } + if (__indexOf.call(EXPRESSION_END, tag) >= 0) { + start = stack.pop(); + return 1; + } + if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref1 = stack[stack.length - 1]) != null ? _ref1[0] : void 0) !== '{'))) { + return 1; + } + sameLine = true; + startIndex = i + 1; + stack.push(['{']); + idx = ago === '@' ? i - 2 : i - 1; + while (this.tag(idx - 2) === 'HERECOMMENT') { + idx -= 2; + } + prevTag = this.tag(idx - 1); + startsLine = !prevTag || (__indexOf.call(LINEBREAKS, prevTag) >= 0); + value = new String('{'); + value.generated = true; + tok = this.generate('{', value, token[2]); + tokens.splice(idx, 0, tok); + this.detectEnd(i + 2, condition, action); + return 2; + }); + }; + + Rewriter.prototype.addImplicitParentheses = function() { + var action, condition, noCall, seenControl, seenSingle; + noCall = seenSingle = seenControl = false; + condition = function(token, i) { + var post, tag, _ref, _ref1; + tag = token[0]; + if (!seenSingle && token.fromThen) { + return true; + } + if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') { + seenSingle = true; + } + if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') { + seenControl = true; + } + if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { + return true; + } + return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); + }; + action = function(token, i) { + return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2])); + }; + return this.scanTokens(function(token, i, tokens) { + var callObject, current, next, prev, tag, _ref, _ref1, _ref2; + tag = token[0]; + if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') { + noCall = true; + } + _ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; + callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0); + seenSingle = false; + seenControl = false; + if (__indexOf.call(LINEBREAKS, tag) >= 0) { + noCall = false; + } + if (prev && !prev.spaced && tag === '?') { + token.call = true; + } + if (token.fromThen) { + return 1; + } + if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { + return 1; + } + tokens.splice(i, 0, this.generate('CALL_START', '(', token[2])); + this.detectEnd(i + 1, condition, action); + if (prev[0] === '?') { + prev[0] = 'FUNC_EXIST'; + } + return 2; + }); + }; + + Rewriter.prototype.addImplicitIndentation = function() { + var action, condition, indent, outdent, starter; + starter = indent = outdent = null; + condition = function(token, i) { + var _ref; + return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); + }; + action = function(token, i) { + return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); + }; + return this.scanTokens(function(token, i, tokens) { + var tag, _ref, _ref1; + tag = token[0]; + if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { + tokens.splice(i, 1); + return 0; + } + if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { + tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token)))); + return 2; + } + if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { + tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token)))); + return 4; + } + if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { + starter = tag; + _ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1]; + if (starter === 'THEN') { + indent.fromThen = true; + } + tokens.splice(i + 1, 0, indent); + this.detectEnd(i + 2, condition, action); + if (tag === 'THEN') { + tokens.splice(i, 1); + } + return 1; + } + return 1; + }); + }; + + Rewriter.prototype.tagPostfixConditionals = function() { + var action, condition, original; + original = null; + condition = function(token, i) { + var _ref; + return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT'; + }; + action = function(token, i) { + if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { + return original[0] = 'POST_' + original[0]; + } + }; + return this.scanTokens(function(token, i) { + if (token[0] !== 'IF') { + return 1; + } + original = token; + this.detectEnd(i + 1, condition, action); + return 1; + }); + }; + + Rewriter.prototype.indentation = function(token, implicit) { + var indent, outdent; + if (implicit == null) { + implicit = false; + } + indent = ['INDENT', 2, token[2]]; + outdent = ['OUTDENT', 2, token[2]]; + if (implicit) { + indent.generated = outdent.generated = true; + } + return [indent, outdent]; + }; + + Rewriter.prototype.generate = function(tag, value, line) { + var tok; + tok = [tag, value, line]; + tok.generated = true; + return tok; + }; + + Rewriter.prototype.tag = function(i) { + var _ref; + return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; + }; + + return Rewriter; + + })(); + + BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; + + exports.INVERSES = INVERSES = {}; + + EXPRESSION_START = []; + + EXPRESSION_END = []; + + for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { + _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; + EXPRESSION_START.push(INVERSES[rite] = left); + EXPRESSION_END.push(INVERSES[left] = rite); + } + + EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); + + IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; + + IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++']; + + IMPLICIT_UNSPACED_CALL = ['+', '-']; + + IMPLICIT_BLOCK = ['->', '=>', '{', '[', ',']; + + IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; + + SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; + + SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; + + LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js new file mode 100644 index 0000000..3f35dbf --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js @@ -0,0 +1,146 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var Scope, extend, last, _ref; + + _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; + + exports.Scope = Scope = (function() { + + Scope.root = null; + + function Scope(parent, expressions, method) { + this.parent = parent; + this.expressions = expressions; + this.method = method; + this.variables = [ + { + name: 'arguments', + type: 'arguments' + } + ]; + this.positions = {}; + if (!this.parent) { + Scope.root = this; + } + } + + Scope.prototype.add = function(name, type, immediate) { + if (this.shared && !immediate) { + return this.parent.add(name, type, immediate); + } + if (Object.prototype.hasOwnProperty.call(this.positions, name)) { + return this.variables[this.positions[name]].type = type; + } else { + return this.positions[name] = this.variables.push({ + name: name, + type: type + }) - 1; + } + }; + + Scope.prototype.namedMethod = function() { + if (this.method.name || !this.parent) { + return this.method; + } + return this.parent.namedMethod(); + }; + + Scope.prototype.find = function(name) { + if (this.check(name)) { + return true; + } + this.add(name, 'var'); + return false; + }; + + Scope.prototype.parameter = function(name) { + if (this.shared && this.parent.check(name, true)) { + return; + } + return this.add(name, 'param'); + }; + + Scope.prototype.check = function(name) { + var _ref1; + return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); + }; + + Scope.prototype.temporary = function(name, index) { + if (name.length > 1) { + return '_' + name + (index > 1 ? index - 1 : ''); + } else { + return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); + } + }; + + Scope.prototype.type = function(name) { + var v, _i, _len, _ref1; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.name === name) { + return v.type; + } + } + return null; + }; + + Scope.prototype.freeVariable = function(name, reserve) { + var index, temp; + if (reserve == null) { + reserve = true; + } + index = 0; + while (this.check((temp = this.temporary(name, index)))) { + index++; + } + if (reserve) { + this.add(temp, 'var', true); + } + return temp; + }; + + Scope.prototype.assign = function(name, value) { + this.add(name, { + value: value, + assigned: true + }, true); + return this.hasAssignments = true; + }; + + Scope.prototype.hasDeclarations = function() { + return !!this.declaredVariables().length; + }; + + Scope.prototype.declaredVariables = function() { + var realVars, tempVars, v, _i, _len, _ref1; + realVars = []; + tempVars = []; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type === 'var') { + (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); + } + } + return realVars.sort().concat(tempVars.sort()); + }; + + Scope.prototype.assignedVariables = function() { + var v, _i, _len, _ref1, _results; + _ref1 = this.variables; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type.assigned) { + _results.push("" + v.name + " = " + v.type.value); + } + } + return _results; + }; + + return Scope; + + })(); + +}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/package.json b/node_modules/jade/node_modules/coffee-script/package.json new file mode 100644 index 0000000..849e1f6 --- /dev/null +++ b/node_modules/jade/node_modules/coffee-script/package.json @@ -0,0 +1,35 @@ +{ + "name": "coffee-script", + "description": "Unfancy JavaScript", + "keywords": ["javascript", "language", "coffeescript", "compiler"], + "author": "Jeremy Ashkenas", + "version": "1.4.0", + "licenses": [{ + "type": "MIT", + "url": "https://raw.github.com/jashkenas/coffee-script/master/LICENSE" + }], + "engines": { + "node": ">=0.4.0" + }, + "directories" : { + "lib" : "./lib/coffee-script" + }, + "main" : "./lib/coffee-script/coffee-script", + "bin": { + "coffee": "./bin/coffee", + "cake": "./bin/cake" + }, + "scripts": { + "test": "node ./bin/cake test" + }, + "homepage": "http://coffeescript.org/", + "bugs": "https://github.com/jashkenas/coffee-script/issues", + "repository": { + "type": "git", + "url": "git://github.com/jashkenas/coffee-script.git" + }, + "devDependencies": { + "uglify-js": ">=1.0.0", + "jison": ">=0.2.0" + } +} diff --git a/node_modules/jade/node_modules/commander/.npmignore b/node_modules/jade/node_modules/commander/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/jade/node_modules/commander/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/jade/node_modules/commander/.travis.yml b/node_modules/jade/node_modules/commander/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/jade/node_modules/commander/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/jade/node_modules/commander/History.md b/node_modules/jade/node_modules/commander/History.md new file mode 100644 index 0000000..4961d2e --- /dev/null +++ b/node_modules/jade/node_modules/commander/History.md @@ -0,0 +1,107 @@ + +0.6.1 / 2012-06-01 +================== + + * Added: append (yes or no) on confirmation + * Added: allow node.js v0.7.x + +0.6.0 / 2012-04-10 +================== + + * Added `.prompt(obj, callback)` support. Closes #49 + * Added default support to .choose(). Closes #41 + * Fixed the choice example + +0.5.1 / 2011-12-20 +================== + + * Fixed `password()` for recent nodes. Closes #36 + +0.5.0 / 2011-12-04 +================== + + * Added sub-command option support [itay] + +0.4.3 / 2011-12-04 +================== + + * Fixed custom help ordering. Closes #32 + +0.4.2 / 2011-11-24 +================== + + * Added travis support + * Fixed: line-buffered input automatically trimmed. Closes #31 + +0.4.1 / 2011-11-18 +================== + + * Removed listening for "close" on --help + +0.4.0 / 2011-11-15 +================== + + * Added support for `--`. Closes #24 + +0.3.3 / 2011-11-14 +================== + + * Fixed: wait for close event when writing help info [Jerry Hamlet] + +0.3.2 / 2011-11-01 +================== + + * Fixed long flag definitions with values [felixge] + +0.3.1 / 2011-10-31 +================== + + * Changed `--version` short flag to `-V` from `-v` + * Changed `.version()` so it's configurable [felixge] + +0.3.0 / 2011-10-31 +================== + + * Added support for long flags only. Closes #18 + +0.2.1 / 2011-10-24 +================== + + * "node": ">= 0.4.x < 0.7.0". Closes #20 + +0.2.0 / 2011-09-26 +================== + + * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] + +0.1.0 / 2011-08-24 +================== + + * Added support for custom `--help` output + +0.0.5 / 2011-08-18 +================== + + * Changed: when the user enters nothing prompt for password again + * Fixed issue with passwords beginning with numbers [NuckChorris] + +0.0.4 / 2011-08-15 +================== + + * Fixed `Commander#args` + +0.0.3 / 2011-08-15 +================== + + * Added default option value support + +0.0.2 / 2011-08-15 +================== + + * Added mask support to `Command#password(str[, mask], fn)` + * Added `Command#password(str, fn)` + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/jade/node_modules/commander/Makefile b/node_modules/jade/node_modules/commander/Makefile new file mode 100644 index 0000000..0074625 --- /dev/null +++ b/node_modules/jade/node_modules/commander/Makefile @@ -0,0 +1,7 @@ + +TESTS = $(shell find test/test.*.js) + +test: + @./test/run $(TESTS) + +.PHONY: test \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/Readme.md b/node_modules/jade/node_modules/commander/Readme.md new file mode 100644 index 0000000..b8328c3 --- /dev/null +++ b/node_modules/jade/node_modules/commander/Readme.md @@ -0,0 +1,262 @@ +# Commander.js + + The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). + + [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) + +## Installation + + $ npm install commander + +## Option parsing + + Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .version('0.0.1') + .option('-p, --peppers', 'Add peppers') + .option('-P, --pineapple', 'Add pineapple') + .option('-b, --bbq', 'Add bbq sauce') + .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') + .parse(process.argv); + +console.log('you ordered a pizza with:'); +if (program.peppers) console.log(' - peppers'); +if (program.pineapple) console.log(' - pineappe'); +if (program.bbq) console.log(' - bbq'); +console.log(' - %s cheese', program.cheese); +``` + + Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. + +## Automated --help + + The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: + +``` + $ ./examples/pizza --help + + Usage: pizza [options] + + Options: + + -V, --version output the version number + -p, --peppers Add peppers + -P, --pineapple Add pineappe + -b, --bbq Add bbq sauce + -c, --cheese Add the specified type of cheese [marble] + -h, --help output usage information + +``` + +## Coercion + +```js +function range(val) { + return val.split('..').map(Number); +} + +function list(val) { + return val.split(','); +} + +program + .version('0.0.1') + .usage('[options] ') + .option('-i, --integer ', 'An integer argument', parseInt) + .option('-f, --float ', 'A float argument', parseFloat) + .option('-r, --range ..', 'A range', range) + .option('-l, --list ', 'A list', list) + .option('-o, --optional [value]', 'An optional value') + .parse(process.argv); + +console.log(' int: %j', program.integer); +console.log(' float: %j', program.float); +console.log(' optional: %j', program.optional); +program.range = program.range || []; +console.log(' range: %j..%j', program.range[0], program.range[1]); +console.log(' list: %j', program.list); +console.log(' args: %j', program.args); +``` + +## Custom help + + You can display arbitrary `-h, --help` information + by listening for "--help". Commander will automatically + exit once you are done so that the remainder of your program + does not execute causing undesired behaviours, for example + in the following executable "stuff" will not output when + `--help` is used. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('../'); + +function list(val) { + return val.split(',').map(Number); +} + +program + .version('0.0.1') + .option('-f, --foo', 'enable some foo') + .option('-b, --bar', 'enable some bar') + .option('-B, --baz', 'enable some baz'); + +// must be before .parse() since +// node's emit() is immediate + +program.on('--help', function(){ + console.log(' Examples:'); + console.log(''); + console.log(' $ custom-help --help'); + console.log(' $ custom-help -h'); + console.log(''); +}); + +program.parse(process.argv); + +console.log('stuff'); +``` + +yielding the following help output: + +``` + +Usage: custom-help [options] + +Options: + + -h, --help output usage information + -V, --version output the version number + -f, --foo enable some foo + -b, --bar enable some bar + -B, --baz enable some baz + +Examples: + + $ custom-help --help + $ custom-help -h + +``` + +## .prompt(msg, fn) + + Single-line prompt: + +```js +program.prompt('name: ', function(name){ + console.log('hi %s', name); +}); +``` + + Multi-line prompt: + +```js +program.prompt('description:', function(name){ + console.log('hi %s', name); +}); +``` + + Coercion: + +```js +program.prompt('Age: ', Number, function(age){ + console.log('age: %j', age); +}); +``` + +```js +program.prompt('Birthdate: ', Date, function(date){ + console.log('date: %s', date); +}); +``` + +## .password(msg[, mask], fn) + +Prompt for password without echoing: + +```js +program.password('Password: ', function(pass){ + console.log('got "%s"', pass); + process.stdin.destroy(); +}); +``` + +Prompt for password with mask char "*": + +```js +program.password('Password: ', '*', function(pass){ + console.log('got "%s"', pass); + process.stdin.destroy(); +}); +``` + +## .confirm(msg, fn) + + Confirm with the given `msg`: + +```js +program.confirm('continue? ', function(ok){ + console.log(' got %j', ok); +}); +``` + +## .choose(list, fn) + + Let the user choose from a `list`: + +```js +var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; + +console.log('Choose the coolest pet:'); +program.choose(list, function(i){ + console.log('you chose %d "%s"', i, list[i]); +}); +``` + +## Links + + - [API documentation](http://visionmedia.github.com/commander.js/) + - [ascii tables](https://github.com/LearnBoost/cli-table) + - [progress bars](https://github.com/visionmedia/node-progress) + - [more progress bars](https://github.com/substack/node-multimeter) + - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) + +## 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/jade/node_modules/commander/index.js b/node_modules/jade/node_modules/commander/index.js new file mode 100644 index 0000000..06ec1e4 --- /dev/null +++ b/node_modules/jade/node_modules/commander/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/lib/commander.js b/node_modules/jade/node_modules/commander/lib/commander.js new file mode 100644 index 0000000..5ba87eb --- /dev/null +++ b/node_modules/jade/node_modules/commander/lib/commander.js @@ -0,0 +1,1026 @@ + +/*! + * commander + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , path = require('path') + , tty = require('tty') + , basename = path.basename; + +/** + * Expose the root command. + */ + +exports = module.exports = new Command; + +/** + * Expose `Command`. + */ + +exports.Command = Command; + +/** + * Expose `Option`. + */ + +exports.Option = Option; + +/** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {String} flags + * @param {String} description + * @api public + */ + +function Option(flags, description) { + this.flags = flags; + this.required = ~flags.indexOf('<'); + this.optional = ~flags.indexOf('['); + this.bool = !~flags.indexOf('-no-'); + flags = flags.split(/[ ,|]+/); + if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); + this.long = flags.shift(); + this.description = description; +} + +/** + * Return option name. + * + * @return {String} + * @api private + */ + +Option.prototype.name = function(){ + return this.long + .replace('--', '') + .replace('no-', ''); +}; + +/** + * Check if `arg` matches the short or long flag. + * + * @param {String} arg + * @return {Boolean} + * @api private + */ + +Option.prototype.is = function(arg){ + return arg == this.short + || arg == this.long; +}; + +/** + * Initialize a new `Command`. + * + * @param {String} name + * @api public + */ + +function Command(name) { + this.commands = []; + this.options = []; + this.args = []; + this.name = name; +} + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Command.prototype.__proto__ = EventEmitter.prototype; + +/** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * Examples: + * + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function(){ + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd){ + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env){ + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {String} name + * @return {Command} the new command + * @api public + */ + +Command.prototype.command = function(name){ + var args = name.split(/ +/); + var cmd = new Command(args.shift()); + this.commands.push(cmd); + cmd.parseExpectedArgs(args); + cmd.parent = this; + return cmd; +}; + +/** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {Array} args + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parseExpectedArgs = function(args){ + if (!args.length) return; + var self = this; + args.forEach(function(arg){ + switch (arg[0]) { + case '<': + self.args.push({ required: true, name: arg.slice(1, -1) }); + break; + case '[': + self.args.push({ required: false, name: arg.slice(1, -1) }); + break; + } + }); + return this; +}; + +/** + * Register callback `fn` for the command. + * + * Examples: + * + * program + * .command('help') + * .description('display verbose help') + * .action(function(){ + * // output help here + * }); + * + * @param {Function} fn + * @return {Command} for chaining + * @api public + */ + +Command.prototype.action = function(fn){ + var self = this; + this.parent.on(this.name, function(args, unknown){ + // Parse any so-far unknown options + unknown = unknown || []; + var parsed = self.parseOptions(unknown); + + // Output help if necessary + outputHelpIfNecessary(self, parsed.unknown); + + // If there are still any unknown options, then we simply + // die, unless someone asked for help, in which case we give it + // to them, and then we die. + if (parsed.unknown.length > 0) { + self.unknownOption(parsed.unknown[0]); + } + + self.args.forEach(function(arg, i){ + if (arg.required && null == args[i]) { + self.missingArgument(arg.name); + } + }); + + // Always append ourselves to the end of the arguments, + // to make sure we match the number of arguments the user + // expects + if (self.args.length) { + args[self.args.length] = self; + } else { + args.push(self); + } + + fn.apply(this, args); + }); + return this; +}; + +/** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * Examples: + * + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to false + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => true + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {String} flags + * @param {String} description + * @param {Function|Mixed} fn or default + * @param {Mixed} defaultValue + * @return {Command} for chaining + * @api public + */ + +Command.prototype.option = function(flags, description, fn, defaultValue){ + var self = this + , option = new Option(flags, description) + , oname = option.name() + , name = camelcase(oname); + + // default as 3rd arg + if ('function' != typeof fn) defaultValue = fn, fn = null; + + // preassign default value only for --no-*, [optional], or + if (false == option.bool || option.optional || option.required) { + // when --no-* we make sure default is true + if (false == option.bool) defaultValue = true; + // preassign only if we have a default + if (undefined !== defaultValue) self[name] = defaultValue; + } + + // register the option + this.options.push(option); + + // when it's passed assign the value + // and conditionally invoke the callback + this.on(oname, function(val){ + // coercion + if (null != val && fn) val = fn(val); + + // unassigned or bool + if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { + // if no value, bool true, and we have a default, then use it! + if (null == val) { + self[name] = option.bool + ? defaultValue || true + : false; + } else { + self[name] = val; + } + } else if (null !== val) { + // reassign + self[name] = val; + } + }); + + return this; +}; + +/** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {Array} argv + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parse = function(argv){ + // store raw args + this.rawArgs = argv; + + // guess name + if (!this.name) this.name = basename(argv[1]); + + // process argv + var parsed = this.parseOptions(this.normalize(argv.slice(2))); + this.args = parsed.args; + return this.parseArgs(this.args, parsed.unknown); +}; + +/** + * Normalize `args`, splitting joined short flags. For example + * the arg "-abc" is equivalent to "-a -b -c". + * + * @param {Array} args + * @return {Array} + * @api private + */ + +Command.prototype.normalize = function(args){ + var ret = [] + , arg; + + for (var i = 0, len = args.length; i < len; ++i) { + arg = args[i]; + if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { + arg.slice(1).split('').forEach(function(c){ + ret.push('-' + c); + }); + } else { + ret.push(arg); + } + } + + return ret; +}; + +/** + * Parse command `args`. + * + * When listener(s) are available those + * callbacks are invoked, otherwise the "*" + * event is emitted and those actions are invoked. + * + * @param {Array} args + * @return {Command} for chaining + * @api private + */ + +Command.prototype.parseArgs = function(args, unknown){ + var cmds = this.commands + , len = cmds.length + , name; + + if (args.length) { + name = args[0]; + if (this.listeners(name).length) { + this.emit(args.shift(), args, unknown); + } else { + this.emit('*', args); + } + } else { + outputHelpIfNecessary(this, unknown); + + // If there were no args and we have unknown options, + // then they are extraneous and we need to error. + if (unknown.length > 0) { + this.unknownOption(unknown[0]); + } + } + + return this; +}; + +/** + * Return an option matching `arg` if any. + * + * @param {String} arg + * @return {Option} + * @api private + */ + +Command.prototype.optionFor = function(arg){ + for (var i = 0, len = this.options.length; i < len; ++i) { + if (this.options[i].is(arg)) { + return this.options[i]; + } + } +}; + +/** + * Parse options from `argv` returning `argv` + * void of these options. + * + * @param {Array} argv + * @return {Array} + * @api public + */ + +Command.prototype.parseOptions = function(argv){ + var args = [] + , len = argv.length + , literal + , option + , arg; + + var unknownOptions = []; + + // parse options + for (var i = 0; i < len; ++i) { + arg = argv[i]; + + // literal args after -- + if ('--' == arg) { + literal = true; + continue; + } + + if (literal) { + args.push(arg); + continue; + } + + // find matching Option + option = this.optionFor(arg); + + // option is defined + if (option) { + // requires arg + if (option.required) { + arg = argv[++i]; + if (null == arg) return this.optionMissingArgument(option); + if ('-' == arg[0]) return this.optionMissingArgument(option, arg); + this.emit(option.name(), arg); + // optional arg + } else if (option.optional) { + arg = argv[i+1]; + if (null == arg || '-' == arg[0]) { + arg = null; + } else { + ++i; + } + this.emit(option.name(), arg); + // bool + } else { + this.emit(option.name()); + } + continue; + } + + // looks like an option + if (arg.length > 1 && '-' == arg[0]) { + unknownOptions.push(arg); + + // If the next argument looks like it might be + // an argument for this option, we pass it on. + // If it isn't, then it'll simply be ignored + if (argv[i+1] && '-' != argv[i+1][0]) { + unknownOptions.push(argv[++i]); + } + continue; + } + + // arg + args.push(arg); + } + + return { args: args, unknown: unknownOptions }; +}; + +/** + * Argument `name` is missing. + * + * @param {String} name + * @api private + */ + +Command.prototype.missingArgument = function(name){ + console.error(); + console.error(" error: missing required argument `%s'", name); + console.error(); + process.exit(1); +}; + +/** + * `Option` is missing an argument, but received `flag` or nothing. + * + * @param {String} option + * @param {String} flag + * @api private + */ + +Command.prototype.optionMissingArgument = function(option, flag){ + console.error(); + if (flag) { + console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); + } else { + console.error(" error: option `%s' argument missing", option.flags); + } + console.error(); + process.exit(1); +}; + +/** + * Unknown option `flag`. + * + * @param {String} flag + * @api private + */ + +Command.prototype.unknownOption = function(flag){ + console.error(); + console.error(" error: unknown option `%s'", flag); + console.error(); + process.exit(1); +}; + +/** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {String} str + * @param {String} flags + * @return {Command} for chaining + * @api public + */ + +Command.prototype.version = function(str, flags){ + if (0 == arguments.length) return this._version; + this._version = str; + flags = flags || '-V, --version'; + this.option(flags, 'output the version number'); + this.on('version', function(){ + console.log(str); + process.exit(0); + }); + return this; +}; + +/** + * Set the description `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.description = function(str){ + if (0 == arguments.length) return this._description; + this._description = str; + return this; +}; + +/** + * Set / get the command usage `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.usage = function(str){ + var args = this.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }); + + var usage = '[options' + + (this.commands.length ? '] [command' : '') + + ']' + + (this.args.length ? ' ' + args : ''); + if (0 == arguments.length) return this._usage || usage; + this._usage = str; + + return this; +}; + +/** + * Return the largest option length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestOptionLength = function(){ + return this.options.reduce(function(max, option){ + return Math.max(max, option.flags.length); + }, 0); +}; + +/** + * Return help for options. + * + * @return {String} + * @api private + */ + +Command.prototype.optionHelp = function(){ + var width = this.largestOptionLength(); + + // Prepend the help information + return [pad('-h, --help', width) + ' ' + 'output usage information'] + .concat(this.options.map(function(option){ + return pad(option.flags, width) + + ' ' + option.description; + })) + .join('\n'); +}; + +/** + * Return command help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.commandHelp = function(){ + if (!this.commands.length) return ''; + return [ + '' + , ' Commands:' + , '' + , this.commands.map(function(cmd){ + var args = cmd.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }).join(' '); + + return cmd.name + + (cmd.options.length + ? ' [options]' + : '') + ' ' + args + + (cmd.description() + ? '\n' + cmd.description() + : ''); + }).join('\n\n').replace(/^/gm, ' ') + , '' + ].join('\n'); +}; + +/** + * Return program help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.helpInformation = function(){ + return [ + '' + , ' Usage: ' + this.name + ' ' + this.usage() + , '' + this.commandHelp() + , ' Options:' + , '' + , '' + this.optionHelp().replace(/^/gm, ' ') + , '' + , '' + ].join('\n'); +}; + +/** + * Prompt for a `Number`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForNumber = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseNumber(val){ + val = Number(val); + if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); + fn(val); + }); +}; + +/** + * Prompt for a `Date`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForDate = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseDate(val){ + val = new Date(val); + if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); + fn(val); + }); +}; + +/** + * Single-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptSingleLine = function(str, fn){ + if ('function' == typeof arguments[2]) { + return this['promptFor' + (fn.name || fn)](str, arguments[2]); + } + + process.stdout.write(str); + process.stdin.setEncoding('utf8'); + process.stdin.once('data', function(val){ + fn(val.trim()); + }).resume(); +}; + +/** + * Multi-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptMultiLine = function(str, fn){ + var buf = []; + console.log(str); + process.stdin.setEncoding('utf8'); + process.stdin.on('data', function(val){ + if ('\n' == val || '\r\n' == val) { + process.stdin.removeAllListeners('data'); + fn(buf.join('\n')); + } else { + buf.push(val.trimRight()); + } + }).resume(); +}; + +/** + * Prompt `str` and callback `fn(val)` + * + * Commander supports single-line and multi-line prompts. + * To issue a single-line prompt simply add white-space + * to the end of `str`, something like "name: ", whereas + * for a multi-line prompt omit this "description:". + * + * + * Examples: + * + * program.prompt('Username: ', function(name){ + * console.log('hi %s', name); + * }); + * + * program.prompt('Description:', function(desc){ + * console.log('description was "%s"', desc.trim()); + * }); + * + * @param {String|Object} str + * @param {Function} fn + * @api public + */ + +Command.prototype.prompt = function(str, fn){ + var self = this; + + if ('string' == typeof str) { + if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); + this.promptMultiLine(str, fn); + } else { + var keys = Object.keys(str) + , obj = {}; + + function next() { + var key = keys.shift() + , label = str[key]; + + if (!key) return fn(obj); + self.prompt(label, function(val){ + obj[key] = val; + next(); + }); + } + + next(); + } +}; + +/** + * Prompt for password with `str`, `mask` char and callback `fn(val)`. + * + * The mask string defaults to '', aka no output is + * written while typing, you may want to use "*" etc. + * + * Examples: + * + * program.password('Password: ', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * program.password('Password: ', '*', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {String} mask + * @param {Function} fn + * @api public + */ + +Command.prototype.password = function(str, mask, fn){ + var self = this + , buf = ''; + + // default mask + if ('function' == typeof mask) { + fn = mask; + mask = ''; + } + + process.stdin.resume(); + tty.setRawMode(true); + process.stdout.write(str); + + // keypress + process.stdin.on('keypress', function(c, key){ + if (key && 'enter' == key.name) { + console.log(); + process.stdin.removeAllListeners('keypress'); + tty.setRawMode(false); + if (!buf.trim().length) return self.password(str, mask, fn); + fn(buf); + return; + } + + if (key && key.ctrl && 'c' == key.name) { + console.log('%s', buf); + process.exit(); + } + + process.stdout.write(mask); + buf += c; + }).resume(); +}; + +/** + * Confirmation prompt with `str` and callback `fn(bool)` + * + * Examples: + * + * program.confirm('continue? ', function(ok){ + * console.log(' got %j', ok); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {Function} fn + * @api public + */ + + +Command.prototype.confirm = function(str, fn, verbose){ + var self = this; + this.prompt(str, function(ok){ + if (!ok.trim()) { + if (!verbose) str += '(yes or no) '; + return self.confirm(str, fn, true); + } + fn(parseBool(ok)); + }); +}; + +/** + * Choice prompt with `list` of items and callback `fn(index, item)` + * + * Examples: + * + * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; + * + * console.log('Choose the coolest pet:'); + * program.choose(list, function(i){ + * console.log('you chose %d "%s"', i, list[i]); + * process.stdin.destroy(); + * }); + * + * @param {Array} list + * @param {Number|Function} index or fn + * @param {Function} fn + * @api public + */ + +Command.prototype.choose = function(list, index, fn){ + var self = this + , hasDefault = 'number' == typeof index; + + if (!hasDefault) { + fn = index; + index = null; + } + + list.forEach(function(item, i){ + if (hasDefault && i == index) { + console.log('* %d) %s', i + 1, item); + } else { + console.log(' %d) %s', i + 1, item); + } + }); + + function again() { + self.prompt(' : ', function(val){ + val = parseInt(val, 10) - 1; + if (hasDefault && isNaN(val)) val = index; + + if (null == list[val]) { + again(); + } else { + fn(val, list[val]); + } + }); + } + + again(); +}; + +/** + * Camel-case the given `flag` + * + * @param {String} flag + * @return {String} + * @api private + */ + +function camelcase(flag) { + return flag.split('-').reduce(function(str, word){ + return str + word[0].toUpperCase() + word.slice(1); + }); +} + +/** + * Parse a boolean `str`. + * + * @param {String} str + * @return {Boolean} + * @api private + */ + +function parseBool(str) { + return /^y|yes|ok|true$/i.test(str); +} + +/** + * Pad `str` to `width`. + * + * @param {String} str + * @param {Number} width + * @return {String} + * @api private + */ + +function pad(str, width) { + var len = Math.max(0, width - str.length); + return str + Array(len + 1).join(' '); +} + +/** + * Output help information if necessary + * + * @param {Command} command to output help for + * @param {Array} array of options to search for -h or --help + * @api private + */ + +function outputHelpIfNecessary(cmd, options) { + options = options || []; + for (var i = 0; i < options.length; i++) { + if (options[i] == '--help' || options[i] == '-h') { + process.stdout.write(cmd.helpInformation()); + cmd.emit('--help'); + process.exit(0); + } + } +} diff --git a/node_modules/jade/node_modules/commander/package.json b/node_modules/jade/node_modules/commander/package.json new file mode 100644 index 0000000..7161a8b --- /dev/null +++ b/node_modules/jade/node_modules/commander/package.json @@ -0,0 +1,13 @@ +{ + "name": "commander" + , "version": "0.6.1" + , "description": "the complete solution for node.js command-line programs" + , "keywords": ["command", "option", "parser", "prompt", "stdin"] + , "author": "TJ Holowaychuk " + , "repository": { "type": "git", "url": "https://github.com/visionmedia/commander.js.git" } + , "dependencies": {} + , "devDependencies": { "should": ">= 0.0.1" } + , "scripts": { "test": "make test" } + , "main": "index" + , "engines": { "node": ">= 0.4.x" } +} \ No newline at end of file diff --git a/node_modules/jade/node_modules/mkdirp/.npmignore b/node_modules/jade/node_modules/mkdirp/.npmignore new file mode 100644 index 0000000..9303c34 --- /dev/null +++ b/node_modules/jade/node_modules/mkdirp/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/jade/node_modules/mkdirp/.travis.yml b/node_modules/jade/node_modules/mkdirp/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/jade/node_modules/mkdirp/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/jade/node_modules/mkdirp/LICENSE b/node_modules/jade/node_modules/mkdirp/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/README.markdown b/node_modules/jade/node_modules/mkdirp/README.markdown new file mode 100644 index 0000000..40de04f --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/examples/pow.js b/node_modules/jade/node_modules/mkdirp/examples/pow.js new file mode 100644 index 0000000..e692421 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/index.js b/node_modules/jade/node_modules/mkdirp/index.js new file mode 100644 index 0000000..fda6de8 --- /dev/null +++ b/node_modules/jade/node_modules/mkdirp/index.js @@ -0,0 +1,82 @@ +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; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + 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; + } + }); +} + +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; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = fs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } + + return made; +}; diff --git a/node_modules/jade/node_modules/mkdirp/package.json b/node_modules/jade/node_modules/mkdirp/package.json new file mode 100644 index 0000000..7316d9f --- /dev/null +++ b/node_modules/jade/node_modules/mkdirp/package.json @@ -0,0 +1,23 @@ +{ + "name" : "mkdirp", + "description" : "Recursively mkdir, like `mkdir -p`", + "version" : "0.3.4", + "author" : "James Halliday (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": "*" } +} diff --git a/node_modules/jade/node_modules/mkdirp/test/chmod.js b/node_modules/jade/node_modules/mkdirp/test/chmod.js new file mode 100644 index 0000000..520dcb8 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/clobber.js b/node_modules/jade/node_modules/mkdirp/test/clobber.js new file mode 100644 index 0000000..0eb7099 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/mkdirp.js b/node_modules/jade/node_modules/mkdirp/test/mkdirp.js new file mode 100644 index 0000000..b07cd70 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/perm.js b/node_modules/jade/node_modules/mkdirp/test/perm.js new file mode 100644 index 0000000..23a7abb --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/perm_sync.js b/node_modules/jade/node_modules/mkdirp/test/perm_sync.js new file mode 100644 index 0000000..f685f60 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/race.js b/node_modules/jade/node_modules/mkdirp/test/race.js new file mode 100644 index 0000000..96a0447 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/rel.js b/node_modules/jade/node_modules/mkdirp/test/rel.js new file mode 100644 index 0000000..7985824 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/return.js b/node_modules/jade/node_modules/mkdirp/test/return.js new file mode 100644 index 0000000..bce68e5 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/return_sync.js b/node_modules/jade/node_modules/mkdirp/test/return_sync.js new file mode 100644 index 0000000..7c222d3 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/root.js b/node_modules/jade/node_modules/mkdirp/test/root.js new file mode 100644 index 0000000..97ad7a2 --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/sync.js b/node_modules/jade/node_modules/mkdirp/test/sync.js new file mode 100644 index 0000000..7530cad --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/umask.js b/node_modules/jade/node_modules/mkdirp/test/umask.js new file mode 100644 index 0000000..64ccafe --- /dev/null +++ b/node_modules/jade/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/jade/node_modules/mkdirp/test/umask_sync.js b/node_modules/jade/node_modules/mkdirp/test/umask_sync.js new file mode 100644 index 0000000..35bd5cb --- /dev/null +++ b/node_modules/jade/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/jade/package.json b/node_modules/jade/package.json new file mode 100644 index 0000000..5d105e1 --- /dev/null +++ b/node_modules/jade/package.json @@ -0,0 +1,34 @@ +{ + "name": "jade", + "description": "Jade template engine", + "version": "0.28.1", + "author": "TJ Holowaychuk ", + "repository": "git://github.com/visionmedia/jade", + "main": "./index.js", + "bin": { + "jade": "./bin/jade" + }, + "man": "./jade.1", + "dependencies": { + "commander": "0.6.1", + "mkdirp": "0.3.x", + "coffee-script": "~1.4.0" + }, + "devDependencies": { + "mocha": "*", + "markdown": "*", + "stylus": "*", + "uubench": "*", + "should": "*", + "less": "*", + "uglify-js": "*" + }, + "component": { + "scripts": { + "jade": "runtime.js" + } + }, + "scripts": { + "prepublish": "npm prune" + } +} diff --git a/node_modules/jade/runtime.js b/node_modules/jade/runtime.js new file mode 100644 index 0000000..0f54907 --- /dev/null +++ b/node_modules/jade/runtime.js @@ -0,0 +1,179 @@ + +jade = (function(exports){ +/*! + * Jade - runtime + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Lame Array.isArray() polyfill for now. + */ + +if (!Array.isArray) { + Array.isArray = function(arr){ + return '[object Array]' == Object.prototype.toString.call(arr); + }; +} + +/** + * Lame Object.keys() polyfill for now. + */ + +if (!Object.keys) { + Object.keys = function(obj){ + var arr = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + arr.push(key); + } + } + return arr; + } +} + +/** + * Merge two attribute objects giving precedence + * to values in object `b`. Classes are special-cased + * allowing for arrays and merging/joining appropriately + * resulting in a string. + * + * @param {Object} a + * @param {Object} b + * @return {Object} a + * @api private + */ + +exports.merge = function merge(a, b) { + var ac = a['class']; + var bc = b['class']; + + if (ac || bc) { + ac = ac || []; + bc = bc || []; + if (!Array.isArray(ac)) ac = [ac]; + if (!Array.isArray(bc)) bc = [bc]; + ac = ac.filter(nulls); + bc = bc.filter(nulls); + a['class'] = ac.concat(bc).join(' '); + } + + for (var key in b) { + if (key != 'class') { + a[key] = b[key]; + } + } + + return a; +}; + +/** + * Filter null `val`s. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function nulls(val) { + return val != null; +} + +/** + * Render the given attributes object. + * + * @param {Object} obj + * @param {Object} escaped + * @return {String} + * @api private + */ + +exports.attrs = function attrs(obj, escaped){ + var buf = [] + , terse = obj.terse; + + delete obj.terse; + var keys = Object.keys(obj) + , len = keys.length; + + if (len) { + buf.push(''); + for (var i = 0; i < len; ++i) { + var key = keys[i] + , val = obj[key]; + + if ('boolean' == typeof val || null == val) { + if (val) { + terse + ? buf.push(key) + : buf.push(key + '="' + key + '"'); + } + } else if (0 == key.indexOf('data') && 'string' != typeof val) { + buf.push(key + "='" + JSON.stringify(val) + "'"); + } else if ('class' == key && Array.isArray(val)) { + buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); + } else if (escaped && escaped[key]) { + buf.push(key + '="' + exports.escape(val) + '"'); + } else { + buf.push(key + '="' + val + '"'); + } + } + } + + return buf.join(' '); +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function escape(html){ + return String(html) + .replace(/&(?!(\w+|\#\d+);)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +}; + +/** + * Re-throw the given `err` in context to the + * the jade in `filename` at the given `lineno`. + * + * @param {Error} err + * @param {String} filename + * @param {String} lineno + * @api private + */ + +exports.rethrow = function rethrow(err, filename, lineno){ + if (!filename) throw err; + + var context = 3 + , str = require('fs').readFileSync(filename, 'utf8') + , lines = str.split('\n') + , start = Math.max(lineno - context, 0) + , end = Math.min(lines.length, lineno + context); + + // 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 || 'Jade') + ':' + lineno + + '\n' + context + '\n\n' + err.message; + throw err; +}; + + return exports; + +})({}); diff --git a/node_modules/jade/runtime.min.js b/node_modules/jade/runtime.min.js new file mode 100644 index 0000000..1714efb --- /dev/null +++ b/node_modules/jade/runtime.min.js @@ -0,0 +1 @@ +jade=function(exports){Array.isArray||(Array.isArray=function(arr){return"[object Array]"==Object.prototype.toString.call(arr)}),Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),exports.merge=function merge(a,b){var ac=a["class"],bc=b["class"];if(ac||bc)ac=ac||[],bc=bc||[],Array.isArray(ac)||(ac=[ac]),Array.isArray(bc)||(bc=[bc]),ac=ac.filter(nulls),bc=bc.filter(nulls),a["class"]=ac.concat(bc).join(" ");for(var key in b)key!="class"&&(a[key]=b[key]);return a};function nulls(val){return val!=null}return exports.attrs=function attrs(obj,escaped){var buf=[],terse=obj.terse;delete obj.terse;var keys=Object.keys(obj),len=keys.length;if(len){buf.push("");for(var i=0;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err},exports}({}); \ No newline at end of file diff --git a/node_modules/jade/testing/index.html b/node_modules/jade/testing/index.html new file mode 100644 index 0000000..105c9f4 --- /dev/null +++ b/node_modules/jade/testing/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/node_modules/jade/testing/index.jade b/node_modules/jade/testing/index.jade new file mode 100644 index 0000000..a22e82a --- /dev/null +++ b/node_modules/jade/testing/index.jade @@ -0,0 +1,4 @@ + +html + body + include some.js diff --git a/node_modules/jade/testing/layout.html b/node_modules/jade/testing/layout.html new file mode 100644 index 0000000..cbbfc7a --- /dev/null +++ b/node_modules/jade/testing/layout.html @@ -0,0 +1 @@ +Application \ No newline at end of file diff --git a/node_modules/jade/testing/layout.jade b/node_modules/jade/testing/layout.jade new file mode 100644 index 0000000..a48765c --- /dev/null +++ b/node_modules/jade/testing/layout.jade @@ -0,0 +1,6 @@ +!!! 5 +html + head + title Application + body + block content diff --git a/node_modules/jade/testing/mobile.html b/node_modules/jade/testing/mobile.html new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/jade/testing/mobile.jade b/node_modules/jade/testing/mobile.jade new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/jade/testing/nested/something.html b/node_modules/jade/testing/nested/something.html new file mode 100644 index 0000000..d6b0493 --- /dev/null +++ b/node_modules/jade/testing/nested/something.html @@ -0,0 +1 @@ +

    out

    \ No newline at end of file diff --git a/node_modules/jade/testing/nested/something.jade b/node_modules/jade/testing/nested/something.jade new file mode 100644 index 0000000..552c797 --- /dev/null +++ b/node_modules/jade/testing/nested/something.jade @@ -0,0 +1 @@ +p out \ No newline at end of file diff --git a/node_modules/jade/testing/some.js b/node_modules/jade/testing/some.js new file mode 100644 index 0000000..3104e71 --- /dev/null +++ b/node_modules/jade/testing/some.js @@ -0,0 +1,4 @@ + +if (something) { + something('hey'); +} diff --git a/node_modules/jade/testing/test.md b/node_modules/jade/testing/test.md new file mode 100644 index 0000000..9af1bb2 --- /dev/null +++ b/node_modules/jade/testing/test.md @@ -0,0 +1,5 @@ +Just a _test_ of some **markdown**: + + - foo + - bar + - baz diff --git a/node_modules/passport-github/.npmignore b/node_modules/passport-github/.npmignore new file mode 100644 index 0000000..d9ceb36 --- /dev/null +++ b/node_modules/passport-github/.npmignore @@ -0,0 +1,8 @@ +*.md +.DS_Store +.git* +Makefile +docs/ +examples/ +support/ +test/ diff --git a/node_modules/passport-github/.travis.yml b/node_modules/passport-github/.travis.yml new file mode 100644 index 0000000..2644170 --- /dev/null +++ b/node_modules/passport-github/.travis.yml @@ -0,0 +1,4 @@ +language: "node_js" +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/passport-github/LICENSE b/node_modules/passport-github/LICENSE new file mode 100644 index 0000000..74524ce --- /dev/null +++ b/node_modules/passport-github/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2011 Jared Hanson + +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/passport-github/examples/login/app.js b/node_modules/passport-github/examples/login/app.js new file mode 100644 index 0000000..7d7e75e --- /dev/null +++ b/node_modules/passport-github/examples/login/app.js @@ -0,0 +1,122 @@ +var express = require('express') + , passport = require('passport') + , util = require('util') + , GitHubStrategy = require('passport-github').Strategy; + +var GITHUB_CLIENT_ID = "--insert-github-client-id-here--" +var GITHUB_CLIENT_SECRET = "--insert-github-client-secret-here--"; + + +// Passport session setup. +// To support persistent login sessions, Passport needs to be able to +// serialize users into and deserialize users out of the session. Typically, +// this will be as simple as storing the user ID when serializing, and finding +// the user by ID when deserializing. However, since this example does not +// have a database of user records, the complete GitHub profile is serialized +// and deserialized. +passport.serializeUser(function(user, done) { + done(null, user); +}); + +passport.deserializeUser(function(obj, done) { + done(null, obj); +}); + + +// Use the GitHubStrategy within Passport. +// Strategies in Passport require a `verify` function, which accept +// credentials (in this case, an accessToken, refreshToken, and GitHub +// profile), and invoke a callback with a user object. +passport.use(new GitHubStrategy({ + clientID: GITHUB_CLIENT_ID, + clientSecret: GITHUB_CLIENT_SECRET, + callbackURL: "http://127.0.0.1:3000/auth/github/callback" + }, + function(accessToken, refreshToken, profile, done) { + // asynchronous verification, for effect... + process.nextTick(function () { + + // To keep the example simple, the user's GitHub profile is returned to + // represent the logged-in user. In a typical application, you would want + // to associate the GitHub account with a user record in your database, + // and return that user instead. + return done(null, profile); + }); + } +)); + + + + +var app = express.createServer(); + +// configure Express +app.configure(function() { + app.set('views', __dirname + '/views'); + app.set('view engine', 'ejs'); + app.use(express.logger()); + app.use(express.cookieParser()); + app.use(express.bodyParser()); + app.use(express.methodOverride()); + app.use(express.session({ secret: 'keyboard cat' })); + // Initialize Passport! Also use passport.session() middleware, to support + // persistent login sessions (recommended). + app.use(passport.initialize()); + app.use(passport.session()); + app.use(app.router); + app.use(express.static(__dirname + '/public')); +}); + + +app.get('/', function(req, res){ + res.render('index', { user: req.user }); +}); + +app.get('/account', ensureAuthenticated, function(req, res){ + res.render('account', { user: req.user }); +}); + +app.get('/login', function(req, res){ + res.render('login', { user: req.user }); +}); + +// GET /auth/github +// Use passport.authenticate() as route middleware to authenticate the +// request. The first step in GitHub authentication will involve redirecting +// the user to github.com. After authorization, GitHubwill redirect the user +// back to this application at /auth/github/callback +app.get('/auth/github', + passport.authenticate('github'), + function(req, res){ + // The request will be redirected to GitHub for authentication, so this + // function will not be called. + }); + +// GET /auth/github/callback +// Use passport.authenticate() as route middleware to authenticate the +// request. If authentication fails, the user will be redirected back to the +// login page. Otherwise, the primary route function function will be called, +// which, in this example, will redirect the user to the home page. +app.get('/auth/github/callback', + passport.authenticate('github', { failureRedirect: '/login' }), + function(req, res) { + res.redirect('/'); + }); + +app.get('/logout', function(req, res){ + req.logout(); + res.redirect('/'); +}); + +app.listen(3000); + + +// Simple route middleware to ensure user is authenticated. +// Use this route middleware on any resource that needs to be protected. If +// the request is authenticated (typically via a persistent login session), +// the request will proceed. Otherwise, the user will be redirected to the +// login page. +function ensureAuthenticated(req, res, next) { + if (req.isAuthenticated()) { return next(); } + res.redirect('/login') +} diff --git a/node_modules/passport-github/examples/login/package.json b/node_modules/passport-github/examples/login/package.json new file mode 100644 index 0000000..413b025 --- /dev/null +++ b/node_modules/passport-github/examples/login/package.json @@ -0,0 +1,10 @@ +{ + "name": "passport-github-examples-login", + "version": "0.0.0", + "dependencies": { + "express": ">= 0.0.0", + "ejs": ">= 0.0.0", + "passport": ">= 0.0.0", + "passport-github": ">= 0.0.0" + } +} diff --git a/node_modules/passport-github/examples/login/views/account.ejs b/node_modules/passport-github/examples/login/views/account.ejs new file mode 100644 index 0000000..c4633d6 --- /dev/null +++ b/node_modules/passport-github/examples/login/views/account.ejs @@ -0,0 +1,4 @@ +

    ID: <%= user.id %>

    +

    Username: <%= user.username %>

    +

    Name: <%= user.displayName %>

    +

    Email: <%= user.emails[0].value %>

    diff --git a/node_modules/passport-github/examples/login/views/index.ejs b/node_modules/passport-github/examples/login/views/index.ejs new file mode 100644 index 0000000..15db9c0 --- /dev/null +++ b/node_modules/passport-github/examples/login/views/index.ejs @@ -0,0 +1,5 @@ +<% if (!user) { %> +

    Welcome! Please log in.

    +<% } else { %> +

    Hello, <%= user.displayName %>.

    +<% } %> diff --git a/node_modules/passport-github/examples/login/views/layout.ejs b/node_modules/passport-github/examples/login/views/layout.ejs new file mode 100644 index 0000000..b2ef4fa --- /dev/null +++ b/node_modules/passport-github/examples/login/views/layout.ejs @@ -0,0 +1,21 @@ + + + + Passport-GitHub Example + + + <% if (!user) { %> +
    + <% } else { %> +

    + Home | + Account | + Log Out +

    + <% } %> + <%- body %> + + diff --git a/node_modules/passport-github/examples/login/views/login.ejs b/node_modules/passport-github/examples/login/views/login.ejs new file mode 100644 index 0000000..d2dc1bb --- /dev/null +++ b/node_modules/passport-github/examples/login/views/login.ejs @@ -0,0 +1 @@ +Login with GitHub diff --git a/node_modules/passport-github/lib/passport-github/index.js b/node_modules/passport-github/lib/passport-github/index.js new file mode 100644 index 0000000..8a2d8c3 --- /dev/null +++ b/node_modules/passport-github/lib/passport-github/index.js @@ -0,0 +1,15 @@ +/** + * Module dependencies. + */ +var Strategy = require('./strategy'); + + +/** + * Framework version. + */ +require('pkginfo')(module, 'version'); + +/** + * Expose constructors. + */ +exports.Strategy = Strategy; diff --git a/node_modules/passport-github/lib/passport-github/strategy.js b/node_modules/passport-github/lib/passport-github/strategy.js new file mode 100644 index 0000000..fdbef53 --- /dev/null +++ b/node_modules/passport-github/lib/passport-github/strategy.js @@ -0,0 +1,106 @@ +/** + * Module dependencies. + */ +var util = require('util') + , OAuth2Strategy = require('passport-oauth').OAuth2Strategy + , InternalOAuthError = require('passport-oauth').InternalOAuthError; + + +/** + * `Strategy` constructor. + * + * The GitHub authentication strategy authenticates requests by delegating to + * GitHub using the OAuth 2.0 protocol. + * + * Applications must supply a `verify` callback which accepts an `accessToken`, + * `refreshToken` and service-specific `profile`, and then calls the `done` + * callback supplying a `user`, which should be set to `false` if the + * credentials are not valid. If an exception occured, `err` should be set. + * + * Options: + * - `clientID` your GitHub application's Client ID + * - `clientSecret` your GitHub application's Client Secret + * - `callbackURL` URL to which GitHub will redirect the user after granting authorization + * - `scope` array of permission scopes to request. valid scopes include: + * 'user', 'public_repo', 'repo', 'gist', or none. + * (see http://developer.github.com/v3/oauth/#scopes for more info) + * + * Examples: + * + * passport.use(new GitHubStrategy({ + * clientID: '123-456-789', + * clientSecret: 'shhh-its-a-secret' + * callbackURL: 'https://www.example.net/auth/github/callback' + * }, + * function(accessToken, refreshToken, profile, done) { + * User.findOrCreate(..., function (err, user) { + * done(err, user); + * }); + * } + * )); + * + * @param {Object} options + * @param {Function} verify + * @api public + */ +function Strategy(options, verify) { + options = options || {}; + options.authorizationURL = options.authorizationURL || 'https://github.com/login/oauth/authorize'; + options.tokenURL = options.tokenURL || 'https://github.com/login/oauth/access_token'; + options.scopeSeparator = options.scopeSeparator || ','; + + OAuth2Strategy.call(this, options, verify); + this.name = 'github'; +} + +/** + * Inherit from `OAuth2Strategy`. + */ +util.inherits(Strategy, OAuth2Strategy); + + +/** + * Retrieve user profile from GitHub. + * + * This function constructs a normalized profile, with the following properties: + * + * - `provider` always set to `github` + * - `id` the user's GitHub ID + * - `username` the user's GitHub username + * - `displayName` the user's full name + * - `profileUrl` the URL of the profile for the user on GitHub + * - `emails` the user's email addresses + * + * @param {String} accessToken + * @param {Function} done + * @api protected + */ +Strategy.prototype.userProfile = function(accessToken, done) { + this._oauth2.get('https://api.github.com/user', accessToken, function (err, body, res) { + if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); } + + try { + var json = JSON.parse(body); + + var profile = { provider: 'github' }; + profile.id = json.id; + profile.displayName = json.name; + profile.username = json.login; + profile.profileUrl = json.html_url; + profile.emails = [{ value: json.email }]; + + profile._raw = body; + profile._json = json; + + done(null, profile); + } catch(e) { + done(e); + } + }); +} + + +/** + * Expose `Strategy`. + */ +module.exports = Strategy; diff --git a/node_modules/passport-github/node_modules/passport-oauth/.travis.yml b/node_modules/passport-github/node_modules/passport-oauth/.travis.yml new file mode 100644 index 0000000..a57e4db --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/.travis.yml @@ -0,0 +1,5 @@ +language: "node_js" +node_js: + - 0.4 + - 0.6 + - 0.8 diff --git a/node_modules/passport-github/node_modules/passport-oauth/LICENSE b/node_modules/passport-github/node_modules/passport-oauth/LICENSE new file mode 100644 index 0000000..ec885b5 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2011-2013 Jared Hanson + +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/passport-github/node_modules/passport-oauth/README.md b/node_modules/passport-github/node_modules/passport-oauth/README.md new file mode 100644 index 0000000..f149c90 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/README.md @@ -0,0 +1,89 @@ +# Passport-OAuth + +General-purpose OAuth 1.0 and OAuth 2.0 authentication strategies for [Passport](https://github.com/jaredhanson/passport). + +This module lets you authenticate using OAuth in your Node.js applications. +By plugging into Passport, OAuth authentication can be easily and unobtrusively +integrated into any application or framework that supports +[Connect](http://www.senchalabs.org/connect/)-style middleware, including +[Express](http://expressjs.com/). + +Note that this strategy provides generic OAuth support. In many cases, a +provider-specific strategy can be used instead, which cuts down on unnecessary +configuration, and accommodates any provider-specific quirks. See the list +below for supported providers. + +Developers who need to implement authentication against an OAuth provider that +is not already supported are encouraged to sub-class this strategy. If you +choose to open source the new provider-specific strategy, send me a message and +I will update the list. + +## Installation + + $ npm install passport-oauth + +## Strategies using OAuth + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    StrategyOAuth Version
    37signals2.0
    AllPlayers.com1.0
    AngelList2.0
    Bitbucket1.0a
    Cloud Foundry (UAA)2.0
    Digg1.0a
    Dropbox1.0
    Dwolla2.0
    Evernote1.0a
    Facebook2.0
    Fitbit1.0a
    Flickr1.0a
    Foursquare2.0
    Geoloqi2.0
    GitHub2.0
    Goodreads1.0
    Google1.0a, 2.0
    Gowalla2.0
    Instagram2.0
    Justin.tv1.0a
    LinkedIn1.0a
    Meetup1.0a
    Netflix1.0a
    Ohloh1.0
    OpenStreetMap1.0a
    picplz2.0
    Rdio1.0a
    Readability1.0a
    RunKeeper2.0
    SmugMug1.0a
    SoundCloud2.0
    TripIt1.0
    Tumblr1.0a
    Twitter1.0a
    Vimeo1.0a
    Windows Live2.0
    Yahoo!1.0a
    Yammer2.0
    + +## Tests + + $ npm install --dev + $ make test + +[![Build Status](https://secure.travis-ci.org/jaredhanson/passport-oauth.png)](http://travis-ci.org/jaredhanson/passport-oauth) + + +## Credits + + - [Jared Hanson](http://github.com/jaredhanson) + +## License + +[The MIT License](http://opensource.org/licenses/MIT) + +Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js new file mode 100644 index 0000000..72d4081 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js @@ -0,0 +1,46 @@ +/** + * `InternalOAuthError` error. + * + * InternalOAuthError wraps errors generated by node-oauth. By wrapping these + * objects, error messages can be formatted in a manner that aids in debugging + * OAuth issues. + * + * @api public + */ +function InternalOAuthError(message, err) { + Error.call(this); + Error.captureStackTrace(this, arguments.callee); + this.name = 'InternalOAuthError'; + this.message = message; + this.oauthError = err; +}; + +/** + * Inherit from `Error`. + */ +InternalOAuthError.prototype.__proto__ = Error.prototype; + +/** + * Returns a string representing the error. + * + * @return {String} + * @api public + */ +InternalOAuthError.prototype.toString = function() { + var m = this.message; + if (this.oauthError) { + if (this.oauthError instanceof Error) { + m += ' (' + this.oauthError + ')'; + } + else if (this.oauthError.statusCode && this.oauthError.data) { + m += ' (status: ' + this.oauthError.statusCode + ' data: ' + this.oauthError.data + ')'; + } + } + return m; +} + + +/** + * Expose `InternalOAuthError`. + */ +module.exports = InternalOAuthError; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js new file mode 100644 index 0000000..b124124 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js @@ -0,0 +1,20 @@ +/** + * Module dependencies. + */ +var OAuthStrategy = require('./strategies/oauth'); +var OAuth2Strategy = require('./strategies/oauth2'); +var InternalOAuthError = require('./errors/internaloautherror'); + + +/** + * Framework version. + */ +require('pkginfo')(module, 'version'); + +/** + * Expose constructors. + */ +exports.OAuthStrategy = OAuthStrategy; +exports.OAuth2Strategy = OAuth2Strategy; + +exports.InternalOAuthError = InternalOAuthError; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js new file mode 100644 index 0000000..eeed51d --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js @@ -0,0 +1,299 @@ +/** + * Module dependencies. + */ +var passport = require('passport') + , url = require('url') + , util = require('util') + , utils = require('./utils') + , OAuth = require('oauth').OAuth + , InternalOAuthError = require('../errors/internaloautherror'); + + +/** + * `OAuthStrategy` constructor. + * + * The OAuth authentication strategy authenticates requests using the OAuth + * protocol. + * + * OAuth provides a facility for delegated authentication, whereby users can + * authenticate using a third-party service such as Twitter. Delegating in this + * manner involves a sequence of events, including redirecting the user to the + * third-party service for authorization. Once authorization has been obtained, + * the user is redirected back to the application and a token can be used to + * obtain credentials. + * + * Applications must supply a `verify` callback which accepts a `token`, + * `tokenSecret` and service-specific `profile`, and then calls the `done` + * callback supplying a `user`, which should be set to `false` if the + * credentials are not valid. If an exception occured, `err` should be set. + * + * Options: + * - `requestTokenURL` URL used to obtain an unauthorized request token + * - `accessTokenURL` URL used to exchange a user-authorized request token for an access token + * - `userAuthorizationURL` URL used to obtain user authorization + * - `consumerKey` identifies client to service provider + * - `consumerSecret` secret used to establish ownership of the consumer key + * - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization + * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) + * + * Examples: + * + * passport.use(new OAuthStrategy({ + * requestTokenURL: 'https://www.example.com/oauth/request_token', + * accessTokenURL: 'https://www.example.com/oauth/access_token', + * userAuthorizationURL: 'https://www.example.com/oauth/authorize', + * consumerKey: '123-456-789', + * consumerSecret: 'shhh-its-a-secret' + * callbackURL: 'https://www.example.net/auth/example/callback' + * }, + * function(token, tokenSecret, profile, done) { + * User.findOrCreate(..., function (err, user) { + * done(err, user); + * }); + * } + * )); + * + * @param {Object} options + * @param {Function} verify + * @api public + */ +function OAuthStrategy(options, verify) { + options = options || {} + passport.Strategy.call(this); + this.name = 'oauth'; + this._verify = verify; + + if (!options.requestTokenURL) throw new Error('OAuthStrategy requires a requestTokenURL option'); + if (!options.accessTokenURL) throw new Error('OAuthStrategy requires a accessTokenURL option'); + if (!options.userAuthorizationURL) throw new Error('OAuthStrategy requires a userAuthorizationURL option'); + if (!options.consumerKey) throw new Error('OAuthStrategy requires a consumerKey option'); + if (options.consumerSecret === undefined) throw new Error('OAuthStrategy requires a consumerSecret option'); + if (!verify) throw new Error('OAuth authentication strategy requires a verify function'); + + // NOTE: The _oauth property is considered "protected". Subclasses are + // allowed to use it when making protected resource requests to retrieve + // the user profile. + this._oauth = new OAuth(options.requestTokenURL, options.accessTokenURL, + options.consumerKey, options.consumerSecret, + "1.0", null, options.signatureMethod || "HMAC-SHA1"); + + this._userAuthorizationURL = options.userAuthorizationURL; + this._callbackURL = options.callbackURL; + this._passReqToCallback = options.passReqToCallback; + this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile; + this._key = options.sessionKey || 'oauth'; +} + +/** + * Inherit from `passport.Strategy`. + */ +util.inherits(OAuthStrategy, passport.Strategy); + + +/** + * Authenticate request by delegating to a service provider using OAuth. + * + * @param {Object} req + * @api protected + */ +OAuthStrategy.prototype.authenticate = function(req, options) { + options = options || {}; + if (!req.session) { return this.error(new Error('OAuth authentication requires session support')); } + + var self = this; + + if (req.query && req.query['oauth_token']) { + // The request being authenticated contains an oauth_token parameter in the + // query portion of the URL. This indicates that the service provider has + // redirected the user back to the application, after authenticating the + // user and obtaining their authorization. + // + // The value of the oauth_token parameter is the request token. Together + // with knowledge of the token secret (stored in the session), the request + // token can be exchanged for an access token and token secret. + // + // This access token and token secret, along with the optional ability to + // fetch profile information from the service provider, is sufficient to + // establish the identity of the user. + + // Bail if the session does not contain the request token and corresponding + // secret. If this happens, it is most likely caused by initiating OAuth + // from a different host than that of the callback endpoint (for example: + // initiating from 127.0.0.1 but handling callbacks at localhost). + if (!req.session[self._key]) { return self.error(new Error('failed to find request token in session')); } + + var oauthToken = req.query['oauth_token']; + var oauthVerifier = req.query['oauth_verifier'] || null; + var oauthTokenSecret = req.session[self._key]["oauth_token_secret"]; + + // NOTE: The oauth_verifier parameter will be supplied in the query portion + // of the redirect URL, if the server supports OAuth 1.0a. + + this._oauth.getOAuthAccessToken(oauthToken, oauthTokenSecret, oauthVerifier, function(err, token, tokenSecret, params) { + if (err) { return self.error(new InternalOAuthError('failed to obtain access token', err)); } + + // The request token has been exchanged for an access token. Since the + // request token is a single-use token, that data can be removed from the + // session. + delete req.session[self._key]['oauth_token']; + delete req.session[self._key]['oauth_token_secret']; + if (Object.keys(req.session[self._key]).length == 0) { + delete req.session[self._key]; + } + + self._loadUserProfile(token, tokenSecret, params, function(err, profile) { + if (err) { return self.error(err); }; + + function verified(err, user, info) { + if (err) { return self.error(err); } + if (!user) { return self.fail(info); } + self.success(user, info); + } + + if (self._passReqToCallback) { + var arity = self._verify.length; + if (arity == 6) { + self._verify(req, token, tokenSecret, params, profile, verified); + } else { // arity == 5 + self._verify(req, token, tokenSecret, profile, verified); + } + } else { + var arity = self._verify.length; + if (arity == 5) { + self._verify(token, tokenSecret, params, profile, verified); + } else { // arity == 4 + self._verify(token, tokenSecret, profile, verified); + } + } + }); + }); + } else { + // In order to authenticate via OAuth, the application must obtain a request + // token from the service provider and redirect the user to the service + // provider to obtain their authorization. After authorization has been + // approved the user will be redirected back the application, at which point + // the application can exchange the request token for an access token. + // + // In order to successfully exchange the request token, its corresponding + // token secret needs to be known. The token secret will be temporarily + // stored in the session, so that it can be retrieved upon the user being + // redirected back to the application. + + var params = this.requestTokenParams(options); + var callbackURL = options.callbackURL || this._callbackURL; + if (callbackURL) { + var parsed = url.parse(callbackURL); + if (!parsed.protocol) { + // The callback URL is relative, resolve a fully qualified URL from the + // URL of the originating request. + callbackURL = url.resolve(utils.originalURL(req), callbackURL); + } + } + params['oauth_callback'] = callbackURL; + + this._oauth.getOAuthRequestToken(params, function(err, token, tokenSecret, params) { + if (err) { return self.error(new InternalOAuthError('failed to obtain request token', err)); } + + // NOTE: params will contain an oauth_callback_confirmed property set to + // true, if the server supports OAuth 1.0a. + // { oauth_callback_confirmed: 'true' } + + if (!req.session[self._key]) { req.session[self._key] = {}; } + req.session[self._key]['oauth_token'] = token; + req.session[self._key]['oauth_token_secret'] = tokenSecret; + + var parsed = url.parse(self._userAuthorizationURL, true); + parsed.query['oauth_token'] = token; + utils.merge(parsed.query, self.userAuthorizationParams(options)) + delete parsed.search; + var location = url.format(parsed); + self.redirect(location); + }); + } +} + +/** + * Retrieve user profile from service provider. + * + * OAuth-based authentication strategies can overrride this function in order to + * load the user's profile from the service provider. This assists applications + * (and users of those applications) in the initial registration process by + * automatically submitting required information. + * + * @param {String} accessToken + * @param {Function} done + * @api protected + */ +OAuthStrategy.prototype.userProfile = function(token, tokenSecret, params, done) { + return done(null, {}); +} + +/** + * Return extra parameters to be included in the request token request. + * + * Some OAuth providers require additional parameters to be included when + * issuing a request token. Since these parameters are not standardized by the + * OAuth specification, OAuth-based authentication strategies can overrride this + * function in order to populate these parameters as required by the provider. + * + * @param {Object} options + * @return {Object} + * @api protected + */ +OAuthStrategy.prototype.requestTokenParams = function(options) { + return {}; +} + +/** + * Return extra parameters to be included in the user authorization request. + * + * Some OAuth providers allow additional, non-standard parameters to be included + * when requesting authorization. Since these parameters are not standardized + * by the OAuth specification, OAuth-based authentication strategies can + * overrride this function in order to populate these parameters as required by + * the provider. + * + * @param {Object} options + * @return {Object} + * @api protected + */ +OAuthStrategy.prototype.userAuthorizationParams = function(options) { + return {}; +} + +/** + * Load user profile, contingent upon options. + * + * @param {String} accessToken + * @param {Function} done + * @api private + */ +OAuthStrategy.prototype._loadUserProfile = function(token, tokenSecret, params, done) { + var self = this; + + function loadIt() { + return self.userProfile(token, tokenSecret, params, done); + } + function skipIt() { + return done(null); + } + + if (typeof this._skipUserProfile == 'function' && this._skipUserProfile.length > 1) { + // async + this._skipUserProfile(token, tokenSecret, function(err, skip) { + if (err) { return done(err); } + if (!skip) { return loadIt(); } + return skipIt(); + }); + } else { + var skip = (typeof this._skipUserProfile == 'function') ? this._skipUserProfile() : this._skipUserProfile; + if (!skip) { return loadIt(); } + return skipIt(); + } +} + + +/** + * Expose `OAuthStrategy`. + */ +module.exports = OAuthStrategy; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js new file mode 100644 index 0000000..718a17b --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js @@ -0,0 +1,246 @@ +/** + * Module dependencies. + */ +var passport = require('passport') + , url = require('url') + , util = require('util') + , utils = require('./utils') + , OAuth2 = require('oauth').OAuth2 + , InternalOAuthError = require('../errors/internaloautherror'); + + +/** + * `OAuth2Strategy` constructor. + * + * The OAuth 2.0 authentication strategy authenticates requests using the OAuth + * 2.0 protocol. + * + * OAuth 2.0 provides a facility for delegated authentication, whereby users can + * authenticate using a third-party service such as Facebook. Delegating in + * this manner involves a sequence of events, including redirecting the user to + * the third-party service for authorization. Once authorization has been + * granted, the user is redirected back to the application and an authorization + * code can be used to obtain credentials. + * + * Applications must supply a `verify` callback which accepts an `accessToken`, + * `refreshToken` and service-specific `profile`, and then calls the `done` + * callback supplying a `user`, which should be set to `false` if the + * credentials are not valid. If an exception occured, `err` should be set. + * + * Options: + * - `authorizationURL` URL used to obtain an authorization grant + * - `tokenURL` URL used to obtain an access token + * - `clientID` identifies client to service provider + * - `clientSecret` secret used to establish ownership of the client identifer + * - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization + * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) + * + * Examples: + * + * passport.use(new OAuth2Strategy({ + * authorizationURL: 'https://www.example.com/oauth2/authorize', + * tokenURL: 'https://www.example.com/oauth2/token', + * clientID: '123-456-789', + * clientSecret: 'shhh-its-a-secret' + * callbackURL: 'https://www.example.net/auth/example/callback' + * }, + * function(accessToken, refreshToken, profile, done) { + * User.findOrCreate(..., function (err, user) { + * done(err, user); + * }); + * } + * )); + * + * @param {Object} options + * @param {Function} verify + * @api public + */ +function OAuth2Strategy(options, verify) { + options = options || {} + passport.Strategy.call(this); + this.name = 'oauth2'; + this._verify = verify; + + if (!options.authorizationURL) throw new Error('OAuth2Strategy requires a authorizationURL option'); + if (!options.tokenURL) throw new Error('OAuthStrategy requires a tokenURL option'); + if (!options.clientID) throw new Error('OAuth2Strategy requires a clientID option'); + if (!options.clientSecret) throw new Error('OAuth2Strategy requires a clientSecret option'); + + // NOTE: The _oauth2 property is considered "protected". Subclasses are + // allowed to use it when making protected resource requests to retrieve + // the user profile. + this._oauth2 = new OAuth2(options.clientID, options.clientSecret, + '', options.authorizationURL, options.tokenURL, options.customHeaders); + + this._callbackURL = options.callbackURL; + this._scope = options.scope; + this._scopeSeparator = options.scopeSeparator || ' '; + this._passReqToCallback = options.passReqToCallback; + this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile; +} + +/** + * Inherit from `passport.Strategy`. + */ +util.inherits(OAuth2Strategy, passport.Strategy); + + +/** + * Authenticate request by delegating to a service provider using OAuth 2.0. + * + * @param {Object} req + * @api protected + */ +OAuth2Strategy.prototype.authenticate = function(req, options) { + options = options || {}; + var self = this; + + if (req.query && req.query.error) { + // TODO: Error information pertaining to OAuth 2.0 flows is encoded in the + // query parameters, and should be propagated to the application. + return this.fail(); + } + + var callbackURL = options.callbackURL || this._callbackURL; + if (callbackURL) { + var parsed = url.parse(callbackURL); + if (!parsed.protocol) { + // The callback URL is relative, resolve a fully qualified URL from the + // URL of the originating request. + callbackURL = url.resolve(utils.originalURL(req), callbackURL); + } + } + + if (req.query && req.query.code) { + var code = req.query.code; + + // NOTE: The module oauth (0.9.5), which is a dependency, automatically adds + // a 'type=web_server' parameter to the percent-encoded data sent in + // the body of the access token request. This appears to be an + // artifact from an earlier draft of OAuth 2.0 (draft 22, as of the + // time of this writing). This parameter is not necessary, but its + // presence does not appear to cause any issues. + this._oauth2.getOAuthAccessToken(code, { grant_type: 'authorization_code', redirect_uri: callbackURL }, + function(err, accessToken, refreshToken, params) { + if (err) { return self.error(new InternalOAuthError('failed to obtain access token', err)); } + + self._loadUserProfile(accessToken, function(err, profile) { + if (err) { return self.error(err); }; + + function verified(err, user, info) { + if (err) { return self.error(err); } + if (!user) { return self.fail(info); } + self.success(user, info); + } + + if (self._passReqToCallback) { + var arity = self._verify.length; + if (arity == 6) { + self._verify(req, accessToken, refreshToken, params, profile, verified); + } else { // arity == 5 + self._verify(req, accessToken, refreshToken, profile, verified); + } + } else { + var arity = self._verify.length; + if (arity == 5) { + self._verify(accessToken, refreshToken, params, profile, verified); + } else { // arity == 4 + self._verify(accessToken, refreshToken, profile, verified); + } + } + }); + } + ); + } else { + // NOTE: The module oauth (0.9.5), which is a dependency, automatically adds + // a 'type=web_server' parameter to the query portion of the URL. + // This appears to be an artifact from an earlier draft of OAuth 2.0 + // (draft 22, as of the time of this writing). This parameter is not + // necessary, but its presence does not appear to cause any issues. + + var params = this.authorizationParams(options); + params['response_type'] = 'code'; + params['redirect_uri'] = callbackURL; + var scope = options.scope || this._scope; + if (scope) { + if (Array.isArray(scope)) { scope = scope.join(this._scopeSeparator); } + params.scope = scope; + } + var state = options.state; + if (state) { params.state = state; } + + var location = this._oauth2.getAuthorizeUrl(params); + this.redirect(location); + } +} + +/** + * Retrieve user profile from service provider. + * + * OAuth 2.0-based authentication strategies can overrride this function in + * order to load the user's profile from the service provider. This assists + * applications (and users of those applications) in the initial registration + * process by automatically submitting required information. + * + * @param {String} accessToken + * @param {Function} done + * @api protected + */ +OAuth2Strategy.prototype.userProfile = function(accessToken, done) { + return done(null, {}); +} + +/** + * Return extra parameters to be included in the authorization request. + * + * Some OAuth 2.0 providers allow additional, non-standard parameters to be + * included when requesting authorization. Since these parameters are not + * standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication + * strategies can overrride this function in order to populate these parameters + * as required by the provider. + * + * @param {Object} options + * @return {Object} + * @api protected + */ +OAuth2Strategy.prototype.authorizationParams = function(options) { + return {}; +} + +/** + * Load user profile, contingent upon options. + * + * @param {String} accessToken + * @param {Function} done + * @api private + */ +OAuth2Strategy.prototype._loadUserProfile = function(accessToken, done) { + var self = this; + + function loadIt() { + return self.userProfile(accessToken, done); + } + function skipIt() { + return done(null); + } + + if (typeof this._skipUserProfile == 'function' && this._skipUserProfile.length > 1) { + // async + this._skipUserProfile(accessToken, function(err, skip) { + if (err) { return done(err); } + if (!skip) { return loadIt(); } + return skipIt(); + }); + } else { + var skip = (typeof this._skipUserProfile == 'function') ? this._skipUserProfile() : this._skipUserProfile; + if (!skip) { return loadIt(); } + return skipIt(); + } +} + + +/** + * Expose `OAuth2Strategy`. + */ +module.exports = OAuth2Strategy; + diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js new file mode 100644 index 0000000..dd401b6 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js @@ -0,0 +1,46 @@ +/** + * Reconstructs the original URL of the request. + * + * This function builds a URL that corresponds the original URL requested by the + * client, including the protocol (http or https) and host. + * + * If the request passed through any proxies that terminate SSL, the + * `X-Forwarded-Proto` header is used to detect if the request was encrypted to + * the proxy. + * + * @return {String} + * @api private + */ +exports.originalURL = function(req) { + var headers = req.headers + , protocol = (req.connection.encrypted || req.headers['x-forwarded-proto'] == 'https') + ? 'https' + : 'http' + , host = headers.host + , path = req.url || ''; + return protocol + '://' + host + path; +}; + +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * utils.merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api private + */ + +exports.merge = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE new file mode 100644 index 0000000..f8049f8 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) <2010-2012> + +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/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile new file mode 100644 index 0000000..be7c339 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile @@ -0,0 +1,7 @@ +# +# Run all tests +# +test: + @@node_modules/.bin/vows tests/* --spec + +.PHONY: test install diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md new file mode 100644 index 0000000..620a13b --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md @@ -0,0 +1,91 @@ +node-oauth +=========== +A simple oauth API for node.js . This API allows users to authenticate against OAUTH providers, and thus act as OAuth consumers. It also has support for OAuth Echo, which is used for communicating with 3rd party media providers such as TwitPic and yFrog. + +Tested against Twitter (http://twitter.com), term.ie (http://term.ie/oauth/example/), TwitPic, and Yahoo! + +Also provides rudimentary OAuth2 support, tested against facebook, github, foursquare, google and Janrain. For more complete usage examples please take a look at connect-auth (http://github.com/ciaranj/connect-auth) + + +Installation +============== + + $ npm install oauth + + +Change History +============== + +* 0.9.8 + - OAuth: Support overly-strict OAuth server's that require whitespace separating the Authorization Header parameters (e.g. 500px.com) (Thanks to Christian Schwarz) + - OAuth: Fix incorrect double-encoding of PLAINTEXT OAuth connections (Thanks to Joe Rozner) + - OAuth: Minor safety check added when checking hostnames. (Thanks to Garrick Cheung) +* 0.9.7 + - OAuth2: Pass back any extra response data for calls to getOAuthAccessToken (Thanks to Tang Bo Hao) + - OAuth2: Don't force a https request if given a http url (Thanks to Damien Mathieu) + - OAuth2: Supports specifying a grant-type of 'refresh-token' (Thanks to Luke Baker) +* 0.9.6 + - OAuth2: Support for 302 redirects (Thanks Patrick Negri). + - OAuth1/2: Some code tidying. ( Thanks to Raoul Millais ) +* 0.9.5 + - OAuth1: Allow usage of HTTP verbs other than GET for retrieving the access and request tokens (Thanks to Raoul Millais) +* 0.9.4 + - OAuth1/2: Support for OAuth providers that drop connections (don't send response lengths? [Google]) + - OAuth2: Change getOAuthAccessToken to POST rather than GET ( Possible Breaking change!!! ... re-tested against Google, Github, Facebook, FourSquare and Janrain and seems ok .. is closer to the spec (v20) ) +* 0.9.3 + - OAuth1: Adds support for following 301 redirects (Thanks bdickason) +* 0.9.2 + - OAuth1: Correct content length calculated for non-ascii post bodies (Thanks selead) + - OAuth1: Allowed for configuration of the 'access token' name used when requesting protected resources (OAuth2) +* 0.9.1 + - OAuth1: Added support for automatically following 302 redirects (Thanks neyric) + - OAuth1: Added support for OAuth Echo (Thanks Ryan LeFevre). + - OAuth1: Improved handling of 2xx responses (Thanks Neil Mansilla). +* 0.9.0 + - OAuth1/2: Compatibility fixes to bring node-oauth up to speed with node.js 0.4x [thanks to Rasmus Andersson for starting the work ] +* 0.8.4 + - OAuth1: Fixed issue #14 (Parameter ordering ignored encodings). + - OAuth1: Added support for repeated parameter names. + - OAuth1/2: Implements issue #15 (Use native SHA1 if available, 10x speed improvement!). + - OAuth2: Fixed issue #16 (Should use POST when requesting access tokens.). + - OAuth2: Fixed Issue #17 (OAuth2 spec compliance). + - OAuth1: Implemented enhancement #13 (Adds support for PUT & DELETE http verbs). + - OAuth1: Fixes issue #18 (Complex/Composite url arguments [thanks novemberborn]) +* 0.8.3 + - OAuth1: Fixed an issue where the auth header code depended on the Array's toString method (Yohei Sasaki) Updated the getOAuthRequestToken method so we can access google's OAuth secured methods. Also re-implemented and fleshed out the test suite. +* 0.8.2 + - OAuth1: The request returning methods will now write the POST body if provided (Chris Anderson), the code responsible for manipulating the headers is a bit safe now when working with other code (Paul McKellar) + - Package: Tweaked the package.json to use index.js instead of main.js +* 0.8.1 + - OAuth1: Added mechanism to get hold of a signed Node Request object, ready for attaching response listeners etc. (Perfect for streaming APIs) +* 0.8.0 + - OAuth1: Standardised method capitalisation, the old getOauthAccessToken is now getOAuthAccessToken (Breaking change to existing code) +* 0.7.7 + - OAuth1: Looks like non oauth_ parameters where appearing within the Authorization headers, which I believe to be incorrect. +* 0.7.6 + - OAuth1: Added in oauth_verifier property to getAccessToken required for 1.0A +* 0.7.5 + - Package: Added in a main.js to simplify the require'ing of OAuth +* 0.7.4 + - OAuth1: Minor change to add an error listener to the OAuth client (thanks troyk) +* 0.7.3 + - OAuth2: Now sends a Content-Length Http header to keep nginx happy :) +* 0.7.2 + - OAuth1: Fixes some broken unit tests! +* 0.7.0 + - OAuth1/2: Introduces support for HTTPS end points and callback URLS for OAuth 1.0A and Oauth 2 (Please be aware that this was a breaking change to the constructor arguments order) + +Contributors (In no particular order) +===================================== + +* Ciaran Jessup - ciaranj@gmail.com +* Mark Wubben - http://equalmedia.com/ +* Ryan LeFevre - http://meltingice.net +* Raoul Millais +* Patrick Negri - http://github.com/pnegri +* Tang Bo Hao - http://github.com/btspoony +* Damien Mathieu - http://42.dmathieu.com +* Luke Baker - http://github.com/lukebaker +* Christian Schwarz - http://github.com/chrischw/ +* Joe Rozer - http://www.deadbytes.net +* Garrick Cheung - http://www.garrickcheung.com/ diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js new file mode 100644 index 0000000..3c7bf7f --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js @@ -0,0 +1,168 @@ +var express = require('express'), + OAuth = require('oauth').OAuth, + querystring = require('querystring'); + +// Setup the Express.js server +var app = express.createServer(); +app.use(express.logger()); +app.use(express.bodyParser()); +app.use(express.cookieParser()); +app.use(express.session({ + secret: "skjghskdjfhbqigohqdiouk" +})); + +// Home Page +app.get('/', function(req, res){ + if(!req.session.oauth_access_token) { + res.redirect("/google_login"); + } + else { + res.redirect("/google_contacts"); + } +}); + +// Request an OAuth Request Token, and redirects the user to authorize it +app.get('/google_login', function(req, res) { + + var getRequestTokenUrl = "https://www.google.com/accounts/OAuthGetRequestToken"; + + // GData specifid: scopes that wa want access to + var gdataScopes = [ + querystring.escape("https://www.google.com/m8/feeds/"), + querystring.escape("https://www.google.com/calendar/feeds/") + ]; + + var oa = new OAuth(getRequestTokenUrl+"?scope="+gdataScopes.join('+'), + "https://www.google.com/accounts/OAuthGetAccessToken", + "anonymous", + "anonymous", + "1.0", + "http://localhost:3000/google_cb"+( req.param('action') && req.param('action') != "" ? "?action="http://github.com/+querystring.escape(req.param('action')) : "" ), + "HMAC-SHA1"); + + oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){ + if(error) { + console.log('error'); + console.log(error); + } + else { + // store the tokens in the session + req.session.oa = oa; + req.session.oauth_token = oauth_token; + req.session.oauth_token_secret = oauth_token_secret; + + // redirect the user to authorize the token + res.redirect("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="+oauth_token); + } + }) + +}); + +// Callback for the authorization page +app.get('/google_cb', function(req, res) { + + // get the OAuth access token with the 'oauth_verifier' that we received + + var oa = new OAuth(req.session.oa._requestUrl, + req.session.oa._accessUrl, + req.session.oa._consumerKey, + req.session.oa._consumerSecret, + req.session.oa._version, + req.session.oa._authorize_callback, + req.session.oa._signatureMethod); + + console.log(oa); + + oa.getOAuthAccessToken( + req.session.oauth_token, + req.session.oauth_token_secret, + req.param('oauth_verifier'), + function(error, oauth_access_token, oauth_access_token_secret, results2) { + + if(error) { + console.log('error'); + console.log(error); + } + else { + + // store the access token in the session + req.session.oauth_access_token = oauth_access_token; + req.session.oauth_access_token_secret = oauth_access_token_secret; + + res.redirect((req.param('action') && req.param('action') != "") ? req.param('action') : "/google_contacts"); + } + + }); + +}); + + +function require_google_login(req, res, next) { + if(!req.session.oauth_access_token) { + res.redirect("/google_login?action="+querystring.escape(req.originalUrl)); + return; + } + next(); +}; + +app.get('/google_contacts', require_google_login, function(req, res) { + var oa = new OAuth(req.session.oa._requestUrl, + req.session.oa._accessUrl, + req.session.oa._consumerKey, + req.session.oa._consumerSecret, + req.session.oa._version, + req.session.oa._authorize_callback, + req.session.oa._signatureMethod); + + console.log(oa); + + // Example using GData API v3 + // GData Specific Header + oa._headers['GData-Version'] = '3.0'; + + oa.getProtectedResource( + "https://www.google.com/m8/feeds/contacts/default/full?alt=json", + "GET", + req.session.oauth_access_token, + req.session.oauth_access_token_secret, + function (error, data, response) { + + var feed = JSON.parse(data); + + res.render('google_contacts.ejs', { + locals: { feed: feed } + }); + }); + +}); + +app.get('/google_calendars', require_google_login, function(req, res) { + var oa = new OAuth(req.session.oa._requestUrl, + req.session.oa._accessUrl, + req.session.oa._consumerKey, + req.session.oa._consumerSecret, + req.session.oa._version, + req.session.oa._authorize_callback, + req.session.oa._signatureMethod); + // Example using GData API v2 + // GData Specific Header + oa._headers['GData-Version'] = '2'; + + oa.getProtectedResource( + "https://www.google.com/calendar/feeds/default/allcalendars/full?alt=jsonc", + "GET", + req.session.oauth_access_token, + req.session.oauth_access_token_secret, + function (error, data, response) { + + var feed = JSON.parse(data); + + res.render('google_calendars.ejs', { + locals: { feed: feed } + }); + }); + +}); + +app.listen(3000); +console.log("listening on http://localhost:3000"); diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs new file mode 100644 index 0000000..15b826f --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs @@ -0,0 +1,21 @@ + +

    Check google_contacts

    + +

    Google Calendars

    + +<% for(var i = 0 ; i < feed.data.items.length ; i++ ) { + + var calendar = feed.data.items[i]; %> +
    + +

    "><%= calendar["title"] %>

    + +

    canEdit: <%= calendar["canEdit"] %>

    +

    accessLevel: <%= calendar["accessLevel"] %>

    +

    timeZone: <%= calendar["timeZone"] %>

    +

    kind: <%= calendar["kind"] %>

    +

    updated: <%= calendar["updated"] %>

    +

    created: <%= calendar["created"] %>

    + +
    +<% } %> \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs new file mode 100644 index 0000000..a2050b2 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs @@ -0,0 +1,24 @@ + +

    Check google_calendars

    + +

    Google Contacts

    + +<% for(var i = 0 ; i < feed.feed.entry.length ; i++ ) { + + var contact = feed.feed.entry[i]; %> + +
    + + <%= contact["title"]["$t"] %> + <% emails = contact["gd$email"] %> + +
      + <% for(var j = 0 ; j < emails.length ; j++) { %> +
    • <%= emails[j]["address" ]%>
    • + <% } %> +
    + +
    + + +<% } %> diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs new file mode 100644 index 0000000..8d1ac6d --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs @@ -0,0 +1,9 @@ + + + + + +<%- body %> + + + \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js new file mode 100644 index 0000000..91af05d --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js @@ -0,0 +1,31 @@ +var util= require('util') + +var OAuth= require('../lib/oauth').OAuth; + +var oa= new OAuth("http://term.ie/oauth/example/request_token.php", + "http://term.ie/oauth/example/access_token.php", + "key", + "secret", + "1.0", + null, + "HMAC-SHA1") + +oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){ + if(error) util.puts('error :' + error) + else { + util.puts('oauth_token :' + oauth_token) + util.puts('oauth_token_secret :' + oauth_token_secret) + util.puts('requestoken results :' + util.inspect(results)) + util.puts("Requesting access token") + oa.getOAuthAccessToken(oauth_token, oauth_token_secret, function(error, oauth_access_token, oauth_access_token_secret, results2) { + util.puts('oauth_access_token :' + oauth_access_token) + util.puts('oauth_token_secret :' + oauth_access_token_secret) + util.puts('accesstoken results :' + util.inspect(results2)) + util.puts("Requesting access token") + var data= ""; + oa.getProtectedResource("http://term.ie/oauth/example/echo_api.php?foo=bar&too=roo", "GET", oauth_access_token, oauth_access_token_secret, function (error, data, response) { + util.puts(data); + }); + }); + } +}) diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js new file mode 100644 index 0000000..e20716d --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js @@ -0,0 +1,3 @@ +exports.OAuth = require("./lib/oauth").OAuth; +exports.OAuthEcho = require("./lib/oauth").OAuthEcho; +exports.OAuth2 = require("./lib/oauth2").OAuth2; \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js new file mode 100644 index 0000000..69fc300 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js @@ -0,0 +1,4 @@ +// Returns true if this is a host that closes *before* it ends?!?! +module.exports.isAnEarlyCloseHost= function( hostName ) { + return hostName && hostName.match(".*google(apis)?.com$") +} \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js new file mode 100644 index 0000000..be3c6d6 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js @@ -0,0 +1,550 @@ +var crypto= require('crypto'), + sha1= require('./sha1'), + http= require('http'), + https= require('https'), + URL= require('url'), + querystring= require('querystring'), + OAuthUtils= require('./_utils'); + +exports.OAuth= function(requestUrl, accessUrl, consumerKey, consumerSecret, version, authorize_callback, signatureMethod, nonceSize, customHeaders) { + this._isEcho = false; + + this._requestUrl= requestUrl; + this._accessUrl= accessUrl; + this._consumerKey= consumerKey; + this._consumerSecret= this._encodeData( consumerSecret ); + this._version= version; + if( authorize_callback === undefined ) { + this._authorize_callback= "oob"; + } + else { + this._authorize_callback= authorize_callback; + } + + if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1") + throw new Error("Un-supported signature method: " + signatureMethod ) + this._signatureMethod= signatureMethod; + this._nonceSize= nonceSize || 32; + this._headers= customHeaders || {"Accept" : "*/*", + "Connection" : "close", + "User-Agent" : "Node authentication"} + this._clientOptions= this._defaultClientOptions= {"requestTokenHttpMethod": "POST", + "accessTokenHttpMethod": "POST"}; + this._oauthParameterSeperator = ","; +}; + +exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) { + this._isEcho = true; + + this._realm= realm; + this._verifyCredentials = verify_credentials; + this._consumerKey= consumerKey; + this._consumerSecret= this._encodeData( consumerSecret ); + this._version= version; + + if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1") + throw new Error("Un-supported signature method: " + signatureMethod ); + this._signatureMethod= signatureMethod; + this._nonceSize= nonceSize || 32; + this._headers= customHeaders || {"Accept" : "*/*", + "Connection" : "close", + "User-Agent" : "Node authentication"}; + this._oauthParameterSeperator = ","; +} + +exports.OAuthEcho.prototype = exports.OAuth.prototype; + +exports.OAuth.prototype._getTimestamp= function() { + return Math.floor( (new Date()).getTime() / 1000 ); +} + +exports.OAuth.prototype._encodeData= function(toEncode){ + if( toEncode == null || toEncode == "" ) return "" + else { + var result= encodeURIComponent(toEncode); + // Fix the mismatch between OAuth's RFC3986's and Javascript's beliefs in what is right and wrong ;) + return result.replace(/\!/g, "%21") + .replace(/\'/g, "%27") + .replace(/\(/g, "%28") + .replace(/\)/g, "%29") + .replace(/\*/g, "%2A"); + } +} + +exports.OAuth.prototype._decodeData= function(toDecode) { + if( toDecode != null ) { + toDecode = toDecode.replace(/\+/g, " "); + } + return decodeURIComponent( toDecode); +} + +exports.OAuth.prototype._getSignature= function(method, url, parameters, tokenSecret) { + var signatureBase= this._createSignatureBase(method, url, parameters); + return this._createSignature( signatureBase, tokenSecret ); +} + +exports.OAuth.prototype._normalizeUrl= function(url) { + var parsedUrl= URL.parse(url, true) + var port =""; + if( parsedUrl.port ) { + if( (parsedUrl.protocol == "http:" && parsedUrl.port != "80" ) || + (parsedUrl.protocol == "https:" && parsedUrl.port != "443") ) { + port= ":" + parsedUrl.port; + } + } + + if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/"; + + return parsedUrl.protocol + "//" + parsedUrl.hostname + port + parsedUrl.pathname; +} + +// Is the parameter considered an OAuth parameter +exports.OAuth.prototype._isParameterNameAnOAuthParameter= function(parameter) { + var m = parameter.match('^oauth_'); + if( m && ( m[0] === "oauth_" ) ) { + return true; + } + else { + return false; + } +}; + +// build the OAuth request authorization header +exports.OAuth.prototype._buildAuthorizationHeaders= function(orderedParameters) { + var authHeader="OAuth "; + if( this._isEcho ) { + authHeader += 'realm="' + this._realm + '",'; + } + + for( var i= 0 ; i < orderedParameters.length; i++) { + // Whilst the all the parameters should be included within the signature, only the oauth_ arguments + // should appear within the authorization header. + if( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) { + authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\""+ this._oauthParameterSeperator; + } + } + + authHeader= authHeader.substring(0, authHeader.length-this._oauthParameterSeperator.length); + return authHeader; +} + +// Takes an object literal that represents the arguments, and returns an array +// of argument/value pairs. +exports.OAuth.prototype._makeArrayOfArgumentsHash= function(argumentsHash) { + var argument_pairs= []; + for(var key in argumentsHash ) { + var value= argumentsHash[key]; + if( Array.isArray(value) ) { + for(var i=0;i= 200 && response.statusCode <= 299 ) { + callback(null, data, response); + } else { + // Follow 301 or 302 redirects with Location HTTP header + if((response.statusCode == 301 || response.statusCode == 302) && response.headers && response.headers.location) { + self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback); + } + else { + callback({ statusCode: response.statusCode, data: data }, data, response); + } + } + } + } + + request.on('response', function (response) { + response.setEncoding('utf8'); + response.on('data', function (chunk) { + data+=chunk; + }); + response.on('end', function () { + passBackControl( response ); + }); + response.on('close', function () { + if( allowEarlyClose ) { + passBackControl( response ); + } + }); + }); + + request.on("error", function(err) { + callbackCalled= true; + callback( err ) + }); + + if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) { + request.write(post_body); + } + request.end(); + } + else { + if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) { + request.write(post_body); + } + return request; + } + + return; +} + +exports.OAuth.prototype.setClientOptions= function(options) { + var key, + mergedOptions= {}, + hasOwnProperty= Object.prototype.hasOwnProperty; + + for( key in this._defaultClientOptions ) { + if( !hasOwnProperty.call(options, key) ) { + mergedOptions[key]= this._defaultClientOptions[key]; + } else { + mergedOptions[key]= options[key]; + } + } + + this._clientOptions= mergedOptions; +}; + +exports.OAuth.prototype.getOAuthAccessToken= function(oauth_token, oauth_token_secret, oauth_verifier, callback) { + var extraParams= {}; + if( typeof oauth_verifier == "function" ) { + callback= oauth_verifier; + } else { + extraParams.oauth_verifier= oauth_verifier; + } + + this._performSecureRequest( oauth_token, oauth_token_secret, this._clientOptions.accessTokenHttpMethod, this._accessUrl, extraParams, null, null, function(error, data, response) { + if( error ) callback(error); + else { + var results= querystring.parse( data ); + var oauth_access_token= results["oauth_token"]; + delete results["oauth_token"]; + var oauth_access_token_secret= results["oauth_token_secret"]; + delete results["oauth_token_secret"]; + callback(null, oauth_access_token, oauth_access_token_secret, results ); + } + }) +} + +// Deprecated +exports.OAuth.prototype.getProtectedResource= function(url, method, oauth_token, oauth_token_secret, callback) { + this._performSecureRequest( oauth_token, oauth_token_secret, method, url, null, "", null, callback ); +} + +exports.OAuth.prototype.delete= function(url, oauth_token, oauth_token_secret, callback) { + return this._performSecureRequest( oauth_token, oauth_token_secret, "DELETE", url, null, "", null, callback ); +} + +exports.OAuth.prototype.get= function(url, oauth_token, oauth_token_secret, callback) { + return this._performSecureRequest( oauth_token, oauth_token_secret, "GET", url, null, "", null, callback ); +} + +exports.OAuth.prototype._putOrPost= function(method, url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { + var extra_params= null; + if( typeof post_content_type == "function" ) { + callback= post_content_type; + post_content_type= null; + } + if( typeof post_body != "string" ) { + post_content_type= "application/x-www-form-urlencoded" + extra_params= post_body; + post_body= null; + } + return this._performSecureRequest( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ); +} + + +exports.OAuth.prototype.put= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { + return this._putOrPost("PUT", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback); +} + +exports.OAuth.prototype.post= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { + return this._putOrPost("POST", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback); +} + +/** + * Gets a request token from the OAuth provider and passes that information back + * to the calling code. + * + * The callback should expect a function of the following form: + * + * function(err, token, token_secret, parsedQueryString) {} + * + * This method has optional parameters so can be called in the following 2 ways: + * + * 1) Primary use case: Does a basic request with no extra parameters + * getOAuthRequestToken( callbackFunction ) + * + * 2) As above but allows for provision of extra parameters to be sent as part of the query to the server. + * getOAuthRequestToken( extraParams, callbackFunction ) + * + * N.B. This method will HTTP POST verbs by default, if you wish to override this behaviour you will + * need to provide a requestTokenHttpMethod option when creating the client. + * + **/ +exports.OAuth.prototype.getOAuthRequestToken= function( extraParams, callback ) { + if( typeof extraParams == "function" ){ + callback = extraParams; + extraParams = {}; + } + // Callbacks are 1.0A related + if( this._authorize_callback ) { + extraParams["oauth_callback"]= this._authorize_callback; + } + this._performSecureRequest( null, null, this._clientOptions.requestTokenHttpMethod, this._requestUrl, extraParams, null, null, function(error, data, response) { + if( error ) callback(error); + else { + var results= querystring.parse(data); + + var oauth_token= results["oauth_token"]; + var oauth_token_secret= results["oauth_token_secret"]; + delete results["oauth_token"]; + delete results["oauth_token_secret"]; + callback(null, oauth_token, oauth_token_secret, results ); + } + }); +} + +exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) { + + if( method === undefined ) { + var method= "GET"; + } + + var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {}); + var parsedUrl= URL.parse( url, false ); + + var query=""; + for( var i= 0 ; i < orderedParameters.length; i++) { + query+= orderedParameters[i][0]+"="+ this._encodeData(orderedParameters[i][1]) + "&"; + } + query= query.substring(0, query.length-1); + + return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query; +}; + +exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method) { + if( method === undefined ) { + var method= "GET"; + } + + var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {}); + return this._buildAuthorizationHeaders(orderedParameters); +}; diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js new file mode 100644 index 0000000..191d3ef --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js @@ -0,0 +1,161 @@ +var querystring= require('querystring'), + crypto= require('crypto'), + https= require('https'), + http= require('http'), + URL= require('url'), + OAuthUtils= require('./_utils'); + +exports.OAuth2= function(clientId, clientSecret, baseSite, authorizePath, accessTokenPath) { + this._clientId= clientId; + this._clientSecret= clientSecret; + this._baseSite= baseSite; + this._authorizeUrl= authorizePath || "/oauth/authorize"; + this._accessTokenUrl= accessTokenPath || "/oauth/access_token"; + this._accessTokenName= "access_token"; +} + +// This 'hack' method is required for sites that don't use +// 'access_token' as the name of the access token (for requests). +// ( http://tools.ietf.org/html/draft-ietf-oauth-v2-16#section-7 ) +// it isn't clear what the correct value should be atm, so allowing +// for specific (temporary?) override for now. +exports.OAuth2.prototype.setAccessTokenName= function ( name ) { + this._accessTokenName= name; +} + +exports.OAuth2.prototype._getAccessTokenUrl= function() { + return this._baseSite + this._accessTokenUrl; /* + "?" + querystring.stringify(params); */ +} + +exports.OAuth2.prototype._request= function(method, url, headers, post_body, access_token, callback) { + + var http_library= https; + var creds = crypto.createCredentials({ }); + var parsedUrl= URL.parse( url, true ); + if( parsedUrl.protocol == "https:" && !parsedUrl.port ) { + parsedUrl.port= 443; + } + + // As this is OAUth2, we *assume* https unless told explicitly otherwise. + if( parsedUrl.protocol != "https:" ) { + http_library= http; + } + + var realHeaders= {}; + if( headers ) { + for(var key in headers) { + realHeaders[key] = headers[key]; + } + } + realHeaders['Host']= parsedUrl.host; + + realHeaders['Content-Length']= post_body ? Buffer.byteLength(post_body) : 0; + if( access_token ) { + if( ! parsedUrl.query ) parsedUrl.query= {}; + parsedUrl.query[this._accessTokenName]= access_token; + } + + var result= ""; + var queryStr= querystring.stringify(parsedUrl.query); + if( queryStr ) queryStr= "?" + queryStr; + var options = { + host:parsedUrl.hostname, + port: parsedUrl.port, + path: parsedUrl.pathname + queryStr, + method: method, + headers: realHeaders + }; + + // Some hosts *cough* google appear to close the connection early / send no content-length header + // allow this behaviour. + var allowEarlyClose= OAuthUtils.isAnEarlyCloseHost(options.host); + var callbackCalled= false; + function passBackControl( response, result ) { + if(!callbackCalled) { + callbackCalled=true; + if( response.statusCode != 200 && (response.statusCode != 301) && (response.statusCode != 302) ) { + callback({ statusCode: response.statusCode, data: result }); + } else { + callback(null, result, response); + } + } + } + + var request = http_library.request(options, function (response) { + response.on("data", function (chunk) { + result+= chunk + }); + response.on("close", function (err) { + if( allowEarlyClose ) { + passBackControl( response, result ); + } + }); + response.addListener("end", function () { + passBackControl( response, result ); + }); + }); + request.on('error', function(e) { + callbackCalled= true; + callback(e); + }); + + if( method == 'POST' && post_body ) { + request.write(post_body); + } + request.end(); +} + + +exports.OAuth2.prototype.getAuthorizeUrl= function( params ) { + var params= params || {}; + params['client_id'] = this._clientId; + params['type'] = 'web_server'; + return this._baseSite + this._authorizeUrl + "?" + querystring.stringify(params); +} + +exports.OAuth2.prototype.getOAuthAccessToken= function(code, params, callback) { + var params= params || {}; + params['client_id'] = this._clientId; + params['client_secret'] = this._clientSecret; + params['type']= 'web_server'; + var codeParam = (params.grant_type === 'refresh_token') ? 'refresh_token' : 'code'; + params[codeParam]= code; + + var post_data= querystring.stringify( params ); + var post_headers= { + 'Content-Type': 'application/x-www-form-urlencoded' + }; + + + this._request("POST", this._getAccessTokenUrl(), post_headers, post_data, null, function(error, data, response) { + if( error ) callback(error); + else { + var results; + try { + // As of http://tools.ietf.org/html/draft-ietf-oauth-v2-07 + // responses should be in JSON + results= JSON.parse( data ); + } + catch(e) { + // .... However both Facebook + Github currently use rev05 of the spec + // and neither seem to specify a content-type correctly in their response headers :( + // clients of these services will suffer a *minor* performance cost of the exception + // being thrown + results= querystring.parse( data ); + } + var access_token= results["access_token"]; + var refresh_token= results["refresh_token"]; + delete results["refresh_token"]; + callback(null, access_token, refresh_token, results); // callback results =-= + } + }); +} + +// Deprecated +exports.OAuth2.prototype.getProtectedResource= function(url, access_token, callback) { + this._request("GET", url, {}, "", access_token, callback ); +} + +exports.OAuth2.prototype.get= function(url, access_token, callback) { + this._request("GET", url, {}, "", access_token, callback ); +} diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js new file mode 100644 index 0000000..d73277a --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js @@ -0,0 +1,334 @@ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS 180-1 + * Version 2.2 Copyright Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 1; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_sha1(s) { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); } +function b64_sha1(s) { return rstr2b64(rstr_sha1(str2rstr_utf8(s))); } +function any_sha1(s, e) { return rstr2any(rstr_sha1(str2rstr_utf8(s)), e); } +function hex_hmac_sha1(k, d) + { return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); } +function b64_hmac_sha1(k, d) + { return rstr2b64(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); } +function any_hmac_sha1(k, d, e) + { return rstr2any(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d)), e); } + +/* + * Perform a simple self-test to see if the VM is working + */ +function sha1_vm_test() +{ + return hex_sha1("abc").toLowerCase() == "a9993e364706816aba3e25717850c26c9cd0d89d"; +} + +/* + * Calculate the SHA1 of a raw string + */ +function rstr_sha1(s) +{ + return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8)); +} + +/* + * Calculate the HMAC-SHA1 of a key and some data (raw strings) + */ +function rstr_hmac_sha1(key, data) +{ + var bkey = rstr2binb(key); + if(bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8); + return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160)); +} + +/* + * Convert a raw string to a hex string + */ +function rstr2hex(input) +{ + try { hexcase } catch(e) { hexcase=0; } + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var output = ""; + var x; + for(var i = 0; i < input.length; i++) + { + x = input.charCodeAt(i); + output += hex_tab.charAt((x >>> 4) & 0x0F) + + hex_tab.charAt( x & 0x0F); + } + return output; +} + +/* + * Convert a raw string to a base-64 string + */ +function rstr2b64(input) +{ + try { b64pad } catch(e) { b64pad=''; } + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var output = ""; + var len = input.length; + for(var i = 0; i < len; i += 3) + { + var triplet = (input.charCodeAt(i) << 16) + | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0) + | (i + 2 < len ? input.charCodeAt(i+2) : 0); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > input.length * 8) output += b64pad; + else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F); + } + } + return output; +} + +/* + * Convert a raw string to an arbitrary string encoding + */ +function rstr2any(input, encoding) +{ + var divisor = encoding.length; + var remainders = Array(); + var i, q, x, quotient; + + /* Convert to an array of 16-bit big-endian values, forming the dividend */ + var dividend = Array(Math.ceil(input.length / 2)); + for(i = 0; i < dividend.length; i++) + { + dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1); + } + + /* + * Repeatedly perform a long division. The binary array forms the dividend, + * the length of the encoding is the divisor. Once computed, the quotient + * forms the dividend for the next step. We stop when the dividend is zero. + * All remainders are stored for later use. + */ + while(dividend.length > 0) + { + quotient = Array(); + x = 0; + for(i = 0; i < dividend.length; i++) + { + x = (x << 16) + dividend[i]; + q = Math.floor(x / divisor); + x -= q * divisor; + if(quotient.length > 0 || q > 0) + quotient[quotient.length] = q; + } + remainders[remainders.length] = x; + dividend = quotient; + } + + /* Convert the remainders to the output string */ + var output = ""; + for(i = remainders.length - 1; i >= 0; i--) + output += encoding.charAt(remainders[i]); + + /* Append leading zero equivalents */ + var full_length = Math.ceil(input.length * 8 / + (Math.log(encoding.length) / Math.log(2))) + for(i = output.length; i < full_length; i++) + output = encoding[0] + output; + + return output; +} + +/* + * Encode a string as utf-8. + * For efficiency, this assumes the input is valid utf-16. + */ +function str2rstr_utf8(input) +{ + var output = ""; + var i = -1; + var x, y; + + while(++i < input.length) + { + /* Decode utf-16 surrogate pairs */ + x = input.charCodeAt(i); + y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; + if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) + { + x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF); + i++; + } + + /* Encode output as utf-8 */ + if(x <= 0x7F) + output += String.fromCharCode(x); + else if(x <= 0x7FF) + output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F), + 0x80 | ( x & 0x3F)); + else if(x <= 0xFFFF) + output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), + 0x80 | ((x >>> 6 ) & 0x3F), + 0x80 | ( x & 0x3F)); + else if(x <= 0x1FFFFF) + output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), + 0x80 | ((x >>> 12) & 0x3F), + 0x80 | ((x >>> 6 ) & 0x3F), + 0x80 | ( x & 0x3F)); + } + return output; +} + +/* + * Encode a string as utf-16 + */ +function str2rstr_utf16le(input) +{ + var output = ""; + for(var i = 0; i < input.length; i++) + output += String.fromCharCode( input.charCodeAt(i) & 0xFF, + (input.charCodeAt(i) >>> 8) & 0xFF); + return output; +} + +function str2rstr_utf16be(input) +{ + var output = ""; + for(var i = 0; i < input.length; i++) + output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, + input.charCodeAt(i) & 0xFF); + return output; +} + +/* + * Convert a raw string to an array of big-endian words + * Characters >255 have their high-byte silently ignored. + */ +function rstr2binb(input) +{ + var output = Array(input.length >> 2); + for(var i = 0; i < output.length; i++) + output[i] = 0; + for(var i = 0; i < input.length * 8; i += 8) + output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32); + return output; +} + +/* + * Convert an array of big-endian words to a string + */ +function binb2rstr(input) +{ + var output = ""; + for(var i = 0; i < input.length * 32; i += 8) + output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF); + return output; +} + +/* + * Calculate the SHA-1 of an array of big-endian words, and a bit length + */ +function binb_sha1(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w = Array(80); + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var e = -1009589776; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + var olde = e; + + for(var j = 0; j < 80; j++) + { + if(j < 16) w[j] = x[i + j]; + else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + var t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), + safe_add(safe_add(e, w[j]), sha1_kt(j))); + e = d; + d = c; + c = bit_rol(b, 30); + b = a; + a = t; + } + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + e = safe_add(e, olde); + } + return Array(a, b, c, d, e); + +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1_ft(t, b, c, d) +{ + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1_kt(t) +{ + return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : + (t < 60) ? -1894007588 : -899497514; +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +exports.HMACSHA1= function(key, data) { + return b64_hmac_sha1(key, data); +} \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json new file mode 100644 index 0000000..e685046 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json @@ -0,0 +1,19 @@ +{ "name" : "oauth" +, "description" : "Library for interacting with OAuth 1.0, 1.0A, 2 and Echo. Provides simplified client access and allows for construction of more complex apis and OAuth providers." +, "version" : "0.9.8" +, "directories" : { "lib" : "./lib" } +, "main" : "index.js" +, "author" : "Ciaran Jessup " +, "repository" : { "type":"git", "url":"http://github.com/ciaranj/node-oauth.git" } +, "devDependencies": { + "vows": "0.5.x" + } +, "scripts": { + "test": "make test" + } +, "licenses" : + [ { "type" : "MIT" + , "url" : "http://github.com/ciaranj/node-oauth/raw/master/LICENSE" + } + ] +} diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js new file mode 100644 index 0000000..b0a4a90 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js @@ -0,0 +1,792 @@ +var vows = require('vows'), + assert = require('assert'), + events = require('events'), + OAuth= require('../lib/oauth').OAuth, + OAuthEcho= require('../lib/oauth').OAuthEcho; + +var DummyResponse =function( statusCode ) { + this.statusCode= statusCode; + this.headers= {}; +} +DummyResponse.prototype= events.EventEmitter.prototype; +DummyResponse.prototype.setEncoding= function() {} + +var DummyRequest =function( response ) { + this.response= response; +} +DummyRequest.prototype= events.EventEmitter.prototype; +DummyRequest.prototype.write= function(post_body){} +DummyRequest.prototype.write= function(post_body){ + this.emit('response',this.response); +} +DummyRequest.prototype.end= function(){ + this.response.emit('end'); +} + +vows.describe('OAuth').addBatch({ + 'When generating the signature base string described in http://oauth.net/core/1.0/#sig_base_example': { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'we get the expected result string': function (oa) { + var result= oa._createSignatureBase("GET", "http://photos.example.net/photos", + "file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original") + assert.equal( result, "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"); + } + }, + 'When generating the signature base string with PLAINTEXT': { + topic: new OAuth(null, null, null, null, null, null, "PLAINTEXT"), + 'we get the expected result string': function (oa) { + var result= oa._getSignature("GET", "http://photos.example.net/photos", + "file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=PLAINTEXT&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original", + "test"); + assert.equal( result, "&test"); + } + }, + 'When normalising a url': { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'default ports should be stripped': function(oa) { + assert.equal( oa._normalizeUrl("https://somehost.com/foo/bar"), "https://somehost.com/foo/bar" ); + }, + 'should leave in non-default ports from urls for use in signature generation': function(oa) { + assert.equal( oa._normalizeUrl("https://somehost.com:446/foo/bar"), "https://somehost.com:446/foo/bar" ); + assert.equal( oa._normalizeUrl("http://somehost.com:81/foo/bar"), "http://somehost.com:81/foo/bar" ); + }, + 'should add a trailing slash when no path at all is present': function(oa) { + assert.equal( oa._normalizeUrl("http://somehost.com/"), "http://somehost.com/") + } + }, + 'When making an array out of the arguments hash' : { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'flatten out arguments that are arrays' : function(oa) { + var parameters= {"z": "a", + "a": ["1", "2"], + "1": "c" }; + var parameterResults= oa._makeArrayOfArgumentsHash(parameters); + assert.equal(parameterResults.length, 4); + assert.equal(parameterResults[0][0], "1"); + assert.equal(parameterResults[1][0], "z"); + assert.equal(parameterResults[2][0], "a"); + assert.equal(parameterResults[3][0], "a"); + } + }, + 'When ordering the request parameters' : { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'Order them by name' : function(oa) { + var parameters= {"z": "a", + "a": "b", + "1": "c" }; + var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters)) + assert.equal(parameterResults[0][0], "1"); + assert.equal(parameterResults[1][0], "a"); + assert.equal(parameterResults[2][0], "z"); + }, + 'If two parameter names are the same then order by the value': function(oa) { + var parameters= {"z": "a", + "a": ["z", "b", "b", "a", "y"], + "1": "c" }; + var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters)) + assert.equal(parameterResults[0][0], "1"); + assert.equal(parameterResults[1][0], "a"); + assert.equal(parameterResults[1][1], "a"); + assert.equal(parameterResults[2][0], "a"); + assert.equal(parameterResults[2][1], "b"); + assert.equal(parameterResults[3][0], "a"); + assert.equal(parameterResults[3][1], "b"); + assert.equal(parameterResults[4][0], "a"); + assert.equal(parameterResults[4][1], "y"); + assert.equal(parameterResults[5][0], "a"); + assert.equal(parameterResults[5][1], "z"); + assert.equal(parameterResults[6][0], "z"); + } + }, + 'When normalising the request parameters': { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'the resulting parameters should be encoded and ordered as per http://tools.ietf.org/html/rfc5849#section-3.1 (3.4.1.3.2)' : function(oa) { + var parameters= {"b5" : "=%3D", + "a3": ["a", "2 q"], + "c@": "", + "a2": "r b", + "oauth_consumer_key": "9djdj82h48djs9d2", + "oauth_token":"kkk9d7dh3k39sjv7", + "oauth_signature_method": "HMAC-SHA1", + "oauth_timestamp": "137131201", + "oauth_nonce": "7d8f3e4a", + "c2" : ""}; + var normalisedParameterString= oa._normaliseRequestParams(parameters); + assert.equal(normalisedParameterString, "a2=r%20b&a3=2%20q&a3=a&b5=%3D%253D&c%40=&c2=&oauth_consumer_key=9djdj82h48djs9d2&oauth_nonce=7d8f3e4a&oauth_signature_method=HMAC-SHA1&oauth_timestamp=137131201&oauth_token=kkk9d7dh3k39sjv7"); + } + }, + 'When preparing the parameters for use in signing': { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'We need to be wary of node\'s auto object creation from foo[bar] style url parameters' : function(oa) { + var result= oa._prepareParameters( "", "", "", "http://foo.com/?foo[bar]=xxx&bar[foo]=yyy", {} ); + assert.equal( result[0][0], "bar[foo]") + assert.equal( result[0][1], "yyy") + assert.equal( result[1][0], "foo[bar]") + assert.equal( result[1][1], "xxx") + } + }, + 'When signing a url': { + topic: function() { + var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); + oa._getTimestamp= function(){ return "1272399856"; } + oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } + return oa; + }, + 'Provide a valid signature when no token present': function(oa) { + assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_version=1.0&oauth_signature=7ytO8vPSLut2GzHjU9pn1SV9xjc%3D"); + }, + 'Provide a valid signature when a token is present': function(oa) { + assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_token=token&oauth_version=1.0&oauth_signature=9LwCuCWw5sURtpMroIolU3YwsdI%3D"); + }, + 'Provide a valid signature when a token and a token secret is present': function(oa) { + assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_token=token&oauth_version=1.0&oauth_signature=zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"); + } + }, + 'When getting a request token': { + topic: function() { + var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); + oa._getTimestamp= function(){ return "1272399856"; } + oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } + oa._performSecureRequest= function(){ return this.requestArguments = arguments; } + return oa; + }, + 'Use the HTTP method in the client options': function(oa) { + oa.setClientOptions({ requestTokenHttpMethod: "GET" }); + oa.getOAuthRequestToken(function() {}); + assert.equal(oa.requestArguments[2], "GET"); + }, + 'Use a POST by default': function(oa) { + oa.setClientOptions({}); + oa.getOAuthRequestToken(function() {}); + assert.equal(oa.requestArguments[2], "POST"); + } + }, + 'When getting an access token': { + topic: function() { + var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); + oa._getTimestamp= function(){ return "1272399856"; } + oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } + oa._performSecureRequest= function(){ return this.requestArguments = arguments; } + return oa; + }, + 'Use the HTTP method in the client options': function(oa) { + oa.setClientOptions({ accessTokenHttpMethod: "GET" }); + oa.getOAuthAccessToken(function() {}); + assert.equal(oa.requestArguments[2], "GET"); + }, + 'Use a POST by default': function(oa) { + oa.setClientOptions({}); + oa.getOAuthAccessToken(function() {}); + assert.equal(oa.requestArguments[2], "POST"); + } + }, + 'When get authorization header' : { + topic: function() { + var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); + oa._getTimestamp= function(){ return "1272399856"; } + oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } + return oa; + }, + 'Provide a valid signature when a token and a token secret is present': function(oa) { + assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0",oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); + }, + 'Support variable whitespace separating the arguments': function(oa) { + oa._oauthParameterSeperator= ", "; + assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey", oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1272399856", oauth_token="token", oauth_version="1.0", oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); + } + }, + 'When get the OAuth Echo authorization header': { + topic: function () { + var realm = "http://foobar.com/"; + var verifyCredentials = "http://api.foobar.com/verify.json"; + var oa = new OAuthEcho(realm, verifyCredentials, "consumerkey", "consumersecret", "1.0A", "HMAC-SHA1"); + oa._getTimestamp= function(){ return "1272399856"; } + oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } + return oa; + }, + 'Provide a valid signature when a token and token secret is present': function (oa) { + assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth realm="http://foobar.com/",oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0A",oauth_signature="0rr1LhSxACX2IEWRq3uCb4IwtOs%3D"'); + } + }, + 'When non standard ports are used': { + topic: function() { + var oa= new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + mockProvider= {}; + + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers.Host, "somehost.com:8080"); + assert.equal(hostname, "somehost.com"); + assert.equal(port, "8080"); + return { + on: function() {}, + end: function() {} + }; + } + return oa; + }, + 'getProtectedResource should correctly define the host headers': function(oa) { + oa.getProtectedResource("http://somehost.com:8080/", "GET", "oauth_token", null, function(){}) + } + }, + 'When building the OAuth Authorization header': { + topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), + 'All provided oauth arguments should be concatentated correctly' : function(oa) { + var parameters= [ + ["oauth_timestamp", "1234567"], + ["oauth_nonce", "ABCDEF"], + ["oauth_version", "1.0"], + ["oauth_signature_method", "HMAC-SHA1"], + ["oauth_consumer_key", "asdasdnm2321b3"]]; + assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); + }, + '*Only* Oauth arguments should be concatentated, others should be disregarded' : function(oa) { + var parameters= [ + ["foo", "2343"], + ["oauth_timestamp", "1234567"], + ["oauth_nonce", "ABCDEF"], + ["bar", "dfsdfd"], + ["oauth_version", "1.0"], + ["oauth_signature_method", "HMAC-SHA1"], + ["oauth_consumer_key", "asdasdnm2321b3"], + ["foobar", "asdasdnm2321b3"]]; + assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); + }, + '_buildAuthorizationHeaders should not depends on Array.prototype.toString' : function(oa) { + var _toString = Array.prototype.toString; + Array.prototype.toString = function(){ return '[Array] ' + this.length; }; // toString overwrite example used in jsdom. + var parameters= [ + ["foo", "2343"], + ["oauth_timestamp", "1234567"], + ["oauth_nonce", "ABCDEF"], + ["bar", "dfsdfd"], + ["oauth_version", "1.0"], + ["oauth_signature_method", "HMAC-SHA1"], + ["oauth_consumer_key", "asdasdnm2321b3"], + ["foobar", "asdasdnm2321b3"]]; + assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); + Array.prototype.toString = _toString; + } + }, + 'When performing the Secure Request' : { + topic: new OAuth("http://foo.com/RequestToken", + "http://foo.com/AccessToken", + "anonymous", "anonymous", + "1.0A", "http://foo.com/callback", "HMAC-SHA1"), + 'using the POST method' : { + 'Any passed extra_params should form part of the POST body': function(oa) { + var post_body_written= false; + var op= oa._createClient; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return { + write: function(post_body){ + post_body_written= true; + assert.equal(post_body,"scope=foobar%2C1%2C2"); + } + }; + } + oa._performSecureRequest("token", "token_secret", 'POST', 'http://foo.com/protected_resource', {"scope": "foobar,1,2"}); + assert.equal(post_body_written, true); + } + finally { + oa._createClient= op; + } + } + } + }, + 'When performing a secure' : { + topic: new OAuth("http://foo.com/RequestToken", + "http://foo.com/AccessToken", + "anonymous", "anonymous", + "1.0A", "http://foo.com/callback", "HMAC-SHA1"), + 'POST' : { + 'if no callback is passed' : { + 'it should return a request object': function(oa) { + var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain") + assert.isObject(request); + assert.equal(request.method, "POST"); + request.end(); + } + }, + 'if a callback is passed' : { + "it should call the internal request's end method and return nothing": function(oa) { + var callbackCalled= false; + var op= oa._createClient; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return { + write: function(){}, + on: function() {}, + end: function() { + callbackCalled= true; + } + }; + } + var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){}) + assert.equal(callbackCalled, true); + assert.isUndefined(request); + } + finally { + oa._createClient= op; + } + } + }, + 'if the post_body is not a string' : { + "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded") + return { + write: function(data){ + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + }, + on: function() {}, + end: function() { + } + }; + } + var request= oa.post("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"}) + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + }, + 'if the post_body is a string' : { + "and it contains non ascii (7/8bit) characters" : { + "the content length should be the byte count, and not the string length" : function(oa) { + var testString= "Tôi yêu node"; + var testStringLength= testString.length; + var testStringBytesLength= Buffer.byteLength(testString); + assert.notEqual(testStringLength, testStringBytesLength); // Make sure we're testing a string that differs between byte-length and char-length! + + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-length"], testStringBytesLength); + return { + write: function(data){ + callbackCalled= true; + assert.equal(data, testString); + }, + on: function() {}, + end: function() { + } + }; + } + var request= oa.post("http://foo.com/blah", "token", "token_secret", "Tôi yêu node") + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + }, + "and no post_content_type is specified" : { + "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded"); + assert.equal(headers["Content-length"], 23); + return { + write: function(data){ + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + }, + on: function() {}, + end: function() { + } + }; + } + var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2") + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + }, + "and a post_content_type is specified" : { + "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "unicorn/encoded"); + assert.equal(headers["Content-length"], 23); + return { + write: function(data){ + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + }, + on: function() {}, + end: function() { + } + }; + } + var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded") + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + } + } + }, + 'GET' : { + 'if no callback is passed' : { + 'it should return a request object': function(oa) { + var request= oa.get("http://foo.com/blah", "token", "token_secret") + assert.isObject(request); + assert.equal(request.method, "GET"); + request.end(); + } + }, + 'if a callback is passed' : { + "it should call the internal request's end method and return nothing": function(oa) { + var callbackCalled= false; + var op= oa._createClient; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return { + on: function() {}, + end: function() { + callbackCalled= true; + } + }; + } + var request= oa.get("http://foo.com/blah", "token", "token_secret", function(e,d) {}) + assert.equal(callbackCalled, true); + assert.isUndefined(request); + } + finally { + oa._createClient= op; + } + } + } + }, + 'PUT' : { + 'if no callback is passed' : { + 'it should return a request object': function(oa) { + var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain") + assert.isObject(request); + assert.equal(request.method, "PUT"); + request.end(); + } + }, + 'if a callback is passed' : { + "it should call the internal request's end method and return nothing": function(oa) { + var callbackCalled= 0; + var op= oa._createClient; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return { + on: function() {}, + write: function(data) { + callbackCalled++; + }, + end: function() { + callbackCalled++; + } + }; + } + var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){}) + assert.equal(callbackCalled, 2); + assert.isUndefined(request); + } + finally { + oa._createClient= op; + } + } + }, + 'if the post_body is not a string' : { + "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded") + return { + write: function(data) { + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + } + }; + } + var request= oa.put("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"}) + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + }, + 'if the post_body is a string' : { + "and no post_content_type is specified" : { + "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded"); + assert.equal(headers["Content-length"], 23); + return { + write: function(data) { + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + } + }; + } + var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2") + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + }, + "and a post_content_type is specified" : { + "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) { + var op= oa._createClient; + try { + var callbackCalled= false; + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + assert.equal(headers["Content-Type"], "unicorn/encoded"); + assert.equal(headers["Content-length"], 23); + return { + write: function(data) { + callbackCalled= true; + assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); + } + }; + } + var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded") + assert.equal(callbackCalled, true); + } + finally { + oa._createClient= op; + } + } + } + } + }, + 'DELETE' : { + 'if no callback is passed' : { + 'it should return a request object': function(oa) { + var request= oa.delete("http://foo.com/blah", "token", "token_secret") + assert.isObject(request); + assert.equal(request.method, "DELETE"); + request.end(); + } + }, + 'if a callback is passed' : { + "it should call the internal request's end method and return nothing": function(oa) { + var callbackCalled= false; + var op= oa._createClient; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return { + on: function() {}, + end: function() { + callbackCalled= true; + } + }; + } + var request= oa.delete("http://foo.com/blah", "token", "token_secret", function(e,d) {}) + assert.equal(callbackCalled, true); + assert.isUndefined(request); + } + finally { + oa._createClient= op; + } + } + } + }, + 'Request With a Callback' : { + 'and a 200 response code is received' : { + 'it should callback successfully' : function(oa) { + var op= oa._createClient; + var callbackCalled = false; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse(200) ); + } + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { + // callback + callbackCalled= true; + assert.equal(error, undefined); + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + } + } + }, + 'and a 210 response code is received' : { + 'it should callback successfully' : function(oa) { + var op= oa._createClient; + var callbackCalled = false; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse(210) ); + } + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { + // callback + callbackCalled= true; + assert.equal(error, undefined); + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + } + } + }, + 'And A 301 redirect is received' : { + 'and there is a location header' : { + 'it should (re)perform the secure request but with the new location' : function(oa) { + var op= oa._createClient; + var psr= oa._performSecureRequest; + var responseCounter = 1; + var callbackCalled = false; + var DummyResponse =function() { + if( responseCounter == 1 ){ + this.statusCode= 301; + this.headers= {location:"http://redirectto.com/"}; + responseCounter++; + } + else { + this.statusCode= 200; + } + } + DummyResponse.prototype= events.EventEmitter.prototype; + DummyResponse.prototype.setEncoding= function() {} + + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse() ); + } + oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) { + if( responseCounter == 1 ) { + assert.equal(url, "http://originalurl.com/"); + } + else { + assert.equal(url, "http://redirectto.com/"); + } + return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) + } + + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function() { + // callback + assert.equal(responseCounter, 2); + callbackCalled= true; + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + oa._performSecureRequest= psr; + } + } + }, + 'but there is no location header' : { + 'it should execute the callback, passing the HTTP Response code' : function(oa) { + var op= oa._createClient; + var callbackCalled = false; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse(301) ); + } + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { + // callback + assert.equal(error.statusCode, 301); + callbackCalled= true; + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + } + } + } + }, + 'And A 302 redirect is received' : { + 'and there is a location header' : { + 'it should (re)perform the secure request but with the new location' : function(oa) { + var op= oa._createClient; + var psr= oa._performSecureRequest; + var responseCounter = 1; + var callbackCalled = false; + var DummyResponse =function() { + if( responseCounter == 1 ){ + this.statusCode= 302; + this.headers= {location:"http://redirectto.com/"}; + responseCounter++; + } + else { + this.statusCode= 200; + } + } + DummyResponse.prototype= events.EventEmitter.prototype; + DummyResponse.prototype.setEncoding= function() {} + + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse() ); + } + oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) { + if( responseCounter == 1 ) { + assert.equal(url, "http://originalurl.com/"); + } + else { + assert.equal(url, "http://redirectto.com/"); + } + return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) + } + + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function() { + // callback + assert.equal(responseCounter, 2); + callbackCalled= true; + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + oa._performSecureRequest= psr; + } + } + }, + 'but there is no location header' : { + 'it should execute the callback, passing the HTTP Response code' : function(oa) { + var op= oa._createClient; + var callbackCalled = false; + try { + oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { + return new DummyRequest( new DummyResponse(302) ); + } + oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { + // callback + assert.equal(error.statusCode, 302); + callbackCalled= true; + }); + assert.equal(callbackCalled, true) + } + finally { + oa._createClient= op; + } + } + } + } + } + } +}).export(module); diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js new file mode 100644 index 0000000..4eb47cd --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js @@ -0,0 +1,67 @@ +var vows = require('vows'), + assert = require('assert'), + OAuth2= require('../lib/oauth2').OAuth2; + +vows.describe('OAuth2').addBatch({ + 'Given an OAuth2 instance, ': { + topic: new OAuth2(), + 'When handling the access token response': { + 'we should correctly extract the token if received as form-data': function (oa) { + oa._request= function( method, url, fo, bar, bleh, callback) { + callback(null, "access_token=access&refresh_token=refresh"); + }; + oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) { + assert.equal( access_token, "access"); + assert.equal( refresh_token, "refresh"); + }); + }, + 'we should correctly extract the token if received as a JSON literal': function (oa) { + oa._request= function(method, url, headers, post_body, access_token, callback) { + callback(null, '{"access_token":"access","refresh_token":"refresh"}'); + }; + oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) { + assert.equal( access_token, "access"); + assert.equal( refresh_token, "refresh"); + }); + }, + 'we should return the received data to the calling method': function (oa) { + oa._request= function(method, url, headers, post_body, access_token, callback) { + callback(null, '{"access_token":"access","refresh_token":"refresh","extra_1":1, "extra_2":"foo"}'); + }; + oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token, results) { + assert.equal( access_token, "access"); + assert.equal( refresh_token, "refresh"); + assert.isNotNull( results ); + assert.equal( results.extra_1, 1); + assert.equal( results.extra_2, "foo"); + }); + } + }, + 'When no grant_type parameter is specified': { + 'we should pass the value of the code argument as the code parameter': function(oa) { + oa._request= function(method, url, headers, post_body, access_token, callback) { + assert.isTrue( post_body.indexOf("code=xsds23") != -1 ) + } + oa.getOAuthAccessToken("xsds23", {} ); + } + }, + 'When an invalid grant_type parameter is specified': { + 'we should pass the value of the code argument as the code parameter': function(oa) { + oa._request= function(method, url, headers, post_body, access_token, callback) { + assert.isTrue( post_body.indexOf("code=xsds23") != -1 ) + } + oa.getOAuthAccessToken("xsds23", {grant_type:"refresh_toucan"} ); + } + }, + 'When a grant_type parameter of value "refresh_token" is specified': { + 'we should pass the value of the code argument as the refresh_token parameter, should pass a grant_type parameter, but shouldn\'t pass a code parameter' : function(oa) { + oa._request= function(method, url, headers, post_body, access_token, callback) { + assert.isTrue( post_body.indexOf("refresh_token=sdsds2") != -1 ) + assert.isTrue( post_body.indexOf("grant_type=refresh_token") != -1 ) + assert.isTrue( post_body.indexOf("code=") == -1 ) + } + oa.getOAuthAccessToken("sdsds2", {grant_type:"refresh_token"} ); + } + } + } +}).export(module); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js new file mode 100644 index 0000000..18ba0ae --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js @@ -0,0 +1,13 @@ +var vows = require('vows'), + assert = require('assert'); + +vows.describe('SHA1 Hashing').addBatch({ + 'When using the SHA1 Hashing function': { + topic: require('../lib/sha1'), + 'we get the specified digest as described in http://oauth.net/core/1.0/#sig_base_example (A.5.2)': function (sha1) { + assert.equal (sha1.HMACSHA1( "kd94hf93k423kf44&pfkkdhi9sl3r4s00", + "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"), + "tR3+Ty81lMeYAr/Fid0kMTYa/WM="); + } + } +}).export(module); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/package.json b/node_modules/passport-github/node_modules/passport-oauth/package.json new file mode 100644 index 0000000..52d0a82 --- /dev/null +++ b/node_modules/passport-github/node_modules/passport-oauth/package.json @@ -0,0 +1,35 @@ +{ + "name": "passport-oauth", + "version": "0.1.14", + "description": "OAuth 1.0 and 2.0 authentication strategies for Passport.", + "keywords": ["passport", "oauth", "auth", "authn", "authentication"], + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/passport-oauth.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/passport-oauth/issues" + }, + "author": { + "name": "Jared Hanson", + "email": "jaredhanson@gmail.com", + "url": "http://www.jaredhanson.net/" + }, + "licenses": [ { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } ], + "main": "./lib/passport-oauth", + "dependencies": { + "pkginfo": "0.2.x", + "passport": "~0.1.1", + "oauth": "0.9.x" + }, + "devDependencies": { + "vows": "0.6.x" + }, + "scripts": { + "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js" + }, + "engines": { "node": ">= 0.4.0" } +} diff --git a/node_modules/passport-github/node_modules/pkginfo/.gitignore b/node_modules/passport-github/node_modules/pkginfo/.gitignore new file mode 100644 index 0000000..9303c34 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/README.md b/node_modules/passport-github/node_modules/pkginfo/README.md new file mode 100644 index 0000000..07ba942 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/README.md @@ -0,0 +1,85 @@ +# node-pkginfo + +An easy way to expose properties on a module from a package.json + +## Installation + +### Installing npm (node package manager) +``` + curl http://npmjs.org/install.sh | sh +``` + +### Installing pkginfo +``` + [sudo] npm install pkginfo +``` + +## Motivation +How often when writing node.js modules have you written the following line(s) of code? + +* Hard code your version string into your code + +``` js + exports.version = '0.1.0'; +``` + +* Programmatically expose the version from the package.json + +``` js + exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; +``` + +In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** + +## Usage + +Using `pkginfo` is idiot-proof, just require and invoke it. + +``` js + var pkginfo = require('pkginfo')(module); + + console.dir(module.exports); +``` + +By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). + +Here's a sample of the output: + +``` + { name: 'simple-app', + description: 'A test fixture for pkginfo', + version: '0.1.0', + author: 'Charlie Robbins ', + keywords: [ 'test', 'fixture' ], + main: './index.js', + scripts: { test: 'vows test/*-test.js --spec' }, + engines: { node: '>= 0.4.0' } } +``` + +### Expose specific properties +If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: + +``` js + var pkginfo = require('pkginfo')(module, 'version', 'author'); + + console.dir(module.exports); +``` + +``` + { version: '0.1.0', + author: 'Charlie Robbins ' } +``` + +If you're looking for further usage see the [examples][0] included in this repository. + +## Run Tests +Tests are written in [vows][1] and give complete coverage of all APIs. + +``` + vows test/*-test.js --spec +``` + +[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples +[1]: http://vowsjs.org + +#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/docs/docco.css b/node_modules/passport-github/node_modules/pkginfo/docs/docco.css new file mode 100644 index 0000000..bd54134 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/docs/docco.css @@ -0,0 +1,194 @@ +/*--------------------- Layout and Typography ----------------------------*/ +body { + font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; + font-size: 15px; + line-height: 22px; + color: #252519; + margin: 0; padding: 0; +} +a { + color: #261a3b; +} + a:visited { + color: #261a3b; + } +p { + margin: 0 0 15px 0; +} +h4, h5, h6 { + color: #333; + margin: 6px 0 6px 0; + font-size: 13px; +} + h2, h3 { + margin-bottom: 0; + color: #000; + } + h1 { + margin-top: 40px; + margin-bottom: 15px; + color: #000; + } +#container { + position: relative; +} +#background { + position: fixed; + top: 0; left: 525px; right: 0; bottom: 0; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + z-index: -1; +} +#jump_to, #jump_page { + background: white; + -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; + -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; + font: 10px Arial; + text-transform: uppercase; + cursor: pointer; + text-align: right; +} +#jump_to, #jump_wrapper { + position: fixed; + right: 0; top: 0; + padding: 5px 10px; +} + #jump_wrapper { + padding: 0; + display: none; + } + #jump_to:hover #jump_wrapper { + display: block; + } + #jump_page { + padding: 5px 0 3px; + margin: 0 0 25px 25px; + } + #jump_page .source { + display: block; + padding: 5px 10px; + text-decoration: none; + border-top: 1px solid #eee; + } + #jump_page .source:hover { + background: #f5f5ff; + } + #jump_page .source:first-child { + } +table td { + border: 0; + outline: 0; +} + td.docs, th.docs { + max-width: 450px; + min-width: 450px; + min-height: 5px; + padding: 10px 25px 1px 50px; + overflow-x: hidden; + vertical-align: top; + text-align: left; + } + .docs pre { + margin: 15px 0 15px; + padding-left: 15px; + } + .docs p tt, .docs p code { + background: #f8f8ff; + border: 1px solid #dedede; + font-size: 12px; + padding: 0 0.2em; + } + .pilwrap { + position: relative; + } + .pilcrow { + font: 12px Arial; + text-decoration: none; + color: #454545; + position: absolute; + top: 3px; left: -20px; + padding: 1px 2px; + opacity: 0; + -webkit-transition: opacity 0.2s linear; + } + td.docs:hover .pilcrow { + opacity: 1; + } + td.code, th.code { + padding: 14px 15px 16px 25px; + width: 100%; + vertical-align: top; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + } + pre, tt, code { + font-size: 12px; line-height: 18px; + font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; + margin: 0; padding: 0; + } + + +/*---------------------- Syntax Highlighting -----------------------------*/ +td.linenos { background-color: #f0f0f0; padding-right: 10px; } +span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } +body .hll { background-color: #ffffcc } +body .c { color: #408080; font-style: italic } /* Comment */ +body .err { border: 1px solid #FF0000 } /* Error */ +body .k { color: #954121 } /* Keyword */ +body .o { color: #666666 } /* Operator */ +body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +body .cp { color: #BC7A00 } /* Comment.Preproc */ +body .c1 { color: #408080; font-style: italic } /* Comment.Single */ +body .cs { color: #408080; font-style: italic } /* Comment.Special */ +body .gd { color: #A00000 } /* Generic.Deleted */ +body .ge { font-style: italic } /* Generic.Emph */ +body .gr { color: #FF0000 } /* Generic.Error */ +body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +body .gi { color: #00A000 } /* Generic.Inserted */ +body .go { color: #808080 } /* Generic.Output */ +body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +body .gs { font-weight: bold } /* Generic.Strong */ +body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +body .gt { color: #0040D0 } /* Generic.Traceback */ +body .kc { color: #954121 } /* Keyword.Constant */ +body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ +body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ +body .kp { color: #954121 } /* Keyword.Pseudo */ +body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ +body .kt { color: #B00040 } /* Keyword.Type */ +body .m { color: #666666 } /* Literal.Number */ +body .s { color: #219161 } /* Literal.String */ +body .na { color: #7D9029 } /* Name.Attribute */ +body .nb { color: #954121 } /* Name.Builtin */ +body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +body .no { color: #880000 } /* Name.Constant */ +body .nd { color: #AA22FF } /* Name.Decorator */ +body .ni { color: #999999; font-weight: bold } /* Name.Entity */ +body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +body .nf { color: #0000FF } /* Name.Function */ +body .nl { color: #A0A000 } /* Name.Label */ +body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +body .nt { color: #954121; font-weight: bold } /* Name.Tag */ +body .nv { color: #19469D } /* Name.Variable */ +body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +body .w { color: #bbbbbb } /* Text.Whitespace */ +body .mf { color: #666666 } /* Literal.Number.Float */ +body .mh { color: #666666 } /* Literal.Number.Hex */ +body .mi { color: #666666 } /* Literal.Number.Integer */ +body .mo { color: #666666 } /* Literal.Number.Oct */ +body .sb { color: #219161 } /* Literal.String.Backtick */ +body .sc { color: #219161 } /* Literal.String.Char */ +body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ +body .s2 { color: #219161 } /* Literal.String.Double */ +body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +body .sh { color: #219161 } /* Literal.String.Heredoc */ +body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +body .sx { color: #954121 } /* Literal.String.Other */ +body .sr { color: #BB6688 } /* Literal.String.Regex */ +body .s1 { color: #219161 } /* Literal.String.Single */ +body .ss { color: #19469D } /* Literal.String.Symbol */ +body .bp { color: #954121 } /* Name.Builtin.Pseudo */ +body .vc { color: #19469D } /* Name.Variable.Class */ +body .vg { color: #19469D } /* Name.Variable.Global */ +body .vi { color: #19469D } /* Name.Variable.Instance */ +body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html b/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html new file mode 100644 index 0000000..bf615fa --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html @@ -0,0 +1,101 @@ + pkginfo.js

    pkginfo.js

    /*
    + * pkginfo.js: Top-level include for the pkginfo module
    + *
    + * (C) 2011, Charlie Robbins
    + *
    + */
    + 
    +var fs = require('fs'),
    +    path = require('path');

    function pkginfo ([options, 'property', 'property' ..])

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @options {Object|Array|string} Optional Options used when exposing properties.

    + +

    @arguments {string...} Optional Specified properties to expose.

    + +

    Exposes properties from the package.json file for the parent module on +it's exports. Valid usage:

    + +

    require('pkginfo')()

    + +

    require('pkginfo')('version', 'author');

    + +

    require('pkginfo')(['version', 'author']);

    + +

    require('pkginfo')({ include: ['version', 'author'] });

    var pkginfo = module.exports = function (pmodule, options) {
    +  var args = [].slice.call(arguments, 2).filter(function (arg) {
    +    return typeof arg === 'string';
    +  });
    +  

    Parse variable arguments

      if (Array.isArray(options)) {

    If the options passed in is an Array assume that +it is the Array of properties to expose from the +on the package.json file on the parent module.

        options = { include: options };
    +  }
    +  else if (typeof options === 'string') {

    Otherwise if the first argument is a string, then +assume that it is the first property to expose from +the package.json file on the parent module.

        options = { include: [options] };
    +  }
    +  

    Setup default options

      options = options || { include: [] };
    +  
    +  if (args.length > 0) {

    If additional string arguments have been passed in +then add them to the properties to expose on the +parent module.

        options.include = options.include.concat(args);
    +  }
    +  
    +  var pkg = pkginfo.read(pmodule, options.dir).package;
    +  Object.keys(pkg).forEach(function (key) {
    +    if (options.include.length > 0 && !~options.include.indexOf(key)) {
    +      return;
    +    }
    +    
    +    if (!pmodule.exports[key]) {
    +      pmodule.exports[key] = pkg[key];
    +    }
    +  });
    +  
    +  return pkginfo;
    +};

    function find (dir)

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @dir {string} Optional Directory to start search from.

    + +

    Searches up the directory tree from dir until it finds a directory +which contains a package.json file.

    pkginfo.find = function (pmodule, dir) {
    +  dir = dir || pmodule.filename;
    +  dir = path.dirname(dir); 
    +  
    +  var files = fs.readdirSync(dir);
    +  
    +  if (~files.indexOf('package.json')) {
    +    return path.join(dir, 'package.json');
    +  }
    +  
    +  if (dir === '/') {
    +    throw new Error('Could not find package.json up from: ' + dir);
    +  }
    +  
    +  return pkginfo.find(dir);
    +};

    function read (pmodule, dir)

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @dir {string} Optional Directory to start search from.

    + +

    Searches up the directory tree from dir until it finds a directory +which contains a package.json file and returns the package information.

    pkginfo.read = function (pmodule, dir) { 
    +  dir = pkginfo.find(pmodule, dir);
    +  
    +  var data = fs.readFileSync(dir).toString();
    +      
    +  return {
    +    dir: dir, 
    +    package: JSON.parse(data)
    +  };
    +};

    Call pkginfo on this module and expose version.

    pkginfo(module, {
    +  dir: __dirname,
    +  include: ['version'],
    +  target: pkginfo
    +});
    +
    +
    \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js b/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js new file mode 100644 index 0000000..fd1d831 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js @@ -0,0 +1,19 @@ +/* + * all-properties.js: Sample of including all properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js b/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js new file mode 100644 index 0000000..b1b6848 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js @@ -0,0 +1,20 @@ +/* + * array-argument.js: Sample of including specific properties from a package.json file + * using Array argument syntax. + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js new file mode 100644 index 0000000..b4b5fd6 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js @@ -0,0 +1,19 @@ +/* + * multiple-properties.js: Sample of including multiple properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js b/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js new file mode 100644 index 0000000..28420c8 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js @@ -0,0 +1,22 @@ +/* + * object-argument.js: Sample of including specific properties from a package.json file + * using Object argument syntax. + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, { + include: ['version', 'author'] + }); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/package.json b/node_modules/passport-github/node_modules/pkginfo/examples/package.json new file mode 100644 index 0000000..1f2f01c --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/package.json @@ -0,0 +1,10 @@ +{ + "name": "simple-app", + "description": "A test fixture for pkginfo", + "version": "0.1.0", + "author": "Charlie Robbins ", + "keywords": ["test", "fixture"], + "main": "./index.js", + "scripts": { "test": "vows test/*-test.js --spec" }, + "engines": { "node": ">= 0.4.0" } +} diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js b/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js new file mode 100644 index 0000000..4f44561 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js @@ -0,0 +1,19 @@ +/* + * single-property.js: Sample of including a single specific properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, 'version'); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js b/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js new file mode 100644 index 0000000..a4a6227 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js @@ -0,0 +1,132 @@ +/* + * pkginfo.js: Top-level include for the pkginfo module + * + * (C) 2011, Charlie Robbins + * + */ + +var fs = require('fs'), + path = require('path'); + +// +// ### function pkginfo ([options, 'property', 'property' ..]) +// #### @pmodule {Module} Parent module to read from. +// #### @options {Object|Array|string} **Optional** Options used when exposing properties. +// #### @arguments {string...} **Optional** Specified properties to expose. +// Exposes properties from the package.json file for the parent module on +// it's exports. Valid usage: +// +// `require('pkginfo')()` +// +// `require('pkginfo')('version', 'author');` +// +// `require('pkginfo')(['version', 'author']);` +// +// `require('pkginfo')({ include: ['version', 'author'] });` +// +var pkginfo = module.exports = function (pmodule, options) { + var args = [].slice.call(arguments, 2).filter(function (arg) { + return typeof arg === 'string'; + }); + + // + // **Parse variable arguments** + // + if (Array.isArray(options)) { + // + // If the options passed in is an Array assume that + // it is the Array of properties to expose from the + // on the package.json file on the parent module. + // + options = { include: options }; + } + else if (typeof options === 'string') { + // + // Otherwise if the first argument is a string, then + // assume that it is the first property to expose from + // the package.json file on the parent module. + // + options = { include: [options] }; + } + + // + // **Setup default options** + // + options = options || { include: [] }; + + if (args.length > 0) { + // + // If additional string arguments have been passed in + // then add them to the properties to expose on the + // parent module. + // + options.include = options.include.concat(args); + } + + var pkg = pkginfo.read(pmodule, options.dir).package; + Object.keys(pkg).forEach(function (key) { + if (options.include.length > 0 && !~options.include.indexOf(key)) { + return; + } + + if (!pmodule.exports[key]) { + pmodule.exports[key] = pkg[key]; + } + }); + + return pkginfo; +}; + +// +// ### function find (dir) +// #### @pmodule {Module} Parent module to read from. +// #### @dir {string} **Optional** Directory to start search from. +// Searches up the directory tree from `dir` until it finds a directory +// which contains a `package.json` file. +// +pkginfo.find = function (pmodule, dir) { + dir = dir || pmodule.filename; + dir = path.dirname(dir); + + var files = fs.readdirSync(dir); + + if (~files.indexOf('package.json')) { + return path.join(dir, 'package.json'); + } + + if (dir === '/') { + throw new Error('Could not find package.json up from: ' + dir); + } + else if (!dir || dir === '.') { + throw new Error('Cannot find package.json from unspecified directory'); + } + + return pkginfo.find(pmodule, dir); +}; + +// +// ### function read (pmodule, dir) +// #### @pmodule {Module} Parent module to read from. +// #### @dir {string} **Optional** Directory to start search from. +// Searches up the directory tree from `dir` until it finds a directory +// which contains a `package.json` file and returns the package information. +// +pkginfo.read = function (pmodule, dir) { + dir = pkginfo.find(pmodule, dir); + + var data = fs.readFileSync(dir).toString(); + + return { + dir: dir, + package: JSON.parse(data) + }; +}; + +// +// Call `pkginfo` on this module and expose version. +// +pkginfo(module, { + dir: __dirname, + include: ['version'], + target: pkginfo +}); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/package.json b/node_modules/passport-github/node_modules/pkginfo/package.json new file mode 100644 index 0000000..0e9e4e7 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/package.json @@ -0,0 +1,17 @@ +{ + "name": "pkginfo", + "version": "0.2.3", + "description": "An easy way to expose properties on a module from a package.json", + "author": "Charlie Robbins ", + "repository": { + "type": "git", + "url": "http://github.com/indexzero/node-pkginfo.git" + }, + "keywords": ["info", "tools", "package.json"], + "devDependencies": { + "vows": "0.6.x" + }, + "main": "./lib/pkginfo", + "scripts": { "test": "vows test/*-test.js --spec" }, + "engines": { "node": ">= 0.4.0" } +} diff --git a/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js new file mode 100644 index 0000000..3156c00 --- /dev/null +++ b/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js @@ -0,0 +1,69 @@ +/* + * pkginfo-test.js: Tests for the pkginfo module. + * + * (C) 2011, Charlie Robbins + * + */ + +var assert = require('assert'), + exec = require('child_process').exec, + fs = require('fs'), + path = require('path'), + vows = require('vows'), + pkginfo = require('../lib/pkginfo'); + +function assertProperties (source, target) { + assert.lengthOf(source, target.length + 1); + target.forEach(function (prop) { + assert.isTrue(!!~source.indexOf(prop)); + }); +} + +function testExposes (options) { + return { + topic: function () { + exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); + }, + "should expose that property correctly": function (err, stdout, stderr) { + assert.isNull(err); + + var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { + return p.substring(1, p.length - 1); + }); + + return !options.assert + ? assertProperties(exposed, options.properties) + : options.assert(exposed); + } + } +} + +vows.describe('pkginfo').addBatch({ + "When using the pkginfo module": { + "and passed a single `string` argument": testExposes({ + script: 'single-property.js', + properties: ['version'] + }), + "and passed multiple `string` arguments": testExposes({ + script: 'multiple-properties.js', + properties: ['version', 'author'] + }), + "and passed an `object` argument": testExposes({ + script: 'object-argument.js', + properties: ['version', 'author'] + }), + "and passed an `array` argument": testExposes({ + script: 'array-argument.js', + properties: ['version', 'author'] + }), + "and passed no arguments": testExposes({ + script: 'all-properties.js', + assert: function (exposed) { + var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), + keys = Object.keys(JSON.parse(pkg)); + + assertProperties(exposed, keys); + } + }) + } +}).export(module); diff --git a/node_modules/passport-github/package.json b/node_modules/passport-github/package.json new file mode 100644 index 0000000..6799272 --- /dev/null +++ b/node_modules/passport-github/package.json @@ -0,0 +1,30 @@ +{ + "name": "passport-github", + "version": "0.1.3", + "description": "GitHub authentication strategy for Passport.", + "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, + "repository": { + "type": "git", + "url": "http://github.com/jaredhanson/passport-github.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/passport-github/issues" + }, + "main": "./lib/passport-github", + "dependencies": { + "pkginfo": "0.2.x", + "passport-oauth": "0.1.x" + }, + "devDependencies": { + "vows": "0.6.x" + }, + "scripts": { + "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js" + }, + "engines": { "node": ">= 0.4.0" }, + "licenses": [ { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } ], + "keywords": ["passport", "github", "auth", "authn", "authentication", "identity"] +} diff --git a/node_modules/passport/.npmignore b/node_modules/passport/.npmignore new file mode 100644 index 0000000..d9ceb36 --- /dev/null +++ b/node_modules/passport/.npmignore @@ -0,0 +1,8 @@ +*.md +.DS_Store +.git* +Makefile +docs/ +examples/ +support/ +test/ diff --git a/node_modules/passport/.travis.yml b/node_modules/passport/.travis.yml new file mode 100644 index 0000000..a57e4db --- /dev/null +++ b/node_modules/passport/.travis.yml @@ -0,0 +1,5 @@ +language: "node_js" +node_js: + - 0.4 + - 0.6 + - 0.8 diff --git a/node_modules/passport/LICENSE b/node_modules/passport/LICENSE new file mode 100644 index 0000000..74524ce --- /dev/null +++ b/node_modules/passport/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2011 Jared Hanson + +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/passport/lib/passport/context/http/actions.js b/node_modules/passport/lib/passport/context/http/actions.js new file mode 100644 index 0000000..1182027 --- /dev/null +++ b/node_modules/passport/lib/passport/context/http/actions.js @@ -0,0 +1,93 @@ +/** + * Export actions prototype for strategies operating within an HTTP context. + */ +var actions = module.exports = {}; + + +/** + * Authenticate `user`, with optional `info`. + * + * Strategies should call this function to successfully authenticate a user. + * `user` should be an object supplied by the application after it has been + * given an opportunity to verify credentials. `info` is an optional argument + * containing additional user information. This is useful for third-party + * authentication strategies to pass profile details. + * + * @param {Object} user + * @param {Object} info + * @api public + */ +actions.success = function(user, info) { + this.delegate.success.apply(this, arguments); +} + +/** + * Fail authentication, with optional `challenge` and `status`, defaulting to + * 401. + * + * Strategies should call this function to fail an authentication attempt. + * + * @param {String} challenge + * @param {Number} status + * @api public + */ +actions.fail = function(challenge, status) { + this.delegate.fail.apply(this, arguments); +} + +/** + * Redirect to `url` with optional `status`, defaulting to 302. + * + * Strategies should call this function to redirect the user (via their user + * agent) to a third-party website for authentication. + * + * @param {String} url + * @param {Number} status + * @api public + */ +actions.redirect = function(url, status) { + var res = this.res; + if (typeof res.redirect == 'function') { + // If possible use redirect method on the response + // Assume Express API, optional status param comes first + if (status) { + res.redirect(status, url); + } else { + res.redirect(url); + } + } else { + // Otherwise fall back to native methods + res.statusCode = status || 302; + res.setHeader('Location', url); + res.setHeader('Content-Length', '0'); + res.end(); + } +} + +/** + * Pass without making a success or fail decision. + * + * Under most circumstances, Strategies should not need to call this function. + * It exists primarily to allow previous authentication state to be restored, + * for example from an HTTP session. + * + * @api public + */ +actions.pass = function() { + this.next(); +} + +/** + * Internal error while performing authentication. + * + * Strategies should call this function when an internal error occurs during the + * process of performing authentication; for example, if the user directory is + * not available. + * + * @param {Error} err + * @api public + */ +actions.error = function(err) { + this.next(err); +} + diff --git a/node_modules/passport/lib/passport/context/http/context.js b/node_modules/passport/lib/passport/context/http/context.js new file mode 100644 index 0000000..27eb9ee --- /dev/null +++ b/node_modules/passport/lib/passport/context/http/context.js @@ -0,0 +1,17 @@ +/** + * `Context` constructor. + * + * @api private + */ +function Context(delegate, req, res, next) { + this.delegate = delegate; + this.req = req; + this.res = res; + this.next = next; +} + + +/** + * Expose `Context`. + */ +module.exports = Context; diff --git a/node_modules/passport/lib/passport/http/request.js b/node_modules/passport/lib/passport/http/request.js new file mode 100644 index 0000000..889fef4 --- /dev/null +++ b/node_modules/passport/lib/passport/http/request.js @@ -0,0 +1,91 @@ +/** + * Module dependencies. + */ +var http = require('http') + , req = http.IncomingMessage.prototype; + + +/** + * Intiate a login session for `user`. + * + * Options: + * - `session` Save login state in session, defaults to _true_ + * + * Examples: + * + * req.logIn(user, { session: false }); + * + * req.logIn(user, function(err) { + * if (err) { throw err; } + * // session saved + * }); + * + * @param {User} user + * @param {Object} options + * @param {Function} done + * @api public + */ +req.login = +req.logIn = function(user, options, done) { + if (!this._passport) throw new Error('passport.initialize() middleware not in use'); + + if (!done && typeof options === 'function') { + done = options; + options = {}; + } + options = options || {}; + var property = this._passport.instance._userProperty || 'user'; + var session = (options.session === undefined) ? true : options.session; + + this[property] = user; + if (session) { + var self = this; + this._passport.instance.serializeUser(user, function(err, obj) { + if (err) { self[property] = null; return done(err); } + self._passport.session.user = obj; + done(); + }); + } else { + done && done(); + } +} + +/** + * Terminate an existing login session. + * + * @api public + */ +req.logout = +req.logOut = function() { + if (!this._passport) throw new Error('passport.initialize() middleware not in use'); + + var property = this._passport.instance._userProperty || 'user'; + + this[property] = null; + delete this._passport.session.user; +}; + +/** + * Test if request is authenticated. + * + * @return {Boolean} + * @api public + */ +req.isAuthenticated = function() { + var property = 'user'; + if (this._passport && this._passport.instance._userProperty) { + property = this._passport.instance._userProperty; + } + + return (this[property]) ? true : false; +}; + +/** + * Test if request is unauthenticated. + * + * @return {Boolean} + * @api public + */ +req.isUnauthenticated = function() { + return !this.isAuthenticated(); +}; diff --git a/node_modules/passport/lib/passport/index.js b/node_modules/passport/lib/passport/index.js new file mode 100644 index 0000000..3f08b36 --- /dev/null +++ b/node_modules/passport/lib/passport/index.js @@ -0,0 +1,412 @@ +/** + * Module dependencies. + */ +var fs = require('fs') + , path = require('path') + , util = require('util') + , Strategy = require('./strategy') + , SessionStrategy = require('./strategies/session') + , initialize = require('./middleware/initialize') + , authenticate = require('./middleware/authenticate'); + + +/** + * `Passport` constructor. + * + * @api public + */ +function Passport() { + this._key = 'passport'; + this._strategies = {}; + this._serializers = []; + this._deserializers = []; + this._infoTransformers = []; + + this._userProperty = 'user'; + + this.use(new SessionStrategy()); +}; + +/** + * Utilize the given `strategy` with optional `name`, overridding the strategy's + * default name. + * + * Examples: + * + * passport.use(new TwitterStrategy(...)); + * + * passport.use('api', new http.BasicStrategy(...)); + * + * @param {String|Strategy} name + * @param {Strategy} strategy + * @return {Passport} for chaining + * @api public + */ +Passport.prototype.use = function(name, strategy) { + if (!strategy) { + strategy = name; + name = strategy.name; + } + if (!name) throw new Error('authentication strategies must have a name'); + + this._strategies[name] = strategy; + return this; +}; + +/** + * Un-utilize the `strategy` with given `name`. + * + * In typical applications, the necessary authentication strategies are static, + * configured once and always available. As such, there is often no need to + * invoke this function. + * + * However, in certain situations, applications may need dynamically configure + * and de-configure authentication strategies. The `use()`/`unuse()` + * combination satisfies these scenarios. + * + * Examples: + * + * passport.unuse('legacy-api'); + * + * @param {String} name + * @return {Passport} for chaining + * @api public + */ +Passport.prototype.unuse = function(name) { + delete this._strategies[name]; + return this; +} + +/** + * Passport's primary initialization middleware. + * + * This middleware must be in use by the Connect/Express application for + * Passport to operate. + * + * Options: + * - `userProperty` Property to set on `req` upon login, defaults to _user_ + * + * Examples: + * + * app.configure(function() { + * app.use(passport.initialize()); + * }); + * + * app.configure(function() { + * app.use(passport.initialize({ userProperty: 'currentUser' })); + * }); + * + * @param {Object} options + * @return {Function} middleware + * @api public + */ +Passport.prototype.initialize = function(options) { + options = options || {}; + this._userProperty = options.userProperty || 'user'; + + return initialize().bind(this); +} + +/** + * Middleware that will restore login state from a session. + * + * Web applications typically use sessions to maintain login state between + * requests. For example, a user will authenticate by entering credentials into + * a form which is submitted to the server. If the credentials are valid, a + * login session is established by setting a cookie containing a session + * identifier in the user's web browser. The web browser will send this cookie + * in subsequent requests to the server, allowing a session to be maintained. + * + * If sessions are being utilized, and a login session has been established, + * this middleware will populate `req.user` with the current user. + * + * Note that sessions are not strictly required for Passport to operate. + * However, as a general rule, most web applications will make use of sessions. + * An exception to this rule would be an API server, which expects each HTTP + * request to provide credentials in an Authorization header. + * + * Examples: + * + * app.configure(function() { + * app.use(connect.cookieParser()); + * app.use(connect.session({ secret: 'keyboard cat' })); + * app.use(passport.initialize()); + * app.use(passport.session()); + * }); + * + * @return {Function} middleware + * @api public + */ +Passport.prototype.session = function() { + return this.authenticate('session'); +} + +/** + * Middleware that will authenticate a request using the given `strategy` name, + * with optional `options` and `callback`. + * + * Examples: + * + * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' })(req, res); + * + * passport.authenticate('local', function(err, user) { + * if (!user) { return res.redirect('/login'); } + * res.end('Authenticated!'); + * })(req, res); + * + * passport.authenticate('basic', { session: false })(req, res); + * + * app.get('/auth/twitter', passport.authenticate('twitter'), function(req, res) { + * // request will be redirected to Twitter + * }); + * app.get('/auth/twitter/callback', passport.authenticate('twitter'), function(req, res) { + * res.json(req.user); + * }); + * + * @param {String} strategy + * @param {Object} options + * @param {Function} callback + * @return {Function} middleware + * @api public + */ +Passport.prototype.authenticate = function(strategy, options, callback) { + return authenticate(strategy, options, callback).bind(this); +} + +/** + * Middleware that will authorize a third-party account using the given + * `strategy` name, with optional `options`. + * + * If authorization is successful, the result provided by the strategy's verify + * callback will be assigned to `req.account`. The existing login session and + * `req.user` will be unaffected. + * + * This function is particularly useful when connecting third-party accounts + * to the local account of a user that is currently authenticated. + * + * Examples: + * + * passport.authorize('twitter-authz', { failureRedirect: '/account' }); + * + * @param {String} strategy + * @param {Object} options + * @return {Function} middleware + * @api public + */ +Passport.prototype.authorize = function(strategy, options, callback) { + options = options || {}; + options.assignProperty = 'account'; + + return authenticate(strategy, options, callback).bind(this); +} + +/** + * Registers a function used to serialize user objects into the session. + * + * Examples: + * + * passport.serializeUser(function(user, done) { + * done(null, user.id); + * }); + * + * @api public + */ +Passport.prototype.serializeUser = function(fn, done) { + if (typeof fn === 'function') { + return this._serializers.push(fn); + } + + // private implementation that traverses the chain of serializers, attempting + // to serialize a user + var user = fn; + + var stack = this._serializers; + (function pass(i, err, obj) { + // serializers use 'pass' as an error to skip processing + if ('pass' === err) { + err = undefined; + } + // an error or serialized object was obtained, done + if (err || obj || obj === 0) { return done(err, obj); } + + var layer = stack[i]; + if (!layer) { + return done(new Error('failed to serialize user into session')); + } + + try { + layer(user, function(e, o) { pass(i + 1, e, o); } ) + } catch(e) { + return done(e); + } + })(0); +} + +/** + * Registers a function used to deserialize user objects out of the session. + * + * Examples: + * + * passport.deserializeUser(function(id, done) { + * User.findById(id, function (err, user) { + * done(err, user); + * }); + * }); + * + * @api public + */ +Passport.prototype.deserializeUser = function(fn, done) { + if (typeof fn === 'function') { + return this._deserializers.push(fn); + } + + // private implementation that traverses the chain of deserializers, + // attempting to deserialize a user + var obj = fn; + + var stack = this._deserializers; + (function pass(i, err, user) { + // deserializers use 'pass' as an error to skip processing + if ('pass' === err) { + err = undefined; + } + // an error or deserialized user was obtained, done + if (err || user) { return done(err, user); } + // a valid user existed when establishing the session, but that user has + // since been removed + if (user === null || user === false) { return done(null, false); } + + var layer = stack[i]; + if (!layer) { + return done(new Error('failed to deserialize user out of session')); + } + + try { + layer(obj, function(e, u) { pass(i + 1, e, u); } ) + } catch(e) { + return done(e); + } + })(0); +} + +/** + * Registers a function used to transform auth info. + * + * In some circumstances authorization details are contained in authentication + * credentials or loaded as part of verification. + * + * For example, when using bearer tokens for API authentication, the tokens may + * encode (either directly or indirectly in a database), details such as scope + * of access or the client to which the token was issued. + * + * Such authorization details should be enforced separately from authentication. + * Because Passport deals only with the latter, this is the responsiblity of + * middleware or routes further along the chain. However, it is not optimal to + * decode the same data or execute the same database query later. To avoid + * this, Passport accepts optional `info` along with the authenticated `user` + * in a strategy's `success()` action. This info is set at `req.authInfo`, + * where said later middlware or routes can access it. + * + * Optionally, applications can register transforms to proccess this info, + * which take effect prior to `req.authInfo` being set. This is useful, for + * example, when the info contains a client ID. The transform can load the + * client from the database and include the instance in the transformed info, + * allowing the full set of client properties to be convieniently accessed. + * + * If no transforms are registered, `info` supplied by the strategy will be left + * unmodified. + * + * Examples: + * + * passport.transformAuthInfo(function(info, done) { + * Client.findById(info.clientID, function (err, client) { + * info.client = client; + * done(err, info); + * }); + * }); + * + * @api public + */ +Passport.prototype.transformAuthInfo = function(fn, done) { + if (typeof fn === 'function') { + return this._infoTransformers.push(fn); + } + + // private implementation that traverses the chain of transformers, + // attempting to transform auth info + var info = fn; + + var stack = this._infoTransformers; + (function pass(i, err, tinfo) { + // transformers use 'pass' as an error to skip processing + if ('pass' === err) { + err = undefined; + } + // an error or transformed info was obtained, done + if (err || tinfo) { return done(err, tinfo); } + + var layer = stack[i]; + if (!layer) { + // if no transformers are registered (or they all pass), the default + // behavior is to use the un-transformed info as-is + return done(null, info); + } + + try { + var arity = layer.length; + if (arity == 1) { + // sync + var t = layer(info); + pass(i + 1, null, t); + } else { + // async + layer(info, function(e, t) { pass(i + 1, e, t); } ) + } + } catch(e) { + return done(e); + } + })(0); +} + +/** + * Return strategy with given `name`. + * + * @param {String} name + * @return {Strategy} + * @api private + */ +Passport.prototype._strategy = function(name) { + return this._strategies[name]; +} + + +/** + * Export default singleton. + * + * @api public + */ +exports = module.exports = new Passport(); + +/** + * Framework version. + */ +require('pkginfo')(module, 'version'); + +/** + * Expose constructors. + */ +exports.Passport = Passport; +exports.Strategy = Strategy; + + +/** + * Expose strategies. + */ +exports.strategies = {}; +exports.strategies.SessionStrategy = SessionStrategy; + + +/** + * HTTP extensions. + */ +require('./http/request'); diff --git a/node_modules/passport/lib/passport/middleware/authenticate.js b/node_modules/passport/lib/passport/middleware/authenticate.js new file mode 100644 index 0000000..d02f498 --- /dev/null +++ b/node_modules/passport/lib/passport/middleware/authenticate.js @@ -0,0 +1,253 @@ +/** + * Module dependencies. + */ +var util = require('util') + , actions = require('../context/http/actions') + , Context = require('../context/http/context') + + +/** + * Authenticates requests. + * + * Applies the `name`ed strategy (or strategies) to the incoming request, in + * order to authenticate the request. If authentication is successful, the user + * will be logged in and populated at `req.user` and a session will be + * established by default. If authentication fails, an unauthorized response + * will be sent. + * + * Options: + * - `session` Save login state in session, defaults to _true_ + * - `successRedirect` After successful login, redirect to given URL + * - `failureRedirect` After failed login, redirect to given URL + * - `assignProperty` Assign the object provided by the verify callback to given property + * + * An optional `callback` can be supplied to allow the application to overrride + * the default manner in which authentication attempts are handled. The + * callback has the following signature, where `user` will be set to the + * authenticated user on a successful authentication attempt, or `false` + * otherwise. An optional `info` argument will be passed, containing additional + * details provided by the strategy's verify callback. + * + * app.get('/protected', function(req, res, next) { + * passport.authenticate('local', function(err, user, info) { + * if (err) { return next(err) } + * if (!user) { return res.redirect('/signin') } + * res.redirect('/account'); + * })(req, res, next); + * }); + * + * Note that if a callback is supplied, it becomes the application's + * responsibility to log-in the user, establish a session, and otherwise perform + * the desired operations. + * + * Examples: + * + * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' }); + * + * passport.authenticate('basic', { session: false }); + * + * passport.authenticate('twitter'); + * + * @param {String} name + * @param {Object} options + * @param {Function} callback + * @return {Function} + * @api public + */ +module.exports = function authenticate(name, options, callback) { + if (!callback && typeof options === 'function') { + callback = options; + options = {}; + } + options = options || {}; + + // Cast `name` to an array, allowing authentication to pass through a chain of + // strategies. The first strategy to succeed, redirect, or error will halt + // the chain. Authentication failures will proceed through each strategy in + // series, ultimately failing if all strategies fail. + // + // This is typically used on API endpoints to allow clients to authenticate + // using their preferred choice of Basic, Digest, token-based schemes, etc. + // It is not feasible to construct a chain of multiple strategies that involve + // redirection (for example both Facebook and Twitter), since the first one to + // redirect will halt the chain. + if (!Array.isArray(name)) { + name = [ name ]; + } + + return function authenticate(req, res, next) { + var passport = this; + + // accumulator for failures from each strategy in the chain + var failures = []; + + function allFailed() { + if (callback) { + if (failures.length == 1) { + return callback(null, false, failures[0].challenge, failures[0].status); + } else { + var challenges = failures.map(function(f) { return f.challenge; }); + var statuses = failures.map(function(f) { return f.status; }) + return callback(null, false, challenges, statuses); + } + } + + // Strategies are ordered by priority. For the purpose of flashing a + // message, the first failure will be displayed. + var failure = failures[0] || {} + , challenge = failure.challenge || {}; + + if (options.failureFlash) { + var flash = options.failureFlash; + if (typeof flash == 'string') { + flash = { type: 'error', message: flash }; + } + flash.type = flash.type || 'error'; + + var type = flash.type || challenge.type || 'error'; + var msg = flash.message || challenge.message || challenge; + if (typeof msg == 'string') { + req.flash(type, msg); + } + } + if (options.failureMessage) { + var msg = options.failureMessage; + if (typeof msg == 'boolean') { + msg = challenge.message || challenge; + } + if (typeof msg == 'string') { + req.session.messages = req.session.messages || []; + req.session.messages.push(msg); + } + } + if (options.failureRedirect) { + return res.redirect(options.failureRedirect); + } + + // When failure handling is not delegated to the application, the default + // is to respond with 401 Unauthorized. Note that the WWW-Authenticate + // header will be set according to the strategies in use (see + // actions#fail). If multiple strategies failed, each of their challenges + // will be included in the response. + var rchallenge = [] + , rstatus; + + for (var j = 0, len = failures.length; j < len; j++) { + var failure = failures[j] + , challenge = failure.challenge || {} + , status = failure.status; + if (typeof challenge == 'number') { + status = challenge; + challenge = null; + } + + rstatus = rstatus || status; + if (typeof challenge == 'string') { + rchallenge.push(challenge) + } + } + + res.statusCode = rstatus || 401; + if (rchallenge.length) { + res.setHeader('WWW-Authenticate', rchallenge); + } + res.end('Unauthorized'); + } + + (function attempt(i) { + var delegate = {}; + delegate.success = function(user, info) { + if (callback) { + return callback(null, user, info); + } + + info = info || {} + + if (options.successFlash) { + var flash = options.successFlash; + if (typeof flash == 'string') { + flash = { type: 'success', message: flash }; + } + flash.type = flash.type || 'success'; + + var type = flash.type || info.type || 'success'; + var msg = flash.message || info.message || info; + if (typeof msg == 'string') { + req.flash(type, msg); + } + } + if (options.successMessage) { + var msg = options.successMessage; + if (typeof msg == 'boolean') { + msg = info.message || info; + } + if (typeof msg == 'string') { + req.session.messages = req.session.messages || []; + req.session.messages.push(msg); + } + } + if (options.assignProperty) { + req[options.assignProperty] = user; + return next(); + } + + req.logIn(user, options, function(err) { + if (err) { return next(err); } + if (options.authInfo || options.authInfo === undefined) { + passport.transformAuthInfo(info, function(err, tinfo) { + if (err) { return next(err); } + req.authInfo = tinfo; + complete(); + }); + } else { + complete(); + } + + function complete() { + if (options.successReturnToOrRedirect) { + var url = options.successReturnToOrRedirect; + if (req.session && req.session.returnTo) { + url = req.session.returnTo; + delete req.session.returnTo; + } + return res.redirect(url); + } + if (options.successRedirect) { + return res.redirect(options.successRedirect); + } + next(); + } + }); + } + delegate.fail = function(challenge, status) { + // push this failure into the accumulator and attempt authentication + // using the next strategy + failures.push({ challenge: challenge, status: status }); + attempt(i + 1); + } + + var layer = name[i]; + // If no more strategies exist in the chain, authentication has failed. + if (!layer) { return allFailed(); } + + // Get the strategy, which will be used as prototype from which to create + // a new instance. Action functions will then be bound to the strategy + // within the context of the HTTP request/response pair. + var prototype = passport._strategy(layer); + if (!prototype) { return next(new Error('no strategy registered under name: ' + layer)); } + + var strategy = Object.create(prototype); + var context = new Context(delegate, req, res, next); + augment(strategy, actions, context); + + strategy.authenticate(req, options); + })(0); // attempt + } +} + + +function augment(strategy, actions, ctx) { + for (var method in actions) { + strategy[method] = actions[method].bind(ctx); + } +} diff --git a/node_modules/passport/lib/passport/middleware/initialize.js b/node_modules/passport/lib/passport/middleware/initialize.js new file mode 100644 index 0000000..c44e391 --- /dev/null +++ b/node_modules/passport/lib/passport/middleware/initialize.js @@ -0,0 +1,71 @@ +/** + * Module dependencies. + */ +var util = require('util'); + + +/** + * Passport initialization. + * + * Intializes Passport for incoming requests, allowing authentication strategies + * to be applied. + * + * If sessions are being utilized, applications must set up Passport with + * functions to serialize a user into and out of a session. For example, a + * common pattern is to serialize just the user ID into the session (due to the + * fact that it is desirable to store the minimum amount of data in a session). + * When a subsequent request arrives for the session, the full User object can + * be loaded from the database by ID. + * + * Note that additional middleware is required to persist login state, so we + * must use the `connect.session()` middleware _before_ `passport.initialize()`. + * + * This middleware must be in use by the Connect/Express application for + * Passport to operate. + * + * Examples: + * + * app.configure(function() { + * app.use(connect.cookieParser()); + * app.use(connect.session({ secret: 'keyboard cat' })); + * app.use(passport.initialize()); + * app.use(passport.session()); + * }); + * + * passport.serializeUser(function(user, done) { + * done(null, user.id); + * }); + * + * passport.deserializeUser(function(id, done) { + * User.findById(id, function (err, user) { + * done(err, user); + * }); + * }); + * + * @return {Function} + * @api public + */ +module.exports = function initialize() { + + return function initialize(req, res, next) { + var passport = this; + req._passport = {}; + req._passport.instance = passport; + + //console.log('!! session: ' + util.inspect(req.session)); + + if (req.session && req.session[passport._key]) { + // load data from existing session + req._passport.session = req.session[passport._key]; + } else if (req.session) { + // initialize new session + req.session[passport._key] = {}; + req._passport.session = req.session[passport._key]; + } else { + // no session is available + req._passport.session = {}; + } + + next(); + } +} diff --git a/node_modules/passport/lib/passport/strategies/session.js b/node_modules/passport/lib/passport/strategies/session.js new file mode 100644 index 0000000..e258999 --- /dev/null +++ b/node_modules/passport/lib/passport/strategies/session.js @@ -0,0 +1,60 @@ +/** + * Module dependencies. + */ +var util = require('util') + , Strategy = require('../strategy'); + + +/** + * `SessionStrategy` constructor. + * + * @api protected + */ +function SessionStrategy() { + Strategy.call(this); + this.name = 'session'; +} + +/** + * Inherit from `Strategy`. + */ +util.inherits(SessionStrategy, Strategy); + +/** + * Authenticate request based on the current session state. + * + * The session authentication strategy uses the session to restore any login + * state across requests. If a login session has been established, `req.user` + * will be populated with the current user. + * + * This strategy is registered automatically by Passport. + * + * @param {Object} req + * @api protected + */ +SessionStrategy.prototype.authenticate = function(req) { + if (!req._passport) { return this.error(new Error('passport.initialize() middleware not in use')); } + + var self = this + , su = req._passport.session.user; + if (su || su === 0) { + req._passport.instance.deserializeUser(su, function(err, user) { + if (err) { return self.error(err); } + if (!user) { + delete req._passport.session.user; + return self.pass(); + }; + var property = req._passport.instance._userProperty || 'user'; + req[property] = user; + self.pass(); + }); + } else { + self.pass(); + } +} + + +/** + * Expose `SessionStrategy`. + */ +module.exports = SessionStrategy; diff --git a/node_modules/passport/lib/passport/strategy.js b/node_modules/passport/lib/passport/strategy.js new file mode 100644 index 0000000..7a93852 --- /dev/null +++ b/node_modules/passport/lib/passport/strategy.js @@ -0,0 +1,33 @@ +/** + * Module dependencies. + */ +var util = require('util'); + + +/** + * `Strategy` constructor. + * + * @api public + */ +function Strategy() { +} + +/** + * Authenticate request. + * + * This function must be overridden by subclasses. In abstract form, it always + * throws an exception. + * + * @param {Object} req + * @param {Object} options + * @api protected + */ +Strategy.prototype.authenticate = function(req, options) { + throw new Error('Strategy#authenticate must be overridden by subclass'); +} + + +/** + * Expose `Strategy`. + */ +module.exports = Strategy; diff --git a/node_modules/passport/node_modules/pkginfo/.gitignore b/node_modules/passport/node_modules/pkginfo/.gitignore new file mode 100644 index 0000000..9303c34 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/README.md b/node_modules/passport/node_modules/pkginfo/README.md new file mode 100644 index 0000000..07ba942 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/README.md @@ -0,0 +1,85 @@ +# node-pkginfo + +An easy way to expose properties on a module from a package.json + +## Installation + +### Installing npm (node package manager) +``` + curl http://npmjs.org/install.sh | sh +``` + +### Installing pkginfo +``` + [sudo] npm install pkginfo +``` + +## Motivation +How often when writing node.js modules have you written the following line(s) of code? + +* Hard code your version string into your code + +``` js + exports.version = '0.1.0'; +``` + +* Programmatically expose the version from the package.json + +``` js + exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; +``` + +In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** + +## Usage + +Using `pkginfo` is idiot-proof, just require and invoke it. + +``` js + var pkginfo = require('pkginfo')(module); + + console.dir(module.exports); +``` + +By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). + +Here's a sample of the output: + +``` + { name: 'simple-app', + description: 'A test fixture for pkginfo', + version: '0.1.0', + author: 'Charlie Robbins ', + keywords: [ 'test', 'fixture' ], + main: './index.js', + scripts: { test: 'vows test/*-test.js --spec' }, + engines: { node: '>= 0.4.0' } } +``` + +### Expose specific properties +If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: + +``` js + var pkginfo = require('pkginfo')(module, 'version', 'author'); + + console.dir(module.exports); +``` + +``` + { version: '0.1.0', + author: 'Charlie Robbins ' } +``` + +If you're looking for further usage see the [examples][0] included in this repository. + +## Run Tests +Tests are written in [vows][1] and give complete coverage of all APIs. + +``` + vows test/*-test.js --spec +``` + +[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples +[1]: http://vowsjs.org + +#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/docs/docco.css b/node_modules/passport/node_modules/pkginfo/docs/docco.css new file mode 100644 index 0000000..bd54134 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/docs/docco.css @@ -0,0 +1,194 @@ +/*--------------------- Layout and Typography ----------------------------*/ +body { + font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; + font-size: 15px; + line-height: 22px; + color: #252519; + margin: 0; padding: 0; +} +a { + color: #261a3b; +} + a:visited { + color: #261a3b; + } +p { + margin: 0 0 15px 0; +} +h4, h5, h6 { + color: #333; + margin: 6px 0 6px 0; + font-size: 13px; +} + h2, h3 { + margin-bottom: 0; + color: #000; + } + h1 { + margin-top: 40px; + margin-bottom: 15px; + color: #000; + } +#container { + position: relative; +} +#background { + position: fixed; + top: 0; left: 525px; right: 0; bottom: 0; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + z-index: -1; +} +#jump_to, #jump_page { + background: white; + -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; + -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; + font: 10px Arial; + text-transform: uppercase; + cursor: pointer; + text-align: right; +} +#jump_to, #jump_wrapper { + position: fixed; + right: 0; top: 0; + padding: 5px 10px; +} + #jump_wrapper { + padding: 0; + display: none; + } + #jump_to:hover #jump_wrapper { + display: block; + } + #jump_page { + padding: 5px 0 3px; + margin: 0 0 25px 25px; + } + #jump_page .source { + display: block; + padding: 5px 10px; + text-decoration: none; + border-top: 1px solid #eee; + } + #jump_page .source:hover { + background: #f5f5ff; + } + #jump_page .source:first-child { + } +table td { + border: 0; + outline: 0; +} + td.docs, th.docs { + max-width: 450px; + min-width: 450px; + min-height: 5px; + padding: 10px 25px 1px 50px; + overflow-x: hidden; + vertical-align: top; + text-align: left; + } + .docs pre { + margin: 15px 0 15px; + padding-left: 15px; + } + .docs p tt, .docs p code { + background: #f8f8ff; + border: 1px solid #dedede; + font-size: 12px; + padding: 0 0.2em; + } + .pilwrap { + position: relative; + } + .pilcrow { + font: 12px Arial; + text-decoration: none; + color: #454545; + position: absolute; + top: 3px; left: -20px; + padding: 1px 2px; + opacity: 0; + -webkit-transition: opacity 0.2s linear; + } + td.docs:hover .pilcrow { + opacity: 1; + } + td.code, th.code { + padding: 14px 15px 16px 25px; + width: 100%; + vertical-align: top; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + } + pre, tt, code { + font-size: 12px; line-height: 18px; + font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; + margin: 0; padding: 0; + } + + +/*---------------------- Syntax Highlighting -----------------------------*/ +td.linenos { background-color: #f0f0f0; padding-right: 10px; } +span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } +body .hll { background-color: #ffffcc } +body .c { color: #408080; font-style: italic } /* Comment */ +body .err { border: 1px solid #FF0000 } /* Error */ +body .k { color: #954121 } /* Keyword */ +body .o { color: #666666 } /* Operator */ +body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +body .cp { color: #BC7A00 } /* Comment.Preproc */ +body .c1 { color: #408080; font-style: italic } /* Comment.Single */ +body .cs { color: #408080; font-style: italic } /* Comment.Special */ +body .gd { color: #A00000 } /* Generic.Deleted */ +body .ge { font-style: italic } /* Generic.Emph */ +body .gr { color: #FF0000 } /* Generic.Error */ +body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +body .gi { color: #00A000 } /* Generic.Inserted */ +body .go { color: #808080 } /* Generic.Output */ +body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +body .gs { font-weight: bold } /* Generic.Strong */ +body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +body .gt { color: #0040D0 } /* Generic.Traceback */ +body .kc { color: #954121 } /* Keyword.Constant */ +body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ +body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ +body .kp { color: #954121 } /* Keyword.Pseudo */ +body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ +body .kt { color: #B00040 } /* Keyword.Type */ +body .m { color: #666666 } /* Literal.Number */ +body .s { color: #219161 } /* Literal.String */ +body .na { color: #7D9029 } /* Name.Attribute */ +body .nb { color: #954121 } /* Name.Builtin */ +body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +body .no { color: #880000 } /* Name.Constant */ +body .nd { color: #AA22FF } /* Name.Decorator */ +body .ni { color: #999999; font-weight: bold } /* Name.Entity */ +body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +body .nf { color: #0000FF } /* Name.Function */ +body .nl { color: #A0A000 } /* Name.Label */ +body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +body .nt { color: #954121; font-weight: bold } /* Name.Tag */ +body .nv { color: #19469D } /* Name.Variable */ +body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +body .w { color: #bbbbbb } /* Text.Whitespace */ +body .mf { color: #666666 } /* Literal.Number.Float */ +body .mh { color: #666666 } /* Literal.Number.Hex */ +body .mi { color: #666666 } /* Literal.Number.Integer */ +body .mo { color: #666666 } /* Literal.Number.Oct */ +body .sb { color: #219161 } /* Literal.String.Backtick */ +body .sc { color: #219161 } /* Literal.String.Char */ +body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ +body .s2 { color: #219161 } /* Literal.String.Double */ +body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +body .sh { color: #219161 } /* Literal.String.Heredoc */ +body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +body .sx { color: #954121 } /* Literal.String.Other */ +body .sr { color: #BB6688 } /* Literal.String.Regex */ +body .s1 { color: #219161 } /* Literal.String.Single */ +body .ss { color: #19469D } /* Literal.String.Symbol */ +body .bp { color: #954121 } /* Name.Builtin.Pseudo */ +body .vc { color: #19469D } /* Name.Variable.Class */ +body .vg { color: #19469D } /* Name.Variable.Global */ +body .vi { color: #19469D } /* Name.Variable.Instance */ +body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html b/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html new file mode 100644 index 0000000..bf615fa --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html @@ -0,0 +1,101 @@ + pkginfo.js

    pkginfo.js

    /*
    + * pkginfo.js: Top-level include for the pkginfo module
    + *
    + * (C) 2011, Charlie Robbins
    + *
    + */
    + 
    +var fs = require('fs'),
    +    path = require('path');

    function pkginfo ([options, 'property', 'property' ..])

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @options {Object|Array|string} Optional Options used when exposing properties.

    + +

    @arguments {string...} Optional Specified properties to expose.

    + +

    Exposes properties from the package.json file for the parent module on +it's exports. Valid usage:

    + +

    require('pkginfo')()

    + +

    require('pkginfo')('version', 'author');

    + +

    require('pkginfo')(['version', 'author']);

    + +

    require('pkginfo')({ include: ['version', 'author'] });

    var pkginfo = module.exports = function (pmodule, options) {
    +  var args = [].slice.call(arguments, 2).filter(function (arg) {
    +    return typeof arg === 'string';
    +  });
    +  

    Parse variable arguments

      if (Array.isArray(options)) {

    If the options passed in is an Array assume that +it is the Array of properties to expose from the +on the package.json file on the parent module.

        options = { include: options };
    +  }
    +  else if (typeof options === 'string') {

    Otherwise if the first argument is a string, then +assume that it is the first property to expose from +the package.json file on the parent module.

        options = { include: [options] };
    +  }
    +  

    Setup default options

      options = options || { include: [] };
    +  
    +  if (args.length > 0) {

    If additional string arguments have been passed in +then add them to the properties to expose on the +parent module.

        options.include = options.include.concat(args);
    +  }
    +  
    +  var pkg = pkginfo.read(pmodule, options.dir).package;
    +  Object.keys(pkg).forEach(function (key) {
    +    if (options.include.length > 0 && !~options.include.indexOf(key)) {
    +      return;
    +    }
    +    
    +    if (!pmodule.exports[key]) {
    +      pmodule.exports[key] = pkg[key];
    +    }
    +  });
    +  
    +  return pkginfo;
    +};

    function find (dir)

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @dir {string} Optional Directory to start search from.

    + +

    Searches up the directory tree from dir until it finds a directory +which contains a package.json file.

    pkginfo.find = function (pmodule, dir) {
    +  dir = dir || pmodule.filename;
    +  dir = path.dirname(dir); 
    +  
    +  var files = fs.readdirSync(dir);
    +  
    +  if (~files.indexOf('package.json')) {
    +    return path.join(dir, 'package.json');
    +  }
    +  
    +  if (dir === '/') {
    +    throw new Error('Could not find package.json up from: ' + dir);
    +  }
    +  
    +  return pkginfo.find(dir);
    +};

    function read (pmodule, dir)

    + +

    @pmodule {Module} Parent module to read from.

    + +

    @dir {string} Optional Directory to start search from.

    + +

    Searches up the directory tree from dir until it finds a directory +which contains a package.json file and returns the package information.

    pkginfo.read = function (pmodule, dir) { 
    +  dir = pkginfo.find(pmodule, dir);
    +  
    +  var data = fs.readFileSync(dir).toString();
    +      
    +  return {
    +    dir: dir, 
    +    package: JSON.parse(data)
    +  };
    +};

    Call pkginfo on this module and expose version.

    pkginfo(module, {
    +  dir: __dirname,
    +  include: ['version'],
    +  target: pkginfo
    +});
    +
    +
    \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/all-properties.js b/node_modules/passport/node_modules/pkginfo/examples/all-properties.js new file mode 100644 index 0000000..fd1d831 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/all-properties.js @@ -0,0 +1,19 @@ +/* + * all-properties.js: Sample of including all properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/array-argument.js b/node_modules/passport/node_modules/pkginfo/examples/array-argument.js new file mode 100644 index 0000000..b1b6848 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/array-argument.js @@ -0,0 +1,20 @@ +/* + * array-argument.js: Sample of including specific properties from a package.json file + * using Array argument syntax. + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js new file mode 100644 index 0000000..b4b5fd6 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js @@ -0,0 +1,19 @@ +/* + * multiple-properties.js: Sample of including multiple properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/object-argument.js b/node_modules/passport/node_modules/pkginfo/examples/object-argument.js new file mode 100644 index 0000000..28420c8 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/object-argument.js @@ -0,0 +1,22 @@ +/* + * object-argument.js: Sample of including specific properties from a package.json file + * using Object argument syntax. + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, { + include: ['version', 'author'] + }); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/package.json b/node_modules/passport/node_modules/pkginfo/examples/package.json new file mode 100644 index 0000000..1f2f01c --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/package.json @@ -0,0 +1,10 @@ +{ + "name": "simple-app", + "description": "A test fixture for pkginfo", + "version": "0.1.0", + "author": "Charlie Robbins ", + "keywords": ["test", "fixture"], + "main": "./index.js", + "scripts": { "test": "vows test/*-test.js --spec" }, + "engines": { "node": ">= 0.4.0" } +} diff --git a/node_modules/passport/node_modules/pkginfo/examples/single-property.js b/node_modules/passport/node_modules/pkginfo/examples/single-property.js new file mode 100644 index 0000000..4f44561 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/examples/single-property.js @@ -0,0 +1,19 @@ +/* + * single-property.js: Sample of including a single specific properties from a package.json file + * + * (C) 2011, Charlie Robbins + * + */ + +var util = require('util'), + pkginfo = require('../lib/pkginfo')(module, 'version'); + +exports.someFunction = function () { + console.log('some of your custom logic here'); +}; + +console.log('Inspecting module:'); +console.dir(module.exports); + +console.log('\nAll exports exposed:'); +console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js b/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js new file mode 100644 index 0000000..a4a6227 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js @@ -0,0 +1,132 @@ +/* + * pkginfo.js: Top-level include for the pkginfo module + * + * (C) 2011, Charlie Robbins + * + */ + +var fs = require('fs'), + path = require('path'); + +// +// ### function pkginfo ([options, 'property', 'property' ..]) +// #### @pmodule {Module} Parent module to read from. +// #### @options {Object|Array|string} **Optional** Options used when exposing properties. +// #### @arguments {string...} **Optional** Specified properties to expose. +// Exposes properties from the package.json file for the parent module on +// it's exports. Valid usage: +// +// `require('pkginfo')()` +// +// `require('pkginfo')('version', 'author');` +// +// `require('pkginfo')(['version', 'author']);` +// +// `require('pkginfo')({ include: ['version', 'author'] });` +// +var pkginfo = module.exports = function (pmodule, options) { + var args = [].slice.call(arguments, 2).filter(function (arg) { + return typeof arg === 'string'; + }); + + // + // **Parse variable arguments** + // + if (Array.isArray(options)) { + // + // If the options passed in is an Array assume that + // it is the Array of properties to expose from the + // on the package.json file on the parent module. + // + options = { include: options }; + } + else if (typeof options === 'string') { + // + // Otherwise if the first argument is a string, then + // assume that it is the first property to expose from + // the package.json file on the parent module. + // + options = { include: [options] }; + } + + // + // **Setup default options** + // + options = options || { include: [] }; + + if (args.length > 0) { + // + // If additional string arguments have been passed in + // then add them to the properties to expose on the + // parent module. + // + options.include = options.include.concat(args); + } + + var pkg = pkginfo.read(pmodule, options.dir).package; + Object.keys(pkg).forEach(function (key) { + if (options.include.length > 0 && !~options.include.indexOf(key)) { + return; + } + + if (!pmodule.exports[key]) { + pmodule.exports[key] = pkg[key]; + } + }); + + return pkginfo; +}; + +// +// ### function find (dir) +// #### @pmodule {Module} Parent module to read from. +// #### @dir {string} **Optional** Directory to start search from. +// Searches up the directory tree from `dir` until it finds a directory +// which contains a `package.json` file. +// +pkginfo.find = function (pmodule, dir) { + dir = dir || pmodule.filename; + dir = path.dirname(dir); + + var files = fs.readdirSync(dir); + + if (~files.indexOf('package.json')) { + return path.join(dir, 'package.json'); + } + + if (dir === '/') { + throw new Error('Could not find package.json up from: ' + dir); + } + else if (!dir || dir === '.') { + throw new Error('Cannot find package.json from unspecified directory'); + } + + return pkginfo.find(pmodule, dir); +}; + +// +// ### function read (pmodule, dir) +// #### @pmodule {Module} Parent module to read from. +// #### @dir {string} **Optional** Directory to start search from. +// Searches up the directory tree from `dir` until it finds a directory +// which contains a `package.json` file and returns the package information. +// +pkginfo.read = function (pmodule, dir) { + dir = pkginfo.find(pmodule, dir); + + var data = fs.readFileSync(dir).toString(); + + return { + dir: dir, + package: JSON.parse(data) + }; +}; + +// +// Call `pkginfo` on this module and expose version. +// +pkginfo(module, { + dir: __dirname, + include: ['version'], + target: pkginfo +}); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/package.json b/node_modules/passport/node_modules/pkginfo/package.json new file mode 100644 index 0000000..0e9e4e7 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/package.json @@ -0,0 +1,17 @@ +{ + "name": "pkginfo", + "version": "0.2.3", + "description": "An easy way to expose properties on a module from a package.json", + "author": "Charlie Robbins ", + "repository": { + "type": "git", + "url": "http://github.com/indexzero/node-pkginfo.git" + }, + "keywords": ["info", "tools", "package.json"], + "devDependencies": { + "vows": "0.6.x" + }, + "main": "./lib/pkginfo", + "scripts": { "test": "vows test/*-test.js --spec" }, + "engines": { "node": ">= 0.4.0" } +} diff --git a/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js new file mode 100644 index 0000000..3156c00 --- /dev/null +++ b/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js @@ -0,0 +1,69 @@ +/* + * pkginfo-test.js: Tests for the pkginfo module. + * + * (C) 2011, Charlie Robbins + * + */ + +var assert = require('assert'), + exec = require('child_process').exec, + fs = require('fs'), + path = require('path'), + vows = require('vows'), + pkginfo = require('../lib/pkginfo'); + +function assertProperties (source, target) { + assert.lengthOf(source, target.length + 1); + target.forEach(function (prop) { + assert.isTrue(!!~source.indexOf(prop)); + }); +} + +function testExposes (options) { + return { + topic: function () { + exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); + }, + "should expose that property correctly": function (err, stdout, stderr) { + assert.isNull(err); + + var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { + return p.substring(1, p.length - 1); + }); + + return !options.assert + ? assertProperties(exposed, options.properties) + : options.assert(exposed); + } + } +} + +vows.describe('pkginfo').addBatch({ + "When using the pkginfo module": { + "and passed a single `string` argument": testExposes({ + script: 'single-property.js', + properties: ['version'] + }), + "and passed multiple `string` arguments": testExposes({ + script: 'multiple-properties.js', + properties: ['version', 'author'] + }), + "and passed an `object` argument": testExposes({ + script: 'object-argument.js', + properties: ['version', 'author'] + }), + "and passed an `array` argument": testExposes({ + script: 'array-argument.js', + properties: ['version', 'author'] + }), + "and passed no arguments": testExposes({ + script: 'all-properties.js', + assert: function (exposed) { + var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), + keys = Object.keys(JSON.parse(pkg)); + + assertProperties(exposed, keys); + } + }) + } +}).export(module); diff --git a/node_modules/passport/package.json b/node_modules/passport/package.json new file mode 100644 index 0000000..f2876a5 --- /dev/null +++ b/node_modules/passport/package.json @@ -0,0 +1,30 @@ +{ + "name": "passport", + "version": "0.1.15", + "description": "Simple, unobtrusive authentication for Node.js.", + "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, + "homepage": "http://passportjs.org/", + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/passport.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/passport/issues" + }, + "main": "./lib/passport", + "dependencies": { + "pkginfo": "0.2.x" + }, + "devDependencies": { + "vows": "0.6.x" + }, + "scripts": { + "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js test/context/http/*-test.js" + }, + "engines": { "node": ">= 0.4.0" }, + "licenses": [ { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } ], + "keywords": ["express", "connect", "auth", "authn", "authentication"] +} diff --git a/src/app.js b/src/app.js new file mode 100644 index 0000000..fff65e1 --- /dev/null +++ b/src/app.js @@ -0,0 +1,2 @@ +var express = require('express'); +var app = express(); From b8950a0d991a7557ffd4fa0b1126d218359d01cf Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Mon, 18 Feb 2013 00:27:39 -0800 Subject: [PATCH 03/11] trying passport, no luck :( --- .gitignore | 1 - src/app.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f83e9dd..1f9d03c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .project -src/config.js *~ output/* *.diff diff --git a/src/app.js b/src/app.js index fff65e1..4bd7fd9 100644 --- a/src/app.js +++ b/src/app.js @@ -1,2 +1,39 @@ +var fs = require('fs'); var express = require('express'); var app = express(); +var passport = require('passport'); +var GitHubStrategy = require('passport-github').Strategy; + +var config = eval('(' + fs.readFileSync('../config/app.config', 'utf8') + ')'); + +passport.use(new GitHubStrategy({ + clientID: config.github.client_id, + clientSecret: config.github.client_secret + }, + function(accessToken, refreshToken, profile, done) { + console.log("accessToken: "+accessToken); + console.log("refreshToken: "+refreshToken); + console.log(profile); + done(null,profile); + } +)); + +app.configure(function() { + app.use(express.cookieParser()); + app.use(express.bodyParser()); + app.use(express.session({ secret: config.session.secret })); + app.use(passport.initialize()); + app.use(passport.session()); +}); + +app.get("/github-login", passport.authenticate('github')); +app.get("/github-auth",function(req,res) { + console.log("github callback"); + console.log(req.params); + passport.authenticate('github', { failureRedirect: 'http://sdether.github.com/josh.js/githubconsole.html' }); + res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); +}); +app.get("/@session", function(req,res) { + res.send(req.session); +}) +app.listen(80); \ No newline at end of file From 7113d9b8b9b3cbe1f59523a74fa0ae98838a5620 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Mon, 18 Feb 2013 07:32:49 -0800 Subject: [PATCH 04/11] doing oauth manually now --- node_modules/everyauth/.gitignore | 7 + node_modules/everyauth/Makefile | 6 + node_modules/everyauth/README.md | 2681 +++++++++++++++++ node_modules/everyauth/documentup.json | 3 + node_modules/everyauth/example/conf.js | 119 + node_modules/everyauth/example/server.js | 435 +++ .../everyauth/example/views/home.jade | 181 ++ .../everyauth/example/views/layout.jade | 9 + .../everyauth/example/views/login.jade | 13 + .../everyauth/example/views/register.jade | 14 + node_modules/everyauth/index.js | 162 + .../everyauth/lib/modules/37signals.js | 51 + node_modules/everyauth/lib/modules/500px.js | 17 + .../everyauth/lib/modules/angellist.js | 49 + .../everyauth/lib/modules/azureacs.js | 157 + node_modules/everyauth/lib/modules/box.js | 161 + node_modules/everyauth/lib/modules/dropbox.js | 18 + node_modules/everyauth/lib/modules/dwolla.js | 64 + .../everyauth/lib/modules/evernote.js | 24 + .../everyauth/lib/modules/everymodule.js | 365 +++ .../everyauth/lib/modules/facebook.js | 86 + .../everyauth/lib/modules/foursquare.js | 56 + node_modules/everyauth/lib/modules/github.js | 50 + node_modules/everyauth/lib/modules/google.js | 132 + node_modules/everyauth/lib/modules/google1.js | 60 + .../everyauth/lib/modules/googlehybrid.js | 63 + node_modules/everyauth/lib/modules/gowalla.js | 62 + .../everyauth/lib/modules/instagram.js | 39 + .../everyauth/lib/modules/justintv.js | 24 + node_modules/everyauth/lib/modules/ldap.js | 28 + .../everyauth/lib/modules/linkedin.js | 66 + .../everyauth/lib/modules/mailchimp.js | 67 + node_modules/everyauth/lib/modules/mailru.js | 91 + .../everyauth/lib/modules/mendeley.js | 45 + node_modules/everyauth/lib/modules/mixi.js | 73 + node_modules/everyauth/lib/modules/oauth.js | 268 ++ node_modules/everyauth/lib/modules/oauth2.js | 317 ++ node_modules/everyauth/lib/modules/openid.js | 106 + node_modules/everyauth/lib/modules/osm.js | 40 + .../everyauth/lib/modules/password.js | 379 +++ .../everyauth/lib/modules/readability.js | 28 + node_modules/everyauth/lib/modules/skyrock.js | 24 + .../everyauth/lib/modules/soundcloud.js | 40 + node_modules/everyauth/lib/modules/tripit.js | 45 + node_modules/everyauth/lib/modules/tumblr.js | 26 + node_modules/everyauth/lib/modules/twitter.js | 56 + node_modules/everyauth/lib/modules/vimeo.js | 20 + .../everyauth/lib/modules/vkontakte.js | 47 + node_modules/everyauth/lib/modules/yahoo.js | 32 + node_modules/everyauth/lib/promise.js | 93 + .../everyauth/lib/routeTriggeredSequence.js | 14 + node_modules/everyauth/lib/step.js | 171 ++ node_modules/everyauth/lib/stepSequence.js | 198 ++ node_modules/everyauth/lib/utils.js | 35 + .../everyauth/lib/views/auth-fail.jade | 1 + node_modules/everyauth/media/37signals.ico | Bin 0 -> 2862 bytes node_modules/everyauth/media/500px.ico | Bin 0 -> 427 bytes node_modules/everyauth/media/angellist.ico | Bin 0 -> 9326 bytes node_modules/everyauth/media/box.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/dropbox.ico | Bin 0 -> 2550 bytes node_modules/everyauth/media/dwolla.ico | Bin 0 -> 556 bytes node_modules/everyauth/media/evernote.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/facebook.ico | Bin 0 -> 318 bytes node_modules/everyauth/media/foursquare.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/github.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/google.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/gowalla.ico | Bin 0 -> 472 bytes node_modules/everyauth/media/instagram.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/justintv.ico | Bin 0 -> 586 bytes node_modules/everyauth/media/linkedin.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/mailru.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/mendeley.ico | Bin 0 -> 1406 bytes node_modules/everyauth/media/mixi.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/openid.ico | Bin 0 -> 3638 bytes node_modules/everyauth/media/osm.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/readability.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/skyrock.ico | Bin 0 -> 7886 bytes node_modules/everyauth/media/soundcloud.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/tripit.png | Bin 0 -> 500 bytes node_modules/everyauth/media/tumblr.jpg | Bin 0 -> 509 bytes node_modules/everyauth/media/twitter.ico | Bin 0 -> 1150 bytes node_modules/everyauth/media/vimeo.gif | Bin 0 -> 967 bytes node_modules/everyauth/media/vkontakte.ico | Bin 0 -> 894 bytes node_modules/everyauth/media/yahoo.ico | Bin 0 -> 318 bytes node_modules/everyauth/package.json | 50 + node_modules/everyauth/test/creds.dummy.js | 18 + node_modules/everyauth/test/facebook.tobi.js | 57 + node_modules/everyauth/test/mailchimp.tobi.js | 38 + .../everyauth/test/password.satisfy.js | 121 + node_modules/everyauth/test/password.tobi.js | 143 + node_modules/everyauth/test/promise.test.js | 48 + .../everyauth/test/soundcloud.tobi.js | 38 + node_modules/everyauth/test/twitter.tobi.js | 42 + node_modules/everyauth/test/util/expect.js | 412 +++ node_modules/everyauth/test/util/satisfy.js | 102 + node_modules/querystring/History.md | 7 + node_modules/querystring/Readme.md | 8 + node_modules/querystring/package.json | 26 + node_modules/querystring/querystring.js | 108 + .../querystring/tests/test-querystring.js | 203 ++ node_modules/request/LICENSE | 55 + node_modules/request/README.md | 310 ++ node_modules/request/aws.js | 191 ++ node_modules/request/forever.js | 103 + node_modules/request/main.js | 1123 +++++++ .../request/node_modules/form-data/.npmignore | 5 + .../request/node_modules/form-data/Makefile | 7 + .../request/node_modules/form-data/Readme.md | 86 + .../node_modules/form-data/lib/form_data.js | 237 ++ .../form-data/node-form-data.sublime-project | 8 + .../node-form-data.sublime-workspace | 508 ++++ .../form-data/node_modules/async/.gitmodules | 9 + .../form-data/node_modules/async/LICENSE | 19 + .../form-data/node_modules/async/Makefile | 21 + .../form-data/node_modules/async/README.md | 970 ++++++ .../node_modules/async/async.min.js.gzip | Bin 0 -> 1859 bytes .../node_modules/async/deps/nodeunit.css | 70 + .../node_modules/async/deps/nodeunit.js | 1966 ++++++++++++ .../node_modules/async/dist/async.min.js | 1 + .../form-data/node_modules/async/index.js | 3 + .../form-data/node_modules/async/lib/async.js | 632 ++++ .../form-data/node_modules/async/nodelint.cfg | 4 + .../form-data/node_modules/async/package.json | 41 + .../form-data/node_modules/async/test/.swp | Bin 0 -> 12288 bytes .../node_modules/async/test/test-async.js | 1367 +++++++++ .../node_modules/async/test/test.html | 24 + .../node_modules/combined-stream/.npmignore | 3 + .../node_modules/combined-stream/License | 19 + .../node_modules/combined-stream/Makefile | 7 + .../node_modules/combined-stream/Readme.md | 132 + .../combined-stream/lib/combined_stream.js | 183 ++ .../node_modules/delayed-stream/.npmignore | 2 + .../node_modules/delayed-stream/License | 19 + .../node_modules/delayed-stream/Makefile | 7 + .../node_modules/delayed-stream/Readme.md | 154 + .../delayed-stream/lib/delayed_stream.js | 99 + .../node_modules/delayed-stream/package.json | 38 + .../delayed-stream/test/common.js | 6 + .../integration/test-delayed-http-upload.js | 38 + .../test-delayed-stream-auto-pause.js | 21 + .../integration/test-delayed-stream-pause.js | 14 + .../test/integration/test-delayed-stream.js | 48 + .../integration/test-handle-source-errors.js | 15 + .../test/integration/test-max-data-size.js | 18 + .../test/integration/test-pipe-resumes.js | 13 + .../test/integration/test-proxy-readable.js | 13 + .../node_modules/delayed-stream/test/run.js | 7 + .../node_modules/combined-stream/package.json | 39 + .../combined-stream/test/common.js | 12 + .../combined-stream/test/fixture/file1.txt | 256 ++ .../combined-stream/test/fixture/file2.txt | 256 ++ .../test/integration/test-callback-streams.js | 27 + .../test/integration/test-data-size.js | 34 + ...delayed-streams-and-buffers-and-strings.js | 38 + .../test/integration/test-delayed-streams.js | 35 + .../test/integration/test-max-data-size.js | 24 + .../test/integration/test-unpaused-streams.js | 30 + .../node_modules/combined-stream/test/run.js | 7 + .../node_modules/form-data/package.json | 43 + .../node_modules/form-data/test/common.js | 14 + .../form-data/test/fixture/bacon.txt | 1 + .../form-data/test/fixture/unicycle.jpg | Bin 0 -> 19806 bytes .../test/integration/test-form-get-length.js | 93 + .../test/integration/test-get-boundary.js | 18 + .../test/integration/test-http-response.js | 121 + .../form-data/test/integration/test-pipe.js | 111 + .../form-data/test/integration/test-submit.js | 107 + .../node_modules/form-data/test/run.js | 7 + .../request/node_modules/mime/LICENSE | 19 + .../request/node_modules/mime/README.md | 63 + .../request/node_modules/mime/mime.js | 104 + .../request/node_modules/mime/package.json | 42 + .../request/node_modules/mime/test.js | 55 + .../node_modules/mime/types/mime.types | 1588 ++++++++++ .../node_modules/mime/types/node.types | 59 + node_modules/request/oauth.js | 43 + node_modules/request/package.json | 17 + node_modules/request/tests/googledoodle.png | Bin 0 -> 38510 bytes node_modules/request/tests/run.js | 45 + node_modules/request/tests/server.js | 90 + node_modules/request/tests/squid.conf | 77 + node_modules/request/tests/ssl/ca/ca.cnf | 20 + node_modules/request/tests/ssl/ca/ca.crl | 0 node_modules/request/tests/ssl/ca/ca.crt | 17 + node_modules/request/tests/ssl/ca/ca.csr | 13 + node_modules/request/tests/ssl/ca/ca.key | 18 + node_modules/request/tests/ssl/ca/ca.srl | 1 + node_modules/request/tests/ssl/ca/server.cnf | 19 + node_modules/request/tests/ssl/ca/server.crt | 16 + node_modules/request/tests/ssl/ca/server.csr | 11 + node_modules/request/tests/ssl/ca/server.js | 28 + node_modules/request/tests/ssl/ca/server.key | 9 + node_modules/request/tests/ssl/npm-ca.crt | 16 + node_modules/request/tests/ssl/test.crt | 15 + node_modules/request/tests/ssl/test.key | 15 + node_modules/request/tests/test-body.js | 117 + node_modules/request/tests/test-cookie.js | 29 + node_modules/request/tests/test-cookiejar.js | 90 + node_modules/request/tests/test-defaults.js | 114 + node_modules/request/tests/test-errors.js | 37 + .../request/tests/test-follow-all-303.js | 30 + node_modules/request/tests/test-follow-all.js | 35 + node_modules/request/tests/test-form.js | 79 + node_modules/request/tests/test-headers.js | 52 + node_modules/request/tests/test-httpModule.js | 94 + .../request/tests/test-https-strict.js | 97 + node_modules/request/tests/test-https.js | 86 + node_modules/request/tests/test-oauth.js | 117 + node_modules/request/tests/test-params.js | 92 + .../request/tests/test-piped-redirect.js | 52 + node_modules/request/tests/test-pipes.js | 216 ++ node_modules/request/tests/test-pool.js | 16 + .../tests/test-protocol-changing-redirect.js | 60 + node_modules/request/tests/test-proxy.js | 39 + node_modules/request/tests/test-qs.js | 28 + node_modules/request/tests/test-redirect.js | 154 + node_modules/request/tests/test-s3.js | 13 + node_modules/request/tests/test-timeout.js | 87 + node_modules/request/tests/test-toJSON.js | 14 + node_modules/request/tests/test-tunnel.js | 63 + node_modules/request/tests/unicycle.jpg | Bin 0 -> 19806 bytes node_modules/request/tunnel.js | 227 ++ node_modules/request/uuid.js | 19 + node_modules/request/vendor/cookie/index.js | 65 + node_modules/request/vendor/cookie/jar.js | 72 + src/app.js | 58 +- 226 files changed, 23353 insertions(+), 27 deletions(-) create mode 100644 node_modules/everyauth/.gitignore create mode 100644 node_modules/everyauth/Makefile create mode 100644 node_modules/everyauth/README.md create mode 100644 node_modules/everyauth/documentup.json create mode 100644 node_modules/everyauth/example/conf.js create mode 100644 node_modules/everyauth/example/server.js create mode 100644 node_modules/everyauth/example/views/home.jade create mode 100644 node_modules/everyauth/example/views/layout.jade create mode 100644 node_modules/everyauth/example/views/login.jade create mode 100644 node_modules/everyauth/example/views/register.jade create mode 100644 node_modules/everyauth/index.js create mode 100644 node_modules/everyauth/lib/modules/37signals.js create mode 100644 node_modules/everyauth/lib/modules/500px.js create mode 100644 node_modules/everyauth/lib/modules/angellist.js create mode 100644 node_modules/everyauth/lib/modules/azureacs.js create mode 100644 node_modules/everyauth/lib/modules/box.js create mode 100644 node_modules/everyauth/lib/modules/dropbox.js create mode 100644 node_modules/everyauth/lib/modules/dwolla.js create mode 100644 node_modules/everyauth/lib/modules/evernote.js create mode 100644 node_modules/everyauth/lib/modules/everymodule.js create mode 100644 node_modules/everyauth/lib/modules/facebook.js create mode 100644 node_modules/everyauth/lib/modules/foursquare.js create mode 100644 node_modules/everyauth/lib/modules/github.js create mode 100644 node_modules/everyauth/lib/modules/google.js create mode 100644 node_modules/everyauth/lib/modules/google1.js create mode 100644 node_modules/everyauth/lib/modules/googlehybrid.js create mode 100644 node_modules/everyauth/lib/modules/gowalla.js create mode 100644 node_modules/everyauth/lib/modules/instagram.js create mode 100644 node_modules/everyauth/lib/modules/justintv.js create mode 100644 node_modules/everyauth/lib/modules/ldap.js create mode 100644 node_modules/everyauth/lib/modules/linkedin.js create mode 100644 node_modules/everyauth/lib/modules/mailchimp.js create mode 100644 node_modules/everyauth/lib/modules/mailru.js create mode 100644 node_modules/everyauth/lib/modules/mendeley.js create mode 100644 node_modules/everyauth/lib/modules/mixi.js create mode 100644 node_modules/everyauth/lib/modules/oauth.js create mode 100644 node_modules/everyauth/lib/modules/oauth2.js create mode 100644 node_modules/everyauth/lib/modules/openid.js create mode 100644 node_modules/everyauth/lib/modules/osm.js create mode 100644 node_modules/everyauth/lib/modules/password.js create mode 100644 node_modules/everyauth/lib/modules/readability.js create mode 100644 node_modules/everyauth/lib/modules/skyrock.js create mode 100644 node_modules/everyauth/lib/modules/soundcloud.js create mode 100644 node_modules/everyauth/lib/modules/tripit.js create mode 100644 node_modules/everyauth/lib/modules/tumblr.js create mode 100644 node_modules/everyauth/lib/modules/twitter.js create mode 100644 node_modules/everyauth/lib/modules/vimeo.js create mode 100644 node_modules/everyauth/lib/modules/vkontakte.js create mode 100644 node_modules/everyauth/lib/modules/yahoo.js create mode 100644 node_modules/everyauth/lib/promise.js create mode 100644 node_modules/everyauth/lib/routeTriggeredSequence.js create mode 100644 node_modules/everyauth/lib/step.js create mode 100644 node_modules/everyauth/lib/stepSequence.js create mode 100644 node_modules/everyauth/lib/utils.js create mode 100644 node_modules/everyauth/lib/views/auth-fail.jade create mode 100644 node_modules/everyauth/media/37signals.ico create mode 100644 node_modules/everyauth/media/500px.ico create mode 100644 node_modules/everyauth/media/angellist.ico create mode 100644 node_modules/everyauth/media/box.ico create mode 100644 node_modules/everyauth/media/dropbox.ico create mode 100644 node_modules/everyauth/media/dwolla.ico create mode 100644 node_modules/everyauth/media/evernote.ico create mode 100644 node_modules/everyauth/media/facebook.ico create mode 100644 node_modules/everyauth/media/foursquare.ico create mode 100644 node_modules/everyauth/media/github.ico create mode 100644 node_modules/everyauth/media/google.ico create mode 100644 node_modules/everyauth/media/gowalla.ico create mode 100644 node_modules/everyauth/media/instagram.ico create mode 100644 node_modules/everyauth/media/justintv.ico create mode 100644 node_modules/everyauth/media/linkedin.ico create mode 100644 node_modules/everyauth/media/mailru.ico create mode 100644 node_modules/everyauth/media/mendeley.ico create mode 100644 node_modules/everyauth/media/mixi.ico create mode 100644 node_modules/everyauth/media/openid.ico create mode 100644 node_modules/everyauth/media/osm.ico create mode 100644 node_modules/everyauth/media/readability.ico create mode 100644 node_modules/everyauth/media/skyrock.ico create mode 100644 node_modules/everyauth/media/soundcloud.ico create mode 100644 node_modules/everyauth/media/tripit.png create mode 100644 node_modules/everyauth/media/tumblr.jpg create mode 100644 node_modules/everyauth/media/twitter.ico create mode 100644 node_modules/everyauth/media/vimeo.gif create mode 100644 node_modules/everyauth/media/vkontakte.ico create mode 100644 node_modules/everyauth/media/yahoo.ico create mode 100644 node_modules/everyauth/package.json create mode 100644 node_modules/everyauth/test/creds.dummy.js create mode 100644 node_modules/everyauth/test/facebook.tobi.js create mode 100644 node_modules/everyauth/test/mailchimp.tobi.js create mode 100644 node_modules/everyauth/test/password.satisfy.js create mode 100644 node_modules/everyauth/test/password.tobi.js create mode 100644 node_modules/everyauth/test/promise.test.js create mode 100644 node_modules/everyauth/test/soundcloud.tobi.js create mode 100644 node_modules/everyauth/test/twitter.tobi.js create mode 100644 node_modules/everyauth/test/util/expect.js create mode 100644 node_modules/everyauth/test/util/satisfy.js create mode 100644 node_modules/querystring/History.md create mode 100644 node_modules/querystring/Readme.md create mode 100644 node_modules/querystring/package.json create mode 100644 node_modules/querystring/querystring.js create mode 100644 node_modules/querystring/tests/test-querystring.js create mode 100644 node_modules/request/LICENSE create mode 100644 node_modules/request/README.md create mode 100644 node_modules/request/aws.js create mode 100644 node_modules/request/forever.js create mode 100644 node_modules/request/main.js create mode 100644 node_modules/request/node_modules/form-data/.npmignore create mode 100644 node_modules/request/node_modules/form-data/Makefile create mode 100644 node_modules/request/node_modules/form-data/Readme.md create mode 100644 node_modules/request/node_modules/form-data/lib/form_data.js create mode 100644 node_modules/request/node_modules/form-data/node-form-data.sublime-project create mode 100644 node_modules/request/node_modules/form-data/node-form-data.sublime-workspace create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/.gitmodules create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/LICENSE create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/Makefile create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/README.md create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/index.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/lib/async.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/package.json create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/test/.swp create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/async/test/test.html create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/License create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js create mode 100755 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js create mode 100644 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js create mode 100755 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js create mode 100644 node_modules/request/node_modules/form-data/package.json create mode 100644 node_modules/request/node_modules/form-data/test/common.js create mode 100644 node_modules/request/node_modules/form-data/test/fixture/bacon.txt create mode 100644 node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg create mode 100644 node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js create mode 100644 node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js create mode 100644 node_modules/request/node_modules/form-data/test/integration/test-http-response.js create mode 100644 node_modules/request/node_modules/form-data/test/integration/test-pipe.js create mode 100644 node_modules/request/node_modules/form-data/test/integration/test-submit.js create mode 100755 node_modules/request/node_modules/form-data/test/run.js create mode 100644 node_modules/request/node_modules/mime/LICENSE create mode 100644 node_modules/request/node_modules/mime/README.md create mode 100644 node_modules/request/node_modules/mime/mime.js create mode 100644 node_modules/request/node_modules/mime/package.json create mode 100644 node_modules/request/node_modules/mime/test.js create mode 100644 node_modules/request/node_modules/mime/types/mime.types create mode 100644 node_modules/request/node_modules/mime/types/node.types create mode 100644 node_modules/request/oauth.js create mode 100644 node_modules/request/package.json create mode 100644 node_modules/request/tests/googledoodle.png create mode 100644 node_modules/request/tests/run.js create mode 100644 node_modules/request/tests/server.js create mode 100644 node_modules/request/tests/squid.conf create mode 100644 node_modules/request/tests/ssl/ca/ca.cnf create mode 100644 node_modules/request/tests/ssl/ca/ca.crl create mode 100644 node_modules/request/tests/ssl/ca/ca.crt create mode 100644 node_modules/request/tests/ssl/ca/ca.csr create mode 100644 node_modules/request/tests/ssl/ca/ca.key create mode 100644 node_modules/request/tests/ssl/ca/ca.srl create mode 100644 node_modules/request/tests/ssl/ca/server.cnf create mode 100644 node_modules/request/tests/ssl/ca/server.crt create mode 100644 node_modules/request/tests/ssl/ca/server.csr create mode 100644 node_modules/request/tests/ssl/ca/server.js create mode 100644 node_modules/request/tests/ssl/ca/server.key create mode 100644 node_modules/request/tests/ssl/npm-ca.crt create mode 100644 node_modules/request/tests/ssl/test.crt create mode 100644 node_modules/request/tests/ssl/test.key create mode 100644 node_modules/request/tests/test-body.js create mode 100644 node_modules/request/tests/test-cookie.js create mode 100644 node_modules/request/tests/test-cookiejar.js create mode 100644 node_modules/request/tests/test-defaults.js create mode 100644 node_modules/request/tests/test-errors.js create mode 100644 node_modules/request/tests/test-follow-all-303.js create mode 100644 node_modules/request/tests/test-follow-all.js create mode 100644 node_modules/request/tests/test-form.js create mode 100644 node_modules/request/tests/test-headers.js create mode 100644 node_modules/request/tests/test-httpModule.js create mode 100644 node_modules/request/tests/test-https-strict.js create mode 100644 node_modules/request/tests/test-https.js create mode 100644 node_modules/request/tests/test-oauth.js create mode 100644 node_modules/request/tests/test-params.js create mode 100644 node_modules/request/tests/test-piped-redirect.js create mode 100644 node_modules/request/tests/test-pipes.js create mode 100644 node_modules/request/tests/test-pool.js create mode 100644 node_modules/request/tests/test-protocol-changing-redirect.js create mode 100644 node_modules/request/tests/test-proxy.js create mode 100644 node_modules/request/tests/test-qs.js create mode 100644 node_modules/request/tests/test-redirect.js create mode 100644 node_modules/request/tests/test-s3.js create mode 100644 node_modules/request/tests/test-timeout.js create mode 100644 node_modules/request/tests/test-toJSON.js create mode 100644 node_modules/request/tests/test-tunnel.js create mode 100644 node_modules/request/tests/unicycle.jpg create mode 100644 node_modules/request/tunnel.js create mode 100644 node_modules/request/uuid.js create mode 100644 node_modules/request/vendor/cookie/index.js create mode 100644 node_modules/request/vendor/cookie/jar.js diff --git a/node_modules/everyauth/.gitignore b/node_modules/everyauth/.gitignore new file mode 100644 index 0000000..8a7afec --- /dev/null +++ b/node_modules/everyauth/.gitignore @@ -0,0 +1,7 @@ +**.swp +node_modules +test/creds.js +issues +IRC.md +playground.js +CHANGES diff --git a/node_modules/everyauth/Makefile b/node_modules/everyauth/Makefile new file mode 100644 index 0000000..bfd6b9e --- /dev/null +++ b/node_modules/everyauth/Makefile @@ -0,0 +1,6 @@ +TESTS = $(shell find test/ -name '*.tobi.js' -o -name '*.test.js') + +test: + mocha --reporter spec $(TESTS) + +.PHONY: test diff --git a/node_modules/everyauth/README.md b/node_modules/everyauth/README.md new file mode 100644 index 0000000..2f82beb --- /dev/null +++ b/node_modules/everyauth/README.md @@ -0,0 +1,2681 @@ +everyauth +========== + +Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps. + +There is a NodeTuts screencast of everyauth [here](http://nodetuts.com/tutorials/26-starting-with-everyauth.html#video) + +There is also a Google Groups (recently created) +[here](http://groups.google.com/group/everyauth) to post questions and discuss +potential ideas and extensions to the library. + +So far, `everyauth` enables you to login via: + + + + + + + + + + +
    Authenticate Via Credits +
    Password +
    Facebook +
    Twitter +
    Google +
    Google Hybrid RocketLabs Development +
    LinkedIn +
    Dropbox Torgeir +
    Tumblr +
    Evernote Danny Amey +
    Github +
    Instagram +
    Foursquare +
    Yahoo! +
    Justin.tv slickplaid +
    Vimeo slickplaid +
    37signals + (Basecamp, Highrise, Backpack, Campfire) +
    Readability Alfred Nerstu +
    AngelList +
    Dwolla Kenan Shifflett +
    OpenStreetMap Christoph Giesel +
    VKontakte (Russian Social Network) Alexey Simonenko +
    Mail.ru (Russian Social Network) Alexey Gordeyev +
    Skyrock Rodolphe Stoclin +
    Gowalla Andrew Kramolisch +
    TripIt Damian Krzeminski +
    500px Danny Amey +
    SoundCloud Chris Leishman +
    mixi + ufssf +
    Mailchimp + Winfred Nadeau +
    Mendeley + Eduard Baun +
    Box.net +
    OpenId RocketLabs Development, Andrew Mee, Brian Noguchi +
    LDAP (experimental; not production-tested) +
    Windows Azure Access Control Service (ACS) Dario Renzulli, Juan Pablo Garcia, Matias Woloski from Southworks +
    + +`everyauth` is: + +- **Modular** - We have you covered with Facebook and Twitter + OAuth logins, basic login/password support, and modules + coming soon for beta invitation support and more. +- **Easily Configurable** - everyauth was built with powerful + configuration needs in mind. Configure an authorization strategy + in a straightforward, easy-to-read & easy-to-write approach, + with as much granularity as you want over the steps and + logic of your authorization strategy. +- **Idiomatic** - The syntax for configuring and extending your authorization strategies are + idiomatic and chainable. + + +## Installation + $ npm install everyauth + +## Quick Start + +Incorporate everyauth into your express app in just 2 easy steps. + +1. **Choose and Configure Auth Strategies** - Find the authentication strategy + you desire in one of the sections below. Follow the configuration + instructions. +2. **Add the Middleware to Express** + + ```javascript + var everyauth = require('everyauth'); + // Step 1 code goes here + + // Step 2 code + var express = require('express'); + var app = express(); + app + .use(express.bodyParser()) + .use(express.cookieParser('mr ripley')) + .use(express.session()) + .use(everyauth.middleware(app)); + ``` + +## Example Application + +There is an example application at [./example](https://github.com/bnoguchi/everyauth/tree/master/example) + +To run it: + + $ cd example + $ node server.js + +**Important** - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a `localhost` +alias called `local.host`. Make sure you set up your /etc/hosts so that 127.0.0.1 is also +associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: + + 127.0.0.1 localhost local.host + +Then point your browser to [http://local.host:3000](http://local.host:3000) + +## Tests + + $ npm install everyauth --dev + +Then, update test/creds.js with credentials that the integration tests use to +login to each 3rd party service. + + $ make test + +## Accessing the User + +If you are using `express` or `connect`, then `everyauth` +provides an easy way to access the user as: + +- `req.user` from your app server +- `everyauth.user` via the `everyauth` helper accessible from your `express` views. +- `user` as a helper accessible from your `express` views + +To access the user, configure `everyauth.everymodule.findUserById` and +optionally `everyauth.everymodule.userPkey`. +For example, using [mongoose](http://github.com/LearnBoost/mongoose): + +```javascript +everyauth.everymodule.findUserById( function (userId, callback) { + User.findById(userId, callback); + // callback has the signature, function (err, user) {...} +}); +``` + +If you need access to the request object the function can have three arguments: + +```javascript +everyauth.everymodule.findUserById( function (req, userId, callback) { + + // use the request in some way ... + + // callback has the signature, function (err, user) {...} +}); +``` + +Once you have configured this method, you now have access to the user object +that was fetched anywhere in your server app code as `req.user`. For instance: + +```javascript +var app = require('express').createServer() + +// Configure your app + +app.get('/', function (req, res) { + console.log(req.user); // FTW! + res.render('home'); +}); +``` + +Moreover, you can access the user in your views as `everyauth.user` or as `user`. + + //- Inside ./views/home.jade + span.user-id= everyauth.user.name + #user-id= user.id + +`everyauth` assumes that you store your users with an `id` property. If not -- +e.g, if you adopt the convention `user.uid` over `user.id` -- then just make +sure to configure the `everyauth.everymodule.userPkey` parameter: + +```javascript +everyauth.everymodule.userPkey('uid'); +``` + +## Express Helpers + +If you are using express, everyauth comes with some useful dynamic helpers. +To enable them: + +```javascript +var express = require('express') + , everyauth = require('everyauth') + , app = express.createServer(); + +everyauth.helpExpress(app); +``` + +Then, from within your views, you will have access to the following helpers methods +attached to the helper, `everyauth`: + +- `everyauth.loggedIn` +- `everyauth.user` - the User document associated with the session +- `everyauth.facebook` - The is equivalent to what is stored at `req.session.auth.facebook`, + so you can do things like ... +- `everyauth.facebook.user` - returns the user json provided from the OAuth provider. +- `everyauth.facebook.accessToken` - returns the access_token provided from the OAuth provider + for authorized API calls on behalf of the user. +- And you also get this pattern for other modules - e.g., `everyauth.twitter.user`, + `everyauth.github.user`, etc. + +You also get access to the view helper + +- `user` - the same as `everyauth.user` above + +As an example of how you would use these, consider the following `./views/user.jade` jade template: + + .user-id + .label User Id + .value #{user.id} + .facebook-id + .label User Facebook Id + .value #{everyauth.facebook.user.id} + +If you already have an express helper named `user`, then you can configure +`everyauth` to use a different helper name to access the user object that +everyauth manages. To do so, leverage the `userAlias` option for +`everyauth.helpExpress`: + +```javascript +everyauth.helpExpress(app, { userAlias: '__user__' }); +``` + +Then, you could access the user object in your view with the helper `__user__` +instead of the default helper `user`. So you can compare with the default use +of helpers given previously, the alternative leveraging userAlias would look like: + + .user-id + .label User Id + .value #{__user__.id} + .facebook-id + .label User Facebook Id + .value #{everyauth.facebook.user.id} + +`everyauth` also provides convenience methods on the `ServerRequest` instance `req`. +From any scope that has access to `req`, you get the following convenience getters and methods: + +- `req.loggedIn` - a Boolean getter that tells you if the request is by a logged in user +- `req.user` - the User document associated with the session +- `req.logout()` - clears the sesion of your auth data + +## Logging Out + +If you integrate `everyauth` with `connect`, then `everyauth` automatically +sets up a `logoutPath` at `GET` `/logout` for your app. It also +sets a default handler for your logout route that clears your session +of auth information and redirects them to '/'. + +To over-write the logout path: + +```javascript +everyauth.everymodule.logoutPath('/bye'); +``` + +To over-write the logout redirect path: + +```javascript +everyauth.everymodule.logoutRedirectPath('/navigate/to/after/logout'); +``` + +To over-write the logout handler: + +```javascript +everyauth.everymodule.handleLogout( function (req, res) { + // Put you extra logic here + + req.logout(); // The logout method is added for you by everyauth, too + + // And/or put your extra logic here + + this.redirect(res, this.logoutRedirectPath()); +}); +``` + +## Custom redirect on password-based login or registration + +You may want your own callback that decides where to send a user after login or registration. One way of doing this is with the `respondToLoginSucceed` and `respondToRegistrationSucceed` methods. This assumes that you have set a `.redirectTo` property on your `req.session` object: + +```javascript +everyauth.password + .respondToLoginSucceed( function (res, user, data) { + if (user) { + this.redirect(res, data.session.redirectTo) + } + }) + .respondToRegistrationSucceed( function (res, user, data) { + this.redirect(res, data.session.redirectTo) + }) +``` + +If you are using express and want your redirects to be subject to [express +redirect mapping](http://expressjs.com/guide.html#res.redirect\(\)), you can +overwrite redirect method employed by everyauth. + +```javascript +everyauth.everymodule + .performRedirect( function (res, location) { + res.redirect(location, 303); + }); +``` + +A newly defined method will be used by everyauth to perform all redirects. + +# Auth Strategy Instructions + +## Facebook Connect + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.facebook + .appId('YOUR APP ID HERE') + .appSecret('YOUR APP SECRET HERE') + .handleAuthCallbackError( function (req, res) { + // If a user denies your app, Facebook will redirect the user to + // /auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request. + // This configurable route handler defines how you want to respond to + // that. + // If you do not configure this, everyauth renders a default fallback + // view notifying the user that their authentication failed and why. + }) + .findOrCreateUser( function (session, accessToken, accessTokExtra, fbUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.facebook + .entryPath('/auth/facebook') + .callbackPath('/auth/facebook/callback') + .scope('email') // Defaults to undefined + .fields('id,name,email,picture') // Controls the returned fields. Defaults to undefined +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.facebook.scope(); // undefined +everyauth.facebook.fields(); // undefined +everyauth.facebook.entryPath(); // '/auth/facebook' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.facebook.configurable(); +``` + +### Dynamic Facebook Connect Scope + +Facebook provides many different +[permissions](http://developers.facebook.com/docs/authentication/permissions/) +for which your app can ask your user. This is bundled up in the `scope` query +paremter sent with the oauth request to Facebook. While your app may require +several different permissions from Facebook, Facebook recommends that you only +ask for these permissions incrementally, as you need them. For example, you might +want to only ask for the "email" scope upon registration. At the same time, for +another user, you may want to ask for "user_status" permissions because they +have progressed further along in your application. + +`everyauth` enables you to specify the "scope" dynamically with a second +variation of the configurable `scope`. In addition to the first variation +that looks like: + +```javascript +everyauth.facebook + .scope('email,user_status'); +``` + +you can have greater dynamic control over "scope" via the second variation of `scope`: + +```javascript +everyauth.facebook + .scope( function (req, res) { + var session = req.session; + switch (session.userPhase) { + case 'registration': + return 'email'; + case 'share-media': + return 'email,user_status'; + } + }); + +``` + +### Facebook Mobile OAuth Dialog +If you are programming for mobile, you can bring up the facebook mobile OAuth +dialog instead of the traditional desktop browser-based one by just adding +`mobile(true)` to your configuration as seen here: + +```javascript +everyauth.facebook + .mobile(true) + .appId('YOUR APP ID HERE') + .appSecret('YOUR APP SECRET HERE') + // rest of configuration +``` + +## Twitter OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.twitter + .consumerKey('YOUR CONSUMER ID HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenSecret, twitterUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +**Important** - Some developers forget to do the following, and it causes them to have issues with `everyauth`. +Please make sure to do the following: When you set up your app at http://dev.twitter.com/, make sure that your callback url is set up to +include that path '/auth/twitter/callback/'. In general, when dealing with OAuth or OAuth2 modules +provided by `everyauth`, the default callback path is always set up to follow the pattern +'/auth/#{moduleName}/callback', so just ensure that you configure your OAuth settings accordingly with +the OAuth provider -- in this case, the "Edit Application Settings" section for your app at http://dev.twitter.com. + +Alternatively, you can specify the callback url at the application level by configuring `callbackPath` (which +has a default configuration of "/auth/twitter/callback"): + +```javascript +everyauth.twitter + .consumerKey('YOUR CONSUMER ID HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .callbackPath('/custom/twitter/callback/path') + .findOrCreateUser( function (session, accessToken, accessTokenSecret, twitterUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); +``` + +So if your hostname is `example.com`, then this configuration will over-ride the `dev.twitter.com` callback url configuration. +Instead, Twitter will redirect back to `example.com/custom/twitter/callback/path` in the example just given above. + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.twitter + .entryPath('/auth/twitter') + .callbackPath('/auth/twitter/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.twitter.callbackPath(); // '/auth/twitter/callback' +everyauth.twitter.entryPath(); // '/auth/twitter' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.twitter.configurable(); +``` + +## Password Authentication + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.password + .getLoginPath('/login') // Uri path to the login page + .postLoginPath('/login') // Uri path that your login form POSTs to + .loginView('a string of html; OR the name of the jade/etc-view-engine view') + .authenticate( function (login, password) { + // Either, we return a user or an array of errors if doing sync auth. + // Or, we return a Promise that can fulfill to promise.fulfill(user) or promise.fulfill(errors) + // `errors` is an array of error message strings + // + // e.g., + // Example 1 - Sync Example + // if (usersByLogin[login] && usersByLogin[login].password === password) { + // return usersByLogin[login]; + // } else { + // return ['Login failed']; + // } + // + // Example 2 - Async Example + // var promise = this.Promise() + // YourUserModel.find({ login: login}, function (err, user) { + // if (err) return promise.fulfill([err]); + // promise.fulfill(user); + // } + // return promise; + }) + .loginSuccessRedirect('/') // Where to redirect to after a login + + // If login fails, we render the errors via the login view template, + // so just make sure your loginView() template incorporates an `errors` local. + // See './example/views/login.jade' + + .getRegisterPath('/register') // Uri path to the registration page + .postRegisterPath('/register') // The Uri path that your registration form POSTs to + .registerView('a string of html; OR the name of the jade/etc-view-engine view') + .validateRegistration( function (newUserAttributes) { + // Validate the registration input + // Return undefined, null, or [] if validation succeeds + // Return an array of error messages (or Promise promising this array) + // if validation fails + // + // e.g., assuming you define validate with the following signature + // var errors = validate(login, password, extraParams); + // return errors; + // + // The `errors` you return show up as an `errors` local in your jade template + }) + .registerUser( function (newUserAttributes) { + // This step is only executed if we pass the validateRegistration step without + // any errors. + // + // Returns a user (or a Promise that promises a user) after adding it to + // some user store. + // + // As an edge case, sometimes your database may make you aware of violation + // of the unique login index, so if this error is sent back in an async + // callback, then you can just return that error as a single element array + // containing just that error message, and everyauth will automatically handle + // that as a failed registration. Again, you will have access to this error via + // the `errors` local in your register view jade template. + // e.g., + // var promise = this.Promise(); + // User.create(newUserAttributes, function (err, user) { + // if (err) return promise.fulfill([err]); + // promise.fulfill(user); + // }); + // return promise; + // + // Note: Index and db-driven validations are the only validations that occur + // here; all other validations occur in the `validateRegistration` step documented above. + }) + .registerSuccessRedirect('/'); // Where to redirect to after a successful registration + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.password + .loginFormFieldName('login') // Defaults to 'login' + .passwordFormFieldName('password') // Defaults to 'password' + .loginLayout('custom_login_layout') // Only with `express` + .registerLayout('custom reg_layout') // Only with `express` + .loginLocals(fn); // See Recipe 3 below +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.password.loginFormFieldName(); // 'login' +everyauth.password.passwordFormFieldName(); // 'password' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.password.configurable(); +``` + +### Password Recipe 1: Extra registration data + +Sometimes your registration will ask for more information from the user besides the login and password. + +For this particular scenario, you can configure the optional step, `extractExtraRegistrationParams`. + +```javascript +everyauth.password.extractExtraRegistrationParams( function (req) { + return { + phone: req.body.phone + , name: { + first: req.body.first_name + , last: req.body.last_name + } + }; +}); +``` + +Then, you will have access to this data from within your configured +`validateRegistration` and `registerUser`: + +```javascript +everyauth.password + .validateRegistration( function (newUserAttributes) { + var phone = newUserAttributes.phone + , firstName = newUserAttributes.name.first + , lastName = newUserAttributes.name.last; + }) + .registerUser( function (newUserAttributes) { + var phone = newUserAttributes.phone + , firstName = newUserAttributes.name.first + , lastName = newUserAttributes.name.last; + }); +``` + +### Password Recipe 2: Logging in with email or phone number + +By default, `everyauth` uses the field and user key name `login` during the +registration and login process. + +Sometimes, you want to use `email` or `phone` instead of `login`. Moreover, +you also want to validate `email` and `phone` fields upon registration. + +`everyauth` provides an easy way to do this: + +```javascript +everyauth.password.loginWith('email'); + +// OR + +everyauth.password.loginWith('phone'); +``` + +With simple login configuration like this, you get email (or phone) validation +in addition to renaming of the form field and user key corresponding to what +otherwise would typically be referred to as 'login'. + +### Password Recipe 3: Adding additional view local variables to login and registration views + +If you are using `express`, you are able to pass variables from your app +context to your view context via local variables. `everyauth` provides +several convenience local vars for your views, but sometimes you will want +to augment this set of local vars with additional locals. + +So `everyauth` also provides a mechanism for you to do so via the following +configurables: + +```javascript +everyauth.password.loginLocals(...); +everyauth.password.registerLocals(...); +``` + +`loginLocals` and `registerLocals` configuration have symmetrical APIs, so I +will only cover `loginLocals` here to illustrate how to use both. + +You can configure this parameter in one of *3* ways. Why 3? Because there are 3 types of ways that you can retrieve your locals. + +1. Static local vars that never change values: + + ```javascript + everyauth.password.loginLocals({ + title: 'Login' + }); + ``` +2. Dynamic synchronous local vars that depend on the incoming request, but whose values are retrieved synchronously + + ```javascript + everyauth.password.loginLocals( function (req, res) { + var sess = req.session; + return { + isReturning: sess.isReturning + }; + }); + ``` +3. Dynamic asynchronous local vars + + ```javascript + everyauth.password.loginLocals( function (req, res, done) { + asyncCall( function ( err, data) { + if (err) return done(err); + done(null, { + title: il8n.titleInLanguage('Login Page', il8n.language(data.geo)) + }); + }); + }); + ``` + +### Password Recipe 4: Customize Your Registration Validation + +By default, `everyauth.password` automatically + +- validates that the login (or email or phone, depending on what you authenticate with -- see Password Recipe 2) is present in the login http request, +- validates that the password is present +- validates that an email login is a correctly formatted email +- validates that a phone login is a valid phone number + +If any of these validations fail, then the appropriate errors are generated and accessible to you in your view via the `errors` view local variable. + +If you want to add additional validations beyond this, you can do so by configuring the step, `validateRegistration`: + +```javascript +everyauth.password + .validateRegistration( function (newUserAttributes, baseErrors) { + // Here, newUserAttributes is the hash of parameters extracted from the incoming request. + // baseErrors is the array of errors generated by the default automatic validation outlined above + // in this same recipe. + + // First, validate your errors. Here, validateUser is a made up function + var moreErrors = validateUser( newUserAttributes ); + if (moreErrors.length) baseErrors.push.apply(baseErrors, moreErrors); + + // Return the array of errors, so your view has access to them. + return baseErrors; + }); +``` + +### Password Recipe 5: Password Hashing + +By default, everyauth is agnostic about how you decide to store your users and +therefore passwords. However, one should *always* use password hashing and +salting for security. + +Here's an example of how to incorporate password hashing into everyauth using +bcrypt hashing. The idea is to store a salt and hash value inside your user object +instead of the password. The hash value is generated from the password (sent with a +registration or login request) and unique salt per user, using the bcrypt algorithm. + +```javascript +// Make sure to `npm install bcrypt` +var bcrypt = require('bcrypt'); + +everyauth.password + .registerUser( function (newUserAttrs) { + var promise = this.Promise() + , password = newUserAttrs.password; + + delete newUserAttrs[password]; // Don't store password + newUserAttrs.salt = bcrypt.genSaltSync(10); + newUserAttrs.hash = bcrypt.hashSync(password, salt); + + // Create a new user in your data store + createUser( newUserAttrs, function (err, createdUser) { + if (err) return promise.fail(err); + return promise.fulfill(createdUser); + }); + + return promise; + }) + .authenticate( function (login, password) { + var promise + , errors = []; + if (!login) errors.push('Missing login.'); + if (!password) errors.push('Missing password.'); + if (errors.length) return errors; + + promise = this.Promise(); + + // findUser passes an error or user to a callback after finding the + // user by login + findUser( login, function (err, user) { + if (err) { + errors.push(err.message || err); + return promise.fulfill(errors); + } + if (!user) { + errors.push('User with login ' + login + ' does not exist.'); + return promise.fulfill(errors); + } + bcrypt.compare(password, user.hash, function (err, didSucceed) { + if (err) { + return promise.fail(err); + errors.push('Wrong password.'); + return promise.fulfill(errors); + } + if (didSucceed) return promise.fulfill(user); + errors.push('Wrong password.'); + return promise.fulfill(errors); + }); + }); + + return promise; + }) +``` + +## Other Modules + +### GitHub OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.github + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .findOrCreateUser( function (session, accessToken, , accessTokenExtra, githubUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.github + .entryPath('/auth/github') + .callbackPath('/auth/github/callback') + .scope('repo'); // Defaults to undefined + // Can be set to a combination of: 'user', 'public_repo', 'repo', 'gist' + // For more details, see http://develop.github.com/p/oauth.html +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.github.scope(); // undefined +everyauth.github.entryPath(); // '/auth/github' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.github.configurable(); +``` + +### Instagram OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.instagram + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, instagramUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.instagram + .entryPath('/auth/instagram') + .callbackPath('/auth/instagram/callback') + .scope('basic') // Defaults to 'basic' + // Can be set to a combination of: 'basic', 'comments', 'relationships', 'likes' + // For more details, see http://instagram.com/developer/auth/#scope + .display(undefined); // Defaults to undefined; Set to 'touch' to see a mobile optimized version + // of the instagram auth page +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.instagram.callbackPath(); // '/auth/instagram/callback' +everyauth.instagram.entryPath(); // '/auth/instagram' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.instagram.configurable(); +``` + +### Foursquare OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.foursquare + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, foursquareUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.foursquare + .entryPath('/auth/foursquare') + .callbackPath('/auth/foursquare/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.foursquare.callbackPath(); // '/auth/foursquare/callback' +everyauth.foursquare.entryPath(); // '/auth/foursquare' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.foursquare.configurable(); +``` + +### LinkedIn OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.linkedin + .consumerKey('YOUR CONSUMER ID HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenSecret, linkedinUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.linkedin + .entryPath('/auth/linkedin') + .callbackPath('/auth/linkedin/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.linkedin.callbackPath(); // '/auth/linkedin/callback' +everyauth.linkedin.entryPath(); // '/auth/linkedin' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.linkedin.configurable(); +``` + +### Google OAuth2 + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.google + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .scope('https://www.google.com/m8/feeds') // What you want access to + .handleAuthCallbackError( function (req, res) { + // If a user denies your app, Google will redirect the user to + // /auth/facebook/callback?error=access_denied + // This configurable route handler defines how you want to respond to + // that. + // If you do not configure this, everyauth renders a default fallback + // view notifying the user that their authentication failed and why. + }) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, googleUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.google + .entryPath('/auth/google') + .callbackPath('/auth/google/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.google.scope(); // undefined +everyauth.google.entryPath(); // '/auth/google' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.google.configurable(); +``` + +### Gowalla OAuth2 + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.gowalla + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .handleAuthCallbackError( function (req, res) { + // TODO - Update this documentation + // This configurable route handler defines how you want to respond to + // a response from Gowalla that something went wrong during the oauth2 process. + // If you do not configure this, everyauth renders a default fallback + // view notifying the user that their authentication failed and why. + }) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, gowallaUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.gowalla + .entryPath('/auth/gowalla') + .callbackPath('/auth/gowalla/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.gowalla.scope(); // undefined +everyauth.gowalla.entryPath(); // '/auth/gowalla' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.gowalla.configurable(); +``` + +### 37signals (Basecamp, Highrise, Backpack, Campfire) OAuth2 + +First, register an app at [integrate.37signals.com](https://integrate.37signals.com). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth['37signals'] + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .handleAuthCallbackError( function (req, res) { + // TODO - Update this documentation + // This configurable route handler defines how you want to respond to + // a response from 37signals that something went wrong during the oauth2 process. + // If you do not configure this, everyauth renders a default fallback + // view notifying the user that their authentication failed and why. + }) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, _37signalsUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth['37signals'] + .entryPath('/auth/37signals') + .callbackPath('/auth/37signals/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth['37signals'].entryPath(); // '/auth/37signals' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth['37signals'].configurable(); +``` + +### AngelList OAuth2 + +First, register an app [on AngelList](http://angel.co/api/oauth/clients). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.angellist + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR TOKEN HERE') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, angelListUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.angellist + .entryPath('/auth/angellist') + .callbackPath('/auth/angellist/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.angellist.entryPath(); // '/auth/angellist' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.angellist.configurable(); +``` + +### Dwolla OAuth2 + +First, register an app [on Dwolla](http://www.dwolla.com/developers). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.dwolla + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR TOKEN HERE') + .scope('accountinfofull') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, dwollaUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; +``` + +### Skyrock OAuth + +First, register an app [on Skyrock](http://www.skyrock.com/developer/). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.skyrock + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, skyrockUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### VKontakte OAuth2 + +First, register an app [on VKontakte](http://vk.com/editapp?act=create&site=1). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.vkontakte + .appId('YOUR APP ID HERE') + .appSecret('YOUR TOKEN HERE') + .scope('photo') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, vkUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Mail.ru OAuth2 + +First, register an app [on mail.ru](http://api.mail.ru/apps/my/add/). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.mailru + .appId('YOUR CONSUMER KEY HERE') + .appSecret('YOUR CONSUMER SECRET HERE') + .scope('messages') + .entryPath('/auth/mailru') + .callbackPath('/auth/mailru/callback') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailruUser) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + // return promise; + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Yahoo OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.yahoo + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (session, accessToken, accessTokenSecret, yahooUserMetadata) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.yahoo + .entryPath('/auth/yahoo') + .callbackPath('/auth/yahoo/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.yahoo.callbackPath(); // '/auth/yahoo/callback' +everyauth.yahoo.entryPath(); // '/auth/yahoo' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.yahoo.configurable(); +``` + +### Readability OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.readability + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, reader) { + // find or create user logic goes here + // + // e.g., + // return usersByReadabilityId[reader.username] || (usersByReadabilityId[reader.username] = reader); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.readability + .entryPath('/auth/readability') + .callbackPath('/auth/readability/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.readability.callbackPath(); // '/auth/readability/callback' +everyauth.readability.entryPath(); // '/auth/readability' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.readability.configurable(); +``` + +### Dropbox OAuth + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.dropbox + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByDropboxId[user.uid] || (usersByDropboxId[user.uid] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.dropbox + .entryPath('/auth/dropbox') + .callbackPath('/auth/dropbox/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.dropbox.callbackPath(); // '/auth/dropbox/callback' +everyauth.dropbox.entryPath(); // '/auth/dropbox' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.dropbox.configurable(); +``` + +### Justin.tv OAuth + +[Sign up for a Justin.tv account](http://www.justin.tv/user/signup) and activate it as a [developer account](http://www.justin.tv/developer/activate) to get your consumer key and secret. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.justintv + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) { + // find or create user logic goes here + // + // e.g., + // return usersByJustintvId[justintvUser.id] || (usersByJustintvId[justintvUser.id] = justintvUser); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +The `justintvUser` parameter in the `.findOrCreateUser()` function above returns the `account/whoami` API call + +[Justin.tv API Wiki - Account/whoami](http://apiwiki.justin.tv/mediawiki/index.php/Account/whoami) + +```javascript +{ + "image_url_huge": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-320x240-4.jpg", + "profile_header_border_color": null, + "favorite_quotes": "I love Justin.tv", + "sex": "Male", + "image_url_large": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-125x94-4.jpg", + "profile_about": "Check out my website:\n\nwww.justin.tv\n", + "profile_background_color": null, + "image_url_medium": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-75x56-4.jpg", + "id": 1698, + "broadcaster": true, + "profile_url": "http:\/\/www.justin.tv\/justin\/profile", + "profile_link_color": null, + "image_url_small": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-50x37-4.jpg", + "profile_header_text_color": null, + "name": "The JUST UN", + "image_url_tiny": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-33x25-4.jpg", + "login": "justin", + "profile_header_bg_color": null, + "location": "San Francisco" +} +``` + +You can also configure more parameters (most are set to defaults) via the same chainable API: + +```javascript +everyauth.justintv + .entryPath('/auth/justintv') + .callbackPath('/auth/justintv/callback'); +``` + +If you want to see what the current value of a configured parameter is, you can do so via: + +```javascript +everyauth.justintv.callbackPath(); // '/auth/justintv/callback' +everyauth.justintv.entryPath(); // '/auth/justintv' +``` + +To see all parameters that are configurable, the following will return an object whose parameter name keys map to description values: + +```javascript +everyauth.justintv.configurable(); +``` + +### Vimeo OAuth + +You will first need to sign up for a [developer application](http://vimeo.com/api/applications) to get the consumer key and secret. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.vimeo + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByVimeoId[user.id] || (usersByVimeoId[user.id] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.vimeo + .entryPath('/auth/vimeo') + .callbackPath('/auth/vimeo/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.vimeo.callbackPath(); // '/auth/vimeo/callback' +everyauth.vimeo.entryPath(); // '/auth/vimeo' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.vimeo.configurable(); +``` + +### Tumblr OAuth (1.a) + +You will first need to [register an app](http://www.tumblr.com/oauth/register) to get the consumer key and secret. +During registration of your new app, enter a "Default callback URL" of "http://:/auth/tumblr/callback". +Once you register your app, copy down your "OAuth Consumer Key" and "Secret Key" and proceed below. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.tumblr + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByTumblrName[user.name] || (usersByTumblrName[user.name] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.tumblr + .entryPath('/auth/tumblr') + .callbackPath('/auth/tumblr/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.tumblr.callbackPath(); // '/auth/tumblr/callback' +everyauth.tumblr.entryPath(); // '/auth/tumblr' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.tumblr.configurable(); +``` + +### Evernote OAuth (1.a) + +You will first need to [request an API key](http://www.evernote.com/about/developer/api/#key) to get the consumer key and secret. Note that this consumer key and secret will only be valid for the sandbox rather than the production OAuth host. By default the Evernote module will use the production host, so you'll need to override this using the chainable API if you're using the sandbox. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.evernote + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByEvernoteId[user.userId] || (usersByEvernoteId[user.userId] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.evernote + .oauthHost('https://sandbox.evernote.com/') + .entryPath('/auth/evernote') + .callbackPath('/auth/evernote/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.evernote.oauthHost(); // 'https://sandbox.evernote.com/' +everyauth.evernote.callbackPath(); // '/auth/evernote/callback' +everyauth.evernote.entryPath(); // '/auth/evernote' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.evernote.configurable(); +``` + +### OpenStreetMap OAuth + +You will first need to [login to OpenStreetMap](http://www.openstreetmap.org). Then register you application on your OpenStreetMap user page via the View my OAuth details link on the bottom of the page to get the consumer key and secret. The registered application does not need any permission listed there to login via OAuth. + +```javascript +var everyauth = require('osm') + , connect = require('connect'); + +everyauth.osm + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByOSMId[user.id] || (usersByOSMId[user.id] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.osm + .oauthHost('http://api06.dev.openstreetmap.org/') + .entryPath('/auth/osm') + .callbackPath('/auth/osm/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.osm.oauthHost(); // 'http://api.openstreetmap.org/' +everyauth.osm.callbackPath(); // '/auth/osm/callback' +everyauth.osm.entryPath(); // '/auth/osm' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.osm.configurable(); +``` + +### TripIt OAuth (1.0) + +Obtain consumer key and consumer secret for your app by [registering it](http://www.tripit.com/developer/create). +Please note that TripIt is using _API Key_ and _API Secret_ terminology: use those values as describe below. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.tripit + .consumerKey('YOUR API KEY') + .consumerSecret('YOUR API SECRET') + .findOrCreateUser( function (sess, accessToken, accessSecret, tripitProfile) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### 500px OAuth (1.0) + +You will first need to [request an API key](http://developer.500px.com/oauth_clients/new) to get the consumer key and secret. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth['500px'] + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersBy500pxId[user.userId] || (usersBy500pxId[user.userId] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### SoundCloud OAuth2 + +You will first need to [register an app](http://soundcloud.com/you/apps) to get the client id and secret. +During registration of your new app, enter a "Default callback URL" of "http://:/auth/soundcloud/callback". +Once you register your app, copy down your "Client ID" and "Client Secret" and proceed below. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.soundcloud + .appId('YOUR CLIENT ID HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .handleAuthCallbackError( function (req, res) { + // TODO - Update this documentation + // This configurable route handler defines how you want to respond to + // a response from SoundCloud that something went wrong during the oauth2 process. + // If you do not configure this, everyauth renders a default fallback + // view notifying the user that their authentication failed and why. + }) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, soundcloudUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.soundcloud + .entryPath('/auth/soundcloud') + .callbackPath('/auth/soundcloud/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.soundcloud.scope(); // undefined +everyauth.soundcloud.display(); // undefined +everyauth.soundcloud.entryPath(); // '/auth/soundcloud' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.soundcloud.configurable(); +``` + +### mixi OAuth2 + +First, register an app [on mixi](http://developer.mixi.co.jp). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.mixi + .appId('YOUR CONSUMER KEY HERE') + .appSecret('YOUR CONSUMER SECRET HERE') + .display('pc') //specify device types of access: See http://developers.mixi.co.jp/ + .scope('r_profile') //specify types of access: See http://developers.mixi.co.jp/ + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mixiUserMetadata) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; +``` + +### Mailchimp OAuth2 + +First, register an app [in Mailchimp](http://login.mailchimp.com). + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.mailchimp + .appId('YOUR CLIENT KEY HERE') + .appSecret('YOUR CLIENT SECRET HERE') + .myHostname(process.env.HOSTNAME || "http://127.0.0.1:3000/")//MC requires 127.0.0.1 for dev + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailchimpUserData) { + // find or create user logic goes here + // Return a user or Promise that promises a user + // Promises are created via + // var promise = this.Promise(); + // The mailchimpUserData object contains everything from the API method getAccountDetails and an apikey. + // You'll want to work with mailchimpUserData.user_id for queries + // and mailchimpUserData.apikey for your API wrapper + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Mendeley OAuth (1.0) + +You will first need to [register your application](http://dev.mendeley.com/applications/register/) to get the consumer key and secret. + +```javascript +everyauth.mendeley + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .findOrCreateUser( function (sess, accessToken, accessSecret, user) { + // find or create user logic goes here + // + // e.g., + // return usersByMendeleyId[user.main.profile_id] || (usersByMendeleyId[user.main.profile_id] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### OpenID protocol + +OpenID protocol allows you to use an openid auth request. You can read more information about it here http://openid.net/ + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.openid + .myHostname('http://localhost:3000/') + .simpleRegistration({ + "nickname" : true + , "email" : true + , "fullname" : true + , "dob" : true + , "gender" : true + , "postcode" : true + , "country" : true + , "language" : true + , "timezone" : true + }) + .attributeExchange({ + "http://axschema.org/contact/email" : "required" + , "http://axschema.org/namePerson/friendly" : "required" + , "http://axschema.org/namePerson" : "required" + , "http://axschema.org/namePerson/first" : "required" + , "http://axschema.org/contact/country/home": "required" + , "http://axschema.org/media/image/default" : "required" + , "http://axschema.org/x/media/signature" : "required" + }) + .openidURLField('openid_identifier'); //The POST variable used to get the OpenID + .findOrCreateUser( function(session, openIdUserAttributes) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Google OpenID+OAuth Hybrid protocol + +OpenID+OAuth Hybrid protocol allows you to combine an openid auth request with a oauth access request. You can read more information about it here http://code.google.com/apis/accounts/docs/OpenID.html + +Register your domain with Google +[here](https://accounts.google.com/ManageDomains) and write down the +consumer key and consumer secret generated during the domain registration. + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.googlehybrid + .consumerKey('YOUR CONSUMER KEY HERE') + .consumerSecret('YOUR CONSUMER SECRET HERE') + .scope(['GOOGLE API SCOPE','GOOGLE API SCOPE']) + .findOrCreateUser( function(session, userAttributes) { + // find or create user logic goes here + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Box.net + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.box + .apiKey('YOUR API KEY') + .findOrCreateUser( function (sess, authToken, boxUser) { + // find or create user logic goes here + // + // e.g., + // return usersByBoxId[user.user_id] || (usersByBoxId[user.user_id] = user); + }) + .redirectPath('/'); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +You can also configure more parameters (most are set to defaults) via +the same chainable API: + +```javascript +everyauth.box + .entryPath('/auth/box') + .callbackPath('/auth/box/callback'); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.box.callbackPath(); // '/auth/box/callback' +everyauth.box.entryPath(); // '/auth/box' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.box.configurable(); +``` + +### LDAP + +The LDAP module is still in development. Do not use it in production yet. + +Install OpenLDAP client libraries: + + $ apt-get install slapd ldap-utils + +Install [node-ldapauth](https://github.com/joewalnes/node-ldapauth): + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.ldap + .host('your.ldap.host') + .port(389) + + // The `ldap` module inherits from the `password` module, so + // refer to the `password` module instructions several sections above + // in this README. + // You do not need to configure the `authenticate` step as instructed + // by `password` because the `ldap` module already does that for you. + // Moreover, all the registration related steps and configurable parameters + // are no longer valid + .getLoginPath(...) + .postLoginPath(...) + .loginView(...) + .loginSuccessRedirect(...); + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +### Windows Azure Access Control Service (ACS) + +You will need to create a [Windows Azure ACS namespace](http://msdn.microsoft.com/en-us/library/windowsazure/hh674478.aspx). The only caveat when creating the namespace is setting the "Return URL". You will probably [create one Relying Party](http://msdn.microsoft.com/en-us/library/windowsazure/gg429779.aspx) for each environment (dev, qa, prod) and each of them will have a different "Return URL". For instance, dev will be `http://localhost:port/auth/azureacs/callback` and prod could be `https://myapp.com/auth/azureacs/callback` (notice the `/auth/azureacs/callback`, that's where the module will listen the POST with the token from ACS) + +```javascript +var everyauth = require('everyauth') + , connect = require('connect'); + +everyauth.azureacs + .identityProviderUrl('https://yournamespace.accesscontrol.windows.net/v2/wsfederation/') + .entryPath('/auth/azureacs') + .callbackPath('/auth/azureacs/callback') + .signingKey('d0jul....YOUR_SIGNINGK=_KEY......OEvz24=') + .realm('YOUR_APPLICATION_REALM_IDENTIFIER') + .homeRealm('') // if you want to use a default idp (like google/liveid) + .tokenFormat('swt') // only swt supported for now + .findOrCreateUser( function (session, acsUser) { + // you could enrich the "user" entity by storing/fetching the user from a db + return null; + }); + .redirectPath('/'); + + +var routes = function (app) { + // Define your routes here +}; + +connect( + connect.bodyParser() + , connect.cookieParser() + , connect.session({secret: 'whodunnit'}) + , everyauth.middleware() + , connect.router(routes); +).listen(3000); +``` + +If you want to see what the current value of a +configured parameter is, you can do so via: + +```javascript +everyauth.box.callbackPath(); // '/auth/azureacs/callback' +``` + +To see all parameters that are configurable, the following will return an +object whose parameter name keys map to description values: + +```javascript +everyauth.box.configurable(); +``` + +## Configuring a Module + +everyauth was built with powerful configuration needs in mind. + +Every module comes with a set of parameters that you can configure +directly. To see a list of those parameters on a per module basis, +with descriptions about what they do, enter the following into the +node REPL (to access the REPL, just type `node` at the command line) + + > var ea = require('everyauth'); + > ea.facebook.configurable(); + +For example, you will see that one of the configuration parameters is +`moduleTimeout`, which is described to be `how long to wait per step +before timing out and invoking any timeout callbacks` + +Every configuration parameter corresponds to a method of the same name +on the auth module under consideration (i.e., in this case +`ea.facebook`). To create or over-write that parameter, just +call that method with the new value as the argument: + +```javascript +ea.facebook + .moduleTimeout( 4000 ); // Wait 4 seconds before timing out any step + // involved in the facebook auth process +``` + +Configuration parameters can be scalars. But they can be anything. For +example, they can also be functions, too. The facebook module has a +configurable step named `findOrCreateUser` that is described as +"STEP FN [findOrCreateUser] function encapsulating the logic for the step +`fetchOAuthUser`.". What this means is that this configures the +function (i.e., "FN") that encapsulates the logic of this step. + +```javascript +ea.facebook + .findOrCreateUser( function (session, accessToken, extra, oauthUser) { + // find or create user logic goes here + }); +``` + +How do we know what arguments the function takes? +We elaborate more about step function configuration in our +`Introspection` section below. + +### For coffee-script lovers + +Everyauth also supports a special method `configure` for coffee-script +aficionados. Coffee and chainable APIs often don't mix well. As an alternative, +you can configure an everyauth module using an `Object` passed to `configure`: + +```coffee +everyauth.dropbox.configure + consumerKey: conf.dropbox.consumerKey + consumerSecret: conf.dropbox.consumerSecret + findOrCreateUser: (sess, accessToken, accessSecret, dbMeta) -> users[dbMeta.uid] or= addUser('dropbox', dbMeta) + redirectPath: '/' +``` + +## Introspection + +everyauth provides convenient methods and getters for finding out +about any module. + +Show all configurable parameters with their descriptions: + +```javascript +everyauth.facebook.configurable(); +``` + +Show the value of a single configurable parameter: + +```javascript +// Get the value of the configurable callbackPath parameter +everyauth.facebook.callbackPath(); // => '/auth/facebook/callback' +``` + +Show the declared routes (pretty printed): + +```javascript +everyauth.facebook.routes; +``` + +Show the steps initiated by a given route: + +```javascript +everyauth.facebook.route.get.entryPath.steps; +everyauth.facebook.route.get.callbackPath.steps; +``` + +Sometimes you need to set up additional steps for a given auth +module, by defining that step in your app. For example, the +set of steps triggered when someone requests the facebook +module's `callbackPath` contains a step that you must define +in your app. To see what that step is, you can introspect +the `callbackPath` route with the facebook module. + +```javascript +everyauth.facebook.route.get.callbackPath.steps.incomplete; +// => [ { name: 'findOrCreateUser', +// error: 'is missing: its function' } ] +``` + +This tells you that you must define the function that defines the +logic for the `findOrCreateUser` step. To see what the function +signature looks like for this step: + +```javascript +var matchingStep = +everyauth.facebook.route.get.callbackPath.steps.filter( function (step) { + return step.name === 'findOrCreateUser'; +})[0]; +// { name: 'findOrCreateUser', +// accepts: [ 'session', 'accessToken', 'extra', 'oauthUser' ], +// promises: [ 'user' ] } +``` + +This tells you that the function should take the following 4 arguments: + +```javascript +function (session, accessToken, extra, oauthUser) { + ... +} +``` + +And that the function should return a `user` that is a user object or +a Promise that promises a user object. + +```javascript +// For synchronous lookup situations, you can return a user +function (session, accessToken, extra, oauthUser) { + ... + return { id: 'some user id', username: 'some user name' }; +} + +// OR + +// For asynchronous lookup situations, you must return a Promise that +// will be fulfilled with a user later on +function (session, accessToken, extra, oauthUser) { + var promise = this.Promise(); + asyncFindUser( function (err, user) { + if (err) return promise.fail(err); + promise.fulfill(user); + }); + return promise; +} +``` + +You add this function as the block for the step `findOrCreateUser` just like +you configure any other configurable parameter in your auth module: + +```javascript +everyauth.facebook + .findOrCreateUser( function (session, accessToken, extra, oauthUser) { + // Logic goes here + }); +``` + +There are also several other introspection tools at your disposal: + +For example, to show the submodules of an auth module by name: + +```javascript +everyauth.oauth2.submodules; +``` + +Other introspection tools to describe (explanations coming soon): + +- *Invalid Steps* + + ```javascript + everyauth.facebook.routes.get.callbackPath.steps.invalid + ``` + +## Debugging + +### Debugging - Logging Module Steps + +To turn on debugging: + +```javascript +everyauth.debug = true; +``` + +Each everyauth auth strategy module is composed of steps. As each step begins and ends, everyauth will print out to the console the beginning and end of each step. So by turning on the debug flag, you get insight into what step everyauth is executing at any time. + +For example, here is some example debugging information output to the console +during a Facebook Connect authorization: + +``` +starting step - getAuthUri +...finished step +starting step - requestAuthUri +...finished step +starting step - getCode +...finished step +starting step - getAccessToken +...finished step +starting step - fetchOAuthUser +...finished step +starting step - getSession +...finished step +starting step - findOrCreateUser +...finished step +starting step - compile +...finished step +starting step - addToSession +...finished step +starting step - sendResponse +...finished step +``` + +### Debugging - Configuring Error Handling + +By default, all modules handle errors by throwing them. That said, `everyauth` allows +you to over-ride this behavior. + +You can configure error handling at the module and step level. To handle *all* +errors in the same manner across all auth modules that you use, do the following. + +```javascript +everyauth.everymodule.moduleErrback( function (err) { + // Do something with the err -- e.g., log it, throw it +}); +``` + +You can also configure your error handling on a per module basis. So, for example, if +you want to handle errors during the Facebook module differently than in other modules: + + +```javascript +everyauth.facebook.moduleErrback( function (err) { + // Do something with the err -- e.g., log it, throw it +}); +``` + +### Debugging - Setting Timeouts + +By default, every module has 10 seconds to complete each step. If a step takes longer than 10 seconds to complete, then everyauth will pass a timeout error to your configured error handler (see section "Configure Error Handling" above). + +If you would like to increase or decrease the timeout period across all modules, you can do so via: + +```javascript +everyauth.everymodule.moduleTimeout(2000); // Wait 2 seconds per step instead before timing out +``` + +You can eliminate the timeout altogether by configuring your timeouts to -1: + +```javascript +everyauth.everymodule.moduleTimeout(-1); +``` + +You can also configure the timeout period on a per module basis. For example, the following will result in the facebook module having 3 seconds to complete each step before timing out; all other modules will have the default 10 seconds per step before timing out. + +```javascript +everyauth.facebook.moduleTimeout(3000); // Wait 3 seconds +``` + +## In the Wild + +The following projects use everyauth. + +If you are using everyauth in a project, app, or module, get on the list below +by getting in touch or submitting a pull request with changes to the README. + +### Startups & Apps + +- [Storify](http://storify.com/) +- [DoodleOrDie](http://doodleordie.com/) +- [Furkot](http://trips.furkot.com/) + +### Modules + +- [mongoose-auth](https://github.com/bnoguchi/mongoose-auth) Authorization plugin + for use with the node.js MongoDB orm. +- [Heroku's Facebook Node.JS + Template](https://github.com/heroku/facebook-template-nodejs) +- [node-express-boilerplate](https://github.com/mape/node-express-boilerplate) +- [ExpressStarter](https://github.com/JustinBeckwith/ExpressStarter) + +## Tutorials + +The following are 3rd party screencasts and blog posts about either getting up +and running with everyauth or writing your own everyauth modules to support a +new service. + +If you would like your blog post to be included, please submit a pull request +with changes to the README. + +- [NodeTuts: Starting with everyauth](http://nodetuts.com/tutorials/26-starting-with-everyauth.html#video) +- [Node.js modules you should know about: + everyauth](http://www.catonmat.net/blog/nodejs-modules-everyauth/) +- [Implementing Windows Azure ACS with + everyauth](http://nodeblog.cloudapp.net/implementing-windows-azure-acs-with-everyauth) +- [OAuth: Logging In with EveryAuth and NodeJS](http://blog.koostudios.com/?p=453) +- [Calling the github API with node.js](http://www.garann.com/dev/2011/calling-the-github-api-with-node-js/) +- [Simple Node.js Express MVR Template](http://benedmunds.com/2012/04/19/simple-nodejs-express-mvr-template/) + +--- +## Author +Brian Noguchi + +## Credits + +Thanks to the following contributors for the following modules: + +- [RocketLabs Development](https://github.com/rocketlabsdev) for contributing + - OpenId + - Google Hybrid +- [Andrew Mee](https://github.com/starfishmod) + - OpenId +- [Alfred Nerstu](https://github.com/alfrednerstu) + - Readability +- [Torgeir](https://github.com/torgeir) + - DropBox +- [slickplaid](https://github.com/slickplaid) + - Justin.tv + - Vimeo +- [Andrew Kramolisch](https://github.com/andykram) + - Gowalla +- [Kenan Shifflett](https://github.com/nanek) + - Dwolla +- [Alexey Simonenko](https://github.com/meritt) + - VKontakte +- [Alexey Gordeyev](https://github.com/biggora) + - Mail.ru +- [Rodolphe Stoclin](https://github.com/srod) + - Skyrock +- [Danny Amey](https://github.com/dannyamey) + - 500px + - Evernote +- [Chris Leishman](https://github.com/chrisleishman) + - SoundCloud + +## MIT License +Copyright (c) 2011 by Brian Noguchi + +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/everyauth/documentup.json b/node_modules/everyauth/documentup.json new file mode 100644 index 0000000..9203667 --- /dev/null +++ b/node_modules/everyauth/documentup.json @@ -0,0 +1,3 @@ +{ + "twitter": ["everyauth", "briannoguchi"] +} diff --git a/node_modules/everyauth/example/conf.js b/node_modules/everyauth/example/conf.js new file mode 100644 index 0000000..6a28044 --- /dev/null +++ b/node_modules/everyauth/example/conf.js @@ -0,0 +1,119 @@ +module.exports = { + fb: { + appId: '111565172259433' + , appSecret: '85f7e0a0cc804886180b887c1f04a3c1' + } + , twit: { + consumerKey: 'JLCGyLzuOK1BjnKPKGyQ' + , consumerSecret: 'GNqKfPqtzOcsCtFbGTMqinoATHvBcy1nzCTimeA9M0' + } + , github: { + appId: '11932f2b6d05d2a5fa18' + , appSecret: '2603d1bc663b74d6732500c1e9ad05b0f4013593' + } + , instagram: { + clientId: 'be147b077ddf49368d6fb5cf3112b9e0' + , clientSecret: 'b65ad83daed242c0aa059ffae42feddd' + } + , foursquare: { + clientId: 'VUGE4VHJMKWALKDKIOH1HLD1OQNHTC0PBZZBUQSHJ3WKW04K' + , clientSecret: '0LVAGARGUN05DEDDRVWNIMH4RFIHEFV0CERU3OITAZW1CXGX' + } + , gowalla: { + apiKey: '11cf666912004d709fa4bbf21718a82e', + apiSecret: 'e1e23f135776452898a6d268129bf153' + } + , linkedin: { + apiKey: 'pv6AWspODUeHIPNZfA531OYcFyB1v23u3y-KIADJdpyw54BXh-ciiQnduWf6FNRH' + , apiSecret: 'Pdx7DCoJRdAk0ai3joXsslZvK1DPCQwsLn-T17Opkae22ZYDP5R7gmAoFes9TNHy' + } + , google: { + clientId: '3335216477.apps.googleusercontent.com' + , clientSecret: 'PJMW_uP39nogdu0WpBuqMhtB' + } + , googlehybrid: { + consumerKey: 'YOUR CONSUMER KEY HERE' + , consumerSecret: 'YOUR CONSUMER SECRET HERE' + } + , _37signals: { + clientId: 'cd4bf9cd9ed828b6bed8b67e6b314cf8b90c8de5' + , clientSecret: '07883c36b4f4493b70f31872ed8fbdb099ff1cef' + } + , angellist: { + clientId: 'e5feda9308f55f16b0ef0e848f5b1e41' + , clientSecret: 'e0ec367efb9d59fa10bdd53ba268b81f' + } + , yahoo: { + consumerKey: 'dj0yJmk9RVExRlhPRE9rV1hSJmQ9WVdrOWEyRTBVMUJoTm1zbWNHbzlNVE13TURFeU9UTTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iYg--' + , consumerSecret: 'efe6ae4982217630fe3aebf6e6fa1e82c02eba0b' + } +, readability: { + consumerKey: 'Alfrednerstu' + , consumerSecret: 'MXGftcxrRNMYn66CVmADR3KRnygCdYSk' + } + , justintv: { + consumerKey: 'enter your consumer key here' + , consumerSecret: 'enter your consumer secret here' + } + , tumblr: { + consumerKey: 'TAofjqRz9iKiAjtPMnXzHELIeQAw8cqKCZVXaEFSAxBrrvV99f' + , consumerSecret: 's8ldFtirtsnWGSiBjwpUwMct8Yh4sliS9Uiocqsv3bw0ovMtlR' + } + , dropbox: { + consumerKey: 'uhfqnbely5stdtm' + , consumerSecret: 'jr7ofuwo32l7vkd' + } + , vimeo: { + consumerKey: 'Enter your consumer key here' + , consumerSecret: 'Enter your consumer secret here' + } + , box: { + apiKey: '5hl66lbfy0quj8qhhzcn57dflb55y4rg' + } + , dwolla: { + clientId: 'Enter your consumer key here' + , clientSecret: 'Enter your consumer secret here' + } + , vkontakte: { + appId: 'Enter your app id here' + , appSecret: 'Enter your app secret here' + } + , mailru: { + appId: 'Enter your app id here' + , appSecret: 'Enter your app secret here' + } + , skyrock: { + consumerKey: 'a0ae943e20c5af88' + , consumerSecret: 'cjucy86r0fg4uxx3' + } + , evernote: { + oauthHost: 'https://www.evernote.com/' + , consumerKey: 'Enter your consumer key here' + , consumerSecret: 'Enter your consumer secret here' + } + , tripit: { + consumerKey: 'a59bb58479f80e24dc6da1b1e61a107db743bc4c' + , consumerSecret: '41dc4c0c39ac3ab162269a79f399eb180f753c66' + } + , _500px: { + consumerKey: 'Enter your consumer key here' + , consumerSecret: 'Enter your consumer secret here' + } + , soundcloud: { + appId: '79dcfcb876e71dc18c1767b9ebe96298' + , appSecret: '6f828028dab96838d07b2407cd5f80cd' + } + , mixi: { + consumerKey: 'Enter your consumer key here' + , consumerSecret: 'Enter your consumer secret here' + , scope: 'r_profile' + } + , mailchimp: { + appId: 'Enter your client/app id here' + , appSecret: 'Enter your client/app secret here' + } + , mendeley: { + consumerKey: 'Enter your consumer key here' + , consumerSecret: 'Enter your consumer secret here' + } +}; diff --git a/node_modules/everyauth/example/server.js b/node_modules/everyauth/example/server.js new file mode 100644 index 0000000..8ec318c --- /dev/null +++ b/node_modules/everyauth/example/server.js @@ -0,0 +1,435 @@ +var express = require('express') + , everyauth = require('../index') + , conf = require('./conf') + , everyauthRoot = __dirname + '/..'; + +everyauth.debug = true; + +var usersById = {}; +var nextUserId = 0; + +function addUser (source, sourceUser) { + var user; + if (arguments.length === 1) { // password-based + user = sourceUser = source; + user.id = ++nextUserId; + return usersById[nextUserId] = user; + } else { // non-password-based + user = usersById[++nextUserId] = {id: nextUserId}; + user[source] = sourceUser; + } + return user; +} + +var usersByVimeoId = {}; +var usersByJustintvId = {}; +var usersBy37signalsId = {}; +var usersByTumblrName = {}; +var usersByDropboxId = {}; +var usersByFbId = {}; +var usersByTwitId = {}; +var usersByGhId = {}; +var usersByInstagramId = {}; +var usersByFoursquareId = {}; +var usersByGowallaId = {}; +var usersByLinkedinId = {}; +var usersByGoogleId = {}; +var usersByAngelListId = {}; +var usersByYahooId = {}; +var usersByGoogleHybridId = {}; +var usersByReadabilityId = {}; +var usersByBoxId = {}; +var usersByOpenId = {}; +var usersByDwollaId = {}; +var usersByVkId = {}; +var usersBySkyrockId = {}; +var usersByEvernoteId = {}; +var usersByAzureAcs = {}; +var usersByTripIt = {}; +var usersBy500pxId = {}; +var usersBySoundCloudId = {}; +var usersByMailchimpId = {}; +var usersMailruId = {}; +var usersByMendeleyId = {}; +var usersByLogin = { + 'brian@example.com': addUser({ login: 'brian@example.com', password: 'password'}) +}; + +everyauth.everymodule + .findUserById( function (id, callback) { + callback(null, usersById[id]); + }); + +everyauth.azureacs + .identityProviderUrl('https://acssample1.accesscontrol.windows.net/v2/wsfederation/') + .entryPath('/auth/azureacs') + .callbackPath('/auth/azureacs/callback') + .signingKey('d0julb9JNbCB8J2ACHzxU33SSiqbylQveQtuwOEvz24=') + .realm('urn:nodeacslocal') + .homeRealm('') + .tokenFormat('swt') + .findOrCreateUser( function (session, acsUser) { + return usersByAzureAcs[acsUser.id] || (usersByAzureAcs[acsUser.id] = addUser('azureAcs', acsUser)); + }) + .redirectPath('/'); + +everyauth + .openid + .myHostname('http://local.host:3000/') + .findOrCreateUser( function (session, userMetadata) { + return usersByOpenId[userMetadata.claimedIdentifier] || + (usersByOpenId[userMetadata.claimedIdentifier] = addUser('openid', userMetadata)); + }) + .redirectPath('/'); + + +everyauth + .facebook + .appId(conf.fb.appId) + .appSecret(conf.fb.appSecret) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, fbUserMetadata) { + return usersByFbId[fbUserMetadata.id] || + (usersByFbId[fbUserMetadata.id] = addUser('facebook', fbUserMetadata)); + }) + .redirectPath('/'); + +everyauth + .twitter + .consumerKey(conf.twit.consumerKey) + .consumerSecret(conf.twit.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, twitUser) { + return usersByTwitId[twitUser.id] || (usersByTwitId[twitUser.id] = addUser('twitter', twitUser)); + }) + .redirectPath('/'); + +everyauth + .password + .loginWith('email') + .getLoginPath('/login') + .postLoginPath('/login') + .loginView('login.jade') +// .loginLocals({ +// title: 'Login' +// }) +// .loginLocals(function (req, res) { +// return { +// title: 'Login' +// } +// }) + .loginLocals( function (req, res, done) { + setTimeout( function () { + done(null, { + title: 'Async login' + }); + }, 200); + }) + .authenticate( function (login, password) { + var errors = []; + if (!login) errors.push('Missing login'); + if (!password) errors.push('Missing password'); + if (errors.length) return errors; + var user = usersByLogin[login]; + if (!user) return ['Login failed']; + if (user.password !== password) return ['Login failed']; + return user; + }) + + .getRegisterPath('/register') + .postRegisterPath('/register') + .registerView('register.jade') +// .registerLocals({ +// title: 'Register' +// }) +// .registerLocals(function (req, res) { +// return { +// title: 'Sync Register' +// } +// }) + .registerLocals( function (req, res, done) { + setTimeout( function () { + done(null, { + title: 'Async Register' + }); + }, 200); + }) + .validateRegistration( function (newUserAttrs, errors) { + var login = newUserAttrs.login; + if (usersByLogin[login]) errors.push('Login already taken'); + return errors; + }) + .registerUser( function (newUserAttrs) { + var login = newUserAttrs[this.loginKey()]; + return usersByLogin[login] = addUser(newUserAttrs); + }) + + .loginSuccessRedirect('/') + .registerSuccessRedirect('/'); + +everyauth.github + .appId(conf.github.appId) + .appSecret(conf.github.appSecret) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, ghUser) { + return usersByGhId[ghUser.id] || (usersByGhId[ghUser.id] = addUser('github', ghUser)); + }) + .redirectPath('/'); + +everyauth.instagram + .appId(conf.instagram.clientId) + .appSecret(conf.instagram.clientSecret) + .scope('basic') + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, hipster) { + return usersByInstagramId[hipster.id] || (usersByInstagramId[hipster.id] = addUser('instagram', hipster)); + }) + .redirectPath('/'); + +everyauth.foursquare + .appId(conf.foursquare.clientId) + .appSecret(conf.foursquare.clientSecret) + .findOrCreateUser( function (sess, accessTok, accessTokExtra, addict) { + return usersByFoursquareId[addict.id] || (usersByFoursquareId[addict.id] = addUser('foursquare', addict)); + }) + .redirectPath('/'); + +everyauth.gowalla + .appId(conf.gowalla.apiKey) + .appSecret(conf.gowalla.apiSecret) + .moduleErrback( function(err) { + console.log("moduleErrback for Gowalla", err); + }) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, loser) { + return usersByGowallaId[loser.url] || (usersByGowallaId[loser.url] = addUser('gowalla', loser)); + }) + .redirectPath('/'); + +everyauth.linkedin + .consumerKey(conf.linkedin.apiKey) + .consumerSecret(conf.linkedin.apiSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, linkedinUser) { + return usersByLinkedinId[linkedinUser.id] || (usersByLinkedinId[linkedinUser.id] = addUser('linkedin', linkedinUser)); + }) + .redirectPath('/'); + +everyauth.google + .appId(conf.google.clientId) + .appSecret(conf.google.clientSecret) + .scope('https://www.googleapis.com/auth/userinfo.profile%20https://www.google.com/m8/feeds/') + .findOrCreateUser( function (sess, accessToken, extra, googleUser) { + googleUser.refreshToken = extra.refresh_token; + googleUser.expiresIn = extra.expires_in; + return usersByGoogleId[googleUser.id] || (usersByGoogleId[googleUser.id] = addUser('google', googleUser)); + }) + .redirectPath('/'); + +everyauth.angellist + .appId(conf.angellist.clientId) + .appSecret(conf.angellist.clientSecret) + .findOrCreateUser( function (sess, accessToken, extra, angellistUser) { + angellistUser.refreshToken = extra.refresh_token; + angellistUser.expiresIn = extra.expires_in; + return usersByAngelListId[angellistUser.id] || (usersByAngelListId[angellistUser.id] = addUser('angellist', angellistUser)); + }) + .redirectPath('/'); + +everyauth.yahoo + .consumerKey(conf.yahoo.consumerKey) + .consumerSecret(conf.yahoo.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, yahooUser) { + return usersByYahooId[yahooUser.id] || (usersByYahooId[yahooUser.id] = addUser('yahoo', yahooUser)); + }) + .redirectPath('/'); + +everyauth.googlehybrid + .myHostname('http://local.host:3000/') + .consumerKey(conf.googlehybrid.consumerKey) + .consumerSecret(conf.googlehybrid.consumerSecret) + .scope(['http://docs.google.com/feeds/','http://spreadsheets.google.com/feeds/']) + .findOrCreateUser( function(session, userAttributes) { + return usersByGoogleHybridId[userAttributes.claimedIdentifier] || (usersByGoogleHybridId[userAttributes.claimedIdentifier] = addUser('googlehybrid', userAttributes)); + }) + .redirectPath('/'); + +everyauth.readability + .consumerKey(conf.readability.consumerKey) + .consumerSecret(conf.readability.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, reader) { + return usersByReadabilityId[reader.username] || (usersByReadabilityId[reader.username] = addUser('readability', reader)); + }) + .redirectPath('/'); + +everyauth + .dropbox + .consumerKey(conf.dropbox.consumerKey) + .consumerSecret(conf.dropbox.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, dropboxUserMetadata) { + return usersByDropboxId[dropboxUserMetadata.uid] || + (usersByDropboxId[dropboxUserMetadata.uid] = addUser('dropbox', dropboxUserMetadata)); + }) + .redirectPath('/') + +everyauth.vimeo + .consumerKey(conf.vimeo.consumerKey) + .consumerSecret(conf.vimeo.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, vimeoUser) { + return usersByVimeoId[vimeoUser.id] || + (usersByVimeoId[vimeoUser.id] = vimeoUser); + }) + .redirectPath('/') + +everyauth.justintv + .consumerKey(conf.justintv.consumerKey) + .consumerSecret(conf.justintv.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) { + return usersByJustintvId[justintvUser.id] || + (usersByJustintvId[justintvUser.id] = addUser('justintv', justintvUser)); + }) + .redirectPath('/') + +everyauth['37signals'] + .appId(conf['_37signals'].clientId) + .appSecret(conf['_37signals'].clientSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, _37signalsUser) { + return usersBy37signalsId[_37signalsUser.id] || + (usersBy37signalsId[_37signalsUser.identity.id] = addUser('37signals', _37signalsUser)); + }) + .redirectPath('/') + +everyauth.tumblr + .consumerKey(conf.tumblr.consumerKey) + .consumerSecret(conf.tumblr.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessSecret, tumblrUser) { + return usersByTumblrName[tumblrUser.name] || + (usersByTumblrName[tumblrUser.name] = addUser('tumblr', tumblrUser)); + }) + .redirectPath('/'); + +everyauth.box + .apiKey(conf.box.apiKey) + .findOrCreateUser( function (sess, authToken, boxUser) { + return usersByBoxId[boxUser.user_id] || + (usersByDropboxId[boxUser.user_id] = addUser('box', boxUser)); + }) + .redirectPath('/'); + +everyauth.dwolla + .appId(conf.dwolla.clientId) + .appSecret(conf.dwolla.clientSecret) + .scope('accountinfofull') + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, dwollaUser) { + return usersByDwollaId[dwollaUser.id] || (usersByDwollaId[dwollaUser.id] = addUser('dwolla', dwollaUser)); + }) + .redirectPath('/'); + +everyauth.vkontakte + .appId(conf.vkontakte.appId) + .appSecret(conf.vkontakte.appSecret) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, vkUserMetadata) { + return usersByVkId[vkUserMetadata.uid] || + (usersByVkId[vkUserMetadata.uid] = addUser('vkontakte', vkUserMetadata)); + }) + .redirectPath('/'); + +everyauth.mailru + .appId(conf.mailru.appId) + .appSecret(conf.mailru.appSecret) + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mlUserMetadata) { + return usersMailruId[mlUserMetadata.uid] || + (usersMailruId[mlUserMetadata.uid] = addUser('mailru', mlUserMetadata)); + }) + .redirectPath('/'); + +everyauth.skyrock + .consumerKey(conf.skyrock.consumerKey) + .consumerSecret(conf.skyrock.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, skyrockUser) { + return usersBySkyrockId[skyrockUser.id_user] || (usersBySkyrockId[skyrockUser.id_user] = addUser('skyrock', skyrockUser)); + }) + .redirectPath('/'); + +everyauth.evernote + .oauthHost(conf.evernote.oauthHost) + .consumerKey(conf.evernote.consumerKey) + .consumerSecret(conf.evernote.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, enUserMetadata) { + return usersByEvernoteId[enUserMetadata.userId] || (usersByEvernoteId[enUserMetadata.userId] = addUser('evernote', enUserMetadata)); + }) + .redirectPath('/'); + +everyauth.tripit + .consumerKey(conf.tripit.consumerKey) + .consumerSecret(conf.tripit.consumerSecret) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, tripitProfile) { + var userId = tripitProfile['@attributes'].ref; + return usersByTripIt[userId] || (usersByTripIt[userId] = addUser('tripit', tripitProfile)); + }) + .redirectPath('/'); + +everyauth['500px'] + .consumerKey(conf._500px.consumerKey) + .consumerSecret(conf._500px.consumerSecret) + .findOrCreateUser(function(sess, accessToken, accessSecret, user) { + return usersBy500pxId[user.id] || (usersBy500pxId[user.id] = addUser('500px', user)); + }) + .redirectPath('/'); + +everyauth.mendeley + .consumerKey(conf.mendeley.consumerKey) + .consumerSecret(conf.mendeley.consumerSecret) + .findOrCreateUser(function(sess, accessToken, accessSecret, user) { + return usersByMendeleyId[user.main.profile_id] || (usersByMendeleyId[user.main.profile_id] = addUser('mendeley', user)); + }) + .redirectPath('/'); + +everyauth + .soundcloud + .appId(conf.soundcloud.appId) + .appSecret(conf.soundcloud.appSecret) + .findOrCreateUser( function (sess, accessToken, accessTokenExtra, soundcloudUser) { + return usersBySoundCloudId[soundcloudUser.id] || (usersBySoundCloudId[soundcloudUser.id] = addUser('soundcloud', soundcloudUser)); + }) + .redirectPath('/'); + +everyauth + .mixi + .appId(conf.mixi.consumerKey) + .appSecret(conf.mixi.consumerSecret) + .scope(conf.mixi.scope) + .display('pc') + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mixiUserMetadata) { + return usersByFbId[mixiUserMetadata.id] || + (usersByFbId[mixiUserMetadata.id] = addUser('mixi', mixiUserMetadata)); + }) + .redirectPath('/'); + +everyauth + .mailchimp + .appId(conf.mailchimp.appId) + .appSecret(conf.mailchimp.appSecret) + .myHostname(process.env.HOSTNAME || "http://127.0.0.1:3000/")//MC requires 127.0.0.1 for dev + .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailchimpUser){ + return usersByMailchimpId[mailchimpUser.id] || + (usersByMailchimpId[mailchimpUser.user_id] = addUser('mailchimp', mailchimpUser)); + }) + .redirectPath("/"); + +var app = express(); +app.use(express.static(__dirname + '/public')) + .use(express.favicon()) + .use(express.bodyParser()) + .use(express.cookieParser('htuayreve')) + .use(express.session()) + .use(everyauth.middleware(app)); + +app.configure( function () { + app.set('view engine', 'jade'); + app.set('views', everyauthRoot + '/example/views'); +}); + +app.get('/', function (req, res) { + res.render('home'); +}); + +app.listen(3000); + +console.log('Go to http://local.host:3000'); + +module.exports = app; diff --git a/node_modules/everyauth/example/views/home.jade b/node_modules/everyauth/example/views/home.jade new file mode 100644 index 0000000..4b39cd6 --- /dev/null +++ b/node_modules/everyauth/example/views/home.jade @@ -0,0 +1,181 @@ +- if (!everyauth.loggedIn) + h2 Not Authenticated + #register + a(href='http://github.com/register') Register + #password-login + a(href='http://github.com/login', style='border: 0px') Login with Password + #fb-login.fb_button(style='background-position: left -188px') + a.fb_button_medium(href='http://github.com/auth/facebook') + span#fb_login_text.fb_button_text + Connect with Facebook + #azureacs-login + a(href='http://github.com/auth/azureacs', style='border: 0px') + img(style='border: 0px', src='http://www.microsoft.com/france/etudiants/Files/labo/windows_azure_logo.png') + #twitter-login + a(href='http://github.com/auth/twitter', style='border: 0px') + img(style='border: 0px', src='https://si0.twimg.com/images/dev/buttons/sign-in-with-twitter-l.png') + #github-login + a(href='http://github.com/auth/github', style='border: 0px') + img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/github_64.png') + #instagram-login + a(href='http://github.com/auth/instagram', style='border: 0px') + img(style='border: 0px', src='https://instagram.com/static/images/headerWithTitle.png') + #foursquare-login + a(href='http://github.com/auth/foursquare', style='border: 0px') + img(style='border: 0px', src='https://foursquare.com/img/headerLogo.png') + #gowalla-login + a(href='http://github.com/auth/gowalla', style='border: 0px') + img(style='border: 0px', src='http://static.gowalla.com/gowalla-connect-buttons/button-gowalla_connect-156ool.png') + #linkedin-login + a(href='http://github.com/auth/linkedin', style='border: 0px') + img(style='border: 0px', src='http://press.linkedin.com/sites/all/themes/presslinkedin/images/LinkedIn_WebLogo_LowResExample.jpg') + #google-login + a(href='http://github.com/auth/google', style='border: 0px') + img(style='border: 0px', src='https://www.google.com/favicon.ico') + #angellist-login + a(href='http://github.com/auth/angellist', style="color: black; text-decoration: none; font-weight: bold; font-size: 25px; font-family: 'helvetica neue', arial, helvetica, freesans, 'liberations sans', 'numbus sans l', sans-serif") AngelList + + #yahoo-login + a(href='http://github.com/auth/yahoo', style='border: 0px') + img(style='border: 0px', src='http://l.yimg.com/a/i/reg/openid/buttons/1_new.png') + #googlehybrid-login + a(href='http://github.com/auth/googlehybrid', style='border: 0px') + img(style='border: 0px', src='https://www.google.com/favicon.ico') + | Hybrid + #readability-login + a(href='http://github.com/auth/readability', style='border: 0px') + img(style='border: 0px', src='https://www.readability.com/media/images/logo_chair.png') + #dropbox-login + a(href='http://github.com/auth/dropbox', style='border: 0px') + img(src='https://www.dropbox.com/static/16890/images/logo.png') + #vimeo-login + a(href='http://github.com/auth/vimeo', style='border: 0px') + img(src='http://a.vimeocdn.com/images/logo_vimeo.png') + #justintv-login + a(href='http://github.com/auth/justintv', style='border: 0px') + img(src='http://s.jtvnw.net/jtv_user_pictures/hosted_images/new_logo_148_40_black.png') + #37signals-login + a(href='http://github.com/auth/37signals', style='border: 0px') + img(src='http://37signals.com/svn/images/37slogo-trans.gif') + #tumblr-login + a(href='http://github.com/auth/tumblr', style='border: 0px') + img(src='http://assets.tumblr.com/images/logo.png?alpha&6') + #box-login + a(href='http://github.com/auth/box', style='border: 0px') + img(src='http://sites.box.net/apps/web/simpleshare/img/logo.png') + #dwolla-login + a(href='http://github.com/auth/dwolla', style='border: 0px') Login with Dwolla + #skyrock-login + a(href='http://github.com/auth/skyrock', style='border: 0px') Login with Skyrock + #evernote-login + a(href='http://github.com/auth/evernote', style='border: 0px') + img(src='http://www.evernote.com/about/media/img/logo.png') + #tripit-login + a(href='http://github.com/auth/tripit', style='border: 0px') + img(src='http://www.tripit.com/images/logos/logo_90x40_trans.gif', title='Login with TripIt') + #500px-login + a(href='http://github.com/auth/500px', style='border: 0px') Login with 500px + #soundcloud-login + a(href='http://github.com/auth/soundcloud', style='border: 0px') + img(src='http://connect.soundcloud.com/2/btn-connect-sc-l.png', title='Login with SoundCloud') + #mixi-login + a(href='http://github.com/auth/mixi', style='border: 0px') + img(src='http://mixi.co.jp/press/images/thumb_press_def.gif', title='Login with mixi') + #mailchimp-login + a(href='http://github.com/auth/mailchimp',style='border: 0px') Login with Mailchimp + #mendeley-login + a(href='http://github.com/auth/mendeley', style='border: 0px') + img(src='http://d1rktifm8krpj.cloudfront.net/graphics/commonnew/logo-mendeley_1248201417297118.png', title='Login with Mendeley') + #openid-login + form#openid(action='http://github.com/auth/openid') + label(for='openid_identifier') OpenID Identifier:   + input(type='text', name='openid_identifier') + input(type='submit') Login +- else + h2 Authenticated + - if (everyauth.facebook) + h3 Facebook User Data + p= JSON.stringify(everyauth.facebook.user) + - if (everyauth.azureacs) + h3 Azure ACS User Data + p= JSON.stringify(everyauth.azureacs.user) + - if (everyauth.twitter) + h3 Twitter User Data + p= JSON.stringify(everyauth.twitter.user) + - if (everyauth.github) + h3 GitHub User Data + p= JSON.stringify(everyauth.github.user) + - if (everyauth.instagram) + h3 Instagram User Data + p= JSON.stringify(everyauth.instagram.user) + - if (everyauth.foursquare) + h3 Foursquare User Data + p= JSON.stringify(everyauth.foursquare.user) + - if (everyauth.gowalla) + h3 Gowalla User Data + p= JSON.stringify(everyauth.gowalla.user) + - if (everyauth.linkedin) + h3 LinkedIn User Data + p= JSON.stringify(everyauth.linkedin.user) + - if (everyauth.google) + h3 Google User Data + p= JSON.stringify(everyauth.google.user) + - if (everyauth.angellist) + h3 AngelList User Data + p= JSON.stringify(everyauth.angellist.user) + - if (everyauth.yahoo) + h3 Yahoo User Data + p= JSON.stringify(everyauth.yahoo.user) + - if (everyauth.readability) + h3 Readability User Data + p= JSON.stringify(everyauth.readability.user) + - if (everyauth.dropbox) + h3 Dropbox User Data + p= JSON.stringify(everyauth.dropbox.user) + - if (everyauth.vimeo) + h3 Vimeo User Data + p= JSON.stringify(everyauth.vimeo.user) + - if (everyauth.justintv) + h3 Justin.tv User Data + p= JSON.stringify(everyauth.justintv.user) + - if (everyauth['37signals']) + h3 37signals User Data + p= JSON.stringify(everyauth['37signals'].user) + - if (everyauth.tumblr) + h3 Tumblr User Data + p= JSON.stringify(everyauth.tumblr.user) + - if (everyauth.box) + h3 Box.net User Data + p= JSON.stringify(everyauth.box.user) + - if (everyauth.openid) + h3 Openid User Data + p= JSON.stringify(everyauth.openid.user) + - if (everyauth.dwolla) + h3 Dwolla User Data + p= JSON.stringify(everyauth.dwolla.user) + - if (everyauth.skyrock) + h3 Skyrock User Data + p= JSON.stringify(everyauth.skyrock.user) + - if (everyauth.evernote) + h3 Evernote User Data + p= JSON.stringify(everyauth.evernote.user) + - if (everyauth.tripit) + h3 TripIt User Data + p= JSON.stringify(everyauth.tripit.user) + - if (everyauth['500px']) + h3 500px User Data + p= JSON.stringify(everyauth['500px'].user) + - if (everyauth['soundcloud']) + h3 SoundCloud User Data + p= JSON.stringify(everyauth['soundcloud'].user) + - if (everyauth.mixi) + h3 mixi User Data + p= JSON.stringify(everyauth.mixi.user) + - if (everyauth.mailchimp) + h3 mailchimp User Data + p= JSON.stringify(everyauth.mailchimp.user) + - if (everyauth.mendeley) + h3 Mendeley User Data + p= JSON.stringify(everyauth.mendeley.user) + h3 + a(href='http://github.com/logout') Logout diff --git a/node_modules/everyauth/example/views/layout.jade b/node_modules/everyauth/example/views/layout.jade new file mode 100644 index 0000000..a27059e --- /dev/null +++ b/node_modules/everyauth/example/views/layout.jade @@ -0,0 +1,9 @@ +!!! 5 +html + head + title= typeof(title) !== 'undefined' ? title : "everyauth example" + script(src='http://static.ak.fbcdn.net/connect/en_US/core.js') + body + h1 everyauth Example + #main + != body diff --git a/node_modules/everyauth/example/views/login.jade b/node_modules/everyauth/example/views/login.jade new file mode 100644 index 0000000..d124db8 --- /dev/null +++ b/node_modules/everyauth/example/views/login.jade @@ -0,0 +1,13 @@ +- if ('undefined' !== typeof errors && errors.length) + ul#errors + - each error in errors + li.error= error +form(action='http://github.com/login', method='post') + #login + label(for=everyauth.password.loginFormFieldName) Login + input(type='text', name=everyauth.password.loginFormFieldName, value=email) + #password + label(for=everyauth.password.passwordFormFieldName) Password + input(type='password', name=everyauth.password.passwordFormFieldName) + #submit + input(type='submit') Login diff --git a/node_modules/everyauth/example/views/register.jade b/node_modules/everyauth/example/views/register.jade new file mode 100644 index 0000000..83d8dda --- /dev/null +++ b/node_modules/everyauth/example/views/register.jade @@ -0,0 +1,14 @@ +h2 Register +- if ('undefined' !== typeof errors && errors.length) + ul#errors + - each error in errors + li.error= error +form(action='http://github.com/register', method='post') + #login + label(for=everyauth.password.loginFormFieldName) Login + input(type='text', name=everyauth.password.loginFormFieldName, value=userParams[everyauth.password.loginFormFieldName]) + #password + label(for=everyauth.password.passwordFormFieldName) Password + input(type='password', name=everyauth.password.passwordFormFieldName) + #submit + input(type='submit') Register diff --git a/node_modules/everyauth/index.js b/node_modules/everyauth/index.js new file mode 100644 index 0000000..460c887 --- /dev/null +++ b/node_modules/everyauth/index.js @@ -0,0 +1,162 @@ +var connect = require('connect') + , express = require('express') + , __pause = connect.utils.pause + , everyauth = module.exports = {}; + + +everyauth.helpExpress = function () { + console.warn('everyauth.helpExpress is being deprecated. helpExpress is now automatically invoked when it detects express. So remove everyauth.helpExpress from your code'); + return this; +} + +everyauth.debug = false; + +// The connect middleware. e.g., +// connect( +// ... +// , everyauth.middleware() +// , ... +// ) +everyauth.middleware = function (expressApp) { + if (expressApp) { + // Then decorate the parent app as soon as we mount everyauth as middleware + // so that any views accessible from the parent app have dynamic helpers + // related to everyauth. + var userAlias = everyauth.expressHelperUserAlias || 'user'; + + expressApp.use( function (req, res, next) { + var sess = req.session + , auth = sess.auth + , ea = { loggedIn: !!(auth && auth.loggedIn) }; + + // Copy the session.auth properties over + for (var k in auth) { + ea[k] = auth[k]; + } + + if (everyauth.enabled.password) { + // Add in access to loginFormFieldName() + passwordFormFieldName() + ea.password || (ea.password = {}); + ea.password.loginFormFieldName = everyauth.password.loginFormFieldName(); + ea.password.passwordFormFieldName = everyauth.password.passwordFormFieldName(); + } + ea.user = req.user; + + res.locals.everyauth = ea; + next(); + }); + + expressApp.use( function (req, res, next) { + res.locals[userAlias] = req.user; + next(); + }); + } + + var app = express(); + app.use(function registerReqGettersAndMethods (req, res, next) { + var methods = everyauth._req._methods + , getters = everyauth._req._getters; + for (var name in methods) { + req[name] = methods[name]; + } + for (name in getters) { + Object.defineProperty(req, name, { + get: getters[name] + }); + } + next(); + }) + .use(function fetchUserFromSession (req, res, next) { + var sess = req.session + , auth = sess && sess.auth; + if (!auth || !auth.userId) return next(); + var everymodule = everyauth.everymodule; + var pause = __pause(req); + + var findUserById_callback = function (err, user) { + if (err) { + pause.resume(); + return next(err); + } + if (user) req.user = user; + else delete sess.auth; + next(); + pause.resume(); + }; + + var findUserById_function = everymodule.findUserById(); + + findUserById_function.length === 3 + ? findUserById_function( req, auth.userId, findUserById_callback ) + : findUserById_function( auth.userId, findUserById_callback ); + + }) + .use(app.router) + + var modules = everyauth.enabled + , _module; + for (var _name in modules) { + _module = modules[_name]; + _module.validateSequences(); + _module.routeApp(app); + } + + app.everyauth = true; + + return app; +}; + +everyauth._req = { + _methods: {} + , _getters: {} +}; + +everyauth.addRequestMethod = function (name, fn) { + this._req._methods[name] = fn; + return this; +}; + +everyauth.addRequestGetter = function (name, fn, isAsync) { + this._req._getters[name] = fn; + return this; +}; + +everyauth + .addRequestMethod('logout', function () { + var req = this; + delete req.session.auth; + }) + .addRequestGetter('loggedIn', function () { + var req = this; + return !!(req.session && req.session.auth && req.session.auth.loggedIn); + }); + +everyauth.modules = {}; +everyauth.enabled = {}; + +// Grab all filenames in ./modules -- They correspond to the modules of the same name +// as the filename (minus '.js') +var fs = require('fs'); +var files = fs.readdirSync(__dirname + '/lib/modules'); +var includeModules = files.map( function (fname) { + return fname.substring(0, fname.length - 3); +}); +for (var i = 0, l = includeModules.length; i < l; i++) { + var name = includeModules[i]; + + // Lazy enabling of a module via `everyauth` getters + // i.e., the `facebook` module is not loaded into memory + // until `everyauth.facebook` is evaluated + Object.defineProperty(everyauth, name, { + get: (function (name) { + return function () { + var mod = this.modules[name] || (this.modules[name] = require('./lib/modules/' + name)); + // Make `everyauth` accessible from each auth strategy module + if (!mod.everyauth) mod.everyauth = this; + if (mod.shouldSetup) + this.enabled[name] = mod; + return mod; + } + })(name) + }); +}; diff --git a/node_modules/everyauth/lib/modules/37signals.js b/node_modules/everyauth/lib/modules/37signals.js new file mode 100644 index 0000000..0cdca99 --- /dev/null +++ b/node_modules/everyauth/lib/modules/37signals.js @@ -0,0 +1,51 @@ +var oauthModule = require('./oauth2'); + +module.exports = +oauthModule.submodule('37signals') + .configurable({ + scope: 'specify types of access: (no scope), user, public_repo, repo, gist' + }) + + .oauthHost('https://launchpad.37signals.com/') + .apiHost('https://launchpad.37signals.com/') + + .authPath('/authorization/new') + .authQueryParam('type', 'web_server') + + .accessTokenPath('/authorization/token') + .accessTokenParam('type', 'web_server') + + .postAccessTokenParamsVia('data') + + .entryPath('/auth/37signals') + .callbackPath('/auth/37signals/callback') + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/authorization.json', accessToken, function (err, data) { + if (err) return p.fail(err); + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var _37sigResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + _37sigResponse.statusCode + , _37sigResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/500px.js b/node_modules/everyauth/lib/modules/500px.js new file mode 100644 index 0000000..5a7c877 --- /dev/null +++ b/node_modules/everyauth/lib/modules/500px.js @@ -0,0 +1,17 @@ +var oauthModule = require('./oauth'); + +module.exports = +oauthModule.submodule('500px') + .apiHost('https://api.500px.com/v1') + .oauthHost('https://api.500px.com/v1') + .entryPath('/auth/500px') + .callbackPath('/auth/500px/callback') + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/users', accessToken, accessTokenSecret, function (err, data) { + if (err) { return p.fail(err); } + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }); + return p; + }); diff --git a/node_modules/everyauth/lib/modules/angellist.js b/node_modules/everyauth/lib/modules/angellist.js new file mode 100644 index 0000000..3d61493 --- /dev/null +++ b/node_modules/everyauth/lib/modules/angellist.js @@ -0,0 +1,49 @@ +var oauthModule = require('./oauth2'); + +module.exports = +oauthModule.submodule('angellist') + .configurable({ + scope: 'specify types of access: (no scope), user, public_repo, repo, gist' + }) + + .oauthHost('https://angel.co/') + .apiHost('https://api.angel.co/1') + + .authPath('/api/oauth/authorize') + .authQueryParam('response_type', 'code') + + .accessTokenPath('/api/oauth/token') + .accessTokenParam('grant_type', 'authorization_code') + + .entryPath('/auth/angellist') + .callbackPath('/auth/angellist/callback') + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/me', accessToken, function (err, data) { + if (err) return p.fail(err); + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var angellistResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + angellistResponse.statusCode + , angellistResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/azureacs.js b/node_modules/everyauth/lib/modules/azureacs.js new file mode 100644 index 0000000..2ac8248 --- /dev/null +++ b/node_modules/everyauth/lib/modules/azureacs.js @@ -0,0 +1,157 @@ +var everyModule = require('./everymodule') + , url = require('url') + , querystring = require('querystring') + , Swt = require('node-swt') + , WsFederation = require('node-wsfederation') + , openId = require('openid') + , extractHostname = require('../utils').extractHostname; + +var azureacs = module.exports = +everyModule.submodule('azureacs') + .definit( function () { + this.wsfederation = new WsFederation(this.realm(), this.homeRealm(), this.identityProviderUrl()); + }) + .configurable({ + identityProviderUrl : 'the federation endpoint at the identity provider' + , signingKey : 'a 256-bit symmetric key for the namespace' + , realm : 'the relying party application identifier, e.g., http://myapp.cloudapp.net' + , redirectPath : 'the path to redirect once the user is authenticated' + , tokenFormat : 'the format used to parse the token' + , homeRealm : 'the indentity provider' + , authCallbackDidErr : 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' + }) + + // Declares a GET route that is aliased + // as 'entryPath'. The handler for this route + // triggers the series of steps that you see + // indented below it. + .get('entryPath', + 'the link a user follows, whereupon you redirect them to ACS url- e.g., "/auth/facebook"') + .step('redirectToIdentityProviderSelector') + .accepts('req res next') + .promises(null) + + .post('callbackPath', + 'the callback path that the ACS redirects to after an authorization result - e.g., "/auth/facebook/callback"') + .step('getToken') + .description('retrieves a verifier code from the url query') + .accepts('req res next') + .promises('token') + .canBreakTo('notValidTokenCallbackErrorSteps') + .canBreakTo('authCallbackErrorSteps') + .step('parseToken') + .description('retrieves a verifier code from the url query') + .accepts('token') + .promises('claims') + .canBreakTo('notValidTokenCallbackErrorSteps') + .step('fetchUser') + .accepts('claims') + .promises('acsUser') + .step('getSession') + .accepts('req') + .promises('session') + .step('findOrCreateUser') + .accepts('session acsUser') + .promises('user') + .step('addToSession') + .accepts('session acsUser token') + .promises(null) + .step('sendResponse') + .accepts('res') + .promises(null) + + .stepseq('authCallbackErrorSteps') + .step('handleAuthCallbackError', + 'a request handler that intercepts a failed authorization message sent from the ACS provider to your service. e.g., the request handler for "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request."') + .accepts('req res next') + .promises(null) + + .stepseq('protocolNotImplementedErrorSteps') + .step('handleProtocolNotImplementedError', + 'the protocol specified is not implemented yet.') + .accepts('tokenFormat') + .promises(null) + + .stepseq('notValidTokenCallbackErrorSteps') + .step('handleNotValidTokenCallbackError', + 'the token is not valid"') + .accepts('token') + .promises(null) + + .redirectToIdentityProviderSelector( function (req, res) { + var identityProviderSelectorUri = this.wsfederation.getRequestSecurityTokenUrl(); + this.redirect(res, identityProviderSelectorUri); + }) + + .getToken( function (req, res) { + var token = this.wsfederation.extractToken(res); + + if (this.tokenFormat() === 'swt') { + var str = token['wsse:BinarySecurityToken']['#']; + var result = new Buffer(str, 'base64').toString('ascii'); + } + else { + return this.breakTo('protocolNotImplementedErrorSteps', this.tokenFormat()); + } + + if (this._authCallbackDidErr(req)) { + return this.breakTo('authCallbackErrorSteps', req, res); + } + + return result; + }) + + .parseToken( function (token) { + if (this.tokenFormat() === 'swt') { + var swt = new Swt(token); + if (!swt.isValid(token, this.realm(), this.signingKey())) { + return this.breakTo('notValidTokenCallbackErrorSteps', token); + } + return swt.claims; + } + + return this.breakTo('protocolNotImplementedErrorSteps', this.tokenFormat()); + }) + + .getSession( function (req) { + return req.session; + }) + + .fetchUser( function (claims) { + var user = {}; + user['azureacs'] = claims; + return user; + }) + + .addToSession( function (sess, acsUser, token) { + var _auth = sess.auth || (sess.auth = {}) + , mod = _auth[this.name] || (_auth[this.name] = {}); + _auth.loggedIn = true; + _auth.userId || (_auth.userId = acsUser.id); + mod.user = acsUser; + mod.accessToken = token; + }) + + .sendResponse( function (res) { + var redirectTo = this.redirectPath(); + if (!redirectTo) + throw new Error('You must configure a redirectPath'); + this.redirect(res, redirectTo); + }) + + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; + }) + + .handleNotValidTokenCallbackError( function (token) { + throw new Error("The token received is NOT valid"); + }) + + .handleAuthCallbackError( function (req, res) { + throw new Error("Authorization Error"); + }) + + .handleProtocolNotImplementedError( function (tokenFormat) { + throw new Error("The protocol specified is not implemented. Token format:" +tokenFormat); + }) diff --git a/node_modules/everyauth/lib/modules/box.js b/node_modules/everyauth/lib/modules/box.js new file mode 100644 index 0000000..3d4305d --- /dev/null +++ b/node_modules/everyauth/lib/modules/box.js @@ -0,0 +1,161 @@ +var everyModule = require('./everymodule') + , request = require('request') + , url = require('url') + , xml2js =require('xml2js'); + +var box = module.exports = +everyModule.submodule('box') + .configurable({ + apiKey: 'The API key obtained when registering a project with OpenBox' + , redirectPath: 'Where to redirect to after a failed or successful auth' + }) + + .get('entryPath', + 'the link a user follows, whereupon you redirect them to Box.net -- e.g., "/auth/box"') + .step('getTicket') + .description('asks Box.net for a unique ticket for each user of your app') + .accepts('req res next') + .promises('ticket') + .step('redirectToBoxAuth') + .description('redirects the user to https://www.box.net/api/1.0/auth/') + .accepts('res ticket') + .promises(null) + .get('callbackPath', + 'the callback path that Box.net redirects to after an authorization result - e.g., "/auth/box/callback"') + .step('extractAuthToken') + .description('extracts auth_token from the url that Box.net redirects to after authorization') + .accepts('req res next') + .promises('authToken') + .step('getSession') + .description('extracts the session from the incoming request') + .accepts('req') + .promises('session') + .step('fetchUser') + .description('fetches the authorizing user via the API with the authToken') + .accepts('authToken') + .promises('boxUser') + .step('findOrCreateUser') + //.optional() + .accepts('session authToken boxUser') + .promises('user') + .step('compileAuth') + .description('combines the ticket, auth token, fetched boxUser, and your app user into a single object') + .accepts('authToken boxUser user') + .promises('auth') + .step('addToSession') + .description('adds the auth token and box.net user metadata to the session') + .accepts('session auth') + .promises(null) + .step('sendResponse') + .description('sends a response to the client by rendering a successful auth view') + .accepts('res') + .promises(null) + + .getTicket( function (req, res) { + var promise = this.Promise(); + request.get({ + url: this._apiHost + '/rest' + , qs: { action: 'get_ticket', api_key: this._apiKey } + }, function (err, res, body) { + var parser = new xml2js.Parser; + console.log(body); + parser.parseString(body, function (xmlErr, json) { + if (xmlErr) { + return promise.fail(xmlErr); + } + if (err) { + err.extra = {res: res, data: json}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: json, res: res}}); + } + var ticket = json.ticket; + return promise.fulfill(ticket); + }); + }); + return promise; + }) + .redirectToBoxAuth( function (res, ticket) { + this.redirect(res, this._apiHost + '/auth/' + ticket); + }) + + .extractAuthToken( function (req, res) { + var parsedUrl = url.parse(req.url, true) + , authToken = parsedUrl.query && parsedUrl.query.auth_token; + return authToken; + }) + .getSession( function (req, res) { + return req.session; + }) + .fetchUser( function (authToken) { + var promise = this.Promise(); + request.get({ + url: this._apiHost + '/rest' + , qs: { + action: 'get_account_info' + , api_key: this._apiKey + , auth_token: authToken + } + }, function (err, res, body) { + var parser = new xml2js.Parser; + parser.parseString(body, function (xmlErr, json) { + if (xmlErr) { + return promise.fail(xmlErr); + } + if (err) { + err.extra = {res: res, data: json}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: json, res: res}}); + } + var user = json.user + return promise.fulfill(user); + }); + }); + return promise; + }) + .compileAuth( function (authToken, boxUser, user) { + return compiled = { + authToken: authToken + , boxUser: boxUser + , user: user + }; + }) + .addToSession( function (sess, auth) { + var _auth = sess.auth || (sess.auth = {}) + , mod = _auth[this.name] || (_auth[this.name] = {}); + _auth.loggedIn = true; + _auth.userId || (_auth.userId = auth.user.user_id); + mod.user = auth.boxUser; + mod.authToken = auth.authToken; + }) + .sendResponse( function (res) { + var redirectTo = this.redirectPath(); + if (!redirectTo) + throw new Error('You must configure a redirectPath'); + this.redirect(res, redirectTo); + }) + + .entryPath('/auth/box') + .callbackPath('/auth/box/callback') + + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var boxResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + boxResponse.statusCode + , boxResponse.headers); + serverResponse.end(err.extra.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); + +box._apiHost = 'https://www.box.net/api/1.0'; diff --git a/node_modules/everyauth/lib/modules/dropbox.js b/node_modules/everyauth/lib/modules/dropbox.js new file mode 100644 index 0000000..7bcae6d --- /dev/null +++ b/node_modules/everyauth/lib/modules/dropbox.js @@ -0,0 +1,18 @@ +var oauthModule = require('./oauth'); + +var dropbox = module.exports = +oauthModule.submodule('dropbox') + .apiHost('https://api.dropbox.com/1') + .oauthHost('https://www.dropbox.com/1') + .entryPath('/auth/dropbox') + .callbackPath('/auth/dropbox/callback') + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/account/info', accessToken, accessTokenSecret, function (err, data) { + if (err) return p.fail(err); + var oauthUser = JSON.parse(data); + oauthUser.id = oauthUser.uid; + p.fulfill(oauthUser); + }); + return p; + }); diff --git a/node_modules/everyauth/lib/modules/dwolla.js b/node_modules/everyauth/lib/modules/dwolla.js new file mode 100644 index 0000000..a3acd5e --- /dev/null +++ b/node_modules/everyauth/lib/modules/dwolla.js @@ -0,0 +1,64 @@ +var oauthModule = require('./oauth2') + , request = require('request'); + +var dwolla = module.exports = +oauthModule.submodule('dwolla') + .configurable({ + scope: 'specify types of access: accountinfofull|request|contacts|balance|send|transactions' + }) + + .oauthHost('https://www.dwolla.com/') + .apiHost('https://www.dwolla.com/oauth/rest') + + .authPath('/oauth/v2/authenticate') + .accessTokenPath('/oauth/v2/token') + .accessTokenParam('grant_type', 'authorization_code') + + .entryPath('/auth/dwolla') + .callbackPath('/auth/dwolla/callback') + + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + + .authQueryParam('response_type', 'code') + + .fetchOAuthUser( function (accessToken) { + var promise = this.Promise(); + request.get({ + url: this.apiHost() + '/users' + , qs: { oauth_token: accessToken, alt: 'json' } + }, function (err, res, body) { + if (err) { + err.extra = {res: res, data: body}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: body, res: res}}); + } + var oauthUser = JSON.parse(body).Response; + return promise.fulfill(oauthUser); + }); + + return promise; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var dwollaResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + dwollaResponse.statusCode + , dwollaResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/evernote.js b/node_modules/everyauth/lib/modules/evernote.js new file mode 100644 index 0000000..0a9ace1 --- /dev/null +++ b/node_modules/everyauth/lib/modules/evernote.js @@ -0,0 +1,24 @@ +var oauthModule = require('./oauth') + , url = require('url'); + +var evernote = module.exports = +oauthModule.submodule('evernote') + .oauthHost('https://www.evernote.com/') + .entryPath('/auth/evernote') + .callbackPath('/auth/evernote/callback') + .authorizePath('/OAuth.action') + .requestTokenPath('/oauth') + .accessTokenPath('/oauth') + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var oauthUser = { + shardId: params.edam_shard + , userId: parseInt(params.edam_userId, 10) + }; + accessToken.split(':').forEach(function(item) { + item = item.split('='); + if (item[0] === 'A') { + oauthUser['username'] = item[1]; + } + }); + return oauthUser; + }); \ No newline at end of file diff --git a/node_modules/everyauth/lib/modules/everymodule.js b/node_modules/everyauth/lib/modules/everymodule.js new file mode 100644 index 0000000..c3fb1c2 --- /dev/null +++ b/node_modules/everyauth/lib/modules/everymodule.js @@ -0,0 +1,365 @@ +var url = require('url') + , Step = require('../step') + , StepSequence = require('../stepSequence') + , RouteTriggeredSequence = require('../routeTriggeredSequence') + , clone = require('../utils').clone + , Promise = require('../promise'); + +var everyModule = module.exports = { + name: 'everymodule' + + , definit: function definit (fn) { + // Remove any prior `init` that was assigned directly to the object via + // definit and not assigned via prototypal inheritance + if (this.hasOwnProperty('init')) delete this.init; + + var _super = this.init; + // since this.hasOwnProperty('init') is false + + this.init = function init () { + this._super = _super; + fn.apply(this, arguments); + delete this._super; + + // Do module compilation here, too + }; + return this; + } + + , _stepSequences: {} + , stepseq: function stepseq (name, description) { + this.configurable(name, description); + this._currSeq = + this._stepSequences[name] || (this._stepSequences[name] = new StepSequence(name, this)); + return this; + } + + // _configurable maps parameter names to descriptions + // It is used for introspection with this.configurable() + , _configurable: {} + , configurable: function configurable (arg, description) { + + // Support function signature: + // module.configurable() + // Return a listing of the module's configuration + if (!arguments.length) return this._configurable; + + var property; + if (arg.constructor == Object) { + for (property in arg) { + description = arg[property]; + this.configurable(property, description); + } + return this; + } + + console.assert('string' === typeof arg); + + property = arg; + + // Support function signature: + // module.configurable(paramName); + // Returns the configurable param description + if (arguments.length === 1 && this[property]) { + return this._configurable[property]; + } + + // Support function signature: + // module.configurable('someParam', 'description'); + this[property] = function (setTo) { + var k = '_' + property; + if (arguments.length) { + this[k] = setTo; + return this; + } + // TODO this.everyauth is not yet available here in some contexts + // For example, when we set and try to access a scope in an auth module definition + // but if you look in index, everyauth is not assigned to the module until after it is + // required + if ('undefined' === typeof this[k]) { + var debugMsg = 'WARNING: You are trying to access the attribute/method configured by `' + + property + '`, which you did not configure. Time to configure it.'; + throw new Error(debugMsg); + } + return this[k]; + }; + + this._configurable[property] = description || 'No Description'; + + // Add configurable to submodules that inherit from this supermodule + for (var name in this.submodules) { + this.submodules[name].configurable(arg, description); + } + return this; + } + + // Convenience method for all you coffee-script lovers, e.g., + // + // everyauth.dropbox.configure + // consumerKey: conf.dropbox.consumerKey + // consumerSecret: conf.dropbox.consumerSecret + // findOrCreateUser: (sess, accessToken, accessSecret, dbMeta) -> users[dbMeta.uid] or= addUser('dropbox', dbMeta) + // redirectPath: '/' + , configure: function (conf) { + for (var k in conf) { + this[k](conf[k]); + } + return this; + } + + // TODO Move `.step(name)` behind StepSequence.prototype + , step: function (name) { + var steps = this._steps + , sequence = this._currSeq; + + if (!sequence) + throw new Error("You can only declare a step after declaring a route alias via `get(...)` or `post(...)`."); + + sequence.orderedStepNames.push(name); + + this._currentStep = + steps[name] || (steps[name] = new Step(name, this)); + + // For configuring what the actual business + // logic is: + // fb.step('fetchOAuthUser') generates the method + // fb.fetchOAuthUser whose logic can be configured like + // fb.fetchOAuthUser( function (...) { + // // Business logic goes here + // } ); + this.configurable(name, + 'STEP FN [' + name + '] function encapsulating the logic for the step `' + name + '`.'); + return this; + } + + , accepts: function (input) { + this._currentStep.accepts = input && input.split(/\s+/) || null; + return this; + } + + , promises: function (output) { + this._currentStep.promises = output && output.split(/\s+/) || null; + return this; + } + + , description: function (desc) { + var step = this._currentStep; + step.description = desc; + if (desc) desc = 'STEP FN [' + step.name + '] - ' + desc; + this.configurable(step.name, desc); + return this; + } + + , stepTimeout: function (millis) { + this._currentStep.timeout = millis; + return this; + } + + , stepErrback: function (fn) { + this._currentStep.errback = fn; + return this; + } + + , canBreakTo: function (sequenceName) { + // TODO Implement this (like static typing) + // unless `canBreakTo` only needed for + // readability + return this; + } + + + , cloneOnSubmodule: ['cloneOnSubmodule', '_configurable'] + + , submodules: {} + + // Creates a new submodule using prototypal inheritance + , submodule: function (name) { + var self = this + // So that when we add configurables after + // to the supermodule after the submodule + // creation, we can propagate those configurables + // to the supermodule's submodules + , submodule = this.submodules[name] = Object.create(this, { + name: { value: name } + , submodules: { value: {} } + }); + + this.cloneOnSubmodule.forEach( function (toClone) { + submodule[toClone] = clone(self[toClone]); + }); + + var seqs = this._stepSequences + , newSeqs = submodule._stepSequences = {}; + for (var seqName in seqs) { + newSeqs[seqName] = seqs[seqName].clone(submodule); + } + + var steps = this._steps + , newSteps = submodule._steps = {}; + for (var stepName in steps) { + newSteps[stepName] = steps[stepName].clone(stepName, submodule); + } + + return submodule; + } + + , validateSequences: function () { + var seqs = this._stepSequences; + for (var seqName in seqs) + seqs[seqName].validateSteps(); + } + + // Decorates the app with the routes required of the module + , routeApp: function (app) { + if (this.init) this.init(); + var routes = this._routes + , methods = ['get', 'post']; + for (var method in routes) { + for (var routeAlias in routes[method]) { + var path = this[routeAlias](); + if (!path) + throw new Error('You have not defined a path for the route alias ' + routeAlias + '.'); + var seq = routes[method][routeAlias]; + + // This kicks off a sequence of steps based on a route + // Creates a new chain of promises and exposes the leading promise + // to the incoming (req, res) pair from the route handler + app[method](path, seq.routeHandler.bind(seq)); + } + } + } + + , Promise: function (values) { + return new Promise(this, values); + } + + /** + * Function signature: + * breakTo(sequenceName, arg1, arg2, ...); + * + * [arg1, arg2, ...] are the arguments passed to the `sequence.start(...)` + * where sequence is the sequence with the name `sequenceName` + */ + , breakTo: function (sequenceName) { + // TODO Garbage collect the abandoned sequence + var seq = this._stepSequences[sequenceName]; + if (!seq) { + throw new Error('You are trying to break to a sequence named `' + sequenceName + '`, but there is no sequence with that name in the auth module, `' + this.name + '`.'); + } + var args = Array.prototype.slice.call(arguments, 1); + seq = seq.materialize(); + seq.initialArgs = args; + throw seq; + } + + // _steps maps step names to step objects + // A step object is { accepts: [...], promises: [...] } + , _steps: {} + + , redirect: function (req, location) { + this._performRedirect(req, location); + } +}; + +everyModule.get = route('get'); +everyModule.post = route('post'); + +/** + * Returns a function used for declaring new route triggered sequences + * associated with the uri route and the http `method` + * @param {String} httpMethod (e.g, 'get', 'post') + */ +function route (httpMethod) { + return function (alias, description) { /* `this` is `everyModule` */ + if (description) + description = routeDescPrefix[httpMethod.toLowerCase()] + ' - ' + description; + this.configurable(alias, description); + var name = httpMethod + ':' + alias; + this._currSeq = + this._stepSequences[name] || (this._stepSequences[name] = new RouteTriggeredSequence(name, this)); + return this; + }; +} + +var routeDescPrefix = { + get: 'ROUTE (GET)' + , post: 'ROUTE (POST)' +}; + +// Used to determine if we should validate the module's sequences and setup the +// module's routes. If a module is strictly used as a parent or ancestor module +// to define a shared interface for submodules, then, this should be false. +Object.defineProperty(everyModule, 'shouldSetup', { get: function () { + return ! Object.keys(this.submodules).length; +}}); + +Object.defineProperty(everyModule, '_routes', { get: function () { + var seqs = this._stepSequences + , methods = ['get', 'post']; + return Object.keys(seqs).filter( function (seqName) { + return ~methods.indexOf(seqName.split(':')[0]); + }).reduce( function (_routes, routeName) { + var parts = routeName.split(':') + , method = parts[0] + , routeAlias = parts[1]; + _routes[method] || (_routes[method] = {}); + _routes[method][routeAlias] = seqs[routeName]; + return _routes; + }, {}); +}}); + +Object.defineProperty(everyModule, 'route', { + get: function () { return this._routes; } +}); + +Object.defineProperty(everyModule, 'routes', {get: function () { + var arr = [] + , _routes = this._routes + , _descriptions = this._configurable; + for (var method in _routes) { + for (var alias in _routes[method]) { + method = method.toUpperCase(); + arr.push(method + ' (' + alias + ') [' + + this[alias]() + ']' + + _descriptions[alias].replace(routeDescPrefix[method.toLowerCase()], '')); + } + } + return arr; +}}); + +everyModule + .configurable({ + moduleTimeout: 'How long to wait per step before timing out and invoking any timeout callbacks' + , moduleErrback: 'THE error callback that is invoked any time an error occurs in the module; ' + + 'defaults to passing the error to connect/express `next` callback' + , logoutRedirectPath: 'Where to redirect the app upon logging out' + , findUserById: 'function for fetching a user by his/her id -- used to assign to `req.user` - function ( [req], userId, callback) where function callback (err, user)' + , performRedirect: 'function for redirecting responses' + , userPkey: 'identifying property of the user; defaults to "id"' + }) + .get('logoutPath') + .step('handleLogout') + .accepts('req res next') + .promises(null) + .logoutPath('/logout') + .handleLogout( function (req, res) { + req.logout(); + this.redirect(res, this.logoutRedirectPath()); + }) + .logoutRedirectPath('/') + .userPkey('id'); + +everyModule.performRedirect( function(res, location) { + res.writeHead(303, { 'Location': location }); + res.end(); +}); + +everyModule.moduleTimeout(10000); +everyModule.moduleErrback( function (err, seqValues) { + if (! (err instanceof Error)) { + console.log('Warning: Try to pass only Errors'); + err = new Error(JSON.stringify(err)); + } + var next = seqValues.next; + next(err); +}); diff --git a/node_modules/everyauth/lib/modules/facebook.js b/node_modules/everyauth/lib/modules/facebook.js new file mode 100644 index 0000000..56da7c5 --- /dev/null +++ b/node_modules/everyauth/lib/modules/facebook.js @@ -0,0 +1,86 @@ +var oauthModule = require('./oauth2') + , url = require('url'); + +var fb = module.exports = +oauthModule.submodule('facebook') + .configurable({ + scope: 'specify types of access: See http://developers.facebook.com/docs/authentication/permissions/', + fields: 'specify returned fields: See http:/developers.facebook.com/docs/reference/api/user/' + }) + + .apiHost('https://graph.facebook.com/') + .oauthHost('https://graph.facebook.com/') + + .authPath('https://www.facebook.com/dialog/oauth') + + .entryPath('/auth/facebook') + .callbackPath('/auth/facebook/callback') + + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; + }) + .handleAuthCallbackError( function (req, res) { + var parsedUrl = url.parse(req.url, true) + , errorDesc = parsedUrl.query.error_description; + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: errorDesc + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + var fieldsQuery = ""; + if (this._fields && this._fields.length > 0){ + fieldsQuery = "?fields=" + this.fields(); + } + this.oauth.get(this.apiHost() + '/me' + fieldsQuery, accessToken, function (err, data) { + if (err) return p.fail(err); + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var facebookResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + facebookResponse.statusCode + , facebookResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); + +fb.mobile = function (isMobile) { + if (isMobile) { + this.authPath('https://m.facebook.com/dialog/oauth'); + } + return this; +}; + +fb.popup = function (isPopup) { + if (isPopup) { + this.authQueryParam('display', 'popup'); + } + return this; +}; diff --git a/node_modules/everyauth/lib/modules/foursquare.js b/node_modules/everyauth/lib/modules/foursquare.js new file mode 100644 index 0000000..f20754e --- /dev/null +++ b/node_modules/everyauth/lib/modules/foursquare.js @@ -0,0 +1,56 @@ +var oauthModule = require('./oauth2') + , request = require('request'); + +var foursquare = module.exports = +oauthModule.submodule('foursquare') + .apiHost('https://api.foursquare.com/v2') + .oauthHost('https://foursquare.com/') + + .authPath('/oauth2/authenticate') + .accessTokenPath('/oauth2/access_token') + + .entryPath('/auth/foursquare') + .callbackPath('/auth/foursquare/callback') + + .authQueryParam('response_type', 'code') + + .accessTokenHttpMethod('get') + .accessTokenParam('grant_type', 'authorization_code') + + .fetchOAuthUser( function (accessToken) { + var promise = this.Promise() + , userUrl = this.apiHost() + '/users/self' + , queryParams = { oauth_token: accessToken } + request.get({ url: userUrl, qs: queryParams}, function (err, res, body) { + if (err) { + err.extra = {res: res, data: body}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: body, res: res}}); + } + var oauthUser = JSON.parse(body).response.user; + return promise.fulfill(oauthUser); + }); + return promise; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var foursquareResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + foursquareResponse.statusCode + , foursquareResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/github.js b/node_modules/everyauth/lib/modules/github.js new file mode 100644 index 0000000..927a986 --- /dev/null +++ b/node_modules/everyauth/lib/modules/github.js @@ -0,0 +1,50 @@ +var oauthModule = require('./oauth2'); + +var github = module.exports = +oauthModule.submodule('github') + .configurable({ + scope: 'specify types of access: (no scope), user, public_repo, repo, gist' + }) + + .oauthHost('https://github.com/') + .apiHost('https://github.com/api/v2/json') + + .authPath('/login/oauth/authorize') + .accessTokenPath('/login/oauth/access_token') + + .entryPath('/auth/github') + .callbackPath('/auth/github/callback') + + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/user/show', accessToken, function (err, data) { + if (err) return p.fail(err); + var oauthUser = JSON.parse(data).user; + p.fulfill(oauthUser); + }) + return p; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var ghResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + ghResponse.statusCode + , ghResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/google.js b/node_modules/everyauth/lib/modules/google.js new file mode 100644 index 0000000..e29420b --- /dev/null +++ b/node_modules/everyauth/lib/modules/google.js @@ -0,0 +1,132 @@ +var oauthModule = require('./oauth2') + , url = require('url') + , request = require('request'); + +var google = module.exports = +oauthModule.submodule('google') + .configurable({ + scope: "URL identifying the Google service to be accessed. See the documentation for the API you'd like to use for what scope to specify. To specify more than one scope, list each one separated with a space." + }) + + .oauthHost('https://accounts.google.com/') + .apiHost('https://www.google.com/m8/feeds') + + .authPath('/o/oauth2/auth') + .authQueryParam('response_type', 'code') + + .accessTokenPath('/o/oauth2/token') + .accessTokenParam('grant_type', 'authorization_code') + .accessTokenHttpMethod('post') + .postAccessTokenParamsVia('data') + + .entryPath('/auth/google') + .callbackPath('/auth/google/callback') + + .authQueryParam({ + access_type: 'offline' + , approval_prompt: 'force' + , scope: function () { + return this._scope && this.scope(); + } + }) + + .addToSession( function (sess, auth) { + this._super(sess, auth); + if (auth.refresh_token) { + sess.auth[this.name].refreshToken = auth.refresh_token; + sess.auth[this.name].expiresInSeconds = parseInt(auth.expires_in, 10); + } + }) + + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; + }) + + .handleAuthCallbackError( function (req, res) { + var parsedUrl = url.parse(req.url, true) + , errorDesc = parsedUrl.query.error + "; " + parsedUrl.query.error_description; + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: errorDesc + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var googleResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + googleResponse.statusCode + , googleResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }) + + .fetchOAuthUser( function (accessToken) { + var promise = this.Promise() + , userUrl = 'https://www.googleapis.com/oauth2/v1/userinfo' + , queryParams = { access_token: accessToken, alt: 'json' }; + request.get({ + url: userUrl + , qs: queryParams + }, function (err, res, body) { + if (err) return promise.fail(err); + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: body, res: res}}); + } + promise.fulfill(JSON.parse(body)); + }); + return promise; + }); + +/** + * @param {Object} params in an object that includes the keys: + * - refreshToken: The refresh token returned from the authorization code + * exchange + * - clientId: The client_id obtained during application registration + * - clientSecret: The client secret obtained during the application registration + * @param {Function} cb + */ +google.refreshToken = function (params, cb) { + request.post('https://accounts.google.com/o/oauth2/token', { + form: { + refresh_token: params.refreshToken + , client_id: params.clientId + , client_secret: params.clientSecret + , grant_type: 'refresh_token' + } + }, function (err, res, body) { + // `body` should look like: + // { + // "access_token":"1/fFBGRNJru1FQd44AzqT3Zg", + // "expires_in":3920, + // "token_type":"Bearer", + // } + if (err) return cb(err); + if (parseInt(res.statusCode / 100, 10) !== 2) { + cb(null, {}, res); + } else { + body = JSON.parse(body); + cb(null, { + accessToken: body.access_token + , expiresIn: body.expires_in + , idToken: body.id_token + }, res); + } + }); + return this; +} diff --git a/node_modules/everyauth/lib/modules/google1.js b/node_modules/everyauth/lib/modules/google1.js new file mode 100644 index 0000000..1bcb0cf --- /dev/null +++ b/node_modules/everyauth/lib/modules/google1.js @@ -0,0 +1,60 @@ +var oauthModule = require('./oauth') + , extractHostname = require('../utils').extractHostname; + +var google = module.exports = +oauthModule.submodule('google1') + .configurable({ + scope: "URL identifying the Google service to be accessed. See the documentation for the API you'd like to use for what scope to specify. To specify more than one scope, list each one separated with a space." + }) + .apiHost('https://www.google.com/') + .oauthHost('https://www.google.com/') + + .entryPath('/auth/google1') + .callbackPath('/auth/google1/callback') + + .requestTokenPath('/accounts/OAuthGetRequestToken') + .authorizePath('/accounts/OAuthAuthorizeToken') + .accessTokenPath('/accounts/OAuthGetAccessToken') + + .requestTokenQueryParam({ + access_type: 'offline' + , approval_prompt: 'force' + , scope: function () { + return this._scope && this.scope(); + } + }) + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise() + , userUrl = 'https://www.google.com/m8/feeds/contacts/default/full?alt=json'; + this.oauth.get(userUrl, accessToken, accessTokenSecret, function (err, data, res) { + if (err) { + err.extra = {data: data, res: res}; + return promise.fail(err); + } + var oauthUser = JSON.parse(data) + , user = { gmail: oauthUser.feed.id.$t }; + promise.fulfill(user); + }); + return promise; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var twitterResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + twitterResponse.statusCode + , twitterResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/googlehybrid.js b/node_modules/everyauth/lib/modules/googlehybrid.js new file mode 100644 index 0000000..f05c176 --- /dev/null +++ b/node_modules/everyauth/lib/modules/googlehybrid.js @@ -0,0 +1,63 @@ +var openidModule = require('./openid') + , OAuth = require('oauth').OAuth + , oid = require('openid') + , extractHostname = require('../utils').extractHostname; + +var googlehybrid = module.exports = +openidModule.submodule('googlehybrid') + .configurable({ + scope: 'array of desired google api scopes' + , consumerKey: 'Consumer Key' + , consumerSecret: 'Consumer Secret' + }) + .definit( function () { + this.relyingParty = + new oid.RelyingParty(this._myHostname + this._callbackPath, null, false, false, [ + new oid.AttributeExchange({ + 'http://axschema.org/contact/email': 'required' + , 'http://axschema.org/namePerson/first': 'required' + , 'http://axschema.org/namePerson/last': 'required' + }) + , new oid.OAuthHybrid({ + consumerKey: this._consumerKey + , scope: this._scope.join(' ') + }) + ]); + + this.oauth = new OAuth( + 'https://www.google.com/accounts/OAuthGetRequestToken' + , 'https://www.google.com/accounts/OAuthGetAccessToken' + , this._consumerKey + , this._consumerSecret + , "1.0", null, "HMAC-SHA1"); + }) + .verifyAttributes(function (req,res) { + var p = this.Promise() + oauth = this.oauth; + this.relyingParty.verifyAssertion(req, function (err, userAttributes) { + if(err) return p.fail(err); + oauth.getOAuthAccessToken(userAttributes['request_token'], undefined, function (err, oauthAccessToken, oauthAccessTokenSecret) { + if (err) return p.fail(err); + userAttributes['access_token'] = oauthAccessToken; + userAttributes['access_token_secret'] = oauthAccessTokenSecret; + p.fulfill(userAttributes) + }); + }); + return p; + }) + .sendToAuthenticationUri(function (req, res) { + + // Automatic hostname detection + assignment + if (!this._myHostname || this._alwaysDetectHostname) { + this.myHostname(extractHostname(req)); + } + + var self = this; + + this.relyingParty.authenticate('http://www.google.com/accounts/o8/id', false, function (err,authenticationUrl){ + if(err) return p.fail(err); + self.redirect(res, authenticationUrl); + }); + }) + .entryPath('/auth/googlehybrid') + .callbackPath('/auth/googlehybrid/callback'); diff --git a/node_modules/everyauth/lib/modules/gowalla.js b/node_modules/everyauth/lib/modules/gowalla.js new file mode 100644 index 0000000..1952f1f --- /dev/null +++ b/node_modules/everyauth/lib/modules/gowalla.js @@ -0,0 +1,62 @@ +var oauthModule = require('./oauth2') + , request = require('request'); + +var gowalla = module.exports = +oauthModule.submodule('gowalla') + .apiHost('https://api.gowalla.com/') + .oauthHost('https://gowalla.com/') + + .authPath('/api/oauth/new') + .accessTokenPath('https://api.gowalla.com/api/oauth/token') + + .entryPath('/auth/gowalla') + .callbackPath('/auth/gowalla/callback') + + .accessTokenHttpMethod('post') + .postAccessTokenParamsVia('data') + .accessTokenParam('grant_type', 'authorization_code') + + .fetchOAuthUser( function (accessToken) { + var promise = this.Promise(); + request.get({ + url: this._apiHost + '/users/me' + , qs: { oauth_token: accessToken } + , headers: { + "X-Gowalla-API-Key": this.appId() + , "Accept": "application/json" + } + }, function (err, res, body) { + if (err) { + err.extra = {res: res, data: body}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: body, res: res}}); + } + var oauthUser = JSON.parse(body); + return promise.fulfill(oauthUser); + }); + + return promise; + }) + + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var gowallaResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + gowallaResponse.statusCode + , gowallaResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/instagram.js b/node_modules/everyauth/lib/modules/instagram.js new file mode 100644 index 0000000..7b131e1 --- /dev/null +++ b/node_modules/everyauth/lib/modules/instagram.js @@ -0,0 +1,39 @@ +var oauthModule = require('./oauth2') + , querystring= require('querystring'); + +var instagram = module.exports = +oauthModule.submodule('instagram') + .configurable({ + display: 'set to "touch" if you want users to see a mobile optimized version of the auth page' + , scope: 'specify types of access (space separated if > 1): basic (default), comments, relationships, likes' + }) + + .oauthHost('https://api.instagram.com/') + .apiHost('https://api.instagram.com/v1') + + .entryPath('/auth/instagram') + .callbackPath('/auth/instagram/callback') + + .authQueryParam('response_type', 'code') + .authQueryParam('display', function () { + return this._display && this.display(); + }) + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + + .accessTokenParam('grant_type', 'authorization_code') + .postAccessTokenParamsVia('data') + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/users/self', accessToken, function (err, data) { + if (err) return p.fail(err.error_message); + var oauthUser = JSON.parse(data).data; + p.fulfill(oauthUser); + }) + return p; + }) + .convertErr( function (data) { + return new Error(data.error_message); + }); diff --git a/node_modules/everyauth/lib/modules/justintv.js b/node_modules/everyauth/lib/modules/justintv.js new file mode 100644 index 0000000..27daff9 --- /dev/null +++ b/node_modules/everyauth/lib/modules/justintv.js @@ -0,0 +1,24 @@ +var oauthModule = require('./oauth'); + +module.exports = +oauthModule.submodule('justintv') + + .apiHost('http://api.justin.tv/') + .oauthHost('http://api.justin.tv/') + + .entryPath('/auth/justintv') + .callbackPath('/auth/justintv/callback') + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/api/account/whoami.json', accessToken, accessTokenSecret, function (err, data) { + if (err) return promise.fail(err); + var oauthUser = JSON.parse(data); + return promise.fulfill(oauthUser); + }); + return promise; + }) + + .convertErr( function (data) { + return new Error(data.data); + }); diff --git a/node_modules/everyauth/lib/modules/ldap.js b/node_modules/everyauth/lib/modules/ldap.js new file mode 100644 index 0000000..18f8ac0 --- /dev/null +++ b/node_modules/everyauth/lib/modules/ldap.js @@ -0,0 +1,28 @@ +var passwordModule = require('./password'); + +var ldap = module.exports = +passwordModule.submodule('ldap') + .configurable({ + host: 'the ldap host' + , port: 'the ldap port' + }) + .authenticate( function (login, password, req, res) { + var promise = this.Promise(); + ldapauth.authenticate(this.host(), this.port(), login, password, function (err, result) { + var user, errors; + if (err) { + return promise.fail(err); + } + if (result === false) { + errors = ['Login failed.']; + return promise.fulfill(errors); + } else if (result === true) { + user = {}; + user[this.loginKey()] = login; + return promise.fulfill(user); + } else { + throw new Error('ldapauth returned a result that was neither `true` nor `false`'); + } + }); + return promise; + }); diff --git a/node_modules/everyauth/lib/modules/linkedin.js b/node_modules/everyauth/lib/modules/linkedin.js new file mode 100644 index 0000000..7dfd81f --- /dev/null +++ b/node_modules/everyauth/lib/modules/linkedin.js @@ -0,0 +1,66 @@ +var oauthModule = require('./oauth') + , OAuth = require('oauth').OAuth; + +var linkedin = module.exports = +oauthModule.submodule('linkedin') + .definit( function () { + this.oauth = new OAuth( + this.oauthHost() + this.requestTokenPath() + , this.oauthHost() + this.accessTokenPath() + , this.consumerKey() + , this.consumerSecret() + , '1.0', null, 'HMAC-SHA1', null + , { + Accept: '/' + , Connection: 'close' + , 'User-Agent': 'Node authentication' + , 'x-li-format': 'json' // So we get JSON responses + }); + }) + + .apiHost('https://api.linkedin.com/v1') + .oauthHost('https://api.linkedin.com/') + + .requestTokenPath('/uas/oauth/requestToken') + .authorizePath('/uas/oauth/authenticate') + .accessTokenPath('/uas/oauth/accessToken') + + .entryPath('/auth/linkedin') + .callbackPath('/auth/linkedin/callback') + + .redirectToProviderAuth( function (res, token) { + this.redirect(res, 'https://www.linkedin.com/' + this.authorizePath() + '?oauth_token=' + token); + }) + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/people/~:(id,first-name,last-name,headline,location:(name,country:(code)),industry,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-standard-profile-request:(url,headers),public-profile-url)', accessToken, accessTokenSecret, function (err, data, res) { + if (err) { + err.extra = {data: data, res: res} + return promise.fail(err); + } + var oauthUser = JSON.parse(data); + promise.fulfill(oauthUser); + }); + return promise; + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var linkedInResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + linkedInResponse.statusCode + , linkedInResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/mailchimp.js b/node_modules/everyauth/lib/modules/mailchimp.js new file mode 100644 index 0000000..c3c3000 --- /dev/null +++ b/node_modules/everyauth/lib/modules/mailchimp.js @@ -0,0 +1,67 @@ +var oauthModule = require('./oauth2') + , request = require('request'); + +var mailchimp = module.exports = +oauthModule.submodule('mailchimp') + .configurable({ + metadataPath: "Although this shouldn't be changed, this is where we get the datacenter for building the API key." + }) + .oauthHost('https://login.mailchimp.com/') + .authPath('/oauth2/authorize') + .accessTokenPath('/oauth2/token') + .metadataPath('/oauth2/metadata') + + .entryPath('/auth/mailchimp') + .callbackPath('/auth/mailchimp/callback') + .fetchOAuthUser( function (accessToken) { + var promise = this.Promise(); + this.oauth._request("GET", this.oauthHost() + this.metadataPath(), { + Authorization: 'OAuth ' + accessToken + },"","", function (err, data){ + if (err) return promise.fail(err); + + var metadata = JSON.parse(data) + , apikey = accessToken + "-"+ metadata.dc; + + request.post({ + url: metadata.api_endpoint + '/1.3/?method=getAccountDetails' + , form: {apikey: apikey} + }, function (err, res, body) { + if (err) { + err.extra = {res: res, data: body}; + return promise.fail(err); + } + if (parseInt(res.statusCode/100, 10) !== 2) { + return promise.fail({extra: {data: body, res: res}}); + } + var oauthUser = JSON.parse(body); + oauthUser.apikey = apikey; + return promise.fulfill(oauthUser); + }); + }); + return promise; + }) + .postAccessTokenParamsVia("data") + .authQueryParam('response_type','code') + .accessTokenParam('grant_type','authorization_code') + + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var mailchimpResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + mailchimpResponse.statusCode + , mailchimpResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/mailru.js b/node_modules/everyauth/lib/modules/mailru.js new file mode 100644 index 0000000..acfceed --- /dev/null +++ b/node_modules/everyauth/lib/modules/mailru.js @@ -0,0 +1,91 @@ +var oauthModule = require('./oauth2') +, url = require('url') +, fs = require('fs') +, crypto = require('crypto'); + +var mailru = module.exports = +oauthModule.submodule('mailru') +.configurable({ + display: 'set to "mobile" if you want users to see a mobile optimized version of the auth page', + scope: 'specify types of access: See http://api.mail.ru/docs/guides/restapi/#permissions' +}) +.oauthHost('https://connect.mail.ru/') +.apiHost('http://www.appsmail.ru/platform/api') +.entryPath('/auth/mailru') +.callbackPath('/auth/mailru/callback') + +.authQueryParam('display', function () { + return this._display && this.display(); +}) +.authQueryParam('response_type', 'code') +.authQueryParam('scope', function () { + return this._scope && this.scope(); +}) + +.accessTokenParam('grant_type', 'authorization_code') +.accessTokenHttpMethod('post') +.postAccessTokenParamsVia('data') +.accessTokenPath('/oauth/token') + +.fetchOAuthUser( function (accessToken, http) { + var promise = this.Promise(), + extradata = http.extra; + + if(typeof accessToken === 'undefined'){ + if(typeof extradata.access_token === 'undefined') { + var strextra = JSON.stringify(extradata).replace(/^\{"(.*)":""\}$/,'"$1"'), + extra = eval('(' + JSON.parse(strextra) + ')'); + accessToken = extra.access_token; + } else { + accessToken = extra.access_token; + } + } + + var query = { + app_id: this.appId(), + method: 'users.getInfo', + secure:1, + session_key: accessToken + }, + data = '', + fields = []; + + for ( key in query ) { + data += key + '=' + query[key]; + } + data += this.appSecret(); + query.sig = crypto.createHash('md5').update(data).digest("hex"); + + for ( key in query ) { + fields.push(key + '=' + query[key]); + } + + this.oauth.get(this.apiHost() + '?' + fields.join('&'), accessToken, function (err, data) { + if (err) { + if (err.error) { + promise.fail(err.error.error_msg) + } + else { + promise.fail(err.error_message); + } + } + var data = JSON.parse(data); + if (data.error) { + promise.fail(data.error.error_msg) + } + else { + var oauthUser = data[0]; + promise.fulfill(oauthUser); + } + }); + return promise; +}) + +.authCallbackDidErr(function(req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; +}) + +.convertErr( function (data) { + return new Error(JSON.parse(data).error.error_msg); +}); diff --git a/node_modules/everyauth/lib/modules/mendeley.js b/node_modules/everyauth/lib/modules/mendeley.js new file mode 100644 index 0000000..6e861a3 --- /dev/null +++ b/node_modules/everyauth/lib/modules/mendeley.js @@ -0,0 +1,45 @@ +var oauthModule = require('./oauth'), + OAuth = require('oauth').OAuth; + var mendeley = module.exports = + oauthModule.submodule('mendeley') + + // http://apidocs.mendeley.com/home/authentication + .apiHost('http://api.mendeley.com/oapi') + .oauthHost('http://www.mendeley.com/oauth') + + .requestTokenPath('/request_token/') + .accessTokenPath('/access_token/') + .authorizePath('/authorize/') + + // oauth_callback not allowed + .sendCallbackWithAuthorize(false) + + .entryPath('/auth/mendeley') + .callbackPath('/auth/mendeley/callback') + .definit( function () { + this.oauth = new OAuth( + this.oauthHost() + this.requestTokenPath() + , this.oauthHost() + this.accessTokenPath() + , this.consumerKey() + , this.consumerSecret() + , '1.0', null, 'HMAC-SHA1'); + + // Mendeley does not support POST requests + this.oauth.setClientOptions({ + "requestTokenHttpMethod": "GET", + "accessTokenHttpMethod": "GET" + }); + }) + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/profiles/info/me/', accessToken, accessTokenSecret, function (err, data) { + if (err) return p.fail(err.error_message); + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .convertErr( function (data) { + return new Error(data.error_message); + }); + diff --git a/node_modules/everyauth/lib/modules/mixi.js b/node_modules/everyauth/lib/modules/mixi.js new file mode 100644 index 0000000..fa44186 --- /dev/null +++ b/node_modules/everyauth/lib/modules/mixi.js @@ -0,0 +1,73 @@ +var oauthModule = require('./oauth2') + , url = require('url'); + +var mixi = module.exports = +oauthModule.submodule('mixi') + .configurable({ + scope: 'specify types of access: See http://developers.mixi.co.jp/' + , display: 'specify types of access: See http://developers.mixi.co.jp/' + }) + + .apiHost('https://api.mixi-platform.com/2') + .oauthHost('https://secure.mixi-platform.com/2/token') + + .accessTokenPath('https://secure.mixi-platform.com/2/token') + + .authPath('https://mixi.jp/connect_authorize.pl') + + .entryPath('/auth/mixi') + .callbackPath('/auth/mixi/callback') + + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + .authQueryParam('response_type', function () { + return 'code'; + }) + .authQueryParam('display', function () { + return this._display && this.display(); + }) + + .accessTokenParam('grant_type', function () { + return 'authorization_code'; + }) + + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; + }) + .handleAuthCallbackError( function (req, res) { + var parsedUrl = url.parse(req.url, true) + , errorDesc = parsedUrl.query.error_description; + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: errorDesc + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + + .fetchOAuthUser( function (accessToken) { + var p = this.Promise(); + this.oauth.setAccessTokenName('oauth_token'); + this.oauth.get(this.apiHost() + '/people/@me/@self', accessToken, function (err, data) { + if (err){ + return p.fail(err); + } + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .convertErr( function (data) { + return new Error(JSON.parse(data.data).error.message); + }); + +mixi.mobile = function (isMobile) { + if (isMobile) { + this.authPath('https://m.mixi.jp/connect_authorize.pl'); + } + return this; +}; diff --git a/node_modules/everyauth/lib/modules/oauth.js b/node_modules/everyauth/lib/modules/oauth.js new file mode 100644 index 0000000..65021a1 --- /dev/null +++ b/node_modules/everyauth/lib/modules/oauth.js @@ -0,0 +1,268 @@ +var everyModule = require('./everymodule') + , OAuth = require('oauth').OAuth + , url = require('url') + , extractHostname = require('../utils').extractHostname; + +var oauth = module.exports = +everyModule.submodule('oauth') + .configurable({ + apiHost: 'e.g., https://api.twitter.com' + , oauthHost: 'the host for the OAuth provider' + , requestTokenPath: "the path on the OAuth provider's domain where we request the request token, e.g., /oauth/request_token" + , accessTokenPath: "the path on the OAuth provider's domain where we request the access token, e.g., /oauth/access_token" + , authorizePath: 'the path on the OAuth provider where you direct a visitor to login, e.g., /oauth/authorize' + , sendCallbackWithAuthorize: 'whether you want oauth_callback=... as a query param send with your request to /oauth/authorize' + , consumerKey: 'the api key provided by the OAuth provider' + , consumerSecret: 'the api secret provided by the OAuth provider' + , myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash' + , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' + , redirectPath: 'Where to redirect to after a failed or successful OAuth authorization' + , convertErr: '(DEPRECATED) a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request' + , authCallbackDidErr: 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' + }) + .definit( function () { + this.oauth = new OAuth( + this.oauthHost() + this.requestTokenPath() + , this.oauthHost() + this.accessTokenPath() + , this.consumerKey() + , this.consumerSecret() + , '1.0', null, 'HMAC-SHA1'); + }) + + .get('entryPath', + 'the link a user follows, whereupon you redirect them to the 3rd party OAuth provider dialog - e.g., "/auth/twitter"') + .step('getRequestToken') + .description('asks OAuth Provider for a request token') + .accepts('req res next') + .promises('token tokenSecret') + .step('storeRequestToken') + .description('stores the request token and secret in the session') + .accepts('req token tokenSecret') + .promises(null) + .step('redirectToProviderAuth') + .description('sends the user to authorization on the OAuth provider site') + .accepts('res token') + .promises(null) + + .get('callbackPath', + 'the callback path that the 3rd party OAuth provider redirects to after an OAuth authorization result - e.g., "/auth/twitter/callback"') + .step('extractTokenAndVerifier') + .description('extracts the request token and verifier from the url query') + .accepts('req res next') + .promises('requestToken verifier') + .canBreakTo('handleDuplicateCallbackRequest') + .canBreakTo('authCallbackErrorSteps') + .step('getSession') + .accepts('req') + .promises('session') + .step('rememberTokenSecret') + .description('retrieves the request token secret from the session') + .accepts('session') + .promises('requestTokenSecret') + .step('getAccessToken') + .description('requests an access token from the OAuth provider') + .accepts('requestToken requestTokenSecret verifier') + .promises('accessToken accessTokenSecret params') + .step('fetchOAuthUser') + .accepts('accessToken accessTokenSecret params') + .promises('oauthUser') + .step('findOrCreateUser') + .accepts('session accessToken accessTokenSecret oauthUser') + .promises('user') + .step('compileAuth') + .accepts('accessToken accessTokenSecret oauthUser user') + .promises('auth') + .step('addToSession') + .accepts('session auth') + .promises(null) + .step('sendResponse') + .accepts('res') + .promises(null) + + .stepseq('handleDuplicateCallbackRequest', + 'handles the case if you manually click the callback link on Twitter, but Twitter has already sent a redirect request to the callback path with the same token') + .step('waitForPriorRequestToWriteSession') + .accepts('req res next') + .promises(null) + .step('sendResponse') + + .stepseq('authCallbackErrorSteps') + .step('handleAuthCallbackError', + 'a request handler that intercepts a failed authorization message sent from the OAuth provider to your service. e.g., the request handler for "/auth/twitter/callback?denied=blahblahblahblahblah"') + .accepts('req res next') + .promises(null) + + .getRequestToken( function (req, res, next) { + + // Automatic hostname detection + assignment + if (!this._myHostname || this._alwaysDetectHostname) { + this.myHostname(extractHostname(req)); + } + + var p = this.Promise() + , params = {oauth_callback: this._myHostname + this._callbackPath} + , additionalParams = this.moreRequestTokenQueryParams + , param; + + if (additionalParams) for (var k in additionalParams) { + param = additionalParams[k]; + if ('function' === typeof param) { + // e.g., for facebook module, param could be + // function () { + // return this._scope && this.scope(); + // } + additionalParams[k] = // cache the function call + param = param.call(this); + } + if ('function' === typeof param) { + // this.scope() itself could be a function + // to allow for dynamic scope determination - e.g., + // function (req, res) { + // return req.session.onboardingPhase; // => "email" + // } + param = param.call(this, req, res); + } + params[k] = param; + } + this.oauth.getOAuthRequestToken(params, function (err, token, tokenSecret, params) { + if (err) { + return p.fail(err); + } + p.fulfill(token, tokenSecret); + }); + return p; + }) + .storeRequestToken( function (req, token, tokenSecret) { + var sess = req.session + , _auth = sess.auth || (sess.auth = {}) + , _provider = _auth[this.name] || (_auth[this.name] = {}); + _provider.token = token; + _provider.tokenSecret = tokenSecret; + }) + .redirectToProviderAuth( function (res, token) { + // Note: Not all oauth modules need oauth_callback as a uri query parameter. As far as I know, only readability's + // module needs it as a uri query parameter. However, in cases such as twitter, it allows you to over-ride + // the callback url settings at dev.twitter.com from one place, your app code, rather than in two places -- i.e., + // your app code + dev.twitter.com app settings. + var redirectTo = this._oauthHost + this._authorizePath + '?oauth_token=' + token; + if (this._sendCallbackWithAuthorize) { + redirectTo += '&oauth_callback=' + this._myHostname + this._callbackPath; + } + this.redirect(res, redirectTo); + }) + + // Steps for GET `callbackPath` + .extractTokenAndVerifier( function (req, res, next) { + if (this._authCallbackDidErr && this._authCallbackDidErr(req)) { + return this.breakTo('authCallbackErrorSteps', req, res); + } + var parsedUrl = url.parse(req.url, true) + , query = parsedUrl.query + , requestToken = query && query.oauth_token + , verifier = query && query.oauth_verifier + + , sess = req.session + , promise + , _auth = sess.auth || (sess.auth = {}) + , name = this.name + , mod = _auth[name] || (_auth[name] = {}); + if ((name === 'twitter') && (mod.token === requestToken) && (mod.verifier === verifier)) { + return this.breakTo('handleDuplicateCallbackRequest', req, res); + } + + promise = this.Promise(); + mod.verifier = verifier; + sess.save( function (err) { + if (err) return promise.fail(err); + promise.fulfill(requestToken, verifier); + }); + return promise; + }) + .getSession( function(req) { + return req.session; + }) + .rememberTokenSecret( function (sess) { + return sess && sess.auth && sess.auth[this.name] && sess.auth[this.name].tokenSecret; + }) + .getAccessToken( function (reqToken, reqTokenSecret, verifier) { + var promise = this.Promise(); + this.oauth.getOAuthAccessToken(reqToken, reqTokenSecret, verifier, function (err, accessToken, accessTokenSecret, params) { + if (err) return promise.fail(err); + promise.fulfill(accessToken, accessTokenSecret, params); + }); + return promise; + }) + .compileAuth( function (accessToken, accessTokenSecret, oauthUser, user) { + return { + accessToken: accessToken + , accessTokenSecret: accessTokenSecret + , oauthUser: oauthUser + , user: user + }; + }) + .addToSession( function (sess, auth) { + var promise = this.Promise() + , _auth = sess.auth + , mod = _auth[this.name]; + _auth.loggedIn = true; + _auth.userId || (_auth.userId = auth.user[this._userPkey]); + mod.user = auth.oauthUser; + mod.accessToken = auth.accessToken; + mod.accessTokenSecret = auth.accessTokenSecret; + // this._super() ? + sess.save( function (err) { + if (err) return promise.fail(err); + promise.fulfill(); + }); + return promise; + }) + .sendResponse( function (res, data) { + var redirectTo = this.redirectPath(); + if (!redirectTo) + throw new Error('You must configure a redirectPath'); + this.redirect(res, redirectTo); + }) + .waitForPriorRequestToWriteSession( function (req, res, next) { + var promise = this.Promise(); + function check (self, sess, res, promise) { + if (sess.auth[self.name].accessToken) { + return promise.fulfill(); + } + + setTimeout(function () { + sess.reload( function (err) { + if (err) return promise.fail(err); + check(self, req.session, res, promise); + }); + }, 100); + } + check(this, req.session, res, promise); + return promise; + }); + +// Defaults inherited by submodules +oauth + .requestTokenPath('/oauth/request_token') + .authorizePath('/oauth/authorize') + .accessTokenPath('/oauth/access_token') + .handleAuthCallbackError( function (req, res, next) { + next(new Error("You must configure handleAuthCallbackError in this module")); + }) + .sendCallbackWithAuthorize(true); + +oauth.moreRequestTokenQueryParams = {}; +oauth.cloneOnSubmodule.push('moreRequestTokenQueryParams'); + +// Add or over-write existing query params that +// get tacked onto the oauth authorize url. +oauth.requestTokenQueryParam = function (key, val) { + if (arguments.length === 1 && key.constructor == Object) { + for (var k in key) { + this.requestTokenQueryParam(k, key[k]); + } + return this; + } + if (val) + this.moreRequestTokenQueryParams[key] = val; + return this; +}; diff --git a/node_modules/everyauth/lib/modules/oauth2.js b/node_modules/everyauth/lib/modules/oauth2.js new file mode 100644 index 0000000..23d867b --- /dev/null +++ b/node_modules/everyauth/lib/modules/oauth2.js @@ -0,0 +1,317 @@ +var everyModule = require('./everymodule') + , OAuth = require('oauth').OAuth2 + , url = require('url') + , querystring = require('querystring') + , request = require('request') + , extractHostname = require('../utils').extractHostname; + +// Steps define a sequence of logic that pipes data through +// a chain of promises. A new chain of promises is generated +// every time the set of steps is started. + +var oauth2 = module.exports = +everyModule.submodule('oauth2') + .definit( function () { + this.oauth = new OAuth(this._appId, this._appSecret, this._oauthHost, this._authPath, this._accessTokenPath); + }) + .configurable({ + apiHost: 'e.g., https://graph.facebook.com' + , oauthHost: 'the host for the OAuth provider' + , appId: 'the OAuth app id provided by the host' + , appSecret: 'the OAuth secret provided by the host' + , authPath: "the path on the OAuth provider's domain where " + + "we direct the user for authentication, e.g., /oauth/authorize" + , accessTokenPath: "the path on the OAuth provider's domain " + + "where we request the access token, e.g., /oauth/access_token" + , accessTokenHttpMethod: 'the http method ("get" or "post") with which to make our access token request' + , postAccessTokenParamsVia: '"query" to POST the params to the access ' + + 'token endpoint as a querysting; "data" to POST the params to ' + + 'the access token endpoint in the request body' + , myHostname: 'e.g., http://local.host:3000 . Notice no trailing slash' + , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' + , convertErr: '(DEPRECATED) a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request' + , authCallbackDidErr: 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' + }) + + // Declares a GET route that is aliased + // as 'entryPath'. The handler for this route + // triggers the series of steps that you see + // indented below it. + .get('entryPath', + 'the link a user follows, whereupon you redirect them to the 3rd party OAuth provider dialog - e.g., "/auth/facebook"') + .step('getAuthUri') + .accepts('req res next') + .promises('authUri') + .step('requestAuthUri') + .accepts('res authUri') + .promises(null) + + .get('callbackPath', + 'the callback path that the 3rd party OAuth provider redirects to after an OAuth authorization result - e.g., "/auth/facebook/callback"') + .step('getCode') + .description('retrieves a verifier code from the url query') + .accepts('req res next') + .promises('code') + .canBreakTo('authCallbackErrorSteps') + .step('getAccessToken') + .accepts('code') + .promises('accessToken extra') + .step('fetchOAuthUser') + .accepts('accessToken') + .promises('oauthUser') + .step('getSession') + .accepts('req') + .promises('session') + .step('findOrCreateUser') + //.optional() + .accepts('session accessToken extra oauthUser') + .promises('user') + .step('compile') + .accepts('accessToken extra oauthUser user') + .promises('auth') + .step('addToSession') + .accepts('session auth') + .promises(null) + .step('sendResponse') + .accepts('res') + .promises(null) + + .stepseq('authCallbackErrorSteps') + .step('handleAuthCallbackError', + 'a request handler that intercepts a failed authorization message sent from the OAuth2 provider to your service. e.g., the request handler for "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request."') + .accepts('req res next') + .promises(null) + + .getAuthUri( function (req, res, next) { + + // Automatic hostname detection + assignment + if (!this._myHostname || this._alwaysDetectHostname) { + this.myHostname(extractHostname(req)); + } + + var params = { + client_id: this._appId + , redirect_uri: this._myHostname + this._callbackPath + } + , authPath = this._authPath + , url = (/^http/.test(authPath)) + ? authPath + : (this._oauthHost + authPath) + , additionalParams = this.moreAuthQueryParams + , param; + + if (additionalParams) for (var k in additionalParams) { + param = additionalParams[k]; + if ('function' === typeof param) { + // e.g., for facebook module, param could be + // function () { + // return this._scope && this.scope(); + // } + param = param.call(this, req, res); + } + if ('function' === typeof param) { + // this.scope() itself could be a function + // to allow for dynamic scope determination - e.g., + // function (req, res) { + // return req.session.onboardingPhase; // => "email" + // } + param = param.call(this, req, res); + } + params[k] = param; + } + return url + '?' + querystring.stringify(params); + }) + .requestAuthUri( function (res, authUri) { + this.redirect(res, authUri); + }) + .getCode( function (req, res, next) { + var parsedUrl = url.parse(req.url, true); + if (this._authCallbackDidErr(req)) { + return this.breakTo('authCallbackErrorSteps', req, res, next); + } + if (!parsedUrl.query || !parsedUrl.query.code) { + console.error("Missing code in querystring. The url looks like " + req.url); + } + return parsedUrl.query && parsedUrl.query.code; + }) + .getAccessToken( function (code, data) { + var p = this.Promise() + , params = { + client_id: this._appId + , redirect_uri: this._myHostname + this._callbackPath + , code: code + , client_secret: this._appSecret + } + , url = this._oauthHost + this._accessTokenPath + , additionalParams = this.moreAccessTokenParams + , param; + + if (this._accessTokenPath.indexOf("://") != -1) { + // Just in case the access token url uses a different subdomain + // than than the other urls involved in the oauth2 process. + // * cough * ... gowalla + url = this._accessTokenPath; + } + + if (additionalParams) for (var k in additionalParams) { + param = additionalParams[k]; + if ('function' === typeof param) { + additionalParams[k] = // cache the fn call + param = param.call(this, data.req, data.res); + } + if ('function' === typeof param) { + param = param.call(this, data.req, data.res); + } + params[k] = param; + } + + var opts = { url: url } + , paramsVia = this._postAccessTokenParamsVia; + switch (paramsVia) { + case 'query': // Submit as a querystring + opts.headers || (opts.headers = {}); + opts.headers['Content-Length'] = 0; + paramsVia = 'qs'; + break; + case 'data': // Submit via application/x-www-form-urlencoded + paramsVia = 'form'; + break; + default: + throw new Error('postAccessTokenParamsVia must be either "query" or "data"'); + } + opts[paramsVia] = params; + request[this._accessTokenHttpMethod](opts, function (err, res, body) { + if (err) { + err.extra = {data: body, res: res}; + return p.fail(err); + } + if (parseInt(res.statusCode / 100) != 2) return p.fail({extra: {res: res, data: body}}); + var resType = res.headers['content-type'] + , data; + if (resType.substring(0, 10) === 'text/plain') { + data = querystring.parse(body); + } else if (resType.substring(0, 33) === 'application/x-www-form-urlencoded') { + data = querystring.parse(body); + } else if (resType.substring(0, 16) === 'application/json') { + data = JSON.parse(body); + } else { + throw new Error('Unsupported content-type ' + resType); + } + var aToken = data.access_token; + delete data.access_token; + p.fulfill(aToken, data); + }); + + return p; + }) + .compile( function (accessToken, extra, oauthUser, user) { + var compiled = { + accessToken: accessToken + , oauthUser: oauthUser + , user: user + }; + // extra is any extra params returned by the + // oauth provider in response to the access token + // POST request + for (var k in extra) { + // avoid clobbering any of the properties we set just above (user, accessToken, oauthUser) + // instagram in particular sends a "user" which can break your code in strange ways if it's overwritten + if (compiled[k]) { + compiled.extra || (compiled.extra = {}); + compiled.extra[k] = extra[k]; + } else { + compiled[k] = extra[k]; + } + } + return compiled; + }) + .getSession( function (req) { + return req.session; + }) + .addToSession( function (sess, auth) { + var _auth = sess.auth || (sess.auth = {}) + , mod = _auth[this.name] || (_auth[this.name] = {}); + _auth.loggedIn = true; + _auth.userId || (_auth.userId = auth.user[this._userPkey]); + mod.user = auth.oauthUser; + mod.accessToken = auth.accessToken; + // this._super() ? + }) + .sendResponse( function (res, data) { + var req = data.req; + var continueTo = req.query['state']; + + if (continueTo) { + return this.redirect(res, continueTo); + } + + var redirectTo = this._redirectPath; + if (!redirectTo) + throw new Error('You must configure a redirectPath'); + this.redirect(res, redirectTo); + }) + + .authCallbackDidErr( function (req, res) { + return false; + }); + +oauth2.moreAuthQueryParams = {}; +oauth2.moreAccessTokenParams = {}; +oauth2.cloneOnSubmodule.push('moreAuthQueryParams', 'moreAccessTokenParams'); + +oauth2 + .authPath('/oauth/authorize') + .accessTokenPath('/oauth/access_token') + .accessTokenHttpMethod('post') + .postAccessTokenParamsVia('query') + .handleAuthCallbackError( function (req, res, next) { + next(Error("You must configure handleAuthCallbackError in this module")); + }) + +// Add or over-write existing query params that +// get tacked onto the oauth authorize url. +oauth2.authQueryParam = function (key, val) { + if (arguments.length === 1 && key.constructor == Object) { + for (var k in key) { + this.authQueryParam(k, key[k]); + } + return this; + } + if (val) + this.moreAuthQueryParams[key] = val; + return this; +}; + +// Add or over-write existing params that +// get sent with the oauth access token request. +oauth2.accessTokenParam = function (key, val) { + if (arguments.length === 1 && key.constructor == Object) { + for (var k in key) { + this.accessTokenParam(k, key[k]); + } + return this; + } + if (val) + this.moreAccessTokenParams[key] = val; + return this; +}; + +/** + * Where to redirect to after a failed or successful OAuth authorization + */ +oauth2.redirectPath = function (path) { + if (typeof path === 'function') { + var self = this; + // req here is the auth request, not the callback request + this.authQueryParam('state', function (req, res) { + return path.call(self, req, res); + }); + } else { + return path; + } +}; + +// removeConfigurable +// removeStep +// undefinedSteps -> [] +// How about module specific and more generic addToSession? Perhaps just do addToSession with null diff --git a/node_modules/everyauth/lib/modules/openid.js b/node_modules/everyauth/lib/modules/openid.js new file mode 100644 index 0000000..6f083fd --- /dev/null +++ b/node_modules/everyauth/lib/modules/openid.js @@ -0,0 +1,106 @@ +var everyModule = require('./everymodule') + , oid = require('openid') + , url = require('url') + , extractHostname = require('../utils').extractHostname; + +var openid = module.exports = +everyModule.submodule('openid') + .configurable({ + simpleRegistration: 'e.g., {"nickname" : true}' + , attributeExchange: 'eg {"http://axschema.org/contact/email": "required"}' + , myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash' + , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' + , redirectPath : 'The path to redirect To' + , openidURLField : 'The post field to use for open id' + }) + .definit( function () { + this.relyingParty = new oid.RelyingParty(this.myHostname() + this.callbackPath(), null, false, false, [ + new oid.UserInterface() + , new oid.SimpleRegistration(this.simpleRegistration()) + , new oid.AttributeExchange(this.attributeExchange()) + ]); + }) + .get('entryPath', + 'the link a user follows, whereupon you kick off the OpenId auth process - e.g., "/auth/openid"') + .step('sendToAuthenticationUri') + .description('sends the user to the providers openid authUrl') + .accepts('req res next') + .promises(null) + .get('callbackPath', + 'the callback path that the 3rd party Openid provider redirects to after an authorization result - e.g., "/auth/openid/callback"') + .step('verifyAttributes') + .description('verifies the return attributes') + .accepts('req res next') + .promises('userAttributes') + .step('getSession') + .accepts('req') + .promises('session') + .step('findOrCreateUser') + .accepts('session userAttributes') + .promises('user') + .step('addToSession') + .accepts('session user') + .promises(null) + .step('sendResponse') + .accepts('res') + .promises(null) + .sendToAuthenticationUri(function(req,res) { + + // Automatic hostname detection + assignment + if (!this._myHostname || this._alwaysDetectHostname) { + this.myHostname(extractHostname(req)); + } + + this.relyingParty.authenticate(req.query[this.openidURLField()], false, function(err,authenticationUrl){ + if(err) return p.fail(err); + this.redirect(res, authenticationUrl); + }); + }) + .getSession( function(req) { + return req.session; + }) + .verifyAttributes(function(req,res) { + var p = this.Promise(); + this.relyingParty.verifyAssertion(req, function (err,userAttributes) { + if(err) return p.fail(err); + p.fulfill(userAttributes) + }); + return p; + }) + .addToSession( function (sess, user) { + var _auth = sess.auth || (sess.auth = {}) + , mod = _auth[this.name] || (_auth[this.name] = {}); + _auth.loggedIn = true; + _auth.userId = user[this._userPkey]; + mod.user = user; + }) + .sendResponse( function (res) { + var redirectTo = this.redirectPath(); + if (!redirectTo) + throw new Error('You must configure a redirectPath'); + this.redirect(res, redirectTo); + }) + .redirectPath('/') + .entryPath('/auth/openid') + .callbackPath('/auth/openid/callback') + .simpleRegistration({ + "nickname" : true + , "email" : true + , "fullname" : true + , "dob" : true + , "gender" : true + , "postcode" : true + , "country" : true + , "language" : true + , "timezone" : true + }) + .attributeExchange({ + "http://axschema.org/contact/email" : "required" + , "http://axschema.org/namePerson/friendly" : "required" + , "http://axschema.org/namePerson" : "required" + , "http://axschema.org/namePerson/first" : "required" + , "http://axschema.org/contact/country/home": "required" + , "http://axschema.org/media/image/default" : "required" + , "http://axschema.org/x/media/signature" : "required" + }) + .openidURLField('openid_identifier'); diff --git a/node_modules/everyauth/lib/modules/osm.js b/node_modules/everyauth/lib/modules/osm.js new file mode 100644 index 0000000..326c2ba --- /dev/null +++ b/node_modules/everyauth/lib/modules/osm.js @@ -0,0 +1,40 @@ +var oauthModule = require('./oauth') + , url = require('url') + , Parser = require('xml2js').Parser + , parser = new Parser({ mergeAttrs: true }); + +var osm = module.exports = +oauthModule.submodule('osm') + .apiHost('http://api.openstreetmap.org/') + .oauthHost('http://www.openstreetmap.org/') + .entryPath('/auth/osm') + .callbackPath('/auth/osm/callback') + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/api/0.6/user/details', accessToken, accessTokenSecret, function (err, data) { + if (err) return promise.fail(err); + parser.parseString(data, function (err, result) { + if (err) return promise.fail(err); + var oauthUser = result.user; + promise.fulfill(oauthUser); + }); + }); + return promise; + }) + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.denied; + }) + .handleAuthCallbackError( function (req, res) { + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: 'The user denied your request' + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + .convertErr( function (data) { + return new Error(data.data.match(/(.+)<\/error>/)[1]); + }); diff --git a/node_modules/everyauth/lib/modules/password.js b/node_modules/everyauth/lib/modules/password.js new file mode 100644 index 0000000..e64dc1c --- /dev/null +++ b/node_modules/everyauth/lib/modules/password.js @@ -0,0 +1,379 @@ +var everyModule = require('./everymodule'); + +/** + * This is used to generate the render methods used with + * + * - `displayLogin` + * - `respondToLoginFail` + * - `displayRegister` + * - `respondToRegistrationFail` + * + * The generated functions have the signature + * + * function (req, res, *extraParams) {...} + * + * @param {String} type is either 'login' or 'register' + * @param {Function} localsDefault is a function that returns the default + * locals object. It has the signature + * + * function (*extraParams) {...} + * + * So, for example, if the generated function can handle incoming args: + * + * function render (req, res, errors, data) + * + * , then the `localsDefault` signature can see the params + * + * function localsDefault (errors, data) + * + * @returns {Function} a generated render function with signature + * + * function (req, res, *extraParams) {...} + */ +function renderGenerator (type, localsDefault) { + return function render (req, res) { + var locals, render, layout + , extraLocals + , view = this[type + 'View'](), arity + , trailingArgs = Array.prototype.slice.call(arguments, 2); + + if (res.render) { + locals = + localsDefault.apply(this, trailingArgs); + layout = this['_' + type + 'Layout']; + render = function render (locals) { + if ('undefined' !== typeof layout) { + locals.layout = layout; + } + res.render(view, locals); + }; + + extraLocals = this['_' + type + 'Locals']; + if ('function' !== typeof extraLocals) { + for (var k in extraLocals) { + locals[k] = extraLocals[k]; + } + return render(locals); + } + + arity = extraLocals.length; + if (arity === 2) { + // Dynamic sync locals + extraLocals = extraLocals(req, res); + for (var k in extraLocals) { + locals[k] = extraLocals[k]; + } + return render(locals); + } else if (arity === 3) { + // Dynamic async locals + return extraLocals(req, res, function (err, extraLocals) { + if (err) throw err; // TODO Call global configurable error handler + for (var k in extraLocals) { + locals[k] = extraLocals[k]; + } + return render(locals); + }); + } else { + throw new Error('Your `locals` function must have arity 2 or 3'); + } + } else { + res.writeHead(200, {'Content-Type': 'text/html'}); + if ('function' === typeof view) { + res.end(view.apply(this, trailingArgs)); + } else { + res.end(view); + } + } + }; +} + +var renderLogin = renderGenerator('login', + function () { + var locals = {}; + locals[this.loginKey()] = null; + return locals; + } +); + +var renderLoginFail = renderGenerator('login', + function (errors, login) { + var locals = {errors: errors}; + locals[this.loginKey()] = login; + return locals; + } +); + +var renderRegister = renderGenerator('register', + function () { + var locals = {}; + locals.userParams = {}; + return locals; + } +); + +var renderRegisterFail = renderGenerator('register', + function (errors, newUserAttributes) { + return { + errors: errors + , userParams: newUserAttributes}; + } +); + +/** + * Let's define our password module + */ +var password = module.exports = +everyModule.submodule('password') + .configurable({ + loginFormFieldName: 'the name of the login field. Same as what you put in your login form ' + + '- e.g., if , then loginFormFieldName ' + + 'should be set to "username".' + , passwordFormFieldName: 'the name of the login field. Same as what you put in your login form ' + + '- e.g., if , then passwordFormFieldName ' + + 'should be set to "pswd".' + , loginHumanName: 'the human readable name of login -- e.g., "login" or "email"' + , loginKey: 'the name of the login field in your data store -- e.g., "email"; defaults to "login"' + , loginWith: 'specify what login type you want to use' + , validLoginTypes: 'specifies the different login types available and associated behavior' + , loginView: 'Either (A) the name of the view (e.g., "login.jade") or (B) the HTML string ' + + 'that corresponds to the login page OR (C) a function (errors, login) {...} that returns the HTML string incorporating the array of `errors` messages and the `login` used in the prior attempt' + , loginLayout: 'the name or path to the layout you want to use for your login' + , loginLocals: 'Configure extra locals to pass to your login view' + , loginSuccessRedirect: 'The path we redirect to after a successful login.' + , registerView: 'Either the name of the view (e.g., "register.jade") or the HTML string ' + + 'that corresponds to the register page.' + , registerLayout: 'the name or path to the layout you want to use for your registration page' + , registerLocals: 'Configure extra locals to pass to your register/registration view' + , registerSuccessRedirect: 'The path we redirect to after a successful registration.' + }) + .loginFormFieldName('login') + .passwordFormFieldName('password') + .loginHumanName('login') + .loginKey('login') + + .get('getLoginPath', "the login page's uri path.") + .step('displayLogin') + .accepts('req res next') + .promises(null) + .displayLogin(renderLogin) + + .post('postLoginPath', "the uri path that the login POSTs to. Same as the 'action' field of the login
    .") + .step('extractLoginPassword') + .accepts('req res next') + .promises('login password') + .step('authenticate') + .accepts('login password') + .promises('userOrErrors') + .step('interpretUserOrErrors') + .description('Pipes the output of the step `authenticate` into either the `user` or `errors` param') + .accepts('userOrErrors') + .promises('user errors') + .step('getSession') + .description('Retrieves the session of the incoming request and returns in') + .accepts('req') + .promises('session') + .step('addToSession') + .description('Adds the user to the session') + .accepts('session user errors') + .promises(null) + .step('respondToLoginSucceed') // TODO Rename to maybeRespondToLoginSucceed ? + .description('Execute a HTTP response for a successful login') + .accepts('res user') + .promises(null) + .step('respondToLoginFail') + .description('Execute a HTTP response for a failed login') + .accepts('req res errors login') + .promises(null) + .extractLoginPassword( function (req, res) { + return [req.body[this.loginFormFieldName()], req.body[this.passwordFormFieldName()]]; + }) + .interpretUserOrErrors( function (userOrErrors) { + if (Array.isArray(userOrErrors)) { + return [null, userOrErrors]; // We have an array of errors + } else { + return [userOrErrors, []]; // We have a user + } + }) + .getSession( function (req) { + return req.session; + }) + .addToSession( function (sess, user, errors) { + var _auth = sess.auth || (sess.auth = {}); + if (user) + _auth.userId = user[this._userPkey]; + _auth.loggedIn = !!user; + }) + .respondToLoginSucceed( function (res, user) { + if (user) { + this.redirect(res, this.loginSuccessRedirect()); + } + }) + .respondToLoginFail( function (req, res, errors, login) { + if (!errors || !errors.length) return; + return renderLoginFail.apply(this, arguments); + }) + + .get('getRegisterPath', "the registration page's uri path.") + .step('displayRegister') + .accepts('req res next') + .promises(null) + .displayRegister( function (req, res) { + return renderRegister.apply(this, arguments); + }) + + .post('postRegisterPath', "the uri path that the registration POSTs to. Same as the 'action' field of the registration .") + .step('extractLoginPassword') // Re-used (/search for other occurence) + .step('extractExtraRegistrationParams') + .description('Extracts additonal query or body params from the ' + + 'incoming request and returns them in the `extraParams` object') + .accepts('req') + .promises('extraParams') + .step('aggregateParams') + .description('Combines login, password, and extraParams into a newUserAttributes Object containing everything in extraParams plus login and password key/value pairs') + .accepts('login password extraParams') + .promises('newUserAttributes') + .step('validateRegistrationBase') + .description("Basic validation done by `everyauth`. Don't edit this. Configure validateRegistration instead.") + .accepts('newUserAttributes') + .promises('baseErrors') + .step('validateRegistration') + .description('Validates the registration parameters. Default includes check for existing user') + .accepts('newUserAttributes baseErrors') + .promises('errors') + .step('maybeBreakToRegistrationFailSteps') + .accepts('req res errors newUserAttributes') + .promises(null) + .canBreakTo('registrationFailSteps') + .step('registerUser') + .description('Creates and returns a new user with newUserAttributes') + .accepts('newUserAttributes') + .promises('userOrErrors') + .step('extractUserOrHandleErrors') // User registration may throw an error if DB detects a non-unique value for login + .accepts('req res userOrErrors newUserAttributes') + .promises('user') + .canBreakTo('registrationFailSteps') + .step('getSession') + .step('addToSession') + .step('respondToRegistrationSucceed') + .accepts('res user') + .promises(null) + .extractExtraRegistrationParams( function (req) { + return {}; + }) + .aggregateParams( function (login, password, extraParams) { + var params = extraParams; + params[this.loginKey()] = login; + params.password = password; + return params; + }) + .validateRegistrationBase( function (newUserAttributes) { + var loginWith = this.loginWith() + , loginWithSpec, loginWithSanitize, loginWithValidate + , login = newUserAttributes[this.loginKey()] + , password = newUserAttributes.password + , errors = []; + if (!login) { + errors.push('Missing ' + this.loginHumanName()); + } else { + // loginWith specific validations + var validLoginTypes = this.validLoginTypes(); + loginWithSpec = this.validLoginTypes()[loginWith]; + + // Sanitize first + loginWithSanitize = loginWithSpec.sanitize; + if (loginWithSanitize) { + login = loginWithSanitize(login); + } + + // Validate second + var validateLoginWith = loginWithSpec.validate; + if (validateLoginWith) { + if (!validateLoginWith(login)) { + // Add error third + errors.push(loginWithSpec.error); + } + } + } + if (!password) errors.push('Missing password'); + return errors; + }) + .validateRegistration( function (newUserAttributes, baseErrors) { + return baseErrors; + }) + .maybeBreakToRegistrationFailSteps( function (req, res, errors, newUserAttributes) { + var user, loginField, loginKey; + if (errors && errors.length) { + user = newUserAttributes; + loginField = this.loginFormFieldName(); + loginKey = this.loginKey(); + if (loginField !== loginKey) { + user[loginField] = user[loginKey]; + delete user[this.loginKey()]; + } + delete user.password; + return this.breakTo('registrationFailSteps', req, res, errors, user); + } + }) + .extractUserOrHandleErrors( function (req, res, userOrErrors, newUserAttributes) { + var errors, user; + if (Array.isArray(userOrErrors)) { + errors = userOrErrors; + user = newUserAttributes; + delete user.password; + return this.breakTo('registrationFailSteps', req, res, errors, user); + } + user = userOrErrors; + return user; + }) + .respondToRegistrationSucceed( function (res, user) { + this.redirect(res, this.registerSuccessRedirect()); + }) + + .stepseq('registrationFailSteps') + .step('respondToRegistrationFail') + .accepts('req res errors newUserAttributes') + .promises(null) + .respondToRegistrationFail( function (req, res, errors, newUserAttributes) { + return renderRegisterFail.apply(this, arguments); + }); + +function validateEmail (value) { + // From Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ + var isValid = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); + + return isValid; +} + +password.validLoginTypes({ + login: {} + , email: { + validate: validateEmail + , error: 'Please correct your email.' + } + , phone: { + sanitize: function (value) { + // Pull out only +, digits and 'x' for extension + return value.replace(/[^\+\dx]/g, ''); + } + , validate: function (value) { + return value.length >= 7; + } + , error: 'Please correct your phone.' + } +}); + +password.loginWith = function (loginType) { + if (!arguments.length) return this._loginType; + + this._loginType = loginType; + var name + , validLoginTypes = Object.keys(this.validLoginTypes()); + if (-1 === validLoginTypes.indexOf(loginType)) { + throw new Error("loginWith only supports " + validLoginTypes.join(', ')); + } + this.loginFormFieldName(loginType); + this.loginKey(loginType); + this.loginHumanName(loginType); + return this; +}; +password.loginWith('login'); diff --git a/node_modules/everyauth/lib/modules/readability.js b/node_modules/everyauth/lib/modules/readability.js new file mode 100644 index 0000000..ebedd68 --- /dev/null +++ b/node_modules/everyauth/lib/modules/readability.js @@ -0,0 +1,28 @@ +var oauthModule = require('./oauth'); + + var readability = module.exports = + oauthModule.submodule('readability') + + .apiHost('https://www.readability.com/api/rest/v1') + .oauthHost('https://www.readability.com/api/rest/v1/oauth') + + .requestTokenPath('/request_token') + .authorizePath('/authorize') + .accessTokenPath('/access_token') + + .entryPath('/auth/readability') + .callbackPath('/auth/readability/callback') + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var p = this.Promise(); + this.oauth.get(this.apiHost() + '/users/_current', accessToken, accessTokenSecret, function (err, data) { + if (err) return p.fail(err.error_message); + var oauthUser = JSON.parse(data); + p.fulfill(oauthUser); + }) + return p; + }) + .convertErr( function (data) { + return new Error(data.error_message); + }); + diff --git a/node_modules/everyauth/lib/modules/skyrock.js b/node_modules/everyauth/lib/modules/skyrock.js new file mode 100644 index 0000000..a43feab --- /dev/null +++ b/node_modules/everyauth/lib/modules/skyrock.js @@ -0,0 +1,24 @@ +var oauthModule = require('./oauth') + , Parser = require('xml2js').Parser; + +var skyrock = module.exports = + oauthModule.submodule('skyrock') + .apiHost('https://api.skyrock.com/v2') + .oauthHost('https://api.skyrock.com/v2') + .requestTokenPath("/oauth/initiate") + .accessTokenPath("/oauth/token") + .authorizePath("/oauth/authorize") + .entryPath('/auth/skyrock') + .callbackPath('/auth/skyrock/callback') + .sendCallbackWithAuthorize(false) + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/user/get.json', accessToken, accessTokenSecret, function (err, data) { + data = JSON.parse(data); + promise.fulfill(data); + }); + return promise; + }) + .convertErr( function (data) { + return data.data; + }); diff --git a/node_modules/everyauth/lib/modules/soundcloud.js b/node_modules/everyauth/lib/modules/soundcloud.js new file mode 100644 index 0000000..fa3aab4 --- /dev/null +++ b/node_modules/everyauth/lib/modules/soundcloud.js @@ -0,0 +1,40 @@ +var oauthModule = require('./oauth2') + , request = require('request'); + +var soundcloud = module.exports = +oauthModule.submodule('soundcloud') + .configurable({ + scope: 'specify types of access: (no scope), non-expiring' + , display: 'specify type of auth dialog: (no display), popup' + }) + .apiHost('https://api.soundcloud.com/') + .oauthHost('https://api.soundcloud.com/') + .authPath('/connect') + .accessTokenPath('/oauth2/token') + .entryPath('/auth/soundcloud') + .callbackPath('/auth/soundcloud/callback') + .authQueryParam('response_type', 'code') + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + .authQueryParam('display', function () { + return this._display && this.display(); + }) + .accessTokenHttpMethod('post') + .postAccessTokenParamsVia('data') + .accessTokenParam('grant_type', 'authorization_code') + .fetchOAuthUser(function (accessToken) { + var promise = this.Promise(); + request.get({ + url: this.apiHost() + '/me.json' + , qs: {oauth_token: accessToken} + }, function (err, res, body) { + if (err) return promise.fail(err); + if (parseInt(res.statusCode / 100, 10) !== 2) { + return promise.fail(body); + } + return promise.fulfill(JSON.parse(body)); + }); + + return promise; + }); diff --git a/node_modules/everyauth/lib/modules/tripit.js b/node_modules/everyauth/lib/modules/tripit.js new file mode 100644 index 0000000..94a6a8e --- /dev/null +++ b/node_modules/everyauth/lib/modules/tripit.js @@ -0,0 +1,45 @@ +var oauthModule = require('./oauth') + , url = require('url'); + +var tripitModule = module.exports = +oauthModule.submodule('tripit') + .apiHost('https://api.tripit.com/') + .oauthHost('https://api.tripit.com/') + .entryPath('/auth/tripit') + .callbackPath('/auth/tripit/callback') + .redirectToProviderAuth( function (res, token) { + var redirectTo = 'https://www.tripit.com/' + this.authorizePath() + '?oauth_token=' + token; + if (this.sendCallbackWithAuthorize()) { + redirectTo += '&oauth_callback=' + this.myHostname() + this.callbackPath(); + } + this.redirect(res, redirectTo); + }) + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/v1/get/profile/id/' + params.user_id + '/format/json', + accessToken, accessTokenSecret, function (err, data) { + if (err) { + return promise.fail(err); + } + var oauthUser = JSON.parse(data).Profile; + promise.fulfill(oauthUser); + }); + return promise; + }) + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.denied; + }) + .handleAuthCallbackError( function (req, res) { + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: 'The user denied your request' + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + .convertErr( function (data) { + return new Error(data.data.match(/(.+)<\/error>/)[1]); + }); diff --git a/node_modules/everyauth/lib/modules/tumblr.js b/node_modules/everyauth/lib/modules/tumblr.js new file mode 100644 index 0000000..52fd7ea --- /dev/null +++ b/node_modules/everyauth/lib/modules/tumblr.js @@ -0,0 +1,26 @@ +var oauthModule = require('./oauth') + , Parser = require('xml2js').Parser; + +var twitter = module.exports = +oauthModule.submodule('tumblr') + .apiHost('http://www.tumblr.com/api') + .oauthHost('http://www.tumblr.com/') + .entryPath('/auth/tumblr') + .callbackPath('/auth/tumblr/callback') + .sendCallbackWithAuthorize(false) + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/authenticate', accessToken, accessTokenSecret, function (err, data) { + if (err) return promise.fail(err); + var parser = new Parser(); + parser.on('end', function (result) { + var oauthUser = result.tumblelog['@']; + promise.fulfill(oauthUser); + }); + parser.parseString(data); + }); + return promise; + }) + .convertErr( function (data) { + return data.data; + }); diff --git a/node_modules/everyauth/lib/modules/twitter.js b/node_modules/everyauth/lib/modules/twitter.js new file mode 100644 index 0000000..b07a248 --- /dev/null +++ b/node_modules/everyauth/lib/modules/twitter.js @@ -0,0 +1,56 @@ +var oauthModule = require('./oauth') + , url = require('url'); + +var twitter = module.exports = +oauthModule.submodule('twitter') + .apiHost('https://api.twitter.com/') + .oauthHost('https://api.twitter.com/') + .entryPath('/auth/twitter') + .callbackPath('/auth/twitter/callback') + .authorizePath('/oauth/authenticate') + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/1/users/show.json?user_id=' + params.user_id, accessToken, accessTokenSecret, function (err, data, res) { + if (err) { + err.extra = {data: data, res: res}; + return promise.fail(err); + } + var oauthUser = JSON.parse(data); + promise.fulfill(oauthUser); + }); + return promise; + }) + .authCallbackDidErr( function (req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.denied; + }) + .handleAuthCallbackError( function (req, res) { + if (res.render) { + res.render(__dirname + '/../views/auth-fail.jade', { + errorDescription: 'The user denied your request' + }); + } else { + // TODO Replace this with a nice fallback + throw new Error("You must configure handleAuthCallbackError if you are not using express"); + } + }) + .moduleErrback( function (err, seqValues) { + if (err instanceof Error) { + var next = seqValues.next; + return next(err); + } else if (err.extra) { + var twitterResponse = err.extra.res + , serverResponse = seqValues.res; + serverResponse.writeHead( + twitterResponse.statusCode + , twitterResponse.headers); + serverResponse.end(err.extra.data); + } else if (err.statusCode) { + var serverResponse = seqValues.res; + serverResponse.writeHead(err.statusCode); + serverResponse.end(err.data); + } else { + console.error(err); + throw new Error('Unsupported error type'); + } + }); diff --git a/node_modules/everyauth/lib/modules/vimeo.js b/node_modules/everyauth/lib/modules/vimeo.js new file mode 100644 index 0000000..b4ecefe --- /dev/null +++ b/node_modules/everyauth/lib/modules/vimeo.js @@ -0,0 +1,20 @@ +var oauthModule = require('./oauth'); + +var vimeo = module.exports = +oauthModule.submodule('vimeo') + + .apiHost('http://vimeo.com/api/rest/v2') + .oauthHost('http://vimeo.com/') + + .entryPath('/auth/vimeo') + .callbackPath('/auth/vimeo/callback') + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '?format=json&method=vimeo.people.getInfo&user_id=' + accessTokenSecret, accessToken, accessTokenSecret, function (err, data) { + if (err) return promise.fail(err); + var oauthUser = JSON.parse(data); + return promise.fulfill(oauthUser.person); + }); + return promise; + }); diff --git a/node_modules/everyauth/lib/modules/vkontakte.js b/node_modules/everyauth/lib/modules/vkontakte.js new file mode 100644 index 0000000..4b5bdb1 --- /dev/null +++ b/node_modules/everyauth/lib/modules/vkontakte.js @@ -0,0 +1,47 @@ +var oauthModule = require('./oauth2') + , url = require('url'); + +var vkontakte = module.exports = +oauthModule.submodule('vkontakte') + .configurable({ + display: 'set to "touch" if you want users to see a mobile optimized version of the auth page' + , scope: 'specify types of access: See http://vk.com/developers.php?oid=-1&p=Права_доступа_приложений' + , fields: 'specify fields of profile: See http://vk.com/developers.php?oid=-1&p=Описание_полей_параметра_fields' + }) + + .oauthHost('https://api.vk.com/') + .apiHost('https://api.vk.com/') + .entryPath('/auth/vkontakte') + .callbackPath('/auth/vkontakte/callback') + + .authQueryParam('response_type', 'code') + + .authQueryParam('display', function () { + return this._display && this.display(); + }) + .authQueryParam('scope', function () { + return this._scope && this.scope(); + }) + + .fetchOAuthUser( function (accessToken, http) { + var promise = this.Promise(); + var params = this._fields && this.fields(); + var fields = (params) ? '&fields=' + params : ''; + this.oauth.get(this.apiHost() + '/method/getProfiles?uids=' + http.extra.user_id + fields, accessToken, function (err, data) { + if (err) return promise.fail(err.error_message); + var data = JSON.parse(data) + if (data.error) return promise.fail(data.error.error_msg); + var oauthUser = data.response[0]; + promise.fulfill(oauthUser); + }) + return promise; + }) + + .authCallbackDidErr(function(req) { + var parsedUrl = url.parse(req.url, true); + return parsedUrl.query && !!parsedUrl.query.error; + }) + + .convertErr( function (data) { + return new Error(JSON.parse(data).error.error_msg); + }); \ No newline at end of file diff --git a/node_modules/everyauth/lib/modules/yahoo.js b/node_modules/everyauth/lib/modules/yahoo.js new file mode 100644 index 0000000..649f6b4 --- /dev/null +++ b/node_modules/everyauth/lib/modules/yahoo.js @@ -0,0 +1,32 @@ +var oauthModule = require('./oauth') + , OAuth = require('oauth').OAuth; + +var yahoo = module.exports = +oauthModule.submodule('yahoo') + .definit( function () { + var oauth = this.oauth = new OAuth( + this.oauthHost() + this.requestTokenPath() + , this.oauthHost() + this.accessTokenPath() + , this.consumerKey() + , this.consumerSecret() + , '1.0', null, 'HMAC-SHA1'); + }) + .apiHost('http://social.yahooapis.com/v1') + .oauthHost('https://api.login.yahoo.com/oauth/v2') + + .requestTokenPath('/get_request_token') + .accessTokenPath('/get_token') + .authorizePath('/request_auth') + + .entryPath('/auth/yahoo') + .callbackPath('/auth/yahoo/callback') + + .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { + var promise = this.Promise(); + this.oauth.get(this.apiHost() + '/user/' + params.xoauth_yahoo_guid + '/profile?format=json', accessToken, accessTokenSecret, function (err, data) { + if (err) return promise.fail(err); + var oauthUser = JSON.parse(data).profile; + promise.fulfill(oauthUser); + }); + return promise; + }); diff --git a/node_modules/everyauth/lib/promise.js b/node_modules/everyauth/lib/promise.js new file mode 100644 index 0000000..77dd198 --- /dev/null +++ b/node_modules/everyauth/lib/promise.js @@ -0,0 +1,93 @@ +var Promise = function (values) { + this._callbacks = []; + this._errbacks = []; + this._timebacks = []; + if (arguments.length > 0) { + this.fulfill.apply(this, values); + } +}; + +Promise.prototype = { + callback: function (fn, scope) { + if (this.values) { + fn.apply(scope, this.values); + return this; + } + this._callbacks.push([fn, scope]); + return this; + } + , errback: function (fn, scope) { + if (this.err) { + fn.call(scope, this.err); + return this; + } + this._errbacks.push([fn, scope]); + return this; + } + , timeback: function (fn, scope) { + if (this.timedOut) { + fn.call(scope); + return this; + } + this._timebacks.push([fn, scope]); + return this; + } + , fulfill: function () { + if (this.isFulfilled || this.err || this.timedOut) return; + this.isFulfilled = true; + if (this._timeout) clearTimeout(this._timeout); + var callbacks = this._callbacks; + this.values = arguments; + for (var i = 0, l = callbacks.length; i < l; i++) { + callbacks[i][0].apply(callbacks[i][1], arguments); + } + return this; + } + , fail: function (err) { + if (this._timeout) clearTimeout(this._timeout); + var errbacks = this._errbacks; + if ('string' === typeof err) + err = new Error(err); + this.err = err; + for (var i = 0, l = errbacks.length; i < l; i++) { + errbacks[i][0].call(errbacks[i][1], err); + } + return this; + } + , timeout: function (ms) { + if (this.values || this.err) return this; + var timebacks = this._timebacks + , self = this; + if (ms === -1) return this; + this._timeout = setTimeout(function () { + self.timedOut = true; + for (var i = 0, l = timebacks.length; i < l; i++) { + timebacks[i][0].call(timebacks[i][1]); + } + }, ms); + return this; + } +}; + +var ModulePromise = module.exports = function (_module, values) { + if (values) + Promise.call(this, values); + else + Promise.call(this); + this.module = _module; +}; + +ModulePromise.prototype.__proto__ = Promise.prototype; + +ModulePromise.prototype.breakTo = function (seqName) { + if (this._timeout) clearTimeout(this._timeout); + + var args = Array.prototype.slice.call(arguments, 1); + var _module = this.module + , seq = _module._stepSequences[seqName]; + if (_module.everyauth.debug) + console.log('breaking out to ' + seq.name); + seq = seq.materialize(); + seq.start.apply(seq, args); + // TODO Garbage collect the abandoned sequence +}; diff --git a/node_modules/everyauth/lib/routeTriggeredSequence.js b/node_modules/everyauth/lib/routeTriggeredSequence.js new file mode 100644 index 0000000..5d29866 --- /dev/null +++ b/node_modules/everyauth/lib/routeTriggeredSequence.js @@ -0,0 +1,14 @@ +var StepSequence = require('./stepSequence'); + +var RouteTriggeredSequence = module.exports = function RouteTriggeredSequence (name, _module) { + StepSequence.call(this, name, _module); +} + +RouteTriggeredSequence.prototype.__proto__ = StepSequence.prototype; + +RouteTriggeredSequence.prototype.routeHandler = function () { + // Create a shallow clone, so that seq.values are different per HTTP request + var seq = this.materialize(); + // Kicks off a sequence of steps based on a route + seq.start.apply(seq, arguments); // BOOM! +}; diff --git a/node_modules/everyauth/lib/step.js b/node_modules/everyauth/lib/step.js new file mode 100644 index 0000000..c1503e5 --- /dev/null +++ b/node_modules/everyauth/lib/step.js @@ -0,0 +1,171 @@ +var Promise = require('./promise') + , clone = require('./utils').clone; + +var Step = module.exports = function Step (name, _module) { + this.name = name; + + // defineProperty; otherwise, + // clone will overflow when we clone a module + Object.defineProperty(this, 'module', { value: _module }); +}; + +Step.prototype = { + /** + * @returns {Promise} + */ + exec: function (seq) { + var accepts = this.accepts + , promises = this.promises + , block = this.block + , _module = this.module + , stepName = this.name + , self = this + , errorCallback = function (error) { + // Ensure that seq.values are always passed back to moduleErrback + if (self.errback) { + self.errback(error, seq.values); + } else if (_module._moduleErrback) { + _module._moduleErrback(error, seq.values); + } else { + throw new Error('Missing module or step errback'); + } + }; + + + if (this.debug) { + console.log('starting step - ' + this.name); + } + + var args = this._unwrapArgs(seq); + + // There is a hidden last argument to every step function that + // is all the data promised by prior steps up to the step's point + // in time. We cannot anticipate everything a developer may want via + // `accepts(...)`. Therefore, just in case, we give the developer + // access to all data promised by prior steps via the last argument -- `seq.values` + args.push(seq.values); + + var ret; + try { + // Apply the step logic + + // Add _super access + _module._super = function () { + var step = this.__proto__._steps[stepName]; + if (!step) return; + var superArgs = arguments.length ? arguments : args; + step.block.apply(this, superArgs); + }; + ret = block.apply(_module, args); + delete _module._super; + } catch (breakTo) { + // Catch any sync breakTo's if any + if (breakTo.isSeq) { + if (this.module.everyauth.debug) + console.log("breaking out to " + breakTo.name); + breakTo.start.apply(breakTo, breakTo.initialArgs); + // TODO Garbage collect the promise chain + return; + } else { + // Else, we have a regular exception + errorCallback(breakTo); + } + } + + if (promises && promises.length && + 'undefined' === typeof ret) { + errorCallback( + new Error('Step ' + this.name + ' of `' + _module.name + + '` is promising: ' + promises.join(', ') + + ' ; however, the step returns nothing. ' + + 'Fix the step by returning the expected values OR ' + + 'by returning a Promise that promises said values.') + ); + } + // Convert return value into a Promise + // if it's not yet a Promise + ret = (ret instanceof Promise) + ? ret + : Array.isArray(ret) + ? promises.length === 1 + ? this.module.Promise([ret]) + : this.module.Promise(ret) + : this.module.Promise([ret]); + + if (seq.debug) { + ret.callback( function () { + console.log('...finished step'); + }); + } + + var convertErr = _module._convertErr; + if (convertErr) { + var oldErrback = ret.errback; + ret.errback = function (fn, scope) { + var oldFn = fn; + fn = function (err) { + if (err.constructor === Object) { + err = convertErr(err); + } else if ('string' === typeof err) { + err = new Error(err); + } + return oldFn.call(this, err); + }; + return oldErrback.call(this, fn, scope); + }; + } + + ret.errback(errorCallback); + + ret.callback( function () { + // Store the returned values + // in the sequence's state via seq.values + var returned = arguments + , vals = seq.values; + if (promises !== null) promises.forEach( function (valName, i) { + vals[valName] = returned[i]; + }); + }); + + ret.timeback( function () { + ret.fail(new Error('Step ' + stepName + ' of `' + _module.name + '` module timed out.')); + }); + + var timeoutMs = this.timeout || _module.moduleTimeout(); + ret.timeout(timeoutMs); + + return ret; + } + + /** + * Unwraps values (from the sequence) based on + * the step's this.accepts spec. + */ + , _unwrapArgs: function (seq) { + return this.accepts.reduce( function (args, accept) { + args.push(seq.values[accept]); + return args; + }, []); + } + , clone: function (name, _module) { + var step = new Step(name, _module); + step.accepts = clone(this.accepts); + step.promises = clone(this.promises); + step.description = this.description; + step.timeout = this.timeout; + step.errback = this.errback; + return step; + } +}; + +Object.defineProperty(Step.prototype, 'block', { + get: function () { + return this._block || (this._block = this.module[this.name]()); + } +}); + +Object.defineProperty(Step.prototype, 'debug', { + get: function () { + return this.module.everyauth.debug; + } +}); diff --git a/node_modules/everyauth/lib/stepSequence.js b/node_modules/everyauth/lib/stepSequence.js new file mode 100644 index 0000000..8ed967b --- /dev/null +++ b/node_modules/everyauth/lib/stepSequence.js @@ -0,0 +1,198 @@ +var Promise = require('./promise') + , clone = require('./utils').clone; + +var StepSequence = module.exports = function StepSequence (name, module) { + this.name = name; + this.module = module; + this.orderedStepNames = []; +} + +StepSequence.prototype = { + constructor: StepSequence + + , isSeq: true + /** + * Sets up the immediate or eventual output of priorPromise to pipe to the + * nextStep's promise + * @param {Promise} priorPromise + * @param {Step} nextStep + * @returns {Promise} + */ + , _bind: function (priorPromise, nextStep) { + var nextPromise = new Promise() + , seq = this; + + priorPromise.callback( function () { + var resultPromise = nextStep.exec(seq); + if (!resultPromise) return; // if we have a breakTo + resultPromise.callback( function () { + nextPromise.fulfill(); + }); // TODO breakback? + }); + return nextPromise; + } + + /** + * This kicks off a sequence of steps. + * Creates a new chain of promises and exposes the leading promise + * to the incoming (req, res) pair from the route handler + */ + , start: function () { + var steps = this.steps; + + this._transposeArgs(arguments); + + // Pipe through the steps + var priorStepPromise = steps[0].exec(this); + + // If we have a breakTo + if (!priorStepPromise) return; + + for (var i = 1, l = steps.length; i < l; i++) { + priorStepPromise = this._bind(priorStepPromise, steps[i]); + } + return priorStepPromise; + } + + // Used for exposing the leading promise of a step promise chain to the + // incoming args (e.g., [req, res] pair from the route handler) + , _transposeArgs: function (args) { + var seq = this; + this.steps[0].accepts.forEach( function (paramName, i) { + // Map the incoming arguments to the named parameters + // that the first step is expected to accept. + seq.values[paramName] = args[i]; + }); + } + , clone: function (submodule) { + var sequence = new (this.constructor)(this.name, submodule); + sequence.orderedStepNames = clone(this.orderedStepNames); + return sequence; + } + + , _propertiesToMaterialize: ['isSeq', '_bind', 'start', '_transposeArgs'] + , materialize: function () { + var sequence = Object.create(this) + , materializedMethods = this._propertiesToMaterialize; + sequence.values = {}; + for (var i = materializedMethods.length; i--;) { + var methodName = materializedMethods[i]; + sequence[methodName] = this[methodName]; + } + return sequence; + } + + // TODO Replace logic here with newer introspection code + , validateSteps: function () { + var steps = this.steps + , step + , paramsToDate = [] + , missingParams; + for (var i = 0, l = steps.length; i < l; i++) { + step = steps[i]; + if ('undefined' === typeof step.accepts) + throw new Error('You did not declare accepts for the step: ' + step.name); + if ('undefined' === typeof step.promises) + throw new Error('You did not declare promises for the step: ' + step.name); + + if (i === 0) + paramsToDate = paramsToDate.concat(step.accepts); + + missingParams = step.accepts.filter( function (param) { + return paramsToDate.indexOf(param) === -1; + }); + + if (i > 0 && missingParams.length) + throw new Error('At step, ' + step.name + ', you are trying to access the parameters: ' + + missingParams.join(', ') + ' . However, only the following parameters have been ' + + 'promised from prior steps thus far: ' + paramsToDate.join(', ')); + + paramsToDate = paramsToDate.concat(step.promises); + + if ('undefined' === typeof this.module[step.name]()) + // TODO Remove this Error, since invoking the arg to typeof (see line above) + // already throws an Error + throw new Error('No one defined the function for the following step: ' + step.name + ' in the module ' + this.module.name); + } + } +}; + +Object.defineProperty(StepSequence.prototype, 'steps', { + get: function () { + // Compile the steps by pulling the step names from the module + var allSteps = this.module._steps + , orderedSteps = this.orderedStepNames.map( function (stepName) { + return allSteps[stepName]; + }) + , seq = this; + + function compileSteps () { + var paramsToDate = [] + , missingParams; + + var steps = orderedSteps.map( function (step, i) { + var meta = { missing: [], step: step, missingParams: [], paramsToDate: {} }; + if (! ('promises' in step)) { + meta.missing.push('promises'); + } + if (! ('accepts' in step)) { + meta.missing.push('accepts'); + } + + if (('accepts' in step) && i === 0) + paramsToDate = paramsToDate.concat(step.accepts); + + missingParams = !step.accepts ? [] : step.accepts.filter( function (param) { + return paramsToDate.indexOf(param) === -1; + }); + + if (step.promises) + paramsToDate = paramsToDate.concat(step.promises); + + if (missingParams.length) { + meta.missingParams = missingParams; + meta.paramsToDate = paramsToDate; + } + + if (! (('_' + step.name) in seq.module)) + meta.missing.push('its function'); + + return meta; + }); + + return steps; + } + + var compiledSteps; + + Object.defineProperty(orderedSteps, 'incomplete', { get: function () { + compiledSteps || (compiledSteps = compileSteps()); + return compiledSteps.filter( function (stepMeta) { + return stepMeta.missing.length > 0; + }).map( function (stepMeta) { + var error = 'is missing: ' + stepMeta.missing.join(', '); + return { name: stepMeta.step.name, error: error }; + }); + } }); + + Object.defineProperty(orderedSteps, 'invalid', { get: function () { + compiledSteps || (compiledSteps = compileSteps()); + return compiledSteps.filter( function (stepMeta) { + return stepMeta.missingParams.length > 0; + }).map( function (stepMeta) { + var error = 'is trying to accept the parameters: ' + + stepMeta.missingParams.join(', ') + + ' . However, only the following parameters have ' + + 'been promised from prior steps thus far: ' + + stepMeta.paramsToDate.join(', '); + return { name: stepMeta.step.name, error: error }; + }); + } }); + + return orderedSteps; + } +}); + +Object.defineProperty(StepSequence.prototype, 'debug', { + get: function () { return this.module.everyauth.debug; } +}); diff --git a/node_modules/everyauth/lib/utils.js b/node_modules/everyauth/lib/utils.js new file mode 100644 index 0000000..9a9718c --- /dev/null +++ b/node_modules/everyauth/lib/utils.js @@ -0,0 +1,35 @@ +var tls = require('tls'); + +var clone = exports.clone = function clone (obj) { + if (obj === undefined || obj === null) + return obj + if (Array.isArray(obj)) + return cloneArray(obj); + if (obj.constructor == Object) + return cloneObject(obj); + return obj; +}; + +function cloneObject (obj, shouldMinimizeData) { + var ret = {}; + for (var k in obj) + ret[k] = clone(obj[k]); + return ret; +}; + +function cloneArray (arr) { + var ret = []; + for (var i = 0, l = arr.length; i < l; i++) + ret.push(clone(arr[i])); + return ret; +}; + +exports.extractHostname = function (req) { + var headers = req.headers + , protocol = (req.connection.server instanceof tls.Server || + (req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'].slice(0,5) === 'https')) + ? 'https://' + : 'http://' + , host = headers.host; + return protocol + host; +}; diff --git a/node_modules/everyauth/lib/views/auth-fail.jade b/node_modules/everyauth/lib/views/auth-fail.jade new file mode 100644 index 0000000..0bb3fe5 --- /dev/null +++ b/node_modules/everyauth/lib/views/auth-fail.jade @@ -0,0 +1 @@ +p Your authentication failed because: #{errorDescription} diff --git a/node_modules/everyauth/media/37signals.ico b/node_modules/everyauth/media/37signals.ico new file mode 100644 index 0000000000000000000000000000000000000000..5b7c3504fc8ce04e7a7e57fee99253e7e69f3a5f GIT binary patch literal 2862 zcmeHJu}T9$5S_#*DN_hG7C8_J2r39-cOcjZ{(`lAK47o7Pe^GaHiC^H0TIL?BG_CI z>;w@65kv@r*n}J3V|U3J3Ca;jkqo@unc11UnYZCGA_bX}N~MCmB(;Lbx(IB6U6#FR zkzM$#U6s9($jyvMjWIwKU|zrQ%u7TCOXQTu84(<Q^*#KfUpRTJ}*r}FPUz%8X%ELvrcH3-Z0P{{!b6wDF#q%h)3qL{8}=Urpy5v~A;n&&YDM q37gL#`niH@IKuBtH|))GcBV^B9Q5Y77&9H`xj5|2bDZfo&wT?UIn&$# literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/500px.ico b/node_modules/everyauth/media/500px.ico new file mode 100644 index 0000000000000000000000000000000000000000..08fc8bb67bf70c69ee36a1041528b831ba81a00f GIT binary patch literal 427 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMfq5z)|S0MfW|9>C}VF1~EeSHuS zOcJ7ogM;Jg)29$wW@cs<78bB>hWGE^0|kNPvSrI2J$eKb6cG^tigFeto7#J8D8k(A#dU|^L`}?P-r?gO^uAT0_gx)yvyIFu!WXylva}?K^V(?72%F^gGDD58j>B1yo6Ig2@C&bnq@Ma((p z#M$I#*^Ila^Q!vJz%YRF-q}BIk9AH@byru_?YZ|()mJrufFa74hoo>LpefB99F+BT z6JQ<5e0`O*t2Gc{4!F{iO&n+lkP?xvkgU*$TCK+P>C@rw?~lyPOgK6^A}lNnn>TO9 z=bwL$?%liN-o1O6Fku4H($aA7;6eQS^UrA7v?;D#yM~~kAoT0k4^N*y#mSQ=F>2H( ztXZ=LbLY;*?%lib_19k`K0Y2VU%o`APMvV;)-4PiI1ppTjKPKt8?bQULIeZ^;L)Q; zIDPswMvNGNW5ICbh2jvqgcsHiB6A3q*3F)`S(WeYZL+=yATW?{~pIasx76;`ZRfu&2A7P@~Q z1t0Igzv~WEa%imch1}}~nOWCwmnW%RuCjAY;m=`+$)-VolSMrtnk!2*s$Ry*w~i1^ zG(KvyswS#h8hSVM&?r=`>1<&gP|?*`vsP6wYH!}s#!j;&R?Ps8UY>dD7H!>3JCriW zTQ{k0kJ43I<*i$rxFFE4maSG`)y4-Xt33||LV1#A+HGA|c}OP4O#w{IU7Em|aFrHP3NDp#&7eX!PEL-DwU;kn#`f*o5gr~c<0r>Mj?o-rOO+~xUw{1-<;s=A7himVN|h?%*|TRd zzPr1-!^6Wv##V1{Z}jNV1O5B=M`~)SjEjkhiTM8e@8Rt1EaN`M%|nL{$rzuWo{qI^ z*J9|${WnUNE{)%R{~cw@l!3XqIlle&TUc9LKYuQBoV~q09zT98^Cah&nl)?6{KC1VcJ11z zQ>PB<)~$=HSFhsAl`Cl2upus7xPZou8>4yi<}$~%Y}pb%K0Y{d#=U#I+<5F*K+>k+&5&%5SgnvhjQNJT*Y~e^ZB@O z<7CdBIB_Bp5)z7dBR`7%Kkq=CM|ANAx0_retVZ}~v#CX@Bvo=+Y913A>K`a3r#f<9gBnoQ_D#W7OvUu0N z2#)W|`(i-BZS)`4Ezy^xL$OZo4+&dUK%+s|s2~vxJW7ZKlT%j%?kS>Yje`5Y=!Qa2 zDvWfqsn^R&EHu^I_rO>ox{sdaERQF87rH}XOI=oDp0Yd49*gwsG0SqO3TsP`E!Q*D zFY2eYS(Rsnj?m$hp7#EHc%0drIp-nuYCMoLNw z)s()-$jFd5h4BgJ9L6iUIE8C3uCF-%a6QL4ka5Z%fBYe_%Inv!!FYsm3fFXP+qRY1 zq*t$AvYuj$!gU_!Q_h`nad8r({Povg5~KX`%P$h6a2?9n;QsylvVPOz6waHBLppTm zAh8J7s$6q&j^z54>rk#oxo+dyj%(6s)22xrV{2-%8x_ z(@#H1>{6jZg*^Q7<(FTgdiClO6F50J$y$@^%zE|e;pWYoVC=#efbk3Gd#4m!`}XZ+J>9Wm$Gp7H`JQWB&i|bAx%M13Y#5d;TL#88ix)4(=+UDwfBt+~>oUG! zj5cM;6eJ}j6GaUkO!uI0_l%p?|K{KI&NG0+b` z{D6uTD}r&*H{X0Cu_fc7ufF;UjE5MzF@|Iu$M}tL5!d+KKVVG9IFYd>*WrwjxV~px z$M}vh6897sC)KZCU*cWHNnGDEPGa2Dq)8K8x^xMio}LmvF?M1c$aVYKvuD9rka0BQ zDDFFO|AOoIz`#I>joYtOYF-yk+C%QANK6o1IE_e57@C|hs3$twrxYto;_vV z&v=^gY~Q|pCH`Uz%=nA(C1YIf9Wc)1-URm>h7TVu`y!0LxbMJtoiW(FdGj!K>{yA( z7>jW)fqN)3X3UWIjC&$er%sjFjO&6)lO`cKIhlT;AL-wB2SQ(7Io5BWkHM+5|KYn0 z4~fmQieB@qQ{JLPljbv7&2mxtu2!pDcsl;va%Lr?p7x|S|L(!LgbRcS=xV-;)|S;v zW(?R8R9$j8PC-1%=ca*Ve7Ix|MvA78!<;VR9gDYV5_N6+l#xM)|_K zz)2xa5f~%7C`2e67i;ZBa3WNk*55<1Fl{FY&P3Nr1ZKtw2Q14o7vdUl;628`Q{a&} z1q^T%CL0l3L0p2Nj=i9JX!Sk^ZZJ(~5r}GRtka6vo*wU&g4 z^8&p`DkRD3MC+s_oZn;L7048Z(~?>HnO5(-)|UALpeO{W(cKAb758meaf1r@bmz?& zz+S$8EFfTOeGynkN!%!#7S(vXqL;7LqiR9#K(dIx<6;PL}pF5)0g{q#%+G zSN>(uQP-c^so)^Zg%5Ad?0eU|%KjajH(6C;sW1HX4fNIzpz0*;yVHhYf8|Ch4(anS zjP&&Nm&S-mW%UWGfQURh%_KDugY*sb){g*B)~-sGoxXXpJ5XOwztEEIzro~AM@W97 zpnd9XIy-sz0PUyWy(#_tfJ^!I6Fb|QrI5&w{tqaWbp69)KYq{GI?y@X& zwhsG%sb)LstZ!O9IhW_)nHPB&s@X0PbA%D6aEc&E9Npip^=6<^i3}B`WA*7e9;jUh{~cCy9!p}lM>rMMYJ8; zZ$~018f{kQ@g=rj4{J8@R>6!@&Rt$KE%_5z9*q%fLN7C=vt{VO!6V2Y{YrR%C-9f| zyc%aBrEuJ42%z#-ls#cO zi3IdG^Z%qN-c4OfGNkRa0F|{$j+EJnx_kh@DC$}8nn22Xf&E(h!3vJMUqpXMtCG*_ z;Rs*sQ&3k+LzMV?kmxv6i?yQS`6@gk-Jn?Ar+o!`NVb*!yf5BPyHgA1q#Fr};Q5q< zWTQ8i^H3yo=WdWZB74lbWcuEkcAdQ*g zzc#d>sJPXIX)$|>+xsa0C+|Rh$MA!*4C-PMaR-wrhr5(SS%44o48qFHQ>cDpPN$@n zCpSB(?Wu4!%%wGV9JQR>NJsiSo8>;#`z(e_ecG4YUgJ-P^Y!I{GBiAeIO+5GisTt2 zPo{n5#MD{TIAu;3;P1hP3fHcc@5Nt`zaMc2Etht=1fp4 literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/box.ico b/node_modules/everyauth/media/box.ico new file mode 100644 index 0000000000000000000000000000000000000000..6fb09652d2924f60df84ebe08819855f12557889 GIT binary patch literal 1150 zcmbu9-A__s9LG;vca=F^A{atCvw7cErdwTf*;d!Bi|+gj(pj43n#-&$H*az_@;xm@ zNd=|QQZzv^8X@?Cf=HksATP<=x8FGg&CBXJ`<&nNe80c%bIzWf9fmnZS7s(dcQI3O zoMCbphPgnHL`qVp!j0?`48xKd@9v$%|1eyYfyI{me`2We6lC{LW40;x2#$pcgzT>n z*^?t|m%uuG`-q?FAF0m3Xl*8Dp71!-%>sm-ZxC_KBI?#6y051_77*E;Luf~m?o0K* zugQd>E(^1iXYsB!BI;5j;-19!{&G%RAG?8wM@9M^=cjtvI{q*V%7$#rH}N=P-Y%K&Hbf5=U})pR*df45rvRFldEB|`U*v!#JrV)< zH=e>ibrXI|D-wwV&hl@y!`vf)xmy4e<+W`>Xj<}MYU9D&o=ZJ3BA(vn&m@kB_aiI= zd9d^gu+b;LI_;yQ{D!;;KU6|ElxL|u0wjX)EZ)JPTaH+G8HXMPJi5EENd>SD@nIe0 zW9uz3kPE#;1dF^FyPpf;R25J@%HueAtKcu`MNrh(RF?uM4m? zR1DAjHMrGRDNpa82xE7;9J^CxNmONUeYgUbvJ|e#QaC3r!>M4o1Y=hrR{Kie`_=%z zp^>sNI;${z`bY47t%Fxz5ASj#ccNJ%bOV(U>LZ)54BBcPW#UJ-uK>p-@V^* z@9+0}z#=ThiWT5~84fQ2ehWN%UxmXz07BXJJJH5%6*qC5cx_%Z-#xv3=UMIqDF40; zaz`NX!hZ;*QQmqM-GwY;zptHlVjU4)8&wa}|i@OK{=ni4UkZGmN63(IgD zrh3a^s6NkeeW0(4h9>NNoVQtoBJVdaeeW7(Mmu31>415(8|MBhn6-_V8P{Q&{fhkF zLBIwe{U5(TUy38ft~p@5B?acO9+-tkm>Is0@y0}qxnbbn%;@OWVzR3d7X!Lrit#U?jy3TG={iQ+B~nCxgB@1x3NzAhmuGQX3${{S`dA z!r$`UF|4%4lMH7JrrJW6 z=?Z;=5~l7l2saO5IF;v=ug7qfD{7)XK-|HVNN|1${VF$1HOevBU5bg$VhGtEL0{wv zBcElb%7e%K1UKa0AT#m{sA5h*73+@zpLNJN{RRp$5};NkBInd=DD?h4iVIXo{&GF; z#_j@jrDCqX0P3@wk#{u~YOmKp4MCs|C0dgYA^GGVQJj~F%#eMk^k0VwwHv5O0=?!e zOf5>#U)Ep3TtOLxN+ zFI&iueSoG2E0C!RWSM|@pc>}E256*PF_vzR$*w}o82Vs&(#o~{5w2f2f%LDpp(nux z2F|@U>JJ!7`U`|Rv9L^=AY66Cpgr0ebSD7Qh3*)N+W>90 z8w~Ba7*%e?zzIMX^EL((-^X-=4D{p{+OvJ|ZK4#JU#^BW)gJn!Eif=vh6+w2^Q*U! z9Up?q>KYIcvcGth&zp1GTM1*42eQ1@LKX2D3WIETPeYvZa_F;NKy^O25$%Bo`4W^C z*0l;_pPrPOhNlG3trwOUg#HWpgKuQzjYXR{NI3Z4;}-gf@1k$iPC#mfBb-N4d#@qMyKssA+y9Oce*lQv2j*3* zmOCt~2H2aLg7i8DE1)g zN+Ygg3ivaY&#!^~F0nR+yocS_kN;|vF+q$8(q*_16{RagZ2`#8{*;r4=z2iLpqGMVhXUBE}*y z7Af9&MMd1+7qc1nM9slu;I(RHZxUml82iN7C)Oci{1fA!82`lhClZ>7Ie_B!|1>AY z0g%|>xF%@5-jLJ67dGaKo+>e-xiMg2P zn!T zYXGqZkWhMtSOds(FO4c?``Q1cXt8Gb{8q~ymz1{3?T9*4hz8We+CxDbVI5?Rt*k%9 z`op!QB-S62J1x~ntguG(oyQDgOFTo#b~v-X5$hX;ZpWtQH6FSH8(8Ovb&e$4;3{Km zF2tkwF5;AbF%Dg{#qn6K%Xqelbt+;b!Vbs6|B53EvHYB8rhfgDXGE^~e>}s#Lg>5o HlxO}4LlDl{ literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/dwolla.ico b/node_modules/everyauth/media/dwolla.ico new file mode 100644 index 0000000000000000000000000000000000000000..dbda31c4638858a87a9189e230e340293d0a3a64 GIT binary patch literal 556 zcmZ?wbhEHb6krfwcoxg>zlq_0GsFKzhW{-L|G$6y`}gnvUg1A~|9=1R^ZU*w; z&ous2&-%8Q;otV07Z-Q^?d1F4%JTogp%<5TKVOpezfb&pHqYi*k$;n9{=T{Q@7MQ# z|Ni~&VEF&%*Z*an|6g6dUdZ!*U(J_02d|_v{hy}#d|BM7Wagho`o6us|McF~qiOtS z@}-_#J@USk;s5T^|DC-58yNo2H2Ob9_4UEY|G$6u|K-*HpI_cQx$}LY+r}u-XUkK+ zeEs&Xo&En5#b5UheSGoY|8(sOIlMo-@*BRrosQSbN+Yod|TlBzlZ<-n>+s=9(lU616%Ziz9KZ|!Vh39_*7YBf=`4TzAQ&@3yb z&n##>qgg1}Gm0^UeL*;5RCF|h(gG<7=Cx5a8Vl?UwlWGhEl_8O4mA?>WnIAM63A^B zF9LCR*ecKn4CHpepP?!i5hs+tHLZMdVtH|p+?0vBRY>%w#X)G4@2DFx5m)Rl)_rLHBdj+wZsl zkLU5<|Ae-)gB&<|nEIAR#uvV1;gK=tF( z=yDAtY>y`^D+`y)h1=~8YW%)~!3^qos2NJ+BD}YUC|n#wGio99z05$x%n9DsZY6%( zb_@msHk*yo(o(!$FU?KOL7jRos;7d20_v21QMfQb^l3%kZwNSU`H9d(vgyrOc4!lk zBni9SPFY!5P*YR0l)a>=n0%)L?-xVJ^T&xE&Sq^-YQTB71Kq{4Ad*`1(d+fW9;y#D zi@K-Ewmd85yj*H#2HEpf7mT;24H3fTY)^04DJ>IY zS_WzQWHO2^l+PVUnrvZRUpgU&c0AWzD#v!uAMBy}h<+=EO;Isy-MAUO%}7>91*YzO zm_}-`OtfR4_LF?AhOq8kM0TYAxp6p`U6(7d+-bw|xpL-Y8K~be%#*-Q##+z zUd6L%q7mtOJzLJ$iRv``n>gg!vHoz{->J-k`3*oN#AKqwW!vFvP literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/facebook.ico b/node_modules/everyauth/media/facebook.ico new file mode 100644 index 0000000000000000000000000000000000000000..ea0c6a3730e1da3856adc228753f0fffcd879805 GIT binary patch literal 318 zcmZQzU<5(|0RbS%!l1#(z#zuJz@P!d0zj+)#2|4HXaHg%ZU_d+f$)q-YleAAt_-Uy z5*XH0CNgYk$z}NR?lr^z|Nnuqgh4qJ6hoAn7rMB(xTUy=!{`E_I9mb(I~JNXEHwZm j&X$&zfK8r(6)MgY29XCE#SXIvW-rK@4M0DWgF$)$&Z{v} literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/foursquare.ico b/node_modules/everyauth/media/foursquare.ico new file mode 100644 index 0000000000000000000000000000000000000000..c7e0739cd3526cb27d044f81296bb871b317606f GIT binary patch literal 1150 zcmb7^?N5_e7>A!F`vd$mDO4zmiXyNIb5=8r$P5~@Zp_6HHAdNVx&@>7mKcL$7(a+o zwF+&eg%J_(B?MCw1f7<)&{mvv0&xpzK=oBP!??$yw+TTMf5BzMgzw3eshHP6R= zM)Hz=z2j9hpNr$3RZFYwOJQel`_KYj_IVlXy1}gjvuVtYqRpzqU$GdkB_UkjTizvl zK1(9rb6R1g?xRcjcd(COFhF2zl-G|tapa{)K5EfeLRjDR|5YLyp2o&aXI3 z#fmB}q}6arTf%lt4qMb)xxQ1)ja?DcOZ3(o2#sK1lfSX<8l^R@P9N zehFi$nHRbRhB-?olZ4T5MM}k^iFMMVkB0nX)6!A-mGnDj*nLManE9}Z~ z|CkeS9!qBUY42-)^*47yUYzi+^>f*yqqAyxc>n!N>2y`6g>^%|@rn1`Mh%XW5rH0i Me#wXT!BqeM2lIEN6951J literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/github.ico b/node_modules/everyauth/media/github.ico new file mode 100644 index 0000000000000000000000000000000000000000..9db08f28661458b3b699bcb1dd261cba137c72e4 GIT binary patch literal 1150 zcma)+Pe+7N6o+q`MWbj)k;tJatxBti+Vlb1MhtC=Xxp;%1zNRj6%o<4RT&~;Xxl3K z0MROjdY-1s_4fBSo_Wtb=lt$_-}l~`lzR9y8j0^no3)fiQcBZ6icB}pB`s4M>hI$C z4~kkuq8*YwIbKa>6rWN&$Oer2y7 z@8i4=pa#Hv>8ZwfFZJjx{j+~~oy&fe{jMRef0(!f)q9rX8S3Tw8KyRD7@!j<`^(sx zvR6-*d+`MB%`xb4pYOo;?A6>pe7Aq3KhBGuRhTqUk?(BDIA literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/google.ico b/node_modules/everyauth/media/google.ico new file mode 100644 index 0000000000000000000000000000000000000000..ee7c943abf1064e3110161deb3a6477fcc7789b5 GIT binary patch literal 1150 zcmai!ZEO@(6o&8IDMXq|w?7~;fHp>@yX|&cgxJ_d0|o(W0wkiuMEv;W=W3v( z)q+3~th6X-V-^ZT+iD9Nw5Wh0X<8r_wUvGWQrV^LZkvVebm#HR_?tMBvv>E*ec$uG zXU<)v47oiXC7+q<#T2DxDy6a{Bqf>u^0M6Wii}$XPK8<0I>KX3QJ$1_XGfg4m7sUv z9K~w*c>_2 zz(cQ__{t3m%S;O1RTKz*@mq@CNQ_zaf8Yt-AT1Ony(LC^^Qg=5;GwIGC4|9>Q&KU9 z+)Alip~;tZ;RcOgbc|a!$qBZjz8yiIvPnH*F|93*I(Ute#vW|jhDn>{JMLvcmBP1G z;TQbkjZ;L20ZBOf&luju4pJNYP%W3xUkx(9;R1g~q7Ib)q2DR2yq(-?@&2KSze-b3 zAs#j=&K?Vr91goayGAEyyf{QnXD`>rZb%NS$q8N#7BhdVfp@3W7mnO5;^70~5{_-f zck|h5FU{|*;D_p081C+rjwR)`3CF^`bfAcA!RFTp*1=2ow@Yl6*rcd0oyV8UXS28D zHg-RrL3F6k^?W%pz*BW|$=)UPKGFCjyz<@mk@Ri5fnPLur5^`Y%;3`{9)hnfqOE?D z>(>(9zjhzzt~WFf?@{E`O4NzoU7|z6>(t+3Q1HINzSZ-%&~_MG`k07~(0lxIt`By* z9%_$P@IaZ=tTV~mZIUA%awYP1$Q+1|MS{OR&?D7s;?W^m)@O0-X+>z&bS`&>-29%V zS~6doL(a!ivqok}aF0|?Bm0Fs((m8wygoP1HnErit}HWJGR`}D=O;8PzjVdiD4v!V^lc8!qMjp zh-|VsTE3LfN=5rx&3DgDC-(PW?z`yvElz6MRoR=wG;F~+_2Z%^A|CqPGl-nQ!Jc-4 vYcl!bi4@Kqt`tj2MxqJw3Qx%XF0`I-Ikc-^&W9Ryu^WtA{w@6P0|)yrC_;$3 literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/gowalla.ico b/node_modules/everyauth/media/gowalla.ico new file mode 100644 index 0000000000000000000000000000000000000000..e99eb9e18767d4bfc4a6d530e9f6b16cec3d01a6 GIT binary patch literal 472 zcmV;}0Vn>6P)I>Y~Wml^(ldBgw>8w?i|VDr-d7e`Rp5CZ~$7V@JT z5P&sMc;pZ^nRPI*L_K0)(#izI%ms`vfZO!>A)L(&)C6a1XMw|p*}N0PRlsS$-%}L` zTjhNiSVAr{FaZM=7hpmU+5eBWGW=(MZWCRu*yP-glaO(vIR0=K15Y%mEEDPrFA1vRULbCm|_s!=#&-e~osxeEv#dF zaUB!>4NL_#F}wN%p0#I`U*UcD8|8QSD07dVFk`yHMRYai@0?Z>CRL(m(WkR!`Mt~?t$ zgB9Ih4O5Rz+5^=FH{o90g5G?I=<3?Y$ZP;EPXOcI74-iwg^F?(#||F=|ILF)NQi_` z7>TkzEiAye}~xEDiMqPZGkG~7)~4IFmsh)^DCe&QKI%#GT#6A zI{ce|VS0H3(}BmRX=ovq3)jd}@G&N47BDnCiSC{+V9HCw)y6`wY!(#R66EJ6Lnaeo z;JXnlu0MyDuI-`c%GF;ab!Y9Qe`pk4H@orn)h;yIuEWvX21AY%IVndG&p!x>@D12( z?HKrJ7GDm!aQn^}oZsAqhC53nnI%NcHN(>6#Fd_J(b;|;wTM>L~{kYSmgsQ3)Wd=J=Q6Igv6J@oR zkwG<4QAcs$)z=Us5JAOW1V1TzH$`5yqcwM+ymTB|=Mn}#RHH=KjuOrWHT%{c#kyvs z=W4*?MIa*LFofb%D9TL`h-EKCsRex%##X4+PROjcaLt^HVyz8DRgF+po`aI2qPbjE zgP6Ev#3dewNGit(+D~+>v@cPb!%I_?_ok+rw_`FiM3tRLr1YO8r4pLkvMuq+<%2(T$JhphH39$nDedsH-jRcVN&$_`Tvjq0MR94 AVE_OC literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/justintv.ico b/node_modules/everyauth/media/justintv.ico new file mode 100644 index 0000000000000000000000000000000000000000..2f2c2cbebbb784c9e148b05846463b177e6edc56 GIT binary patch literal 586 zcmV-Q0=4~#P)@M7=_QB`6stGy$mQ^18r8Vlx7i-Jb|rZ!Dnz$XrI7^J6}LBPav%;5f?6`_y8`7 zwAw`|LO_Io2_srPI?>GRCZHtr_PWhlhu|(-)YvmH^Pq%nUf^&RR>>TGnc{ z_5h4(wOTLF^J>4}U$xey?~y#5vyq z;MsWw>6F5I59ge>)-t73v9Pf4GRv}(l=5u|fs8Rs2=S}a>AV9_U~zHrX&lE&2%##K z%Kq%^?2SgFQBTu!Ktw7@lArZ@{T=|GW!YyUQq^kpIRF75q9jRPNhxn9N%Bc4^+szw zJUBS`vb?Uq#f*NdT49p0F2%}6S3rj+i@QF*3 z1ZhH37EO((`@O!euR#<&kMBF*bI$$TdwIhX37IDx7W0nC;*`jYh|C(9mg)5RCJl@W zR~)0lgo^o`nmmc@xtD9AH+vC%xpS@HYv(cRkuirjFC`pX^Uj!+4jpB{f3^y?L?+KU z_Cb$)W_>u1Im7^un*7yZ#_Ri)N4EgIF(Wg|v!+*U8d>`~pIT2MbyRQCCFBfG4vhuyK%%&+qMMa@2G-et_}4E!mK(fk9=rMvb3 literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/mailru.ico b/node_modules/everyauth/media/mailru.ico new file mode 100644 index 0000000000000000000000000000000000000000..ff56262cf448df6a2d30a6c623a7cc1865f7bfbd GIT binary patch literal 1150 zcmb7@T}+c#9LE1`EenZR$drNlBAGFpf)><*w7w%n zRzM0AEFx4Kr66r5HXs5<#T7OYT{7J+NMLqj?UG#@XExkO@H{)`HM`l}&YS0aJm>l4 zf6hr>A_f1Fl8E;&P{|6SRYbIoi(A}z?DK($@BO!(@SI$k`W$&p8d@-G=&mV687+K$ zMbx~WqQ$R0mRX~S3ZL%_-4$8E2v)mhrN^ct*!A@2h+YXvr@*l^f=#c2CFfa`Wj}+X zTa>8QDp0vqjjA`5a#k>cElE>Gomm7aQ@LEHBUWKZW}7QLETQv0qdqY5gU|1=UB+D2 zx|vw5Ud2RKFoHd-Rm7SMO0;GY+gF&0#54CmLEx48E6BFiBCDbvtDC>Ywu%Pi9s#C^Jz0K?Atz~N8B9gk|C@ai>`O_k#)`YOZ5x}0^?_yp3CD3^wq2~`A z+L_Kea|nX9Zc)X(+X)+L0*uZAl?5r-{RW*>E3 zMQ!zdtiB4EPYuIcz73s+a^VRPt z`eq3}Zxj4obvPazfh#zSK!?QF4fuHKA$CvxiLl$kBJN!ftnV{Z?1o>$^{z5D+TQ|c z=05iS0344jpl4(pJr~B%bZrjhcL3Y1MT`uz^Q?v4=#?PYKIh)K*|84Hgj~zteObq5 z&bP8qjv;nU8!aevGFXm9iUsNX$5#>a7AV!SVS!tT8e!uQ-RK5S>q6s}E%)X7&;MTTe{Sx1fQ*kyh2UzI1M%#vB=AX3 zWRO^c%^&@zx2PsyC5sDdNQ=A$y)=MtUw^?!%}JVqO??}7k`j6YI%19Ok?i)l^;T()q zn`RmvzGtvgQ{;Zm`k^O_^Pgaf;JL(C^N2qEFc51j?@CIu?jbE|6lP)!AA*T=_@3kb zomG0x-~lzAs+0H9uNOVt%k*4>HD&_u-+iao0DYJlxqj^pTI%NM!<;m;n7jKC8yg#_ zFM9|9%<2|+|N5HhnV#Yv*y`~-oO8G ztJ_Lo6A9RzdFhD}iFr<^Gf$c5Ol&xC*;!HHtl)c~IiU`&j6mJ3R%fV-tE-EOimERZ zb5$1?g(jrt7b+5(jvq_P$xY3_WNU2{jYnE*g{VCpT_wcP0-P(>^Pnz7oQm0g z@tn7=C8V;_TUX{i8@A2mIvgiNyvvm-M5e3Rm69B37DAZPSQ>XFM`>iTz`J=5iyS94 zStW*SA*|;O^+H$@ z+~A)^IsT&Vho2zvR`@Hd=Koka$FaVR0CX=qL2JE)=u5UHP7YkeGcawv0Hw|aJu7aQ zvR=X9)+uP#{UEIRK+wBkHyD>wB;V+dff6|s*K6_v)vaEXM_DI_>n_FXX&Uh4c_@b( zbI3Irvz&sk=HvC^sMRQ*l{l8`1YhJ67ER|lt}=RI)*h02?=yO&o}1xQ4+AEj#256g z3jX+BP^!NZN^oCZpY-WLjYS(a`%&Yc{+9yxoMXRDLF6UJeXT7l`NUTn+#($|PVQ0H z@)@XqM=Z@_pR?~^zI=pOCJ(QLBIq!Vv{0i~6P7cHPtFkb@Z0Rf8Svh5&W>oZf}hM5 zU}Q4@D%7&k97#92SMx`a3a{ zkLQC#D|iwju)ijVw&5$mR3XaE2u_T3=1*OJQc6m_mh|zvP4-EX_D&_)my&k&ZSq`) zJ|9Y2eItpUNOCT0a<3#ckDElV5O;yqQDH5{@X)IPVVb<&~(>}OBq_eQS+y$<}-4lu^1 z^im=@GK(jFq%}j!&Iq0l%|cOUY*p|T-_A`G3V4_od?<)6l+@g|b$udcFBi4tNY5!n zOKX_RDql~PiY%8hv@{zOd@h$x>4?qgnlaEn%7>Q>O)sjHTzWABd(1#$I1nGKAKLBp zLwj~|A*Qor-*l84%tPb;eAi|w&Iw&w9<*Qqg>YJX=cg1MM^%#@E?+xtL=Q4P&nC$camNWKT zy$oD5xg;A znr5x|WLa2yRM>wG_h>a-ctiuB<93R9@}YZ&FVg%oa!Dk_A^XYA(vFjhhIch<|@_dB*ge>vZI|6@8ED)x1JA90-(raHf`jsP}y)6q?Y|Lgeye5xp> literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/osm.ico b/node_modules/everyauth/media/osm.ico new file mode 100644 index 0000000000000000000000000000000000000000..4448dd6f612e8500092c3ee50ae0a1cba84d36cd GIT binary patch literal 1150 zcma)6draF^82uGALt_>+WX>#0Ox%o_O*UXK9fHI$l#B(#besAI^^rwHhXI)mhB`Jk z!eSG$M{GLQwQD<|Wu?$k7|*tpKA`jkr9ApvA3Vz_4#OrKZ<+k9_vYL$_uTJ%Ip0n0 zr6?Mi@$nQ{U!}f&hN8An6!iuHp$PMoCxN2KnPkUPZ0yMbfRad>VsejUC*-_;C|=gu zLW^?$7hbQIN=~A0Pt8AmBQbgJCHkJ-`$|ho;(B{~X~AHS5{t#OqN1Yba&vQEEG{mN z6c%4X={p1Cfo2?@FnAAq5D2gSDnFu{i!(cRw~ZitOi@FgxIZGlLYnX zbE+XCvC3SBi?&<%;%1qaczHJJfyH9QaP(r&y?_QKH5JH6OGjGT+bI6M3PMXCl;eG9 za+)A@Tfnr5HfofsuSRz5dTsma>MG@MIH)q_`MS=40n*SQN|-<6@Oy`lnVA8$kPVSt z500fBwMsG0%h{;xuEif_G13pe^GQYdkFf%QfR_FFN9VXcHH4ErXf$h3cI6@%6&H|S zcnU?;KY^{_LZWF!v!Ml?9wGR>4Jar*^-FT%n_Khp^0qK8{cx8b7y!qvL!(Cnl}8I@ zzXbV5b0Fkjg^~C&Ob=mXeiVVQA6@-29L>);mYTA6TUJ(998)85ZRkgJXb9*a^{b)i zs|TM|4ZFJ^2BIG%dQ&J`V+4UEKWb`zmF`cXCvY1CI~%7BXqq+Rj(rf^2TI&=cYxD= z8#4|SCPQY}X3g+VsxV{kfzhXdn&cQ9sguh;#0d3iZ4hwF z&Y2+a^@643!Qr*SH9rMscnTvS3x?f#v}?r}^^ASH`3B?*wvqZ719+2q$QG=S%^M-~ zb%O0|0n5+?gKC5;nb;P#*#?%J{0EN~KUi6NymRJp zd;t%q8(3 D0iwzd literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/readability.ico b/node_modules/everyauth/media/readability.ico new file mode 100644 index 0000000000000000000000000000000000000000..59216b7642f0b6c83a40623c88f0ef7ac0c2a3b0 GIT binary patch literal 1150 zcmb`GQAm?f6vvN!8=6@g&4mS4D}pH%?ja*+q2hxQd@vK#AorvzKcbo?x=m9UThiE2 z(n`<}%^Iyp5lo@B8Uz^_`65D65*bC1FSD@*xBs0@oSQGv{rK&k@7(`6_kMTh5T)T! zDha>)>AZ|+7ZGUzT=1;=F~x>z8xiM!55|}bYz66HORD_v%l~R{%ESTx&dSPelimL6 z6xSrK62T`MAAgruUf$gVI|ro2HLwM6RHbTMs;GD}3|kM5ZQ!`aGi@bmW>ZriMXasu z0bAMD_PCYE!u0y#0MS)OfTF~!9r&xtM~_7Z3T z*Fih5GOgA*D+pJjSy|4Xp-|*B;?#Y8{xb@N^+$X^lWAh8tLycO!QhMNbUo4hd{?xz z^iITX_pj8}j(U|!*LNZtlgm594Goj+MMaLML=y5lnIPPV=H+$07le*zNy*4>Ntz5> zEP-F5=!;}z+zfFvn%nb4jWK<0ZqEm!@vejD9NsT5jizH>t#0`eKTE2)tjzn2=o<7A zD=c)qz&GrztLwMb)b#e7Oanti^|9QkV!03Z>z5>7Z*_H#dtu?*5ybPl*$#F)9AoCy zvovp-!(e#$0NMk9-@AN64IC;cu)ZZSB0f1sc6R62nVCgiU+M9<^)vjLb8|~4bUNFc z)pOJ#5C0!8vz(l!#lgYgS!j4$Z91^dd*GnkJyBm(b?credc0=y{Z{x6gB>7cZ>&!U z4X@`+paN>Z?&&&ScOH?U3ibJ$^tqExZ0?{XQ_c93Y-~D_t?KG= zZow_Odfln5yX!UQUU1HxJsa-ddcwKe>Z=JnfAulvR-bb2S&fm3YY6oJA7W;i(4Dt$ z`K$?rfGp3`zx=g?5soFpdHI$va_-{PHeWOQ?K7_C!oB<~3j_P(SFO#-{+BW-6A>cRS2;9roU~_ZR&YwST%5PuroN->@`}1dZ{o?-!+{;#Hdwbi? zojbS3Z<>D^7uSsUx#P2V$?VoUA&#SQKUiB^t9)O$a3R=3H%N~LEUG7^^ZeZ{2|4WxH(KQfyK4)?d+>d7QnU0Z-MuN7tiQQ7D`;;HTB9?O8$os|r?GNc235Uv` zSfo>}KlrB}$dO0msOqoeWzYI!?+Y^X-dFmbY5ft?-Me@3P?T|N@k^+?xc{&RvM+@B znYssRTzk^`BX8CuwMM;{e&M$(z*n3%Vi;BXFLOaGVJ$GeL#+FWo)>9t;S>I=eJ0Fl zu5ke0S=pN1>pzNgPhxKjT=b+R5@$Fp0yshZ>4sQb1myNp(PMY3TklZ^NsZ$xL5b&b#{*_8L8f8WiS`xuY>hdBs!KR50Z|J0`W zca7d#v45Veyz@>&CcaNjI~MuPg}HMd^OA4opdIgz)0*vEF?%3v$z)&1Y-?%3`Ys@I zi+WiJ{Y6`IOa7W?*@C;0IkzI5$r^4+?V_-dxfSWI*d1X@usbphwtxjZQ2Q`||0(oW zhT|oFn*USCTTS4deqwvILiQq?%fe7N_IohejIC^T{QLcA-!%>CdqjJ&Re#`vGfD5s zcvhUsjr8h5FFlKu=OuMlXC{1(s&B&ZT{M*&>0o=rx3=PZ1oV5m?ECD$@jV#6d#0WN zq}z+OImd7v-|_MLmU}OpZ8+QFBXHl2-0jz*7voOOkeRx>oZ)zepGw%ncfT2@?qwu z05_arqfIG!+sWAy&UWjE`3>*-&Or{Olc(os?80~ae)2ZMnF`KY{yx?}YapD@5Bg3S z#yTPX@=VCPC>IK$D}>n7@1peEkpD>nUyboxctFgc6u%yIo#6|gGOZ=0-Ja}O~0}ltzXSAEP($9&PnxqyZ zDqfgFIN`rB?I)@3tk=?O2+Ud1uL*7SYvp#L$|Y!)iiZnB^R1 zqaU?jPQmXt&8};$Xq?Pe;`RRhTT~n%zv#dA_a8TVPiy(ldzB4zNB8erx7)Q=t7VNw z!`kh(<#`^AJ-l!Bh4w%6z{k&pe*Bg3E-x=n+@Cs~jv0Q@i@tAtup6ZG^LO9$y4WBN zgtlI<`+nbdQ|FXxDkbcsBK>0Hnq^sLMNw2wQvJbTV7C2J(EaqqYK*@qUjCw_PocCxe z;h!$%s>(ms4f<)#L|xjbzq6C}hU+-z`^Aoq^cA!7b|$SKYL2-Ym$LTJjZ(!DW1{_9 Z?`6%=q-RmDzj&jWE!=22cQ~Mf?tf@u?@a&z literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/soundcloud.ico b/node_modules/everyauth/media/soundcloud.ico new file mode 100644 index 0000000000000000000000000000000000000000..4130bea1b97673078f1fc9b79fd7c829678b3a19 GIT binary patch literal 1150 zcmb7^O=uHA9K}ac5h{dIp;A9EN&+cHiWIz9pn$P(9u%|L-I>|vo7s)2(Mxvu?c4d!dow$;%L=iKXIq=# zH6aeQ2+<*gNE4P=3F{Qm$G%l7LrmKqS?m#6d?jcSlQG$HtRHCU4Vog>ADH>dA{$`E zPSU3%6m=<*?HaW@z08=bp>?+=ib&#z?DEiRaj8pT-TD;7n6|_R6yp1QbPjpgd)C9I z{Z$MWTqH*vY(M5;$9N^=xPxtntMs~v4@hRiG1`YDu0K?`@mOK*ou>Mjd&~AC4?ija z8jlAhh4w)&$}4n?NX)#_n0g}d;=Q7JREepX|L4tkYY(^(qvjbj)=+bIByK*HnE$A# z9@Vs&cmAFK!xxRtgZ2FSqY~?mcsO&{$HJn*?O7l5pCoS0didFp&);*=d)~2ryMFHf z#?u;!Qxb`j9=7DF7@zjA@L6H{IrG)}{3Wg_apD(!uJzmfXFfGS@*2r=lK4pGT=W#H z$V^o5jO%$_*0}#tvgX)6<4NVY_xAk*T^EB0jjp0Xx+sw@_()%HBdVbmJlkhHCR592 zE(4ay02zzM=1Ypm1{C{s7Z+ oIK)0n6KXQULNNCiZ?q7ji~Ki?k<}z-{}c7ga^7wr?C&Z426T_eApigX literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/tripit.png b/node_modules/everyauth/media/tripit.png new file mode 100644 index 0000000000000000000000000000000000000000..a43465352c836184cc670be7d39ccf51d4e243a7 GIT binary patch literal 500 zcmVPx#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUza!Eu%R5(v#{0{^SlmL(c*uaNxzy5dZxcvX{?U%TefW;Yb$!0A( z@n5iT1sFek`vs>VI1TWbvKMXuK3BjE*mCK~|4UEa!)>Zue-3PbLe<*;An(8c$Y7Ay zU;u7_eC68z(Q^-@IMuFa2a2H}mw*ff8G>N|$ORocuKWkt3_&;0mx>M0if_gNe3VaP#CN` zaryt(HL3qUPmucm>qPed<2Ubsor@gJFgDx(kO0V3bk~5a289oL^kKvTND(N}AV(vz qyFt+haveIrnUwM7AS6kO4FCX}VpX{alvnKl0000w literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/tumblr.jpg b/node_modules/everyauth/media/tumblr.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3f02fd6747b4b044b1ca1cdc9902c6f73cb7537e GIT binary patch literal 509 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivO=p>qZR90YemX^xOzYk;Pu0Cp* zk!P08sX5#Kh@MWw($^K`la%+Ia_T!e(d5s`BAzJ>Qn_>AiYF+|-?Zva(X|-Gm(40$ M19q6czxn?r0Q%{IIRF3v literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/twitter.ico b/node_modules/everyauth/media/twitter.ico new file mode 100644 index 0000000000000000000000000000000000000000..00450d4fe367de0e7b12d251ee9965b32d2d0f5f GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJy!Tl&9eZ;-18zSz3=zE8nj=#FSV+Bw?9f&2+%>jx1 z{Pv;Z?52X_+dAa_@9CBQe`K=a|5MYI{-2o%!KY^^{lB=v>-oo*S0m%m>Hi>ej!jjB>xY?hYPR0@4==8CBfH_y+S9K-R(Sx4RSNg z4WMw{)~o&X>Fp!-SC21G0O<$XE&uZV(S=*OwZ5*bm-)Y>UgO=#ZC#BZxy}6+PY+B` z0Q&`G&h8%h{|A;N?S$D2q95Nn;xngI>i^DpiR)ly!sKt9T%NG5S@!?FJ_Rsd+a&w{ z$*m*yFnJISiofq)-t!}iA+z@{FPOiqM&|#zHm%POu57D8mLrx8au>)?C$>WTMXWyB zt78D>e+GsJ_6!UM_!$@)*cliqfcOV91H%VkVexEyr|!_dZKfAmrG4QSNm%2DLW#oUcx~aMSw)Xbh7Q63S@408Y_nzzIRY`sGQkL#?*mvJ^?`_Y654;XN z@HzA_{Mh5De0tdPd{ya_G#bCF9&ZwK6vNJg}aXqy!vwS^`{3fUcY(s=KYti zAAbJ%|NlS3C>RX^YJ`B|PZppt{~2^ZhJo?~1IH4E;uQ-nELh;!%xAFY#KT7moZAgK z?B<+cY&ys($m3?f_{h0st9eBx zY)uf&Il;!`QnIz-z(N*Yc2)_7fa{6u5`4mQY+pFI^-0KTXvCel(cCM;$jD#~026(? AlmGw# literal 0 HcmV?d00001 diff --git a/node_modules/everyauth/media/vkontakte.ico b/node_modules/everyauth/media/vkontakte.ico new file mode 100644 index 0000000000000000000000000000000000000000..1dc9e63a0dbf49dffeb79b965d709985d902c3bb GIT binary patch literal 894 zcmZQzU<5(|0R|u`!H~hsz#zuJz@P!dKp_SNAO?x!0;`*1W~5sai6DxBB#{VWEKu?0 z{#=3xVmMF>vikW&o^Z6N%y(5I!YHij|097aQK%c<1!)pWnX# zbst>ZPEbA289;P)>wKX4D+ksRRDXWQ;G?0$FM7C8NF(y zflE+OPoIFtoUMeH0YqOmK1W{Us>OZs6jwuWykMn^lYFFT1yD%vMXz z|4BBsVm9Y;adB~8z--L0(#55V0Z8KjASb}^0ZRsk21%eoejw(AVh$h;#SIb+3OuMdrBp (https://github.com/bnoguchi/)", + "keywords": [ + "auth", + "oauth", + "password", + "facebook", + "openid", + "twitter", + "dropbox", + "authorization", + "authentication", + "connect", + "express" + ], + "main": "./index.js", + "directories": { + "lib": "lib" + }, + "dependencies": { + "oauth": "https://github.com/ciaranj/node-oauth/tarball/master", + "request": "2.9.x", + "connect": "2.3.x", + "openid": ">=0.2.0", + "xml2js": ">=0.1.7", + "node-swt": ">=0.1.1", + "node-wsfederation": ">=0.1.1", + "debug": "0.5.0", + "express": "3.x" + }, + "devDependencies": { + "jade": ">=0.12.1", + "tobi": ">=0.2.2", + "expect.js": ">=0.1.2", + "mocha": ">=0.13.0", + "satisfy": ">=0.1.0" + }, + "engines": { + "node": ">=0.4" + }, + "optionalDependencies": {} +} diff --git a/node_modules/everyauth/test/creds.dummy.js b/node_modules/everyauth/test/creds.dummy.js new file mode 100644 index 0000000..5f1fb78 --- /dev/null +++ b/node_modules/everyauth/test/creds.dummy.js @@ -0,0 +1,18 @@ +module.exports = { + facebook: { + login: '' + , password: '' + } + , twitter: { + login: '' + , password: '' + } + , soundcloud: { + login: '' + , password: '' + } + , mailchimp: { + login: '' + , password: '' + } +}; diff --git a/node_modules/everyauth/test/facebook.tobi.js b/node_modules/everyauth/test/facebook.tobi.js new file mode 100644 index 0000000..47efe9a --- /dev/null +++ b/node_modules/everyauth/test/facebook.tobi.js @@ -0,0 +1,57 @@ +var tobi = require('tobi') + , expect = require('expect.js') + , creds = require('./creds.js'); + +require('./util/expect.js'); + +describe('facebook', function () { + var app, browser; + + beforeEach( function () { + delete require.cache[require.resolve('./app')] + app = require('./app') + var everyauth = require('../index'); + everyauth.debug = false; + tobi.Browser.browsers = {}; + browser = tobi.createBrowser(3000, 'local.host'); + browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; + }); + + afterEach( function () { + app.close(); + }); + + describe('a successful login', function () { + it ('should succeed', function (done) { + this.timeout(10000); + browser.get('/auth/facebook', function (res, $) { + var form = $('#login_form'); + form + .fill({ + email: creds.facebook.login + , pass: creds.facebook.password + + // Need to do this; otherwise, parameters are corrupted, and Facebook responds with an error + // Ideally, $.fn.serializeArray() would do this, but alas... + , next: form.find('input[name="next"]').attr('value').replace(/&/g, '&') }) + .submit(function (res, $) { + var form = $('#uiserver_form'); + if (form.length) { + // If we are at the "Request for Permission" page on Facebook + return form.submit( function (res, $) { + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).not.to.have.text('Not Authenticated'); + done(); + }); + + } + + // Else we are back at local.host + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); + }); +}); diff --git a/node_modules/everyauth/test/mailchimp.tobi.js b/node_modules/everyauth/test/mailchimp.tobi.js new file mode 100644 index 0000000..7908e53 --- /dev/null +++ b/node_modules/everyauth/test/mailchimp.tobi.js @@ -0,0 +1,38 @@ +var tobi = require('tobi') + , expect = require('expect.js') + , creds = require('./creds.js'); + +require('./util/expect.js'); + +describe('Mailchimp', function () { + var app, browser; + + beforeEach( function () { + delete require.cache[require.resolve('./app')] + app = require('./app') + tobi.Browser.browsers = {}; + var everyauth = require('../index'); + everyauth.debug = false; + browser = tobi.createBrowser(3000, '127.0.0.1'); //mailchimp requires 127.0.0.1 instead of localhost in dev/test. + browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; + }); + + afterEach( function () { + app.close(); + }); + + it('should successfully login with the right username, password', function (done) { + this.timeout(10000); + browser.get('/auth/mailchimp', function (res, $) { + $('#login-form') + .fill({ + username: creds.mailchimp.login + , password: creds.mailchimp.password }) + .submit(function (res, $) { + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/node_modules/everyauth/test/password.satisfy.js b/node_modules/everyauth/test/password.satisfy.js new file mode 100644 index 0000000..65f2718 --- /dev/null +++ b/node_modules/everyauth/test/password.satisfy.js @@ -0,0 +1,121 @@ +var satisfy = require('./util/satisfy'); + +// TODO Add case of person trying to take an existing login + +describe('password', function () { + var app; + + before( function () { + app = require('./app'); + }); + + after( function () { + app.close(); + }); + + describe('registration', function () { + var regUrl = 'http://localhost:3000/register'; + + it('should succeed if provided with a username and password', function (done) { + satisfy(regUrl) + .fill({ email: 'newuser@example.com', password: 'pass'}) + .submit() + + .expect('h2').to.have.text('Authenticated') + .expect('h2').to.not.have.text('Not Authenticated') + + .run(done); + }); + + describe('failing', function () { + it('should fail with no email, no password', function (done) { + satisfy(regUrl) + .fill({email: '', password: ''}) + .submit() + + .expect('#errors li:first').to.have.text('Missing email') + .expect('#errors li:eq(1)').to.have.text('Missing password') + + .run(done); + }); + + it('should fail with an invalid email, non-empty password', function (done) { + satisfy(regUrl) + .fill({ email: 'newuser', password: 'pass' }) + .submit() + + .expect('#errors').to.have.text('Please correct your email.') + .run(done); + }); + + it('should fail with an invalid email, no password', function (done) { + satisfy(regUrl) + .fill({email: 'newuser', password: ''}) + .submit() + + .expect('#errors li:first').to.have.text('Please correct your email.') + .expect('#errors li:eq(1)').to.have.text('Missing password') + + .run(done); + }); + + it('should fail with a valid email, no password', function (done) { + satisfy(regUrl) + .fill({email: 'abc@example.com', password: ''}) + .submit() + + .expect('#errors').to.have.text('Missing password') + + .run(done); + }); + }); + }); + + describe('login', function () { + var loginUrl = 'http://localhost:3000/login'; + + it('should succeed with the right email + password', function (done) { + satisfy(loginUrl) + .fill({ email: 'brian@example.com', password: 'password' }) + .submit() + + .expect('h2').to.have.text('Authenticated') + .expect('h2').to.not.have.text('Not Authenticated') + + .run(done); + }); + + describe('failing', function () { + it('should fail with the wrong password', function (done) { + satisfy(loginUrl) + .fill({ email: 'brian@example.com', password: 'wrongpassword' }) + .submit() + + .expect('#errors').to.have.text('Login failed') + + .run(done); + }); + + it('should fail with an empty password', function (done) { + satisfy(loginUrl) + .fill({ email: 'brian@example.com', password: '' }) + .submit() + + .expect('#errors').to.have.text('Missing password') + + .run(done); + }); + + it('should fail with no email, no password', function (done) { + satisfy(loginUrl) + .fill({ email: '', password: '' }) + .submit() + + .expect('#errors li:first').to.have.text('Missing login') + .expect('#errors li:eq(1)').to.have.text('Missing password') + + .run(done); + }); + }); + }); +}); diff --git a/node_modules/everyauth/test/password.tobi.js b/node_modules/everyauth/test/password.tobi.js new file mode 100644 index 0000000..13693c4 --- /dev/null +++ b/node_modules/everyauth/test/password.tobi.js @@ -0,0 +1,143 @@ +var tobi = require('tobi') + , expect = require('expect.js') + +require('./util/expect.js'); + +describe('password', function () { + var app, browser; + + beforeEach( function () { + delete require.cache[require.resolve('./app')] + app = require('./app'); + tobi.Browser.browsers = {}; + var everyauth = require('../index'); + everyauth.debug = false; + browser = tobi.createBrowser(3000, 'local.host'); + browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; + }); + + afterEach( function () { + app.close(); + }); + + describe('registration', function () { + it('should succeed if provided with a username and password', function (done) { + browser.get('/register', function (res, $) { + $('form') + .fill({ email: 'newuser@example.com', password: 'pass' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); + + describe('failing', function () { + it('should fail if no email, no password', function (done) { + browser.get('/register', function (res, $) { + $('form') + .fill({ email: '', password: '' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('#errors li:first')).to.have.text('Missing email'); + expect($('#errors li:eq(1)')).to.have.text('Missing password'); + done(); + }); + }); + + // TODO Add case of person trying to take an existing login + }); + + it('should fail with an invalid email, non-empty password', function (done) { + browser.get('/register', function (res, $) { + $('form') + .fill({ email: 'newuser', password: 'pass' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('#errors')).to.have.text('Please correct your email.'); + done(); + }); + }); + }); + + it('should fail with an invalid email, no password', function (done) { + browser.get('/register', function (res, $) { + $('form') + .fill({ email: 'newuser', password: '' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('#errors li:first')).to.have.text('Please correct your email.'); + expect($('#errors li:eq(1)')).to.have.text('Missing password'); + done(); + }); + }); + }); + + it('should fail with a valid email, no password', function (done) { + browser.get('/register', function (res, $) { + $('form') + .fill({ email: 'abc@example.com', password: '' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('#errors')).to.have.text('Missing password'); + done(); + }); + }); + }); + }); + }); + + describe('login', function () { + it('should succeed with the right email + password', function (done) { + browser.get('/login', function (res, $) { + $('form') + .fill({ email: 'brian@example.com', password: 'password' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); + + describe('failing', function () { + it('should fail with the wrong password', function (done) { + browser.get('/login', function (res, $) { + $('form') + .fill({ email: 'brian@example.com', password: 'wrongpassword' }) + .submit( function (res, $) { + expect(res).to.have.status(200); + expect($('#errors')).to.have.text('Login failed'); + done(); + }); + }); + }); + + it('should fail with an empty password', function (done) { + browser.get('/login', function (res, $) { + $('form') + .fill({ email: 'brian@example.com', password: '' }) + .submit( function (res, $) { + expect($('#errors')).to.have.text('Missing password'); + done(); + }); + }); + }); + + it('should fail with no email, no password', function (done) { + browser.get('/login', function (res, $) { + $('form') + .fill({ email: '', password: '' }) + .submit( function (res, $) { + expect($('#errors li:first')).to.have.text('Missing login'); + expect($('#errors li:eq(1)')).to.have.text('Missing password'); + done(); + }); + }); + }); + }); + }); +}); diff --git a/node_modules/everyauth/test/promise.test.js b/node_modules/everyauth/test/promise.test.js new file mode 100644 index 0000000..ec98bae --- /dev/null +++ b/node_modules/everyauth/test/promise.test.js @@ -0,0 +1,48 @@ +var expect = require('expect.js') + , Promise = require('../lib/promise'); + +describe('Promise', function () { + describe('#fulfill', function () { + it('should be idempotent', function (done) { + var p = new Promise() + , test = null; + p.callback( function (val) { + test = val; + }); + p.fulfill(1); + p.fulfill(2); + setTimeout( function () { + expect(test).to.equal(1); + done(); + }, 1000); + }); + + it('should not have an effect if #fail was already called', function (done) { + var p = new Promise(); + p.fail(new Error()); + var fulfillHasImpact = false; + p.callback( function () { + fulfillHasImpact = true; + }); + setTimeout( function () { + p.fulfill(1); + expect(fulfillHasImpact).to.not.be.ok(); + done(); + }, 1000); + }); + + it('should not have an effect if the promise already timed out', function (done) { + var p = new Promise; + p.timeout(1); + var fulfillHasImpact = false; + p.callback( function () { + fulfillHasImpact = true; + }); + setTimeout( function () { + p.fulfill(1); + expect(fulfillHasImpact).to.not.be.ok(); + done(); + }, 200); + }); + }); +}); diff --git a/node_modules/everyauth/test/soundcloud.tobi.js b/node_modules/everyauth/test/soundcloud.tobi.js new file mode 100644 index 0000000..cb52624 --- /dev/null +++ b/node_modules/everyauth/test/soundcloud.tobi.js @@ -0,0 +1,38 @@ +var tobi = require('tobi') + , expect = require('expect.js') + , creds = require('./creds.js'); + +require('./util/expect.js'); + +describe('SoundCloud', function () { + var app, browser; + + beforeEach( function () { + delete require.cache[require.resolve('./app')] + app = require('./app') + tobi.Browser.browsers = {}; + var everyauth = require('../index'); + everyauth.debug = false; + browser = tobi.createBrowser(3000, 'local.host'); + browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; + }); + + afterEach( function () { + app.close(); + }); + + it('should successfully login with the right username, password', function (done) { + this.timeout(10000); + browser.get('/auth/soundcloud', function (res, $) { + $('#oauth2-login-form') + .fill({ + username: creds.soundcloud.login + , password: creds.soundcloud.password }) + .submit(function (res, $) { + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); +}); diff --git a/node_modules/everyauth/test/twitter.tobi.js b/node_modules/everyauth/test/twitter.tobi.js new file mode 100644 index 0000000..1f2ceed --- /dev/null +++ b/node_modules/everyauth/test/twitter.tobi.js @@ -0,0 +1,42 @@ +var tobi = require('tobi') + , expect = require('expect.js') + , creds = require('./creds.js'); + +require('./util/expect.js'); + +describe('Twitter', function () { + var app, browser; + + beforeEach( function () { + delete require.cache[require.resolve('./app')] + app = require('./app') + tobi.Browser.browsers = {}; + var everyauth = require('../index'); + everyauth.debug = false; + browser = tobi.createBrowser(3000, 'local.host'); + browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; + }); + + afterEach( function () { + app.close(); + }); + + it('should successfully login with the right username, password', function (done) { + this.timeout(10000); + browser.get('/auth/twitter', function (res, $) { + $('#oauth_form') + .fill({ + 'session[username_or_email]': creds.twitter.login + , 'session[password]': creds.twitter.password }) + .submit(function (res, $) { + expect($('.happy.notice h2')).to.have.text('Redirecting you back to the application. This may take a few moments.'); + $('.happy.notice a').click( function (res, $) { + expect(res).to.have.status(200); + expect($('h2')).to.have.text('Authenticated'); + expect($('h2')).to.not.have.text('Not Authenticated'); + done(); + }); + }); + }); + }); +}); diff --git a/node_modules/everyauth/test/util/expect.js b/node_modules/everyauth/test/util/expect.js new file mode 100644 index 0000000..e9ca46f --- /dev/null +++ b/node_modules/everyauth/test/util/expect.js @@ -0,0 +1,412 @@ +var expect = require('expect.js'); + +/** + * Adapted from Tobi to work with expect.js + * + * Tobi - assertions - should + * Copyright(c) 2010 LearnBoost + * MIT Licensed + */ +var Assertion = expect.Assertion + , statusCodes = require('http').STATUS_CODES + , j = function(elem){ return '[jQuery ' + i(elem.selector.replace(/^ *\* */, '')) + ']'; } + , i = require('sys').inspect; + +/** + * Number strings. + */ + +var nums = [ + 'none' + , 'one' + , 'two' + , 'three' + , 'four' + , 'five' +]; + +/** + * Return string representation for `n`. + * + * @param {Number} n + * @return {String} + * @api private + */ + +function n(n) { return nums[n] || n; } + +/** + * Assert text as `str` or a `RegExp`. + * + * @param {String|RegExp} str + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.text = function(str){ + var elem = this.obj + , text = elem.text() + , include = this.includes; + + if (str instanceof RegExp) { + this.assert( + str.test(text) + , 'expected ' + j(elem)+ ' to have text matching ' + i(str) + , 'expected ' + j(elem) + ' text ' + i(text) + ' to not match ' + i(str)); + } else if (include) { + this.assert( + ~text.indexOf(str) + , 'expected ' + j(elem) + ' to include text ' + i(str) + ' within ' + i(text) + , 'expected ' + j(elem) + ' to not include text ' + i(str) + ' within ' + i(text)); + } else { + this.assert( + str == text + , 'expected ' + j(elem) + ' to have text ' + i(str) + ', but has ' + i(text) + , 'expected ' + j(elem) + ' to not have text ' + i(str)); + } + + return this; +}; + +/** + * Assert that many child elements are present via `selector`. + * When negated, <= 1 is a valid length. + * + * @param {String} selector + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.many = function(selector){ + var elem = this.obj + , elems = elem.find(selector) + , len = elems.length; + + this.assert( + this.negate ? len > 1 : len + , 'expected ' + j(elem) + ' to have many ' + i(selector) + ' tags, but has ' + n(len) + , 'expected ' + j(elem) + ' to not have many ' + i(selector) + ' tags, but has ' + n(len)); + + return this; +}; + +/** + * Assert that one child element is present via `selector` + * with optional `text` assertion.. + * + * @param {String} selector + * @param {String} text + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.one = function(selector, text){ + var elem = this.obj + , elems = elem.find(selector) + , len = elems.length; + + this.assert( + 1 == len + , 'expected ' + j(elem) + ' to have one ' + i(selector) + ' tag, but has ' + n(len) + , 'expected ' + j(elem) + ' to not have one ' + i(selector) + ' tag, but has ' + n(len)); + + if (undefined != text) { + expect(elems).to.have.text(text); + } + + return this; +}; + +/** + * Assert existance attr `key` with optional `val`. + * + * @param {String} key + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.attr = function(key, val){ + var elem = this.obj + , attr = elem.attr(key); + + if (!val || (val && !this.negate)) { + this.assert( + attr.length + , 'expected ' + j(elem) + ' to have attribute ' + i(key) + , 'expected ' + j(elem) + ' to not have attribute ' + i(key) + ', but has ' + i(attr)); + } + + if (val) { + this.assert( + val == attr + , 'expected ' + j(elem) + ' to have attribute ' + i(key) + ' with ' + i(val) + ', but has ' + i(attr) + , 'expected ' + j(elem) + ' to not have attribute ' + i(key) + ' with ' + i(val)); + } + + return this; +}; + +/** + * Assert presence of the given class `name`. + * + * @param {String} name + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.class = function(name){ + var elem = this.obj; + + this.assert( + elem.hasClass(name) + , 'expected ' + j(elem) + ' to have class ' + i(name) + ', but has ' + i(elem.attr('class')) + , 'expected ' + j(elem) + ' to not have class ' + i(name)); + + return this; +}; + +/** + * Assert that header `field` has the given `val`. + * + * @param {String} field + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.header = function(field, val){ + expect(this.obj).to.have.property('headers'); + expect(this.obj.headers).to.have.property(field.toLowerCase(), val); + return this; +}; + +/** + * Assert `.statusCode` of `code`. + * + * @param {Number} code + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.status = function(code){ + expect(this.obj).to.have.property('statusCode'); + var status = this.obj.statusCode; + + this.assert( + code == status + , 'expected response code of ' + code + ' ' + i(statusCodes[code]) + + ', but got ' + status + ' ' + i(statusCodes[status]) + , 'expected to not respond with ' + code + ' ' + i(statusCodes[code])); + + return this; +}; + +/** + * Assert id attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.id = attr('id'); + +/** + * Assert title attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.title = attr('title'); + +/** + * Assert alt attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.alt = attr('alt'); + +/** + * Assert href attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.href = attr('href'); + +/** + * Assert src attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.src = attr('src'); + +/** + * Assert rel attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.rel = attr('rel'); + +/** + * Assert media attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.media = attr('media'); + +/** + * Assert name attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.name = attr('name'); + +/** + * Assert action attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.action = attr('action'); + +/** + * Assert method attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.method = attr('method'); + +/** + * Assert value attribute. + * + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.value = attr('value'); + +/** + * Assert enabled. + * + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.enabled = function () { + var elem = this.obj + , disabled = elem.attr('disabled'); + + this.assert( + !disabled + , 'expected ' + j(elem) + ' to be enabled' + , ''); + + return this; +}; + +/** + * Assert disabled. + * + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.disabled = function () { + var elem = this.obj + , disabled = elem.attr('disabled'); + + this.assert( + disabled + , 'expected ' + j(elem) + ' to be disabled' + , ''); + + return this; +}; + +/** + * Assert checked. + * + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.checked = bool('checked'); + +/** + * Assert selected. + * + * @return {Assertion} for chaining + * @api public + */ + +Assertion.prototype.selected = bool('selected'); + +/** + * Generate a boolean assertion function for the given attr `name`. + * + * @param {String} name + * @return {Function} + * @api private + */ + +function bool(name) { + return function(){ + var elem = this.obj; + + this.assert( + elem.attr(name) + , 'expected ' + j(elem) + ' to be ' + name + , 'expected ' + j(elem) + ' to not be ' + name); + + return this; + } +} + +/** + * Generate an attr assertion function for the given attr `name`. + * + * @param {String} name + * @return {Function} + * @api private + */ + +function attr(name) { + return function(expected){ + var elem = this.obj + , val = elem.attr(name); + + this.assert( + expected == val + , 'expected ' + j(elem) + ' to have ' + name + ' ' + i(expected) + ', but has ' + i(val) + , 'expected ' + j(elem) + ' to not have ' + name + ' ' + i(expected)); + + return this; + } +} diff --git a/node_modules/everyauth/test/util/satisfy.js b/node_modules/everyauth/test/util/satisfy.js new file mode 100644 index 0000000..996d926 --- /dev/null +++ b/node_modules/everyauth/test/util/satisfy.js @@ -0,0 +1,102 @@ +var satisfy = require('satisfy') + , Satisfaction = satisfy.Satisfaction; + +var _fill = Satisfaction.prototype.fill; +Satisfaction.prototype.fill = function () { + if (arguments.length === 1) { + var namesToVals = arguments[0]; + for (var name in namesToVals) { + _fill.call(this, 'input[name="' + name + '"]', namesToVals[name]); + } + return this; + } + if (arguments.length === 2) { + if ('string' === typeof arguments[1]) { + return _fill.apply(this, arguments); + } + var formSelector = this._currFormSelector = arguments[0] + , namesToVals = arguments[1]; + for (var name in namesToVals) { + this.fill(formSelector + ' input[name="' + name + '"]', namesToVals[name]); + } + return this; + } + throw new Error("Unsupported function signature for Satisfaction.prototype.fill"); +}; + +Satisfaction.prototype.submit = function submit () { + var submitSelector = '' + , currFormSelector = this._currFormSelector; + if (currFormSelector) { + submitSelector += currFormSelector + ' '; + } + submitSelector += 'input[type=submit]'; + return this.click(submitSelector); +} + +var _expect = Satisfaction.prototype.expect; +Satisfaction.prototype.expect = function (selector) { + return new Assertion(selector, this); +}; + +var flags = { + not: ['to', 'have'] + , to: ['not', 'have'] + , have: [] +}; + +function Assertion (selector, satisfaction, flag, parent) { + this.selector = selector; + this.satisfaction = satisfaction; + + if (flag == 'not') { + this.onComplete = function () { + this.selector = ':not(' + this.selector + ')'; + } + } + + this.flags = {}; + + if (undefined != parent) { + this.flags[flag] = true; + for (var i in parent.flags) if (parent.flags.hasOwnProperty(i)) { + this.flags[i] = true; + } + if (parent.onComplete) this.onComplete = parent.onComplete; + } + + var $flags = flag ? flags[flag] : Object.keys(flags) + , self = this; + + for (var i = $flags.length; i--; ) { + // avoid recursion + if (this.flags[$flags[i]]) continue; + + var name = $flags[i] + , assertion = new Assertion(this.selector, this.satisfaction, name, this); + + this[name] = assertion; + } +} + +Assertion.prototype.text = function (str) { + this.selector += ':contains(' + str + ')' + return this +}; + +// Delegate any methods with satisfaction method names back to satisfaction + +var satisfyMethodNames = ['run', 'fill', 'expect', 'click', 'submit']; +for (var i = satisfyMethodNames.length; i--; ) { + var name = satisfyMethodNames[i]; + (function (name) { + Assertion.prototype[name] = function () { + if (this.onComplete) this.onComplete(); + console.log(this.selector); + _expect.call(this.satisfaction, this.selector); + return this.satisfaction[name].apply(this.satisfaction, arguments); + }; + })(name); +} + +module.exports = satisfy; diff --git a/node_modules/querystring/History.md b/node_modules/querystring/History.md new file mode 100644 index 0000000..45e0606 --- /dev/null +++ b/node_modules/querystring/History.md @@ -0,0 +1,7 @@ +# 0.0.3 / 2011-04-16 # + - Support for AMD module loaders +# 0.0.2 / 2011-04-16 # + - Ported unit tests + - Removed functionality that depended on Buffers +# 0.0.1 / 2011-04-15 # + - Initial release diff --git a/node_modules/querystring/Readme.md b/node_modules/querystring/Readme.md new file mode 100644 index 0000000..337b9a4 --- /dev/null +++ b/node_modules/querystring/Readme.md @@ -0,0 +1,8 @@ +# querystring # + +Node's querystring module for all engines. + +## Install ## + + npm install querystring + diff --git a/node_modules/querystring/package.json b/node_modules/querystring/package.json new file mode 100644 index 0000000..b4e0738 --- /dev/null +++ b/node_modules/querystring/package.json @@ -0,0 +1,26 @@ +{ + "name": "querystring", + "id": "querystring", + "version": "0.1.0", + "description": "Node's querystring module for all engines.", + "keywords": [ "commonjs", "query", "querystring" ], + "author": "Irakli Gozalishvili ", + "repository": { + "type": "git", + "url": "git://github.com/Gozala/querystring.git", + "web": "https://github.com/Gozala/querystring" + }, + "bugs": { + "url": "http://github.com/Gozala/querystring/issues/" + }, + "devDependencies": { + "test": ">=0.4.3" + }, + "main": "./querystring.js", + "engines": { + "node": ">=0.4.x" + }, + "scripts": { + "test": "node tests/test-querystring.js" + } +} diff --git a/node_modules/querystring/querystring.js b/node_modules/querystring/querystring.js new file mode 100644 index 0000000..8e5d4c5 --- /dev/null +++ b/node_modules/querystring/querystring.js @@ -0,0 +1,108 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// Query String Utilities + +(typeof define === "undefined" ? function($) { $(require, exports, module) } : define)(function(require, exports, module, undefined) { +"use strict"; + +var QueryString = exports; + +function charCode(c) { + return c.charCodeAt(0); +} + +QueryString.unescape = decodeURIComponent; +QueryString.escape = encodeURIComponent; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + + +QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + obj = (obj === null) ? undefined : obj; + + switch (typeof obj) { + case 'object': + return Object.keys(obj).map(function(k) { + if (Array.isArray(obj[k])) { + return obj[k].map(function(v) { + return QueryString.escape(stringifyPrimitive(k)) + + eq + + QueryString.escape(stringifyPrimitive(v)); + }).join(sep); + } else { + return QueryString.escape(stringifyPrimitive(k)) + + eq + + QueryString.escape(stringifyPrimitive(obj[k])); + } + }).join(sep); + + default: + if (!name) return ''; + return QueryString.escape(stringifyPrimitive(name)) + eq + + QueryString.escape(stringifyPrimitive(obj)); + } +}; + +// Parse a key=val string. +QueryString.parse = QueryString.decode = function(qs, sep, eq) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + qs.split(sep).forEach(function(kvp) { + var x = kvp.split(eq); + var k = QueryString.unescape(x[0], true); + var v = QueryString.unescape(x.slice(1).join(eq), true); + + if (!(k in obj)) { + obj[k] = v; + } else if (!Array.isArray(obj[k])) { + obj[k] = [obj[k], v]; + } else { + obj[k].push(v); + } + }); + + return obj; +}; + +}); diff --git a/node_modules/querystring/tests/test-querystring.js b/node_modules/querystring/tests/test-querystring.js new file mode 100644 index 0000000..4a37c61 --- /dev/null +++ b/node_modules/querystring/tests/test-querystring.js @@ -0,0 +1,203 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +"use strict"; + +// test using assert +var qs = require('../querystring'); + +// folding block, commented to pass gjslint +// {{{ +// [ wonkyQS, canonicalQS, obj ] +var qsTestCases = [ + ['foo=918854443121279438895193', + 'foo=918854443121279438895193', + {'foo': '918854443121279438895193'}], + ['foo=bar', 'foo=bar', {'foo': 'bar'}], + ['foo=bar&foo=quux', 'foo=bar&foo=quux', {'foo': ['bar', 'quux']}], + ['foo=1&bar=2', 'foo=1&bar=2', {'foo': '1', 'bar': '2'}], + // ['my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F', + // 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', + // {'my weird field': 'q1!2"\'w$5&7/z8)?' }], + ['foo%3Dbaz=bar', 'foo%3Dbaz=bar', {'foo=baz': 'bar'}], + ['foo=baz=bar', 'foo=baz%3Dbar', {'foo': 'baz=bar'}], + ['str=foo&arr=1&arr=2&arr=3&somenull=&undef=', + 'str=foo&arr=1&arr=2&arr=3&somenull=&undef=', + { 'str': 'foo', + 'arr': ['1', '2', '3'], + 'somenull': '', + 'undef': ''}], + [' foo = bar ', '%20foo%20=%20bar%20', {' foo ': ' bar '}], + // disable test that fails ['foo=%zx', 'foo=%25zx', {'foo': '%zx'}], + ['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }] +]; + +// [ wonkyQS, canonicalQS, obj ] +var qsColonTestCases = [ + ['foo:bar', 'foo:bar', {'foo': 'bar'}], + ['foo:bar;foo:quux', 'foo:bar;foo:quux', {'foo': ['bar', 'quux']}], + ['foo:1&bar:2;baz:quux', + 'foo:1%26bar%3A2;baz:quux', + {'foo': '1&bar:2', 'baz': 'quux'}], + ['foo%3Abaz:bar', 'foo%3Abaz:bar', {'foo:baz': 'bar'}], + ['foo:baz:bar', 'foo:baz%3Abar', {'foo': 'baz:bar'}] +]; + +// [wonkyObj, qs, canonicalObj] +var extendedFunction = function() {}; +extendedFunction.prototype = {a: 'b'}; +var qsWeirdObjects = [ + [{regexp: /./g}, 'regexp=', {'regexp': ''}], + [{regexp: new RegExp('.', 'g')}, 'regexp=', {'regexp': ''}], + [{fn: function() {}}, 'fn=', {'fn': ''}], + [{fn: new Function('')}, 'fn=', {'fn': ''}], + [{math: Math}, 'math=', {'math': ''}], + [{e: extendedFunction}, 'e=', {'e': ''}], + [{d: new Date()}, 'd=', {'d': ''}], + [{d: Date}, 'd=', {'d': ''}], + [{f: new Boolean(false), t: new Boolean(true)}, 'f=&t=', {'f': '', 't': ''}], + [{f: false, t: true}, 'f=false&t=true', {'f': 'false', 't': 'true'}], + [{n: null}, 'n=', {'n': ''}], + [{nan: NaN}, 'nan=', {'nan': ''}], + [{inf: Infinity}, 'inf=', {'inf': ''}] +]; +// }}} + +var qsNoMungeTestCases = [ + ['', {}], + ['foo=bar&foo=baz', {'foo': ['bar', 'baz']}], + ['blah=burp', {'blah': 'burp'}], + ['gragh=1&gragh=3&goo=2', {'gragh': ['1', '3'], 'goo': '2'}], + ['frappucino=muffin&goat%5B%5D=scone&pond=moose', + {'frappucino': 'muffin', 'goat[]': 'scone', 'pond': 'moose'}], + ['trololol=yes&lololo=no', {'trololol': 'yes', 'lololo': 'no'}] +]; + +exports['test basic'] = function(assert) { + assert.strictEqual('918854443121279438895193', + qs.parse('id=918854443121279438895193').id, + 'prase id=918854443121279438895193'); +}; + +exports['test that the canonical qs is parsed properly'] = function(assert) { + qsTestCases.forEach(function(testCase) { + assert.deepEqual(testCase[2], qs.parse(testCase[0]), + 'parse ' + testCase[0]); + }); +}; + + +exports['test that the colon test cases can do the same'] = function(assert) { + qsColonTestCases.forEach(function(testCase) { + assert.deepEqual(testCase[2], qs.parse(testCase[0], ';', ':'), + 'parse ' + testCase[0] + ' -> ; :'); + }); +}; + +exports['test the weird objects, that they get parsed properly'] = function(assert) { + qsWeirdObjects.forEach(function(testCase) { + assert.deepEqual(testCase[2], qs.parse(testCase[1]), + 'parse ' + testCase[1]); + }); +}; + +exports['test non munge test cases'] = function(assert) { + qsNoMungeTestCases.forEach(function(testCase) { + assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '=', false), + 'stringify ' + JSON.stringify(testCase[1]) + ' -> & ='); + }); +}; + +exports['test the nested qs-in-qs case'] = function(assert) { + var f = qs.parse('a=b&q=x%3Dy%26y%3Dz'); + f.q = qs.parse(f.q); + assert.deepEqual(f, { a: 'b', q: { x: 'y', y: 'z' } }, + 'parse a=b&q=x%3Dy%26y%3Dz'); +}; + +exports['test nested in colon'] = function(assert) { + var f = qs.parse('a:b;q:x%3Ay%3By%3Az', ';', ':'); + f.q = qs.parse(f.q, ';', ':'); + assert.deepEqual(f, { a: 'b', q: { x: 'y', y: 'z' } }, + 'parse a:b;q:x%3Ay%3By%3Az -> ; :'); +}; + +exports['test stringifying'] = function(assert) { + qsTestCases.forEach(function(testCase) { + assert.equal(testCase[1], qs.stringify(testCase[2]), + 'stringify ' + JSON.stringify(testCase[2])); + }); + + qsColonTestCases.forEach(function(testCase) { + assert.equal(testCase[1], qs.stringify(testCase[2], ';', ':'), + 'stringify ' + JSON.stringify(testCase[2]) + ' -> ; :'); + }); + + qsWeirdObjects.forEach(function(testCase) { + assert.equal(testCase[1], qs.stringify(testCase[0]), + 'stringify ' + JSON.stringify(testCase[0])); + }); +}; + +exports['test stringifying nested'] = function(assert) { + var f = qs.stringify({ + a: 'b', + q: qs.stringify({ + x: 'y', + y: 'z' + }) + }); + assert.equal(f, 'a=b&q=x%3Dy%26y%3Dz', + JSON.stringify({ + a: 'b', + 'qs.stringify -> q': { + x: 'y', + y: 'z' + } + })); + + var threw = false; + try { qs.parse(undefined); } catch(error) { threw = true; } + assert.ok(!threw, "does not throws on undefined"); +}; + +exports['test nested in colon'] = function(assert) { + var f = qs.stringify({ + a: 'b', + q: qs.stringify({ + x: 'y', + y: 'z' + }, ';', ':') + }, ';', ':'); + assert.equal(f, 'a:b;q:x%3Ay%3By%3Az', + 'stringify ' + JSON.stringify({ + a: 'b', + 'qs.stringify -> q': { + x: 'y', + y: 'z' + } + }) + ' -> ; : '); + + + assert.deepEqual({}, qs.parse(), 'parse undefined'); +}; + +require("test").run(exports); diff --git a/node_modules/request/LICENSE b/node_modules/request/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/node_modules/request/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/request/README.md b/node_modules/request/README.md new file mode 100644 index 0000000..d1f5c56 --- /dev/null +++ b/node_modules/request/README.md @@ -0,0 +1,310 @@ +# Request -- Simplified HTTP request method + +## Install + +
    +  npm install request
    +
    + +Or from source: + +
    +  git clone git://github.com/mikeal/request.git 
    +  cd request
    +  npm link
    +
    + +## Super simple to use + +Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. + +```javascript +var request = require('request'); +request('http://www.google.com/', function (error, response, body) { + if (!error && response.statusCode == 200) { + console.log(body) // Print the google web page. + } +}) +``` + +## Streaming + +You can stream any response to a file stream. + +```javascript +request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) +``` + +You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. + +```javascript +fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) +``` + +Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. + +```javascript +request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) +``` + +Now let's get fancy. + +```javascript +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + if (req.method === 'PUT') { + req.pipe(request.put('http://mysite.com/doodle.png')) + } else if (req.method === 'GET' || req.method === 'HEAD') { + request.get('http://mysite.com/doodle.png').pipe(resp) + } + } +}) +``` + +You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: + +```javascript +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + var x = request('http://mysite.com/doodle.png') + req.pipe(x) + x.pipe(resp) + } +}) +``` + +And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) + +```javascript +req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) +``` + +Also, none of this new functionality conflicts with requests previous features, it just expands them. + +```javascript +var r = request.defaults({'proxy':'http://localproxy.com/'}) + +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + r.get('http://google.com/doodle.png').pipe(resp) + } +}) +``` +You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. + +## Forms + +`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API. + +Url encoded forms are simple + +```javascript +request.post('http://service.com/upload', {form:{key:'value'}}) +// or +request.post('http://service.com/upload').form({key:'value'}) +``` + +For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you. + +```javascript +var r = request.post('http://service.com/upload') +var form = r.form() +form.append('my_field', 'my_value') +form.append('my_buffer', new Buffer([1, 2, 3])) +form.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png')) +form.append('remote_file', request('http://google.com/doodle.png')) +``` + +## OAuth Signing + +```javascript +// Twitter OAuth +var qs = require('querystring') + , oauth = + { callback: 'http://mysite.com/callback/' + , consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + } + , url = 'https://api.twitter.com/oauth/request_token' + ; +request.post({url:url, oauth:oauth}, function (e, r, body) { + // Assume by some stretch of magic you aquired the verifier + var access_token = qs.parse(body) + , oauth = + { consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + , token: access_token.oauth_token + , verifier: VERIFIER + , token_secret: access_token.oauth_token_secret + } + , url = 'https://api.twitter.com/oauth/access_token' + ; + request.post({url:url, oauth:oauth}, function (e, r, body) { + var perm_token = qs.parse(body) + , oauth = + { consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + , token: perm_token.oauth_token + , token_secret: perm_token.oauth_token_secret + } + , url = 'https://api.twitter.com/1/users/show.json?' + , params = + { screen_name: perm_token.screen_name + , user_id: perm_token.user_id + } + ; + url += qs.stringify(params) + request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { + console.log(user) + }) + }) +}) +``` + + + +### request(options, callback) + +The first argument can be either a url or an options object. The only required option is uri, all others are optional. + +* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() +* `qs` - object containing querystring values to be appended to the uri +* `method` - http method, defaults to GET +* `headers` - http headers, defaults to {} +* `body` - entity body for POST and PUT requests. Must be buffer or string. +* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request. +* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json. +* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. +* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. +* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. +* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. +* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. +* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. +* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. +* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request +* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. +* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. +* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. +* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) +* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services) + + +The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. + +## Convenience methods + +There are also shorthand methods for different HTTP METHODs and some other conveniences. + +### request.defaults(options) + +This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. + +### request.put + +Same as request() but defaults to `method: "PUT"`. + +```javascript +request.put(url) +``` + +### request.post + +Same as request() but defaults to `method: "POST"`. + +```javascript +request.post(url) +``` + +### request.head + +Same as request() but defaults to `method: "HEAD"`. + +```javascript +request.head(url) +``` + +### request.del + +Same as request() but defaults to `method: "DELETE"`. + +```javascript +request.del(url) +``` + +### request.get + +Alias to normal request method for uniformity. + +```javascript +request.get(url) +``` +### request.cookie + +Function that creates a new cookie. + +```javascript +request.cookie('cookie_string_here') +``` +### request.jar + +Function that creates a new cookie jar. + +```javascript +request.jar() +``` + + +## Examples: + +```javascript + var request = require('request') + , rand = Math.floor(Math.random()*100000000).toString() + ; + request( + { method: 'PUT' + , uri: 'http://mikeal.iriscouch.com/testjs/' + rand + , multipart: + [ { 'content-type': 'application/json' + , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + } + , { body: 'I am an attachment' } + ] + } + , function (error, response, body) { + if(response.statusCode == 201){ + console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) + } else { + console.log('error: '+ response.statusCode) + console.log(body) + } + } + ) +``` +Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). + +```javascript +var request = request.defaults({jar: false}) +request('http://www.google.com/', function () { + request('http://images.google.com/') +}) +``` + +If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: + +```javascript +var j = request.jar() +var request = request.defaults({jar:j}) +request('http://www.google.com/', function () { + request('http://images.google.com/') +}) +``` +OR + +```javascript +var j = request.jar() +var cookie = request.cookie('your_cookie_here') +j.add(cookie) +request({url: 'http://www.google.com/', jar: j}, function () { + request('http://images.google.com/') +}) +``` diff --git a/node_modules/request/aws.js b/node_modules/request/aws.js new file mode 100644 index 0000000..4d8d950 --- /dev/null +++ b/node_modules/request/aws.js @@ -0,0 +1,191 @@ + +/*! + * knox - auth + * Copyright(c) 2010 LearnBoost + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var crypto = require('crypto') + , parse = require('url').parse + ; + +/** + * Valid keys. + */ + +var keys = + [ 'acl' + , 'location' + , 'logging' + , 'notification' + , 'partNumber' + , 'policy' + , 'requestPayment' + , 'torrent' + , 'uploadId' + , 'uploads' + , 'versionId' + , 'versioning' + , 'versions' + , 'website' + ] + +/** + * Return an "Authorization" header value with the given `options` + * in the form of "AWS :" + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.authorization = function(options){ + return 'AWS ' + options.key + ':' + exports.sign(options) +} + +/** + * Simple HMAC-SHA1 Wrapper + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.hmacSha1 = function(options){ + return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64') +} + +/** + * Create a base64 sha1 HMAC for `options`. + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.sign = function(options){ + options.message = exports.stringToSign(options) + return exports.hmacSha1(options) +} + +/** + * Create a base64 sha1 HMAC for `options`. + * + * Specifically to be used with S3 presigned URLs + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.signQuery = function(options){ + options.message = exports.queryStringToSign(options) + return exports.hmacSha1(options) +} + +/** + * Return a string for sign() with the given `options`. + * + * Spec: + * + * \n + * \n + * \n + * \n + * [headers\n] + * + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.stringToSign = function(options){ + var headers = options.amazonHeaders || '' + if (headers) headers += '\n' + var r = + [ options.verb + , options.md5 + , options.contentType + , options.date.toUTCString() + , headers + options.resource + ] + return r.join('\n') +} + +/** + * Return a string for sign() with the given `options`, but is meant exclusively + * for S3 presigned URLs + * + * Spec: + * + * \n + * + * + * @param {Object} options + * @return {String} + * @api private + */ + +exports.queryStringToSign = function(options){ + return 'GET\n\n\n' + options.date + '\n' + options.resource +}; + +/** + * Perform the following: + * + * - ignore non-amazon headers + * - lowercase fields + * - sort lexicographically + * - trim whitespace between ":" + * - join with newline + * + * @param {Object} headers + * @return {String} + * @api private + */ + +exports.canonicalizeHeaders = function(headers){ + var buf = [] + , fields = Object.keys(headers) + ; + for (var i = 0, len = fields.length; i < len; ++i) { + var field = fields[i] + , val = headers[field] + , field = field.toLowerCase() + ; + if (0 !== field.indexOf('x-amz')) continue + buf.push(field + ':' + val) + } + return buf.sort().join('\n') +}; + +/** + * Perform the following: + * + * - ignore non sub-resources + * - sort lexicographically + * + * @param {String} resource + * @return {String} + * @api private + */ + +exports.canonicalizeResource = function(resource){ + var url = parse(resource, true) + , path = url.pathname + , buf = [] + ; + + Object.keys(url.query).forEach(function(key){ + if (!~keys.indexOf(key)) return + var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]) + buf.push(key + val) + }) + + return path + (buf.length ? '?' + buf.sort().join('&') : '') +}; diff --git a/node_modules/request/forever.js b/node_modules/request/forever.js new file mode 100644 index 0000000..1e1d4b9 --- /dev/null +++ b/node_modules/request/forever.js @@ -0,0 +1,103 @@ +module.exports = ForeverAgent +ForeverAgent.SSL = ForeverAgentSSL + +var util = require('util') + , Agent = require('http').Agent + , net = require('net') + , tls = require('tls') + , AgentSSL = require('https').Agent + +function ForeverAgent(options) { + var self = this + self.options = options || {} + self.requests = {} + self.sockets = {} + self.freeSockets = {} + self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets + self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets + self.on('free', function(socket, host, port) { + var name = host + ':' + port + if (self.requests[name] && self.requests[name].length) { + self.requests[name].shift().onSocket(socket) + } else if (self.sockets[name].length < self.minSockets) { + if (!self.freeSockets[name]) self.freeSockets[name] = [] + self.freeSockets[name].push(socket) + + // if an error happens while we don't use the socket anyway, meh, throw the socket away + function onIdleError() { + socket.destroy() + } + socket._onIdleError = onIdleError + socket.on('error', onIdleError) + } else { + // If there are no pending requests just destroy the + // socket and it will get removed from the pool. This + // gets us out of timeout issues and allows us to + // default to Connection:keep-alive. + socket.destroy() + } + }) + +} +util.inherits(ForeverAgent, Agent) + +ForeverAgent.defaultMinSockets = 5 + + +ForeverAgent.prototype.createConnection = net.createConnection +ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest +ForeverAgent.prototype.addRequest = function(req, host, port) { + var name = host + ':' + port + if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { + var idleSocket = this.freeSockets[name].pop() + idleSocket.removeListener('error', idleSocket._onIdleError) + delete idleSocket._onIdleError + req._reusedSocket = true + req.onSocket(idleSocket) + } else { + this.addRequestNoreuse(req, host, port) + } +} + +ForeverAgent.prototype.removeSocket = function(s, name, host, port) { + if (this.sockets[name]) { + var index = this.sockets[name].indexOf(s) + if (index !== -1) { + this.sockets[name].splice(index, 1) + } + } else if (this.sockets[name] && this.sockets[name].length === 0) { + // don't leak + delete this.sockets[name] + delete this.requests[name] + } + + if (this.freeSockets[name]) { + var index = this.freeSockets[name].indexOf(s) + if (index !== -1) { + this.freeSockets[name].splice(index, 1) + if (this.freeSockets[name].length === 0) { + delete this.freeSockets[name] + } + } + } + + if (this.requests[name] && this.requests[name].length) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(name, host, port).emit('free') + } +} + +function ForeverAgentSSL (options) { + ForeverAgent.call(this, options) +} +util.inherits(ForeverAgentSSL, ForeverAgent) + +ForeverAgentSSL.prototype.createConnection = createConnectionSSL +ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest + +function createConnectionSSL (port, host, options) { + options.port = port + options.host = host + return tls.connect(options) +} diff --git a/node_modules/request/main.js b/node_modules/request/main.js new file mode 100644 index 0000000..27b470b --- /dev/null +++ b/node_modules/request/main.js @@ -0,0 +1,1123 @@ +// Copyright 2010-2012 Mikeal Rogers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +var http = require('http') + , https = false + , tls = false + , url = require('url') + , util = require('util') + , stream = require('stream') + , qs = require('querystring') + , oauth = require('./oauth') + , uuid = require('./uuid') + , ForeverAgent = require('./forever') + , Cookie = require('./vendor/cookie') + , CookieJar = require('./vendor/cookie/jar') + , cookieJar = new CookieJar + , tunnel = require('./tunnel') + , aws = require('./aws') + + , mime = require('mime') + , FormData = require('form-data') + ; + +if (process.logging) { + var log = process.logging('request') +} + +try { + https = require('https') +} catch (e) {} + +try { + tls = require('tls') +} catch (e) {} + +function toBase64 (str) { + return (new Buffer(str || "", "ascii")).toString("base64") +} + +// Hacky fix for pre-0.4.4 https +if (https && !https.Agent) { + https.Agent = function (options) { + http.Agent.call(this, options) + } + util.inherits(https.Agent, http.Agent) + https.Agent.prototype._getConnection = function (host, port, cb) { + var s = tls.connect(port, host, this.options, function () { + // do other checks here? + if (cb) cb() + }) + return s + } +} + +function isReadStream (rs) { + if (rs.readable && rs.path && rs.mode) { + return true + } +} + +function copy (obj) { + var o = {} + Object.keys(obj).forEach(function (i) { + o[i] = obj[i] + }) + return o +} + +var isUrl = /^https?:/ + +var globalPool = {} + +function Request (options) { + stream.Stream.call(this) + this.readable = true + this.writable = true + + if (typeof options === 'string') { + options = {uri:options} + } + + var reserved = Object.keys(Request.prototype) + for (var i in options) { + if (reserved.indexOf(i) === -1) { + this[i] = options[i] + } else { + if (typeof options[i] === 'function') { + delete options[i] + } + } + } + options = copy(options) + + this.init(options) +} +util.inherits(Request, stream.Stream) +Request.prototype.init = function (options) { + var self = this + + if (!options) options = {} + if (process.env.NODE_DEBUG && /request/.test(process.env.NODE_DEBUG)) console.error('REQUEST', options) + if (!self.pool && self.pool !== false) self.pool = globalPool + self.dests = [] + self.__isRequestRequest = true + + // Protect against double callback + if (!self._callback && self.callback) { + self._callback = self.callback + self.callback = function () { + if (self._callbackCalled) return // Print a warning maybe? + self._callback.apply(self, arguments) + self._callbackCalled = true + } + self.on('error', self.callback.bind()) + self.on('complete', self.callback.bind(self, null)) + } + + if (self.url) { + // People use this property instead all the time so why not just support it. + self.uri = self.url + delete self.url + } + + if (!self.uri) { + // this will throw if unhandled but is handleable when in a redirect + return self.emit('error', new Error("options.uri is a required argument")) + } else { + if (typeof self.uri == "string") self.uri = url.parse(self.uri) + } + if (self.proxy) { + if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) + + // do the HTTP CONNECT dance using koichik/node-tunnel + if (http.globalAgent && self.uri.protocol === "https:") { + var tunnelFn = self.proxy.protocol === "http:" + ? tunnel.httpsOverHttp : tunnel.httpsOverHttps + + var tunnelOptions = { proxy: { host: self.proxy.hostname + , port: +self.proxy.port + , proxyAuth: self.proxy.auth } + , ca: this.ca } + + self.agent = tunnelFn(tunnelOptions) + self.tunnel = true + } + } + + if (!self.uri.host || !self.uri.pathname) { + // Invalid URI: it may generate lot of bad errors, like "TypeError: Cannot call method 'indexOf' of undefined" in CookieJar + // Detect and reject it as soon as possible + var faultyUri = url.format(self.uri) + var message = 'Invalid URI "' + faultyUri + '"' + if (Object.keys(options).length === 0) { + // No option ? This can be the sign of a redirect + // As this is a case where the user cannot do anything (he didn't call request directly with this URL) + // he should be warned that it can be caused by a redirection (can save some hair) + message += '. This can be caused by a crappy redirection.' + } + self.emit('error', new Error(message)) + return // This error was fatal + } + + self._redirectsFollowed = self._redirectsFollowed || 0 + self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 + self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true + self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false + if (self.followRedirect || self.followAllRedirects) + self.redirects = self.redirects || [] + + self.headers = self.headers ? copy(self.headers) : {} + + self.setHost = false + if (!self.headers.host) { + self.headers.host = self.uri.hostname + if (self.uri.port) { + if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && + !(self.uri.port === 443 && self.uri.protocol === 'https:') ) + self.headers.host += (':'+self.uri.port) + } + self.setHost = true + } + + self.jar(self._jar || options.jar) + + if (!self.uri.pathname) {self.uri.pathname = '/'} + if (!self.uri.port) { + if (self.uri.protocol == 'http:') {self.uri.port = 80} + else if (self.uri.protocol == 'https:') {self.uri.port = 443} + } + + if (self.proxy && !self.tunnel) { + self.port = self.proxy.port + self.host = self.proxy.hostname + } else { + self.port = self.uri.port + self.host = self.uri.hostname + } + + self.clientErrorHandler = function (error) { + if (self._aborted) return + + if (self.setHost) delete self.headers.host + if (self.req._reusedSocket && error.code === 'ECONNRESET' + && self.agent.addRequestNoreuse) { + self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } + self.start() + self.req.end() + return + } + if (self.timeout && self.timeoutTimer) { + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null + } + self.emit('error', error) + } + + self._parserErrorHandler = function (error) { + if (this.res) { + if (this.res.request) { + this.res.request.emit('error', error) + } else { + this.res.emit('error', error) + } + } else { + this._httpMessage.emit('error', error) + } + } + + if (options.form) { + self.form(options.form) + } + + if (options.oauth) { + self.oauth(options.oauth) + } + + if (options.aws) { + self.aws(options.aws) + } + + if (self.uri.auth && !self.headers.authorization) { + self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) + } + if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { + self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) + } + + if (options.qs) self.qs(options.qs) + + if (self.uri.path) { + self.path = self.uri.path + } else { + self.path = self.uri.pathname + (self.uri.search || "") + } + + if (self.path.length === 0) self.path = '/' + + if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) + + if (options.json) { + self.json(options.json) + } else if (options.multipart) { + self.boundary = uuid() + self.multipart(options.multipart) + } + + if (self.body) { + var length = 0 + if (!Buffer.isBuffer(self.body)) { + if (Array.isArray(self.body)) { + for (var i = 0; i < self.body.length; i++) { + length += self.body[i].length + } + } else { + self.body = new Buffer(self.body) + length = self.body.length + } + } else { + length = self.body.length + } + if (length) { + if(!self.headers['content-length'] && !self.headers['Content-Length']) + self.headers['content-length'] = length + } else { + throw new Error('Argument error, options.body.') + } + } + + var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol + , defaultModules = {'http:':http, 'https:':https} + , httpModules = self.httpModules || {} + ; + self.httpModule = httpModules[protocol] || defaultModules[protocol] + + if (!self.httpModule) return this.emit('error', new Error("Invalid protocol")) + + if (options.ca) self.ca = options.ca + + if (!self.agent) { + if (options.agentOptions) self.agentOptions = options.agentOptions + + if (options.agentClass) { + self.agentClass = options.agentClass + } else if (options.forever) { + self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL + } else { + self.agentClass = self.httpModule.Agent + } + } + + if (self.pool === false) { + self.agent = false + } else { + self.agent = self.agent || self.getAgent() + if (self.maxSockets) { + // Don't use our pooling if node has the refactored client + self.agent.maxSockets = self.maxSockets + } + if (self.pool.maxSockets) { + // Don't use our pooling if node has the refactored client + self.agent.maxSockets = self.pool.maxSockets + } + } + + self.once('pipe', function (src) { + if (self.ntick && self._started) throw new Error("You cannot pipe to this stream after the outbound request has started.") + self.src = src + if (isReadStream(src)) { + if (!self.headers['content-type'] && !self.headers['Content-Type']) + self.headers['content-type'] = mime.lookup(src.path) + } else { + if (src.headers) { + for (var i in src.headers) { + if (!self.headers[i]) { + self.headers[i] = src.headers[i] + } + } + } + if (self._json && !self.headers['content-type'] && !self.headers['Content-Type']) + self.headers['content-type'] = 'application/json' + if (src.method && !self.method) { + self.method = src.method + } + } + + self.on('pipe', function () { + console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") + }) + }) + + process.nextTick(function () { + if (self._aborted) return + + if (self._form) { + self.setHeaders(self._form.getHeaders()) + self._form.pipe(self) + } + if (self.body) { + if (Array.isArray(self.body)) { + self.body.forEach(function (part) { + self.write(part) + }) + } else { + self.write(self.body) + } + self.end() + } else if (self.requestBodyStream) { + console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") + self.requestBodyStream.pipe(self) + } else if (!self.src) { + if (self.method !== 'GET' && typeof self.method !== 'undefined') { + self.headers['content-length'] = 0 + } + self.end() + } + self.ntick = true + }) +} + +// Must call this when following a redirect from https to http or vice versa +// Attempts to keep everything as identical as possible, but update the +// httpModule, Tunneling agent, and/or Forever Agent in use. +Request.prototype._updateProtocol = function () { + var self = this + var protocol = self.uri.protocol + + if (protocol === 'https:') { + // previously was doing http, now doing https + // if it's https, then we might need to tunnel now. + if (self.proxy) { + self.tunnel = true + var tunnelFn = self.proxy.protocol === 'http:' + ? tunnel.httpsOverHttp : tunnel.httpsOverHttps + var tunnelOptions = { proxy: { host: self.proxy.hostname + , post: +self.proxy.port + , proxyAuth: self.proxy.auth } + , ca: self.ca } + self.agent = tunnelFn(tunnelOptions) + return + } + + self.httpModule = https + switch (self.agentClass) { + case ForeverAgent: + self.agentClass = ForeverAgent.SSL + break + case http.Agent: + self.agentClass = https.Agent + break + default: + // nothing we can do. Just hope for the best. + return + } + + // if there's an agent, we need to get a new one. + if (self.agent) self.agent = self.getAgent() + + } else { + if (log) log('previously https, now http') + // previously was doing https, now doing http + // stop any tunneling. + if (self.tunnel) self.tunnel = false + self.httpModule = http + switch (self.agentClass) { + case ForeverAgent.SSL: + self.agentClass = ForeverAgent + break + case https.Agent: + self.agentClass = http.Agent + break + default: + // nothing we can do. just hope for the best + return + } + + // if there's an agent, then get a new one. + if (self.agent) { + self.agent = null + self.agent = self.getAgent() + } + } +} + +Request.prototype.getAgent = function () { + var Agent = this.agentClass + var options = {} + if (this.agentOptions) { + for (var i in this.agentOptions) { + options[i] = this.agentOptions[i] + } + } + if (this.ca) options.ca = this.ca + + var poolKey = '' + + // different types of agents are in different pools + if (Agent !== this.httpModule.Agent) { + poolKey += Agent.name + } + + if (!this.httpModule.globalAgent) { + // node 0.4.x + options.host = this.host + options.port = this.port + if (poolKey) poolKey += ':' + poolKey += this.host + ':' + this.port + } + + // ca option is only relevant if proxy or destination are https + var proxy = this.proxy + if (typeof proxy === 'string') proxy = url.parse(proxy) + var caRelevant = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:' + if (options.ca && caRelevant) { + if (poolKey) poolKey += ':' + poolKey += options.ca + } + + if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { + // not doing anything special. Use the globalAgent + return this.httpModule.globalAgent + } + + // we're using a stored agent. Make sure it's protocol-specific + poolKey = this.uri.protocol + poolKey + + // already generated an agent for this setting + if (this.pool[poolKey]) return this.pool[poolKey] + + return this.pool[poolKey] = new Agent(options) +} + +Request.prototype.start = function () { + var self = this + + if (self._aborted) return + + self._started = true + self.method = self.method || 'GET' + self.href = self.uri.href + if (log) log('%method %href', self) + + if (self.src && self.src.stat && self.src.stat.size && !self.headers['content-length'] && !self.headers['Content-Length']) { + self.headers['content-length'] = self.src.stat.size + } + if (self._aws) { + self.aws(self._aws, true) + } + self.req = self.httpModule.request(self, function (response) { + if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) { + response.connection.once('error', self._parserErrorHandler) + } + if (self._aborted) return + if (self._paused) response.pause() + + self.response = response + response.request = self + response.toJSON = toJSON + + if (self.httpModule === https && + self.strictSSL && + !response.client.authorized) { + var sslErr = response.client.authorizationError + self.emit('error', new Error('SSL Error: '+ sslErr)) + return + } + + if (self.setHost) delete self.headers.host + if (self.timeout && self.timeoutTimer) { + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null + } + + var addCookie = function (cookie) { + if (self._jar) self._jar.add(new Cookie(cookie)) + else cookieJar.add(new Cookie(cookie)) + } + + if (response.headers['set-cookie'] && (!self._disableCookies)) { + if (Array.isArray(response.headers['set-cookie'])) response.headers['set-cookie'].forEach(addCookie) + else addCookie(response.headers['set-cookie']) + } + + if (response.statusCode >= 300 && response.statusCode < 400 && + (self.followAllRedirects || + (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && + response.headers.location) { + if (self._redirectsFollowed >= self.maxRedirects) { + self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+self.uri.href)) + return + } + self._redirectsFollowed += 1 + + if (!isUrl.test(response.headers.location)) { + response.headers.location = url.resolve(self.uri.href, response.headers.location) + } + + var uriPrev = self.uri + self.uri = url.parse(response.headers.location) + + // handle the case where we change protocol from https to http or vice versa + if (self.uri.protocol !== uriPrev.protocol) { + self._updateProtocol() + } + + self.redirects.push( + { statusCode : response.statusCode + , redirectUri: response.headers.location + } + ) + if (self.followAllRedirects) self.method = 'GET' + // self.method = 'GET' // Force all redirects to use GET || commented out fixes #215 + delete self.src + delete self.req + delete self.agent + delete self._started + delete self.body + delete self._form + if (self.headers) { + delete self.headers.host + delete self.headers['content-type'] + delete self.headers['content-length'] + } + if (log) log('Redirect to %uri', self) + self.init() + return // Ignore the rest of the response + } else { + self._redirectsFollowed = self._redirectsFollowed || 0 + // Be a good stream and emit end when the response is finished. + // Hack to emit end on close because of a core bug that never fires end + response.on('close', function () { + if (!self._ended) self.response.emit('end') + }) + + if (self.encoding) { + if (self.dests.length !== 0) { + console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") + } else { + response.setEncoding(self.encoding) + } + } + + self.dests.forEach(function (dest) { + self.pipeDest(dest) + }) + + response.on("data", function (chunk) { + self._destdata = true + self.emit("data", chunk) + }) + response.on("end", function (chunk) { + self._ended = true + self.emit("end", chunk) + }) + response.on("close", function () {self.emit("close")}) + + self.emit('response', response) + + if (self.callback) { + var buffer = [] + var bodyLen = 0 + self.on("data", function (chunk) { + buffer.push(chunk) + bodyLen += chunk.length + }) + self.on("end", function () { + if (self._aborted) return + + if (buffer.length && Buffer.isBuffer(buffer[0])) { + var body = new Buffer(bodyLen) + var i = 0 + buffer.forEach(function (chunk) { + chunk.copy(body, i, 0, chunk.length) + i += chunk.length + }) + if (self.encoding === null) { + response.body = body + } else { + response.body = body.toString(self.encoding) + } + } else if (buffer.length) { + response.body = buffer.join('') + } + + if (self._json) { + try { + response.body = JSON.parse(response.body) + } catch (e) {} + } + + self.emit('complete', response, response.body) + }) + } + } + }) + + if (self.timeout && !self.timeoutTimer) { + self.timeoutTimer = setTimeout(function () { + self.req.abort() + var e = new Error("ETIMEDOUT") + e.code = "ETIMEDOUT" + self.emit("error", e) + }, self.timeout) + + // Set additional timeout on socket - in case if remote + // server freeze after sending headers + if (self.req.setTimeout) { // only works on node 0.6+ + self.req.setTimeout(self.timeout, function () { + if (self.req) { + self.req.abort() + var e = new Error("ESOCKETTIMEDOUT") + e.code = "ESOCKETTIMEDOUT" + self.emit("error", e) + } + }) + } + } + + self.req.on('error', self.clientErrorHandler) + self.req.on('drain', function() { + self.emit('drain') + }) + self.on('end', function() { + if ( self.req.connection ) self.req.connection.removeListener('error', self._parserErrorHandler) + }) + self.emit('request', self.req) +} + +Request.prototype.abort = function () { + this._aborted = true + + if (this.req) { + this.req.abort() + } + else if (this.response) { + this.response.abort() + } + + this.emit("abort") +} + +Request.prototype.pipeDest = function (dest) { + var response = this.response + // Called after the response is received + if (dest.headers) { + dest.headers['content-type'] = response.headers['content-type'] + if (response.headers['content-length']) { + dest.headers['content-length'] = response.headers['content-length'] + } + } + if (dest.setHeader) { + for (var i in response.headers) { + dest.setHeader(i, response.headers[i]) + } + dest.statusCode = response.statusCode + } + if (this.pipefilter) this.pipefilter(response, dest) +} + +// Composable API +Request.prototype.setHeader = function (name, value, clobber) { + if (clobber === undefined) clobber = true + if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value + else this.headers[name] += ',' + value + return this +} +Request.prototype.setHeaders = function (headers) { + for (var i in headers) {this.setHeader(i, headers[i])} + return this +} +Request.prototype.qs = function (q, clobber) { + var base + if (!clobber && this.uri.query) base = qs.parse(this.uri.query) + else base = {} + + for (var i in q) { + base[i] = q[i] + } + + this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base)) + this.url = this.uri + + return this +} +Request.prototype.form = function (form) { + if (form) { + this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' + this.body = qs.stringify(form).toString('utf8') + return this + } + // create form-data object + this._form = new FormData() + return this._form +} +Request.prototype.multipart = function (multipart) { + var self = this + self.body = [] + + if (!self.headers['content-type']) { + self.headers['content-type'] = 'multipart/related; boundary=' + self.boundary + } else { + self.headers['content-type'] = self.headers['content-type'].split(';')[0] + '; boundary=' + self.boundary + } + + if (!multipart.forEach) throw new Error('Argument error, options.multipart.') + + if (self.preambleCRLF) { + self.body.push(new Buffer('\r\n')) + } + + multipart.forEach(function (part) { + var body = part.body + if(body == null) throw Error('Body attribute missing in multipart.') + delete part.body + var preamble = '--' + self.boundary + '\r\n' + Object.keys(part).forEach(function (key) { + preamble += key + ': ' + part[key] + '\r\n' + }) + preamble += '\r\n' + self.body.push(new Buffer(preamble)) + self.body.push(new Buffer(body)) + self.body.push(new Buffer('\r\n')) + }) + self.body.push(new Buffer('--' + self.boundary + '--')) + return self +} +Request.prototype.json = function (val) { + this.setHeader('accept', 'application/json') + this._json = true + if (typeof val === 'boolean') { + if (typeof this.body === 'object') { + this.setHeader('content-type', 'application/json') + this.body = JSON.stringify(this.body) + } + } else { + this.setHeader('content-type', 'application/json') + this.body = JSON.stringify(val) + } + return this +} +function getHeader(name, headers) { + var result, re, match + Object.keys(headers).forEach(function (key) { + re = new RegExp(name, 'i') + match = key.match(re) + if (match) result = headers[key] + }) + return result +} +Request.prototype.aws = function (opts, now) { + if (!now) { + this._aws = opts + return this + } + var date = new Date() + this.setHeader('date', date.toUTCString()) + var auth = + { key: opts.key + , secret: opts.secret + , verb: this.method.toUpperCase() + , date: date + , contentType: getHeader('content-type', this.headers) || '' + , md5: getHeader('content-md5', this.headers) || '' + , amazonHeaders: aws.canonicalizeHeaders(this.headers) + } + if (opts.bucket && this.path) { + auth.resource = '/' + opts.bucket + this.path + } else if (opts.bucket && !this.path) { + auth.resource = '/' + opts.bucket + } else if (!opts.bucket && this.path) { + auth.resource = this.path + } else if (!opts.bucket && !this.path) { + auth.resource = '/' + } + auth.resource = aws.canonicalizeResource(auth.resource) + this.setHeader('authorization', aws.authorization(auth)) + + return this +} + +Request.prototype.oauth = function (_oauth) { + var form + if (this.headers['content-type'] && + this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === + 'application/x-www-form-urlencoded' + ) { + form = qs.parse(this.body) + } + if (this.uri.query) { + form = qs.parse(this.uri.query) + } + if (!form) form = {} + var oa = {} + for (var i in form) oa[i] = form[i] + for (var i in _oauth) oa['oauth_'+i] = _oauth[i] + if (!oa.oauth_version) oa.oauth_version = '1.0' + if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() + if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') + + oa.oauth_signature_method = 'HMAC-SHA1' + + var consumer_secret = oa.oauth_consumer_secret + delete oa.oauth_consumer_secret + var token_secret = oa.oauth_token_secret + delete oa.oauth_token_secret + + var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname + var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) + + // oa.oauth_signature = signature + for (var i in form) { + if ( i.slice(0, 'oauth_') in _oauth) { + // skip + } else { + delete oa['oauth_'+i] + if (i !== 'x_auth_mode') delete oa[i] + } + } + this.headers.Authorization = + 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') + this.headers.Authorization += ',oauth_signature="' + oauth.rfc3986(signature) + '"' + return this +} +Request.prototype.jar = function (jar) { + var cookies + + if (this._redirectsFollowed === 0) { + this.originalCookieHeader = this.headers.cookie + } + + if (jar === false) { + // disable cookies + cookies = false + this._disableCookies = true + } else if (jar) { + // fetch cookie from the user defined cookie jar + cookies = jar.get({ url: this.uri.href }) + } else { + // fetch cookie from the global cookie jar + cookies = cookieJar.get({ url: this.uri.href }) + } + + if (cookies && cookies.length) { + var cookieString = cookies.map(function (c) { + return c.name + "=" + c.value + }).join("; ") + + if (this.originalCookieHeader) { + // Don't overwrite existing Cookie header + this.headers.cookie = this.originalCookieHeader + '; ' + cookieString + } else { + this.headers.cookie = cookieString + } + } + this._jar = jar + return this +} + + +// Stream API +Request.prototype.pipe = function (dest, opts) { + if (this.response) { + if (this._destdata) { + throw new Error("You cannot pipe after data has been emitted from the response.") + } else if (this._ended) { + throw new Error("You cannot pipe after the response has been ended.") + } else { + stream.Stream.prototype.pipe.call(this, dest, opts) + this.pipeDest(dest) + return dest + } + } else { + this.dests.push(dest) + stream.Stream.prototype.pipe.call(this, dest, opts) + return dest + } +} +Request.prototype.write = function () { + if (!this._started) this.start() + return this.req.write.apply(this.req, arguments) +} +Request.prototype.end = function (chunk) { + if (chunk) this.write(chunk) + if (!this._started) this.start() + this.req.end() +} +Request.prototype.pause = function () { + if (!this.response) this._paused = true + else this.response.pause.apply(this.response, arguments) +} +Request.prototype.resume = function () { + if (!this.response) this._paused = false + else this.response.resume.apply(this.response, arguments) +} +Request.prototype.destroy = function () { + if (!this._ended) this.end() +} + +// organize params for post, put, head, del +function initParams(uri, options, callback) { + if ((typeof options === 'function') && !callback) callback = options + if (options && typeof options === 'object') { + options.uri = uri + } else if (typeof uri === 'string') { + options = {uri:uri} + } else { + options = uri + uri = options.uri + } + return { uri: uri, options: options, callback: callback } +} + +function request (uri, options, callback) { + if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.') + if ((typeof options === 'function') && !callback) callback = options + if (options && typeof options === 'object') { + options.uri = uri + } else if (typeof uri === 'string') { + options = {uri:uri} + } else { + options = uri + } + + if (callback) options.callback = callback + var r = new Request(options) + return r +} + +module.exports = request + +request.initParams = initParams + +request.defaults = function (options, requester) { + var def = function (method) { + var d = function (uri, opts, callback) { + var params = initParams(uri, opts, callback) + for (var i in options) { + if (params.options[i] === undefined) params.options[i] = options[i] + } + if(typeof requester === 'function') { + if(method === request) { + method = requester + } else { + params.options._requester = requester + } + } + return method(params.options, params.callback) + } + return d + } + var de = def(request) + de.get = def(request.get) + de.post = def(request.post) + de.put = def(request.put) + de.head = def(request.head) + de.del = def(request.del) + de.cookie = def(request.cookie) + de.jar = request.jar + return de +} + +request.forever = function (agentOptions, optionsArg) { + var options = {} + if (optionsArg) { + for (option in optionsArg) { + options[option] = optionsArg[option] + } + } + if (agentOptions) options.agentOptions = agentOptions + options.forever = true + return request.defaults(options) +} + +request.get = request +request.post = function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.options.method = 'POST' + return request(params.uri || null, params.options, params.callback) +} +request.put = function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.options.method = 'PUT' + return request(params.uri || null, params.options, params.callback) +} +request.head = function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.options.method = 'HEAD' + if (params.options.body || + params.options.requestBodyStream || + (params.options.json && typeof params.options.json !== 'boolean') || + params.options.multipart) { + throw new Error("HTTP HEAD requests MUST NOT include a request body.") + } + return request(params.uri || null, params.options, params.callback) +} +request.del = function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.options.method = 'DELETE' + if(typeof params.options._requester === 'function') { + request = params.options._requester + } + return request(params.uri || null, params.options, params.callback) +} +request.jar = function () { + return new CookieJar +} +request.cookie = function (str) { + if (str && str.uri) str = str.uri + if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") + return new Cookie(str) +} + +// Safe toJSON + +function getSafe (self, uuid) { + if (typeof self === 'object' || typeof self === 'function') var safe = {} + if (Array.isArray(self)) var safe = [] + + var recurse = [] + + Object.defineProperty(self, uuid, {}) + + var attrs = Object.keys(self).filter(function (i) { + if (i === uuid) return false + if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true + return !(Object.getOwnPropertyDescriptor(self[i], uuid)) + }) + + + for (var i=0;i $(BUILDDIR)/async.min.js + +test: + nodeunit test + +clean: + rm -rf $(BUILDDIR) + +lint: + nodelint --config nodelint.cfg lib/async.js + +.PHONY: test build all diff --git a/node_modules/request/node_modules/form-data/node_modules/async/README.md b/node_modules/request/node_modules/form-data/node_modules/async/README.md new file mode 100644 index 0000000..039d942 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/README.md @@ -0,0 +1,970 @@ +# Async.js + +Async is a utility module which provides straight-forward, powerful functions +for working with asynchronous JavaScript. Although originally designed for +use with [node.js](http://nodejs.org), it can also be used directly in the +browser. + +Async provides around 20 functions that include the usual 'functional' +suspects (map, reduce, filter, forEach…) as well as some common patterns +for asynchronous flow control (parallel, series, waterfall…). All these +functions assume you follow the node.js convention of providing a single +callback as the last argument of your async function. + + +## Quick Examples + + async.map(['file1','file2','file3'], fs.stat, function(err, results){ + // results is now an array of stats for each file + }); + + async.filter(['file1','file2','file3'], path.exists, function(results){ + // results now equals an array of the existing files + }); + + async.parallel([ + function(){ ... }, + function(){ ... } + ], callback); + + async.series([ + function(){ ... }, + function(){ ... } + ]); + +There are many more functions available so take a look at the docs below for a +full list. This module aims to be comprehensive, so if you feel anything is +missing please create a GitHub issue for it. + + +## Download + +Releases are available for download from +[GitHub](http://github.com/caolan/async/downloads). +Alternatively, you can install using Node Package Manager (npm): + + npm install async + + +__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed + +__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped + + +## In the Browser + +So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: + + + + + +## Documentation + +### Collections + +* [forEach](#forEach) +* [map](#map) +* [filter](#filter) +* [reject](#reject) +* [reduce](#reduce) +* [detect](#detect) +* [sortBy](#sortBy) +* [some](#some) +* [every](#every) +* [concat](#concat) + +### Flow Control + +* [series](#series) +* [parallel](#parallel) +* [whilst](#whilst) +* [until](#until) +* [waterfall](#waterfall) +* [queue](#queue) +* [auto](#auto) +* [iterator](#iterator) +* [apply](#apply) +* [nextTick](#nextTick) + +### Utils + +* [memoize](#memoize) +* [log](#log) +* [dir](#dir) +* [noConflict](#noConflict) + + +## Collections + + +### forEach(arr, iterator, callback) + +Applies an iterator function to each item in an array, in parallel. +The iterator is called with an item from the list and a callback for when it +has finished. If the iterator passes an error to this callback, the main +callback for the forEach function is immediately called with the error. + +Note, that since this function applies the iterator to each item in parallel +there is no guarantee that the iterator functions will complete in order. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A function to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed. +* callback(err) - A callback which is called after all the iterator functions + have finished, or an error has occurred. + +__Example__ + + // assuming openFiles is an array of file names and saveFile is a function + // to save the modified contents of that file: + + async.forEach(openFiles, saveFile, function(err){ + // if any of the saves produced an error, err would equal that error + }); + +--------------------------------------- + + +### forEachSeries(arr, iterator, callback) + +The same as forEach only the iterator is applied to each item in the array in +series. The next iterator is only called once the current one has completed +processing. This means the iterator functions will complete in order. + + +--------------------------------------- + + +### map(arr, iterator, callback) + +Produces a new array of values by mapping each value in the given array through +the iterator function. The iterator is called with an item from the array and a +callback for when it has finished processing. The callback takes 2 arguments, +an error and the transformed item from the array. If the iterator passes an +error to this callback, the main callback for the map function is immediately +called with the error. + +Note, that since this function applies the iterator to each item in parallel +there is no guarantee that the iterator functions will complete in order, however +the results array will be in the same order as the original array. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A function to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed + with an error (which can be null) and a transformed item. +* callback(err, results) - A callback which is called after all the iterator + functions have finished, or an error has occurred. Results is an array of the + transformed items from the original array. + +__Example__ + + async.map(['file1','file2','file3'], fs.stat, function(err, results){ + // results is now an array of stats for each file + }); + +--------------------------------------- + + +### mapSeries(arr, iterator, callback) + +The same as map only the iterator is applied to each item in the array in +series. The next iterator is only called once the current one has completed +processing. The results array will be in the same order as the original. + + +--------------------------------------- + + +### filter(arr, iterator, callback) + +__Alias:__ select + +Returns a new array of all the values which pass an async truth test. +_The callback for each iterator call only accepts a single argument of true or +false, it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like path.exists. This operation is +performed in parallel, but the results array will be in the same order as the +original. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A truth test to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed. +* callback(results) - A callback which is called after all the iterator + functions have finished. + +__Example__ + + async.filter(['file1','file2','file3'], path.exists, function(results){ + // results now equals an array of the existing files + }); + +--------------------------------------- + + +### filterSeries(arr, iterator, callback) + +__alias:__ selectSeries + +The same as filter only the iterator is applied to each item in the array in +series. The next iterator is only called once the current one has completed +processing. The results array will be in the same order as the original. + +--------------------------------------- + + +### reject(arr, iterator, callback) + +The opposite of filter. Removes values that pass an async truth test. + +--------------------------------------- + + +### rejectSeries(arr, iterator, callback) + +The same as filter, only the iterator is applied to each item in the array +in series. + + +--------------------------------------- + + +### reduce(arr, memo, iterator, callback) + +__aliases:__ inject, foldl + +Reduces a list of values into a single value using an async iterator to return +each successive step. Memo is the initial state of the reduction. This +function only operates in series. For performance reasons, it may make sense to +split a call to this function into a parallel map, then use the normal +Array.prototype.reduce on the results. This function is for situations where +each step in the reduction needs to be async, if you can get the data before +reducing it then its probably a good idea to do so. + +__Arguments__ + +* arr - An array to iterate over. +* memo - The initial state of the reduction. +* iterator(memo, item, callback) - A function applied to each item in the + array to produce the next step in the reduction. The iterator is passed a + callback which accepts an optional error as its first argument, and the state + of the reduction as the second. If an error is passed to the callback, the + reduction is stopped and the main callback is immediately called with the + error. +* callback(err, result) - A callback which is called after all the iterator + functions have finished. Result is the reduced value. + +__Example__ + + async.reduce([1,2,3], 0, function(memo, item, callback){ + // pointless async: + process.nextTick(function(){ + callback(null, memo + item) + }); + }, function(err, result){ + // result is now equal to the last value of memo, which is 6 + }); + +--------------------------------------- + + +### reduceRight(arr, memo, iterator, callback) + +__Alias:__ foldr + +Same as reduce, only operates on the items in the array in reverse order. + + +--------------------------------------- + + +### detect(arr, iterator, callback) + +Returns the first value in a list that passes an async truth test. The +iterator is applied in parallel, meaning the first iterator to return true will +fire the detect callback with that result. That means the result might not be +the first item in the original array (in terms of order) that passes the test. + +If order within the original array is important then look at detectSeries. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A truth test to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed. +* callback(result) - A callback which is called as soon as any iterator returns + true, or after all the iterator functions have finished. Result will be + the first item in the array that passes the truth test (iterator) or the + value undefined if none passed. + +__Example__ + + async.detect(['file1','file2','file3'], path.exists, function(result){ + // result now equals the first file in the list that exists + }); + +--------------------------------------- + + +### detectSeries(arr, iterator, callback) + +The same as detect, only the iterator is applied to each item in the array +in series. This means the result is always the first in the original array (in +terms of array order) that passes the truth test. + + +--------------------------------------- + + +### sortBy(arr, iterator, callback) + +Sorts a list by the results of running each value through an async iterator. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A function to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed + with an error (which can be null) and a value to use as the sort criteria. +* callback(err, results) - A callback which is called after all the iterator + functions have finished, or an error has occurred. Results is the items from + the original array sorted by the values returned by the iterator calls. + +__Example__ + + async.sortBy(['file1','file2','file3'], function(file, callback){ + fs.stat(file, function(err, stats){ + callback(err, stats.mtime); + }); + }, function(err, results){ + // results is now the original array of files sorted by + // modified date + }); + + +--------------------------------------- + + +### some(arr, iterator, callback) + +__Alias:__ any + +Returns true if at least one element in the array satisfies an async test. +_The callback for each iterator call only accepts a single argument of true or +false, it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like path.exists. Once any iterator +call returns true, the main callback is immediately called. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A truth test to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed. +* callback(result) - A callback which is called as soon as any iterator returns + true, or after all the iterator functions have finished. Result will be + either true or false depending on the values of the async tests. + +__Example__ + + async.some(['file1','file2','file3'], path.exists, function(result){ + // if result is true then at least one of the files exists + }); + +--------------------------------------- + + +### every(arr, iterator, callback) + +__Alias:__ all + +Returns true if every element in the array satisfies an async test. +_The callback for each iterator call only accepts a single argument of true or +false, it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like path.exists. + +__Arguments__ + +* arr - An array to iterate over. +* iterator(item, callback) - A truth test to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed. +* callback(result) - A callback which is called after all the iterator + functions have finished. Result will be either true or false depending on + the values of the async tests. + +__Example__ + + async.every(['file1','file2','file3'], path.exists, function(result){ + // if result is true then every file exists + }); + +--------------------------------------- + + +### concat(arr, iterator, callback) + +Applies an iterator to each item in a list, concatenating the results. Returns the +concatenated list. The iterators are called in parallel, and the results are +concatenated as they return. There is no guarantee that the results array will +be returned in the original order of the arguments passed to the iterator function. + +__Arguments__ + +* arr - An array to iterate over +* iterator(item, callback) - A function to apply to each item in the array. + The iterator is passed a callback which must be called once it has completed + with an error (which can be null) and an array of results. +* callback(err, results) - A callback which is called after all the iterator + functions have finished, or an error has occurred. Results is an array containing + the concatenated results of the iterator function. + +__Example__ + + async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ + // files is now a list of filenames that exist in the 3 directories + }); + +--------------------------------------- + + +### concatSeries(arr, iterator, callback) + +Same as async.concat, but executes in series instead of parallel. + + +## Flow Control + + +### series(tasks, [callback]) + +Run an array of functions in series, each one running once the previous +function has completed. If any functions in the series pass an error to its +callback, no more functions are run and the callback for the series is +immediately called with the value of the error. Once the tasks have completed, +the results are passed to the final callback as an array. + +It is also possible to use an object instead of an array. Each property will be +run as a function and the results will be passed to the final callback as an object +instead of an array. This can be a more readable way of handling results from +async.series. + + +__Arguments__ + +* tasks - An array or object containing functions to run, each function is passed + a callback it must call on completion. +* callback(err, results) - An optional callback to run once all the functions + have completed. This function gets an array of all the arguments passed to + the callbacks used in the array. + +__Example__ + + async.series([ + function(callback){ + // do some stuff ... + callback(null, 'one'); + }, + function(callback){ + // do some more stuff ... + callback(null, 'two'); + }, + ], + // optional callback + function(err, results){ + // results is now equal to ['one', 'two'] + }); + + + // an example using an object instead of an array + async.series({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + }, + }, + function(err, results) { + // results is now equals to: {one: 1, two: 2} + }); + + +--------------------------------------- + + +### parallel(tasks, [callback]) + +Run an array of functions in parallel, without waiting until the previous +function has completed. If any of the functions pass an error to its +callback, the main callback is immediately called with the value of the error. +Once the tasks have completed, the results are passed to the final callback as an +array. + +It is also possible to use an object instead of an array. Each property will be +run as a function and the results will be passed to the final callback as an object +instead of an array. This can be a more readable way of handling results from +async.parallel. + + +__Arguments__ + +* tasks - An array or object containing functions to run, each function is passed a + callback it must call on completion. +* callback(err, results) - An optional callback to run once all the functions + have completed. This function gets an array of all the arguments passed to + the callbacks used in the array. + +__Example__ + + async.parallel([ + function(callback){ + setTimeout(function(){ + callback(null, 'one'); + }, 200); + }, + function(callback){ + setTimeout(function(){ + callback(null, 'two'); + }, 100); + }, + ], + // optional callback + function(err, results){ + // in this case, the results array will equal ['two','one'] + // because the functions were run in parallel and the second + // function had a shorter timeout before calling the callback. + }); + + + // an example using an object instead of an array + async.parallel({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + }, + }, + function(err, results) { + // results is now equals to: {one: 1, two: 2} + }); + + +--------------------------------------- + + +### whilst(test, fn, callback) + +Repeatedly call fn, while test returns true. Calls the callback when stopped, +or an error occurs. + +__Arguments__ + +* test() - synchronous truth test to perform before each execution of fn. +* fn(callback) - A function to call each time the test passes. The function is + passed a callback which must be called once it has completed with an optional + error as the first argument. +* callback(err) - A callback which is called after the test fails and repeated + execution of fn has stopped. + +__Example__ + + var count = 0; + + async.whilst( + function () { return count < 5; }, + function (callback) { + count++; + setTimeout(callback, 1000); + }, + function (err) { + // 5 seconds have passed + } + }); + + +--------------------------------------- + + +### until(test, fn, callback) + +Repeatedly call fn, until test returns true. Calls the callback when stopped, +or an error occurs. + +The inverse of async.whilst. + + +--------------------------------------- + + +### waterfall(tasks, [callback]) + +Runs an array of functions in series, each passing their results to the next in +the array. However, if any of the functions pass an error to the callback, the +next function is not executed and the main callback is immediately called with +the error. + +__Arguments__ + +* tasks - An array of functions to run, each function is passed a callback it + must call on completion. +* callback(err) - An optional callback to run once all the functions have + completed. This function gets passed any error that may have occurred. + +__Example__ + + async.waterfall([ + function(callback){ + callback(null, 'one', 'two'); + }, + function(arg1, arg2, callback){ + callback(null, 'three'); + }, + function(arg1, callback){ + // arg1 now equals 'three' + callback(null, 'done'); + } + ]); + + +--------------------------------------- + + +### queue(worker, concurrency) + +Creates a queue object with the specified concurrency. Tasks added to the +queue will be processed in parallel (up to the concurrency limit). If all +workers are in progress, the task is queued until one is available. Once +a worker has completed a task, the task's callback is called. + +__Arguments__ + +* worker(task, callback) - An asynchronous function for processing a queued + task. +* concurrency - An integer for determining how many worker functions should be + run in parallel. + +__Queue objects__ + +The queue object returned by this function has the following properties and +methods: + +* length() - a function returning the number of items waiting to be processed. +* concurrency - an integer for determining how many worker functions should be + run in parallel. This property can be changed after a queue is created to + alter the concurrency on-the-fly. +* push(task, [callback]) - add a new task to the queue, the callback is called + once the worker has finished processing the task. +* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued +* empty - a callback that is called when the last item from the queue is given to a worker +* drain - a callback that is called when the last item from the queue has returned from the worker + +__Example__ + + // create a queue object with concurrency 2 + + var q = async.queue(function (task, callback) { + console.log('hello ' + task.name). + callback(); + }, 2); + + + // assign a callback + q.drain = function() { + console.log('all items have been processed'); + } + + // add some items to the queue + + q.push({name: 'foo'}, function (err) { + console.log('finished processing foo'); + }); + q.push({name: 'bar'}, function (err) { + console.log('finished processing bar'); + }); + + +--------------------------------------- + + +### auto(tasks, [callback]) + +Determines the best order for running functions based on their requirements. +Each function can optionally depend on other functions being completed first, +and each function is run as soon as its requirements are satisfied. If any of +the functions pass and error to their callback, that function will not complete +(so any other functions depending on it will not run) and the main callback +will be called immediately with the error. + +__Arguments__ + +* tasks - An object literal containing named functions or an array of + requirements, with the function itself the last item in the array. The key + used for each function or array is used when specifying requirements. The + syntax is easier to understand by looking at the example. +* callback(err) - An optional callback which is called when all the tasks have + been completed. The callback may receive an error as an argument. + +__Example__ + + async.auto({ + get_data: function(callback){ + // async code to get some data + }, + make_folder: function(callback){ + // async code to create a directory to store a file in + // this is run at the same time as getting the data + }, + write_file: ['get_data', 'make_folder', function(callback){ + // once there is some data and the directory exists, + // write the data to a file in the directory + }], + email_link: ['write_file', function(callback){ + // once the file is written let's email a link to it... + }] + }); + +This is a fairly trivial example, but to do this using the basic parallel and +series functions would look like this: + + async.parallel([ + function(callback){ + // async code to get some data + }, + function(callback){ + // async code to create a directory to store a file in + // this is run at the same time as getting the data + } + ], + function(results){ + async.series([ + function(callback){ + // once there is some data and the directory exists, + // write the data to a file in the directory + }, + email_link: ['write_file', function(callback){ + // once the file is written let's email a link to it... + } + ]); + }); + +For a complicated series of async tasks using the auto function makes adding +new tasks much easier and makes the code more readable. + + +--------------------------------------- + + +### iterator(tasks) + +Creates an iterator function which calls the next function in the array, +returning a continuation to call the next one after that. Its also possible to +'peek' the next iterator by doing iterator.next(). + +This function is used internally by the async module but can be useful when +you want to manually control the flow of functions in series. + +__Arguments__ + +* tasks - An array of functions to run, each function is passed a callback it + must call on completion. + +__Example__ + + var iterator = async.iterator([ + function(){ sys.p('one'); }, + function(){ sys.p('two'); }, + function(){ sys.p('three'); } + ]); + + node> var iterator2 = iterator(); + 'one' + node> var iterator3 = iterator2(); + 'two' + node> iterator3(); + 'three' + node> var nextfn = iterator2.next(); + node> nextfn(); + 'three' + + +--------------------------------------- + + +### apply(function, arguments..) + +Creates a continuation function with some arguments already applied, a useful +shorthand when combined with other flow control functions. Any arguments +passed to the returned function are added to the arguments originally passed +to apply. + +__Arguments__ + +* function - The function you want to eventually apply all arguments to. +* arguments... - Any number of arguments to automatically apply when the + continuation is called. + +__Example__ + + // using apply + + async.parallel([ + async.apply(fs.writeFile, 'testfile1', 'test1'), + async.apply(fs.writeFile, 'testfile2', 'test2'), + ]); + + + // the same process without using apply + + async.parallel([ + function(callback){ + fs.writeFile('testfile1', 'test1', callback); + }, + function(callback){ + fs.writeFile('testfile2', 'test2', callback); + }, + ]); + +It's possible to pass any number of additional arguments when calling the +continuation: + + node> var fn = async.apply(sys.puts, 'one'); + node> fn('two', 'three'); + one + two + three + +--------------------------------------- + + +### nextTick(callback) + +Calls the callback on a later loop around the event loop. In node.js this just +calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), +which means other higher priority events may precede the execution of the callback. + +This is used internally for browser-compatibility purposes. + +__Arguments__ + +* callback - The function to call on a later loop around the event loop. + +__Example__ + + var call_order = []; + async.nextTick(function(){ + call_order.push('two'); + // call_order now equals ['one','two] + }); + call_order.push('one') + + +## Utils + + +### memoize(fn, [hasher]) + +Caches the results of an async function. When creating a hash to store function +results against, the callback is omitted from the hash and an optional hash +function can be used. + +__Arguments__ + +* fn - the function you to proxy and cache results from. +* hasher - an optional function for generating a custom hash for storing + results, it has all the arguments applied to it apart from the callback, and + must be synchronous. + +__Example__ + + var slow_fn = function (name, callback) { + // do something + callback(null, result); + }; + var fn = async.memoize(slow_fn); + + // fn can now be used as if it were slow_fn + fn('some name', function () { + // callback + }); + + + +### log(function, arguments) + +Logs the result of an async function to the console. Only works in node.js or +in browsers that support console.log and console.error (such as FF and Chrome). +If multiple arguments are returned from the async function, console.log is +called on each argument in order. + +__Arguments__ + +* function - The function you want to eventually apply all arguments to. +* arguments... - Any number of arguments to apply to the function. + +__Example__ + + var hello = function(name, callback){ + setTimeout(function(){ + callback(null, 'hello ' + name); + }, 1000); + }; + + node> async.log(hello, 'world'); + 'hello world' + + +--------------------------------------- + + +### dir(function, arguments) + +Logs the result of an async function to the console using console.dir to +display the properties of the resulting object. Only works in node.js or +in browsers that support console.dir and console.error (such as FF and Chrome). +If multiple arguments are returned from the async function, console.dir is +called on each argument in order. + +__Arguments__ + +* function - The function you want to eventually apply all arguments to. +* arguments... - Any number of arguments to apply to the function. + +__Example__ + + var hello = function(name, callback){ + setTimeout(function(){ + callback(null, {hello: name}); + }, 1000); + }; + + node> async.dir(hello, 'world'); + {hello: 'world'} + + +--------------------------------------- + + +### noConflict() + +Changes the value of async back to its original value, returning a reference to the +async object. diff --git a/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip b/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip new file mode 100644 index 0000000000000000000000000000000000000000..e1c32944465c634d9b609622b37972d1ae8e6e7d GIT binary patch literal 1859 zcmV-J2fX+niwFpUH4aSx17UM{ZeuQOX>KlRa{$d)OOx9+4E`&dJ!r^8tJqh0RZrV# zZ=H17-aJ0=C0o0)cwe{Z%@F7vMl6BIVG?Up_q$mIcJ^&y2_Vq3=Im_>A)%=wm zRM|H1UCQ!Wg?FMX>M~b$eE0e-N!vm+Sy>Qze$T2qmYlm4KJcX3XLTqN91Adg8<}0$l>2$&!4KwRQ*L(Nw8`Hdo+t}rs${2EMTi7(9>F{v~n`LU|lDFTN#B?dOCp(dzEuskQM+O-E&H1&YCh#iml zi4<*~hnwCB+XzaUU=84sc1HQrH&bpRFk`~=Br2gaYEw)$o?wcPlg8*d>nw?R_@3ph zidomukX@}6kY9SiFs~J)8=Gd^M21i(G+KPvYdq>e>9Uq&(6B4SC&a#o&2hWH4BYlSH>uKEi9n30?Sh3G;4_GGWRFU!ynmh-%Jfljc<1oxAviD z9fi-|tEvWkuKFswvmbX>U6qWq=s4!zI*u?K1gWXCjDq84f~ZIu)zDYToN8BUAGrAi z&2ug>iaTo2kY;(KDgZ=|@i(I$6MC*zxe1YZ+0WQjdNQmxpO8dx`vc8$c5a0wPIM zwTgyv+zsYEtcj(~YgU{RV*v~>15f|OlFNlS@wb_xt+tlrSWUDE+9y@>)0{1u?0q&W zx}>eKxHYTMX-r6? zwy5`6+7QRR$DGWuLJky#KW2^?6i&BCUlFOG+;n>*Rwk&T*a5&i(op1bd=j0*-G$r$dt<7}^7< zmYYGtmh9+CL8_f6<%^zSDb$2#tS-|pw0jF6K^kEn7{E5g%<~h?5L7-xP~q%113&p$ zHm9^WMFsp#*y><@dK1}0G?}n*P5!~6-P*PjiJOblK2pPZ!AH}GC2FG8VRk}S0Y|U~ z0M02T+BZj5fpRr<&9w_)cO3a;4Y3j+0+6aVL+6VXM3@mDcDIvV+`mhL$7BgH25UBp zEkM?+)Z2nGce&X7=u zTF5y4G*cIc%Z7&~w(vJg8l$wXm(f3QvM^l|RnC}wtKY6qpM5*_cEjBX@}@&+f66RB z!LW5Jet}+UP(U2}vnzHKI(t&XW23Ts)2s%*Sz-}1qn>Z-xexm+ucv1;ykwwjL9Xg{ zPlyzr%*?m;6X=c76w9_~vV2w|EQnu}sz2|AqQJjf)v8G;7+;Ur?wTfN++$l+st~7G zgxCP$@rSm5pCxM;99uA0oQdaHbmKk|*_$P>z&^zuEWmF0m`0wqAaF_NZf2EZJ_~>r zB;ZQl#z4p-)E#=#D%V_ph{y=}x~tWg_Zqt;o}^@)-iC>}>SGDSWA z(uz3hq{3lz^YsGl#i70ap59&)zP4{7RaIpb1fwCSi|qsyydW6SLQJgwoi2p5+v*gB zVpHytBe{p4dwo31DjdR(9v;-8%>J3)K%0F*Q6IB$|2ku)su=X%cBf?!E~8_4wAX@Z xGIF@2s}wJS#afNxut~Qx9u+Qm9U5>4tV;&(tNFTZoYVmy`WKn%6PvIY007E|gZuyh literal 0 HcmV?d00001 diff --git a/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css b/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css new file mode 100644 index 0000000..274434a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css @@ -0,0 +1,70 @@ +/*! + * Styles taken from qunit.css + */ + +h1#nodeunit-header, h1.nodeunit-header { + padding: 15px; + font-size: large; + background-color: #06b; + color: white; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; +} + +h1#nodeunit-header a { + color: white; +} + +h2#nodeunit-banner { + height: 2em; + border-bottom: 1px solid white; + background-color: #eee; + margin: 0; + font-family: 'trebuchet ms', verdana, arial; +} +h2#nodeunit-banner.pass { + background-color: green; +} +h2#nodeunit-banner.fail { + background-color: red; +} + +h2#nodeunit-userAgent, h2.nodeunit-userAgent { + padding: 10px; + background-color: #eee; + color: black; + margin: 0; + font-size: small; + font-weight: normal; + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} + +div#nodeunit-testrunner-toolbar { + background: #eee; + border-top: 1px solid black; + padding: 10px; + font-family: 'trebuchet ms', verdana, arial; + margin: 0; + font-size: 10pt; +} + +ol#nodeunit-tests { + font-family: 'trebuchet ms', verdana, arial; + font-size: 10pt; +} +ol#nodeunit-tests li strong { + cursor:pointer; +} +ol#nodeunit-tests .pass { + color: green; +} +ol#nodeunit-tests .fail { + color: red; +} + +p#nodeunit-testresult { + margin-left: 1em; + font-size: 10pt; + font-family: 'trebuchet ms', verdana, arial; +} diff --git a/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js b/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js new file mode 100644 index 0000000..5957184 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js @@ -0,0 +1,1966 @@ +/*! + * Nodeunit + * https://github.com/caolan/nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * json2.js + * http://www.JSON.org/json2.js + * Public Domain. + * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + */ +nodeunit = (function(){ +/* + http://www.JSON.org/json2.js + 2010-11-17 + + Public Domain. + + NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + + See http://www.JSON.org/js.html + + + This code should be minified before deployment. + See http://javascript.crockford.com/jsmin.html + + USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO + NOT CONTROL. + + + This file creates a global JSON object containing two methods: stringify + and parse. + + JSON.stringify(value, replacer, space) + value any JavaScript value, usually an object or array. + + replacer an optional parameter that determines how object + values are stringified for objects. It can be a + function or an array of strings. + + space an optional parameter that specifies the indentation + of nested structures. If it is omitted, the text will + be packed without extra whitespace. If it is a number, + it will specify the number of spaces to indent at each + level. If it is a string (such as '\t' or ' '), + it contains the characters used to indent at each level. + + This method produces a JSON text from a JavaScript value. + + When an object value is found, if the object contains a toJSON + method, its toJSON method will be called and the result will be + stringified. A toJSON method does not serialize: it returns the + value represented by the name/value pair that should be serialized, + or undefined if nothing should be serialized. The toJSON method + will be passed the key associated with the value, and this will be + bound to the value + + For example, this would serialize Dates as ISO strings. + + Date.prototype.toJSON = function (key) { + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + return this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z'; + }; + + You can provide an optional replacer method. It will be passed the + key and value of each member, with this bound to the containing + object. The value that is returned from your method will be + serialized. If your method returns undefined, then the member will + be excluded from the serialization. + + If the replacer parameter is an array of strings, then it will be + used to select the members to be serialized. It filters the results + such that only members with keys listed in the replacer array are + stringified. + + Values that do not have JSON representations, such as undefined or + functions, will not be serialized. Such values in objects will be + dropped; in arrays they will be replaced with null. You can use + a replacer function to replace those with JSON values. + JSON.stringify(undefined) returns undefined. + + The optional space parameter produces a stringification of the + value that is filled with line breaks and indentation to make it + easier to read. + + If the space parameter is a non-empty string, then that string will + be used for indentation. If the space parameter is a number, then + the indentation will be that many spaces. + + Example: + + text = JSON.stringify(['e', {pluribus: 'unum'}]); + // text is '["e",{"pluribus":"unum"}]' + + + text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); + // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' + + text = JSON.stringify([new Date()], function (key, value) { + return this[key] instanceof Date ? + 'Date(' + this[key] + ')' : value; + }); + // text is '["Date(---current time---)"]' + + + JSON.parse(text, reviver) + This method parses a JSON text to produce an object or array. + It can throw a SyntaxError exception. + + The optional reviver parameter is a function that can filter and + transform the results. It receives each of the keys and values, + and its return value is used instead of the original value. + If it returns what it received, then the structure is not modified. + If it returns undefined then the member is deleted. + + Example: + + // Parse the text. Values that look like ISO date strings will + // be converted to Date objects. + + myData = JSON.parse(text, function (key, value) { + var a; + if (typeof value === 'string') { + a = +/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); + if (a) { + return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], + +a[5], +a[6])); + } + } + return value; + }); + + myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { + var d; + if (typeof value === 'string' && + value.slice(0, 5) === 'Date(' && + value.slice(-1) === ')') { + d = new Date(value.slice(5, -1)); + if (d) { + return d; + } + } + return value; + }); + + + This is a reference implementation. You are free to copy, modify, or + redistribute. +*/ + +/*jslint evil: true, strict: false, regexp: false */ + +/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, + call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, + getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, + lastIndex, length, parse, prototype, push, replace, slice, stringify, + test, toJSON, toString, valueOf +*/ + + +// Create a JSON object only if one does not already exist. We create the +// methods in a closure to avoid creating global variables. + +if (!this.JSON) { + this.JSON = {}; +} + +(function () { + "use strict"; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + if (typeof Date.prototype.toJSON !== 'function') { + + Date.prototype.toJSON = function (key) { + + return isFinite(this.valueOf()) ? + this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z' : null; + }; + + String.prototype.toJSON = + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + } + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? + '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : + '"' + string + '"'; + } + + + function str(key, holder) { + +// Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + +// If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + +// If we were called with a replacer function, then call the replacer to +// obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + +// What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + +// JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + +// If the value is a boolean or null, convert it to a string. Note: +// typeof null does not produce 'null'. The case is included here in +// the remote chance that this gets fixed someday. + + return String(value); + +// If the type is 'object', we might be dealing with an object or an array or +// null. + + case 'object': + +// Due to a specification blunder in ECMAScript, typeof null is 'object', +// so watch out for that case. + + if (!value) { + return 'null'; + } + +// Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + +// Is the value an array? + + if (Object.prototype.toString.apply(value) === '[object Array]') { + +// The value is an array. Stringify every element. Use null as a placeholder +// for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + +// Join all of the elements together, separated with commas, and wrap them in +// brackets. + + v = partial.length === 0 ? '[]' : + gap ? '[\n' + gap + + partial.join(',\n' + gap) + '\n' + + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + +// If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + +// Join all of the member texts together, separated with commas, +// and wrap them in braces. + + v = partial.length === 0 ? '{}' : + gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + + mind + '}' : '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + +// If the JSON object does not yet have a stringify method, give it one. + + if (typeof JSON.stringify !== 'function') { + JSON.stringify = function (value, replacer, space) { + +// The stringify method takes a value and an optional replacer, and an optional +// space parameter, and returns a JSON text. The replacer can be a function +// that can replace values, or an array of strings that will select the keys. +// A default replacer method can be provided. Use of the space parameter can +// produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + +// If the space parameter is a number, make an indent string containing that +// many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + +// If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + +// If there is a replacer, it must be a function or an array. +// Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + +// Make a fake root object containing our value under the key of ''. +// Return the result of stringifying the value. + + return str('', {'': value}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== 'function') { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with '()' and 'new' +// because they can cause invocation, and '=' because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we +// replace all simple value tokens with ']' characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or ']' or +// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ +.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') +.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') +.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The '{' operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + } +}()); +var assert = this.assert = {}; +var types = {}; +var core = {}; +var nodeunit = {}; +var reporter = {}; +/*global setTimeout: false, console: false */ +(function () { + + var async = {}; + + // global on the server, window in the browser + var root = this, + previous_async = root.async; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = async; + } + else { + root.async = async; + } + + async.noConflict = function () { + root.async = previous_async; + return async; + }; + + //// cross-browser compatiblity functions //// + + var _forEach = function (arr, iterator) { + if (arr.forEach) { + return arr.forEach(iterator); + } + for (var i = 0; i < arr.length; i += 1) { + iterator(arr[i], i, arr); + } + }; + + var _map = function (arr, iterator) { + if (arr.map) { + return arr.map(iterator); + } + var results = []; + _forEach(arr, function (x, i, a) { + results.push(iterator(x, i, a)); + }); + return results; + }; + + var _reduce = function (arr, iterator, memo) { + if (arr.reduce) { + return arr.reduce(iterator, memo); + } + _forEach(arr, function (x, i, a) { + memo = iterator(memo, x, i, a); + }); + return memo; + }; + + var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; + }; + + var _indexOf = function (arr, item) { + if (arr.indexOf) { + return arr.indexOf(item); + } + for (var i = 0; i < arr.length; i += 1) { + if (arr[i] === item) { + return i; + } + } + return -1; + }; + + //// exported async module functions //// + + //// nextTick implementation with browser-compatible fallback //// + async.nextTick = function (fn) { + if (typeof process === 'undefined' || !(process.nextTick)) { + setTimeout(fn, 0); + } + else { + process.nextTick(fn); + } + }; + + async.forEach = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + _forEach(arr, function (x) { + iterator(x, function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + } + }); + }); + }; + + async.forEachSeries = function (arr, iterator, callback) { + if (!arr.length) { + return callback(); + } + var completed = 0; + var iterate = function () { + iterator(arr[completed], function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + else { + iterate(); + } + } + }); + }; + iterate(); + }; + + + var doParallel = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEach].concat(args)); + }; + }; + var doSeries = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.forEachSeries].concat(args)); + }; + }; + + + var _asyncMap = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (err, v) { + results[x.index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + }; + async.map = doParallel(_asyncMap); + async.mapSeries = doSeries(_asyncMap); + + + // reduce only has a series version, as doing reduce in parallel won't + // work in many situations. + async.reduce = function (arr, memo, iterator, callback) { + async.forEachSeries(arr, function (x, callback) { + iterator(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); + }; + // inject alias + async.inject = async.reduce; + // foldl alias + async.foldl = async.reduce; + + async.reduceRight = function (arr, memo, iterator, callback) { + var reversed = _map(arr, function (x) { + return x; + }).reverse(); + async.reduce(reversed, memo, iterator, callback); + }; + // foldr alias + async.foldr = async.reduceRight; + + var _filter = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.filter = doParallel(_filter); + async.filterSeries = doSeries(_filter); + // select alias + async.select = async.filter; + async.selectSeries = async.filterSeries; + + var _reject = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (!v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.reject = doParallel(_reject); + async.rejectSeries = doSeries(_reject); + + var _detect = function (eachfn, arr, iterator, main_callback) { + eachfn(arr, function (x, callback) { + iterator(x, function (result) { + if (result) { + main_callback(x); + } + else { + callback(); + } + }); + }, function (err) { + main_callback(); + }); + }; + async.detect = doParallel(_detect); + async.detectSeries = doSeries(_detect); + + async.some = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (v) { + main_callback(true); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(false); + }); + }; + // any alias + async.any = async.some; + + async.every = function (arr, iterator, main_callback) { + async.forEach(arr, function (x, callback) { + iterator(x, function (v) { + if (!v) { + main_callback(false); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(true); + }); + }; + // all alias + async.all = async.every; + + async.sortBy = function (arr, iterator, callback) { + async.map(arr, function (x, callback) { + iterator(x, function (err, criteria) { + if (err) { + callback(err); + } + else { + callback(null, {value: x, criteria: criteria}); + } + }); + }, function (err, results) { + if (err) { + return callback(err); + } + else { + var fn = function (left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }; + callback(null, _map(results.sort(fn), function (x) { + return x.value; + })); + } + }); + }; + + async.auto = function (tasks, callback) { + callback = callback || function () {}; + var keys = _keys(tasks); + if (!keys.length) { + return callback(null); + } + + var completed = []; + + var listeners = []; + var addListener = function (fn) { + listeners.unshift(fn); + }; + var removeListener = function (fn) { + for (var i = 0; i < listeners.length; i += 1) { + if (listeners[i] === fn) { + listeners.splice(i, 1); + return; + } + } + }; + var taskComplete = function () { + _forEach(listeners, function (fn) { + fn(); + }); + }; + + addListener(function () { + if (completed.length === keys.length) { + callback(null); + } + }); + + _forEach(keys, function (k) { + var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; + var taskCallback = function (err) { + if (err) { + callback(err); + // stop subsequent errors hitting callback multiple times + callback = function () {}; + } + else { + completed.push(k); + taskComplete(); + } + }; + var requires = task.slice(0, Math.abs(task.length - 1)) || []; + var ready = function () { + return _reduce(requires, function (a, x) { + return (a && _indexOf(completed, x) !== -1); + }, true); + }; + if (ready()) { + task[task.length - 1](taskCallback); + } + else { + var listener = function () { + if (ready()) { + removeListener(listener); + task[task.length - 1](taskCallback); + } + }; + addListener(listener); + } + }); + }; + + async.waterfall = function (tasks, callback) { + if (!tasks.length) { + return callback(); + } + callback = callback || function () {}; + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + async.nextTick(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(async.iterator(tasks))(); + }; + + async.parallel = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.map(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEach(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.series = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.mapSeries(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args || null); + }); + } + }, callback); + } + else { + var results = {}; + async.forEachSeries(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.iterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + async.apply = function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + return function () { + return fn.apply( + null, args.concat(Array.prototype.slice.call(arguments)) + ); + }; + }; + + var _concat = function (eachfn, arr, fn, callback) { + var r = []; + eachfn(arr, function (x, cb) { + fn(x, function (err, y) { + r = r.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, r); + }); + }; + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + if (test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.whilst(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.until = function (test, iterator, callback) { + if (!test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.until(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.queue = function (worker, concurrency) { + var workers = 0; + var tasks = []; + var q = { + concurrency: concurrency, + push: function (data, callback) { + tasks.push({data: data, callback: callback}); + async.nextTick(q.process); + }, + process: function () { + if (workers < q.concurrency && tasks.length) { + var task = tasks.splice(0, 1)[0]; + workers += 1; + worker(task.data, function () { + workers -= 1; + if (task.callback) { + task.callback.apply(task, arguments); + } + q.process(); + }); + } + }, + length: function () { + return tasks.length; + } + }; + return q; + }; + + var _console_fn = function (name) { + return function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + fn.apply(null, args.concat([function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (typeof console !== 'undefined') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _forEach(args, function (x) { + console[name](x); + }); + } + } + }])); + }; + }; + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + +}()); +(function(exports){ +/** + * This file is based on the node.js assert module, but with some small + * changes for browser-compatibility + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + */ + + +/** + * Added for browser compatibility + */ + +var _keys = function(obj){ + if(Object.keys) return Object.keys(obj); + var keys = []; + for(var k in obj){ + if(obj.hasOwnProperty(k)) keys.push(k); + } + return keys; +}; + + + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.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 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. + + +var pSlice = Array.prototype.slice; + +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = exports; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({message: message, actual: actual, expected: expected}) + +assert.AssertionError = function AssertionError (options) { + this.name = "AssertionError"; + this.message = options.message; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + var stackStartFunction = options.stackStartFunction || fail; + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } +}; +// code from util.inherits in node +assert.AssertionError.super_ = Error; + + +// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call +// TODO: test what effect this may have +var ctor = function () { this.constructor = assert.AssertionError; }; +ctor.prototype = Error.prototype; +assert.AssertionError.prototype = new ctor(); + + +assert.AssertionError.prototype.toString = function() { + if (this.message) { + return [this.name+":", this.message].join(' '); + } else { + return [ this.name+":" + , JSON.stringify(this.expected ) + , this.operator + , JSON.stringify(this.actual) + ].join(" "); + } +}; + +// assert.AssertionError instanceof Error + +assert.AssertionError.__proto__ = Error.prototype; + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +assert.ok = function ok(value, message) { + if (!!!value) fail(value, true, message, "==", assert.ok); +}; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, "==", assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, "!=", assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected)) { + fail(actual, expected, message, "deepEqual", assert.deepEqual); + } +}; + +function _deepEqual(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +} + +function isUndefinedOrNull (value) { + return value === null || value === undefined; +} + +function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b); + } + try{ + var ka = _keys(a), + kb = _keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key] )) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected)) { + fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); + } +}; + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, "===", assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. +// assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, "!==", assert.notStrictEqual); + } +}; + +function _throws (shouldThrow, block, err, message) { + var exception = null, + threw = false, + typematters = true; + + message = message || ""; + + //handle optional arguments + if (arguments.length == 3) { + if (typeof(err) == "string") { + message = err; + typematters = false; + } + } else if (arguments.length == 2) { + typematters = false; + } + + try { + block(); + } catch (e) { + threw = true; + exception = e; + } + + if (shouldThrow && !threw) { + fail( "Missing expected exception" + + (err && err.name ? " ("+err.name+")." : '.') + + (message ? " " + message : "") + ); + } + if (!shouldThrow && threw && typematters && exception instanceof err) { + fail( "Got unwanted exception" + + (err && err.name ? " ("+err.name+")." : '.') + + (message ? " " + message : "") + ); + } + if ((shouldThrow && threw && typematters && !(exception instanceof err)) || + (!shouldThrow && threw)) { + throw exception; + } +}; + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [true].concat(pSlice.call(arguments))); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [false].concat(pSlice.call(arguments))); +}; + +assert.ifError = function (err) { if (err) {throw err;}}; +})(assert); +(function(exports){ +/*! + * Nodeunit + * Copyright (c) 2010 Caolan McMahon + * MIT Licensed + * + * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! + * Only code on that line will be removed, its mostly to avoid requiring code + * that is node specific + */ + +/** + * Module dependencies + */ + + + +/** + * Creates assertion objects representing the result of an assert call. + * Accepts an object or AssertionError as its argument. + * + * @param {object} obj + * @api public + */ + +exports.assertion = function (obj) { + return { + method: obj.method || '', + message: obj.message || (obj.error && obj.error.message) || '', + error: obj.error, + passed: function () { + return !this.error; + }, + failed: function () { + return Boolean(this.error); + } + }; +}; + +/** + * Creates an assertion list object representing a group of assertions. + * Accepts an array of assertion objects. + * + * @param {Array} arr + * @param {Number} duration + * @api public + */ + +exports.assertionList = function (arr, duration) { + var that = arr || []; + that.failures = function () { + var failures = 0; + for (var i=0; i(' + + '' + assertions.failures() + ', ' + + '' + assertions.passes() + ', ' + + assertions.length + + ')'; + test.className = assertions.failures() ? 'fail': 'pass'; + test.appendChild(strong); + + var aList = document.createElement('ol'); + aList.style.display = 'none'; + test.onclick = function () { + var d = aList.style.display; + aList.style.display = (d == 'none') ? 'block': 'none'; + }; + for (var i=0; i' + (a.error.stack || a.error) + ''; + li.className = 'fail'; + } + else { + li.innerHTML = a.message || a.method || 'no message'; + li.className = 'pass'; + } + aList.appendChild(li); + } + test.appendChild(aList); + tests.appendChild(test); + }, + done: function (assertions) { + var end = new Date().getTime(); + var duration = end - start; + + var failures = assertions.failures(); + banner.className = failures ? 'fail': 'pass'; + + result.innerHTML = 'Tests completed in ' + duration + + ' milliseconds.
    ' + + assertions.passes() + ' assertions of ' + + '' + assertions.length + ' passed, ' + + assertions.failures() + ' failed.'; + } + }); +}; +})(reporter); +nodeunit = core; +nodeunit.assert = assert; +nodeunit.reporter = reporter; +nodeunit.run = reporter.run; +return nodeunit; })(); diff --git a/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js new file mode 100644 index 0000000..f89741e --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js @@ -0,0 +1 @@ +/*global setTimeout: false, console: false */(function(){var a={};var b=this,c=b.async;typeof module!=="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){b.async=c;return a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;cd?1:0};d(null,e(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=g(a);if(!c.length)return b(null);var e=[];var i=[];var j=function(a){i.unshift(a)};var k=function(a){for(var b=0;b b ? 1 : 0; + }; + callback(null, _map(results.sort(fn), function (x) { + return x.value; + })); + } + }); + }; + + async.auto = function (tasks, callback) { + callback = callback || function () {}; + var keys = _keys(tasks); + if (!keys.length) { + return callback(null); + } + + var completed = []; + + var listeners = []; + var addListener = function (fn) { + listeners.unshift(fn); + }; + var removeListener = function (fn) { + for (var i = 0; i < listeners.length; i += 1) { + if (listeners[i] === fn) { + listeners.splice(i, 1); + return; + } + } + }; + var taskComplete = function () { + _forEach(listeners, function (fn) { + fn(); + }); + }; + + addListener(function () { + if (completed.length === keys.length) { + callback(null); + } + }); + + _forEach(keys, function (k) { + var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; + var taskCallback = function (err) { + if (err) { + callback(err); + // stop subsequent errors hitting callback multiple times + callback = function () {}; + } + else { + completed.push(k); + taskComplete(); + } + }; + var requires = task.slice(0, Math.abs(task.length - 1)) || []; + var ready = function () { + return _reduce(requires, function (a, x) { + return (a && _indexOf(completed, x) !== -1); + }, true); + }; + if (ready()) { + task[task.length - 1](taskCallback); + } + else { + var listener = function () { + if (ready()) { + removeListener(listener); + task[task.length - 1](taskCallback); + } + }; + addListener(listener); + } + }); + }; + + async.waterfall = function (tasks, callback) { + if (!tasks.length) { + return callback(); + } + callback = callback || function () {}; + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + async.nextTick(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(async.iterator(tasks))(); + }; + + async.parallel = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.map(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args); + }); + } + }, callback); + } + else { + var results = {}; + async.forEach(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.series = function (tasks, callback) { + callback = callback || function () {}; + if (tasks.constructor === Array) { + async.mapSeries(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args); + }); + } + }, callback); + } + else { + var results = {}; + async.forEachSeries(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.iterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + async.apply = function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + return function () { + return fn.apply( + null, args.concat(Array.prototype.slice.call(arguments)) + ); + }; + }; + + var _concat = function (eachfn, arr, fn, callback) { + var r = []; + eachfn(arr, function (x, cb) { + fn(x, function (err, y) { + r = r.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, r); + }); + }; + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + if (test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.whilst(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.until = function (test, iterator, callback) { + if (!test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.until(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.queue = function (worker, concurrency) { + var workers = 0; + var tasks = []; + var q = { + concurrency: concurrency, + saturated: null, + empty: null, + drain: null, + push: function (data, callback) { + tasks.push({data: data, callback: callback}); + if(q.saturated && tasks.length == concurrency) q.saturated(); + async.nextTick(q.process); + }, + process: function () { + if (workers < q.concurrency && tasks.length) { + var task = tasks.splice(0, 1)[0]; + if(q.empty && tasks.length == 0) q.empty(); + workers += 1; + worker(task.data, function () { + workers -= 1; + if (task.callback) { + task.callback.apply(task, arguments); + } + if(q.drain && tasks.length + workers == 0) q.drain(); + q.process(); + }); + } + }, + length: function () { + return tasks.length; + }, + running: function () { + return workers; + } + }; + return q; + }; + + var _console_fn = function (name) { + return function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + fn.apply(null, args.concat([function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (typeof console !== 'undefined') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _forEach(args, function (x) { + console[name](x); + }); + } + } + }])); + }; + }; + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + + async.memoize = function (fn, hasher) { + var memo = {}; + hasher = hasher || function (x) { + return x; + }; + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + var key = hasher.apply(null, args); + if (key in memo) { + callback.apply(null, memo[key]); + } + else { + fn.apply(null, args.concat([function () { + memo[key] = arguments; + callback.apply(null, arguments); + }])); + } + }; + }; + +}()); diff --git a/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg b/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg new file mode 100644 index 0000000..457a967 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg @@ -0,0 +1,4 @@ +var options = { + indent: 4, + onevar: false +}; diff --git a/node_modules/request/node_modules/form-data/node_modules/async/package.json b/node_modules/request/node_modules/form-data/node_modules/async/package.json new file mode 100644 index 0000000..e5646d7 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/package.json @@ -0,0 +1,41 @@ +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "main": "./index", + "author": { + "name": "Caolan McMahon" + }, + "version": "0.1.9", + "repository": { + "type": "git", + "url": "git://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" + } + ], + "_npmUser": { + "name": "mikeal", + "email": "mikeal.rogers@gmail.com" + }, + "_id": "async@0.1.9", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.8.1", + "_defaultsLoaded": true, + "dist": { + "shasum": "fd9b6aca66495fd0f7e97f86e71c7706ca9ae754" + }, + "_from": "async@0.1.9" +} diff --git a/node_modules/request/node_modules/form-data/node_modules/async/test/.swp b/node_modules/request/node_modules/form-data/node_modules/async/test/.swp new file mode 100644 index 0000000000000000000000000000000000000000..ece9b6bb6a4f01d31a8613468ccc9244e256ea4d GIT binary patch literal 12288 zcmeI2y>1gh5XU!k2=O6!fx#G*1bfd;q(nN!t|DZl1PM@R*c9ixB|hhTd)%IJ+yq_& z3R-G9L;(dAk3r27P#`h8Hj0FhDR2|%Kho^%?9R;1{jOTw_FGTx@6)#25G>b(c>C(Z z{-Njzc}a*kGFg`WCKRNaX>-TxySGFHn-?2hK00ck)1V8`;KmY_l00ck)1pbRatF`szv%4rQ2h}JO z&i%`hkMQef!&#D>HT{)qIkZB`K-8$SMB#Eo565YIOg)_yA?@62cf$csiJIY&p>aV; zS`zJsiOzJTi5`We&Z7~}Y-mkcHTzSdlTe@N*jMYNNtz#pT-S?SSJF;oz2PRsbQbfN z^T_JwW1Yu3q^Bx4tT)t7Y)Y+euPUh$byuyaj_Nj)9PpNm{ZJJ3#yWe(d8R*fCe5FD z*G_m-$$oUq=Ctm6anI2SxelGUw*7iAFe4o-xY}N$2f8XJw40WE>)n)7+DmQ4?=>s* V?{PKv`7hd=TWkEtC4RDw_ysbD&=&vz literal 0 HcmV?d00001 diff --git a/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js b/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js new file mode 100644 index 0000000..8c2cebd --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js @@ -0,0 +1,1367 @@ +var async = require('../lib/async'); + + +exports['auto'] = function(test){ + var callOrder = []; + var testdata = [{test: 'test'}]; + async.auto({ + task1: ['task2', function(callback){ + setTimeout(function(){ + callOrder.push('task1'); + callback(); + }, 25); + }], + task2: function(callback){ + setTimeout(function(){ + callOrder.push('task2'); + callback(); + }, 50); + }, + task3: ['task2', function(callback){ + callOrder.push('task3'); + callback(); + }], + task4: ['task1', 'task2', function(callback){ + callOrder.push('task4'); + callback(); + }] + }, + function(err){ + test.same(callOrder, ['task2','task3','task1','task4']); + test.done(); + }); +}; + +exports['auto empty object'] = function(test){ + async.auto({}, function(err){ + test.done(); + }); +}; + +exports['auto error'] = function(test){ + test.expect(1); + async.auto({ + task1: function(callback){ + callback('testerror'); + }, + task2: ['task1', function(callback){ + test.ok(false, 'task2 should not be called'); + callback(); + }], + task3: function(callback){ + callback('testerror2'); + } + }, + function(err){ + test.equals(err, 'testerror'); + }); + setTimeout(test.done, 100); +}; + +exports['auto no callback'] = function(test){ + async.auto({ + task1: function(callback){callback();}, + task2: ['task1', function(callback){callback(); test.done();}] + }); +}; + +exports['waterfall'] = function(test){ + test.expect(6); + var call_order = []; + async.waterfall([ + function(callback){ + call_order.push('fn1'); + setTimeout(function(){callback(null, 'one', 'two');}, 0); + }, + function(arg1, arg2, callback){ + call_order.push('fn2'); + test.equals(arg1, 'one'); + test.equals(arg2, 'two'); + setTimeout(function(){callback(null, arg1, arg2, 'three');}, 25); + }, + function(arg1, arg2, arg3, callback){ + call_order.push('fn3'); + test.equals(arg1, 'one'); + test.equals(arg2, 'two'); + test.equals(arg3, 'three'); + callback(null, 'four'); + }, + function(arg4, callback){ + call_order.push('fn4'); + test.same(call_order, ['fn1','fn2','fn3','fn4']); + callback(null, 'test'); + } + ], function(err){ + test.done(); + }); +}; + +exports['waterfall empty array'] = function(test){ + async.waterfall([], function(err){ + test.done(); + }); +}; + +exports['waterfall no callback'] = function(test){ + async.waterfall([ + function(callback){callback();}, + function(callback){callback(); test.done();} + ]); +}; + +exports['waterfall async'] = function(test){ + var call_order = []; + async.waterfall([ + function(callback){ + call_order.push(1); + callback(); + call_order.push(2); + }, + function(callback){ + call_order.push(3); + callback(); + }, + function(){ + test.same(call_order, [1,2,3]); + test.done(); + } + ]); +}; + +exports['waterfall error'] = function(test){ + test.expect(1); + async.waterfall([ + function(callback){ + callback('error'); + }, + function(callback){ + test.ok(false, 'next function should not be called'); + callback(); + } + ], function(err){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['waterfall multiple callback calls'] = function(test){ + var call_order = []; + var arr = [ + function(callback){ + call_order.push(1); + // call the callback twice. this should call function 2 twice + callback(null, 'one', 'two'); + callback(null, 'one', 'two'); + }, + function(arg1, arg2, callback){ + call_order.push(2); + callback(null, arg1, arg2, 'three'); + }, + function(arg1, arg2, arg3, callback){ + call_order.push(3); + callback(null, 'four'); + }, + function(arg4){ + call_order.push(4); + arr[3] = function(){ + call_order.push(4); + test.same(call_order, [1,2,2,3,3,4,4]); + test.done(); + }; + } + ]; + async.waterfall(arr); +}; + + +exports['parallel'] = function(test){ + var call_order = []; + async.parallel([ + function(callback){ + setTimeout(function(){ + call_order.push(1); + callback(null, 1); + }, 25); + }, + function(callback){ + setTimeout(function(){ + call_order.push(2); + callback(null, 2); + }, 50); + }, + function(callback){ + setTimeout(function(){ + call_order.push(3); + callback(null, 3,3); + }, 15); + } + ], + function(err, results){ + test.equals(err, null); + test.same(call_order, [3,1,2]); + test.same(results, [1,2,[3,3]]); + test.done(); + }); +}; + +exports['parallel empty array'] = function(test){ + async.parallel([], function(err, results){ + test.equals(err, null); + test.same(results, []); + test.done(); + }); +}; + +exports['parallel error'] = function(test){ + async.parallel([ + function(callback){ + callback('error', 1); + }, + function(callback){ + callback('error2', 2); + } + ], + function(err, results){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 100); +}; + +exports['parallel no callback'] = function(test){ + async.parallel([ + function(callback){callback();}, + function(callback){callback(); test.done();}, + ]); +}; + +exports['parallel object'] = function(test){ + var call_order = []; + async.parallel({ + one: function(callback){ + setTimeout(function(){ + call_order.push(1); + callback(null, 1); + }, 25); + }, + two: function(callback){ + setTimeout(function(){ + call_order.push(2); + callback(null, 2); + }, 50); + }, + three: function(callback){ + setTimeout(function(){ + call_order.push(3); + callback(null, 3,3); + }, 15); + } + }, + function(err, results){ + test.equals(err, null); + test.same(call_order, [3,1,2]); + test.same(results, { + one: 1, + two: 2, + three: [3,3] + }); + test.done(); + }); +}; + +exports['series'] = function(test){ + var call_order = []; + async.series([ + function(callback){ + setTimeout(function(){ + call_order.push(1); + callback(null, 1); + }, 25); + }, + function(callback){ + setTimeout(function(){ + call_order.push(2); + callback(null, 2); + }, 50); + }, + function(callback){ + setTimeout(function(){ + call_order.push(3); + callback(null, 3,3); + }, 15); + } + ], + function(err, results){ + test.equals(err, null); + test.same(results, [1,2,[3,3]]); + test.same(call_order, [1,2,3]); + test.done(); + }); +}; + +exports['series empty array'] = function(test){ + async.series([], function(err, results){ + test.equals(err, null); + test.same(results, []); + test.done(); + }); +}; + +exports['series error'] = function(test){ + test.expect(1); + async.series([ + function(callback){ + callback('error', 1); + }, + function(callback){ + test.ok(false, 'should not be called'); + callback('error2', 2); + } + ], + function(err, results){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 100); +}; + +exports['series no callback'] = function(test){ + async.series([ + function(callback){callback();}, + function(callback){callback(); test.done();}, + ]); +}; + +exports['series object'] = function(test){ + var call_order = []; + async.series({ + one: function(callback){ + setTimeout(function(){ + call_order.push(1); + callback(null, 1); + }, 25); + }, + two: function(callback){ + setTimeout(function(){ + call_order.push(2); + callback(null, 2); + }, 50); + }, + three: function(callback){ + setTimeout(function(){ + call_order.push(3); + callback(null, 3,3); + }, 15); + } + }, + function(err, results){ + test.equals(err, null); + test.same(results, { + one: 1, + two: 2, + three: [3,3] + }); + test.same(call_order, [1,2,3]); + test.done(); + }); +}; + +exports['iterator'] = function(test){ + var call_order = []; + var iterator = async.iterator([ + function(){call_order.push(1);}, + function(arg1){ + test.equals(arg1, 'arg1'); + call_order.push(2); + }, + function(arg1, arg2){ + test.equals(arg1, 'arg1'); + test.equals(arg2, 'arg2'); + call_order.push(3); + } + ]); + iterator(); + test.same(call_order, [1]); + var iterator2 = iterator(); + test.same(call_order, [1,1]); + var iterator3 = iterator2('arg1'); + test.same(call_order, [1,1,2]); + var iterator4 = iterator3('arg1', 'arg2'); + test.same(call_order, [1,1,2,3]); + test.equals(iterator4, undefined); + test.done(); +}; + +exports['iterator empty array'] = function(test){ + var iterator = async.iterator([]); + test.equals(iterator(), undefined); + test.equals(iterator.next(), undefined); + test.done(); +}; + +exports['iterator.next'] = function(test){ + var call_order = []; + var iterator = async.iterator([ + function(){call_order.push(1);}, + function(arg1){ + test.equals(arg1, 'arg1'); + call_order.push(2); + }, + function(arg1, arg2){ + test.equals(arg1, 'arg1'); + test.equals(arg2, 'arg2'); + call_order.push(3); + } + ]); + var fn = iterator.next(); + var iterator2 = fn('arg1'); + test.same(call_order, [2]); + iterator2('arg1','arg2'); + test.same(call_order, [2,3]); + test.equals(iterator2.next(), undefined); + test.done(); +}; + +exports['forEach'] = function(test){ + var args = []; + async.forEach([1,3,2], function(x, callback){ + setTimeout(function(){ + args.push(x); + callback(); + }, x*25); + }, function(err){ + test.same(args, [1,2,3]); + test.done(); + }); +}; + +exports['forEach empty array'] = function(test){ + test.expect(1); + async.forEach([], function(x, callback){ + test.ok(false, 'iterator should not be called'); + callback(); + }, function(err){ + test.ok(true, 'should call callback'); + }); + setTimeout(test.done, 25); +}; + +exports['forEach error'] = function(test){ + test.expect(1); + async.forEach([1,2,3], function(x, callback){ + callback('error'); + }, function(err){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['forEachSeries'] = function(test){ + var args = []; + async.forEachSeries([1,3,2], function(x, callback){ + setTimeout(function(){ + args.push(x); + callback(); + }, x*25); + }, function(err){ + test.same(args, [1,3,2]); + test.done(); + }); +}; + +exports['forEachSeries empty array'] = function(test){ + test.expect(1); + async.forEachSeries([], function(x, callback){ + test.ok(false, 'iterator should not be called'); + callback(); + }, function(err){ + test.ok(true, 'should call callback'); + }); + setTimeout(test.done, 25); +}; + +exports['forEachSeries error'] = function(test){ + test.expect(2); + var call_order = []; + async.forEachSeries([1,2,3], function(x, callback){ + call_order.push(x); + callback('error'); + }, function(err){ + test.same(call_order, [1]); + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['map'] = function(test){ + var call_order = []; + async.map([1,3,2], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(null, x*2); + }, x*25); + }, function(err, results){ + test.same(call_order, [1,2,3]); + test.same(results, [2,6,4]); + test.done(); + }); +}; + +exports['map original untouched'] = function(test){ + var a = [1,2,3]; + async.map(a, function(x, callback){ + callback(null, x*2); + }, function(err, results){ + test.same(results, [2,4,6]); + test.same(a, [1,2,3]); + test.done(); + }); +}; + +exports['map error'] = function(test){ + test.expect(1); + async.map([1,2,3], function(x, callback){ + callback('error'); + }, function(err, results){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['mapSeries'] = function(test){ + var call_order = []; + async.mapSeries([1,3,2], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(null, x*2); + }, x*25); + }, function(err, results){ + test.same(call_order, [1,3,2]); + test.same(results, [2,6,4]); + test.done(); + }); +}; + +exports['mapSeries error'] = function(test){ + test.expect(1); + async.mapSeries([1,2,3], function(x, callback){ + callback('error'); + }, function(err, results){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['reduce'] = function(test){ + var call_order = []; + async.reduce([1,2,3], 0, function(a, x, callback){ + call_order.push(x); + callback(null, a + x); + }, function(err, result){ + test.equals(result, 6); + test.same(call_order, [1,2,3]); + test.done(); + }); +}; + +exports['reduce async with non-reference memo'] = function(test){ + async.reduce([1,3,2], 0, function(a, x, callback){ + setTimeout(function(){callback(null, a + x)}, Math.random()*100); + }, function(err, result){ + test.equals(result, 6); + test.done(); + }); +}; + +exports['reduce error'] = function(test){ + test.expect(1); + async.reduce([1,2,3], 0, function(a, x, callback){ + callback('error'); + }, function(err, result){ + test.equals(err, 'error'); + }); + setTimeout(test.done, 50); +}; + +exports['inject alias'] = function(test){ + test.equals(async.inject, async.reduce); + test.done(); +}; + +exports['foldl alias'] = function(test){ + test.equals(async.foldl, async.reduce); + test.done(); +}; + +exports['reduceRight'] = function(test){ + var call_order = []; + var a = [1,2,3]; + async.reduceRight(a, 0, function(a, x, callback){ + call_order.push(x); + callback(null, a + x); + }, function(err, result){ + test.equals(result, 6); + test.same(call_order, [3,2,1]); + test.same(a, [1,2,3]); + test.done(); + }); +}; + +exports['foldr alias'] = function(test){ + test.equals(async.foldr, async.reduceRight); + test.done(); +}; + +exports['filter'] = function(test){ + async.filter([3,1,2], function(x, callback){ + setTimeout(function(){callback(x % 2);}, x*25); + }, function(results){ + test.same(results, [3,1]); + test.done(); + }); +}; + +exports['filter original untouched'] = function(test){ + var a = [3,1,2]; + async.filter(a, function(x, callback){ + callback(x % 2); + }, function(results){ + test.same(results, [3,1]); + test.same(a, [3,1,2]); + test.done(); + }); +}; + +exports['filterSeries'] = function(test){ + async.filterSeries([3,1,2], function(x, callback){ + setTimeout(function(){callback(x % 2);}, x*25); + }, function(results){ + test.same(results, [3,1]); + test.done(); + }); +}; + +exports['select alias'] = function(test){ + test.equals(async.select, async.filter); + test.done(); +}; + +exports['selectSeries alias'] = function(test){ + test.equals(async.selectSeries, async.filterSeries); + test.done(); +}; + +exports['reject'] = function(test){ + async.reject([3,1,2], function(x, callback){ + setTimeout(function(){callback(x % 2);}, x*25); + }, function(results){ + test.same(results, [2]); + test.done(); + }); +}; + +exports['reject original untouched'] = function(test){ + var a = [3,1,2]; + async.reject(a, function(x, callback){ + callback(x % 2); + }, function(results){ + test.same(results, [2]); + test.same(a, [3,1,2]); + test.done(); + }); +}; + +exports['rejectSeries'] = function(test){ + async.rejectSeries([3,1,2], function(x, callback){ + setTimeout(function(){callback(x % 2);}, x*25); + }, function(results){ + test.same(results, [2]); + test.done(); + }); +}; + +exports['some true'] = function(test){ + async.some([3,1,2], function(x, callback){ + setTimeout(function(){callback(x === 1);}, 0); + }, function(result){ + test.equals(result, true); + test.done(); + }); +}; + +exports['some false'] = function(test){ + async.some([3,1,2], function(x, callback){ + setTimeout(function(){callback(x === 10);}, 0); + }, function(result){ + test.equals(result, false); + test.done(); + }); +}; + +exports['some early return'] = function(test){ + var call_order = []; + async.some([1,2,3], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(x === 1); + }, x*25); + }, function(result){ + call_order.push('callback'); + }); + setTimeout(function(){ + test.same(call_order, [1,'callback',2,3]); + test.done(); + }, 100); +}; + +exports['any alias'] = function(test){ + test.equals(async.any, async.some); + test.done(); +}; + +exports['every true'] = function(test){ + async.every([1,2,3], function(x, callback){ + setTimeout(function(){callback(true);}, 0); + }, function(result){ + test.equals(result, true); + test.done(); + }); +}; + +exports['every false'] = function(test){ + async.every([1,2,3], function(x, callback){ + setTimeout(function(){callback(x % 2);}, 0); + }, function(result){ + test.equals(result, false); + test.done(); + }); +}; + +exports['every early return'] = function(test){ + var call_order = []; + async.every([1,2,3], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(x === 1); + }, x*25); + }, function(result){ + call_order.push('callback'); + }); + setTimeout(function(){ + test.same(call_order, [1,2,'callback',3]); + test.done(); + }, 100); +}; + +exports['all alias'] = function(test){ + test.equals(async.all, async.every); + test.done(); +}; + +exports['detect'] = function(test){ + var call_order = []; + async.detect([3,2,1], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(x == 2); + }, x*25); + }, function(result){ + call_order.push('callback'); + test.equals(result, 2); + }); + setTimeout(function(){ + test.same(call_order, [1,2,'callback',3]); + test.done(); + }, 100); +}; + +exports['detectSeries'] = function(test){ + var call_order = []; + async.detectSeries([3,2,1], function(x, callback){ + setTimeout(function(){ + call_order.push(x); + callback(x == 2); + }, x*25); + }, function(result){ + call_order.push('callback'); + test.equals(result, 2); + }); + setTimeout(function(){ + test.same(call_order, [3,2,'callback']); + test.done(); + }, 200); +}; + +exports['sortBy'] = function(test){ + async.sortBy([{a:1},{a:15},{a:6}], function(x, callback){ + setTimeout(function(){callback(null, x.a);}, 0); + }, function(err, result){ + test.same(result, [{a:1},{a:6},{a:15}]); + test.done(); + }); +}; + +exports['apply'] = function(test){ + test.expect(6); + var fn = function(){ + test.same(Array.prototype.slice.call(arguments), [1,2,3,4]) + }; + async.apply(fn, 1, 2, 3, 4)(); + async.apply(fn, 1, 2, 3)(4); + async.apply(fn, 1, 2)(3, 4); + async.apply(fn, 1)(2, 3, 4); + async.apply(fn)(1, 2, 3, 4); + test.equals( + async.apply(function(name){return 'hello ' + name}, 'world')(), + 'hello world' + ); + test.done(); +}; + + +// generates tests for console functions such as async.log +var console_fn_tests = function(name){ + + if (typeof console !== 'undefined') { + exports[name] = function(test){ + test.expect(5); + var fn = function(arg1, callback){ + test.equals(arg1, 'one'); + setTimeout(function(){callback(null, 'test');}, 0); + }; + var fn_err = function(arg1, callback){ + test.equals(arg1, 'one'); + setTimeout(function(){callback('error');}, 0); + }; + var _console_fn = console[name]; + var _error = console.error; + console[name] = function(val){ + test.equals(val, 'test'); + test.equals(arguments.length, 1); + console.error = function(val){ + test.equals(val, 'error'); + console[name] = _console_fn; + console.error = _error; + test.done(); + }; + async[name](fn_err, 'one'); + }; + async[name](fn, 'one'); + }; + + exports[name + ' with multiple result params'] = function(test){ + var fn = function(callback){callback(null,'one','two','three');}; + var _console_fn = console[name]; + var called_with = []; + console[name] = function(x){ + called_with.push(x); + }; + async[name](fn); + test.same(called_with, ['one','two','three']); + console[name] = _console_fn; + test.done(); + }; + } + + // browser-only test + exports[name + ' without console.' + name] = function(test){ + if (typeof window !== 'undefined') { + var _console = window.console; + window.console = undefined; + var fn = function(callback){callback(null, 'val');}; + var fn_err = function(callback){callback('error');}; + async[name](fn); + async[name](fn_err); + window.console = _console; + } + test.done(); + }; + +}; + +console_fn_tests('log'); +console_fn_tests('dir'); +/*console_fn_tests('info'); +console_fn_tests('warn'); +console_fn_tests('error');*/ + +exports['nextTick'] = function(test){ + var call_order = []; + async.nextTick(function(){call_order.push('two');}); + call_order.push('one'); + setTimeout(function(){ + test.same(call_order, ['one','two']); + test.done(); + }, 50); +}; + +exports['nextTick in the browser'] = function(test){ + if (typeof process !== 'undefined') { + // skip this test in node + return test.done(); + } + test.expect(1); + + var call_order = []; + async.nextTick(function(){call_order.push('two');}); + + call_order.push('one'); + setTimeout(function(){ + if (typeof process !== 'undefined') { + process.nextTick = _nextTick; + } + test.same(call_order, ['one','two']); + }, 50); + setTimeout(test.done, 100); +}; + +exports['noConflict - node only'] = function(test){ + if (typeof process !== 'undefined') { + // node only test + test.expect(3); + var fs = require('fs'); + var filename = __dirname + '/../lib/async.js'; + fs.readFile(filename, function(err, content){ + if(err) return test.done(); + var Script = process.binding('evals').Script; + + var s = new Script(content, filename); + var s2 = new Script( + content + 'this.async2 = this.async.noConflict();', + filename + ); + + var sandbox1 = {async: 'oldvalue'}; + s.runInNewContext(sandbox1); + test.ok(sandbox1.async); + + var sandbox2 = {async: 'oldvalue'}; + s2.runInNewContext(sandbox2); + test.equals(sandbox2.async, 'oldvalue'); + test.ok(sandbox2.async2); + + test.done(); + }); + } + else test.done(); +}; + +exports['concat'] = function(test){ + var call_order = []; + var iterator = function (x, cb) { + setTimeout(function(){ + call_order.push(x); + var r = []; + while (x > 0) { + r.push(x); + x--; + } + cb(null, r); + }, x*25); + }; + async.concat([1,3,2], iterator, function(err, results){ + test.same(results, [1,2,1,3,2,1]); + test.same(call_order, [1,2,3]); + test.ok(!err); + test.done(); + }); +}; + +exports['concat error'] = function(test){ + var iterator = function (x, cb) { + cb(new Error('test error')); + }; + async.concat([1,2,3], iterator, function(err, results){ + test.ok(err); + test.done(); + }); +}; + +exports['concatSeries'] = function(test){ + var call_order = []; + var iterator = function (x, cb) { + setTimeout(function(){ + call_order.push(x); + var r = []; + while (x > 0) { + r.push(x); + x--; + } + cb(null, r); + }, x*25); + }; + async.concatSeries([1,3,2], iterator, function(err, results){ + test.same(results, [1,3,2,1,2,1]); + test.same(call_order, [1,3,2]); + test.ok(!err); + test.done(); + }); +}; + +exports['until'] = function (test) { + var call_order = []; + + var count = 0; + async.until( + function () { + call_order.push(['test', count]); + return (count == 5); + }, + function (cb) { + call_order.push(['iterator', count]); + count++; + cb(); + }, + function (err) { + test.same(call_order, [ + ['test', 0], + ['iterator', 0], ['test', 1], + ['iterator', 1], ['test', 2], + ['iterator', 2], ['test', 3], + ['iterator', 3], ['test', 4], + ['iterator', 4], ['test', 5], + ]); + test.equals(count, 5); + test.done(); + } + ); +}; + +exports['whilst'] = function (test) { + var call_order = []; + + var count = 0; + async.whilst( + function () { + call_order.push(['test', count]); + return (count < 5); + }, + function (cb) { + call_order.push(['iterator', count]); + count++; + cb(); + }, + function (err) { + test.same(call_order, [ + ['test', 0], + ['iterator', 0], ['test', 1], + ['iterator', 1], ['test', 2], + ['iterator', 2], ['test', 3], + ['iterator', 3], ['test', 4], + ['iterator', 4], ['test', 5], + ]); + test.equals(count, 5); + test.done(); + } + ); +}; + +exports['queue'] = function (test) { + var call_order = [], + delays = [40,20,60,20]; + + // worker1: --1-4 + // worker2: -2---3 + // order of completion: 2,1,4,3 + + var q = async.queue(function (task, callback) { + setTimeout(function () { + call_order.push('process ' + task); + callback('error', 'arg'); + }, delays.splice(0,1)[0]); + }, 2); + + q.push(1, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 1); + call_order.push('callback ' + 1); + }); + q.push(2, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 2); + call_order.push('callback ' + 2); + }); + q.push(3, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 0); + call_order.push('callback ' + 3); + }); + q.push(4, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 0); + call_order.push('callback ' + 4); + }); + test.equal(q.length(), 4); + test.equal(q.concurrency, 2); + + setTimeout(function () { + test.same(call_order, [ + 'process 2', 'callback 2', + 'process 1', 'callback 1', + 'process 4', 'callback 4', + 'process 3', 'callback 3' + ]); + test.equal(q.concurrency, 2); + test.equal(q.length(), 0); + test.done(); + }, 200); +}; + +exports['queue changing concurrency'] = function (test) { + var call_order = [], + delays = [40,20,60,20]; + + // worker1: --1-2---3-4 + // order of completion: 1,2,3,4 + + var q = async.queue(function (task, callback) { + setTimeout(function () { + call_order.push('process ' + task); + callback('error', 'arg'); + }, delays.splice(0,1)[0]); + }, 2); + + q.push(1, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 3); + call_order.push('callback ' + 1); + }); + q.push(2, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 2); + call_order.push('callback ' + 2); + }); + q.push(3, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 1); + call_order.push('callback ' + 3); + }); + q.push(4, function (err, arg) { + test.equal(err, 'error'); + test.equal(arg, 'arg'); + test.equal(q.length(), 0); + call_order.push('callback ' + 4); + }); + test.equal(q.length(), 4); + test.equal(q.concurrency, 2); + q.concurrency = 1; + + setTimeout(function () { + test.same(call_order, [ + 'process 1', 'callback 1', + 'process 2', 'callback 2', + 'process 3', 'callback 3', + 'process 4', 'callback 4' + ]); + test.equal(q.concurrency, 1); + test.equal(q.length(), 0); + test.done(); + }, 250); +}; + +exports['queue push without callback'] = function (test) { + var call_order = [], + delays = [40,20,60,20]; + + // worker1: --1-4 + // worker2: -2---3 + // order of completion: 2,1,4,3 + + var q = async.queue(function (task, callback) { + setTimeout(function () { + call_order.push('process ' + task); + callback('error', 'arg'); + }, delays.splice(0,1)[0]); + }, 2); + + q.push(1); + q.push(2); + q.push(3); + q.push(4); + + setTimeout(function () { + test.same(call_order, [ + 'process 2', + 'process 1', + 'process 4', + 'process 3' + ]); + test.done(); + }, 200); +}; + +exports['memoize'] = function (test) { + test.expect(4); + var call_order = []; + + var fn = function (arg1, arg2, callback) { + call_order.push(['fn', arg1, arg2]); + callback(null, arg1 + arg2); + }; + + var fn2 = async.memoize(fn); + fn2(1, 2, function (err, result) { + test.equal(result, 3); + }); + fn2(1, 2, function (err, result) { + test.equal(result, 3); + }); + fn2(2, 2, function (err, result) { + test.equal(result, 4); + }); + + test.same(call_order, [['fn',1,2], ['fn',2,2]]); + test.done(); +}; + +exports['memoize error'] = function (test) { + test.expect(1); + var testerr = new Error('test'); + var fn = function (arg1, arg2, callback) { + callback(testerr, arg1 + arg2); + }; + async.memoize(fn)(1, 2, function (err, result) { + test.equal(err, testerr); + }); + test.done(); +}; + +exports['memoize custom hash function'] = function (test) { + test.expect(2); + var testerr = new Error('test'); + + var fn = function (arg1, arg2, callback) { + callback(testerr, arg1 + arg2); + }; + var fn2 = async.memoize(fn, function () { + return 'custom hash'; + }); + fn2(1, 2, function (err, result) { + test.equal(result, 3); + }); + fn2(2, 2, function (err, result) { + test.equal(result, 3); + }); + test.done(); +}; + +// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 +exports['falsy return values in series'] = function (test) { + function taskFalse(callback) { + async.nextTick(function() { + callback(null, false); + }); + }; + function taskUndefined(callback) { + async.nextTick(function() { + callback(null, undefined); + }); + }; + function taskEmpty(callback) { + async.nextTick(function() { + callback(null); + }); + }; + function taskNull(callback) { + async.nextTick(function() { + callback(null, null); + }); + }; + async.series( + [taskFalse, taskUndefined, taskEmpty, taskNull], + function(err, results) { + test.same(results, [false, undefined, undefined, null]); + test.strictEqual(results[0], false); + test.strictEqual(results[1], undefined); + test.strictEqual(results[2], undefined); + test.strictEqual(results[3], null); + test.done(); + } + ); +}; + +// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 +exports['falsy return values in parallel'] = function (test) { + function taskFalse(callback) { + async.nextTick(function() { + callback(null, false); + }); + }; + function taskUndefined(callback) { + async.nextTick(function() { + callback(null, undefined); + }); + }; + function taskEmpty(callback) { + async.nextTick(function() { + callback(null); + }); + }; + function taskNull(callback) { + async.nextTick(function() { + callback(null, null); + }); + }; + async.parallel( + [taskFalse, taskUndefined, taskEmpty, taskNull], + function(err, results) { + test.same(results, [false, undefined, undefined, null]); + test.strictEqual(results[0], false); + test.strictEqual(results[1], undefined); + test.strictEqual(results[2], undefined); + test.strictEqual(results[3], null); + test.done(); + } + ); +}; + +exports['queue events'] = function(test) { + var calls = []; + var q = async.queue(function(task, cb) { + // nop + calls.push('process ' + task); + cb(); + }, 3); + + q.saturated = function() { + test.ok(q.length() == 3, 'queue should be saturated now'); + calls.push('saturated'); + }; + q.empty = function() { + test.ok(q.length() == 0, 'queue should be empty now'); + calls.push('empty'); + }; + q.drain = function() { + test.ok( + q.length() == 0 && q.running() == 0, + 'queue should be empty now and no more workers should be running' + ); + calls.push('drain'); + test.same(calls, [ + 'saturated', + 'process foo', + 'foo cb', + 'process bar', + 'bar cb', + 'process zoo', + 'zoo cb', + 'process poo', + 'poo cb', + 'empty', + 'process moo', + 'moo cb', + 'drain', + ]); + test.done(); + }; + q.push('foo', function () {calls.push('foo cb');}); + q.push('bar', function () {calls.push('bar cb');}); + q.push('zoo', function () {calls.push('zoo cb');}); + q.push('poo', function () {calls.push('poo cb');}); + q.push('moo', function () {calls.push('moo cb');}); +}; diff --git a/node_modules/request/node_modules/form-data/node_modules/async/test/test.html b/node_modules/request/node_modules/form-data/node_modules/async/test/test.html new file mode 100644 index 0000000..2450e2d --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/async/test/test.html @@ -0,0 +1,24 @@ + + + Async.js Test Suite + + + + + + + + +

    Async.js Test Suite

    + + + diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore b/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore new file mode 100644 index 0000000..aba34f0 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore @@ -0,0 +1,3 @@ +*.un~ +/node_modules +/test/tmp diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/License b/node_modules/request/node_modules/form-data/node_modules/combined-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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/request/node_modules/form-data/node_modules/combined-stream/Makefile b/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile new file mode 100644 index 0000000..b4ff85a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md b/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md new file mode 100644 index 0000000..1a9999e --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md @@ -0,0 +1,132 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = true + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = 2 * 1024 * 1024 + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = 0 + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 0000000..03754e6 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,183 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + stream.on('data', this._checkDataSize.bind(this)); + + stream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + var stream = this._streams.shift(); + + + if (!stream) { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)) + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore new file mode 100644 index 0000000..2fedb26 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore @@ -0,0 +1,2 @@ +*.un~ +/node_modules/* diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile new file mode 100644 index 0000000..b4ff85a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md new file mode 100644 index 0000000..5cb5b35 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md @@ -0,0 +1,154 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 0000000..7c10d48 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,99 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +DelayedStream.prototype.__defineGetter__('readable', function() { + return this.source.readable; +}); + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json new file mode 100644 index 0000000..d394b92 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json @@ -0,0 +1,38 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "version": "0.0.5", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + }, + "_npmUser": { + "name": "mikeal", + "email": "mikeal.rogers@gmail.com" + }, + "_id": "delayed-stream@0.0.5", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.8.1", + "_defaultsLoaded": true, + "dist": { + "shasum": "56f46a53506f656e1a549c63d8794c6cf8b6e1fc" + }, + "_from": "delayed-stream@0.0.5" +} diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js new file mode 100644 index 0000000..4d71b8a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js @@ -0,0 +1,6 @@ +var common = module.exports; + +common.DelayedStream = require('..'); +common.assert = require('assert'); +common.fake = require('fake'); +common.PORT = 49252; diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js new file mode 100644 index 0000000..9ecad5b --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js @@ -0,0 +1,38 @@ +var common = require('../common'); +var assert = common.assert; +var DelayedStream = common.DelayedStream; +var http = require('http'); + +var UPLOAD = new Buffer(10 * 1024 * 1024); + +var server = http.createServer(function(req, res) { + var delayed = DelayedStream.create(req, {maxDataSize: UPLOAD.length}); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 10); +}); +server.listen(common.PORT, function() { + var request = http.request({ + method: 'POST', + port: common.PORT, + }); + + request.write(UPLOAD); + request.end(); + + request.on('response', function(res) { + var received = 0; + res + .on('data', function(chunk) { + received += chunk.length; + }) + .on('end', function() { + assert.equal(received, UPLOAD.length); + server.close(); + }); + }); +}); + + diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js new file mode 100644 index 0000000..6f417f3 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js @@ -0,0 +1,21 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testAutoPause() { + var source = new Stream(); + + fake.expect(source, 'pause', 1); + var delayedStream = DelayedStream.create(source); + fake.verify(); +})(); + +(function testDisableAutoPause() { + var source = new Stream(); + fake.expect(source, 'pause', 0); + + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + fake.verify(); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js new file mode 100644 index 0000000..b50c397 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js @@ -0,0 +1,14 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testDelayEventsUntilResume() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + + fake.expect(source, 'pause'); + delayedStream.pause(); + fake.verify(); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js new file mode 100644 index 0000000..fc4047e --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js @@ -0,0 +1,48 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testDelayEventsUntilResume() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + + // delayedStream must not emit until we resume + fake.expect(delayedStream, 'emit', 0); + + // but our original source must emit + var params = []; + source.on('foo', function(param) { + params.push(param); + }); + + source.emit('foo', 1); + source.emit('foo', 2); + + // Make sure delayedStream did not emit, and source did + assert.deepEqual(params, [1, 2]); + fake.verify(); + + // After resume, delayedStream must playback all events + fake + .stub(delayedStream, 'emit') + .times(Infinity) + .withArg(1, 'newListener'); + fake.expect(delayedStream, 'emit', ['foo', 1]); + fake.expect(delayedStream, 'emit', ['foo', 2]); + fake.expect(source, 'resume'); + + delayedStream.resume(); + fake.verify(); + + // Calling resume again will delegate to source + fake.expect(source, 'resume'); + delayedStream.resume(); + fake.verify(); + + // Emitting more events directly leads to them being emitted + fake.expect(delayedStream, 'emit', ['foo', 3]); + source.emit('foo', 3); + fake.verify(); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js new file mode 100644 index 0000000..a9d35e7 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js @@ -0,0 +1,15 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testHandleSourceErrors() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + + // We deal with this by attaching a no-op listener to 'error' on the source + // when creating a new DelayedStream. This way error events on the source + // won't throw. + source.emit('error', new Error('something went wrong')); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js new file mode 100644 index 0000000..7638a2b --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js @@ -0,0 +1,18 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testMaxDataSize() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {maxDataSize: 1024, pauseStream: false}); + + source.emit('data', new Buffer(1024)); + + fake + .expect(delayedStream, 'emit') + .withArg(1, 'error'); + source.emit('data', new Buffer(1)); + fake.verify(); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js new file mode 100644 index 0000000..7d312ab --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js @@ -0,0 +1,13 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testPipeReleases() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + + fake.expect(delayedStream, 'resume'); + delayedStream.pipe(new Stream()); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js new file mode 100644 index 0000000..d436163 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js @@ -0,0 +1,13 @@ +var common = require('../common'); +var assert = common.assert; +var fake = common.fake.create(); +var DelayedStream = common.DelayedStream; +var Stream = require('stream').Stream; + +(function testProxyReadableProperty() { + var source = new Stream(); + var delayedStream = DelayedStream.create(source, {pauseStream: false}); + + source.readable = fake.value('source.readable'); + assert.strictEqual(delayedStream.readable, source.readable); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js new file mode 100755 index 0000000..0bb8e82 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var far = require('far').create(); + +far.add(__dirname); +far.include(/test-.*\.js$/); + +far.execute(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json new file mode 100644 index 0000000..7bb0fcf --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json @@ -0,0 +1,39 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "0.0.3", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "engines": { + "node": "*" + }, + "dependencies": { + "delayed-stream": "0.0.5" + }, + "devDependencies": { + "far": "0.0.1" + }, + "_npmUser": { + "name": "mikeal", + "email": "mikeal.rogers@gmail.com" + }, + "_id": "combined-stream@0.0.3", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.8.1", + "_defaultsLoaded": true, + "dist": { + "shasum": "c41c9899277b587901bb6ce4bf458b94693afafa" + }, + "_from": "combined-stream@0.0.3" +} diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js new file mode 100644 index 0000000..aa9ab3a --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js @@ -0,0 +1,12 @@ +var common = module.exports; + +var path = require('path'); +var root = path.join(__dirname, '..'); + +common.dir = { + fixture: root + '/test/fixture', + tmp: root + '/test/tmp', +}; + +common.CombinedStream = require(root); +common.assert = require('assert'); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt new file mode 100644 index 0000000..50e0218 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt @@ -0,0 +1,256 @@ +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 +10101010101010101010101010101010101010101010101010101010101010101010101010101010 +01010101010101010101010101010101010101010101010101010101010101010101010101010101 diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt new file mode 100644 index 0000000..da1d821 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt @@ -0,0 +1,256 @@ +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 +20202020202020202020202020202020202020202020202020202020202020202020202020202020 +02020202020202020202020202020202020202020202020202020202020202020202020202020202 diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js new file mode 100644 index 0000000..44ecaba --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js @@ -0,0 +1,27 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; +var fs = require('fs'); + +var FILE1 = common.dir.fixture + '/file1.txt'; +var FILE2 = common.dir.fixture + '/file2.txt'; +var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); + +(function testDelayedStreams() { + var combinedStream = CombinedStream.create(); + combinedStream.append(function(next) { + next(fs.createReadStream(FILE1)); + }); + combinedStream.append(function(next) { + next(fs.createReadStream(FILE2)); + }); + + var tmpFile = common.dir.tmp + '/combined.txt'; + var dest = fs.createWriteStream(tmpFile); + combinedStream.pipe(dest); + + dest.on('end', function() { + var written = fs.readFileSync(tmpFile, 'utf8'); + assert.strictEqual(written, EXPECTED); + }); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js new file mode 100644 index 0000000..e3fbd18 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js @@ -0,0 +1,34 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; + +(function testDataSizeGetter() { + var combinedStream = CombinedStream.create(); + + assert.strictEqual(combinedStream.dataSize, 0); + + // Test one stream + combinedStream._streams.push({dataSize: 10}); + combinedStream._updateDataSize(); + assert.strictEqual(combinedStream.dataSize, 10); + + // Test two streams + combinedStream._streams.push({dataSize: 23}); + combinedStream._updateDataSize(); + assert.strictEqual(combinedStream.dataSize, 33); + + // Test currentStream + combinedStream._currentStream = {dataSize: 20}; + combinedStream._updateDataSize(); + assert.strictEqual(combinedStream.dataSize, 53); + + // Test currentStream without dataSize + combinedStream._currentStream = {}; + combinedStream._updateDataSize(); + assert.strictEqual(combinedStream.dataSize, 33); + + // Test stream function + combinedStream._streams.push(function() {}); + combinedStream._updateDataSize(); + assert.strictEqual(combinedStream.dataSize, 33); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js new file mode 100644 index 0000000..c678575 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js @@ -0,0 +1,38 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; +var fs = require('fs'); + +var FILE1 = common.dir.fixture + '/file1.txt'; +var BUFFER = new Buffer('Bacon is delicious'); +var FILE2 = common.dir.fixture + '/file2.txt'; +var STRING = 'The € kicks the $\'s ass!'; + +var EXPECTED = + fs.readFileSync(FILE1) + + BUFFER + + fs.readFileSync(FILE2) + + STRING; +var GOT; + +(function testDelayedStreams() { + var combinedStream = CombinedStream.create(); + combinedStream.append(fs.createReadStream(FILE1)); + combinedStream.append(BUFFER); + combinedStream.append(fs.createReadStream(FILE2)); + combinedStream.append(function(next) { + next(STRING); + }); + + var tmpFile = common.dir.tmp + '/combined-file1-buffer-file2-string.txt'; + var dest = fs.createWriteStream(tmpFile); + combinedStream.pipe(dest); + + dest.on('close', function() { + GOT = fs.readFileSync(tmpFile, 'utf8'); + }); +})(); + +process.on('exit', function() { + assert.strictEqual(GOT, EXPECTED); +}); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js new file mode 100644 index 0000000..263cfdf --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js @@ -0,0 +1,35 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; +var fs = require('fs'); + +var FILE1 = common.dir.fixture + '/file1.txt'; +var FILE2 = common.dir.fixture + '/file2.txt'; +var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); +var GOT; + +(function testDelayedStreams() { + var combinedStream = CombinedStream.create(); + combinedStream.append(fs.createReadStream(FILE1)); + combinedStream.append(fs.createReadStream(FILE2)); + + var stream1 = combinedStream._streams[0]; + var stream2 = combinedStream._streams[1]; + + stream1.on('end', function() { + assert.equal(stream2.dataSize, 0); + }); + + var tmpFile = common.dir.tmp + '/combined.txt'; + var dest = fs.createWriteStream(tmpFile); + combinedStream.pipe(dest); + + dest.on('close', function() { + GOT = fs.readFileSync(tmpFile, 'utf8'); + }); +})(); + +process.on('exit', function() { + console.error(GOT.length, EXPECTED.length); + assert.strictEqual(GOT, EXPECTED); +}); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js new file mode 100644 index 0000000..25f47a4 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js @@ -0,0 +1,24 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; +var fs = require('fs'); + +var FILE1 = common.dir.fixture + '/file1.txt'; +var FILE2 = common.dir.fixture + '/file2.txt'; +var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); + +(function testDelayedStreams() { + var combinedStream = CombinedStream.create({pauseStreams: false, maxDataSize: 20736}); + combinedStream.append(fs.createReadStream(FILE1)); + combinedStream.append(fs.createReadStream(FILE2)); + + var gotErr = null; + combinedStream.on('error', function(err) { + gotErr = err; + }); + + process.on('exit', function() { + assert.ok(gotErr); + assert.ok(gotErr.message.match(/bytes/)); + }); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js new file mode 100644 index 0000000..30a3a6f --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js @@ -0,0 +1,30 @@ +var common = require('../common'); +var assert = common.assert; +var CombinedStream = common.CombinedStream; +var fs = require('fs'); + +var FILE1 = common.dir.fixture + '/file1.txt'; +var FILE2 = common.dir.fixture + '/file2.txt'; +var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); + +(function testDelayedStreams() { + var combinedStream = CombinedStream.create({pauseStreams: false}); + combinedStream.append(fs.createReadStream(FILE1)); + combinedStream.append(fs.createReadStream(FILE2)); + + var stream1 = combinedStream._streams[0]; + var stream2 = combinedStream._streams[1]; + + stream1.on('end', function() { + assert.ok(stream2.dataSize > 0); + }); + + var tmpFile = common.dir.tmp + '/combined.txt'; + var dest = fs.createWriteStream(tmpFile); + combinedStream.pipe(dest); + + dest.on('end', function() { + var written = fs.readFileSync(tmpFile, 'utf8'); + assert.strictEqual(written, EXPECTED); + }); +})(); diff --git a/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js new file mode 100755 index 0000000..0bb8e82 --- /dev/null +++ b/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var far = require('far').create(); + +far.add(__dirname); +far.include(/test-.*\.js$/); + +far.execute(); diff --git a/node_modules/request/node_modules/form-data/package.json b/node_modules/request/node_modules/form-data/package.json new file mode 100644 index 0000000..1948a5e --- /dev/null +++ b/node_modules/request/node_modules/form-data/package.json @@ -0,0 +1,43 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "name": "form-data", + "description": "A module to create readable `\"multipart/form-data\"` streams. Can be used to submit forms and file uploads to other web applications.", + "version": "0.0.3", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-form-data.git" + }, + "main": "./lib/form_data", + "engines": { + "node": "*" + }, + "dependencies": { + "combined-stream": "0.0.3", + "mime": "~1.2.2", + "async": "~0.1.9" + }, + "devDependencies": { + "fake": "0.2.1", + "far": "0.0.1", + "formidable": "1.0.2", + "request": "~2.9.203" + }, + "_npmUser": { + "name": "mikeal", + "email": "mikeal.rogers@gmail.com" + }, + "_id": "form-data@0.0.3", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.8.1", + "_defaultsLoaded": true, + "dist": { + "shasum": "6eea17b45790b42d779a1d581d1b3600fe0c7c0d" + }, + "_from": "form-data" +} diff --git a/node_modules/request/node_modules/form-data/test/common.js b/node_modules/request/node_modules/form-data/test/common.js new file mode 100644 index 0000000..8a26482 --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/common.js @@ -0,0 +1,14 @@ +var common = module.exports; +var path = require('path'); + +var rootDir = path.join(__dirname, '..'); +common.dir = { + lib: rootDir + '/lib', + fixture: rootDir + '/test/fixture', + tmp: rootDir + '/test/tmp', +}; + +common.assert = require('assert'); +common.fake = require('fake'); + +common.port = 8432; diff --git a/node_modules/request/node_modules/form-data/test/fixture/bacon.txt b/node_modules/request/node_modules/form-data/test/fixture/bacon.txt new file mode 100644 index 0000000..9804bbd --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/fixture/bacon.txt @@ -0,0 +1 @@ +Bacon is delicious. diff --git a/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg b/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7cea4dd71dc41cd51c84bfcec6b3e65c15a58507 GIT binary patch literal 19806 zcmbTc1z40%^fvq;-Jx_#Nh95;NK1E1=hCsXfTT16N{WCqh_G}>mxMG+w{*i&%eVge z{eSO!eKC8@&i%}sIp;oS=E<4+nfqmcKv7mf7C=Hm0^|`t;C>bLiGsAWshWnWtimf9 zL<0bzl9{=+8}k70-O<9+&Fc?Y1ephX0PrW@KWZLIn}Mv{%;ualph#^3Ms7GLF z6$B=y;}i_IW0Ga(VK3cCEmw%3d&g(|=n-+)V8(M&geEwLdugw)b1_pVsIQ zEX@93Mh8d(D+r!{9{tV5;XmB}=4H|Ktj|d%yh)ndH`9(Sa~3_#lN=xYxh5r|J7iHu>1EY{~2{1#MsjTf7*4V zBS&a+`D+ZU{_yzsys-Vt7T{q8_CU-dK-$^G$IZ^h)`O0hhlh{uIpWe}MJMeHa`E)A za-&mlvf$#NGjnvL`$NW^&dti*%FWBllIwTh`;`abGGIGv08m!`V+LaYm`M1*14I*I z-U7Zz1b^V)*Q_KYA^;gtBKFFPR5%U}73Jp_eTuj+QHG@d&FukANY+1?Ir8yeJkbFl0dc`X z=tkk;<$aof{5Q`BTnQ-u;1`Jx{^_fegaTmw$>)Jd66!zo)=B7p=|n^(3F9w}jlh_H zVMIieu>O&E`t-Nmr#w8Lkp7ZEc=_qUKk+I1g!~Ua%KuviVLboAU-G{(^1praQU1~I zm5=&YJqtnx?JtZNm;AqZ{_guX&)@iOp1(2Hzxok}ztivde?nwDL`MDJMf-nOhmeg! zboEA*zte9Wf6gHQ_&uk7AOB8B_j8Ez<-zZS^vC~$2gt~1D9DI}j*5zchJlWO@jGK; z;bLQA;$UH5VB=%s;Nl??CN=>fJ|5w3{9DQI?ucG!C@5%nm>8J9CH}vq`|kiD25 z0f=@0g%Fj9{^@hHhw5hNk6j<}1}ElXFubU0C)W6R#K>pv7J`XILP|zX!Nkn+gq4k7 zKu}0nL{$2vjI5lzf}*CDwvI01rfXqoWo=_?XYcOe>E#Xf@eO?&79J596`hp)J|#8n z!^iZ`dHDrj3X6(MzE#&iYU}D78aq0>x_f&2`Ul3wCnl$+XJ(-*t842Un_IuOcaBd^ z&(1F{VOQ6`{X)#CKi&Grv;W~2A;PZ*C@9D%=)e6!df<)7$b=}U^iR=qmT%UlW$mDv_^09WR>EfUw5|pXx$ELf1=1HCf-G}A$ifkAKY0k)f)&f^@I?lrTv+^y1zFzo@Bs#(74 zB2%!Tp?dq>Xz#9(^6?KK}b*#0Z z0naJ~K@1vW6wNNAG0(cE1;5XE&$kx_;^9f5{tP!OlX{QxY)3IqGi_^m!*% zqGbX~y;f_LM7#uY3ED1`3q2>3JU?3s3*_9^-NtQ;9K$79>C3!$r? zs<;Pgmg_{_xArvHi0Rf})2dIWXQ_TE%vvdUv@khRU0GvDtwOjZEB+mCn%beqUwT<# zpJ-JkhHO#8`$^wxRa$9dxz3Syi+Hd%I^&8HB-F;5?t1h7Nj%j0=*Relis$EXB6ZS_ zIT9Naw8NjTeo@!ZvF)TxU8(x&9y;B2m6K({c{FbgmykS|+}E0~sT!n3ddGz!nfb=u z2$IrL8@w`;m-GypP|x(ylHNjdyclkDYEoE+j|FZQS17SlEn5)G@Oqh`>NeVs)^8x9 zCaYpdiKz>Oh^3zn$*K5(0zJbGl}gcL_2gWc_1}kJFrHxiQdLzvE_tCezujW}+ip;7WR(VE~@-+rRFC>i4hbzy~@~ zUQnPdV@fc0^&UWm#T!pKHe0M9H^`2_g zX$x=V3ao;>sZvcJGI>~?9CRFrpJ#;y@NZ^FVCx+^NfPNfOey;v9d<*#>S%5%1a2MrAxn6$_)gMRowj__?aX7ws!ir=dEUa)5r_vSmOyW3B8Yvi-;Q{8VBrlCk}{kCy9<*{i)~?x{K|Wg*cO?v%yD8H*lqY z^SC52ENN{pyHgDoP}Yy}0rK^f6N5p7&g$9iqiOb_qc*LYcl)BA`#F*PrvvkPJdE+i z4e*zftlhyIdq$lswBLhL0^@#RSR4t)#Aae+e3e>$&?*l6l~m}1uc!T7ds!FQ=T#UM!O{$Jb-RJT$OI>%E!T9cmnqf zqo@`V-d!52J)bpqCbPHS^`w~jMCu5d@v(BxmIvUTn-ppB9y1ltIaTCA)$=sI?7NQO z>0M*6IO;2vD*HuiZ3i~Lye9UBDD~i(i748G9^cRrYKP8>z{hr)H9upWs11%{ytrO~1zKYAG&$&-?EYxkz zi)SHy65)htG4h}}vlE+&Lu7;fZ1kKL`mkH)!gYM&YOZUMJA79&yQh8G0p(+Yk2HP5 zy3I}REqkA5{l=8%rcT_fS*#F7a#kLd<@Js3>^(s2k7QAjXAHJcuBozW(ypz2%SOkw zQSk9A-|53)pVe0HWA098LOUS^-VdJ4PDTa^!2z=Prsd$XDju7br~&&iFM~Yn_CRJ; z%v-(DTRGfzeUJW>&;B+jtVTkY@57~10;~N+jxRFSa?tF2-;xUEsi#Yf8|1x?%X2|5 z$x%0rfyTuKpw%Dsqm=Ryo)C+y(ZVYv9L|!ziwcE%n9ihi=#pN0ZWKoC+r(yT*VXHv zZaq-!YhyG^SffUBu#YwT(24zF5M@cUaVO59TN3$Q7X{~Glm|7KX}LMwJ5D$xa*V~w zb|y~${lVo$We$2|Dz;J+cwaedhGT@YxG%@G!(x1zYJIwD_gXb-?N}RLylgCF&=R`; z*)S4|OlKiWIx6eiqpe&hrU+wbfs|F|m+$o6l%PK^Eb$4o)tjKToIBsE+f10ys#X^E4u+J- z%=BnbbzA?D#i~*qK9rvJ3PX3KH2G+^w~+GPP8HHU5MePiMKD}f$r2T|Xq)Z#%J`{e*LqB`Dj0(O-x*?b&E=q~=$#drA8|(& z!tByTiQ7 zcSj;?uXPehBbsRodqE%+NiB_%H{EiD5ckQ7yf1raUq5Q)HH!h@5*1+&hnhC zIkx=;SYQF{w{rI-?O05?rul>Mf!C>4403R$tKM^+qREB0?TPPZQ;EuVTcApC2d-)R zb=a43kA#4Vg~Xp|B4$f8=T}w5u+LM%2jxT_e8oJqmb4vRPj`3N&)uYuY;nu@BVL6u zkhhzg1}*#PrurLIAECbq#57&J2Rb-cK0-q8wB7UsHYfmO30B9;X-2yK4gt{r)-in9w&cN{X;Tk@GBi5-JT#+oi$-lYD#GP>*l!b!urHV$DQ zq!q@8VA}~sPy^RDF|@uH_rUC$a?ZMijFlPxx8#1YqY})^t&>VzD@Dv!5PqP) zw1^A~b%1KkzCU-q{&qR~>{^o!=*RfyDwaB@ltbNYx}Q!`Hr)7NC#WqAxDZ0|*2Fp0 z?5ck^#wz}oLgf=WN3tH*Ox+PU-!vrhR@%qGf`6#>SrxRS8){OTi5KSjefO-wU#o!3 zKtlCHw>gu?VtID^D(;KR_Uy+~`yM$DJ7mhLs_ibnl??LM08Yym*jaBbm(MHX0v|i1 zr@a$bwh8j)tRX5$e!)dStWGEWUSr{?&`BPx<&p7%y>CTf>29Z5Q?etYw1>9N$^(!( zOF#*DO+s{<#01HoDOsid2L~00+(9044`m@ac_pugi?@>WaOULMQ-AI+84YR56ILL4 z`k2ziZe(%Zl9(#`c%x-Y-|4~`Fn_z*hB4F!kLt<>M|=WKN)2W}(WR;*5o&~IIe>~( zarjziIT@o?29i%cXTFZtG=}ulmCJejoU`}l`D}*cHB3nAJOK1>ZD0>s?K>^0?*90o z+P5c(bejXf8HH5O`Xb;j434sR$(+OqSHTrj-8j&7tUWvo8na3;j6yJQ*p$$4>RLQ# zsh~1@I{s}dt4OhJ)$!d9O54t`u9e%U}%#ia4y$(L2@z*wiZL zV};hKScgp?F0VL4YDvhJ&bPjMfTWeOYfmwjl~MfMJU+=Gy9yOfXcCj$*3Hm%$0zVE z-W{6lba>EpE}^M2!R;je+|I|7f4^}19mFU`offIB{d4_N7hUq!&0m`5J7nN3gS-hzO~rWnWUoN6zX~yeT|d-FlDDD zH9`P%rGj_n+`>1)kN5qyiaoaU>_Nl6*>MogtlD^&CQEF-N4Ki~o-?^1w4Z?LgBkXf zdwNGEd&oC(YJ%gO6`H)U7OZ587*&}dsyTfy+lbOQXT|GOC~>r4vI8pv$`*Q|i9CJ{=*d*qaXBshdt8%6Bm| zG%#&vv7u%N8BRcB+>K&7RamYnT}7_40C~5RMXvB}QKubGHW( zb8(EF-=gAPmoFo! zB-I?`vDs3$(7%#bTD6}-e)-mkiSgj~I0G^GX)j~$fprmfY{jh=(fC7f5nQTKpxXLU zZmlplWLBhB6pQ3TA6n;zLc0lMXuD3g_8vgpKVTZiJ6>%jYd+ubZ+03{?Z|Ckx;`-F zl{kDcI@c9Mett*hk`}(ms+#YY&~W=mK&snYuAovcrXHsmfO@O3U9^2|)NZm4oYYg)|xC&5~V`sk3 zQU4VR3J>|@F$$8pu>VnG9w;;uGl1kHYe6pMJyuhrfZUtgn4k+Mym^uD>pz)dC9Zz! zP-|y#O6t)H6Q-JwRt(dcLA=`9Iuq>p2Bx8w`Bu-_xiUajYosl4d&c%dzY>p#W5En0 zBoDjC=T&oIsl8e=fwtvb1Xa!|A#IA1jJJYgxB6BBw~0FxGA9hgQ;trHB(rgZ6Cp`O z5=iLOrE5V1{z#4E%?b`d0q%HpWU{Y27R;JoBXwY!u~&VQm8a$vot{z*XM1EpRxVcV zeG^Ba7sHqAWN_gd^zqawHy50&((DYG*_q;?3{T>mz14l(u$wFH$dt;`ky-u7_Viq8 zbQ-d2fZwHL%!SJ$Cz|yuO53tN{Hh|~j@L~Jj7R!uE1Uh}SD5NCzR}eFoY4mZXf8gx z$woDMdCIMz-ks;S;;Qxn)ARsamLX^yx; zSK5e2K;A)x3%iY$j^RHo=Q}x561ZJ!g0ttN_bOXwZE#b*yW`Z^k31@wVJmTwXUMZD z0PFX#cKBz-SFFV3?YhNtoy_%fm0f3aOfhuA3CEY8_7k6Betd65*0AH+`@%K-ObnlJ zm&C0s%Im;2gym`?zBe52Lw`Q7xbgT0?i zV)AP(#B>D>qO^ptcPnq5R~=?U9HTc0zUWQk#NbOwAL??7qY{j-;bioYacFI{jI;z8 zy5@F2b?m`kQC7w4h^l$s^ou>kY|QszKk+E6=>kk7cf;!cN-nFAy(|nzz6a%LoJ1TS zY&w`e2&Nv$cn>Hv+ye=>U^99Y*HMZ~=h>mt8%BRwsdEyeEqJ}0sZ=kW6q5fdRc8XZ z_?yiZ=6e7PH_d%@R%&|1osG`Pm>-WX%VQ}l)sUPdHce0TQW9yV^s20|do7usMGU>g zlVlz~x`-uy5A@aMTr(?f-Aa9#-!;V+7s#D`;%+{c7x876o zEiB%~A{Rb%ogK*#C4d`HFfBkNY^`Atg4=u7MVsQopD>q0zT?KP)ZmZPpCrP*;c>0q zM!lU5Z4N9S0)l{W2enk4-kqvxbzL~;n5X>@TNiGh^R6L4j z8^FNrI%rPps07Z-D{+!tixnPeemq#Sky$!5!|bCA%<|KjT#RzCa&`Az&adF(A8PVD zo=@%$%rZV5=D}WJ*7LigyRs!E)F#y2Gbk@YkD? zIrcXPcm0mb+$|`P{o+LDRY^9SvS;T#{IszvBIzwHzX9ku8C1eXI3O?ua(* zR-)8Cous_nF3>_R(qp&XnUQNY(Uc_|-Oh++U1uw-g0fpuxOPG%hY6DPbv|y^xa$pH zs21YtT$<5hx-4{|of_waGzp?Ia@yqPQod=CbR@n9f_2eoxkEbwuk5`ihj-0RSq!n+ zJsM99vgPu3uQ|6OuLDTJWcWyIO{T54G^xkNv3jD~oU zGfak z0fw_jcllyUTh+2IUcBqbdx2TSF|xkP<^?sW9#Ly-mG)Zu3p8Xo{*%1R_du*4C?_h^ zf2b!A@=&&*erxX0-FK=r^raSgv7`JuQH^@ymu$Sxhjj(6fO%nnNw9p`0?4;%)MF|;=*qR9IXg*Pb{zW zFZOlr0m}qm*CDT*2Sm`3m7d}?u^YQQRjd)8B5CTOYPrYrH8d}S7~Xt`A2;bPjFi|L zRDP!=R5nl74l&v#QgRt@u+#M@aw$O*mgxV*z8M5fH&*SuKKS<86LVE;_mNGQc-7;s zsD{?C_fzkyOr}^1+IA~<+?9pzPRh{pG@u7~fu_-a^9h)lgjm(}dwyKRu3 zxdkVZA}maCdjZ4DBo2!UaucR0-=8YlackVkAqh@bBccrW)X;Gv>Z{Ye@SR3r>gD(= zIvR`xI$5!*jhMv4m}!k_(`hsQfY47;{dsY6x03e_1wwim@m)>)iWa&{W|n5f*^%GVS|{q- zI^s!2M7OQnM4nTVC;2$1?l3*jR^WLial8Po9Q~?1J($N;<#pvDX-G({ME>L~wQwkh zM*K-OBg|*@JTawW<7YwKY*mvP@&*v#a9Y`(ZoU&lzya0wpVM1pPC`Xh0^Ee~GTpCq zcQ5KzcCi;8Z_36wd=Yyek&qxO-%fm`z50X!=6R#ClNx4#Vcvqmh1sP+unb3yUw8OX ziBa;^ZLav&$_AIhlY_uwFn&jRKwWrw1!$k1i2qq>V*QEeW^>(IPliWZbx>T062Gd0 zwX+#d5qG4X{CAs}gcKb^~1e`34Ucy#*(Yl%pDU#R6Tvg7FM}|9%Sv5>Ek&hEF=7lN?O(xF| z_bymep`D#G4J`>nc_yTCAHG>~7?tES^*R?Hnldh_u1Gx8IK~gJG_P)$0-cMMDmmoT zntdYd>wELX$E>b+$6+UDc0}JW9-7?gYd2cKzdil3xjt_H6u~45gRyx;NW@5MP30m2=f9cghAFSTju%eUwTr9V}ajHxI>vVyCpDcCq*78${l>*nS&1w+%EX}g(C1Bac|gq zicED1Z@}soCt2wbfTm@jG}{Sox^8q-UD7gSdW-z45+=8&+3uSsE%C$F>6KtPO(CRD zN6qc?)3(qzdhu$gV4;15N`b8y4*vYp?uvLHD;rF&g(kv{IKLCu>~)ISaX6>HdCPHk zeAr>l9UC>R+Rr)t>GibEu}(Hckpwx`fU4U$DerJPn`}2pujAgB^TWtMiVTy<{m~KH zsK<~xB_(o(F2c~SU)QVsyQ+`yYguK)KC_zHV2YIot-QM=5kfrJNOIYEF(Z4sQh$5N zk~|pmls$GRH25&|tRmd_!KLQ(dFi0CVaM^T!iw(L=hQ9Dlc+`vQdC8o!I5M5`w?8I zcv}r=yi6Anwqdd3l;CS^s~*0Z%U+0ke1m_$>O0>I+Q-CLfhSTZ=F263@dk*0?dY-@SHfR{p$6O#>a1i8H?knqvg_T>G{{ z^?$;8+e_DO0!(il_7i3II-YP8csa(nJnM0A=rpkYP@Ydb&Vdw!r$5lUH+U+t&=60p z>aMRVTAP!5Yy35JTfEdlJkr0&y^i%4s#^(+NmEgEiyMY2O7;bkGaoy3y!p|+l(N); zmV5!&Sd%}CdQkzU`nqj=`PN_GCSc9hG26Myz9<95?Y8yxu>4k=1ba@)u}XrcPX$`p zjqaThBf-dl+*wJZBgx{EW8Nf=9;5?hdj+Fc^`;#N~oBT|l3Lqx`ow7l=n`~zQTgJ~r@VlC)b)KK8(*6~-&EDOy zVJAgl{HOj;+iJ5u7l|9Sz2QJ`%R8jLwSs`45^%_-GuB=DY)22;qqxGwHfA{O z(k$3w_3*8Ll9*jt_Q{?>A2y%hEJ0Qo=2`;ZS>?~L)&^zXMUm$BcIK!qWSKPgfMSfK z&@O*KVc+hLlj03n+6%wKmdjIdzg5T9C*O{GDoeo>15oxkL+i$DlxNV0vA7MijgZ*)jHUamDxtO6*HSJI(yc zaS|hi5dRy-Dw!Jx7_XB1#_VAJ{CiJE*DADmI7;B7<8PWBin^0}%bjv*56R~IatfsN ztH)I~-vE`8DwgO6(yx6Nl~aFy5{3emNlrF3K~RehIO#YD zv|s+IK`En>)wNY7b}r|OPHS;&tNMtGDBSkUI8-w^4cAZTvEGcF$gzM{ zD~TM^&!!req6M1Xy~s}yLVb480qQ%a-X3jzd+n9WIawJcH?u^fgu956>G^D-p~Cq& zFJf)TX;JH`5p@K{7BCGeSTL=~DdC`Ds;bIjyc?<>0BWfGV^0zfhkd8h)ZJ$ratbYf zzO~T2^q$;3k#6P_Oc9FZXU|Zg4Ab-rOFF((e3S=(*St+Tid9Q@47@4>P_x>DaVI{0 z-%2g!*RP0(;cwvP{ycFYb2#FTj7*uJ`ho`^7us;=<)GKB6tMM;PRL0=>&*<(aA3;5 zhUrnFI`@`o;!#7EPW^Bw^o$7+4`%!RRb0?~Svq8i^^N$6Fm>bEMd>w7sVix$qjh~l zy35>qH1l3YziE_4NJ4!~aZKN%rpFJudhb>Y(@}4QuHiAruM!p9C|JcmA*o@uk1$+K zC(81=>qulCkEI$LE9WP z`0D-=p+P2AEGrQOu}c_u{R(=rb_}ym)S4Lgp5>q2hVviGw4Ar>Y?GWq?M{L!-8Ky~ z^6mj;MhVip#9-5G+DGTu4s9eOSun=Wq>NyczHrYYs_g_uzFrH9X~`{wJHV+RDM^i$EAKj&ZU-g!tE zW$<;Xzh7hWQRI{}bXXeh)eSOpUqLKJ9t>N&GDokozwN#etnnA%#Q-U1M$Y}?R3>Nq3r z0egx0wLRK4Na-O`7FXQnPXcM-;3-IkX17A3=o~VXq72Z8dda;!Z}O-|3e3Tam~!7+ zG=#BxrXLG$m@V?Ixm>P^>*mG`E+`Vc^$yzf(GO(f>0(vYwrR_&TMcmdv}+Jh_m2Mq z^kQTvz+`bjdsAD|f%jW+|8fE^AGCG-*rcVUNB7Sad(UP%c|zG8=+5+@hja5r3pB*$s1bzk}SE&hI!X zy{&7?r1?%FpL}L;Ln9(wnIMV(i-zgwFctzb>{_IqsCk>z!|taIW#J6Bc6;U1tG(Kq zK*KuzIPxk&LqnM1M%3{h_$9C*LqT;`=1B`pALfykv$EB1LF&B+Y)r;+LI=$kX4cZL zraM~c#xoF~U85lx+gy$e+#80F{rs;{k6v$hb29*L>=S7{f#f&hdea>EefUdKD>_+W z7RS36w$MNte~q^^pBLiqj^not;2dOcEAX-VyWJ7{m5{@K!dcpLGWK*vLJ@nFXvZ2& zN!{Yauuk}-R{i7W{P|7yJcGKg8Tvf(9)L?^v)1Lkvbsg##FKhVP1_W+rudY*pe6A^ z_V6Y$sv{nJCkghnF>|}-*JcU~Q6H%I)@-jg8)Lb8#@L6ftd3uf&daWR31)DouB3Wh z{LA;OLQ-eBoH8dMZ6c{yOw8dLGnXG!x=q-Q{Oc>{;xET_H@(*7dZq>u;$c`B8+da& zsG8nyGX2%S46U8fJy2q?=R@;RVDy*QAzt0*d!R6$pnkGFK+b{Ae~k^Pf3@1*!r9aB znCoPiu*9^Zjz}KFv7as*Q%CcftpO#blDRbkC;wz1O3uXUiZ*>Kg|5C7TVznxiaYI> zYhqKG;GFmeLd>TP>s|N2f@FzQf#)K2ef_(hMv+iWC34h3{)ho0cK*CjGAhQon~w5RYrwlus~s&GCbb?uVxH`ai6qIT=*cGK(qw z`@dlT=K#eV+hCQ_L&dVyHDbm&U)%IUi})y58oN&*1HMX0mck2l1;1$!e{JKACOJL20>U6=Vow!*rn1lgS z?PtENh%kN2=`Z#R->X!_SA-rh$+qa5k@aR0RYS~3l`l!L2jvy%QjOP{jZis7`Hg5?hzWTY!#L~^j$Uus;X0EEX^U-wMl(>seJ;s7`Cty(lZGC;J zP$yloeC1t}60Z5ea`>ji5$Stj30`CzOPsh*gz3BGCeDyK!{NRV;Ys>L0st5$u9~>X zR(7XhZc8(a?+mhvHWS~A*vd%djM-lpef==rzRt$|A_JLF(z5pCJ*BD$Iys8Xb$~&K>YszRMT zLta5CZG7GE;qsx%pb6N?BD*t#Mr&iz@jWov|2BaYJ?y*F?65+mGtBj9aFsTi>%ijZ zEk#90;vCDZvQ2&J82Px*-Ix;X55qU|+vCZm-Y}&VmQKv_a)CR__H0@R?*sEBG0-=; zktglp(s*xa6)z3NP-|-C&9PAwc}nsMz~otatJ9oi@t+1=iFvdwbOhaAowS9vQour2 zaJja{4a?>n_>2tOsT`Qrt1-mCKBv!^X81%c(qH*$KR;{Y>CID?#^m6uY0;`rfsF6# z0%eS26ldl*f_>9ZR^F=XG}Q7@i!1AEr|Sl!B#sKq!~kQ`%@@F=Z0iT92a^#N4H0KW zNe?Ibe%Oyf99@Ere@xyya(AD+rR*mS{kiVVA<=dbHIBZA}pHgO;w;Dcuo5!DDHZt%3w5TAg(rNcZe7ZwO z&?|^!-^mlhWOIl-rmCplEc%*OVai{`=ZiyMBW;+|9%4=Jvvh!MrNlHXuRK_s2A!VRWNB3~^@b(->>a5^$pcw*6y2)iV}Vz-5!G6G{O6Y`x1mx; zI}rrt8!8qdis_6qm5cu+`&@_|`8hp1w?XCRnzS*-ITjV}Z8 zuW{fhQL7%~$*azh+*^<|_0*x}evWpsEUcqE7V_aBtZRER|Chf8nhm~`2rz+&bS}#p znJOaIuQs`n~afgF;r0%;HE+kkzHL4Ai zrSdQBotO|3o$##-WsZXyzuZ~19o1K&Q+jfGs>IHAa?o{D7~H-*oe`7!wg6KUlBF>F zs|h-HCDo#L@vT|MLL*)p@z6eF8G11khQdIyy^3{s3e&cW9HK?zQuXD3niuJ zH`|u1Nx`&s3pEczLxW9o`EDN^vqanqa78RrJ7|vIO7O{lwY?ne2J>$Omf{ZbF!QMB z{=j*5ZT=Op%bpg^VG$F?esmA?1QNF~a$v@M=a!A0K@yTB720f; zzfBPl1qmSWlb``9Ec5+%(NI6HJ=!Jv48_Ie`F=0U_Tg;Yn&MPmBc!zk65pdUy)RJv zIn?n|a6EDAVT@CX9x-5pp*z)*u{If=M!T1>TEE^Hqd15=1Sv~K`iPRl(A$)X?u0>g zswext@<-fteNp|B`rR*WgM4?IiFKUdFn>e@lzZKV;xc5M&D$>kh=2I-5(hC^odsewswdnq%Hd;51)?)bq^9 zJszQo>6m7BrLsq?TxYBU_vOO&q2uV_(>U>i`LcGop%~hc@__LhG1$(C;Wt=(DL5S7 zF?_w-Wp12UiZ~PEKaqbQmXl1GQ^ML%(Pn_r7#o>#>Wv5ZWj8EKp&EcmJBjQB2|8`8 z82356s^m|Jtv9kZ5>k_7#jCRmPb;oK1+Kk=Fpq*zqodni9{Y5o(7T3?oN3~6=b%C* z=9!AJti}~CwVW;elL^Hs>**LsBb%IcCu)Y&5yeC_j(a$R_`24rpU#Fp=EdV|?#Ei~ z91+vW{gC3C(UemK)>dcpT-j`6_DOrY7N;8Li=z1=x#O~b^W}b+CpweD8J)Yy_*xNY z1y)>sm(;PO{4F!8e1HGVNg`H^WAF0>6-mgtBuZV#<;CYCfv`P7WBr9)*LHDUoU+J) zD-E%jVACR9)9QPmQ>mIAu`}0E0o@}tELZrtxWb-HWU8~mB0j6CJGwfJo zIaWXB4C}tzEN~?rN{9B8O&znnWt$ZdKTYfo5PZnd#etJ2S#D@}DaEo%!`HFu{=uB* zxQ;E!TgP`!*Wqrf--HH+dCcDRwrN}4RwtQY?hsEe=sP-WdeQ{*?qjo1{t)g(i*-8u zOBwBt2BXilPg7JvS~DQWTW^dXeXMkR|5Y2`+BK(W$ivHo4;H`A^*idQ$irVv`heqW~U_;8N}xo+QR*DW7qkaZ!vk!LXe5~(5@ zteE7bbS7R>U*e+sK0e?4TNrRRvoKA(nnM!!*q^252(4{}me~Gir&GN;X=+z#Tn@^@ zwjAem6fvI|4Ri02qLzFNyVy|@%d%F&CdVUH`WcGYrSep>85m!V#A#1Ep>= z{4Cd7KQ!udU$R}ME%)U=xmJfWv?akSd{U}e2jIhkr#7f7O}qC1KJ4udlw*2ys8G38 z|I^$>#%tcH`Jx^SwrBnikZp=eXqcxBHKP@r#9w&cG`OEOk8mUwi+!M;ryDtn@m$uO zZ~0<`9`xN%Rb^W5@f`-0d?P?$4LnnNk7G~YcXS)QYsyh0*Au-G(?t=fM8(22gQvYI{0-bjD5)7hdkEP1hVq=3)wtt0z1xn zIF(kcv)x3ey|v?_3m(7R8~bG+LH*?JMOjZDvlRpd!1nBw6AXlWl_*6bP}M?#jFlU8hXNS_vTiRIfLE^2;EvU-WxzE6zum^TVOU8iI^A4g z`TdVMt)tM-JEjMq6 zRB*a_t{=;gpDpqG(ORCHH=eIoMHK%p8#|#+XZGYqEDa+fPpG7SXoPqDwyE zXRy#_`SA1fYi9%m2HXQb&K#!Q-jX_}IiHAZdr)E<>K{xEPud`R9TSCb)jli9Ev)0I zdDv{L(Dzye3B9mVVA6=8A5afY4o5kTL#)Va8VXN_@`k(2YThjZC0P{y-!^n?wRTnb zbiEtWjt*Bve~SjJ~7j3588QqyjWm`ZK7;Z2lQH|MFAdU~|r;yY6}hdOoL&Vrz6Cew2xR4nItvR*j)}Vc*jOAAk?6BlqHAA`7Fq zjx}$!)8c!8A#)%vseP1G%*~UxF-UZ=^-R7+{ol*O#$Ma)8^0r6@Y&##M8;jVdUK&Z z0-NTf(h>B~+HhDp8owP*pKxI(SVOtexb;Nrdzc>Y@pa!0*#-4Q^b;jlGqRGC)3i=h z!RnOKg>6Fi-g+(~_sA~GjYqHWJ1{*onyVRk@(xR7FP!elkYS^IUdWDvC2DT{$%4Y} zsEeOx<>z*&$3%8o8{!Khj{gN~y_RdVGJ7D4Cwin~)`z>s{zoyvP03diKX;DjA7P5) zQpViIk4#*{iMIqV1TPH|%tu(C5{!&;7xhkk3SeZ3^q8`XaV_o3c(CO%mpJ0|7OtJ2 zrOfTmDL)DE5m;!Cjs>AY*RMI0XcAj8)X3DK!1 zpFQMrHn7$~=ps_(@}LUB8R;M&iY;M0Rpu;lYJG^02QzrU70S|#eYJK|hnGi<)a_4v zOe6&>5s0}vgov=fQ5+7?a->+bkp+%zx{5Bqow~@vd{tY!rubdz&2)FFi_NUX@Nr`w z?jKjqnvD*$L{h?MT^CbnAXSbeEh&F1}THYDxyq zH2;+uMC>d1(P1lac$%*)mZ}QaeoVz9(u)ppTNlWD*w|?B5tgQuolmM8G`3Bjmb?c?)>X^iRmwQCF>L03uQEmi7zo`?_3Iy&Ll>Rj!iLbO*oE; z!wbC&=3o&zb-YdiA4p`w!fV3{a*pW2R`_}3*STWU+nHm?`3P#LSmz9CsMI2oQim0Ed7F z8TF$quNXH|nYh~4ZRzIkrQeWdF`ZPYxTP!J=_T^hqCTcC^5;1<8k4zlYr>-V<>6bO z4%+Fq-)ghfhRCiiu5H?1Cyca=tM`fY_pYDA{{RuZKYy=9Z++rT9W9#Kq%tbBZXb3P z2xE^^UcEeJ8A{3Sc~vk~Vw-&rQ{99l@^evc&*fZw&x`Ej)+L8Whx=;ECRpT}-sUjI zLNkDb@D&7#NwPyjJb znHEcOjnS6}>0HIPigZiKZPGjV(n&}WM=CUK#GDKU0Q1_qN!-8?+_uO#H}xfQ*%QOhKVr5V_<=e;9Y!q)P|$XOgSka;9ypRW~TBRM~f zDQ@6bMLaZP3ok#!&UK{ad;b7PuMA5Iy8x?_eo#I0RUKt*W*JzWishFF{fuD#wRy?F zJ*yj0)%49V;~Itay^(g>o^$O4p4p{{q?IV9?W!FKPE{q!uG;8r#>9d>4N0C!&w9?a zxr%vYSmlY_07zE_fITuhRq?>@UGU|59J9LJ9=?1%IS#REP|iU9G%7*-E8{ChVcsIoLF(H4#Qz{g7Y^Txjjul!HrE6q&nD{7Z7xz(ZG!+62<6 z9`UWDI<~|Z6DcP zqcA8x!qEedY>Mc0tHD|lX?Zi^ydmtR%vdGxO4@8Q0Z`qWySvd;#i z3x|&8Mqx4$(++v|sQgXgTfY_fcp>L`}4(N>0p_(@S@-V>%`PTSM&b=AMB^L*} zcTIXdQ(tk(jLW^Zy=I@0#L1#Z1fowSYiGuHZD{`hUMg&AQR$LdL#t|0TRIeIg~M$i z_QiS+hU`39;lBr+4(+4yHk21+DX6hBM4dKo!7M(!k6QD%{43(m4}3#9zK5qR_lM;< zxY2cK%;=z=RyjWM^U9N)bm@$GG&A`*PBWu!%}H7QO?>q8JlW+lR%(BGfACEf*8Eld zv!~tMYd059X&`u>NYuKJ2pr>)&2_Eg?PFD+Oga zbTU{=xXQhLP4Eo3JzZ*Ug$e)rW|6 zX>4?YFK^>Q(%OXEGJtS$jf279j-sw#Xy(#Tx7JcxGkxDWJ)4iVde^ZWYI0DF(|xb2 z{LVK)B;4TF$okt(@kfU5d@FURHos;b-ZLc81;9)$?W%gW)}^(M(_GawU-(EgIU%=6 z)^N8C9Ey#Pmyk#;`Pat3*|x?vP@EitgTbo|+K1T9y6T#khk_#)Pl1k@=Zsa=e%hb2 zsJWNs{{YBT`DxFd4$t)RK7sJ(i0^eD8hFpfclNMBV?F$lLm(q5Z3}sEr~{MGoDOo; z>5Hhq=opz4p2j8z`B%hxZO*x6=0gszc8MLz%NnV`1z0lvM1D2sQ2bN)f{+Co#81h| fYj98Vt#BBK!Y<0!*KWN`v2;1-d*0f7x*z}9I;jH( literal 0 HcmV?d00001 diff --git a/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js b/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js new file mode 100644 index 0000000..44d3b4d --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js @@ -0,0 +1,93 @@ +var common = require('../common'); +var assert = common.assert; +var FormData = require(common.dir.lib + '/form_data'); +var fake = require('fake').create(); +var fs = require('fs'); + +(function testEmptyForm() { + var form = new FormData(); + var callback = fake.callback(arguments.callee.name + '-getLength'); + var calls = fake.expectAnytime(callback, [null, 0]).calls; + + form.getLength(callback); + + // Make sure our response is async + assert.strictEqual(calls.length, 0); +})(); + +(function testUtf8String() { + var FIELD = 'my_field'; + var VALUE = 'May the € be with you'; + + var form = new FormData(); + form.append(FIELD, VALUE); + var callback = fake.callback(arguments.callee.name + '-getLength'); + + var expectedLength = + form._overheadLength + + Buffer.byteLength(VALUE) + + form._lastBoundary().length; + + fake.expectAnytime(callback, [null, expectedLength]); + form.getLength(callback); +})(); + +(function testBuffer() { + var FIELD = 'my_field'; + var VALUE = new Buffer(23); + + var form = new FormData(); + form.append(FIELD, VALUE); + var callback = fake.callback(arguments.callee.name + '-getLength'); + + var expectedLength = + form._overheadLength + + VALUE.length + + form._lastBoundary().length; + + fake.expectAnytime(callback, [null, expectedLength]); + form.getLength(callback); +})(); + + +(function testStringFileBufferFile() { + var fields = [ + { + name: 'my_field', + value: 'Test 123', + }, + { + name: 'my_image', + value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg'), + }, + { + name: 'my_buffer', + value: new Buffer('123'), + }, + { + name: 'my_txt', + value: fs.createReadStream(common.dir.fixture + '/bacon.txt'), + }, + ]; + + var form = new FormData(); + var expectedLength = 0; + + fields.forEach(function(field) { + form.append(field.name, field.value); + if (field.value.path) { + var stat = fs.statSync(field.value.path); + expectedLength += stat.size; + } else { + expectedLength += field.value.length; + } + }); + + expectedLength += form._overheadLength + form._lastBoundary().length; + + var callback = fake.callback(arguments.callee.name + '-getLength'); + fake.expectAnytime(callback, [null, expectedLength]); + form.getLength(callback); +})(); + + diff --git a/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js b/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js new file mode 100644 index 0000000..6dc2fb2 --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js @@ -0,0 +1,18 @@ +var common = require('../common'); +var assert = common.assert; + +var FormData = require(common.dir.lib + '/form_data'); + +(function testOneBoundaryPerForm() { + var form = new FormData(); + var boundary = form.getBoundary(); + + assert.equal(boundary, form.getBoundary()); + assert.equal(boundary.length, 50); +})(); + +(function testUniqueBoundaryPerForm() { + var formA = new FormData(); + var formB = new FormData(); + assert.notEqual(formA.getBoundary(), formB.getBoundary()); +})(); diff --git a/node_modules/request/node_modules/form-data/test/integration/test-http-response.js b/node_modules/request/node_modules/form-data/test/integration/test-http-response.js new file mode 100644 index 0000000..8e183fe --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/integration/test-http-response.js @@ -0,0 +1,121 @@ +var common = require('../common'); +var assert = common.assert; +var http = require('http'); +var path = require('path'); +var mime = require('mime'); +var request = require('request'); +var parseUrl = require('url').parse; +var fs = require('fs'); +var FormData = require(common.dir.lib + '/form_data'); +var IncomingForm = require('formidable').IncomingForm; + +var remoteFile = 'http://nodejs.org/images/logo.png'; + +var FIELDS; +var server; + +var parsedUrl = parseUrl(remoteFile) + , options = { + method: 'get', + port: parsedUrl.port || 80, + path: parsedUrl.pathname, + host: parsedUrl.hostname + } + ; + +http.request(options, function(res) { + + FIELDS = [ + {name: 'my_field', value: 'my_value'}, + {name: 'my_buffer', value: new Buffer([1, 2, 3])}, + {name: 'remote_file', value: res } + ]; + + var form = new FormData(); + FIELDS.forEach(function(field) { + form.append(field.name, field.value); + }); + + server.listen(common.port, function() { + + form.submit('http://localhost/' + common.port + '/', function(err, res) { + + if (err) { + throw err; + } + + assert.strictEqual(res.statusCode, 200); + server.close(); + }); + + }); + + +}).end(); + +server = http.createServer(function(req, res) { + + // formidable is broken so let's do it manual way + // + // var form = new IncomingForm(); + // form.uploadDir = common.dir.tmp; + // form.parse(req); + // form + // .on('field', function(name, value) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(value, field.value+''); + // }) + // .on('file', function(name, file) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(file.name, path.basename(field.value.path)); + // // mime.lookup file.NAME == 'my_file' ? + // assert.strictEqual(file.type, mime.lookup(file.name)); + // }) + // .on('end', function() { + // res.writeHead(200); + // res.end('done'); + // }); + + // temp workaround + var data = ''; + req.setEncoding('utf8'); + + req.on('data', function(d) { + data += d; + }); + + req.on('end', function() { + + // check for the fields' traces + + // 1st field : my_field + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 2nd field : my_buffer + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 3rd field : remote_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(remoteFile)+'"') != -1 ); + // check for http://nodejs.org/images/logo.png traces + assert.ok( data.indexOf('ImageReady') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); + + res.writeHead(200); + res.end('done'); + + }); + +}); + + +process.on('exit', function() { + assert.strictEqual(FIELDS.length, 0); +}); diff --git a/node_modules/request/node_modules/form-data/test/integration/test-pipe.js b/node_modules/request/node_modules/form-data/test/integration/test-pipe.js new file mode 100644 index 0000000..acc39df --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/integration/test-pipe.js @@ -0,0 +1,111 @@ +var common = require('../common'); +var assert = common.assert; +var http = require('http'); +var path = require('path'); +var mime = require('mime'); +var request = require('request'); +var fs = require('fs'); +var FormData = require(common.dir.lib + '/form_data'); +var IncomingForm = require('formidable').IncomingForm; + +var remoteFile = 'http://nodejs.org/images/logo.png'; + +var FIELDS = [ + {name: 'my_field', value: 'my_value'}, + {name: 'my_buffer', value: new Buffer([1, 2, 3])}, + {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg')}, + {name: 'remote_file', value: request(remoteFile) } +]; + +var server = http.createServer(function(req, res) { + + // formidable is broken so let's do it manual way + // + // var form = new IncomingForm(); + // form.uploadDir = common.dir.tmp; + // form.parse(req); + // form + // .on('field', function(name, value) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(value, field.value+''); + // }) + // .on('file', function(name, file) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(file.name, path.basename(field.value.path)); + // assert.strictEqual(file.type, mime.lookup(file.name)); + // }) + // .on('end', function() { + // res.writeHead(200); + // res.end('done'); + // }); + + // temp workaround + var data = ''; + req.setEncoding('utf8'); + + req.on('data', function(d) { + data += d; + }); + + req.on('end', function() { + // check for the fields' traces + + // 1st field : my_field + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 2nd field : my_buffer + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 3rd field : my_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for unicycle.jpg traces + assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); + + // 4th field : remote_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for http://nodejs.org/images/logo.png traces + assert.ok( data.indexOf('ImageReady') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); + + res.writeHead(200); + res.end('done'); + + }); + + +}); + +server.listen(common.port, function() { + var form = new FormData(); + FIELDS.forEach(function(field) { + form.append(field.name, field.value); + }); + + var request = http.request({ + method: 'post', + port: common.port, + path: '/upload', + headers: form.getHeaders() + }); + + form.pipe(request); + + request.on('response', function(res) { + server.close(); + }); +}); + +process.on('exit', function() { + assert.strictEqual(FIELDS.length, 0); +}); diff --git a/node_modules/request/node_modules/form-data/test/integration/test-submit.js b/node_modules/request/node_modules/form-data/test/integration/test-submit.js new file mode 100644 index 0000000..c40e88f --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/integration/test-submit.js @@ -0,0 +1,107 @@ +var common = require('../common'); +var assert = common.assert; +var http = require('http'); +var path = require('path'); +var mime = require('mime'); +var request = require('request'); +var fs = require('fs'); +var FormData = require(common.dir.lib + '/form_data'); +var IncomingForm = require('formidable').IncomingForm; + +var remoteFile = 'http://nodejs.org/images/logo.png'; + +var FIELDS = [ + {name: 'my_field', value: 'my_value'}, + {name: 'my_buffer', value: new Buffer([1, 2, 3])}, + {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg') }, + {name: 'remote_file', value: request(remoteFile) } +]; + +var server = http.createServer(function(req, res) { + + // formidable is broken so let's do it manual way + // + // var form = new IncomingForm(); + // form.uploadDir = common.dir.tmp; + // form.parse(req); + // form + // .on('field', function(name, value) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(value, field.value+''); + // }) + // .on('file', function(name, file) { + // var field = FIELDS.shift(); + // assert.strictEqual(name, field.name); + // assert.strictEqual(file.name, path.basename(field.value.path)); + // // mime.lookup file.NAME == 'my_file' ? + // assert.strictEqual(file.type, mime.lookup(file.name)); + // }) + // .on('end', function() { + // res.writeHead(200); + // res.end('done'); + // }); + + // temp workaround + var data = ''; + req.setEncoding('utf8'); + req.on('data', function(d) { + data += d; + }); + req.on('end', function() { + // check for the fields' traces + + // 1st field : my_field + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 2nd field : my_buffer + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 3rd field : my_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for unicycle.jpg traces + assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); + + // 4th field : remote_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for http://nodejs.org/images/logo.png traces + assert.ok( data.indexOf('ImageReady') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); + + res.writeHead(200); + res.end('done'); + + }); + +}); + +server.listen(common.port, function() { + var form = new FormData(); + FIELDS.forEach(function(field) { + form.append(field.name, field.value); + }); + + form.submit('http://localhost/' + common.port + '/', function(err, res) { + + if (err) { + throw err; + } + + assert.strictEqual(res.statusCode, 200); + server.close(); + }); + +}); + +process.on('exit', function() { + assert.strictEqual(FIELDS.length, 0); +}); diff --git a/node_modules/request/node_modules/form-data/test/run.js b/node_modules/request/node_modules/form-data/test/run.js new file mode 100755 index 0000000..0bb8e82 --- /dev/null +++ b/node_modules/request/node_modules/form-data/test/run.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var far = require('far').create(); + +far.add(__dirname); +far.include(/test-.*\.js$/); + +far.execute(); diff --git a/node_modules/request/node_modules/mime/LICENSE b/node_modules/request/node_modules/mime/LICENSE new file mode 100644 index 0000000..451fc45 --- /dev/null +++ b/node_modules/request/node_modules/mime/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 Benjamin Thomas, Robert Kieffer + +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/request/node_modules/mime/README.md b/node_modules/request/node_modules/mime/README.md new file mode 100644 index 0000000..b90552a --- /dev/null +++ b/node_modules/request/node_modules/mime/README.md @@ -0,0 +1,63 @@ +# mime + +Comprehensive 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. + +## Install + +Install with [npm](http://github.com/isaacs/npm): + + npm install mime + +## API - Queries + +### mime.lookup(path) +Get 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. + + var mime = require('mime'); + + mime.lookup('/path/to/file.txt'); // => 'text/plain' + mime.lookup('file.txt'); // => 'text/plain' + mime.lookup('.TXT'); // => 'text/plain' + mime.lookup('htm'); // => 'text/html' + +### mime.extension(type) +Get the default extension for `type` + + mime.extension('text/html'); // => 'html' + mime.extension('application/octet-stream'); // => 'bin' + +### mime.charsets.lookup() + +Map mime-type to charset + + mime.charsets.lookup('text/plain'); // => 'UTF-8' + +(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) + +## API - Defining Custom Types + +The 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/broofa/node-mime/wiki/Requesting-New-Types). + +### mime.define() + +Add custom mime/extension mappings + + mime.define({ + 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], + 'application/x-my-type': ['x-mt', 'x-mtt'], + // etc ... + }); + + mime.lookup('x-sft'); // => 'text/x-some-format' + +The first entry in the extensions array is returned by `mime.extension()`. E.g. + + mime.extension('text/x-some-format'); // => 'x-sf' + +### mime.load(filepath) + +Load mappings from an Apache ".types" format file + + mime.load('./my_project.types'); + +The .types file format is simple - See the `types` dir for examples. diff --git a/node_modules/request/node_modules/mime/mime.js b/node_modules/request/node_modules/mime/mime.js new file mode 100644 index 0000000..1e00585 --- /dev/null +++ b/node_modules/request/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/request/node_modules/mime/package.json b/node_modules/request/node_modules/mime/package.json new file mode 100644 index 0000000..06e2ee5 --- /dev/null +++ b/node_modules/request/node_modules/mime/package.json @@ -0,0 +1,42 @@ +{ + "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": "git://github.com/broofa/node-mime.git", + "type": "git" + }, + "version": "1.2.7", + "_npmUser": { + "name": "mikeal", + "email": "mikeal.rogers@gmail.com" + }, + "_id": "mime@1.2.7", + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.8.1", + "_defaultsLoaded": true, + "_from": "mime" +} diff --git a/node_modules/request/node_modules/mime/test.js b/node_modules/request/node_modules/mime/test.js new file mode 100644 index 0000000..cbad034 --- /dev/null +++ b/node_modules/request/node_modules/mime/test.js @@ -0,0 +1,55 @@ +/** + * Usage: node test.js + */ + +var mime = require('./mime'); +var assert = require('assert'); + +function eq(a, b) { + console.log('Test: ' + a + ' === ' + b); + assert.strictEqual.apply(null, arguments); +} + +console.log(Object.keys(mime.extensions).length + ' types'); +console.log(Object.keys(mime.types).length + ' extensions\n'); + +// +// Test mime lookups +// + +eq('text/plain', mime.lookup('text.txt')); +eq('text/plain', mime.lookup('.text.txt')); +eq('text/plain', mime.lookup('.txt')); +eq('text/plain', mime.lookup('txt')); +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 +// + +eq('txt', mime.extension(mime.types.text)); +eq('html', mime.extension(mime.types.htm)); +eq('bin', mime.extension('application/octet-stream')); +eq(undefined, mime.extension('constructor')); + +// +// Test node types +// + +eq('application/octet-stream', mime.lookup('file.buffer')); +eq('audio/mp4', mime.lookup('file.m4a')); + +// +// Test charsets +// + +eq('UTF-8', mime.charsets.lookup('text/plain')); +eq(undefined, mime.charsets.lookup(mime.types.js)); +eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); + +console.log('\nOK'); diff --git a/node_modules/request/node_modules/mime/types/mime.types b/node_modules/request/node_modules/mime/types/mime.types new file mode 100644 index 0000000..b90b165 --- /dev/null +++ b/node_modules/request/node_modules/mime/types/mime.types @@ -0,0 +1,1588 @@ +# This file maps Internet media types to unique file extension(s). +# Although created for httpd, this file is used by many software systems +# and has been placed in the public domain for unlimited redisribution. +# +# The table below contains both registered and (common) unregistered types. +# A type that has no unique extension can be ignored -- they are listed +# here to guide configurations toward known types and to make it easier to +# identify "new" types. File extensions are also commonly used to indicate +# content languages and encodings, so choose them carefully. +# +# Internet media types should be registered as described in RFC 4288. +# The registry is at . +# +# MIME type (lowercased) Extensions +# ============================================ ========== +# application/1d-interleaved-parityfec +# application/3gpp-ims+xml +# application/activemessage +application/andrew-inset ez +# application/applefile +application/applixware aw +application/atom+xml atom +application/atomcat+xml atomcat +# application/atomicmail +application/atomsvc+xml atomsvc +# application/auth-policy+xml +# application/batch-smtp +# application/beep+xml +# application/calendar+xml +# application/cals-1840 +# application/ccmp+xml +application/ccxml+xml ccxml +application/cdmi-capability cdmia +application/cdmi-container cdmic +application/cdmi-domain cdmid +application/cdmi-object cdmio +application/cdmi-queue cdmiq +# application/cea-2018+xml +# application/cellml+xml +# application/cfw +# application/cnrp+xml +# application/commonground +# application/conference-info+xml +# application/cpl+xml +# application/csta+xml +# application/cstadata+xml +application/cu-seeme cu +# application/cybercash +application/davmount+xml davmount +# application/dca-rft +# application/dec-dx +# application/dialog-info+xml +# application/dicom +# application/dns +application/docbook+xml dbk +# application/dskpp+xml +application/dssc+der dssc +application/dssc+xml xdssc +# application/dvcs +application/ecmascript ecma +# application/edi-consent +# application/edi-x12 +# application/edifact +application/emma+xml emma +# application/epp+xml +application/epub+zip epub +# application/eshop +# application/example +application/exi exi +# application/fastinfoset +# application/fastsoap +# application/fits +application/font-tdpfr pfr +# application/framework-attributes+xml +application/gml+xml gml +application/gpx+xml gpx +application/gxf gxf +# application/h224 +# application/held+xml +# application/http +application/hyperstudio stk +# application/ibe-key-request+xml +# application/ibe-pkg-reply+xml +# application/ibe-pp-data +# application/iges +# application/im-iscomposing+xml +# application/index +# application/index.cmd +# application/index.obj +# application/index.response +# application/index.vnd +application/inkml+xml ink inkml +# application/iotp +application/ipfix ipfix +# application/ipp +# application/isup +application/java-archive jar +application/java-serialized-object ser +application/java-vm class +application/javascript js +application/json json +application/jsonml+json jsonml +# application/kpml-request+xml +# application/kpml-response+xml +application/lost+xml lostxml +application/mac-binhex40 hqx +application/mac-compactpro cpt +# application/macwriteii +application/mads+xml mads +application/marc mrc +application/marcxml+xml mrcx +application/mathematica ma nb mb +# application/mathml-content+xml +# application/mathml-presentation+xml +application/mathml+xml mathml +# application/mbms-associated-procedure-description+xml +# application/mbms-deregister+xml +# application/mbms-envelope+xml +# application/mbms-msk+xml +# application/mbms-msk-response+xml +# application/mbms-protection-description+xml +# application/mbms-reception-report+xml +# application/mbms-register+xml +# application/mbms-register-response+xml +# application/mbms-user-service-description+xml +application/mbox mbox +# application/media_control+xml +application/mediaservercontrol+xml mscml +application/metalink+xml metalink +application/metalink4+xml meta4 +application/mets+xml mets +# application/mikey +application/mods+xml mods +# application/moss-keys +# application/moss-signature +# application/mosskey-data +# application/mosskey-request +application/mp21 m21 mp21 +application/mp4 mp4s +# application/mpeg4-generic +# application/mpeg4-iod +# application/mpeg4-iod-xmt +# application/msc-ivr+xml +# application/msc-mixer+xml +application/msword doc dot +application/mxf mxf +# application/nasdata +# application/news-checkgroups +# application/news-groupinfo +# application/news-transmission +# application/nss +# application/ocsp-request +# application/ocsp-response +application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy +application/oda oda +application/oebps-package+xml opf +application/ogg ogx +application/omdoc+xml omdoc +application/onenote onetoc onetoc2 onetmp onepkg +application/oxps oxps +# application/parityfec +application/patch-ops-error+xml xer +application/pdf pdf +application/pgp-encrypted pgp +# application/pgp-keys +application/pgp-signature asc sig +application/pics-rules prf +# application/pidf+xml +# application/pidf-diff+xml +application/pkcs10 p10 +application/pkcs7-mime p7m p7c +application/pkcs7-signature p7s +application/pkcs8 p8 +application/pkix-attr-cert ac +application/pkix-cert cer +application/pkix-crl crl +application/pkix-pkipath pkipath +application/pkixcmp pki +application/pls+xml pls +# application/poc-settings+xml +application/postscript ai eps ps +# application/prs.alvestrand.titrax-sheet +application/prs.cww cww +# application/prs.nprend +# application/prs.plucker +# application/prs.rdf-xml-crypt +# application/prs.xsf+xml +application/pskc+xml pskcxml +# application/qsig +application/rdf+xml rdf +application/reginfo+xml rif +application/relax-ng-compact-syntax rnc +# application/remote-printing +application/resource-lists+xml rl +application/resource-lists-diff+xml rld +# application/riscos +# application/rlmi+xml +application/rls-services+xml rs +application/rpki-ghostbusters gbr +application/rpki-manifest mft +application/rpki-roa roa +# application/rpki-updown +application/rsd+xml rsd +application/rss+xml rss +application/rtf rtf +# application/rtx +# application/samlassertion+xml +# application/samlmetadata+xml +application/sbml+xml sbml +application/scvp-cv-request scq +application/scvp-cv-response scs +application/scvp-vp-request spq +application/scvp-vp-response spp +application/sdp sdp +# application/set-payment +application/set-payment-initiation setpay +# application/set-registration +application/set-registration-initiation setreg +# application/sgml +# application/sgml-open-catalog +application/shf+xml shf +# application/sieve +# application/simple-filter+xml +# application/simple-message-summary +# application/simplesymbolcontainer +# application/slate +# application/smil +application/smil+xml smi smil +# application/soap+fastinfoset +# application/soap+xml +application/sparql-query rq +application/sparql-results+xml srx +# application/spirits-event+xml +application/srgs gram +application/srgs+xml grxml +application/sru+xml sru +application/ssdl+xml ssdl +application/ssml+xml ssml +# application/tamp-apex-update +# application/tamp-apex-update-confirm +# application/tamp-community-update +# application/tamp-community-update-confirm +# application/tamp-error +# application/tamp-sequence-adjust +# application/tamp-sequence-adjust-confirm +# application/tamp-status-query +# application/tamp-status-response +# application/tamp-update +# application/tamp-update-confirm +application/tei+xml tei teicorpus +application/thraud+xml tfi +# application/timestamp-query +# application/timestamp-reply +application/timestamped-data tsd +# application/tve-trigger +# application/ulpfec +# application/vcard+xml +# application/vemmi +# application/vividence.scriptfile +# application/vnd.3gpp.bsf+xml +application/vnd.3gpp.pic-bw-large plb +application/vnd.3gpp.pic-bw-small psb +application/vnd.3gpp.pic-bw-var pvb +# application/vnd.3gpp.sms +# application/vnd.3gpp2.bcmcsinfo+xml +# application/vnd.3gpp2.sms +application/vnd.3gpp2.tcap tcap +application/vnd.3m.post-it-notes pwn +application/vnd.accpac.simply.aso aso +application/vnd.accpac.simply.imp imp +application/vnd.acucobol acu +application/vnd.acucorp atc acutc +application/vnd.adobe.air-application-installer-package+zip air +application/vnd.adobe.formscentral.fcdt fcdt +application/vnd.adobe.fxp fxp fxpl +# application/vnd.adobe.partial-upload +application/vnd.adobe.xdp+xml xdp +application/vnd.adobe.xfdf xfdf +# application/vnd.aether.imp +# application/vnd.ah-barcode +application/vnd.ahead.space ahead +application/vnd.airzip.filesecure.azf azf +application/vnd.airzip.filesecure.azs azs +application/vnd.amazon.ebook azw +application/vnd.americandynamics.acc acc +application/vnd.amiga.ami ami +# application/vnd.amundsen.maze+xml +application/vnd.android.package-archive apk +application/vnd.anser-web-certificate-issue-initiation cii +application/vnd.anser-web-funds-transfer-initiation fti +application/vnd.antix.game-component atx +application/vnd.apple.installer+xml mpkg +application/vnd.apple.mpegurl m3u8 +# application/vnd.arastra.swi +application/vnd.aristanetworks.swi swi +application/vnd.astraea-software.iota iota +application/vnd.audiograph aep +# application/vnd.autopackage +# application/vnd.avistar+xml +application/vnd.blueice.multipass mpm +# application/vnd.bluetooth.ep.oob +application/vnd.bmi bmi +application/vnd.businessobjects rep +# application/vnd.cab-jscript +# application/vnd.canon-cpdl +# application/vnd.canon-lips +# application/vnd.cendio.thinlinc.clientconf +application/vnd.chemdraw+xml cdxml +application/vnd.chipnuts.karaoke-mmd mmd +application/vnd.cinderella cdy +# application/vnd.cirpack.isdn-ext +application/vnd.claymore cla +application/vnd.cloanto.rp9 rp9 +application/vnd.clonk.c4group c4g c4d c4f c4p c4u +application/vnd.cluetrust.cartomobile-config c11amc +application/vnd.cluetrust.cartomobile-config-pkg c11amz +# application/vnd.collection+json +# application/vnd.commerce-battelle +application/vnd.commonspace csp +application/vnd.contact.cmsg cdbcmsg +application/vnd.cosmocaller cmc +application/vnd.crick.clicker clkx +application/vnd.crick.clicker.keyboard clkk +application/vnd.crick.clicker.palette clkp +application/vnd.crick.clicker.template clkt +application/vnd.crick.clicker.wordbank clkw +application/vnd.criticaltools.wbs+xml wbs +application/vnd.ctc-posml pml +# application/vnd.ctct.ws+xml +# application/vnd.cups-pdf +# application/vnd.cups-postscript +application/vnd.cups-ppd ppd +# application/vnd.cups-raster +# application/vnd.cups-raw +# application/vnd.curl +application/vnd.curl.car car +application/vnd.curl.pcurl pcurl +# application/vnd.cybank +application/vnd.dart dart +application/vnd.data-vision.rdz rdz +application/vnd.dece.data uvf uvvf uvd uvvd +application/vnd.dece.ttml+xml uvt uvvt +application/vnd.dece.unspecified uvx uvvx +application/vnd.dece.zip uvz uvvz +application/vnd.denovo.fcselayout-link fe_launch +# application/vnd.dir-bi.plate-dl-nosuffix +application/vnd.dna dna +application/vnd.dolby.mlp mlp +# application/vnd.dolby.mobile.1 +# application/vnd.dolby.mobile.2 +application/vnd.dpgraph dpg +application/vnd.dreamfactory dfac +application/vnd.ds-keypoint kpxx +application/vnd.dvb.ait ait +# application/vnd.dvb.dvbj +# application/vnd.dvb.esgcontainer +# application/vnd.dvb.ipdcdftnotifaccess +# application/vnd.dvb.ipdcesgaccess +# application/vnd.dvb.ipdcesgaccess2 +# application/vnd.dvb.ipdcesgpdd +# application/vnd.dvb.ipdcroaming +# application/vnd.dvb.iptv.alfec-base +# application/vnd.dvb.iptv.alfec-enhancement +# application/vnd.dvb.notif-aggregate-root+xml +# application/vnd.dvb.notif-container+xml +# application/vnd.dvb.notif-generic+xml +# application/vnd.dvb.notif-ia-msglist+xml +# application/vnd.dvb.notif-ia-registration-request+xml +# application/vnd.dvb.notif-ia-registration-response+xml +# application/vnd.dvb.notif-init+xml +# application/vnd.dvb.pfr +application/vnd.dvb.service svc +# application/vnd.dxr +application/vnd.dynageo geo +# application/vnd.easykaraoke.cdgdownload +# application/vnd.ecdis-update +application/vnd.ecowin.chart mag +# application/vnd.ecowin.filerequest +# application/vnd.ecowin.fileupdate +# application/vnd.ecowin.series +# application/vnd.ecowin.seriesrequest +# application/vnd.ecowin.seriesupdate +# application/vnd.emclient.accessrequest+xml +application/vnd.enliven nml +# application/vnd.eprints.data+xml +application/vnd.epson.esf esf +application/vnd.epson.msf msf +application/vnd.epson.quickanime qam +application/vnd.epson.salt slt +application/vnd.epson.ssf ssf +# application/vnd.ericsson.quickcall +application/vnd.eszigno3+xml es3 et3 +# application/vnd.etsi.aoc+xml +# application/vnd.etsi.cug+xml +# application/vnd.etsi.iptvcommand+xml +# application/vnd.etsi.iptvdiscovery+xml +# application/vnd.etsi.iptvprofile+xml +# application/vnd.etsi.iptvsad-bc+xml +# application/vnd.etsi.iptvsad-cod+xml +# application/vnd.etsi.iptvsad-npvr+xml +# application/vnd.etsi.iptvservice+xml +# application/vnd.etsi.iptvsync+xml +# application/vnd.etsi.iptvueprofile+xml +# application/vnd.etsi.mcid+xml +# application/vnd.etsi.overload-control-policy-dataset+xml +# application/vnd.etsi.sci+xml +# application/vnd.etsi.simservs+xml +# application/vnd.etsi.tsl+xml +# application/vnd.etsi.tsl.der +# application/vnd.eudora.data +application/vnd.ezpix-album ez2 +application/vnd.ezpix-package ez3 +# application/vnd.f-secure.mobile +application/vnd.fdf fdf +application/vnd.fdsn.mseed mseed +application/vnd.fdsn.seed seed dataless +# application/vnd.ffsns +# application/vnd.fints +application/vnd.flographit gph +application/vnd.fluxtime.clip ftc +# application/vnd.font-fontforge-sfd +application/vnd.framemaker fm frame maker book +application/vnd.frogans.fnc fnc +application/vnd.frogans.ltf ltf +application/vnd.fsc.weblaunch fsc +application/vnd.fujitsu.oasys oas +application/vnd.fujitsu.oasys2 oa2 +application/vnd.fujitsu.oasys3 oa3 +application/vnd.fujitsu.oasysgp fg5 +application/vnd.fujitsu.oasysprs bh2 +# application/vnd.fujixerox.art-ex +# application/vnd.fujixerox.art4 +# application/vnd.fujixerox.hbpl +application/vnd.fujixerox.ddd ddd +application/vnd.fujixerox.docuworks xdw +application/vnd.fujixerox.docuworks.binder xbd +# application/vnd.fut-misnet +application/vnd.fuzzysheet fzs +application/vnd.genomatix.tuxedo txd +# application/vnd.geocube+xml +application/vnd.geogebra.file ggb +application/vnd.geogebra.tool ggt +application/vnd.geometry-explorer gex gre +application/vnd.geonext gxt +application/vnd.geoplan g2w +application/vnd.geospace g3w +# application/vnd.globalplatform.card-content-mgt +# application/vnd.globalplatform.card-content-mgt-response +application/vnd.gmx gmx +application/vnd.google-earth.kml+xml kml +application/vnd.google-earth.kmz kmz +application/vnd.grafeq gqf gqs +# application/vnd.gridmp +application/vnd.groove-account gac +application/vnd.groove-help ghf +application/vnd.groove-identity-message gim +application/vnd.groove-injector grv +application/vnd.groove-tool-message gtm +application/vnd.groove-tool-template tpl +application/vnd.groove-vcard vcg +# application/vnd.hal+json +application/vnd.hal+xml hal +application/vnd.handheld-entertainment+xml zmm +application/vnd.hbci hbci +# application/vnd.hcl-bireports +application/vnd.hhe.lesson-player les +application/vnd.hp-hpgl hpgl +application/vnd.hp-hpid hpid +application/vnd.hp-hps hps +application/vnd.hp-jlyt jlt +application/vnd.hp-pcl pcl +application/vnd.hp-pclxl pclxl +# application/vnd.httphone +application/vnd.hydrostatix.sof-data sfd-hdstx +# application/vnd.hzn-3d-crossword +# application/vnd.ibm.afplinedata +# application/vnd.ibm.electronic-media +application/vnd.ibm.minipay mpy +application/vnd.ibm.modcap afp listafp list3820 +application/vnd.ibm.rights-management irm +application/vnd.ibm.secure-container sc +application/vnd.iccprofile icc icm +application/vnd.igloader igl +application/vnd.immervision-ivp ivp +application/vnd.immervision-ivu ivu +# application/vnd.informedcontrol.rms+xml +# application/vnd.informix-visionary +# application/vnd.infotech.project +# application/vnd.infotech.project+xml +# application/vnd.innopath.wamp.notification +application/vnd.insors.igm igm +application/vnd.intercon.formnet xpw xpx +application/vnd.intergeo i2g +# application/vnd.intertrust.digibox +# application/vnd.intertrust.nncp +application/vnd.intu.qbo qbo +application/vnd.intu.qfx qfx +# application/vnd.iptc.g2.conceptitem+xml +# application/vnd.iptc.g2.knowledgeitem+xml +# application/vnd.iptc.g2.newsitem+xml +# application/vnd.iptc.g2.newsmessage+xml +# application/vnd.iptc.g2.packageitem+xml +# application/vnd.iptc.g2.planningitem+xml +application/vnd.ipunplugged.rcprofile rcprofile +application/vnd.irepository.package+xml irp +application/vnd.is-xpr xpr +application/vnd.isac.fcs fcs +application/vnd.jam jam +# application/vnd.japannet-directory-service +# application/vnd.japannet-jpnstore-wakeup +# application/vnd.japannet-payment-wakeup +# application/vnd.japannet-registration +# application/vnd.japannet-registration-wakeup +# application/vnd.japannet-setstore-wakeup +# application/vnd.japannet-verification +# application/vnd.japannet-verification-wakeup +application/vnd.jcp.javame.midlet-rms rms +application/vnd.jisp jisp +application/vnd.joost.joda-archive joda +application/vnd.kahootz ktz ktr +application/vnd.kde.karbon karbon +application/vnd.kde.kchart chrt +application/vnd.kde.kformula kfo +application/vnd.kde.kivio flw +application/vnd.kde.kontour kon +application/vnd.kde.kpresenter kpr kpt +application/vnd.kde.kspread ksp +application/vnd.kde.kword kwd kwt +application/vnd.kenameaapp htke +application/vnd.kidspiration kia +application/vnd.kinar kne knp +application/vnd.koan skp skd skt skm +application/vnd.kodak-descriptor sse +application/vnd.las.las+xml lasxml +# application/vnd.liberty-request+xml +application/vnd.llamagraphics.life-balance.desktop lbd +application/vnd.llamagraphics.life-balance.exchange+xml lbe +application/vnd.lotus-1-2-3 123 +application/vnd.lotus-approach apr +application/vnd.lotus-freelance pre +application/vnd.lotus-notes nsf +application/vnd.lotus-organizer org +application/vnd.lotus-screencam scm +application/vnd.lotus-wordpro lwp +application/vnd.macports.portpkg portpkg +# application/vnd.marlin.drm.actiontoken+xml +# application/vnd.marlin.drm.conftoken+xml +# application/vnd.marlin.drm.license+xml +# application/vnd.marlin.drm.mdcf +application/vnd.mcd mcd +application/vnd.medcalcdata mc1 +application/vnd.mediastation.cdkey cdkey +# application/vnd.meridian-slingshot +application/vnd.mfer mwf +application/vnd.mfmp mfm +application/vnd.micrografx.flo flo +application/vnd.micrografx.igx igx +application/vnd.mif mif +# application/vnd.minisoft-hp3000-save +# application/vnd.mitsubishi.misty-guard.trustweb +application/vnd.mobius.daf daf +application/vnd.mobius.dis dis +application/vnd.mobius.mbk mbk +application/vnd.mobius.mqy mqy +application/vnd.mobius.msl msl +application/vnd.mobius.plc plc +application/vnd.mobius.txf txf +application/vnd.mophun.application mpn +application/vnd.mophun.certificate mpc +# application/vnd.motorola.flexsuite +# application/vnd.motorola.flexsuite.adsi +# application/vnd.motorola.flexsuite.fis +# application/vnd.motorola.flexsuite.gotap +# application/vnd.motorola.flexsuite.kmr +# application/vnd.motorola.flexsuite.ttc +# application/vnd.motorola.flexsuite.wem +# application/vnd.motorola.iprm +application/vnd.mozilla.xul+xml xul +application/vnd.ms-artgalry cil +# application/vnd.ms-asf +application/vnd.ms-cab-compressed cab +# application/vnd.ms-color.iccprofile +application/vnd.ms-excel xls xlm xla xlc xlt xlw +application/vnd.ms-excel.addin.macroenabled.12 xlam +application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb +application/vnd.ms-excel.sheet.macroenabled.12 xlsm +application/vnd.ms-excel.template.macroenabled.12 xltm +application/vnd.ms-fontobject eot +application/vnd.ms-htmlhelp chm +application/vnd.ms-ims ims +application/vnd.ms-lrm lrm +# application/vnd.ms-office.activex+xml +application/vnd.ms-officetheme thmx +# application/vnd.ms-opentype +# application/vnd.ms-package.obfuscated-opentype +application/vnd.ms-pki.seccat cat +application/vnd.ms-pki.stl stl +# application/vnd.ms-playready.initiator+xml +application/vnd.ms-powerpoint ppt pps pot +application/vnd.ms-powerpoint.addin.macroenabled.12 ppam +application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm +application/vnd.ms-powerpoint.slide.macroenabled.12 sldm +application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm +application/vnd.ms-powerpoint.template.macroenabled.12 potm +# application/vnd.ms-printing.printticket+xml +application/vnd.ms-project mpp mpt +# application/vnd.ms-tnef +# application/vnd.ms-wmdrm.lic-chlg-req +# application/vnd.ms-wmdrm.lic-resp +# application/vnd.ms-wmdrm.meter-chlg-req +# application/vnd.ms-wmdrm.meter-resp +application/vnd.ms-word.document.macroenabled.12 docm +application/vnd.ms-word.template.macroenabled.12 dotm +application/vnd.ms-works wps wks wcm wdb +application/vnd.ms-wpl wpl +application/vnd.ms-xpsdocument xps +application/vnd.mseq mseq +# application/vnd.msign +# application/vnd.multiad.creator +# application/vnd.multiad.creator.cif +# application/vnd.music-niff +application/vnd.musician mus +application/vnd.muvee.style msty +application/vnd.mynfc taglet +# application/vnd.ncd.control +# application/vnd.ncd.reference +# application/vnd.nervana +# application/vnd.netfpx +application/vnd.neurolanguage.nlu nlu +application/vnd.nitf ntf nitf +application/vnd.noblenet-directory nnd +application/vnd.noblenet-sealer nns +application/vnd.noblenet-web nnw +# application/vnd.nokia.catalogs +# application/vnd.nokia.conml+wbxml +# application/vnd.nokia.conml+xml +# application/vnd.nokia.isds-radio-presets +# application/vnd.nokia.iptv.config+xml +# application/vnd.nokia.landmark+wbxml +# application/vnd.nokia.landmark+xml +# application/vnd.nokia.landmarkcollection+xml +# application/vnd.nokia.n-gage.ac+xml +application/vnd.nokia.n-gage.data ngdat +application/vnd.nokia.n-gage.symbian.install n-gage +# application/vnd.nokia.ncd +# application/vnd.nokia.pcd+wbxml +# application/vnd.nokia.pcd+xml +application/vnd.nokia.radio-preset rpst +application/vnd.nokia.radio-presets rpss +application/vnd.novadigm.edm edm +application/vnd.novadigm.edx edx +application/vnd.novadigm.ext ext +# application/vnd.ntt-local.file-transfer +# application/vnd.ntt-local.sip-ta_remote +# application/vnd.ntt-local.sip-ta_tcp_stream +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.chart-template otc +application/vnd.oasis.opendocument.database odb +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.formula-template odft +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.image-template oti +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master odm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +# application/vnd.obn +# application/vnd.oftn.l10n+json +# application/vnd.oipf.contentaccessdownload+xml +# application/vnd.oipf.contentaccessstreaming+xml +# application/vnd.oipf.cspg-hexbinary +# application/vnd.oipf.dae.svg+xml +# application/vnd.oipf.dae.xhtml+xml +# application/vnd.oipf.mippvcontrolmessage+xml +# application/vnd.oipf.pae.gem +# application/vnd.oipf.spdiscovery+xml +# application/vnd.oipf.spdlist+xml +# application/vnd.oipf.ueprofile+xml +# application/vnd.oipf.userprofile+xml +application/vnd.olpc-sugar xo +# application/vnd.oma-scws-config +# application/vnd.oma-scws-http-request +# application/vnd.oma-scws-http-response +# application/vnd.oma.bcast.associated-procedure-parameter+xml +# application/vnd.oma.bcast.drm-trigger+xml +# application/vnd.oma.bcast.imd+xml +# application/vnd.oma.bcast.ltkm +# application/vnd.oma.bcast.notification+xml +# application/vnd.oma.bcast.provisioningtrigger +# application/vnd.oma.bcast.sgboot +# application/vnd.oma.bcast.sgdd+xml +# application/vnd.oma.bcast.sgdu +# application/vnd.oma.bcast.simple-symbol-container +# application/vnd.oma.bcast.smartcard-trigger+xml +# application/vnd.oma.bcast.sprov+xml +# application/vnd.oma.bcast.stkm +# application/vnd.oma.cab-address-book+xml +# application/vnd.oma.cab-feature-handler+xml +# application/vnd.oma.cab-pcc+xml +# application/vnd.oma.cab-user-prefs+xml +# application/vnd.oma.dcd +# application/vnd.oma.dcdc +application/vnd.oma.dd2+xml dd2 +# application/vnd.oma.drm.risd+xml +# application/vnd.oma.group-usage-list+xml +# application/vnd.oma.pal+xml +# application/vnd.oma.poc.detailed-progress-report+xml +# application/vnd.oma.poc.final-report+xml +# application/vnd.oma.poc.groups+xml +# application/vnd.oma.poc.invocation-descriptor+xml +# application/vnd.oma.poc.optimized-progress-report+xml +# application/vnd.oma.push +# application/vnd.oma.scidm.messages+xml +# application/vnd.oma.xcap-directory+xml +# application/vnd.omads-email+xml +# application/vnd.omads-file+xml +# application/vnd.omads-folder+xml +# application/vnd.omaloc-supl-init +application/vnd.openofficeorg.extension oxt +# application/vnd.openxmlformats-officedocument.custom-properties+xml +# application/vnd.openxmlformats-officedocument.customxmlproperties+xml +# application/vnd.openxmlformats-officedocument.drawing+xml +# application/vnd.openxmlformats-officedocument.drawingml.chart+xml +# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml +# application/vnd.openxmlformats-officedocument.extended-properties+xml +# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml +# application/vnd.openxmlformats-officedocument.presentationml.comments+xml +# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml +application/vnd.openxmlformats-officedocument.presentationml.presentation pptx +# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml +application/vnd.openxmlformats-officedocument.presentationml.slide sldx +# application/vnd.openxmlformats-officedocument.presentationml.slide+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml +application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx +# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml +# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml +# application/vnd.openxmlformats-officedocument.presentationml.tags+xml +application/vnd.openxmlformats-officedocument.presentationml.template potx +# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx +# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml +# application/vnd.openxmlformats-officedocument.theme+xml +# application/vnd.openxmlformats-officedocument.themeoverride+xml +# application/vnd.openxmlformats-officedocument.vmldrawing +# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.document docx +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx +# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml +# application/vnd.openxmlformats-package.core-properties+xml +# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml +# application/vnd.openxmlformats-package.relationships+xml +# application/vnd.quobject-quoxdocument +# application/vnd.osa.netdeploy +application/vnd.osgeo.mapguide.package mgp +# application/vnd.osgi.bundle +application/vnd.osgi.dp dp +application/vnd.osgi.subsystem esa +# application/vnd.otps.ct-kip+xml +application/vnd.palm pdb pqa oprc +# application/vnd.paos.xml +application/vnd.pawaafile paw +application/vnd.pg.format str +application/vnd.pg.osasli ei6 +# application/vnd.piaccess.application-licence +application/vnd.picsel efif +application/vnd.pmi.widget wg +# application/vnd.poc.group-advertisement+xml +application/vnd.pocketlearn plf +application/vnd.powerbuilder6 pbd +# application/vnd.powerbuilder6-s +# application/vnd.powerbuilder7 +# application/vnd.powerbuilder7-s +# application/vnd.powerbuilder75 +# application/vnd.powerbuilder75-s +# application/vnd.preminet +application/vnd.previewsystems.box box +application/vnd.proteus.magazine mgz +application/vnd.publishare-delta-tree qps +application/vnd.pvi.ptid1 ptid +# application/vnd.pwg-multiplexed +# application/vnd.pwg-xhtml-print+xml +# application/vnd.qualcomm.brew-app-res +application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb +# application/vnd.radisys.moml+xml +# application/vnd.radisys.msml+xml +# application/vnd.radisys.msml-audit+xml +# application/vnd.radisys.msml-audit-conf+xml +# application/vnd.radisys.msml-audit-conn+xml +# application/vnd.radisys.msml-audit-dialog+xml +# application/vnd.radisys.msml-audit-stream+xml +# application/vnd.radisys.msml-conf+xml +# application/vnd.radisys.msml-dialog+xml +# application/vnd.radisys.msml-dialog-base+xml +# application/vnd.radisys.msml-dialog-fax-detect+xml +# application/vnd.radisys.msml-dialog-fax-sendrecv+xml +# application/vnd.radisys.msml-dialog-group+xml +# application/vnd.radisys.msml-dialog-speech+xml +# application/vnd.radisys.msml-dialog-transform+xml +# application/vnd.rainstor.data +# application/vnd.rapid +application/vnd.realvnc.bed bed +application/vnd.recordare.musicxml mxl +application/vnd.recordare.musicxml+xml musicxml +# application/vnd.renlearn.rlprint +application/vnd.rig.cryptonote cryptonote +application/vnd.rim.cod cod +application/vnd.rn-realmedia rm +application/vnd.rn-realmedia-vbr rmvb +application/vnd.route66.link66+xml link66 +# application/vnd.rs-274x +# application/vnd.ruckus.download +# application/vnd.s3sms +application/vnd.sailingtracker.track st +# application/vnd.sbm.cid +# application/vnd.sbm.mid2 +# application/vnd.scribus +# application/vnd.sealed.3df +# application/vnd.sealed.csf +# application/vnd.sealed.doc +# application/vnd.sealed.eml +# application/vnd.sealed.mht +# application/vnd.sealed.net +# application/vnd.sealed.ppt +# application/vnd.sealed.tiff +# application/vnd.sealed.xls +# application/vnd.sealedmedia.softseal.html +# application/vnd.sealedmedia.softseal.pdf +application/vnd.seemail see +application/vnd.sema sema +application/vnd.semd semd +application/vnd.semf semf +application/vnd.shana.informed.formdata ifm +application/vnd.shana.informed.formtemplate itp +application/vnd.shana.informed.interchange iif +application/vnd.shana.informed.package ipk +application/vnd.simtech-mindmapper twd twds +application/vnd.smaf mmf +# application/vnd.smart.notebook +application/vnd.smart.teacher teacher +# application/vnd.software602.filler.form+xml +# application/vnd.software602.filler.form-xml-zip +application/vnd.solent.sdkm+xml sdkm sdkd +application/vnd.spotfire.dxp dxp +application/vnd.spotfire.sfs sfs +# application/vnd.sss-cod +# application/vnd.sss-dtf +# application/vnd.sss-ntf +application/vnd.stardivision.calc sdc +application/vnd.stardivision.draw sda +application/vnd.stardivision.impress sdd +application/vnd.stardivision.math smf +application/vnd.stardivision.writer sdw vor +application/vnd.stardivision.writer-global sgl +application/vnd.stepmania.package smzip +application/vnd.stepmania.stepchart sm +# application/vnd.street-stream +application/vnd.sun.xml.calc sxc +application/vnd.sun.xml.calc.template stc +application/vnd.sun.xml.draw sxd +application/vnd.sun.xml.draw.template std +application/vnd.sun.xml.impress sxi +application/vnd.sun.xml.impress.template sti +application/vnd.sun.xml.math sxm +application/vnd.sun.xml.writer sxw +application/vnd.sun.xml.writer.global sxg +application/vnd.sun.xml.writer.template stw +# application/vnd.sun.wadl+xml +application/vnd.sus-calendar sus susp +application/vnd.svd svd +# application/vnd.swiftview-ics +application/vnd.symbian.install sis sisx +application/vnd.syncml+xml xsm +application/vnd.syncml.dm+wbxml bdm +application/vnd.syncml.dm+xml xdm +# application/vnd.syncml.dm.notification +# application/vnd.syncml.ds.notification +application/vnd.tao.intent-module-archive tao +application/vnd.tcpdump.pcap pcap cap dmp +application/vnd.tmobile-livetv tmo +application/vnd.trid.tpt tpt +application/vnd.triscape.mxs mxs +application/vnd.trueapp tra +# application/vnd.truedoc +# application/vnd.ubisoft.webplayer +application/vnd.ufdl ufd ufdl +application/vnd.uiq.theme utz +application/vnd.umajin umj +application/vnd.unity unityweb +application/vnd.uoml+xml uoml +# application/vnd.uplanet.alert +# application/vnd.uplanet.alert-wbxml +# application/vnd.uplanet.bearer-choice +# application/vnd.uplanet.bearer-choice-wbxml +# application/vnd.uplanet.cacheop +# application/vnd.uplanet.cacheop-wbxml +# application/vnd.uplanet.channel +# application/vnd.uplanet.channel-wbxml +# application/vnd.uplanet.list +# application/vnd.uplanet.list-wbxml +# application/vnd.uplanet.listcmd +# application/vnd.uplanet.listcmd-wbxml +# application/vnd.uplanet.signal +application/vnd.vcx vcx +# application/vnd.vd-study +# application/vnd.vectorworks +# application/vnd.verimatrix.vcas +# application/vnd.vidsoft.vidconference +application/vnd.visio vsd vst vss vsw +application/vnd.visionary vis +# application/vnd.vividence.scriptfile +application/vnd.vsf vsf +# application/vnd.wap.sic +# application/vnd.wap.slc +application/vnd.wap.wbxml wbxml +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/vnd.webturbo wtb +# application/vnd.wfa.wsc +# application/vnd.wmc +# application/vnd.wmf.bootstrap +# application/vnd.wolfram.mathematica +# application/vnd.wolfram.mathematica.package +application/vnd.wolfram.player nbp +application/vnd.wordperfect wpd +application/vnd.wqd wqd +# application/vnd.wrq-hp3000-labelled +application/vnd.wt.stf stf +# application/vnd.wv.csp+wbxml +# application/vnd.wv.csp+xml +# application/vnd.wv.ssp+xml +application/vnd.xara xar +application/vnd.xfdl xfdl +# application/vnd.xfdl.webform +# application/vnd.xmi+xml +# application/vnd.xmpie.cpkg +# application/vnd.xmpie.dpkg +# application/vnd.xmpie.plan +# application/vnd.xmpie.ppkg +# application/vnd.xmpie.xlim +application/vnd.yamaha.hv-dic hvd +application/vnd.yamaha.hv-script hvs +application/vnd.yamaha.hv-voice hvp +application/vnd.yamaha.openscoreformat osf +application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg +# application/vnd.yamaha.remote-setup +application/vnd.yamaha.smaf-audio saf +application/vnd.yamaha.smaf-phrase spf +# application/vnd.yamaha.through-ngn +# application/vnd.yamaha.tunnel-udpencap +application/vnd.yellowriver-custom-menu cmp +application/vnd.zul zir zirz +application/vnd.zzazz.deck+xml zaz +application/voicexml+xml vxml +# application/vq-rtcpxr +# application/watcherinfo+xml +# application/whoispp-query +# application/whoispp-response +application/widget wgt +application/winhlp hlp +# application/wita +# application/wordperfect5.1 +application/wsdl+xml wsdl +application/wspolicy+xml wspolicy +application/x-7z-compressed 7z +application/x-abiword abw +application/x-ace-compressed ace +# application/x-amf +application/x-apple-diskimage dmg +application/x-authorware-bin aab x32 u32 vox +application/x-authorware-map aam +application/x-authorware-seg aas +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-blorb blb blorb +application/x-bzip bz +application/x-bzip2 bz2 boz +application/x-cbr cbr cba cbt cbz cb7 +application/x-cdlink vcd +application/x-cfs-compressed cfs +application/x-chat chat +application/x-chess-pgn pgn +application/x-conference nsc +# application/x-compress +application/x-cpio cpio +application/x-csh csh +application/x-debian-package deb udeb +application/x-dgc-compressed dgc +application/x-director dir dcr dxr cst cct cxt w3d fgd swa +application/x-doom wad +application/x-dtbncx+xml ncx +application/x-dtbook+xml dtb +application/x-dtbresource+xml res +application/x-dvi dvi +application/x-envoy evy +application/x-eva eva +application/x-font-bdf bdf +# application/x-font-dos +# application/x-font-framemaker +application/x-font-ghostscript gsf +# application/x-font-libgrx +application/x-font-linux-psf psf +application/x-font-otf otf +application/x-font-pcf pcf +application/x-font-snf snf +# application/x-font-speedo +# application/x-font-sunos-news +application/x-font-ttf ttf ttc +application/x-font-type1 pfa pfb pfm afm +application/x-font-woff woff +# application/x-font-vfont +application/x-freearc arc +application/x-futuresplash spl +application/x-gca-compressed gca +application/x-glulx ulx +application/x-gnumeric gnumeric +application/x-gramps-xml gramps +application/x-gtar gtar +# application/x-gzip +application/x-hdf hdf +application/x-install-instructions install +application/x-iso9660-image iso +application/x-java-jnlp-file jnlp +application/x-latex latex +application/x-lzh-compressed lzh lha +application/x-mie mie +application/x-mobipocket-ebook prc mobi +application/x-ms-application application +application/x-ms-shortcut lnk +application/x-ms-wmd wmd +application/x-ms-wmz wmz +application/x-ms-xbap xbap +application/x-msaccess mdb +application/x-msbinder obd +application/x-mscardfile crd +application/x-msclip clp +application/x-msdownload exe dll com bat msi +application/x-msmediaview mvb m13 m14 +application/x-msmetafile wmf wmz emf emz +application/x-msmoney mny +application/x-mspublisher pub +application/x-msschedule scd +application/x-msterminal trm +application/x-mswrite wri +application/x-netcdf nc cdf +application/x-nzb nzb +application/x-pkcs12 p12 pfx +application/x-pkcs7-certificates p7b spc +application/x-pkcs7-certreqresp p7r +application/x-rar-compressed rar +application/x-research-info-systems ris +application/x-sh sh +application/x-shar shar +application/x-shockwave-flash swf +application/x-silverlight-app xap +application/x-sql sql +application/x-stuffit sit +application/x-stuffitx sitx +application/x-subrip srt +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-t3vm-image t3 +application/x-tads gam +application/x-tar tar +application/x-tcl tcl +application/x-tex tex +application/x-tex-tfm tfm +application/x-texinfo texinfo texi +application/x-tgif obj +application/x-ustar ustar +application/x-wais-source src +application/x-x509-ca-cert der crt +application/x-xfig fig +application/x-xliff+xml xlf +application/x-xpinstall xpi +application/x-xz xz +application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 +# application/x400-bp +application/xaml+xml xaml +# application/xcap-att+xml +# application/xcap-caps+xml +application/xcap-diff+xml xdf +# application/xcap-el+xml +# application/xcap-error+xml +# application/xcap-ns+xml +# application/xcon-conference-info-diff+xml +# application/xcon-conference-info+xml +application/xenc+xml xenc +application/xhtml+xml xhtml xht +# application/xhtml-voice+xml +application/xml xml xsl +application/xml-dtd dtd +# application/xml-external-parsed-entity +# application/xmpp+xml +application/xop+xml xop +application/xproc+xml xpl +application/xslt+xml xslt +application/xspf+xml xspf +application/xv+xml mxml xhvml xvml xvm +application/yang yang +application/yin+xml yin +application/zip zip +# audio/1d-interleaved-parityfec +# audio/32kadpcm +# audio/3gpp +# audio/3gpp2 +# audio/ac3 +audio/adpcm adp +# audio/amr +# audio/amr-wb +# audio/amr-wb+ +# audio/asc +# audio/atrac-advanced-lossless +# audio/atrac-x +# audio/atrac3 +audio/basic au snd +# audio/bv16 +# audio/bv32 +# audio/clearmode +# audio/cn +# audio/dat12 +# audio/dls +# audio/dsr-es201108 +# audio/dsr-es202050 +# audio/dsr-es202211 +# audio/dsr-es202212 +# audio/dv +# audio/dvi4 +# audio/eac3 +# audio/evrc +# audio/evrc-qcp +# audio/evrc0 +# audio/evrc1 +# audio/evrcb +# audio/evrcb0 +# audio/evrcb1 +# audio/evrcwb +# audio/evrcwb0 +# audio/evrcwb1 +# audio/example +# audio/fwdred +# audio/g719 +# audio/g722 +# audio/g7221 +# audio/g723 +# audio/g726-16 +# audio/g726-24 +# audio/g726-32 +# audio/g726-40 +# audio/g728 +# audio/g729 +# audio/g7291 +# audio/g729d +# audio/g729e +# audio/gsm +# audio/gsm-efr +# audio/gsm-hr-08 +# audio/ilbc +# audio/ip-mr_v2.5 +# audio/isac +# audio/l16 +# audio/l20 +# audio/l24 +# audio/l8 +# audio/lpc +audio/midi mid midi kar rmi +# audio/mobile-xmf +audio/mp4 mp4a +# audio/mp4a-latm +# audio/mpa +# audio/mpa-robust +audio/mpeg mpga mp2 mp2a mp3 m2a m3a +# audio/mpeg4-generic +# audio/musepack +audio/ogg oga ogg spx +# audio/opus +# audio/parityfec +# audio/pcma +# audio/pcma-wb +# audio/pcmu-wb +# audio/pcmu +# audio/prs.sid +# audio/qcelp +# audio/red +# audio/rtp-enc-aescm128 +# audio/rtp-midi +# audio/rtx +audio/s3m s3m +audio/silk sil +# audio/smv +# audio/smv0 +# audio/smv-qcp +# audio/sp-midi +# audio/speex +# audio/t140c +# audio/t38 +# audio/telephone-event +# audio/tone +# audio/uemclip +# audio/ulpfec +# audio/vdvi +# audio/vmr-wb +# audio/vnd.3gpp.iufp +# audio/vnd.4sb +# audio/vnd.audiokoz +# audio/vnd.celp +# audio/vnd.cisco.nse +# audio/vnd.cmles.radio-events +# audio/vnd.cns.anp1 +# audio/vnd.cns.inf1 +audio/vnd.dece.audio uva uvva +audio/vnd.digital-winds eol +# audio/vnd.dlna.adts +# audio/vnd.dolby.heaac.1 +# audio/vnd.dolby.heaac.2 +# audio/vnd.dolby.mlp +# audio/vnd.dolby.mps +# audio/vnd.dolby.pl2 +# audio/vnd.dolby.pl2x +# audio/vnd.dolby.pl2z +# audio/vnd.dolby.pulse.1 +audio/vnd.dra dra +audio/vnd.dts dts +audio/vnd.dts.hd dtshd +# audio/vnd.dvb.file +# audio/vnd.everad.plj +# audio/vnd.hns.audio +audio/vnd.lucent.voice lvp +audio/vnd.ms-playready.media.pya pya +# audio/vnd.nokia.mobile-xmf +# audio/vnd.nortel.vbk +audio/vnd.nuera.ecelp4800 ecelp4800 +audio/vnd.nuera.ecelp7470 ecelp7470 +audio/vnd.nuera.ecelp9600 ecelp9600 +# audio/vnd.octel.sbc +# audio/vnd.qcelp +# audio/vnd.rhetorex.32kadpcm +audio/vnd.rip rip +# audio/vnd.sealedmedia.softseal.mpeg +# audio/vnd.vmx.cvsd +# audio/vorbis +# audio/vorbis-config +audio/webm weba +audio/x-aac aac +audio/x-aiff aif aiff aifc +audio/x-caf caf +audio/x-flac flac +audio/x-matroska mka +audio/x-mpegurl m3u +audio/x-ms-wax wax +audio/x-ms-wma wma +audio/x-pn-realaudio ram ra +audio/x-pn-realaudio-plugin rmp +# audio/x-tta +audio/x-wav wav +audio/xm xm +chemical/x-cdx cdx +chemical/x-cif cif +chemical/x-cmdf cmdf +chemical/x-cml cml +chemical/x-csml csml +# chemical/x-pdb +chemical/x-xyz xyz +image/bmp bmp +image/cgm cgm +# image/example +# image/fits +image/g3fax g3 +image/gif gif +image/ief ief +# image/jp2 +image/jpeg jpeg jpg jpe +# image/jpm +# image/jpx +image/ktx ktx +# image/naplps +image/png png +image/prs.btif btif +# image/prs.pti +image/sgi sgi +image/svg+xml svg svgz +# image/t38 +image/tiff tiff tif +# image/tiff-fx +image/vnd.adobe.photoshop psd +# image/vnd.cns.inf2 +image/vnd.dece.graphic uvi uvvi uvg uvvg +image/vnd.dvb.subtitle sub +image/vnd.djvu djvu djv +image/vnd.dwg dwg +image/vnd.dxf dxf +image/vnd.fastbidsheet fbs +image/vnd.fpx fpx +image/vnd.fst fst +image/vnd.fujixerox.edmics-mmr mmr +image/vnd.fujixerox.edmics-rlc rlc +# image/vnd.globalgraphics.pgb +# image/vnd.microsoft.icon +# image/vnd.mix +image/vnd.ms-modi mdi +image/vnd.ms-photo wdp +image/vnd.net-fpx npx +# image/vnd.radiance +# image/vnd.sealed.png +# image/vnd.sealedmedia.softseal.gif +# image/vnd.sealedmedia.softseal.jpg +# image/vnd.svf +image/vnd.wap.wbmp wbmp +image/vnd.xiff xif +image/webp webp +image/x-3ds 3ds +image/x-cmu-raster ras +image/x-cmx cmx +image/x-freehand fh fhc fh4 fh5 fh7 +image/x-icon ico +image/x-mrsid-image sid +image/x-pcx pcx +image/x-pict pic pct +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-tga tga +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd +# message/cpim +# message/delivery-status +# message/disposition-notification +# message/example +# message/external-body +# message/feedback-report +# message/global +# message/global-delivery-status +# message/global-disposition-notification +# message/global-headers +# message/http +# message/imdn+xml +# message/news +# message/partial +message/rfc822 eml mime +# message/s-http +# message/sip +# message/sipfrag +# message/tracking-status +# message/vnd.si.simp +# model/example +model/iges igs iges +model/mesh msh mesh silo +model/vnd.collada+xml dae +model/vnd.dwf dwf +# model/vnd.flatland.3dml +model/vnd.gdl gdl +# model/vnd.gs-gdl +# model/vnd.gs.gdl +model/vnd.gtw gtw +# model/vnd.moml+xml +model/vnd.mts mts +# model/vnd.parasolid.transmit.binary +# model/vnd.parasolid.transmit.text +model/vnd.vtu vtu +model/vrml wrl vrml +model/x3d+binary x3db x3dbz +model/x3d+vrml x3dv x3dvz +model/x3d+xml x3d x3dz +# multipart/alternative +# multipart/appledouble +# multipart/byteranges +# multipart/digest +# multipart/encrypted +# multipart/example +# multipart/form-data +# multipart/header-set +# multipart/mixed +# multipart/parallel +# multipart/related +# multipart/report +# multipart/signed +# multipart/voice-message +# text/1d-interleaved-parityfec +text/cache-manifest appcache +text/calendar ics ifb +text/css css +text/csv csv +# text/directory +# text/dns +# text/ecmascript +# text/enriched +# text/example +# text/fwdred +text/html html htm +# text/javascript +text/n3 n3 +# text/parityfec +text/plain txt text conf def list log in +# text/prs.fallenstein.rst +text/prs.lines.tag dsc +# text/vnd.radisys.msml-basic-layout +# text/red +# text/rfc822-headers +text/richtext rtx +# text/rtf +# text/rtp-enc-aescm128 +# text/rtx +text/sgml sgml sgm +# text/t140 +text/tab-separated-values tsv +text/troff t tr roff man me ms +text/turtle ttl +# text/ulpfec +text/uri-list uri uris urls +text/vcard vcard +# text/vnd.abc +text/vnd.curl curl +text/vnd.curl.dcurl dcurl +text/vnd.curl.scurl scurl +text/vnd.curl.mcurl mcurl +# text/vnd.dmclientscript +text/vnd.dvb.subtitle sub +# text/vnd.esmertec.theme-descriptor +text/vnd.fly fly +text/vnd.fmi.flexstor flx +text/vnd.graphviz gv +text/vnd.in3d.3dml 3dml +text/vnd.in3d.spot spot +# text/vnd.iptc.newsml +# text/vnd.iptc.nitf +# text/vnd.latex-z +# text/vnd.motorola.reflex +# text/vnd.ms-mediapackage +# text/vnd.net2phone.commcenter.command +# text/vnd.si.uricatalogue +text/vnd.sun.j2me.app-descriptor jad +# text/vnd.trolltech.linguist +# text/vnd.wap.si +# text/vnd.wap.sl +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/x-asm s asm +text/x-c c cc cxx cpp h hh dic +text/x-fortran f for f77 f90 +text/x-java-source java +text/x-opml opml +text/x-pascal p pas +text/x-nfo nfo +text/x-setext etx +text/x-sfv sfv +text/x-uuencode uu +text/x-vcalendar vcs +text/x-vcard vcf +# text/xml +# text/xml-external-parsed-entity +# video/1d-interleaved-parityfec +video/3gpp 3gp +# video/3gpp-tt +video/3gpp2 3g2 +# video/bmpeg +# video/bt656 +# video/celb +# video/dv +# video/example +video/h261 h261 +video/h263 h263 +# video/h263-1998 +# video/h263-2000 +video/h264 h264 +# video/h264-rcdo +# video/h264-svc +video/jpeg jpgv +# video/jpeg2000 +video/jpm jpm jpgm +video/mj2 mj2 mjp2 +# video/mp1s +# video/mp2p +# video/mp2t +video/mp4 mp4 mp4v mpg4 +# video/mp4v-es +video/mpeg mpeg mpg mpe m1v m2v +# video/mpeg4-generic +# video/mpv +# video/nv +video/ogg ogv +# video/parityfec +# video/pointer +video/quicktime qt mov +# video/raw +# video/rtp-enc-aescm128 +# video/rtx +# video/smpte292m +# video/ulpfec +# video/vc1 +# video/vnd.cctv +video/vnd.dece.hd uvh uvvh +video/vnd.dece.mobile uvm uvvm +# video/vnd.dece.mp4 +video/vnd.dece.pd uvp uvvp +video/vnd.dece.sd uvs uvvs +video/vnd.dece.video uvv uvvv +# video/vnd.directv.mpeg +# video/vnd.directv.mpeg-tts +# video/vnd.dlna.mpeg-tts +video/vnd.dvb.file dvb +video/vnd.fvt fvt +# video/vnd.hns.video +# video/vnd.iptvforum.1dparityfec-1010 +# video/vnd.iptvforum.1dparityfec-2005 +# video/vnd.iptvforum.2dparityfec-1010 +# video/vnd.iptvforum.2dparityfec-2005 +# video/vnd.iptvforum.ttsavc +# video/vnd.iptvforum.ttsmpeg2 +# video/vnd.motorola.video +# video/vnd.motorola.videop +video/vnd.mpegurl mxu m4u +video/vnd.ms-playready.media.pyv pyv +# video/vnd.nokia.interleaved-multimedia +# video/vnd.nokia.videovoip +# video/vnd.objectvideo +# video/vnd.sealed.mpeg1 +# video/vnd.sealed.mpeg4 +# video/vnd.sealed.swf +# video/vnd.sealedmedia.softseal.mov +video/vnd.uvvu.mp4 uvu uvvu +video/vnd.vivo viv +video/webm webm +video/x-f4v f4v +video/x-fli fli +video/x-flv flv +video/x-m4v m4v +video/x-matroska mkv mk3d mks +video/x-mng mng +video/x-ms-asf asf asx +video/x-ms-vob vob +video/x-ms-wm wm +video/x-ms-wmv wmv +video/x-ms-wmx wmx +video/x-ms-wvx wvx +video/x-msvideo avi +video/x-sgi-movie movie +video/x-smv smv +x-conference/x-cooltalk ice diff --git a/node_modules/request/node_modules/mime/types/node.types b/node_modules/request/node_modules/mime/types/node.types new file mode 100644 index 0000000..9097334 --- /dev/null +++ b/node_modules/request/node_modules/mime/types/node.types @@ -0,0 +1,59 @@ +# What: Google Chrome Extension +# Why: To allow apps to (work) be served with the right content type header. +# http://codereview.chromium.org/2830017 +# Added by: niftylettuce +application/x-chrome-extension crx + +# What: OTF Message Silencer +# Why: To silence the "Resource interpreted as font but transferred with MIME +# type font/otf" message that occurs in Google Chrome +# Added by: niftylettuce +font/opentype otf + +# What: HTC support +# Why: To properly render .htc files such as CSS3PIE +# Added by: niftylettuce +text/x-component htc + +# What: HTML5 application cache manifest +# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps +# per https://developer.mozilla.org/en/offline_resources_in_firefox +# Added by: louisremi +text/cache-manifest appcache manifest + +# What: node binary buffer format +# Why: semi-standard extension w/in the node community +# Added by: tootallnate +application/octet-stream buffer + +# What: The "protected" MP-4 formats used by iTunes. +# Why: Required for streaming music to browsers (?) +# Added by: broofa +application/mp4 m4p +audio/mp4 m4a + +# What: Music playlist format (http://en.wikipedia.org/wiki/M3U) +# Why: See https://github.com/bentomas/node-mime/pull/6 +# Added by: mjrusso +application/x-mpegURL m3u8 + +# What: Video format, Part of RFC1890 +# Why: See https://github.com/bentomas/node-mime/pull/6 +# Added by: mjrusso +video/MP2T ts + +# What: The FLAC lossless codec format +# Why: Streaming and serving FLAC audio +# Added by: jacobrask +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 diff --git a/node_modules/request/oauth.js b/node_modules/request/oauth.js new file mode 100644 index 0000000..e35bfa6 --- /dev/null +++ b/node_modules/request/oauth.js @@ -0,0 +1,43 @@ +var crypto = require('crypto') + , qs = require('querystring') + ; + +function sha1 (key, body) { + return crypto.createHmac('sha1', key).update(body).digest('base64') +} + +function rfc3986 (str) { + return encodeURIComponent(str) + .replace(/!/g,'%21') + .replace(/\*/g,'%2A') + .replace(/\(/g,'%28') + .replace(/\)/g,'%29') + .replace(/'/g,'%27') + ; +} + +function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) { + // adapted from https://dev.twitter.com/docs/auth/oauth and + // https://dev.twitter.com/docs/auth/creating-signature + + var querystring = Object.keys(params).sort().map(function(key){ + // big WTF here with the escape + encoding but it's what twitter wants + return escape(rfc3986(key)) + "%3D" + escape(rfc3986(params[key])) + }).join('%26') + + var base = [ + httpMethod ? httpMethod.toUpperCase() : 'GET', + rfc3986(base_uri), + querystring + ].join('&') + + var key = [ + consumer_secret, + token_secret || '' + ].map(rfc3986).join('&') + + return sha1(key, base) +} + +exports.hmacsign = hmacsign +exports.rfc3986 = rfc3986 diff --git a/node_modules/request/package.json b/node_modules/request/package.json new file mode 100644 index 0000000..f3539ea --- /dev/null +++ b/node_modules/request/package.json @@ -0,0 +1,17 @@ +{ "name" : "request" +, "description" : "Simplified HTTP request client." +, "tags" : ["http", "simple", "util", "utility"] +, "version" : "2.12.0" +, "author" : "Mikeal Rogers " +, "repository" : + { "type" : "git" + , "url" : "http://github.com/mikeal/request.git" + } +, "bugs" : + { "url" : "http://github.com/mikeal/request/issues" } +, "engines" : ["node >= 0.3.6"] +, "main" : "./main" +, "dependencies": { "form-data":"~0.0.3", "mime":"~1.2.7" } +, "bundleDependencies": ["form-data", "mime"] +, "scripts": { "test": "node tests/run.js" } +} diff --git a/node_modules/request/tests/googledoodle.png b/node_modules/request/tests/googledoodle.png new file mode 100644 index 0000000000000000000000000000000000000000..f80c9c52d3c507996535a19ee0bcfe3821de322d GIT binary patch literal 38510 zcmbTdbx>Tv*DX4@1RI>-?lQRh;O>J3cXtmG2<{Nv-Gaj)!C~;=9^56kgvjIf-COs* z`_+3@uipNr&#CTO-Bo9w?%r#!{crW(20#V?_y67C|Fq9LQ8BOoHd!M}SOAc+G2 zAj7>)0*`=qJHYpaOC6sL}92G*SfIn&^bI(&p}TJYgwBS{5F}^fKY8 z#Su*dEpG_q|A9vN-}rCSz`_3q0Tlu5ty>NVc!P&WKte=DMMOe+8~2|TAtC{hsc}J4 zD0rIY?ljzCDX93;#Z3bQv~TF)sdIEZo+X5qyVo}|+NI5dpVI!V12Eo}1`k940we%G z_hnUqcD*yl3?kMW4bGdQ<%S+Nq>-S=Nrt}4WwkjGq>OTY%!B=CJ8w#IenptLVpc_V z1`f4~Xi@?&sD@*|R)6y)`SB0wheqC}eNj-v9bcmL2^X6*MoZm{esqIwe2z;JRYD?H zR`$jhNv|+C@Vp5MD0Bx=i}7t@UfDUk|38gA#%a#oGvFUC_!A^7VE7@Eu7 zDy*la? z46rH)2FlGnV3n*)<-E8exU`^3QBJh~j)^!{)iNuDXE4+=EIIn_*NRI0z|;&@DLxnl z+|_CRDWB5}X@042CH!UDJgH(rDj%2suACjAniipk{VR5Fexn+!oRl=fVu^c_Azb}S zY-3Y2cN{j_9osMJo&bB|j}L0aTK@pGdMANi7YzZUb3A&(6vt*lb5pCgKK}rqxhS|J zW74A%DRgbR8s)MaSXBY`$gbvx%2lLRaLE$BRFaVZVXwhVdE=WLTFYKD0v z6H}C{+FOqTAxB%WH&WLLnM1E(u6{)FtCn!}PHo&@GgY~}a`OuO`478g$0?$syQKc> z!-o)$Frmd$X?=!eNdhD~lM*D8krn&Frxa>@pj|~|=4d}0k@iCz$_s0Nx5}?G;u*TS zn9Au(${5pdW|Ij4$}m$M(-t>T0iQMZKR^?D`9IN~SQW7inU>KGmi~WM5S|H8< zvb8MtTf*rP;8O8{brk?qSwOV{zcUKHDSg*6^5w*~+0q5BZ_DHzWQn-IJq6cyir2e7 zqDr&0bMC%os)oDb!n|(BdmbU?Y7UXrk)s48QFNLB0<5hCU0IA;c||y|tcph{Q2IWv zf_Z2l){Fw+5BTwm)xfB2BHU?X|X$n zGKNfNQ$PxO2~BlQT*J38kd!2+LK3`i+ctZA?^?sMJw2$oA;&=ZGk*;6kvo=A{4u#d zQ$#rWAuYQl*;<>CszpQ=)q9Y)SD^4{hDCU0Qf5R4e?2hg4i6YZ)3Mi7Z`6_ER1)*e zW%D$9K(RkJKWKb8IM<;ULBRWCiKRW+F~3mGBQ!N?-zU^>bQqUxIVF$N;{A^Cic`4@ z8|=wo{ebS1>de%@?*Jqx-JID82IjKpP=**KeX7C^l}M)ad@+DlG{AkdPDeObbAv7_ z(5I*&To3RbBAU=o77DkzOBQ;V&=h%4nTfmIQs{vrB&wa`ux82QE4LQ%Q5%Z`2hmb2byW*cHDV{3L|IuNBax7f<}C%C2A z++doKajscVL@P-+A)(a|hqBjfZ3kr2RV2eO?yE*x60JbO;~fj2DMlyDdp91?wXNpJ zE>N4zyY6zd-bp(~y1H`BH|92Y%!?)J0{IEo9SWPO6<=2S@BcVMbgjgq0Flc_)+y&v zA{5I2IlZExjVpfR&pI$)WP*Tq7%3#!I3~RxZp)Omv>`;my-Cj)QnCaWX1?tS)lnII zJQi79FVvRf4fxTYZdka(C+qbZFCwnk={4r;y`vz)T$atsSAs*v8w-qF0Re;iZ9MAVRF!!uD=}9I6_tQT>jE4JE*?3Yjx!#~Z z;r-NcBqJT1M&76pBK77!K!m0>J*!rgP)rIO1WG1EbI)`2`j+-U-7#YqOCi8p z5GTcNIs_oaTuob(XDs;gE7}`lr{`lvy<=^+?tG5qxVpBM1BWW*!O&-%Ac~8qmhY)Q zw;)I@s>WC5&D`Qwd4DRM3#F$1QaIE#GgdSB!G7jdDn9xRwpt^`uY(DM&>qr`PkGi> z6dnjnQBoeqi!`n&LcAw)`Z_MneS#X-%AC8RZ?CRT-H)kBDR(g;hkf!!%rdG9Jku*8 z0y}drhjJU@POVJg%c4ms^jOmpd(e~?L*pV?pF3C8pIy=~g-wz|`#XH4tel3K{{ULM znm+Y4)$RvYDF?r~^^^(d$$2DWbNG4vc(KO=bn~a=AzF%UX$Mu8kSFvRFoB@mW4WsD<#ELzQS}8d|&1PYl*$16$cgbqPc3aqRam=hCrW_9XUE9)bhfw0em!RReZ{byNW7oqK zf4e3w-+yksWY}RBKGPz<9W&>v9Tm6~lkbHE*6in+) z&8f5m+b=V1q+=T2L61xlBhCEic@OA@Xl#U)RFvL zwqbEdo(=FQllnsIUxs_P=uJxqGA7|276dIIR3Q9bKiQ)H>ebL*{%fY7t64uOKp+se z@mW~Fd>fegjN2F&S@CU+5y@J}?qs)Hy_hs4M46>$(UNm<(uBeh`mFk`o5v^>|8u0m zjDy&4U?eW^W=mB7-r{b*3IT$-yiLBo=GHd##Lp7_frR}CVcjU@h$p#fCwuX3NJQ*W zP%sEfU!pBP`f8uZioRCUTd#dRmvJ!PmueJpJ_YHD{z@5yE)1js-a;z%Bdl%xwjLd1VOn^jkZVUX&hzb z{FAvog1FV`J06+{vj69GPbz=wXJ%hpmi_#Y`9)vh)pZk&+K;6sKCh(Rvs>Tl$JPt8 zNqS?GIz63H-^sZ9oC=@I@#n z1N?q(tE;x)2Fqm6adD05u zai3KTqYoYB3%Ah zR^A((Hqaaim)wd`NNH<|*OE3(wd{C}G?UaX6%8DmIikM*cCY4?*3#m~;`=={`RJ|* zawd~VO-*)7lVc-pRhSg=xtu?yVc+PG4Y$l2L}HdnA@`r=)wxj=z2!@8DuWJ(0!UL8 zR{=s9Jj5>)%b>EJJb(b*3y1Gh=~)ZAi!Ugif4C-jsfh@P2eCROCq;_HYM9JyZB2)- zM#9*YI(@1^=`k+U0!s=CLE~B})>v4+wb;#j5LaCr{z_E;7#$rPwSQS?caM4GWAa(P z8Axuu)T4C=yr&%53xZ-nb$R1IIgtfUg1hXykv|D-N@RcW9`p8AVS$?HW`Z(3cD19U z0p4VLq5y2+BlIsidW*!xj%8K;Gsp+O{#w=jT(b;%kJ8V!jk>+h6CaoLOJsKI*DD@5 z=MPAQnLmlFmVt)u6d7|OITKT{EP8DU9A&{anM3uu=3-NO#o69*;U9kT&o?5suG3mw zwL(Db7z2ic0D%NK`933!a7McQvi%1-1&Xh{<>~;nt(!; zHqNGpi4~zph8XDwMI;P&kz%{;?+=W#EP3u~e@V#nk2Y`Ty&$;D1#Hs8bzVAVH`L6U z7rB)ib>!6jX&no*r=tz}ESfr_i#$OIiv|D&0nEYIz{cc;)!RJsW-eHPBxs1(SIZtB zOklO4+Lt0#{RKWu#RH@f33uRk&g8IVUyVPnsK^>hW-8i}lR7Yy z*sE>nLFWl;XuZ7}n6$=|?&}{Rc3SyHPN_W0f28W<|l-9cwM6@Ee}uj*@FX zShe9KE;dV3TtEU~&G}l}43uJzbjztA;VF<5`U!zl2SVj%g~xUlEx!C_BsCtr+`raU ztt4aLd&-oMZaUgDyZO57!~B9gR}&tuaOjU%IL2futWLx~KFIBae~NveGjem#m3!{x zT;=TjOu4)f-Edu&KvoYl2h^0tjvKDv=cxCSKnR!8nEQU2v+?VE>hp{MnNdvnON7oc(YoxL=9-!7EbAG#xv&LM zKSqF69nF4agI?#F8^dEg@$i#sWT7kP4T&{kCcDo%sLT5xnNmD=moFh=x?zM1l*T@Va z?gkn;5$N?Uv=%lRSkyG*UZxpn(~k1}wB%~>BC7zDSbKH7b2CFi&AJ=obNEm;T`*+w z;K$ph3a0WA8DgbnoZ^Xm^?uA-*nVp(juoi1Yg^&s|^-NARSuD<=HsIXfZra>-MGsvSY?U&as?ypvgq?8tRO*KqdUOd( zmcl{|2RdU~E4+oHu|&{xxu-F1lO>8-5(i3PdjPMj!u;~w&0G(hWgZk(&f22TZVl|#VKGS$DgL=eS5?IckjxRuTRLzekUuyzFMMl@7|!2AoT5rE%*{gG*vcgIFGwTOm9& z65k3madQ=caR{FYcqP%|W<0($0|;6HjivBJ`k#Y77m7xo>u)L>X=;*+&9L_p6$r2d zI90L=4w1%=>B&I32~I1m$~RCMK$@ZizM-@?t2nQTEfix9f%mR< z?eEgcc8jahwbj3kGQ;c{pD70zZ%fX0j%lp8V~NXDB0)2rS?JO@MGT;LOH};ww?hhe z4fnMMoi%T3^NJSZ5WRiR8K0GKwna{}bAy_N_zQ{cI(vjTD>UI7|5%f1jo`Wc;xCh# zQXYPl!cOlp%ltJ9qK`nrKST}NDbn&C!gMCMveh(oIuM5M?b;?0M*yp)?TI;>SQ5>#&% z*i#GzcYDy?^Crhk~OuVx+7ZlzF66#3M^XLn*R7Z zgih#LC|x=e<`l&guJ}(3`r6&+wpd~TR-UHu@zAQveXz~48D)w|8`@-Eo31g&Yn zb1pOl9ll%%A|85;1gH6o&Ya#y;Rjf3^sx@k=;u-VLFb!?ZTFHHcE>ut(k+Ah#02_n zdCLllxj)m$09i~c* z4sAJZ)n%}7vat9x0u_k~vzO)Ng>CuMZrIVHFDh+Zc48ip;0uZAa@23)pEOOsw!DcQ zb6ra5{{dQmTmF*syrDKOAlUdpxiRf;_=B!oP8ZU{%`(xe-1F$-K7kf)56#I9Dve<# zP$0WcKl52QqXLLA`Kzyn;L`y{n&b#y#}|w=_lCK140M_!he?)s<`@+u&;Vk(SBb^pd?eF7 zO)|N5Qh2(&-fRB)nsr&Q_xd-M0J%G_L`;%vk|T9VZgt7n^4r3O<$cF7a8FU;-6sPE84hmky?+vZush7ePKO; zYvai{KCHy^XM7O31ZbY^Did@amD45?6hkUuHQp+u?e^(Yk|lqugNZ~4Nz2wwm9Jjg zetbaV?*88Q*uhXh5famXrJzs%015yAp&x+!HM-C1Keq|f_`EVFRurukTs8}f)e>K9 ztFo;Qvw>W%p|pn6{c>EFEnJlGL^Gz4uIuXRiqa^hoUSOa+Q1jFD@;fE7|&=xK)R;5 z<3}U@u%J56ts%=X4o!`57A`HUi%V^th~gYnjM@{0K(aC`x2!=8y0qmc6k1&<)2$lf z!5gS?OcA)VKkheW{C-8CG)z4IW7oc|ga48tcMPxJ zj$svSf;-viK=!i>T6D?IXO%%s=8Y;%<_QPKH~iW;e}KiH3t9pxcdB$h1d_j6t+(s9UY1q`VVl4l_>gA1JiwE zMn#<;`5)j#t3GvF28{@D5rj_-(AFp&fVm)Ufhm(g_*|$V5w&DJQl+1E`;WybpO1?C zInqxaHWF`c{&MH^8SVT7Tu++~yT|{`N`23F=9AZvGBC7i^hr;tJ^#tRg4RM|{=R>- zC@y9suSStk&P)d6{m|W#ApZ|QXy?rN(S2%Ro~P#@KsO@%!&BP?i|5FaBaSl_?XF`o z2!qAlZeS@JJTx}eS})yU7lBBL z*u0j%H6;>@ZZYQhyl(RoM!1WGm@N21y*=4HWBh)#tnp##(3ablu0nYLM&$x5?ZQ-M z2ID}b_uUEX7_BL~iv5fq5sZU>h+6R$MD|mV-O-X=W4CH3^H_U1&jQBD-6timY8rcO zeP{mxA~E|~#&oJb+GgLKj4z*$+CUZQ4N7^y+*_9iCj$N@M^fvWbs0N|WIf!~N!srF zh?gRo-^R^SQ&XikA`RFOJsrh2K8FqL+TRF~Mg}aj!Z$;kCpHIwh|hT6Lu?nw^_jD< z2&U&p2ms;ZsY=eKXEQ5Y8H6W=VFzliG;~za(J09~2tOMnGjUcAvMJm(m4OtJORJ8eGNPs{TL2_mkza35ndG* z0|1LHdFwE$`c^p%XS-j3G832EYA^Dbo!UVKY%!i5^<(op?r^LfgC<{vF*Wf090#K0 zq!J4>)ac8OWDMC6Ha(X2rTaHX#bY)nfz&G|nQUQrcKST8TdJVm>sVGT>($`VRyJAq>z+f7O6o;h67POr@jS>mmIia~30sds1&w%gNiXYr&KN`|bK^9h z0GkkPl@EG6MomWb_uMak2febsYoi|YF{TQzZC_!Kd_or`GGuVoU?q!~WU#bP z_yrV82Dg+O5K$fZ<`SAKT+x3XI_lRysI424x->6<6N?i#{+7H;8m=>}ICZb3TU>_y z1JLXzC2w3A^_MZDBT_3#;|nq?0kqO3B;U>^{7B?uUOeHMI`}jsY|3e*s zFa2Zrrl}ov9du;U*O1%so0&+issgH&+PR(~t1`paBvY-E#ScU>?SzjpDx&np$i|Ly z_@k*>&aPgcl7DD9ivhAlRs>Co5pVlnoosW%afq<3p-=_HDNP<=9DZTH+~Rnc&^^20 ziMn*q<#!++b(-KuJ9KX!WkACI@37TP;uYIbgX+oxcUe9(4D!g>-qTHNsDqJ z-S1~SFzk)z%466Jo{D5k(10Lr(#N zERQ%(nAA8IHAU?77Ma)t6?2(Il~xwIMQ#Kjs_ij1r+K!ziY`{aT|nvmW4PN93IAO3z!mo|T}s0lE3eg*`-I?^r^5ZO6K zP9)a@=~h;Ry;&iK0mqr#c}ssU z@Rm7+v~3-UlRjc-n+luwe4o07;>yxd6|h;*txerkSh4z_c;;=7X&j=!0I~UF0Mj2G z9C4Qg4oa(4uD+CC4Jc&5GNA-Gwq`Z}I5x{m3Ajs&xxItp$i)_0_8$T+H@TloT76>G z47;3a96LO=ye4X}NE=e(Q(<)}p~FJ5N*2+m*zeEu#8N@cayuuRaEN5#SUchTREc0I z|2A%R?9M-fnvaul*0EpXQFlvFt#Quj4U%kyV|LwLb26(Mt@+k2w346Q_D`>3TOjE?+yt93paKVB=o z)V^yLNc-x%EVPlfQ>T&>#ac0!iUT%yf5@84jiw#Q$c6>+jkRc#tWJ;3ecygk-Eb=t zuyV`Yb>5P#-nYcu6*UH=Zx;3NYIYY)X-5XCWf`Ed95~uJ+_R}*i11FNDO4FOySvwG zaUQC+5Hb}lAx=KRCj#@I-EF=S_&P!7V$#KrK92eOWRx~SQu-%&q-Bv zEI3e=bk6fX@i=$rm{Oc;9Q@zY}3Z#!+!vK{AMY2ySI@E#Ks)DoniDXr_rv z=`vsZs*x=0kLN+*J$?V6yM#X<<(rDS0VBehJN+JjbnramIj2N|Ip#7LVX8D9%6;(4 z!^=#jv_jEv)&E0IFkDk4OK;{wcI;P@WZA7qEuA=`emCl)af?f}yUL%~r2=PXhQ8gH zo;Dv5Oy-(Fzg2b_&D@)gJ2-s?GQ-g(P7oFryq}Kk;9#!mWiMol3c+Ibv^2T1C5ar~MMNhBKRVa2b%n3x7>$5ccX&x6rCbBB zgxczdgO?R|L0IIs`@>3Ki1qmDGh<4aGI$!dvR6H{vO`>*i9?iW1$`7zeB^abhVp;M zV4x$W=b6#rG70u38RL%ySfXw1$VX4PZoQhlF7MS2S zt8&vx)1{#1*e6$45)usZ&3kX@>_&}0f>8De2ZJ=2;6>#tCDGE z`G7kUOWIvcXKHp{J&Ujz%8z63V39~;18P5n$39pz`Twrqx;gN!7E#@4-4YR9dfEMz zv6Zaw@jxH6_;WVd-Lj`CvIftY=#Yp)jRJucGyqA%gcc*%AYQ8r)qn<7n+l&`HIoj zZyQ#-%YubZA7~A-_z(O~>}f_R?5ab9L&+7`B+kDU7lONQxaT%u4((HP*K#Ym_LU;~wNQOqu(WyMglj_J!^t z?F}{gj*c$oqxcXX-B;_qK1?wh>6&>=-*Q89SuB@SAzn-A&Y(D%+u#8t z9==OWaOSXV%_}ynd2N|J(FNZoDIeGe{{}EiO z0yXsr_?^RKJM%ll4D>YP;Rk66kJ8eX>ZJuu z8#*Kcit?@T?x2$MIv2I-8FFbFxO!6G`da7!Vn$jvC7G(F;-AdppEsh*wqOi5rAOKR z@5ia`dpcEvR~+NG$eMW?K!t}t8zk6na*VVDdRN&fR3510_!)5cvpaq_{h`QhZPtV6 zrjI011_4<95E*LD-9R<;#`_lXg4L_{ougt8^P??gM$6S1izZ@D{$pryu72KlvOld4 zrex4?!Ob=-vY?*On1njvKojp@B`it`WUwC>064EC#x%pZzS)Bsv{+ZHeAjNWZcLvmI>ZL2-|NGe+4}i_6HD4)Ri#gsS!aYrwEL#b;u#0^eg2@#VnLTg z%isQ;GMr659zW!rb=G7Dq_~_(2nU+Y2eh1~OYCV1X%B|RG^c1RQKO^JE9{w0?U?t< zN-C{%n&SED;p!1!NMEfpAqPP%3MQ?XS{TegIXX|uxxKtyj0i-(Egdhi8WdD*J^*0Jv>B;uI1@pK5Ck}nvLd(LH z*qT3q@fEyvb+t2iQx&;m7B#_GR9ZNZa6sUjbaoL96KRHu7juGx=#OzrWSSo&cGA0M zoS8Mg34h42U7)U_dSX7H5C24N$V#E~yL4BZLe`8zaop0SmV=DvI;J~T<0TfkdVNh3 zKRbrwZl$jz+&=&h<(=ufmf46;UYZ9*dOt3FSW@!1kh#%lbYn}9eAe`iG-;!8`lzf1 z%&^`#1dy!%j;tWLSxycM%M4oJ5s_sOj{83Vn19R~%3D5Ya*32l?gfYB8-9Y?3kfqDsikK7hyY$*5JKgascgi%%P>sx83v3_?Vx z`zF!5)a3|?tzxy~Wgi)-6kievyA=uR`y3u4v}SQFp8L8mGLt}09qr)}-F^x0LbAX> zA*hQVQ6@Il4%S%`kdmnzy*0-QN}{dWs()Xj#8Ll=@{Bp%!gmcL+@tbFpa;HcIJSkt9|aY3C* zd@9}(%~#zIK8Pz~Kxs2Bg(-7WOyEOm!7ZQH#_S7Z>OAV5WID zfpM$0)WF~_7(1DXwis9;=?;Xa(m{K~3hZdC*E|1FSlc|yNdWGh#u(p*rqM@?VX%A3 zNBGIhvK+MaEE0xIiFlPBO*UZk80D)({6tW;X+LxWm@G}_X)poZ!$jH{QGyCrz{@ff=H-G$kQE4N|+y~aL3f~`1K@* zX4ECaZgN_DNhwF6R@SIC&HGK`VOk`Dwz>jJ97>`H#8MsG&eztPA2X5H2XjsF$Q_By zO|wh5gZsT(Yy~zC4K_cq`=>1(`n1HeuZ-Jb&Vv@T3@h!d(bFjnP}KXr#GAA1!UGrj|&4=YpZJY%KGW@DS73UnbVXD$;uf1 znyh75n3wv+U%lA8&<)DOeJ6&-=o0zulmyXSVNX%$s4H_-{B>zF(AvF0%W49Fw_h&% zr+<#*1kEe)Y_Y(6Q+&L{i_-!Sq;``ctNlhiP~ah?aO_=tY!~F)H?it*ldmpGiYC06 zh{E>2ptQa`dckvrM2>y3@U|e6WSZLo z@fs^)E3&r4RxmwPntpgzmt7T8sjV}iFby-4&n#(GAtWU2{s92Me!msKsHfqW&uq1n z3A0K}Y^UHF+fVo;*mU88hS+xL>A^1uJL)l=A0sS?6JORTH-7y4J-Our&ZUj$0Tt|P zrkDaN|9mxQq33XJdKj2=6Z!)2NuinVr`zIx10y5jC^3CVDP5%JT!?D^w zKe>em+QP1$kVJcJDdn47sqjG68Pk#V8KvR15Vcw|GhkLzPX;{ARu&4DlnlP#6`#yO!Z6eXVo|U*2~nNO}A1I@+w^K2>WGTPVqgH6D|`@TC4P4ELU~!Lq%yx zUR%zjo9mD|CNEpq2nXn0=@T6W`>zUnn-#`IQt;%9(8>;{;);S!zax14LYD&KP|H;I zJCZK&*Y??U6^N)182j3J? z>mQqgN$grSE+5*3l_pk8FoWi0=a0LyeO~&)3MQjgP_iNT^=fF931?Z(ZZas?QlvzHruiw8Lps>x~ z15l*Ef{AAOLQ*m^!s3(jqV)PWcKf)w&Kly^dgSCJ|p85328siUTF8=sarbP%I za9OLh90KpanASg5?XFyH&&@focl_vZ$mXT&$MDp}ak=4Odh1oYQ6&ba$GDQ%%@@Fw z6Mu@&)4^LNOTurP0Ebea9ciH3^7!**(lYC}Q)6$-8msuvJ|6c0noZC;SS^BTWV}MS zu2c_wv4CqnOJyX1Dn1MztRk%5x+Oz)+oCQ*sKV)#6cRFLziUS!wZ=GxFk-zP5ZzP( zy?P3>qkwD{M)wA1A|M6Z(Zm;B!h0%jffl}CRN{7a-uw49G zOPG8aN`i&fnr){sO-aYXQ^u`rSSgtrl~q_OoZvRe1hl;=S^D%iEeiRLQIMi@;*4?r zCu$;+WrFQj%}x)MbFS9w4z$aebRvcoAA$1S^%NoI*H(_1fMQ&RrN^Q`BK?*y$f^L0@=-J`bZPO6zqkQ~`ZHVkX8jSW91#*lXW-dbWLPZ7 z5BItgcrXv5m`s&MGBQ(-z;Vz1In#UP41){O9f+bW{IefMrHpAHY{!jYRIgYoHR{bB z=Pvcu1d@8|f?V|<5Oya^j+kjLkL$nRt-{KuZ#+HVR+BXqdcYsa3KLnrSnrYPTU(dT zL}oT#Y`L<0LG^W^=Fk<0^-3r3HE10ZH7o8H))8?Bg`{BGGPR4pi4YQVt47v1d3S3W z*hh(~rabAr5R2LPzf6DV_WDtDQiB`(Ns4w6EW14^u=`ewkuKI8n~qokQZrUJT>JX| zv-;9n-3o)2s^*2bJPIz2_^Z)SlKs%yOz`|}6IFQqx_k*1AX@6{&m)!b4lqoMWWldR zO2!R|3h})D`?rEA21OE*!~>O@Ehe_9?G5Vv^{MKl zrq=%=zn)HF@(%zr7MEmVwppvSQD9igwR+DlTO@1L4(7#Ch{OWKl%yzRqr+VT0Pklk z{wIMHj~O8e2!Lw@S9GwuG+X|G+P)t0tq~iY3aYbg)Fh?b#oh8W>z$-6aH-9V3_5fK z$lb=L3YHbCfC0iP@bJ`MWg&?iS?P`YY~B)rP!rV|O%@(Jtk`hp*dr~qK8i;vk9LJJ zMW~)n(-a~ToZ{?TMO+D6sz)!JZK6B2bwqUIaE}VCJ1#H5nw{(v?=y{ zfs}Poo`64kF<=Om!K-;7>hXT@>F-c0{mD2xAL)sMns24=JI_5!H&1a)%m*+b|JLbv zr)tiXa9=V=4_s*_YAtHb0!7OErGC~jQYLD`=*U*5MHw>&Qv!E69DR`o_VRRZ~NuJ^YdrfzbAQVgMvB7yrG6N(0E|Drdk{a@Mr(Yzp37w-_nG;5ArDUPJh=jwI2K1O zHKxjgZRL%3N7)|>o5S}Qel;9^_N6p+|6|H*i*`uV?(g))>I*m4#h2_{e@aG9YQg(x zs_X^Tp77{ar)<=<8cHcNSl-xZ-FvmUO7=FrGt_Yc>{P{q3!+K7PhX(N0Pi750Iw5@ z=s>?9jz2-aJ*YMhv+MWi=W?SsTi&>X1zZNvv^1V{%`SNr(cpJ&msuqgh$w~MIwxDZ zz0zH(D%>9TGA_h(3$MyU(@16BghxiKN~5^!bI52l(t+Nc2T=en{Gr@3ygh2?|ykB_Mujh2w71x*fO9jiONQd4wfpu)3RexAE{@h^QfCAuE9|%d?yUT z!(VW(eVDaNKAm^gYe4&&NP6rejZO30)Blz2xf=nHIGGr~)pxmVdn(U*$UbguAC;K; z;U9q7(lV=RX&#B-P&QZJ&cplJEA3PRfUtpj9}0**S6)10S9E_o=On-qI#{{x_yxdJ zse%*W;rXfMm7lqpwg9C{ReHy$CiP7?3WVdnNwTDiz&fk=az#`n5Bu|=tNg*V{|UV# zp<~b7H|vK0!r>Bp8+n$?Sg;_R!K8}mOY@-MqfqlP2TP}+`R%Q|B5tfT*oM%bbPB^! zQc{SqjmMUX3PAN`rs?(AaXoQqca(ZFKMb1r*+#MVESgWkf#ZkVKk3dZ}FE!6Gkr%}QFX9qd5*K~g+st62AJ>m7e? z*W4K9#Drx+c|3+w>n#d#89S+O*mO#>pwlhFZ0j)#deso+FxH3xVOO;_hgF}Q;og?A z%M@sk5w!g})f?y*<_|=kUR!XSJByLofBtCvLwK!X`$GWRJ_CiKOJ1RU-a%Vh zrjdA+{J5eg-!$)pd~A(0_f+QbmQc5Y%>ubo-XUwkW=Zl8CNB1^NmqadqkltMq=_X% z1aH2U70N41wffkDMT?rrAtO-VQ{xreT)(pZKX+ z+9tbG+^*-StumcpTE+hZ00lN@BKD_#i{gu|?aL9=_Rvi=k9X*8v9#%t5#V5*e_Cgy z2|@JRsUhL6KzPy^!T#1N_VA{Ut&F#loe>C9Lpi>NIEv-rEqQ^$lY)v56^xVEjnjN% z>e#ZRi>+c66&b$c-dvK8z7g?DMNDV(EvbqGIx8BX;ZgFHbr@9dr@A?cdrkw}vo0~# zkG`nHW*6retXo~J?^pzuIeHwmMGm~seu~P!Yi`^wulQO~-x9OFeuey2w=o8!_>ReF zp$19}d}a*-TjkN^oG^h?Alxje)md0MF?mH6WKo<{7Fne*RL2uhtr1bpX^gP%y+y4N z$x@p*0pWxNp2lNB4a9DO)c$-Y<%aU^B=wm;Zj2K(K0>lO=_c0VPA|`sS=!|c<&>EZ zS!~#12rGSmW05Es&$$(0!&{|t0Yam(qMMvZ^VlG^OjpZaX!Xs}j5n5D8!TAz_Vr!z zL_5n~;dd`u#F!bv$AK;M`;5&FbEhc?WEE1?Smp>>Bk;_eB}~U%Y-83#2E!jLyC#jk znf0vFfWDEG_j&n%(q1U$Su63&?iTxXto0f|4o9XCi~FpUDMI+HO5DUc;i&6#F?_Yk z&%IC`l~uE(WUsF?f=P0q;#vQbUX3TpWT~$39TDn%ba33(ks_SRr9!7Z8s@K z@6lD&qsrRbd)?FU8eVgBJR!+&zadAjMXnYx}=7|kJf=}m| z_X#eyjulMk311Eyrnufe+QUKFTK~*3{NmbZ`aL7I{ zk-_zIC(KheVXM;(?otS0eX?ms_s3^lrLpMq>eXMiP8S#ycugB_KBvvy=*b z41Xv3d+??2ruwzH__Oqc5XRfj6u{IM;-JZKl(K*zzvb;>KDCk(Z$}wN43)PyO5&3{ zc0_ZN{U-~1S$U8<1*OX66K8Kt+rfVo26K@0+Ag#$1*@Z*Sf~1oicZE-w?>Lhf?q%4m+PiO6~W{7IJ|4*e?kJl&NeKsWq@~LmMm0H8ZVk&s7Lsg55h})Fs3Ho1yJr&lBC)J|1qu}) z2$&*3s8)cefOLXI2xeU=fj|HN2p%~8nj*{eM9~vOO%X=S=Z%y`I>nf=)>V8+z^3aHxMOi*>QCT&Jqek90{{VT+ z7{0Z8vuv|+(E%<=GNo#u!qe{9uIS1#S@c^g<}H(#xKnbJ-Z;CnW=U8lQq?F|uA?0y zptj)UImo1mH(ifVKo^~*ZXU70K*|zhYD=eK-ohJqn)N$hRwIkZuI99s=_JE0;UlW z9&7SXA`t-*^Ut(lp)Gw&PF0r0D-lhYi&XQ01au% z>x&)*Q5+Fx{{V5@1CG2SF2`ORBH#|@wB3P838}XZ>=ru&tGRjUiAN75Wo70i9GT>l zl#|sJ6FGYI+M=SW7{VeVZE<{ckEpDks-mIJk>t6~Cvr~Yl6NHTrBT98H0>Ss*N79G z#_0q5voj%tPsXjMw^9qh?7 zOs*|!T6b)CJG|pRWFBI^N`S^StvP-^O7cB5@Rn-YvRKzK*5E98s{-zG4$>v^Az@!f zJIGj{Dyq%1sX2!ba*_<4Txt&_y~z%Z}H#xoJO>uY}8F*}j7M>BBS3EvG7awR9&`M@2gi%+aLIQ+MVy3AM ziphzJ2Lh^?@O0ECJQ$B2Tsz087b? zTUE5YfQKNNIQwhp(<@t{yCa6SJ*S4;($Dp#1B3qnl0onau7;oMRh0Do9O0i%zjEZ> z!lKe{PT|UmIdI|f?iXEA>rr1H7Lax!$82@VwO{6aJ+igYk|bX==6AOeF~+1zwS#D_>0*Ft(`017Daq=sAg!aB?V5|6M**m#K!`U0%7BwcGi^A zmc1KomeFS87V}Xgt!s}L2Y5j&X~s)I_js~E*pr2*t`+m#r)@<}4BP>vjkArie9v5L zvj6}9000004gdf+008&^0QdmbN&o-=HdHJ3QAG`Ry*XM_6vSgS<8C&5o0TsWMwmLA zj$GDS-Q{wYJDXvaYnC>TE{&g4;j1|D?IAh2xe0U^jc*>%>76GFE`wFbp;xB%-g8v! zrH6BQt3AnB;wCfZ;BOR+T|$w0`@M!A8tiY3s#SrP!*dYmDtwTjS zBIqz(U}n2QE1%I6OUulaeY!oQ9pXK3u|&>tjn1c(3u-kYGBPDW0r~;bQ4$g$kdL3@ z8;`!V?xLuTn)9>DY0e^eu5&ZU%Gg=}{vgLlN5x*KnoXkg_Ity+2lz|Qei;p0+aqHN zMp%Ig)%GE2m~yxWX}51PI|RBe%9+wl(|HQ?oK%ZtD^q{Eng%e|}~5({{-ow9S4=J^j6;9+m=xBk#h=je*XvCQ$+EcH||5bKdUHq`sD zvI7ZByLo6P>BYKo0mvKON2+l#coP8m)eWWv5aTHzBgyZ zHawS0yFc|E+dlK#Cc_+BMhhUO(9YlE8*!UP+Q^bb>vG~8rCCN+MlHYuPNOvrbjTe_ zrkHDXX>EUE)g)8G_fy?5lMJ{HJ|&I>wm?609(G|PuG-WPU?$B_-RYXiJ-8XQFOkpufQwW%BSIs$U)G!Dx zFq4i>X~T!1-{e6GLmNxmCOxs&^7L9m3Hp9))*0m;#R8^ z1S~8|*YZhLo1nrT1|{Q$D47sdyCOVP4cqRB97<~zpX}#L>B`U2G<1%V;xoe}r;W_d zJ^_H%k~ZQE;>Ov=RO+6$f4rROgRWGKsZ}hJSh{3u1gb`+w@_T^ z^Ywa&Su1nThDL|CK6oQ43tDIK&WU3A`3<L2qPRp6}Mr}SG|^H)R>g_Is9=T`6P^1ISRPt zf+bZ>1GD(NBD2uo0AcWRteHeS`17l+2W`3zt^L(qY_xKYee`5EKgP~B{7DF`KBTgIj8ZZG z0R2ftu6Ia`%Z;+`ExmRcM#o@Z1m)CVtI-VH$jeVmtB>pijE0MkW>dR;BPjI5K?G6( zQB@QvN&;aGT+wG3q_4?~v9TpsyNi@92Ao+a*XXF-^mFppV}aurjn)1t4%#>aCZP@W z6y*>fA)+k8Mou;%qL1aI7{#$fIa%b3v>7x=I1%MX4pd1L!+`sUYr>|gnvNILR#e9o zJ9)Y84QTaqhy&(|BIJ$rU z>qToHq=#m@P)!9b#n(%dcJAo_djartY&}a zO024Bo2&Z^ziUlXqFbo-wQO@$)l@ve!4o14fw*AVfMmKsA<4n0Q zUgbqSfH?3T06YK(+eA$fG)3{=SF7?5*-AfyhkYj+v0O(;yo_Y!`v(OmkgKwIvIlV0 zVvxcBWXw|l4;<)=k>A<_jVU*=w;2?ZC@lW~4MH?Bg(v~l2AK~ab%Bf?OjMG4$o_$@ zV(r|9+-XKR+uTpWLxmBthgApWX4L`-fTl?#L+78Pj!18}Jpv*F{R3QAcZ5h>aga$+ zJl64pv6d-fKLt8aF9uLLymXj25`cZg!O27QAN1B0Jt2^ovF#NF(kG@>y}i$E9{rl4 zvql*b;}qQDU@&y0_*>OLq8>Q+FOSd91J1sT{T868rR=ek)g0MzsSO?tC64@DR8>rV z(ABN$iH)se&vL3T=(WkW*QgW#P;n%Y>b2On3xUi8>tfa0!lpb4zr+{==Tmm~Un3i* zZSD6R-pEFIk-*WnkS_GeP%D@lO@*Um)+z*D-(&!tN~)*vRWN}Hnk~@jIgE7-1pw;g zN5>k_v^0--X?YFLfaE+$DjrJ*iD&p^nor#_Wa4$o$3UbbMyF|7D!^{Y0nVC&_H>FE zrV$g0ZH_#BN^{e3sCk|TMI5dapl6xPnCJW~_+`VuD1{v|8gfcRzFp8RtCvz`@2a`X zqUIIbfT$}daS<}7GJhQYn#-+55j;$00~*bM*lc#fk6f(76h@WA6>>R~G5lqe8ZAZ8 z2T+`rsYmnWMBpCXX1AFDV4bGzZ5pFplbv4 zK+>udpqb7<{{Ri(2Z8{H0CfKTKR^At=Y4IcUs&-;3%|pIzn}g79;#A$F4J}h^|Q^S z;pCct6)4D=h<<<{37R&`GT)#B`9P&8a35gfUqO2dxVq=rR*{}Z@kq#D89(XD_7AuO zQp#psgakaa^s41+7YQ2rUP;Ng0=Hor)mM)fHzEPjlXOgB@*f)84|`){3(!->w;nzNq&3#PzR&e7 z8D+LZv~t(P&*hFe90$#<`7DP_MkKq#o`99hf@y)&4oV(W>L~pD7~Vts01mlaY}L8I z*eSh@GQ%uqi0U(O(k+n45ZP|4FHUM>kX?e+iDOQ@dMSQzk1HVt%Nz2T9dvo>5Y;UO zbzP$C`cj4XsivAantyq`Bm?A2NIqFqHI(eBE`m{*WR1-}hj08YwlOYBfy@}#UexuaZJ8klX*{7(CI~`i? zPGR$7fob$wLb{S#3c2Yf9@`y{QPBKG>tUSaNQYHZku=jGj-rP!5QHHBOmm#(5GhDf zhaw~316Q?3q2;4b69=0$71^R;;iDI zdBhm`v~o8)W88aefn145y0A=4Pb}rC4%$49RV0d$6@}Dlb;=!9w@9bMv#-?Z5K&dC z)D(FPn;3W~Mkq$bMzkT!bAk++HX>!}F^nKyL_~QV5o9_d(;32*H)^Y~n5P{yulW99 z3#}+r00iGj#H&TKBZAGjY^b2og1lKPp`)vFD%-_FGYoPM-FMm^Z8&iBS%x^cseYwETNZK#yiFy*i8@5!nZ!6yoESU~ubMvnQ>k>_s`FcFnufY) z{{UG8tu1tNG?u(!z!KgdOB_eE+!af4q-7Os^wCr{Sekv8G=c~_gST8A$3nT;{iR*J zx4Ga9Ke!my37T^l-JMV;-KK~Og(_JQnViQ9m4G_^v}Lxw-86&Xr;#}S05+^0q1y#b z9UXgH`pBMGPwu~Q@^JqEagZ+!x#w z=@=FEs|i3AFWZ1H2PNQiJ;IgbI!M|Kpl&wyhli-?^6I@<;NhI?tVa;hETazFBIAoB zwR<4a7DB}g_8w8gM@lIkm^}v(a*WkY%Naz|FIozur%HkyCj8unvAEv9M_eh}mobII zh3zG;jo|FyMhL;@j1kkpdjq=aYtuj07QdHSz~L>>SQ)_O4jac+GGvgojf1^`fQdDZ zvaCQsoHeLKK%{aYn^*jYS8adux+6e#xYu_!J!w)IQ^ms-S-@nS8rjall5`RrG5vU5 z?@U7I6a)kSKtMo11Ox|=5Fa2QA@T#Rg9H!=J18&R5i~^66eZmysXLBK+pg1L#k=WT zy>e43Wab7>+yqYEunXv0ZK?c`6I2Y{ozEt_sntqFNF;dPW#LQ6BA}FtwLMtCoH>rSvf9`r zY}fGHWw^Kp%~0kspna|u@fXVMd#z(mPB#N}SI>}FcX#!w*zN?ZMAKS}vcq*c#NO%o$)#C#F( zv7xQ@4Xj>s|Jzq-2Ii z>RV$EaVFI)9J9zw2cIY7nZvo~K2Cpj;9c$$@;})AKB|H+rb2@!W;#JM(p@6}0T$po zPEp{&!NjBU^T>aFa+amEReMuHNn!Bn7q^#HW_Z^uG=?*Cu^(*YohD7g6N49N003|) zx@;wKAJe4#Yfx6vT&X2BG?jA0F#Ak*ihXM{0UX&4I}i0TAV;Xe zc&MXt%Qsug(@Ea$_Payn4h9vh78yxG6hM4-l60!A(I|d|DL^%V-ESI;P|9V!UaG5J zdd(x``<&tjz#`Uj7qMLV)I4 zV?$Q!8|}MJ+2K9p&m2!9XyXUlmEH|#{-E+jxvorYMh= zl9F>-txTxRgAlutpYDrRdypA5WMVOzaM4*9(z5d6U$VR1|^L%@agT5i~^67ag9j`A)l;_tgI+Bz@PU~j2SQ-?;z<1#Sa2Y62hMgDAIeiofF@!#N58?j+LkCcN>)z94Wn<%zv)a!80GIdl*+Y`*%h66c zNe@r_aXBP`kQ<%5CE8eZfq?79IJwEh$2cCZlBnJwIs`lk00-}{pxuqze@19KbY*~d zlFKKqUPgc0^1>y%ok9iD&mu52Z46<=dMd1UHwE7>IdM~yiBc)qK6r$8 z(gXZPCm*> zCaP=|QF0=4cF2llJc?-vyz(V(Ch$Ga%dBc@ySA}`?J&DJz`<|>K0fI`)#=Q=(!r=N z*byecn{axGlK?1ibBlmEOg=v-m;iYlNa~Oxl$Yh)2R|fHn>am2Ix<Y_q` zan|v|F36er51!co>VH52exa<#O~&b_r+)k;fcya;^dB`4q<+?EMf^CEYqk{>cOVHx z5aG$rR&82W^!nMuM6FQx*!&=O{`H7L=d+>cQqDr?q%VZ;C z8Z##Y+ep2^50O)V9+2_yCNOK9>)!f_;7sPw2xro3hGi$i2JW|veC2TC$O0ld+uF|JExK~&Hx?v&JGT12Z^I|xyrw?OSUI?X z{r=!r3b>u9MpmK`0N_#*fw&F?M1%znBk}yk{{ZV;AAWy*Svm6m0HXI&!YR-J1b{!~ zDCoicj-gip{{T=C*1o8VaPJU53@Bkq&r6&}zIyd7#_!#>JDTnXVPwnmXA*(YMcsWQ zA!(_YL_nleZWHX>6Ye0`+1MpQ(YScY3sNv;FRA_$cyS2YSQBIDfZl zo21BNBEuo0-!KOyA)QyIlSiz6-9}76Kd!c4(k?gu0K?jDa6eYdjt}!gCO-v`>34A5 zV)F%Z_=-YPCMFLhBHV}lLG*xsPbb$e=h-9CZehtu{0$c$J7bBj$u(@~u2%(`qUki% zOyk>3uMh&N1_ACQLYt4jNa~1ABB+!faz^lK!qpC7H%)u1 zg^k!NTdCz68yyWE$|fE?lvGq}R2aubMzukVdj?IDDovU)WYsjAHEP`=fk>KVDF{#i z007Y!yP_tDnj&b4qA10@+yvKj8(qyI!W@UbQmO(^kqj?inbj&ReL8Dkv#|)hiKIKoj(Vx;%&nk>^(H z4Kgm!wyKf1t7Cy6eXtHrI&pY-tGiC?<*#O&jhPs7LCLE94#LS9qAISMsH!3@Uq`!b z)`INafORCHOeHtR$Os3UXesJxjQ#TrF32F`;@33tBas9zT<^N*V_=@KnRjo@>p0JG zkycBdF*->$f{>p@c9z&Ex$ zDNHE3uShC{kQp&INS!h$iHGu>!NBXLG}maFJ61%;+Aolrlg=3kigq5M(LWE!<&XGj^_wDSi(B4on41`t=2OU$v|37x;Y|qY_hwoa8Tde?=+d8nl6CK8`-UF;MRGDC zhAEdGqNXPvbwP2uTWs{tth!f4PfFfyk-?+TWQ?C7l6nMO`g(zS=tWhk)6~70xMb$U za;nYdZ?;67@bIMMptwn?&UI(lT0`b=`7cg`H011<&*zJmY{8rF5UJA|=E6qQbM8gtNO_?!Wp zbV9m>^m@SIhIXQ*fzvN(Et)U39FA}~dRHxc2-3AxNWdj2fx5AfV(}mzewVz5gKOvy zVD`Cadq1GAsgH)Hx$cMmX>`bAxv z`1h$92Q6GAZw5_Njv@9C`2hg{9d0S1ilQkXnSs$f5JBWY<`f*z=9ai+rE$CJY3SvA z!n5;JjqvI-Z8NW_~@sGhrzBbIkJD4TOzFEc=j_G?3=3*cO?l4+#EEfoa9gBIl?2=mB+ z)DtLf)6p6OPv|-aQraLcs*n!$ci_t@9w(Dp4tQAHGyD7a39 z*-2}*Mz=sxs?15ry5(#y(qMwFL_f-FAJlc+s9^%8*&`@n04R>OHjlAXSJYEMO%`UE z;jJIM< z+a(@MTI^DfCgoo{P)w*wPCQZcl!JiqRc7TKx;fNPL#ZyYS7wGCA)WNK3qP@~R zv9xa11N}raet#tp7p{{C=H-1V{{Wzj;Fvj-aATMVUZfKeHYZU1AS${!N*~ixR8-1D zH1QwS%<#eJPD%JQ6Y79x;G!h<)%Pp7RIIk_XNGU`xaI@#3q`voxq){Lj%#sbiD>px zMg7)nk=4~blR)TAx(ll1V-vQLW;pcgdg+U8T{Ws}lj&deI3Oj@BMl8F^2|NA6_|WdwQs01Lo>K-RmfYk()=^4S+iK9h-UXq$NAJ?RbAi9=0S~smihUVqq@(P@10!+X*3R+i>^DC)l@&{$w1>E`nYQ5F zr9nRGMjM0JW)#5e{zAI%p^euR5L1MB*-vCk9YW5FfG+JHviDSgIPT^rc`%&ZqJe>0HTm=Pa zo6y8Ab7tIfEiy5D~+b5w6_Xro^Z}AA0T$m!~a5n5r2w z5XBN0f@L`|OhW(|rznR41LOoa*9k)M=*D^f0B;q&V>yk7$!t25v)c5WEZk|uC$TS@ zKWbnR4pnTrX963Kk}3rfm_FqZ)xL4WUOK6q(BN8m6}@RJvZc!DJ%5RrLQZ$_q^&V8 z8!mXMhR1HH7LH0a9?&yQ#5lGhL`)Pf`9bm{=2INlrnu46cXjbNA7qeOBMw0arrUmk1TrhLUgR#o#>uQ^WjNB$MVLGXjXLx}kFu4K;fJtcS^b-`+dXr(`>Bh`< zjItbu&^>7n)S0#4J(z3iU3;ftt8<#$)Bs0SA1)a&?}7UgV7a~-t@)|$q{gC)wHpQ?ZPgZ5l`JJ9v; zJM~sN_#ICut%!RcXnuZ&@%3Dr$VaOf^;XLeN*!k4c=+-@OaB1xT6V6T(LLE6Ree0o zm5p#KX49{7G3mCBcmXEGq4{pnbxxY76izA|@b`u4Ri|*n$dl?w#`z$Qv0H_wM3>wN@DzokU9NzkY248flc*^=~+`S>fCMo!Ax<_ znzSIy8@|MqCf4dU<1G@A48=60*|nCOig^x0n5nmPEK!v*E+fow0*T0OQV|ZK@#HZ3 zW%8n$uj-UnJDm)lXS=JIG~=KgSO?1(Di{TPH$J7?<#OEZRNN);5*VEw)^qa7tO3A> zAg{aY0Uy_$W+PN<4jv!)-tbxAYF+q^{`EHsh2k?)b;H@U~;qp;|_I4P|@#R~4nc%dh9 zJc6p85jz)ruuPCeQzU|=iZ^Ko=Wrwy1j1DS2qgd#ay-y#IqGO8Wi7tr+_|IL;Kvyx zZ?1P z(~$u)mjxe!m_qxY^i5X0)btiOn&CynA5ii3AZZ+DJsj_GpSET4Sg=Arh<;13QAamDWYRo#*Kqo z&;wcrfB*oC=xf;*;fhm~#5q94FbPak02rnzgMlf4c>w_d@)~p4@Dpse4GL9{{)!*)HtA&l!J=e^dBE5P+Q8~JdqU?^ThvfReubrCdE9{S`mVm)n z?s7nTvVV!VEO)7CK57A>yn?NW4?!KcTbUzg##^GeP19aGlWf837}|xpJyoIQ9z#kr zZ9NSk9L>V9lF`exTna%H*F@wn0g50P1y^9Ux!zqCqNrnh<71D{E&LQ#)P(d4+xsJ+ zGWowW$f834tlBsCN*N_f&muw!(30w+1OEVVhf=}xey}uyReh_I#|?>}{$2T^oR}}u z8)vu%QLTcvjty?JF)$sChb71j(d#9;M84&l7md(@Z0I@Us*#u|nY@t2)@xzxn?z~( z*;fUxzpHP$`OkVC|E08*5o08*3#fGI#c004XjwnzW~ z0NEGrh?*kxp0y+9ZrLcJ=_c{A?Nn8&$~JPD93*s%qjw1jRc^Toen@hN7>3|O$Z8H~ zb6nC+2*NI5k@Z~8ewjH%?#_3ciY)nllaEBv_@h2T%ALMNzhZRVD4jCbU~OY^;u7^P zlsOY?BH@?k%2ivxsmx2Ro+g zcv!z^&uS%NV`Kb5oo*7{qM0^xY-!ZE!B|Vll2%mKdjpabh8_gOW~Vwc^)G6gs`$w%sbv&2PTLU^#z*f;aP9v9a5Q-36=_Ax zBB|Cmu62yMr&(3ps%4z0vd0ssyM>h#D7uRr!X`O{M8ZBtpChKKqLI!oc_rtWJ$!yY z`BBMPdJe>#3M1Ad;7S5Ke!K_t0RI3`)v@t|o*YcK7 z3{;vfHF?h9b@S zOhp<%EX}1!nTWA^$YMwLNIwVG&aie#qBQ*Q)<!b}PjNZl1N*2fqQPftTdm5>t|bCAO<+r&08A(&&{7A-gQz@z zVbv^F=hs!z(y)6^BR*N&pOO>5lIg?J?Gj^OPJBOcyRZ03C2Kcqy<~Xwy?|{MWwY5W zjozvXbnuu~m2PtWrQ?sbzMA%7M;(*1%M)ZA5w-_NbJ4DIoDcNisU&-1jq*JEEd-xH zxNqH7;2-X@cDc_wyjfLQTJ6tU)>2hNC=4m^$^>0;nms~pgp!PCn1Bb5sDG}s4zjww z>2j&8asL1^LO}2XW{-eUQ#H+qIpg(?_K&IG9|3{zUV2G{gVH_>B8kWQ^rSq0@GiAQ z%x7`Sf6Y`Y2-$Ae?whU6wVZWbZ1t^ivdpFOHL(OtX0;k?DFXzHr57K*Y2sLv|5yZIfuxxj&fZDoF=X%p!A`M8**?i0kMD4Gk@}ik9C+2#%5% z+Qu|;4QRk0F1>k`1(Is56$ko}`gp!sdCkILXhmNYRTr1ZIO-{|s_7*}PT}>&rp*$G z+#+)cl#pPVMC1__&;c)Sh2}ohJ1Bf|)#{xwPF)+xeMLJ);GNwpKywG2k&VI2o3=pM z+Fw&QhC5}(OcAtiJiMCY{{Ynd4@FAx+z2+~;J}|B>YxYz09xg_w&VD%hPTEbx=2!G zkbKMv;Q&*I43!ZC*GvwvPEas;NkJ%hFnkXl2Ug07q=G>-M}DKDhTQ)EBhh)u8)a_` zzwo3UABs`6>r|MFfZ7sw8kKiHI0A zkm)^5cGH*2d;XcNjw;rSOB95LOw8oQ=8t$BWD)H(*l@vC+l9WGwusVJ#$3*h9NKyj z;C|!Cu7R+Q>2c0vaJ6IJB~r=JiKa6+@^R8BN|=X4tCCW<;6*en@Gg=!T5cP49EI?* zX&c77vqJWnVAj;p#}uNP_#67lXSi{L)W&uav%$^W4|%OCQ{8M;mbVv{@zI`A0k@;S zWceR~Dog8QD@1t%10BdjOvj!H8 zn#enGUCW6RxoF+Qt)~#CvZ8;&ZfQ3nj-S;V^#K~r6rxfT3P-)QI#yp!YP~5f2z^~E z3+R4jo=*MW2YmcZoYToiA#{0lIs3hTzs+;_l1nyJIRg(*z?aX`K0w6~9t1e@0vP-%$+$QOay~#ne#Qw8vhN+x7T?EUn> z!P_#t9O;|DeJ4LriO(JcJ_I#lo|%r~93VXWGwbK)^HMpa478Oep>HxS;}nZLg3HFc zZlhNXyQV5@w^V>d5Ll%jxd)FQKkckuqSHF>&e>s0;;Nxf}o(qsR{nf`Cy0 z_#d{dZ=SV|-e-?PkHZVtI5~Y{sEK$?qEZ1s3Q*&ufB+r}QQ!-}2fzlYNO8-t%|&hO zIf}2@!uxWbr?!fuCnR- zwxzk#+3eJgnz~nD4vigN_i}3+&CWXyGk}Y*{g~|rp|nhA`?DJ18x8KpX3}{Q?d`h< zoRvi*6})s}N9tLXY7nZOHfR_`#uFW7KZvP-JL|KK&u!hGS$?Ghgttks>WQ&}_YO^O zQ5!Nt8|GYhaZpnWTMZLLO%Z9$#AL-V#stk7X$Ff(JI46B^>vSpZiDua?M9QwY&OS#(TjNAc5i~^66GTlBMZMST-vIAN9-kfOYGM#BL8zLM~A^J^Mdd;Vtv*$lkvvGx=p&%e(nV}yO4-p#OHjE>qn6@Hq+OufcB9Me3K&2>aq2Y!qc%y;{ z!y#isTF@{68vqAD0)qQ`^hD7YiDi*&imn_gk`2&FMVDP=3X&+IkwogMs;3f>G?O7j zOkofJ0OWNCIjw1Phz$cIo;k?eA!oG~P`~71TY$FvU3k01nLqcN;&B zp}ItShe;6XD~XZ_7pwSe%qB1{9O2qWYfOAqHccs1d!d%iRKxHwzTA0Pq2>M7&hE$CI%+I2{K; z^Xtr$le!hXjQU#M1%qG1t1vZ)WIjYaKO`k=!qlfq)OQ696B603L->&ffL$LH0Am??K3X zPCfvxFfsgNgQwX+x~?3$=}iO?OzN)XQym~GNFtaSRg^zh08)U6kH)#0=I2Q(19Eb3 zG1s3Us=~bulzL9?hjA}r=dAVFJS&Ws22LE@uaK^z7oK{POKD3!khU_}XoH2E z-t)WUb}_{Fbv^@N(X&7b3PNinM9~vORjs+7O*~PXBwt-9PKk;#6U7eg`th;kbx^Ur zF@;mOnSe<~#$x%(pXNGbbi~8S)Jap1I?~$bv0E0Yl6#G+U#MOmlH%6pDI9vfF^(4= zu3;JGTH>2@Qg?~ax4oy zqty0lz%f=Mf9${6`~B1NTB%C)f)VOX<>02GT@Y45cG7Wg**aNRa7%YD^B6;a|rl20RAHjLv!?>K0Wc|Z=r*kZb-5BTX zRhBHHLbWlB(5##_I5|ko%yAUNf(9o(IM4nRZZc?^DJVvpGW&&TKcP9`>w(HMt>z?7~1o`xCD}Ql(7wN z@dg|!^Y9x5UJCewaSyEQ6`a&cIGl&SEH$`=sCN( znh2_Z>RQIh+`Nz2_6g<079U$lq^2db7bzl_rxRZ2^X5q69=rM}ll$u%`<46i_-&W) z{{X_j6#O6ea##1Oo;rUG{oD5c0EzxB?mvau==}bAx<0LLuhW#@p#K0*eO9aL{nsCN z+{xen00(o!$KGez;m1C_JFI8wulm>3JIMI>vBktVJ$SQ>V|@O5EW=loOqwESiJ~as zxU8dcszI~I_-3(Nzvt|blbGy%QMa!33N%b=O0{if$vIKXSrn0DjHwJ>g09m?q13~} zwu)$Cx_X(@5C|ZRkydu-y#+RJxQR!%Dv>5O^N?kK#LK(IY~zC;Ny;oDtJmsdX<%7| zXgF|jFee)Afj|f9>M)6i1H5*9X1YE}soeTm-MQewVLl~?Z|N;wecO3~g-W?|_HK7| zPCKXgcP3&Cy1_FXTSZ8^na37&(g6V>0U1V<6~I*C@FtW@pkVzqudBN)zD6DOTBs*) zLAxFDAh-R>JS25c;=$<~>Q6xA(%V_L%_31Td$g+!7VHNC59TXs-KG2R1AK?@b%j^< zd#fPH{R<<#SO*O6u*M=Q|wQx5q~p5iNqz4aSTTCEDl-V~idx2oqiOUXF+$5@U$b4o#Ioy!*_|Pa!%E8 zhvkw6?J5G=^OG*SA1E6J?kE!mT#dxm{TZZUN2Aj*dH#suE=HikpiB#K1oY5ci0PI( z&!mZ*0qwlAu~3wexMliuc9$6&_lNs;SH2w_MUPq>5I@p}r2iC9;i%|mToQEE)}LL> z{gSbg#k=OvSSe#}l(?c2O1bg+X}E_%%>{3DgO5|wd5l@wDJem9C-W z%u0@AoNtiQg-`wN`-btohdFOu2#Fd6Yph>3*Irik{H%D)|6>6Dqc+hAFM~xjopiZ~ z6Zuy#hC5Rw=cx@69rFmer6zuf166sAfZc^dmwFe0T(pnfZvYxUtl#z+JgoO%_4Tei zPBcIkZX!5DZU=x1Uxxp`MSj<{j6H$^g2cc^1TcFmL0SvW5F+07Vc$1I|EX1M<5I~c zOKkwxlLE8apYf3|n-uFe$l)VEGgBGbl=?u%8CM|y=;d`O<6wEw0ZaRW632UFRE5Qk zStHVBl!{E|g){fO^Jp1~h1D<+#)Zv*3)MRri5MznVw6s2-B49KR(5(R_uR*=nd)Z` zCVIO~O{%=;syM|g(W)+V##-E-PjD{t=w$ZUnVvopnsrQPcr@7h@H}#m7zvPqLHUq_ ziszhgN;X)*^rlpvFkcTez0|$^Vdk?ffrJ6(RPX>yZ!H;;SS>pfn5MtCx#fsarNG1buKAud6v|cKXW-?sRiPvCW;UbGPQxNe$P49>0Pn%qM6mOxk z=jiuQ@K?Y9eMx^IGb2sF-JYriZO_GKTkX;t(n>L+qv%)n7*t!}j+hBH={d72QyL8V z{5&Ydxth{&tRv@!Cv|TUkYFdzbJypLHcH1CJ7`>rFXlU^HPgH3Y%uz@)VmK0XhuZx z<*u``+22x|;FbH?`-V0?7%7g&a1&|tf^pm`SO7poeV`puMqdnh`N3`Qh;LD<8u#AA zKJ~}@gt@~bPtk)cO^KfLL`mGJ0&CG`^MGE>*TchWIZSMcwYKOKFl7uK&T@*iWM$7> z|JBwa+cTwzXyyKJ6*>H1FP9D}`PC@)X%S&eA-7!v^6fWZ>ekJ(WbbO3y}B@Y<=5=} zd;55EeHeP7KG8^c$N}T{N#Ki*(4P@*kXF{fHH)5|vMgN5gt-+w;iZt0t4Z50hN{_n z*601lNN5@Tn_5KFGRKndR6tUf#)K4dBG{xMkDa#&*F^~KI>y!?S886h$Fy@F1)||M zkDy}ioyx{}s(NLfHDv;#lOwc;&<5o|ij}f70EHE)M9IYs9w^;mOij4wsa-0e0(dOu>!FIli#Y!1 z@BtdqFp9`M_87wkju5u@11fNiSg1NO4Fk3PuT2LM2X$8Hgz}0?gP6Lgp)F(prg>xI zxhZ1l)=gH^E0B#B)sC?ua$T^Zu;?0~LkiI8xy7n>3hh@xhmKi-yuYzn#-<|V5Av!M z_cWR_@@G=i9UoZz6OddsDqZTBB-r=~^6DuvTUMVMj&n*N>jDa~=y&nuU7;f8ScNH!SmyER%8-{JBT*!p|pTzs`{QGiX zMG_gtq~+H<4>Ha@_pC}Lgw6dDcN6_?nl!A*e4@8JguC4fZ3DB^A2jXDNh99z@PH1V z9^0KRTDNK>64Onfh^tqb?>~>L>e9wPkB&;Pzce{XV88cwnY~OLxj4HEs6Y}{(k@Xf zNEyJTwv6ubvrEuf*gu7?nIx;xU`Cr;?vk(h-;ay~$)9Q2wji&+qRuP(mG-RX4S5h_ z^w9*m<)rF!_}$0DoiFu4Qu5R!?TD5KGsCdXan&GS<(egnOCB&JL$_1kWWh0R@P_DX zDGP1w&QDydpZw~AxCZ(L<$T{Z>@Ww46hLq-*S2=2-F^3*@Vj4@h7`2e>C&x17Fz*I z2mw~O>y2%~y}gf%iqPK1JOnpU3eIWor)Gk;e;#lNxD%dfXy*H6^@8YlW)JnAFh+N5(#|3=hNrH74MbL&Aeib49i;M9sr12*wrU@&+0&T-_T!-pX z%fw1?=n8|JD6S+FY;yo8hOoSH*jX*1Y$317AlRo<$jzt=^~ci5z8$xe_IjXg@_k8e z!tpg7Xl5N}@FTTfqP>q_gbJTrRX~>gX;0~p*#kX!^=C9W=eFUHGIuy*@vIU)vtf;) zq}Z1j#G=nAI9vPL=EFIpRe0VM^53KtPf_{Jpp9mUrZKbHFJ|jiOcop-IkM8kqRDC9 z9`LDf;r*(QTG`C2l^-&<$YY^~4uOEkOu6bdz3G!{@DjCZ4_6+iTX^HKNE9HzX3~&` zji*m0M38&rt=rNMi4)$#qE!*8CN;{H=&&_GDl-d0DIqc~d^vHSc74cgPB%HbZgK0# zd;vWj6r66N>ur^-Q?$hN2k)wTZUu~-EJp90z})czoR8cGv%*@l#t>!7jzmYU^NB~1 z4=JiPhIsXyTTeYp;yY7XWyS)1g-!tqww$J7{bgpjpcDw*FPdw7oIx0nu$4pom zaRsk%=|FM+aWja1l%BAGmU3{MilbO zErTICYvcPN3a~+cqmOveU!>}y;;9qW8ww&kccS~U%(vM5NBJi~*|*czGgG&?%p(*l z9YnHW#_9>BMcK=U3S7Vt7t0LKYd6A2;$5OMgYWgPumJ@rZ*qvO>iy0;OV$7gHH!G;0 zVQM&&ve-CMV2GobJhL2ZM@DvfDe<+JjF0)w^)tPTDTFJ!J#q(;W>}Vh73luKo3|2? z9;pWS_|=Xv_ju;j0`D}U;WywBq#`+fd6*vai9%$Gl8TNy6T`Q?NA@JM;KB6n+B${V zR84cNf@_2>S9Ry&ByCX=gj#e^vV|PWT|hxpdL40X(s<+IH^BC;nrhCDH!Q5+Wn1vl zKmd^x)sEsHth2BvX!6${arulb=^-y6k6mpHxyXFplY;bHqGDL-;=AL@3vl=3)HB|W z8<)!<2<0(dJ?P~MCkgZ-5^tqWvSiun?PO08IK3)r+1oQJyiLZu=u$I$EL_0FQz!u7 z`|RrS^{P8oHz>7)NJ%#Ynps&iH1xfTc76kD+qBce@7?dsy8ncRKl!ZG$Z)r0+4nbq z=sR>S;d8Gb_q2}g{SgW1F8AqWF|wjhxUs|`5yoXz3M4PSfMF~&-;7*gRZ(rtmyh<& zsscE0=sIP9Drc>P6?CIxnpC^@!xUI-4;~BpeETx+UG$qut`Isu#qNt@*^buT4YADo zQuV&u@{>4`mSPumlJ?XmGR%v)gbdF;INL6B*bb(*%s@N=+5lF7`Wq1z=lHFyH%zb| zEIFj)c2g}^;pun>up=iDdPlTIK?^RVaY1>eAq!94{7aNew4B#s$$Z=Y@IW~EdK$edc&)T>ostG++D)Zz z_`CqzDLAG`&e&DPJD@W)%y~6@R%wrBvijj^+)+!b*0bI#2CcB!)lwXEWLuX*i};30 zN%Llk4ffQn-9U;l@|uUoyt8%i_Qt5;7Su((Hdf)x_J?z5zy5;JHcC?khCPF@%bhEj zLLt-@-j}G-E@G7H*TYQ+*(DuvTYH@fZO?Ri2B5KYBBAwCiSF{r=aXw+lg*vPi{sB> zUf08ki?;$9NPPt*)?=F-TkU4qc&@~Hq=ZAwc!L8fJgOsQm9Jz=PSU@VI1EMh-TVa8VS_{$IUS8&F)atk`^n3!-`R*%ac z>LIL(qT*`{AX1?dhL1{sj;u0{lF6iR2%7KYD{Cj0CztmJS)>|mXJf}*S-1gLFJa=- z<n`K7Bm>;=~qxqH5ANGM_`Li*J{i_gQ?z+;6$!h;qu1E~UcnU%o!IDw-0i6koN( zj`A;Rt1{dTG!fJ6&O9?^`KY3f*%06Np0=E4pL}S_4!z!b_X2N`Z;q)RvO@73{aLO5 o*^l@KiLVu39we%YkU9jx8~%ww|L*+%f9}89cYmM6li!Q~0sWHz(EtDd literal 0 HcmV?d00001 diff --git a/node_modules/request/tests/run.js b/node_modules/request/tests/run.js new file mode 100644 index 0000000..538a65c --- /dev/null +++ b/node_modules/request/tests/run.js @@ -0,0 +1,45 @@ +var spawn = require('child_process').spawn + , exitCode = 0 + ; + +var tests = [ + 'test-body.js' + , 'test-cookie.js' + , 'test-cookiejar.js' + , 'test-defaults.js' + , 'test-errors.js' + , 'test-form.js' + , 'test-follow-all-303.js' + , 'test-follow-all.js' + , 'test-headers.js' + , 'test-httpModule.js' + , 'test-https.js' + , 'test-https-strict.js' + , 'test-oauth.js' + , 'test-params.js' + , 'test-pipes.js' + , 'test-pool.js' + , 'test-protocol-changing-redirect.js' + , 'test-proxy.js' + , 'test-piped-redirect.js' + , 'test-qs.js' + , 'test-redirect.js' + , 'test-timeout.js' + , 'test-toJSON.js' + , 'test-tunnel.js' +] + +var next = function () { + if (tests.length === 0) process.exit(exitCode); + + var file = tests.shift() + console.log(file) + var proc = spawn('node', [ 'tests/' + file ]) + proc.stdout.pipe(process.stdout) + proc.stderr.pipe(process.stderr) + proc.on('exit', function (code) { + exitCode += code || 0 + next() + }) +} +next() diff --git a/node_modules/request/tests/server.js b/node_modules/request/tests/server.js new file mode 100644 index 0000000..b6eacba --- /dev/null +++ b/node_modules/request/tests/server.js @@ -0,0 +1,90 @@ +var fs = require('fs') + , http = require('http') + , path = require('path') + , https = require('https') + , events = require('events') + , stream = require('stream') + , assert = require('assert') + ; + +exports.createServer = function (port) { + port = port || 6767 + var s = http.createServer(function (req, resp) { + s.emit(req.url, req, resp); + }) + s.port = port + s.url = 'http://localhost/'+port + return s; +} + +exports.createSSLServer = function(port, opts) { + port = port || 16767 + + var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') + , 'cert': path.join(__dirname, 'ssl', 'test.crt') + } + if (opts) { + for (var i in opts) options[i] = opts[i] + } + + for (var i in options) { + options[i] = fs.readFileSync(options[i]) + } + + var s = https.createServer(options, function (req, resp) { + s.emit(req.url, req, resp); + }) + s.port = port + s.url = 'https://localhost/'+port + return s; +} + +exports.createPostStream = function (text) { + var postStream = new stream.Stream(); + postStream.writeable = true; + postStream.readable = true; + setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); + return postStream; +} +exports.createPostValidator = function (text, reqContentType) { + var l = function (req, resp) { + var r = ''; + req.on('data', function (chunk) {r += chunk}) + req.on('end', function () { + if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) { + var boundary = req.headers['content-type'].split('boundary=')[1]; + text = text.replace(/__BOUNDARY__/g, boundary); + } + if (r !== text) console.log(r, text); + assert.equal(r, text) + if (reqContentType) { + assert.ok(req.headers['content-type']) + assert.ok(~req.headers['content-type'].indexOf(reqContentType)) + } + resp.writeHead(200, {'content-type':'text/plain'}) + resp.write('OK') + resp.end() + }) + } + return l; +} +exports.createGetResponse = function (text, contentType) { + var l = function (req, resp) { + contentType = contentType || 'text/plain' + resp.writeHead(200, {'content-type':contentType}) + resp.write(text) + resp.end() + } + return l; +} +exports.createChunkResponse = function (chunks, contentType) { + var l = function (req, resp) { + contentType = contentType || 'text/plain' + resp.writeHead(200, {'content-type':contentType}) + chunks.forEach(function (chunk) { + resp.write(chunk) + }) + resp.end() + } + return l; +} diff --git a/node_modules/request/tests/squid.conf b/node_modules/request/tests/squid.conf new file mode 100644 index 0000000..0d4a3b6 --- /dev/null +++ b/node_modules/request/tests/squid.conf @@ -0,0 +1,77 @@ +# +# Recommended minimum configuration: +# +acl manager proto cache_object +acl localhost src 127.0.0.1/32 ::1 +acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 + +# Example rule allowing access from your local networks. +# Adapt to list your (internal) IP networks from where browsing +# should be allowed +acl localnet src 10.0.0.0/8 # RFC1918 possible internal network +acl localnet src 172.16.0.0/12 # RFC1918 possible internal network +acl localnet src 192.168.0.0/16 # RFC1918 possible internal network +acl localnet src fc00::/7 # RFC 4193 local private network range +acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines + +acl SSL_ports port 443 +acl Safe_ports port 80 # http +acl Safe_ports port 21 # ftp +acl Safe_ports port 443 # https +acl Safe_ports port 70 # gopher +acl Safe_ports port 210 # wais +acl Safe_ports port 1025-65535 # unregistered ports +acl Safe_ports port 280 # http-mgmt +acl Safe_ports port 488 # gss-http +acl Safe_ports port 591 # filemaker +acl Safe_ports port 777 # multiling http +acl CONNECT method CONNECT + +# +# Recommended minimum Access Permission configuration: +# +# Only allow cachemgr access from localhost +http_access allow manager localhost +http_access deny manager + +# Deny requests to certain unsafe ports +http_access deny !Safe_ports + +# Deny CONNECT to other than secure SSL ports +#http_access deny CONNECT !SSL_ports + +# We strongly recommend the following be uncommented to protect innocent +# web applications running on the proxy server who think the only +# one who can access services on "localhost" is a local user +#http_access deny to_localhost + +# +# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS +# + +# Example rule allowing access from your local networks. +# Adapt localnet in the ACL section to list your (internal) IP networks +# from where browsing should be allowed +http_access allow localnet +http_access allow localhost + +# And finally deny all other access to this proxy +http_access deny all + +# Squid normally listens to port 3128 +http_port 3128 + +# We recommend you to use at least the following line. +hierarchy_stoplist cgi-bin ? + +# Uncomment and adjust the following to add a disk cache directory. +#cache_dir ufs /usr/local/var/cache 100 16 256 + +# Leave coredumps in the first cache dir +coredump_dir /usr/local/var/cache + +# Add any of your own refresh_pattern entries above these. +refresh_pattern ^ftp: 1440 20% 10080 +refresh_pattern ^gopher: 1440 0% 1440 +refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 +refresh_pattern . 0 20% 4320 diff --git a/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/request/tests/ssl/ca/ca.cnf new file mode 100644 index 0000000..425a889 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/ca.cnf @@ -0,0 +1,20 @@ +[ req ] +default_bits = 1024 +days = 3650 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no +output_password = password + +[ req_distinguished_name ] +C = US +ST = CA +L = Oakland +O = request +OU = request Certificate Authority +CN = requestCA +emailAddress = mikeal@mikealrogers.com + +[ req_attributes ] +challengePassword = password challenge + diff --git a/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/request/tests/ssl/ca/ca.crl new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/request/tests/ssl/ca/ca.crt new file mode 100644 index 0000000..b4524e4 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/ca.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 +ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG +A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n +ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD +VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT +B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl +YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 +5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ +5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD +xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB +ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm +D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo +88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj +-----END CERTIFICATE----- diff --git a/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/request/tests/ssl/ca/ca.csr new file mode 100644 index 0000000..e48c56e --- /dev/null +++ b/node_modules/request/tests/ssl/ca/ca.csr @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE +BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD +ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG +SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB +BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 +deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br +44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB +AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 +DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj +bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia +SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X +-----END CERTIFICATE REQUEST----- diff --git a/node_modules/request/tests/ssl/ca/ca.key b/node_modules/request/tests/ssl/ca/ca.key new file mode 100644 index 0000000..a53e7f7 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/ca.key @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,C8B5887048377F02 + +nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q +nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ +GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH +gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 +VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 +/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb +4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U +gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR +Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh +FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf +dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC +uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb +EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/request/tests/ssl/ca/ca.srl new file mode 100644 index 0000000..17128db --- /dev/null +++ b/node_modules/request/tests/ssl/ca/ca.srl @@ -0,0 +1 @@ +ADF62016AA40C9C3 diff --git a/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/request/tests/ssl/ca/server.cnf new file mode 100644 index 0000000..cd1fd1e --- /dev/null +++ b/node_modules/request/tests/ssl/ca/server.cnf @@ -0,0 +1,19 @@ +[ req ] +default_bits = 1024 +days = 3650 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no + +[ req_distinguished_name ] +C = US +ST = CA +L = Oakland +O = request +OU = testing +CN = testing.request.mikealrogers.com +emailAddress = mikeal@mikealrogers.com + +[ req_attributes ] +challengePassword = password challenge + diff --git a/node_modules/request/tests/ssl/ca/server.crt b/node_modules/request/tests/ssl/ca/server.crt new file mode 100644 index 0000000..efe96ce --- /dev/null +++ b/node_modules/request/tests/ssl/ca/server.crt @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 +ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG +A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n +ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD +VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT +B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx +dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr +ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM +20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh +DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj +7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB +kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC +yapjN3RxZbInGhWR+jA= +-----END CERTIFICATE----- diff --git a/node_modules/request/tests/ssl/ca/server.csr b/node_modules/request/tests/ssl/ca/server.csr new file mode 100644 index 0000000..a8e7595 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/server.csr @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE +BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp +MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq +hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB +BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg +cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU +ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw +7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A +HidVJ/3u +-----END CERTIFICATE REQUEST----- diff --git a/node_modules/request/tests/ssl/ca/server.js b/node_modules/request/tests/ssl/ca/server.js new file mode 100644 index 0000000..05e21c1 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/server.js @@ -0,0 +1,28 @@ +var fs = require("fs") +var https = require("https") +var options = { key: fs.readFileSync("./server.key") + , cert: fs.readFileSync("./server.crt") } + +var server = https.createServer(options, function (req, res) { + res.writeHead(200) + res.end() + server.close() +}) +server.listen(1337) + +var ca = fs.readFileSync("./ca.crt") +var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) + +https.request({ host: "localhost" + , method: "HEAD" + , port: 1337 + , headers: { host: "testing.request.mikealrogers.com" } + , agent: agent + , ca: [ ca ] + , path: "/" }, function (res) { + if (res.client.authorized) { + console.log("node test: OK") + } else { + throw new Error(res.client.authorizationError) + } +}).end() diff --git a/node_modules/request/tests/ssl/ca/server.key b/node_modules/request/tests/ssl/ca/server.key new file mode 100644 index 0000000..72d8698 --- /dev/null +++ b/node_modules/request/tests/ssl/ca/server.key @@ -0,0 +1,9 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg +cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB +iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW +gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 +JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ +rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ +0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/request/tests/ssl/npm-ca.crt new file mode 100644 index 0000000..fde2fe9 --- /dev/null +++ b/node_modules/request/tests/ssl/npm-ca.crt @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x +IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w +bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y +MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV +BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj +YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA +aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE +OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz +Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl +y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC +l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv +yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl +ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op +-----END CERTIFICATE----- diff --git a/node_modules/request/tests/ssl/test.crt b/node_modules/request/tests/ssl/test.crt new file mode 100644 index 0000000..b357f86 --- /dev/null +++ b/node_modules/request/tests/ssl/test.crt @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU +SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo +ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx +MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV +BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz +dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto +wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj +eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC +AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV +l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 +L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE +c7U8F6MWLQ== +-----END CERTIFICATE----- diff --git a/node_modules/request/tests/ssl/test.key b/node_modules/request/tests/ssl/test.key new file mode 100644 index 0000000..b85810d --- /dev/null +++ b/node_modules/request/tests/ssl/test.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt +NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE +mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB +AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt +Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ +fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb +rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 +V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF ++WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb +G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf +Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ +fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w +kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/request/tests/test-body.js b/node_modules/request/tests/test-body.js new file mode 100644 index 0000000..a624397 --- /dev/null +++ b/node_modules/request/tests/test-body.js @@ -0,0 +1,117 @@ +var server = require('./server') + , events = require('events') + , stream = require('stream') + , assert = require('assert') + , request = require('../main.js') + ; + +var s = server.createServer(); + +var tests = + { testGet : + { resp : server.createGetResponse("TESTING!") + , expectBody: "TESTING!" + } + , testGetChunkBreak : + { resp : server.createChunkResponse( + [ new Buffer([239]) + , new Buffer([163]) + , new Buffer([191]) + , new Buffer([206]) + , new Buffer([169]) + , new Buffer([226]) + , new Buffer([152]) + , new Buffer([131]) + ]) + , expectBody: "Ω☃" + } + , testGetBuffer : + { resp : server.createGetResponse(new Buffer("TESTING!")) + , encoding: null + , expectBody: new Buffer("TESTING!") + } + , testGetEncoding : + { resp : server.createGetResponse(new Buffer('efa3bfcea9e29883', 'hex')) + , encoding: 'hex' + , expectBody: "efa3bfcea9e29883" + } + , testGetJSON : + { resp : server.createGetResponse('{"test":true}', 'application/json') + , json : true + , expectBody: {"test":true} + } + , testPutString : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : "PUTTINGDATA" + } + , testPutBuffer : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : new Buffer("PUTTINGDATA") + } + , testPutJSON : + { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) + , method: "PUT" + , json: {foo: 'bar'} + } + , testPutMultipart : + { resp: server.createPostValidator( + '--__BOUNDARY__\r\n' + + 'content-type: text/html\r\n' + + '\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__\r\n\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__--' + ) + , method: "PUT" + , multipart: + [ {'content-type': 'text/html', 'body': 'Oh hi.'} + , {'body': 'Oh hi.'} + ] + } + , testPutMultipartPreambleCRLF : + { resp: server.createPostValidator( + '\r\n--__BOUNDARY__\r\n' + + 'content-type: text/html\r\n' + + '\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__\r\n\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__--' + ) + , method: "PUT" + , preambleCRLF: true + , multipart: + [ {'content-type': 'text/html', 'body': 'Oh hi.'} + , {'body': 'Oh hi.'} + ] + } + } + +s.listen(s.port, function () { + + var counter = 0 + + for (i in tests) { + (function () { + var test = tests[i] + s.on('/'+i, test.resp) + test.uri = s.url + '/' + i + request(test, function (err, resp, body) { + if (err) throw err + if (test.expectBody) { + assert.deepEqual(test.expectBody, body) + } + counter = counter - 1; + if (counter === 0) { + console.log(Object.keys(tests).length+" tests passed.") + s.close() + } + }) + counter++ + })() + } +}) + diff --git a/node_modules/request/tests/test-cookie.js b/node_modules/request/tests/test-cookie.js new file mode 100644 index 0000000..6c6a7a7 --- /dev/null +++ b/node_modules/request/tests/test-cookie.js @@ -0,0 +1,29 @@ +var Cookie = require('../vendor/cookie') + , assert = require('assert'); + +var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT'; +var cookie = new Cookie(str); + +// test .toString() +assert.equal(cookie.toString(), str); + +// test .path +assert.equal(cookie.path, '/'); + +// test .httpOnly +assert.equal(cookie.httpOnly, true); + +// test .name +assert.equal(cookie.name, 'Sid'); + +// test .value +assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); + +// test .expires +assert.equal(cookie.expires instanceof Date, true); + +// test .path default +var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); +assert.equal(cookie.path, '/bar'); + +console.log('All tests passed'); diff --git a/node_modules/request/tests/test-cookiejar.js b/node_modules/request/tests/test-cookiejar.js new file mode 100644 index 0000000..76fcd71 --- /dev/null +++ b/node_modules/request/tests/test-cookiejar.js @@ -0,0 +1,90 @@ +var Cookie = require('../vendor/cookie') + , Jar = require('../vendor/cookie/jar') + , assert = require('assert'); + +function expires(ms) { + return new Date(Date.now() + ms).toUTCString(); +} + +// test .get() expiration +(function() { + var jar = new Jar; + var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); + jar.add(cookie); + setTimeout(function(){ + var cookies = jar.get({ url: 'http://foo.com/foo' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], cookie); + setTimeout(function(){ + var cookies = jar.get({ url: 'http://foo.com/foo' }); + assert.equal(cookies.length, 0); + }, 1000); + }, 5); +})(); + +// test .get() path support +(function() { + var jar = new Jar; + var a = new Cookie('sid=1234; path=/'); + var b = new Cookie('sid=1111; path=/foo/bar'); + var c = new Cookie('sid=2222; path=/'); + jar.add(a); + jar.add(b); + jar.add(c); + + // should remove the duplicates + assert.equal(jar.cookies.length, 2); + + // same name, same path, latter prevails + var cookies = jar.get({ url: 'http://foo.com/' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], c); + + // same name, diff path, path specifity prevails, latter prevails + var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], b); + + var jar = new Jar; + var a = new Cookie('sid=1111; path=/foo/bar'); + var b = new Cookie('sid=1234; path=/'); + jar.add(a); + jar.add(b); + + var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], a); + + var cookies = jar.get({ url: 'http://foo.com/' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], b); + + var jar = new Jar; + var a = new Cookie('sid=1111; path=/foo/bar'); + var b = new Cookie('sid=3333; path=/foo/bar'); + var c = new Cookie('pid=3333; path=/foo/bar'); + var d = new Cookie('sid=2222; path=/foo/'); + var e = new Cookie('sid=1234; path=/'); + jar.add(a); + jar.add(b); + jar.add(c); + jar.add(d); + jar.add(e); + + var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); + assert.equal(cookies.length, 2); + assert.equal(cookies[0], b); + assert.equal(cookies[1], c); + + var cookies = jar.get({ url: 'http://foo.com/foo/' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], d); + + var cookies = jar.get({ url: 'http://foo.com/' }); + assert.equal(cookies.length, 1); + assert.equal(cookies[0], e); +})(); + +setTimeout(function() { + console.log('All tests passed'); +}, 1200); diff --git a/node_modules/request/tests/test-defaults.js b/node_modules/request/tests/test-defaults.js new file mode 100644 index 0000000..ba09418 --- /dev/null +++ b/node_modules/request/tests/test-defaults.js @@ -0,0 +1,114 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + ; + +var s = server.createServer(); + +s.listen(s.port, function () { + var counter = 0; + s.on('/get', function (req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.method, 'GET') + resp.writeHead(200, {'Content-Type': 'text/plain'}); + resp.end('TESTING!'); + }); + + // test get(string, function) + request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ + if (e) throw e; + assert.deepEqual("TESTING!", b); + counter += 1; + }); + + s.on('/post', function (req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.headers['content-type'], null); + assert.equal(req.method, 'POST') + resp.writeHead(200, {'Content-Type': 'application/json'}); + resp.end(JSON.stringify({foo:'bar'})); + }); + + // test post(string, object, function) + request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ + if (e) throw e; + assert.deepEqual('bar', b.foo); + counter += 1; + }); + + s.on('/post-body', function (req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.headers['content-type'], 'application/json'); + assert.equal(req.method, 'POST') + resp.writeHead(200, {'Content-Type': 'application/json'}); + resp.end(JSON.stringify({foo:'bar'})); + }); + + // test post(string, object, function) with body + request.defaults({headers:{foo:"bar"}}).post(s.url + '/post-body', {json: true, body:{bar:"baz"}}, function (e, r, b){ + if (e) throw e; + assert.deepEqual('bar', b.foo); + counter += 1; + }); + + s.on('/del', function (req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.method, 'DELETE') + resp.writeHead(200, {'Content-Type': 'application/json'}); + resp.end(JSON.stringify({foo:'bar'})); + }); + + // test .del(string, function) + request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ + if (e) throw e; + assert.deepEqual('bar', b.foo); + counter += 1; + }); + + s.on('/head', function (req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.method, 'HEAD') + resp.writeHead(200, {'Content-Type': 'text/plain'}); + resp.end(); + }); + + // test head.(object, function) + request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ + if (e) throw e; + counter += 1; + }); + + s.on('/get_custom', function(req, resp) { + assert.equal(req.headers.foo, 'bar'); + assert.equal(req.headers.x, 'y'); + resp.writeHead(200, {'Content-Type': 'text/plain'}); + resp.end(); + }); + + // test custom request handler function + var defaultRequest = request.defaults({ + headers:{foo:"bar"} + , body: 'TESTING!' + }, function(uri, options, callback) { + var params = request.initParams(uri, options, callback); + options = params.options; + options.headers.x = 'y'; + + return request(params.uri, params.options, params.callback); + }); + + var msg = 'defaults test failed. head request should throw earlier'; + assert.throws(function() { + defaultRequest.head(s.url + '/get_custom', function(e, r, b) { + throw new Error(msg); + }); + counter+=1; + }, msg); + + defaultRequest.get(s.url + '/get_custom', function(e, r, b) { + if(e) throw e; + counter += 1; + console.log(counter.toString() + " tests passed."); + s.close(); + }); +}) diff --git a/node_modules/request/tests/test-errors.js b/node_modules/request/tests/test-errors.js new file mode 100644 index 0000000..1986a59 --- /dev/null +++ b/node_modules/request/tests/test-errors.js @@ -0,0 +1,37 @@ +var server = require('./server') + , events = require('events') + , assert = require('assert') + , request = require('../main.js') + ; + +var local = 'http://localhost:8888/asdf' + +try { + request({uri:local, body:{}}) + assert.fail("Should have throw") +} catch(e) { + assert.equal(e.message, 'Argument error, options.body.') +} + +try { + request({uri:local, multipart: 'foo'}) + assert.fail("Should have throw") +} catch(e) { + assert.equal(e.message, 'Argument error, options.multipart.') +} + +try { + request({uri:local, multipart: [{}]}) + assert.fail("Should have throw") +} catch(e) { + assert.equal(e.message, 'Body attribute missing in multipart.') +} + +try { + request(local, {multipart: [{}]}) + assert.fail("Should have throw") +} catch(e) { + assert.equal(e.message, 'Body attribute missing in multipart.') +} + +console.log("All tests passed.") diff --git a/node_modules/request/tests/test-follow-all-303.js b/node_modules/request/tests/test-follow-all-303.js new file mode 100644 index 0000000..3f2162d --- /dev/null +++ b/node_modules/request/tests/test-follow-all-303.js @@ -0,0 +1,30 @@ +var request = require('../main'); +var http = require('http'); +var requests = 0; +var assert = require('assert'); + +var server = http.createServer(function (req, res) { + console.error(req.method, req.url); + requests ++; + + if (req.method === 'POST') { + console.error('send 303'); + res.setHeader('location', req.url); + res.statusCode = 303; + res.end('try again, i guess\n'); + } else { + console.error('send 200') + res.end('ok: ' + requests); + } +}); +server.listen(6767); + +request.post({ url: 'http://localhost:6767/foo', + followAllRedirects: true, + form: { foo: 'bar' } }, function (er, req, body) { + if (er) throw er; + assert.equal(body, 'ok: 2'); + assert.equal(requests, 2); + console.error('ok - ' + process.version); + server.close(); +}); diff --git a/node_modules/request/tests/test-follow-all.js b/node_modules/request/tests/test-follow-all.js new file mode 100644 index 0000000..b78745b --- /dev/null +++ b/node_modules/request/tests/test-follow-all.js @@ -0,0 +1,35 @@ +var request = require('../main'); +var http = require('http'); +var requests = 0; +var assert = require('assert'); + +var server = http.createServer(function (req, res) { + requests ++; + + // redirect everything 3 times, no matter what. + var c = req.headers.cookie; + + if (!c) c = 0; + else c = +c.split('=')[1] || 0; + + if (c > 3) { + res.end('ok: '+requests); + return; + } + + res.setHeader('set-cookie', 'c=' + (c + 1)); + res.setHeader('location', req.url); + res.statusCode = 302; + res.end('try again, i guess\n'); +}); +server.listen(6767); + +request.post({ url: 'http://localhost:6767/foo', + followAllRedirects: true, + form: { foo: 'bar' } }, function (er, req, body) { + if (er) throw er; + assert.equal(body, 'ok: 5'); + assert.equal(requests, 5); + console.error('ok - ' + process.version); + server.close(); +}); diff --git a/node_modules/request/tests/test-form.js b/node_modules/request/tests/test-form.js new file mode 100644 index 0000000..aeefd31 --- /dev/null +++ b/node_modules/request/tests/test-form.js @@ -0,0 +1,79 @@ +var assert = require('assert') +var http = require('http'); +var path = require('path'); +var mime = require('mime'); +var request = require('../main.js'); +var fs = require('fs'); + +var remoteFile = 'http://nodejs.org/images/logo.png'; + +var FIELDS = [ + {name: 'my_field', value: 'my_value'}, + {name: 'my_buffer', value: new Buffer([1, 2, 3])}, + {name: 'my_file', value: fs.createReadStream(__dirname + '/unicycle.jpg')}, + {name: 'remote_file', value: request(remoteFile) } +]; + +var server = http.createServer(function(req, res) { + + // temp workaround + var data = ''; + req.setEncoding('utf8'); + + req.on('data', function(d) { + data += d; + }); + + req.on('end', function() { + // check for the fields' traces + + // 1st field : my_field + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 2nd field : my_buffer + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf(field.value) != -1 ); + + // 3rd field : my_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for unicycle.jpg traces + assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); + + // 4th field : remote_file + var field = FIELDS.shift(); + assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); + assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); + // check for http://nodejs.org/images/logo.png traces + assert.ok( data.indexOf('ImageReady') != -1 ); + assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); + + res.writeHead(200); + res.end('done'); + + }); + + +}); + +server.listen(8080, function() { + + var req = request.post('http://localhost:8080/upload', function () { + server.close(); + }) + var form = req.form() + + FIELDS.forEach(function(field) { + form.append(field.name, field.value); + }); + +}); + +process.on('exit', function() { + assert.strictEqual(FIELDS.length, 0); +}); diff --git a/node_modules/request/tests/test-headers.js b/node_modules/request/tests/test-headers.js new file mode 100644 index 0000000..31fe3f4 --- /dev/null +++ b/node_modules/request/tests/test-headers.js @@ -0,0 +1,52 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + , Cookie = require('../vendor/cookie') + , Jar = require('../vendor/cookie/jar') + , s = server.createServer() + +s.listen(s.port, function () { + var serverUri = 'http://localhost/' + s.port + , numTests = 0 + , numOutstandingTests = 0 + + function createTest(requestObj, serverAssertFn) { + var testNumber = numTests; + numTests += 1; + numOutstandingTests += 1; + s.on('/' + testNumber, function (req, res) { + serverAssertFn(req, res); + res.writeHead(200); + res.end(); + }); + requestObj.url = serverUri + '/' + testNumber + request(requestObj, function (err, res, body) { + assert.ok(!err) + assert.equal(res.statusCode, 200) + numOutstandingTests -= 1 + if (numOutstandingTests === 0) { + console.log(numTests + ' tests passed.') + s.close() + } + }) + } + + // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified + createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { + assert.ok(req.headers.cookie) + assert.equal(req.headers.cookie, 'foo=bar') + }) + + // Issue #125: headers.cookie + cookie jar + var jar = new Jar() + jar.add(new Cookie('quux=baz')); + createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { + assert.ok(req.headers.cookie) + assert.equal(req.headers.cookie, 'foo=bar; quux=baz') + }) + + // There should be no cookie header when neither headers.cookie nor a cookie jar is specified + createTest({}, function (req, res) { + assert.ok(!req.headers.cookie) + }) +}) diff --git a/node_modules/request/tests/test-httpModule.js b/node_modules/request/tests/test-httpModule.js new file mode 100644 index 0000000..1866de2 --- /dev/null +++ b/node_modules/request/tests/test-httpModule.js @@ -0,0 +1,94 @@ +var http = require('http') + , https = require('https') + , server = require('./server') + , assert = require('assert') + , request = require('../main.js') + + +var faux_requests_made = {'http':0, 'https':0} +function wrap_request(name, module) { + // Just like the http or https module, but note when a request is made. + var wrapped = {} + Object.keys(module).forEach(function(key) { + var value = module[key]; + + if(key != 'request') + wrapped[key] = value; + else + wrapped[key] = function(options, callback) { + faux_requests_made[name] += 1 + return value.apply(this, arguments) + } + }) + + return wrapped; +} + + +var faux_http = wrap_request('http', http) + , faux_https = wrap_request('https', https) + , plain_server = server.createServer() + , https_server = server.createSSLServer() + + +plain_server.listen(plain_server.port, function() { + plain_server.on('/plain', function (req, res) { + res.writeHead(200) + res.end('plain') + }) + plain_server.on('/to_https', function (req, res) { + res.writeHead(301, {'location':'https://localhost/'+https_server.port + '/https'}) + res.end() + }) + + https_server.listen(https_server.port, function() { + https_server.on('/https', function (req, res) { + res.writeHead(200) + res.end('https') + }) + https_server.on('/to_plain', function (req, res) { + res.writeHead(302, {'location':'http://localhost/'+plain_server.port + '/plain'}) + res.end() + }) + + run_tests() + run_tests({}) + run_tests({'http:':faux_http}) + run_tests({'https:':faux_https}) + run_tests({'http:':faux_http, 'https:':faux_https}) + }) +}) + +function run_tests(httpModules) { + var to_https = 'http://localhost/'+plain_server.port+'/to_https' + var to_plain = 'https://localhost/'+https_server.port+'/to_plain' + + request(to_https, {'httpModules':httpModules}, function (er, res, body) { + assert.ok(!er, 'Bounce to SSL worked') + assert.equal(body, 'https', 'Received HTTPS server body') + done() + }) + + request(to_plain, {'httpModules':httpModules}, function (er, res, body) { + assert.ok(!er, 'Bounce to plaintext server worked') + assert.equal(body, 'plain', 'Received HTTPS server body') + done() + }) +} + + +var passed = 0; +function done() { + passed += 1 + var expected = 10 + + if(passed == expected) { + plain_server.close() + https_server.close() + + assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') + assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') + + console.log((expected+2) + ' tests passed.') + } +} diff --git a/node_modules/request/tests/test-https-strict.js b/node_modules/request/tests/test-https-strict.js new file mode 100644 index 0000000..470b68d --- /dev/null +++ b/node_modules/request/tests/test-https-strict.js @@ -0,0 +1,97 @@ +// a test where we validate the siguature of the keys +// otherwise exactly the same as the ssl test + +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + , fs = require('fs') + , path = require('path') + , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') + , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } + , s = server.createSSLServer(null, opts) + , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') + , ca = fs.readFileSync(caFile) + +var tests = + { testGet : + { resp : server.createGetResponse("TESTING!") + , expectBody: "TESTING!" + } + , testGetChunkBreak : + { resp : server.createChunkResponse( + [ new Buffer([239]) + , new Buffer([163]) + , new Buffer([191]) + , new Buffer([206]) + , new Buffer([169]) + , new Buffer([226]) + , new Buffer([152]) + , new Buffer([131]) + ]) + , expectBody: "Ω☃" + } + , testGetJSON : + { resp : server.createGetResponse('{"test":true}', 'application/json') + , json : true + , expectBody: {"test":true} + } + , testPutString : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : "PUTTINGDATA" + } + , testPutBuffer : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : new Buffer("PUTTINGDATA") + } + , testPutJSON : + { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) + , method: "PUT" + , json: {foo: 'bar'} + } + , testPutMultipart : + { resp: server.createPostValidator( + '--__BOUNDARY__\r\n' + + 'content-type: text/html\r\n' + + '\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__\r\n\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__--' + ) + , method: "PUT" + , multipart: + [ {'content-type': 'text/html', 'body': 'Oh hi.'} + , {'body': 'Oh hi.'} + ] + } + } + +s.listen(s.port, function () { + + var counter = 0 + + for (i in tests) { + (function () { + var test = tests[i] + s.on('/'+i, test.resp) + test.uri = s.url + '/' + i + test.strictSSL = true + test.ca = ca + test.headers = { host: 'testing.request.mikealrogers.com' } + request(test, function (err, resp, body) { + if (err) throw err + if (test.expectBody) { + assert.deepEqual(test.expectBody, body) + } + counter = counter - 1; + if (counter === 0) { + console.log(Object.keys(tests).length+" tests passed.") + s.close() + } + }) + counter++ + })() + } +}) diff --git a/node_modules/request/tests/test-https.js b/node_modules/request/tests/test-https.js new file mode 100644 index 0000000..58e7db9 --- /dev/null +++ b/node_modules/request/tests/test-https.js @@ -0,0 +1,86 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + +var s = server.createSSLServer(); + +var tests = + { testGet : + { resp : server.createGetResponse("TESTING!") + , expectBody: "TESTING!" + } + , testGetChunkBreak : + { resp : server.createChunkResponse( + [ new Buffer([239]) + , new Buffer([163]) + , new Buffer([191]) + , new Buffer([206]) + , new Buffer([169]) + , new Buffer([226]) + , new Buffer([152]) + , new Buffer([131]) + ]) + , expectBody: "Ω☃" + } + , testGetJSON : + { resp : server.createGetResponse('{"test":true}', 'application/json') + , json : true + , expectBody: {"test":true} + } + , testPutString : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : "PUTTINGDATA" + } + , testPutBuffer : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : new Buffer("PUTTINGDATA") + } + , testPutJSON : + { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) + , method: "PUT" + , json: {foo: 'bar'} + } + , testPutMultipart : + { resp: server.createPostValidator( + '--__BOUNDARY__\r\n' + + 'content-type: text/html\r\n' + + '\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__\r\n\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__--' + ) + , method: "PUT" + , multipart: + [ {'content-type': 'text/html', 'body': 'Oh hi.'} + , {'body': 'Oh hi.'} + ] + } + } + +s.listen(s.port, function () { + + var counter = 0 + + for (i in tests) { + (function () { + var test = tests[i] + s.on('/'+i, test.resp) + test.uri = s.url + '/' + i + request(test, function (err, resp, body) { + if (err) throw err + if (test.expectBody) { + assert.deepEqual(test.expectBody, body) + } + counter = counter - 1; + if (counter === 0) { + console.log(Object.keys(tests).length+" tests passed.") + s.close() + } + }) + counter++ + })() + } +}) diff --git a/node_modules/request/tests/test-oauth.js b/node_modules/request/tests/test-oauth.js new file mode 100644 index 0000000..72ca923 --- /dev/null +++ b/node_modules/request/tests/test-oauth.js @@ -0,0 +1,117 @@ +var hmacsign = require('../oauth').hmacsign + , assert = require('assert') + , qs = require('querystring') + , request = require('../main') + ; + +function getsignature (r) { + var sign + r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { + if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) + }) + return decodeURIComponent(sign) +} + +// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth + +var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', + { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' + , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' + , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' + , oauth_signature_method: 'HMAC-SHA1' + , oauth_timestamp: '1272323042' + , oauth_version: '1.0' + }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") + +console.log(reqsign) +console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') +assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') + +var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', + { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' + , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' + , oauth_signature_method: 'HMAC-SHA1' + , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' + , oauth_timestamp: '1272323047' + , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' + , oauth_version: '1.0' + }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") + +console.log(accsign) +console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') +assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') + +var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', + { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" + , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" + , oauth_signature_method: "HMAC-SHA1" + , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" + , oauth_timestamp: "1272325550" + , oauth_version: "1.0" + , status: 'setting up my twitter 私のさえずりを設定する' + }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") + +console.log(upsign) +console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') +assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') + + +var rsign = request.post( + { url: 'https://api.twitter.com/oauth/request_token' + , oauth: + { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' + , consumer_key: 'GDdmIQH6jhtmLUypg82g' + , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' + , timestamp: '1272323042' + , version: '1.0' + , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" + } + }) + +setTimeout(function () { + console.log(getsignature(rsign)) + assert.equal(reqsign, getsignature(rsign)) +}) + +var raccsign = request.post( + { url: 'https://api.twitter.com/oauth/access_token' + , oauth: + { consumer_key: 'GDdmIQH6jhtmLUypg82g' + , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' + , signature_method: 'HMAC-SHA1' + , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' + , timestamp: '1272323047' + , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' + , version: '1.0' + , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" + , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" + } + }) + +setTimeout(function () { + console.log(getsignature(raccsign)) + assert.equal(accsign, getsignature(raccsign)) +}, 1) + +var rupsign = request.post( + { url: 'http://api.twitter.com/1/statuses/update.json' + , oauth: + { consumer_key: "GDdmIQH6jhtmLUypg82g" + , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" + , signature_method: "HMAC-SHA1" + , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" + , timestamp: "1272325550" + , version: "1.0" + , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" + , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" + } + , form: {status: 'setting up my twitter 私のさえずりを設定する'} + }) +setTimeout(function () { + console.log(getsignature(rupsign)) + assert.equal(upsign, getsignature(rupsign)) +}, 1) + + + + diff --git a/node_modules/request/tests/test-params.js b/node_modules/request/tests/test-params.js new file mode 100644 index 0000000..5ddb311 --- /dev/null +++ b/node_modules/request/tests/test-params.js @@ -0,0 +1,92 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + ; + +var s = server.createServer(); + +var tests = + { testGet : + { resp : server.createGetResponse("TESTING!") + , expectBody: "TESTING!" + } + , testGetChunkBreak : + { resp : server.createChunkResponse( + [ new Buffer([239]) + , new Buffer([163]) + , new Buffer([191]) + , new Buffer([206]) + , new Buffer([169]) + , new Buffer([226]) + , new Buffer([152]) + , new Buffer([131]) + ]) + , expectBody: "Ω☃" + } + , testGetBuffer : + { resp : server.createGetResponse(new Buffer("TESTING!")) + , encoding: null + , expectBody: new Buffer("TESTING!") + } + , testGetJSON : + { resp : server.createGetResponse('{"test":true}', 'application/json') + , json : true + , expectBody: {"test":true} + } + , testPutString : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : "PUTTINGDATA" + } + , testPutBuffer : + { resp : server.createPostValidator("PUTTINGDATA") + , method : "PUT" + , body : new Buffer("PUTTINGDATA") + } + , testPutJSON : + { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) + , method: "PUT" + , json: {foo: 'bar'} + } + , testPutMultipart : + { resp: server.createPostValidator( + '--__BOUNDARY__\r\n' + + 'content-type: text/html\r\n' + + '\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__\r\n\r\n' + + 'Oh hi.' + + '\r\n--__BOUNDARY__--' + ) + , method: "PUT" + , multipart: + [ {'content-type': 'text/html', 'body': 'Oh hi.'} + , {'body': 'Oh hi.'} + ] + } + } + +s.listen(s.port, function () { + + var counter = 0 + + for (i in tests) { + (function () { + var test = tests[i] + s.on('/'+i, test.resp) + //test.uri = s.url + '/' + i + request(s.url + '/' + i, test, function (err, resp, body) { + if (err) throw err + if (test.expectBody) { + assert.deepEqual(test.expectBody, body) + } + counter = counter - 1; + if (counter === 0) { + console.log(Object.keys(tests).length+" tests passed.") + s.close() + } + }) + counter++ + })() + } +}) diff --git a/node_modules/request/tests/test-piped-redirect.js b/node_modules/request/tests/test-piped-redirect.js new file mode 100644 index 0000000..25bf35d --- /dev/null +++ b/node_modules/request/tests/test-piped-redirect.js @@ -0,0 +1,52 @@ +var http = require('http') + , assert = require('assert') + , request = require('../main.js') + ; + +var portOne = 8968 + , portTwo = 8969 + ; + + +// server one +var s1 = http.createServer(function (req, resp) +{ + if (req.url == '/original') + { + resp.writeHeader(302, {'location': '/redirected'}) + resp.end() + } + else if (req.url == '/redirected') + { + resp.writeHeader(200, {'content-type': 'text/plain'}) + resp.write('OK') + resp.end() + } + +}).listen(portOne); + + +// server two +var s2 = http.createServer(function (req, resp) +{ + + var x = request('http://localhost/'+portOne+'/original') + req.pipe(x) + x.pipe(resp) + +}).listen(portTwo, function() +{ + + var r = request('http://localhost/'+portTwo+'/original', function (err, res, body) { + + assert.equal(body, 'OK') + + s1.close() + s2.close() + + }); + + // it hangs, so wait a second :) + r.timeout = 1000; + +}); diff --git a/node_modules/request/tests/test-pipes.js b/node_modules/request/tests/test-pipes.js new file mode 100644 index 0000000..7162981 --- /dev/null +++ b/node_modules/request/tests/test-pipes.js @@ -0,0 +1,216 @@ +var server = require('./server') + , events = require('events') + , stream = require('stream') + , assert = require('assert') + , fs = require('fs') + , request = require('../main.js') + , path = require('path') + , util = require('util') + ; + +var s = server.createServer(3453); + +function ValidationStream(str) { + this.str = str + this.buf = '' + this.on('data', function (data) { + this.buf += data + }) + this.on('end', function () { + assert.equal(this.str, this.buf) + }) + this.writable = true +} +util.inherits(ValidationStream, stream.Stream) +ValidationStream.prototype.write = function (chunk) { + this.emit('data', chunk) +} +ValidationStream.prototype.end = function (chunk) { + if (chunk) emit('data', chunk) + this.emit('end') +} + +s.listen(s.port, function () { + counter = 0; + + var check = function () { + counter = counter - 1 + if (counter === 0) { + console.log('All tests passed.') + setTimeout(function () { + process.exit(); + }, 500) + } + } + + // Test pipeing to a request object + s.once('/push', server.createPostValidator("mydata")); + + var mydata = new stream.Stream(); + mydata.readable = true + + counter++ + var r1 = request.put({url:'http://localhost:3453/push'}, function () { + check(); + }) + mydata.pipe(r1) + + mydata.emit('data', 'mydata'); + mydata.emit('end'); + + // Test pipeing to a request object with a json body + s.once('/push-json', server.createPostValidator("{\"foo\":\"bar\"}", "application/json")); + + var mybodydata = new stream.Stream(); + mybodydata.readable = true + + counter++ + var r2 = request.put({url:'http://localhost:3453/push-json',json:true}, function () { + check(); + }) + mybodydata.pipe(r2) + + mybodydata.emit('data', JSON.stringify({foo:"bar"})); + mybodydata.emit('end'); + + // Test pipeing from a request object. + s.once('/pull', server.createGetResponse("mypulldata")); + + var mypulldata = new stream.Stream(); + mypulldata.writable = true + + counter++ + request({url:'http://localhost:3453/pull'}).pipe(mypulldata) + + var d = ''; + + mypulldata.write = function (chunk) { + d += chunk; + } + mypulldata.end = function () { + assert.equal(d, 'mypulldata'); + check(); + }; + + + s.on('/cat', function (req, resp) { + if (req.method === "GET") { + resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); + resp.end('asdf') + } else if (req.method === "PUT") { + assert.equal(req.headers['content-type'], 'text/plain-test'); + assert.equal(req.headers['content-length'], 4) + var validate = ''; + + req.on('data', function (chunk) {validate += chunk}) + req.on('end', function () { + resp.writeHead(201); + resp.end(); + assert.equal(validate, 'asdf'); + check(); + }) + } + }) + s.on('/pushjs', function (req, resp) { + if (req.method === "PUT") { + assert.equal(req.headers['content-type'], 'application/javascript'); + check(); + } + }) + s.on('/catresp', function (req, resp) { + request.get('http://localhost:3453/cat').pipe(resp) + }) + s.on('/doodle', function (req, resp) { + if (req.headers['x-oneline-proxy']) { + resp.setHeader('x-oneline-proxy', 'yup') + } + resp.writeHead('200', {'content-type':'image/png'}) + fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) + }) + s.on('/onelineproxy', function (req, resp) { + var x = request('http://localhost:3453/doodle') + req.pipe(x) + x.pipe(resp) + }) + + counter++ + fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) + + counter++ + request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) + + counter++ + request.get('http://localhost:3453/catresp', function (e, resp, body) { + assert.equal(resp.headers['content-type'], 'text/plain-test'); + assert.equal(resp.headers['content-length'], 4) + check(); + }) + + var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) + + counter++ + request.get('http://localhost:3453/doodle').pipe(doodleWrite) + + doodleWrite.on('close', function () { + assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) + check() + }) + + process.on('exit', function () { + fs.unlinkSync(path.join(__dirname, 'test.png')) + }) + + counter++ + request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { + assert.equal(resp.headers['x-oneline-proxy'], 'yup') + check() + }) + + s.on('/afterresponse', function (req, resp) { + resp.write('d') + resp.end() + }) + + counter++ + var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { + var v = new ValidationStream('d') + afterresp.pipe(v) + v.on('end', check) + }) + + s.on('/forward1', function (req, resp) { + resp.writeHead(302, {location:'/forward2'}) + resp.end() + }) + s.on('/forward2', function (req, resp) { + resp.writeHead('200', {'content-type':'image/png'}) + resp.write('d') + resp.end() + }) + + counter++ + var validateForward = new ValidationStream('d') + validateForward.on('end', check) + request.get('http://localhost:3453/forward1').pipe(validateForward) + + // Test pipe options + s.once('/opts', server.createGetResponse('opts response')); + + var optsStream = new stream.Stream(); + optsStream.writable = true + + var optsData = ''; + optsStream.write = function (buf) { + optsData += buf; + if (optsData === 'opts response') { + setTimeout(check, 10); + } + } + + optsStream.end = function () { + assert.fail('end called') + }; + + counter++ + request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) +}) diff --git a/node_modules/request/tests/test-pool.js b/node_modules/request/tests/test-pool.js new file mode 100644 index 0000000..1e7d578 --- /dev/null +++ b/node_modules/request/tests/test-pool.js @@ -0,0 +1,16 @@ +var request = require('../main') + , http = require('http') + , assert = require('assert') + ; + +var s = http.createServer(function (req, resp) { + resp.statusCode = 200; + resp.end('asdf'); +}).listen(8080, function () { + request({'url': 'http://localhost:8080/', 'pool': false}, function (e, resp) { + var agent = resp.request.agent; + assert.strictEqual(typeof agent, 'boolean'); + assert.strictEqual(agent, false); + s.close(); + }); +}); \ No newline at end of file diff --git a/node_modules/request/tests/test-protocol-changing-redirect.js b/node_modules/request/tests/test-protocol-changing-redirect.js new file mode 100644 index 0000000..f74e196 --- /dev/null +++ b/node_modules/request/tests/test-protocol-changing-redirect.js @@ -0,0 +1,60 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + + +var s = server.createServer() +var ss = server.createSSLServer() +var sUrl = 'http://localhost/' + s.port +var ssUrl = 'https://localhost/' + ss.port + +s.listen(s.port, bouncy(s, ssUrl)) +ss.listen(ss.port, bouncy(ss, sUrl)) + +var hits = {} +var expect = {} +var pending = 0 +function bouncy (s, server) { return function () { + + var redirs = { a: 'b' + , b: 'c' + , c: 'd' + , d: 'e' + , e: 'f' + , f: 'g' + , g: 'h' + , h: 'end' } + + var perm = true + Object.keys(redirs).forEach(function (p) { + var t = redirs[p] + + // switch type each time + var type = perm ? 301 : 302 + perm = !perm + s.on('/' + p, function (req, res) { + res.writeHead(type, { location: server + '/' + t }) + res.end() + }) + }) + + s.on('/end', function (req, res) { + var h = req.headers['x-test-key'] + hits[h] = true + pending -- + if (pending === 0) done() + }) +}} + +for (var i = 0; i < 5; i ++) { + pending ++ + var val = 'test_' + i + expect[val] = true + request({ url: (i % 2 ? sUrl : ssUrl) + '/a' + , headers: { 'x-test-key': val } }) +} + +function done () { + assert.deepEqual(hits, expect) + process.exit(0) +} diff --git a/node_modules/request/tests/test-proxy.js b/node_modules/request/tests/test-proxy.js new file mode 100644 index 0000000..647157c --- /dev/null +++ b/node_modules/request/tests/test-proxy.js @@ -0,0 +1,39 @@ +var server = require('./server') + , events = require('events') + , stream = require('stream') + , assert = require('assert') + , fs = require('fs') + , request = require('../main.js') + , path = require('path') + , util = require('util') + ; + +var port = 6768 + , called = false + , proxiedHost = 'google.com' + ; + +var s = server.createServer(port) +s.listen(port, function () { + s.on('http://google.com/', function (req, res) { + called = true + assert.equal(req.headers.host, proxiedHost) + res.writeHeader(200) + res.end() + }) + request ({ + url: 'http://'+proxiedHost, + proxy: 'http://localhost/'+port + /* + //should behave as if these arguments where passed: + url: 'http://localhost/'+port, + headers: {host: proxiedHost} + //*/ + }, function (err, res, body) { + s.close() + }) +}) + +process.on('exit', function () { + assert.ok(called, 'the request must be made to the proxy server') +}) diff --git a/node_modules/request/tests/test-qs.js b/node_modules/request/tests/test-qs.js new file mode 100644 index 0000000..1aac22b --- /dev/null +++ b/node_modules/request/tests/test-qs.js @@ -0,0 +1,28 @@ +var request = request = require('../main.js') + , assert = require('assert') + ; + + +// Test adding a querystring +var req1 = request.get({ uri: 'http://www.google.com/', qs: { q : 'search' }}) +setTimeout(function() { + assert.equal('/?q=search', req1.path) +}, 1) + +// Test replacing a querystring value +var req2 = request.get({ uri: 'http://www.google.com/?q=abc', qs: { q : 'search' }}) +setTimeout(function() { + assert.equal('/?q=search', req2.path) +}, 1) + +// Test appending a querystring value to the ones present in the uri +var req3 = request.get({ uri: 'http://www.google.com/?x=y', qs: { q : 'search' }}) +setTimeout(function() { + assert.equal('/?x=y&q=search', req3.path) +}, 1) + +// Test leaving a querystring alone +var req4 = request.get({ uri: 'http://www.google.com/?x=y'}) +setTimeout(function() { + assert.equal('/?x=y', req4.path) +}, 1) diff --git a/node_modules/request/tests/test-redirect.js b/node_modules/request/tests/test-redirect.js new file mode 100644 index 0000000..b84844a --- /dev/null +++ b/node_modules/request/tests/test-redirect.js @@ -0,0 +1,154 @@ +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + , Cookie = require('../vendor/cookie') + , Jar = require('../vendor/cookie/jar') + +var s = server.createServer() + +s.listen(s.port, function () { + var server = 'http://localhost/' + s.port; + var hits = {} + var passed = 0; + + bouncer(301, 'temp') + bouncer(302, 'perm') + bouncer(302, 'nope') + + function bouncer(code, label) { + var landing = label+'_landing'; + + s.on('/'+label, function (req, res) { + hits[label] = true; + res.writeHead(code, { + 'location':server + '/'+landing, + 'set-cookie': 'ham=eggs' + }) + res.end() + }) + + s.on('/'+landing, function (req, res) { + if (req.method !== 'GET') { // We should only accept GET redirects + console.error("Got a non-GET request to the redirect destination URL"); + res.writeHead(400); + res.end(); + return; + } + // Make sure the cookie doesn't get included twice, see #139: + // Make sure cookies are set properly after redirect + assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs'); + hits[landing] = true; + res.writeHead(200) + res.end(landing) + }) + } + + // Permanent bounce + var jar = new Jar() + jar.add(new Cookie('quux=baz')) + request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) + assert.ok(hits.perm, 'Original request is to /perm') + assert.ok(hits.perm_landing, 'Forward to permanent landing URL') + assert.equal(body, 'perm_landing', 'Got permanent landing content') + passed += 1 + done() + }) + + // Temporary bounce + request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(hits.temp_landing, 'Forward to temporary landing URL') + assert.equal(body, 'temp_landing', 'Got temporary landing content') + passed += 1 + done() + }) + + // Prevent bouncing. + request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode) + assert.ok(hits.nope, 'Original request to /nope') + assert.ok(!hits.nope_landing, 'No chasing the redirect') + assert.equal(res.statusCode, 302, 'Response is the bounce itself') + passed += 1 + done() + }) + + // Should not follow post redirects by default + request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(!hits.temp_landing, 'No chasing the redirect when post') + assert.equal(res.statusCode, 301, 'Response is the bounce itself') + passed += 1 + done() + }) + + // Should follow post redirects when followAllRedirects true + request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(hits.temp_landing, 'Forward to temporary landing URL') + assert.equal(body, 'temp_landing', 'Got temporary landing content') + passed += 1 + done() + }) + + request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(!hits.temp_landing, 'No chasing the redirect') + assert.equal(res.statusCode, 301, 'Response is the bounce itself') + passed += 1 + done() + }) + + // Should not follow delete redirects by default + request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode < 301) throw new Error('Status is not a redirect.') + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') + assert.equal(res.statusCode, 301, 'Response is the bounce itself') + passed += 1 + done() + }) + + // Should not follow delete redirects even if followRedirect is set to true + request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') + assert.equal(res.statusCode, 301, 'Response is the bounce itself') + passed += 1 + done() + }) + + // Should follow delete redirects when followAllRedirects true + request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { + if (er) throw er + if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) + assert.ok(hits.temp, 'Original request is to /temp') + assert.ok(hits.temp_landing, 'Forward to temporary landing URL') + assert.equal(body, 'temp_landing', 'Got temporary landing content') + passed += 1 + done() + }) + + var reqs_done = 0; + function done() { + reqs_done += 1; + if(reqs_done == 9) { + console.log(passed + ' tests passed.') + s.close() + } + } +}) diff --git a/node_modules/request/tests/test-s3.js b/node_modules/request/tests/test-s3.js new file mode 100644 index 0000000..5f59c4a --- /dev/null +++ b/node_modules/request/tests/test-s3.js @@ -0,0 +1,13 @@ +var request = require('../main') + +var r = request.get('https://log.curlybracecast.com.s3.amazonaws.com/', + { aws: + { key: 'AKIAI6KIQRRVMGK3WK5Q' + , secret: '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' + , bucket: 'log.curlybracecast.com' + } + }, function (e, resp, body) { + console.log(r.headers) + console.log(body) + } +) \ No newline at end of file diff --git a/node_modules/request/tests/test-timeout.js b/node_modules/request/tests/test-timeout.js new file mode 100644 index 0000000..673f8ad --- /dev/null +++ b/node_modules/request/tests/test-timeout.js @@ -0,0 +1,87 @@ +var server = require('./server') + , events = require('events') + , stream = require('stream') + , assert = require('assert') + , request = require('../main.js') + ; + +var s = server.createServer(); +var expectedBody = "waited"; +var remainingTests = 5; + +s.listen(s.port, function () { + // Request that waits for 200ms + s.on('/timeout', function (req, resp) { + setTimeout(function(){ + resp.writeHead(200, {'content-type':'text/plain'}) + resp.write(expectedBody) + resp.end() + }, 200); + }); + + // Scenario that should timeout + var shouldTimeout = { + url: s.url + "/timeout", + timeout:100 + } + + + request(shouldTimeout, function (err, resp, body) { + assert.equal(err.code, "ETIMEDOUT"); + checkDone(); + }) + + + // Scenario that shouldn't timeout + var shouldntTimeout = { + url: s.url + "/timeout", + timeout:300 + } + + request(shouldntTimeout, function (err, resp, body) { + assert.equal(err, null); + assert.equal(expectedBody, body) + checkDone(); + }) + + // Scenario with no timeout set, so shouldn't timeout + var noTimeout = { + url: s.url + "/timeout" + } + + request(noTimeout, function (err, resp, body) { + assert.equal(err); + assert.equal(expectedBody, body) + checkDone(); + }) + + // Scenario with a negative timeout value, should be treated a zero or the minimum delay + var negativeTimeout = { + url: s.url + "/timeout", + timeout:-1000 + } + + request(negativeTimeout, function (err, resp, body) { + assert.equal(err.code, "ETIMEDOUT"); + checkDone(); + }) + + // Scenario with a float timeout value, should be rounded by setTimeout anyway + var floatTimeout = { + url: s.url + "/timeout", + timeout: 100.76 + } + + request(floatTimeout, function (err, resp, body) { + assert.equal(err.code, "ETIMEDOUT"); + checkDone(); + }) + + function checkDone() { + if(--remainingTests == 0) { + s.close(); + console.log("All tests passed."); + } + } +}) + diff --git a/node_modules/request/tests/test-toJSON.js b/node_modules/request/tests/test-toJSON.js new file mode 100644 index 0000000..b7c67ef --- /dev/null +++ b/node_modules/request/tests/test-toJSON.js @@ -0,0 +1,14 @@ +var request = require('../main') + , http = require('http') + , assert = require('assert') + ; + +var s = http.createServer(function (req, resp) { + resp.statusCode = 200 + resp.end('asdf') +}).listen(8080, function () { + var r = request('http://localhost:8080/', function (e, resp) { + assert.equal(JSON.parse(JSON.stringify(r)).response.statusCode, 200) + s.close() + }) +}) \ No newline at end of file diff --git a/node_modules/request/tests/test-tunnel.js b/node_modules/request/tests/test-tunnel.js new file mode 100644 index 0000000..51e2126 --- /dev/null +++ b/node_modules/request/tests/test-tunnel.js @@ -0,0 +1,63 @@ +// test that we can tunnel a https request over an http proxy +// keeping all the CA and whatnot intact. +// +// Note: this requires that squid is installed. +// If the proxy fails to start, we'll just log a warning and assume success. + +var server = require('./server') + , assert = require('assert') + , request = require('../main.js') + , fs = require('fs') + , path = require('path') + , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') + , ca = fs.readFileSync(caFile) + , child_process = require('child_process') + , sqConf = path.resolve(__dirname, 'squid.conf') + , sqArgs = ['-f', sqConf, '-N', '-d', '5'] + , proxy = 'http://localhost:3128/' + , hadError = null + +var squid = child_process.spawn('squid', sqArgs); +var ready = false + +squid.stderr.on('data', function (c) { + console.error('SQUIDERR ' + c.toString().trim().split('\n') + .join('\nSQUIDERR ')) + ready = c.toString().match(/ready to serve requests/i) +}) + +squid.stdout.on('data', function (c) { + console.error('SQUIDOUT ' + c.toString().trim().split('\n') + .join('\nSQUIDOUT ')) +}) + +squid.on('exit', function (c) { + console.error('squid: exit '+c) + if (c && !ready) { + console.error('squid must be installed to run this test.') + console.error('skipping this test. please install squid and run again if you need to test tunneling.') + c = null + hadError = null + process.exit(0) + return + } + + if (c) { + hadError = hadError || new Error('Squid exited with '+c) + } + if (hadError) throw hadError +}) + +setTimeout(function F () { + if (!ready) return setTimeout(F, 100) + request({ uri: 'https://registry.npmjs.org/' + , proxy: 'http://localhost:3128/' + , strictSSL: true + , ca: ca + , json: true }, function (er, body) { + hadError = er + console.log(er || typeof body) + if (!er) console.log("ok") + squid.kill('SIGKILL') + }) +}, 100) diff --git a/node_modules/request/tests/unicycle.jpg b/node_modules/request/tests/unicycle.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7cea4dd71dc41cd51c84bfcec6b3e65c15a58507 GIT binary patch literal 19806 zcmbTc1z40%^fvq;-Jx_#Nh95;NK1E1=hCsXfTT16N{WCqh_G}>mxMG+w{*i&%eVge z{eSO!eKC8@&i%}sIp;oS=E<4+nfqmcKv7mf7C=Hm0^|`t;C>bLiGsAWshWnWtimf9 zL<0bzl9{=+8}k70-O<9+&Fc?Y1ephX0PrW@KWZLIn}Mv{%;ualph#^3Ms7GLF z6$B=y;}i_IW0Ga(VK3cCEmw%3d&g(|=n-+)V8(M&geEwLdugw)b1_pVsIQ zEX@93Mh8d(D+r!{9{tV5;XmB}=4H|Ktj|d%yh)ndH`9(Sa~3_#lN=xYxh5r|J7iHu>1EY{~2{1#MsjTf7*4V zBS&a+`D+ZU{_yzsys-Vt7T{q8_CU-dK-$^G$IZ^h)`O0hhlh{uIpWe}MJMeHa`E)A za-&mlvf$#NGjnvL`$NW^&dti*%FWBllIwTh`;`abGGIGv08m!`V+LaYm`M1*14I*I z-U7Zz1b^V)*Q_KYA^;gtBKFFPR5%U}73Jp_eTuj+QHG@d&FukANY+1?Ir8yeJkbFl0dc`X z=tkk;<$aof{5Q`BTnQ-u;1`Jx{^_fegaTmw$>)Jd66!zo)=B7p=|n^(3F9w}jlh_H zVMIieu>O&E`t-Nmr#w8Lkp7ZEc=_qUKk+I1g!~Ua%KuviVLboAU-G{(^1praQU1~I zm5=&YJqtnx?JtZNm;AqZ{_guX&)@iOp1(2Hzxok}ztivde?nwDL`MDJMf-nOhmeg! zboEA*zte9Wf6gHQ_&uk7AOB8B_j8Ez<-zZS^vC~$2gt~1D9DI}j*5zchJlWO@jGK; z;bLQA;$UH5VB=%s;Nl??CN=>fJ|5w3{9DQI?ucG!C@5%nm>8J9CH}vq`|kiD25 z0f=@0g%Fj9{^@hHhw5hNk6j<}1}ElXFubU0C)W6R#K>pv7J`XILP|zX!Nkn+gq4k7 zKu}0nL{$2vjI5lzf}*CDwvI01rfXqoWo=_?XYcOe>E#Xf@eO?&79J596`hp)J|#8n z!^iZ`dHDrj3X6(MzE#&iYU}D78aq0>x_f&2`Ul3wCnl$+XJ(-*t842Un_IuOcaBd^ z&(1F{VOQ6`{X)#CKi&Grv;W~2A;PZ*C@9D%=)e6!df<)7$b=}U^iR=qmT%UlW$mDv_^09WR>EfUw5|pXx$ELf1=1HCf-G}A$ifkAKY0k)f)&f^@I?lrTv+^y1zFzo@Bs#(74 zB2%!Tp?dq>Xz#9(^6?KK}b*#0Z z0naJ~K@1vW6wNNAG0(cE1;5XE&$kx_;^9f5{tP!OlX{QxY)3IqGi_^m!*% zqGbX~y;f_LM7#uY3ED1`3q2>3JU?3s3*_9^-NtQ;9K$79>C3!$r? zs<;Pgmg_{_xArvHi0Rf})2dIWXQ_TE%vvdUv@khRU0GvDtwOjZEB+mCn%beqUwT<# zpJ-JkhHO#8`$^wxRa$9dxz3Syi+Hd%I^&8HB-F;5?t1h7Nj%j0=*Relis$EXB6ZS_ zIT9Naw8NjTeo@!ZvF)TxU8(x&9y;B2m6K({c{FbgmykS|+}E0~sT!n3ddGz!nfb=u z2$IrL8@w`;m-GypP|x(ylHNjdyclkDYEoE+j|FZQS17SlEn5)G@Oqh`>NeVs)^8x9 zCaYpdiKz>Oh^3zn$*K5(0zJbGl}gcL_2gWc_1}kJFrHxiQdLzvE_tCezujW}+ip;7WR(VE~@-+rRFC>i4hbzy~@~ zUQnPdV@fc0^&UWm#T!pKHe0M9H^`2_g zX$x=V3ao;>sZvcJGI>~?9CRFrpJ#;y@NZ^FVCx+^NfPNfOey;v9d<*#>S%5%1a2MrAxn6$_)gMRowj__?aX7ws!ir=dEUa)5r_vSmOyW3B8Yvi-;Q{8VBrlCk}{kCy9<*{i)~?x{K|Wg*cO?v%yD8H*lqY z^SC52ENN{pyHgDoP}Yy}0rK^f6N5p7&g$9iqiOb_qc*LYcl)BA`#F*PrvvkPJdE+i z4e*zftlhyIdq$lswBLhL0^@#RSR4t)#Aae+e3e>$&?*l6l~m}1uc!T7ds!FQ=T#UM!O{$Jb-RJT$OI>%E!T9cmnqf zqo@`V-d!52J)bpqCbPHS^`w~jMCu5d@v(BxmIvUTn-ppB9y1ltIaTCA)$=sI?7NQO z>0M*6IO;2vD*HuiZ3i~Lye9UBDD~i(i748G9^cRrYKP8>z{hr)H9upWs11%{ytrO~1zKYAG&$&-?EYxkz zi)SHy65)htG4h}}vlE+&Lu7;fZ1kKL`mkH)!gYM&YOZUMJA79&yQh8G0p(+Yk2HP5 zy3I}REqkA5{l=8%rcT_fS*#F7a#kLd<@Js3>^(s2k7QAjXAHJcuBozW(ypz2%SOkw zQSk9A-|53)pVe0HWA098LOUS^-VdJ4PDTa^!2z=Prsd$XDju7br~&&iFM~Yn_CRJ; z%v-(DTRGfzeUJW>&;B+jtVTkY@57~10;~N+jxRFSa?tF2-;xUEsi#Yf8|1x?%X2|5 z$x%0rfyTuKpw%Dsqm=Ryo)C+y(ZVYv9L|!ziwcE%n9ihi=#pN0ZWKoC+r(yT*VXHv zZaq-!YhyG^SffUBu#YwT(24zF5M@cUaVO59TN3$Q7X{~Glm|7KX}LMwJ5D$xa*V~w zb|y~${lVo$We$2|Dz;J+cwaedhGT@YxG%@G!(x1zYJIwD_gXb-?N}RLylgCF&=R`; z*)S4|OlKiWIx6eiqpe&hrU+wbfs|F|m+$o6l%PK^Eb$4o)tjKToIBsE+f10ys#X^E4u+J- z%=BnbbzA?D#i~*qK9rvJ3PX3KH2G+^w~+GPP8HHU5MePiMKD}f$r2T|Xq)Z#%J`{e*LqB`Dj0(O-x*?b&E=q~=$#drA8|(& z!tByTiQ7 zcSj;?uXPehBbsRodqE%+NiB_%H{EiD5ckQ7yf1raUq5Q)HH!h@5*1+&hnhC zIkx=;SYQF{w{rI-?O05?rul>Mf!C>4403R$tKM^+qREB0?TPPZQ;EuVTcApC2d-)R zb=a43kA#4Vg~Xp|B4$f8=T}w5u+LM%2jxT_e8oJqmb4vRPj`3N&)uYuY;nu@BVL6u zkhhzg1}*#PrurLIAECbq#57&J2Rb-cK0-q8wB7UsHYfmO30B9;X-2yK4gt{r)-in9w&cN{X;Tk@GBi5-JT#+oi$-lYD#GP>*l!b!urHV$DQ zq!q@8VA}~sPy^RDF|@uH_rUC$a?ZMijFlPxx8#1YqY})^t&>VzD@Dv!5PqP) zw1^A~b%1KkzCU-q{&qR~>{^o!=*RfyDwaB@ltbNYx}Q!`Hr)7NC#WqAxDZ0|*2Fp0 z?5ck^#wz}oLgf=WN3tH*Ox+PU-!vrhR@%qGf`6#>SrxRS8){OTi5KSjefO-wU#o!3 zKtlCHw>gu?VtID^D(;KR_Uy+~`yM$DJ7mhLs_ibnl??LM08Yym*jaBbm(MHX0v|i1 zr@a$bwh8j)tRX5$e!)dStWGEWUSr{?&`BPx<&p7%y>CTf>29Z5Q?etYw1>9N$^(!( zOF#*DO+s{<#01HoDOsid2L~00+(9044`m@ac_pugi?@>WaOULMQ-AI+84YR56ILL4 z`k2ziZe(%Zl9(#`c%x-Y-|4~`Fn_z*hB4F!kLt<>M|=WKN)2W}(WR;*5o&~IIe>~( zarjziIT@o?29i%cXTFZtG=}ulmCJejoU`}l`D}*cHB3nAJOK1>ZD0>s?K>^0?*90o z+P5c(bejXf8HH5O`Xb;j434sR$(+OqSHTrj-8j&7tUWvo8na3;j6yJQ*p$$4>RLQ# zsh~1@I{s}dt4OhJ)$!d9O54t`u9e%U}%#ia4y$(L2@z*wiZL zV};hKScgp?F0VL4YDvhJ&bPjMfTWeOYfmwjl~MfMJU+=Gy9yOfXcCj$*3Hm%$0zVE z-W{6lba>EpE}^M2!R;je+|I|7f4^}19mFU`offIB{d4_N7hUq!&0m`5J7nN3gS-hzO~rWnWUoN6zX~yeT|d-FlDDD zH9`P%rGj_n+`>1)kN5qyiaoaU>_Nl6*>MogtlD^&CQEF-N4Ki~o-?^1w4Z?LgBkXf zdwNGEd&oC(YJ%gO6`H)U7OZ587*&}dsyTfy+lbOQXT|GOC~>r4vI8pv$`*Q|i9CJ{=*d*qaXBshdt8%6Bm| zG%#&vv7u%N8BRcB+>K&7RamYnT}7_40C~5RMXvB}QKubGHW( zb8(EF-=gAPmoFo! zB-I?`vDs3$(7%#bTD6}-e)-mkiSgj~I0G^GX)j~$fprmfY{jh=(fC7f5nQTKpxXLU zZmlplWLBhB6pQ3TA6n;zLc0lMXuD3g_8vgpKVTZiJ6>%jYd+ubZ+03{?Z|Ckx;`-F zl{kDcI@c9Mett*hk`}(ms+#YY&~W=mK&snYuAovcrXHsmfO@O3U9^2|)NZm4oYYg)|xC&5~V`sk3 zQU4VR3J>|@F$$8pu>VnG9w;;uGl1kHYe6pMJyuhrfZUtgn4k+Mym^uD>pz)dC9Zz! zP-|y#O6t)H6Q-JwRt(dcLA=`9Iuq>p2Bx8w`Bu-_xiUajYosl4d&c%dzY>p#W5En0 zBoDjC=T&oIsl8e=fwtvb1Xa!|A#IA1jJJYgxB6BBw~0FxGA9hgQ;trHB(rgZ6Cp`O z5=iLOrE5V1{z#4E%?b`d0q%HpWU{Y27R;JoBXwY!u~&VQm8a$vot{z*XM1EpRxVcV zeG^Ba7sHqAWN_gd^zqawHy50&((DYG*_q;?3{T>mz14l(u$wFH$dt;`ky-u7_Viq8 zbQ-d2fZwHL%!SJ$Cz|yuO53tN{Hh|~j@L~Jj7R!uE1Uh}SD5NCzR}eFoY4mZXf8gx z$woDMdCIMz-ks;S;;Qxn)ARsamLX^yx; zSK5e2K;A)x3%iY$j^RHo=Q}x561ZJ!g0ttN_bOXwZE#b*yW`Z^k31@wVJmTwXUMZD z0PFX#cKBz-SFFV3?YhNtoy_%fm0f3aOfhuA3CEY8_7k6Betd65*0AH+`@%K-ObnlJ zm&C0s%Im;2gym`?zBe52Lw`Q7xbgT0?i zV)AP(#B>D>qO^ptcPnq5R~=?U9HTc0zUWQk#NbOwAL??7qY{j-;bioYacFI{jI;z8 zy5@F2b?m`kQC7w4h^l$s^ou>kY|QszKk+E6=>kk7cf;!cN-nFAy(|nzz6a%LoJ1TS zY&w`e2&Nv$cn>Hv+ye=>U^99Y*HMZ~=h>mt8%BRwsdEyeEqJ}0sZ=kW6q5fdRc8XZ z_?yiZ=6e7PH_d%@R%&|1osG`Pm>-WX%VQ}l)sUPdHce0TQW9yV^s20|do7usMGU>g zlVlz~x`-uy5A@aMTr(?f-Aa9#-!;V+7s#D`;%+{c7x876o zEiB%~A{Rb%ogK*#C4d`HFfBkNY^`Atg4=u7MVsQopD>q0zT?KP)ZmZPpCrP*;c>0q zM!lU5Z4N9S0)l{W2enk4-kqvxbzL~;n5X>@TNiGh^R6L4j z8^FNrI%rPps07Z-D{+!tixnPeemq#Sky$!5!|bCA%<|KjT#RzCa&`Az&adF(A8PVD zo=@%$%rZV5=D}WJ*7LigyRs!E)F#y2Gbk@YkD? zIrcXPcm0mb+$|`P{o+LDRY^9SvS;T#{IszvBIzwHzX9ku8C1eXI3O?ua(* zR-)8Cous_nF3>_R(qp&XnUQNY(Uc_|-Oh++U1uw-g0fpuxOPG%hY6DPbv|y^xa$pH zs21YtT$<5hx-4{|of_waGzp?Ia@yqPQod=CbR@n9f_2eoxkEbwuk5`ihj-0RSq!n+ zJsM99vgPu3uQ|6OuLDTJWcWyIO{T54G^xkNv3jD~oU zGfak z0fw_jcllyUTh+2IUcBqbdx2TSF|xkP<^?sW9#Ly-mG)Zu3p8Xo{*%1R_du*4C?_h^ zf2b!A@=&&*erxX0-FK=r^raSgv7`JuQH^@ymu$Sxhjj(6fO%nnNw9p`0?4;%)MF|;=*qR9IXg*Pb{zW zFZOlr0m}qm*CDT*2Sm`3m7d}?u^YQQRjd)8B5CTOYPrYrH8d}S7~Xt`A2;bPjFi|L zRDP!=R5nl74l&v#QgRt@u+#M@aw$O*mgxV*z8M5fH&*SuKKS<86LVE;_mNGQc-7;s zsD{?C_fzkyOr}^1+IA~<+?9pzPRh{pG@u7~fu_-a^9h)lgjm(}dwyKRu3 zxdkVZA}maCdjZ4DBo2!UaucR0-=8YlackVkAqh@bBccrW)X;Gv>Z{Ye@SR3r>gD(= zIvR`xI$5!*jhMv4m}!k_(`hsQfY47;{dsY6x03e_1wwim@m)>)iWa&{W|n5f*^%GVS|{q- zI^s!2M7OQnM4nTVC;2$1?l3*jR^WLial8Po9Q~?1J($N;<#pvDX-G({ME>L~wQwkh zM*K-OBg|*@JTawW<7YwKY*mvP@&*v#a9Y`(ZoU&lzya0wpVM1pPC`Xh0^Ee~GTpCq zcQ5KzcCi;8Z_36wd=Yyek&qxO-%fm`z50X!=6R#ClNx4#Vcvqmh1sP+unb3yUw8OX ziBa;^ZLav&$_AIhlY_uwFn&jRKwWrw1!$k1i2qq>V*QEeW^>(IPliWZbx>T062Gd0 zwX+#d5qG4X{CAs}gcKb^~1e`34Ucy#*(Yl%pDU#R6Tvg7FM}|9%Sv5>Ek&hEF=7lN?O(xF| z_bymep`D#G4J`>nc_yTCAHG>~7?tES^*R?Hnldh_u1Gx8IK~gJG_P)$0-cMMDmmoT zntdYd>wELX$E>b+$6+UDc0}JW9-7?gYd2cKzdil3xjt_H6u~45gRyx;NW@5MP30m2=f9cghAFSTju%eUwTr9V}ajHxI>vVyCpDcCq*78${l>*nS&1w+%EX}g(C1Bac|gq zicED1Z@}soCt2wbfTm@jG}{Sox^8q-UD7gSdW-z45+=8&+3uSsE%C$F>6KtPO(CRD zN6qc?)3(qzdhu$gV4;15N`b8y4*vYp?uvLHD;rF&g(kv{IKLCu>~)ISaX6>HdCPHk zeAr>l9UC>R+Rr)t>GibEu}(Hckpwx`fU4U$DerJPn`}2pujAgB^TWtMiVTy<{m~KH zsK<~xB_(o(F2c~SU)QVsyQ+`yYguK)KC_zHV2YIot-QM=5kfrJNOIYEF(Z4sQh$5N zk~|pmls$GRH25&|tRmd_!KLQ(dFi0CVaM^T!iw(L=hQ9Dlc+`vQdC8o!I5M5`w?8I zcv}r=yi6Anwqdd3l;CS^s~*0Z%U+0ke1m_$>O0>I+Q-CLfhSTZ=F263@dk*0?dY-@SHfR{p$6O#>a1i8H?knqvg_T>G{{ z^?$;8+e_DO0!(il_7i3II-YP8csa(nJnM0A=rpkYP@Ydb&Vdw!r$5lUH+U+t&=60p z>aMRVTAP!5Yy35JTfEdlJkr0&y^i%4s#^(+NmEgEiyMY2O7;bkGaoy3y!p|+l(N); zmV5!&Sd%}CdQkzU`nqj=`PN_GCSc9hG26Myz9<95?Y8yxu>4k=1ba@)u}XrcPX$`p zjqaThBf-dl+*wJZBgx{EW8Nf=9;5?hdj+Fc^`;#N~oBT|l3Lqx`ow7l=n`~zQTgJ~r@VlC)b)KK8(*6~-&EDOy zVJAgl{HOj;+iJ5u7l|9Sz2QJ`%R8jLwSs`45^%_-GuB=DY)22;qqxGwHfA{O z(k$3w_3*8Ll9*jt_Q{?>A2y%hEJ0Qo=2`;ZS>?~L)&^zXMUm$BcIK!qWSKPgfMSfK z&@O*KVc+hLlj03n+6%wKmdjIdzg5T9C*O{GDoeo>15oxkL+i$DlxNV0vA7MijgZ*)jHUamDxtO6*HSJI(yc zaS|hi5dRy-Dw!Jx7_XB1#_VAJ{CiJE*DADmI7;B7<8PWBin^0}%bjv*56R~IatfsN ztH)I~-vE`8DwgO6(yx6Nl~aFy5{3emNlrF3K~RehIO#YD zv|s+IK`En>)wNY7b}r|OPHS;&tNMtGDBSkUI8-w^4cAZTvEGcF$gzM{ zD~TM^&!!req6M1Xy~s}yLVb480qQ%a-X3jzd+n9WIawJcH?u^fgu956>G^D-p~Cq& zFJf)TX;JH`5p@K{7BCGeSTL=~DdC`Ds;bIjyc?<>0BWfGV^0zfhkd8h)ZJ$ratbYf zzO~T2^q$;3k#6P_Oc9FZXU|Zg4Ab-rOFF((e3S=(*St+Tid9Q@47@4>P_x>DaVI{0 z-%2g!*RP0(;cwvP{ycFYb2#FTj7*uJ`ho`^7us;=<)GKB6tMM;PRL0=>&*<(aA3;5 zhUrnFI`@`o;!#7EPW^Bw^o$7+4`%!RRb0?~Svq8i^^N$6Fm>bEMd>w7sVix$qjh~l zy35>qH1l3YziE_4NJ4!~aZKN%rpFJudhb>Y(@}4QuHiAruM!p9C|JcmA*o@uk1$+K zC(81=>qulCkEI$LE9WP z`0D-=p+P2AEGrQOu}c_u{R(=rb_}ym)S4Lgp5>q2hVviGw4Ar>Y?GWq?M{L!-8Ky~ z^6mj;MhVip#9-5G+DGTu4s9eOSun=Wq>NyczHrYYs_g_uzFrH9X~`{wJHV+RDM^i$EAKj&ZU-g!tE zW$<;Xzh7hWQRI{}bXXeh)eSOpUqLKJ9t>N&GDokozwN#etnnA%#Q-U1M$Y}?R3>Nq3r z0egx0wLRK4Na-O`7FXQnPXcM-;3-IkX17A3=o~VXq72Z8dda;!Z}O-|3e3Tam~!7+ zG=#BxrXLG$m@V?Ixm>P^>*mG`E+`Vc^$yzf(GO(f>0(vYwrR_&TMcmdv}+Jh_m2Mq z^kQTvz+`bjdsAD|f%jW+|8fE^AGCG-*rcVUNB7Sad(UP%c|zG8=+5+@hja5r3pB*$s1bzk}SE&hI!X zy{&7?r1?%FpL}L;Ln9(wnIMV(i-zgwFctzb>{_IqsCk>z!|taIW#J6Bc6;U1tG(Kq zK*KuzIPxk&LqnM1M%3{h_$9C*LqT;`=1B`pALfykv$EB1LF&B+Y)r;+LI=$kX4cZL zraM~c#xoF~U85lx+gy$e+#80F{rs;{k6v$hb29*L>=S7{f#f&hdea>EefUdKD>_+W z7RS36w$MNte~q^^pBLiqj^not;2dOcEAX-VyWJ7{m5{@K!dcpLGWK*vLJ@nFXvZ2& zN!{Yauuk}-R{i7W{P|7yJcGKg8Tvf(9)L?^v)1Lkvbsg##FKhVP1_W+rudY*pe6A^ z_V6Y$sv{nJCkghnF>|}-*JcU~Q6H%I)@-jg8)Lb8#@L6ftd3uf&daWR31)DouB3Wh z{LA;OLQ-eBoH8dMZ6c{yOw8dLGnXG!x=q-Q{Oc>{;xET_H@(*7dZq>u;$c`B8+da& zsG8nyGX2%S46U8fJy2q?=R@;RVDy*QAzt0*d!R6$pnkGFK+b{Ae~k^Pf3@1*!r9aB znCoPiu*9^Zjz}KFv7as*Q%CcftpO#blDRbkC;wz1O3uXUiZ*>Kg|5C7TVznxiaYI> zYhqKG;GFmeLd>TP>s|N2f@FzQf#)K2ef_(hMv+iWC34h3{)ho0cK*CjGAhQon~w5RYrwlus~s&GCbb?uVxH`ai6qIT=*cGK(qw z`@dlT=K#eV+hCQ_L&dVyHDbm&U)%IUi})y58oN&*1HMX0mck2l1;1$!e{JKACOJL20>U6=Vow!*rn1lgS z?PtENh%kN2=`Z#R->X!_SA-rh$+qa5k@aR0RYS~3l`l!L2jvy%QjOP{jZis7`Hg5?hzWTY!#L~^j$Uus;X0EEX^U-wMl(>seJ;s7`Cty(lZGC;J zP$yloeC1t}60Z5ea`>ji5$Stj30`CzOPsh*gz3BGCeDyK!{NRV;Ys>L0st5$u9~>X zR(7XhZc8(a?+mhvHWS~A*vd%djM-lpef==rzRt$|A_JLF(z5pCJ*BD$Iys8Xb$~&K>YszRMT zLta5CZG7GE;qsx%pb6N?BD*t#Mr&iz@jWov|2BaYJ?y*F?65+mGtBj9aFsTi>%ijZ zEk#90;vCDZvQ2&J82Px*-Ix;X55qU|+vCZm-Y}&VmQKv_a)CR__H0@R?*sEBG0-=; zktglp(s*xa6)z3NP-|-C&9PAwc}nsMz~otatJ9oi@t+1=iFvdwbOhaAowS9vQour2 zaJja{4a?>n_>2tOsT`Qrt1-mCKBv!^X81%c(qH*$KR;{Y>CID?#^m6uY0;`rfsF6# z0%eS26ldl*f_>9ZR^F=XG}Q7@i!1AEr|Sl!B#sKq!~kQ`%@@F=Z0iT92a^#N4H0KW zNe?Ibe%Oyf99@Ere@xyya(AD+rR*mS{kiVVA<=dbHIBZA}pHgO;w;Dcuo5!DDHZt%3w5TAg(rNcZe7ZwO z&?|^!-^mlhWOIl-rmCplEc%*OVai{`=ZiyMBW;+|9%4=Jvvh!MrNlHXuRK_s2A!VRWNB3~^@b(->>a5^$pcw*6y2)iV}Vz-5!G6G{O6Y`x1mx; zI}rrt8!8qdis_6qm5cu+`&@_|`8hp1w?XCRnzS*-ITjV}Z8 zuW{fhQL7%~$*azh+*^<|_0*x}evWpsEUcqE7V_aBtZRER|Chf8nhm~`2rz+&bS}#p znJOaIuQs`n~afgF;r0%;HE+kkzHL4Ai zrSdQBotO|3o$##-WsZXyzuZ~19o1K&Q+jfGs>IHAa?o{D7~H-*oe`7!wg6KUlBF>F zs|h-HCDo#L@vT|MLL*)p@z6eF8G11khQdIyy^3{s3e&cW9HK?zQuXD3niuJ zH`|u1Nx`&s3pEczLxW9o`EDN^vqanqa78RrJ7|vIO7O{lwY?ne2J>$Omf{ZbF!QMB z{=j*5ZT=Op%bpg^VG$F?esmA?1QNF~a$v@M=a!A0K@yTB720f; zzfBPl1qmSWlb``9Ec5+%(NI6HJ=!Jv48_Ie`F=0U_Tg;Yn&MPmBc!zk65pdUy)RJv zIn?n|a6EDAVT@CX9x-5pp*z)*u{If=M!T1>TEE^Hqd15=1Sv~K`iPRl(A$)X?u0>g zswext@<-fteNp|B`rR*WgM4?IiFKUdFn>e@lzZKV;xc5M&D$>kh=2I-5(hC^odsewswdnq%Hd;51)?)bq^9 zJszQo>6m7BrLsq?TxYBU_vOO&q2uV_(>U>i`LcGop%~hc@__LhG1$(C;Wt=(DL5S7 zF?_w-Wp12UiZ~PEKaqbQmXl1GQ^ML%(Pn_r7#o>#>Wv5ZWj8EKp&EcmJBjQB2|8`8 z82356s^m|Jtv9kZ5>k_7#jCRmPb;oK1+Kk=Fpq*zqodni9{Y5o(7T3?oN3~6=b%C* z=9!AJti}~CwVW;elL^Hs>**LsBb%IcCu)Y&5yeC_j(a$R_`24rpU#Fp=EdV|?#Ei~ z91+vW{gC3C(UemK)>dcpT-j`6_DOrY7N;8Li=z1=x#O~b^W}b+CpweD8J)Yy_*xNY z1y)>sm(;PO{4F!8e1HGVNg`H^WAF0>6-mgtBuZV#<;CYCfv`P7WBr9)*LHDUoU+J) zD-E%jVACR9)9QPmQ>mIAu`}0E0o@}tELZrtxWb-HWU8~mB0j6CJGwfJo zIaWXB4C}tzEN~?rN{9B8O&znnWt$ZdKTYfo5PZnd#etJ2S#D@}DaEo%!`HFu{=uB* zxQ;E!TgP`!*Wqrf--HH+dCcDRwrN}4RwtQY?hsEe=sP-WdeQ{*?qjo1{t)g(i*-8u zOBwBt2BXilPg7JvS~DQWTW^dXeXMkR|5Y2`+BK(W$ivHo4;H`A^*idQ$irVv`heqW~U_;8N}xo+QR*DW7qkaZ!vk!LXe5~(5@ zteE7bbS7R>U*e+sK0e?4TNrRRvoKA(nnM!!*q^252(4{}me~Gir&GN;X=+z#Tn@^@ zwjAem6fvI|4Ri02qLzFNyVy|@%d%F&CdVUH`WcGYrSep>85m!V#A#1Ep>= z{4Cd7KQ!udU$R}ME%)U=xmJfWv?akSd{U}e2jIhkr#7f7O}qC1KJ4udlw*2ys8G38 z|I^$>#%tcH`Jx^SwrBnikZp=eXqcxBHKP@r#9w&cG`OEOk8mUwi+!M;ryDtn@m$uO zZ~0<`9`xN%Rb^W5@f`-0d?P?$4LnnNk7G~YcXS)QYsyh0*Au-G(?t=fM8(22gQvYI{0-bjD5)7hdkEP1hVq=3)wtt0z1xn zIF(kcv)x3ey|v?_3m(7R8~bG+LH*?JMOjZDvlRpd!1nBw6AXlWl_*6bP}M?#jFlU8hXNS_vTiRIfLE^2;EvU-WxzE6zum^TVOU8iI^A4g z`TdVMt)tM-JEjMq6 zRB*a_t{=;gpDpqG(ORCHH=eIoMHK%p8#|#+XZGYqEDa+fPpG7SXoPqDwyE zXRy#_`SA1fYi9%m2HXQb&K#!Q-jX_}IiHAZdr)E<>K{xEPud`R9TSCb)jli9Ev)0I zdDv{L(Dzye3B9mVVA6=8A5afY4o5kTL#)Va8VXN_@`k(2YThjZC0P{y-!^n?wRTnb zbiEtWjt*Bve~SjJ~7j3588QqyjWm`ZK7;Z2lQH|MFAdU~|r;yY6}hdOoL&Vrz6Cew2xR4nItvR*j)}Vc*jOAAk?6BlqHAA`7Fq zjx}$!)8c!8A#)%vseP1G%*~UxF-UZ=^-R7+{ol*O#$Ma)8^0r6@Y&##M8;jVdUK&Z z0-NTf(h>B~+HhDp8owP*pKxI(SVOtexb;Nrdzc>Y@pa!0*#-4Q^b;jlGqRGC)3i=h z!RnOKg>6Fi-g+(~_sA~GjYqHWJ1{*onyVRk@(xR7FP!elkYS^IUdWDvC2DT{$%4Y} zsEeOx<>z*&$3%8o8{!Khj{gN~y_RdVGJ7D4Cwin~)`z>s{zoyvP03diKX;DjA7P5) zQpViIk4#*{iMIqV1TPH|%tu(C5{!&;7xhkk3SeZ3^q8`XaV_o3c(CO%mpJ0|7OtJ2 zrOfTmDL)DE5m;!Cjs>AY*RMI0XcAj8)X3DK!1 zpFQMrHn7$~=ps_(@}LUB8R;M&iY;M0Rpu;lYJG^02QzrU70S|#eYJK|hnGi<)a_4v zOe6&>5s0}vgov=fQ5+7?a->+bkp+%zx{5Bqow~@vd{tY!rubdz&2)FFi_NUX@Nr`w z?jKjqnvD*$L{h?MT^CbnAXSbeEh&F1}THYDxyq zH2;+uMC>d1(P1lac$%*)mZ}QaeoVz9(u)ppTNlWD*w|?B5tgQuolmM8G`3Bjmb?c?)>X^iRmwQCF>L03uQEmi7zo`?_3Iy&Ll>Rj!iLbO*oE; z!wbC&=3o&zb-YdiA4p`w!fV3{a*pW2R`_}3*STWU+nHm?`3P#LSmz9CsMI2oQim0Ed7F z8TF$quNXH|nYh~4ZRzIkrQeWdF`ZPYxTP!J=_T^hqCTcC^5;1<8k4zlYr>-V<>6bO z4%+Fq-)ghfhRCiiu5H?1Cyca=tM`fY_pYDA{{RuZKYy=9Z++rT9W9#Kq%tbBZXb3P z2xE^^UcEeJ8A{3Sc~vk~Vw-&rQ{99l@^evc&*fZw&x`Ej)+L8Whx=;ECRpT}-sUjI zLNkDb@D&7#NwPyjJb znHEcOjnS6}>0HIPigZiKZPGjV(n&}WM=CUK#GDKU0Q1_qN!-8?+_uO#H}xfQ*%QOhKVr5V_<=e;9Y!q)P|$XOgSka;9ypRW~TBRM~f zDQ@6bMLaZP3ok#!&UK{ad;b7PuMA5Iy8x?_eo#I0RUKt*W*JzWishFF{fuD#wRy?F zJ*yj0)%49V;~Itay^(g>o^$O4p4p{{q?IV9?W!FKPE{q!uG;8r#>9d>4N0C!&w9?a zxr%vYSmlY_07zE_fITuhRq?>@UGU|59J9LJ9=?1%IS#REP|iU9G%7*-E8{ChVcsIoLF(H4#Qz{g7Y^Txjjul!HrE6q&nD{7Z7xz(ZG!+62<6 z9`UWDI<~|Z6DcP zqcA8x!qEedY>Mc0tHD|lX?Zi^ydmtR%vdGxO4@8Q0Z`qWySvd;#i z3x|&8Mqx4$(++v|sQgXgTfY_fcp>L`}4(N>0p_(@S@-V>%`PTSM&b=AMB^L*} zcTIXdQ(tk(jLW^Zy=I@0#L1#Z1fowSYiGuHZD{`hUMg&AQR$LdL#t|0TRIeIg~M$i z_QiS+hU`39;lBr+4(+4yHk21+DX6hBM4dKo!7M(!k6QD%{43(m4}3#9zK5qR_lM;< zxY2cK%;=z=RyjWM^U9N)bm@$GG&A`*PBWu!%}H7QO?>q8JlW+lR%(BGfACEf*8Eld zv!~tMYd059X&`u>NYuKJ2pr>)&2_Eg?PFD+Oga zbTU{=xXQhLP4Eo3JzZ*Ug$e)rW|6 zX>4?YFK^>Q(%OXEGJtS$jf279j-sw#Xy(#Tx7JcxGkxDWJ)4iVde^ZWYI0DF(|xb2 z{LVK)B;4TF$okt(@kfU5d@FURHos;b-ZLc81;9)$?W%gW)}^(M(_GawU-(EgIU%=6 z)^N8C9Ey#Pmyk#;`Pat3*|x?vP@EitgTbo|+K1T9y6T#khk_#)Pl1k@=Zsa=e%hb2 zsJWNs{{YBT`DxFd4$t)RK7sJ(i0^eD8hFpfclNMBV?F$lLm(q5Z3}sEr~{MGoDOo; z>5Hhq=opz4p2j8z`B%hxZO*x6=0gszc8MLz%NnV`1z0lvM1D2sQ2bN)f{+Co#81h| fYj98Vt#BBK!Y<0!*KWN`v2;1-d*0f7x*z}9I;jH( literal 0 HcmV?d00001 diff --git a/node_modules/request/tunnel.js b/node_modules/request/tunnel.js new file mode 100644 index 0000000..3f7bbb9 --- /dev/null +++ b/node_modules/request/tunnel.js @@ -0,0 +1,227 @@ +'use strict' + +var net = require('net') + , tls = require('tls') + , http = require('http') + , https = require('https') + , events = require('events') + , assert = require('assert') + , util = require('util') + ; + +exports.httpOverHttp = httpOverHttp +exports.httpsOverHttp = httpsOverHttp +exports.httpOverHttps = httpOverHttps +exports.httpsOverHttps = httpsOverHttps + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options) + agent.request = http.request + return agent +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options) + agent.request = http.request + agent.createSocket = createSecureSocket + return agent +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options) + agent.request = https.request + return agent +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options) + agent.request = https.request + agent.createSocket = createSecureSocket + return agent +} + + +function TunnelingAgent(options) { + var self = this + self.options = options || {} + self.proxyOptions = self.options.proxy || {} + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets + self.requests = [] + self.sockets = [] + + self.on('free', function onFree(socket, host, port) { + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i] + if (pending.host === host && pending.port === port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1) + pending.request.onSocket(socket) + return + } + } + socket.destroy() + self.removeSocket(socket) + }) +} +util.inherits(TunnelingAgent, events.EventEmitter) + +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { + var self = this + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push({host: host, port: port, request: req}) + return + } + + // If we are under maxSockets create a new one. + self.createSocket({host: host, port: port, request: req}, function(socket) { + socket.on('free', onFree) + socket.on('close', onCloseOrRemove) + socket.on('agentRemove', onCloseOrRemove) + req.onSocket(socket) + + function onFree() { + self.emit('free', socket, host, port) + } + + function onCloseOrRemove(err) { + self.removeSocket() + socket.removeListener('free', onFree) + socket.removeListener('close', onCloseOrRemove) + socket.removeListener('agentRemove', onCloseOrRemove) + } + }) +} + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this + var placeholder = {} + self.sockets.push(placeholder) + + var connectOptions = mergeOptions({}, self.proxyOptions, + { method: 'CONNECT' + , path: options.host + ':' + options.port + , agent: false + } + ) + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {} + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64') + } + + debug('making CONNECT request') + var connectReq = self.request(connectOptions) + connectReq.useChunkedEncodingByDefault = false // for v0.6 + connectReq.once('response', onResponse) // for v0.6 + connectReq.once('upgrade', onUpgrade) // for v0.6 + connectReq.once('connect', onConnect) // for v0.7 or later + connectReq.once('error', onError) + connectReq.end() + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head) + }) + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners() + socket.removeAllListeners() + + if (res.statusCode === 200) { + assert.equal(head.length, 0) + debug('tunneling connection has established') + self.sockets[self.sockets.indexOf(placeholder)] = socket + cb(socket) + } else { + debug('tunneling socket could not be established, statusCode=%d', res.statusCode) + var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode) + error.code = 'ECONNRESET' + options.request.emit('error', error) + self.removeSocket(placeholder) + } + } + + function onError(cause) { + connectReq.removeAllListeners() + + debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack) + var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message) + error.code = 'ECONNRESET' + options.request.emit('error', error) + self.removeSocket(placeholder) + } +} + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) return + + this.sockets.splice(pos, 1) + + var pending = this.requests.shift() + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket) + }) + } +} + +function createSecureSocket(options, cb) { + var self = this + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, mergeOptions({}, self.options, + { servername: options.host + , socket: socket + } + )) + cb(secureSocket) + }) +} + + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i] + if (typeof overrides === 'object') { + var keys = Object.keys(overrides) + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j] + if (overrides[k] !== undefined) { + target[k] = overrides[k] + } + } + } + } + return target +} + + +var debug +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments) + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0] + } else { + args.unshift('TUNNEL:') + } + console.error.apply(console, args) + } +} else { + debug = function() {} +} +exports.debug = debug // for test diff --git a/node_modules/request/uuid.js b/node_modules/request/uuid.js new file mode 100644 index 0000000..fc0588b --- /dev/null +++ b/node_modules/request/uuid.js @@ -0,0 +1,19 @@ +module.exports = function () { + var s = [], itoh = '0123456789ABCDEF' + + // Make array of random hex digits. The UUID only has 32 digits in it, but we + // allocate an extra items to make room for the '-'s we'll be inserting. + for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10) + + // Conform to RFC-4122, section 4.4 + s[14] = 4; // Set 4 high bits of time_high field to version + s[19] = (s[19] & 0x3) | 0x8 // Specify 2 high bits of clock sequence + + // Convert to hex chars + for (var i = 0; i <36; i++) s[i] = itoh[s[i]] + + // Insert '-'s + s[8] = s[13] = s[18] = s[23] = '-' + + return s.join('') +} diff --git a/node_modules/request/vendor/cookie/index.js b/node_modules/request/vendor/cookie/index.js new file mode 100644 index 0000000..ff44b3e --- /dev/null +++ b/node_modules/request/vendor/cookie/index.js @@ -0,0 +1,65 @@ +/*! + * Tobi - Cookie + * Copyright(c) 2010 LearnBoost + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var url = require('url'); + +/** + * Initialize a new `Cookie` with the given cookie `str` and `req`. + * + * @param {String} str + * @param {IncomingRequest} req + * @api private + */ + +var Cookie = exports = module.exports = function Cookie(str, req) { + this.str = str; + + // Map the key/val pairs + str.split(/ *; */).reduce(function(obj, pair){ + var p = pair.indexOf('='); + var key = p > 0 ? pair.substring(0, p).trim() : pair.trim(); + var lowerCasedKey = key.toLowerCase(); + var value = p > 0 ? pair.substring(p + 1).trim() : true; + + if (!obj.name) { + // First key is the name + obj.name = key; + obj.value = value; + } + else if (lowerCasedKey === 'httponly') { + obj.httpOnly = value; + } + else { + obj[lowerCasedKey] = value; + } + return obj; + }, this); + + // Expires + this.expires = this.expires + ? new Date(this.expires) + : Infinity; + + // Default or trim path + this.path = this.path + ? this.path.trim(): req + ? url.parse(req.url).pathname: '/'; +}; + +/** + * Return the original cookie string. + * + * @return {String} + * @api public + */ + +Cookie.prototype.toString = function(){ + return this.str; +}; diff --git a/node_modules/request/vendor/cookie/jar.js b/node_modules/request/vendor/cookie/jar.js new file mode 100644 index 0000000..34920e0 --- /dev/null +++ b/node_modules/request/vendor/cookie/jar.js @@ -0,0 +1,72 @@ +/*! +* Tobi - CookieJar +* Copyright(c) 2010 LearnBoost +* MIT Licensed +*/ + +/** +* Module dependencies. +*/ + +var url = require('url'); + +/** +* Initialize a new `CookieJar`. +* +* @api private +*/ + +var CookieJar = exports = module.exports = function CookieJar() { + this.cookies = []; +}; + +/** +* Add the given `cookie` to the jar. +* +* @param {Cookie} cookie +* @api private +*/ + +CookieJar.prototype.add = function(cookie){ + this.cookies = this.cookies.filter(function(c){ + // Avoid duplication (same path, same name) + return !(c.name == cookie.name && c.path == cookie.path); + }); + this.cookies.push(cookie); +}; + +/** +* Get cookies for the given `req`. +* +* @param {IncomingRequest} req +* @return {Array} +* @api private +*/ + +CookieJar.prototype.get = function(req){ + var path = url.parse(req.url).pathname + , now = new Date + , specificity = {}; + return this.cookies.filter(function(cookie){ + if (0 == path.indexOf(cookie.path) && now < cookie.expires + && cookie.path.length > (specificity[cookie.name] || 0)) + return specificity[cookie.name] = cookie.path.length; + }); +}; + +/** +* Return Cookie string for the given `req`. +* +* @param {IncomingRequest} req +* @return {String} +* @api private +*/ + +CookieJar.prototype.cookieString = function(req){ + var cookies = this.get(req); + if (cookies.length) { + return cookies.map(function(cookie){ + return cookie.name + '=' + cookie.value; + }).join('; '); + } +}; diff --git a/src/app.js b/src/app.js index 4bd7fd9..846b125 100644 --- a/src/app.js +++ b/src/app.js @@ -1,39 +1,43 @@ var fs = require('fs'); +var request = require('request'); +var qs = require('querystring'); var express = require('express'); var app = express(); -var passport = require('passport'); -var GitHubStrategy = require('passport-github').Strategy; - var config = eval('(' + fs.readFileSync('../config/app.config', 'utf8') + ')'); -passport.use(new GitHubStrategy({ - clientID: config.github.client_id, - clientSecret: config.github.client_secret - }, - function(accessToken, refreshToken, profile, done) { - console.log("accessToken: "+accessToken); - console.log("refreshToken: "+refreshToken); - console.log(profile); - done(null,profile); - } -)); - app.configure(function() { app.use(express.cookieParser()); app.use(express.bodyParser()); - app.use(express.session({ secret: config.session.secret })); - app.use(passport.initialize()); - app.use(passport.session()); }); -app.get("/github-login", passport.authenticate('github')); -app.get("/github-auth",function(req,res) { - console.log("github callback"); - console.log(req.params); - passport.authenticate('github', { failureRedirect: 'http://sdether.github.com/josh.js/githubconsole.html' }); - res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); +app.get("/github", function(req, res) { + res.redirect("https://github.com/login/oauth/authorize?client_id=" + config.github.client_id); +}); +app.get("/github-token", function(req, res) { + var token = req.cookies.access_token; + console.log("token: " + token); + res.set('Access-Control-Allow-Origin', 'http://sdether.github.com/'); + res.send({access_token: token}); +}); + +app.get("/github-auth", function(req, res) { + console.log("code: " + req.query.code); + request({ + method: 'post', + uri: 'https://github.com/login/oauth/access_token', + qs: { + client_id: config.github.client_id, + client_secret: config.github.client_secret, + code: req.query.code + }, + headers: { + Accept: 'application/json' + } + }, function(error, response, body) { + console.log(body); + body = JSON.parse(body); + res.cookie('access_token', body.access_token); + res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); + }); }); -app.get("/@session", function(req,res) { - res.send(req.session); -}) app.listen(80); \ No newline at end of file From 440c6fd7ecaef3ed3ccdbb6344de6738e4420da5 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Tue, 19 Feb 2013 06:41:20 -0800 Subject: [PATCH 05/11] removing unneeded npm modules --- node_modules/.bin/jade | 1 - node_modules/everyauth/.gitignore | 7 - node_modules/everyauth/Makefile | 6 - node_modules/everyauth/README.md | 2681 ------------ node_modules/everyauth/documentup.json | 3 - node_modules/everyauth/example/conf.js | 119 - node_modules/everyauth/example/server.js | 435 -- .../everyauth/example/views/home.jade | 181 - .../everyauth/example/views/layout.jade | 9 - .../everyauth/example/views/login.jade | 13 - .../everyauth/example/views/register.jade | 14 - node_modules/everyauth/index.js | 162 - .../everyauth/lib/modules/37signals.js | 51 - node_modules/everyauth/lib/modules/500px.js | 17 - .../everyauth/lib/modules/angellist.js | 49 - .../everyauth/lib/modules/azureacs.js | 157 - node_modules/everyauth/lib/modules/box.js | 161 - node_modules/everyauth/lib/modules/dropbox.js | 18 - node_modules/everyauth/lib/modules/dwolla.js | 64 - .../everyauth/lib/modules/evernote.js | 24 - .../everyauth/lib/modules/everymodule.js | 365 -- .../everyauth/lib/modules/facebook.js | 86 - .../everyauth/lib/modules/foursquare.js | 56 - node_modules/everyauth/lib/modules/github.js | 50 - node_modules/everyauth/lib/modules/google.js | 132 - node_modules/everyauth/lib/modules/google1.js | 60 - .../everyauth/lib/modules/googlehybrid.js | 63 - node_modules/everyauth/lib/modules/gowalla.js | 62 - .../everyauth/lib/modules/instagram.js | 39 - .../everyauth/lib/modules/justintv.js | 24 - node_modules/everyauth/lib/modules/ldap.js | 28 - .../everyauth/lib/modules/linkedin.js | 66 - .../everyauth/lib/modules/mailchimp.js | 67 - node_modules/everyauth/lib/modules/mailru.js | 91 - .../everyauth/lib/modules/mendeley.js | 45 - node_modules/everyauth/lib/modules/mixi.js | 73 - node_modules/everyauth/lib/modules/oauth.js | 268 -- node_modules/everyauth/lib/modules/oauth2.js | 317 -- node_modules/everyauth/lib/modules/openid.js | 106 - node_modules/everyauth/lib/modules/osm.js | 40 - .../everyauth/lib/modules/password.js | 379 -- .../everyauth/lib/modules/readability.js | 28 - node_modules/everyauth/lib/modules/skyrock.js | 24 - .../everyauth/lib/modules/soundcloud.js | 40 - node_modules/everyauth/lib/modules/tripit.js | 45 - node_modules/everyauth/lib/modules/tumblr.js | 26 - node_modules/everyauth/lib/modules/twitter.js | 56 - node_modules/everyauth/lib/modules/vimeo.js | 20 - .../everyauth/lib/modules/vkontakte.js | 47 - node_modules/everyauth/lib/modules/yahoo.js | 32 - node_modules/everyauth/lib/promise.js | 93 - .../everyauth/lib/routeTriggeredSequence.js | 14 - node_modules/everyauth/lib/step.js | 171 - node_modules/everyauth/lib/stepSequence.js | 198 - node_modules/everyauth/lib/utils.js | 35 - .../everyauth/lib/views/auth-fail.jade | 1 - node_modules/everyauth/media/37signals.ico | Bin 2862 -> 0 bytes node_modules/everyauth/media/500px.ico | Bin 427 -> 0 bytes node_modules/everyauth/media/angellist.ico | Bin 9326 -> 0 bytes node_modules/everyauth/media/box.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/dropbox.ico | Bin 2550 -> 0 bytes node_modules/everyauth/media/dwolla.ico | Bin 556 -> 0 bytes node_modules/everyauth/media/evernote.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/facebook.ico | Bin 318 -> 0 bytes node_modules/everyauth/media/foursquare.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/github.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/google.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/gowalla.ico | Bin 472 -> 0 bytes node_modules/everyauth/media/instagram.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/justintv.ico | Bin 586 -> 0 bytes node_modules/everyauth/media/linkedin.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/mailru.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/mendeley.ico | Bin 1406 -> 0 bytes node_modules/everyauth/media/mixi.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/openid.ico | Bin 3638 -> 0 bytes node_modules/everyauth/media/osm.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/readability.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/skyrock.ico | Bin 7886 -> 0 bytes node_modules/everyauth/media/soundcloud.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/tripit.png | Bin 500 -> 0 bytes node_modules/everyauth/media/tumblr.jpg | Bin 509 -> 0 bytes node_modules/everyauth/media/twitter.ico | Bin 1150 -> 0 bytes node_modules/everyauth/media/vimeo.gif | Bin 967 -> 0 bytes node_modules/everyauth/media/vkontakte.ico | Bin 894 -> 0 bytes node_modules/everyauth/media/yahoo.ico | Bin 318 -> 0 bytes node_modules/everyauth/package.json | 50 - node_modules/everyauth/test/creds.dummy.js | 18 - node_modules/everyauth/test/facebook.tobi.js | 57 - node_modules/everyauth/test/mailchimp.tobi.js | 38 - .../everyauth/test/password.satisfy.js | 121 - node_modules/everyauth/test/password.tobi.js | 143 - node_modules/everyauth/test/promise.test.js | 48 - .../everyauth/test/soundcloud.tobi.js | 38 - node_modules/everyauth/test/twitter.tobi.js | 42 - node_modules/everyauth/test/util/expect.js | 412 -- node_modules/everyauth/test/util/satisfy.js | 102 - node_modules/jade/.npmignore | 14 - node_modules/jade/LICENSE | 22 - node_modules/jade/Readme.md | 1298 ------ node_modules/jade/Readme_zh-cn.md | 921 ----- node_modules/jade/bin/jade | 168 - node_modules/jade/index.js | 4 - node_modules/jade/jade.js | 3654 ----------------- node_modules/jade/jade.md | 510 --- node_modules/jade/jade.min.js | 2 - node_modules/jade/lib/compiler.js | 655 --- node_modules/jade/lib/doctypes.js | 18 - node_modules/jade/lib/filters.js | 105 - node_modules/jade/lib/inline-tags.js | 28 - node_modules/jade/lib/jade.js | 253 -- node_modules/jade/lib/lexer.js | 775 ---- node_modules/jade/lib/nodes/attrs.js | 77 - node_modules/jade/lib/nodes/block-comment.js | 33 - node_modules/jade/lib/nodes/block.js | 122 - node_modules/jade/lib/nodes/case.js | 43 - node_modules/jade/lib/nodes/code.js | 35 - node_modules/jade/lib/nodes/comment.js | 32 - node_modules/jade/lib/nodes/doctype.js | 29 - node_modules/jade/lib/nodes/each.js | 35 - node_modules/jade/lib/nodes/filter.js | 34 - node_modules/jade/lib/nodes/index.js | 20 - node_modules/jade/lib/nodes/literal.js | 32 - node_modules/jade/lib/nodes/mixin.js | 36 - node_modules/jade/lib/nodes/node.js | 25 - node_modules/jade/lib/nodes/tag.js | 95 - node_modules/jade/lib/nodes/text.js | 36 - node_modules/jade/lib/parser.js | 699 ---- node_modules/jade/lib/runtime.js | 174 - node_modules/jade/lib/self-closing.js | 19 - node_modules/jade/lib/utils.js | 68 - node_modules/jade/node_modules/.bin/cake | 1 - node_modules/jade/node_modules/.bin/coffee | 1 - .../node_modules/coffee-script/.npmignore | 11 - .../jade/node_modules/coffee-script/CNAME | 1 - .../coffee-script/CONTRIBUTING.md | 9 - .../jade/node_modules/coffee-script/LICENSE | 22 - .../jade/node_modules/coffee-script/README | 51 - .../jade/node_modules/coffee-script/Rakefile | 78 - .../jade/node_modules/coffee-script/bin/cake | 7 - .../node_modules/coffee-script/bin/coffee | 7 - .../coffee-script/extras/jsl.conf | 44 - .../lib/coffee-script/browser.js | 92 - .../coffee-script/lib/coffee-script/cake.js | 113 - .../lib/coffee-script/coffee-script.js | 171 - .../lib/coffee-script/command.js | 502 --- .../lib/coffee-script/grammar.js | 606 --- .../lib/coffee-script/helpers.js | 88 - .../coffee-script/lib/coffee-script/index.js | 11 - .../coffee-script/lib/coffee-script/lexer.js | 788 ---- .../coffee-script/lib/coffee-script/nodes.js | 2971 -------------- .../lib/coffee-script/optparse.js | 138 - .../coffee-script/lib/coffee-script/parser.js | 683 --- .../coffee-script/lib/coffee-script/repl.js | 276 -- .../lib/coffee-script/rewriter.js | 349 -- .../coffee-script/lib/coffee-script/scope.js | 146 - .../node_modules/coffee-script/package.json | 35 - .../jade/node_modules/commander/.npmignore | 4 - .../jade/node_modules/commander/.travis.yml | 4 - .../jade/node_modules/commander/History.md | 107 - .../jade/node_modules/commander/Makefile | 7 - .../jade/node_modules/commander/Readme.md | 262 -- .../jade/node_modules/commander/index.js | 2 - .../node_modules/commander/lib/commander.js | 1026 ----- .../jade/node_modules/commander/package.json | 13 - .../jade/node_modules/mkdirp/.npmignore | 2 - .../jade/node_modules/mkdirp/.travis.yml | 4 - node_modules/jade/node_modules/mkdirp/LICENSE | 21 - .../jade/node_modules/mkdirp/README.markdown | 61 - .../jade/node_modules/mkdirp/examples/pow.js | 6 - .../jade/node_modules/mkdirp/index.js | 82 - .../jade/node_modules/mkdirp/package.json | 23 - .../jade/node_modules/mkdirp/test/chmod.js | 38 - .../jade/node_modules/mkdirp/test/clobber.js | 37 - .../jade/node_modules/mkdirp/test/mkdirp.js | 28 - .../jade/node_modules/mkdirp/test/perm.js | 32 - .../node_modules/mkdirp/test/perm_sync.js | 39 - .../jade/node_modules/mkdirp/test/race.js | 41 - .../jade/node_modules/mkdirp/test/rel.js | 32 - .../jade/node_modules/mkdirp/test/return.js | 25 - .../node_modules/mkdirp/test/return_sync.js | 24 - .../jade/node_modules/mkdirp/test/root.js | 18 - .../jade/node_modules/mkdirp/test/sync.js | 32 - .../jade/node_modules/mkdirp/test/umask.js | 28 - .../node_modules/mkdirp/test/umask_sync.js | 32 - node_modules/jade/package.json | 34 - node_modules/jade/runtime.js | 179 - node_modules/jade/runtime.min.js | 1 - node_modules/jade/testing/index.html | 5 - node_modules/jade/testing/index.jade | 4 - node_modules/jade/testing/layout.html | 1 - node_modules/jade/testing/layout.jade | 6 - node_modules/jade/testing/mobile.html | 0 node_modules/jade/testing/mobile.jade | 0 .../jade/testing/nested/something.html | 1 - .../jade/testing/nested/something.jade | 1 - node_modules/jade/testing/some.js | 4 - node_modules/jade/testing/test.md | 5 - node_modules/passport-github/.npmignore | 8 - node_modules/passport-github/.travis.yml | 4 - node_modules/passport-github/LICENSE | 20 - .../passport-github/examples/login/app.js | 122 - .../examples/login/package.json | 10 - .../examples/login/views/account.ejs | 4 - .../examples/login/views/index.ejs | 5 - .../examples/login/views/layout.ejs | 21 - .../examples/login/views/login.ejs | 1 - .../lib/passport-github/index.js | 15 - .../lib/passport-github/strategy.js | 106 - .../node_modules/passport-oauth/.travis.yml | 5 - .../node_modules/passport-oauth/LICENSE | 20 - .../node_modules/passport-oauth/README.md | 89 - .../errors/internaloautherror.js | 46 - .../lib/passport-oauth/index.js | 20 - .../lib/passport-oauth/strategies/oauth.js | 299 -- .../lib/passport-oauth/strategies/oauth2.js | 246 -- .../lib/passport-oauth/strategies/utils.js | 46 - .../node_modules/oauth/.gitignore | 1 - .../passport-oauth/node_modules/oauth/LICENSE | 8 - .../node_modules/oauth/Makefile | 7 - .../node_modules/oauth/Readme.md | 91 - .../oauth/examples/express-gdata/server.js | 168 - .../express-gdata/views/google_calendars.ejs | 21 - .../express-gdata/views/google_contacts.ejs | 24 - .../examples/express-gdata/views/layout.ejs | 9 - .../oauth/examples/term.ie.oauth-HMAC-SHA1.js | 31 - .../node_modules/oauth/index.js | 3 - .../node_modules/oauth/lib/_utils.js | 4 - .../node_modules/oauth/lib/oauth.js | 550 --- .../node_modules/oauth/lib/oauth2.js | 161 - .../node_modules/oauth/lib/sha1.js | 334 -- .../node_modules/oauth/package.json | 19 - .../node_modules/oauth/tests/oauth.js | 792 ---- .../node_modules/oauth/tests/oauth2.js | 67 - .../node_modules/oauth/tests/sha1.js | 13 - .../node_modules/passport-oauth/package.json | 35 - .../node_modules/pkginfo/.gitignore | 2 - .../node_modules/pkginfo/README.md | 85 - .../node_modules/pkginfo/docs/docco.css | 194 - .../node_modules/pkginfo/docs/pkginfo.html | 101 - .../pkginfo/examples/all-properties.js | 19 - .../pkginfo/examples/array-argument.js | 20 - .../pkginfo/examples/multiple-properties.js | 19 - .../pkginfo/examples/object-argument.js | 22 - .../pkginfo/examples/package.json | 10 - .../pkginfo/examples/single-property.js | 19 - .../node_modules/pkginfo/lib/pkginfo.js | 132 - .../node_modules/pkginfo/package.json | 17 - .../node_modules/pkginfo/test/pkginfo-test.js | 69 - node_modules/passport-github/package.json | 30 - node_modules/passport/.npmignore | 8 - node_modules/passport/.travis.yml | 5 - node_modules/passport/LICENSE | 20 - .../lib/passport/context/http/actions.js | 93 - .../lib/passport/context/http/context.js | 17 - .../passport/lib/passport/http/request.js | 91 - node_modules/passport/lib/passport/index.js | 412 -- .../lib/passport/middleware/authenticate.js | 253 -- .../lib/passport/middleware/initialize.js | 71 - .../lib/passport/strategies/session.js | 60 - .../passport/lib/passport/strategy.js | 33 - .../passport/node_modules/pkginfo/.gitignore | 2 - .../passport/node_modules/pkginfo/README.md | 85 - .../node_modules/pkginfo/docs/docco.css | 194 - .../node_modules/pkginfo/docs/pkginfo.html | 101 - .../pkginfo/examples/all-properties.js | 19 - .../pkginfo/examples/array-argument.js | 20 - .../pkginfo/examples/multiple-properties.js | 19 - .../pkginfo/examples/object-argument.js | 22 - .../pkginfo/examples/package.json | 10 - .../pkginfo/examples/single-property.js | 19 - .../node_modules/pkginfo/lib/pkginfo.js | 132 - .../node_modules/pkginfo/package.json | 17 - .../node_modules/pkginfo/test/pkginfo-test.js | 69 - node_modules/passport/package.json | 30 - 274 files changed, 33997 deletions(-) delete mode 120000 node_modules/.bin/jade delete mode 100644 node_modules/everyauth/.gitignore delete mode 100644 node_modules/everyauth/Makefile delete mode 100644 node_modules/everyauth/README.md delete mode 100644 node_modules/everyauth/documentup.json delete mode 100644 node_modules/everyauth/example/conf.js delete mode 100644 node_modules/everyauth/example/server.js delete mode 100644 node_modules/everyauth/example/views/home.jade delete mode 100644 node_modules/everyauth/example/views/layout.jade delete mode 100644 node_modules/everyauth/example/views/login.jade delete mode 100644 node_modules/everyauth/example/views/register.jade delete mode 100644 node_modules/everyauth/index.js delete mode 100644 node_modules/everyauth/lib/modules/37signals.js delete mode 100644 node_modules/everyauth/lib/modules/500px.js delete mode 100644 node_modules/everyauth/lib/modules/angellist.js delete mode 100644 node_modules/everyauth/lib/modules/azureacs.js delete mode 100644 node_modules/everyauth/lib/modules/box.js delete mode 100644 node_modules/everyauth/lib/modules/dropbox.js delete mode 100644 node_modules/everyauth/lib/modules/dwolla.js delete mode 100644 node_modules/everyauth/lib/modules/evernote.js delete mode 100644 node_modules/everyauth/lib/modules/everymodule.js delete mode 100644 node_modules/everyauth/lib/modules/facebook.js delete mode 100644 node_modules/everyauth/lib/modules/foursquare.js delete mode 100644 node_modules/everyauth/lib/modules/github.js delete mode 100644 node_modules/everyauth/lib/modules/google.js delete mode 100644 node_modules/everyauth/lib/modules/google1.js delete mode 100644 node_modules/everyauth/lib/modules/googlehybrid.js delete mode 100644 node_modules/everyauth/lib/modules/gowalla.js delete mode 100644 node_modules/everyauth/lib/modules/instagram.js delete mode 100644 node_modules/everyauth/lib/modules/justintv.js delete mode 100644 node_modules/everyauth/lib/modules/ldap.js delete mode 100644 node_modules/everyauth/lib/modules/linkedin.js delete mode 100644 node_modules/everyauth/lib/modules/mailchimp.js delete mode 100644 node_modules/everyauth/lib/modules/mailru.js delete mode 100644 node_modules/everyauth/lib/modules/mendeley.js delete mode 100644 node_modules/everyauth/lib/modules/mixi.js delete mode 100644 node_modules/everyauth/lib/modules/oauth.js delete mode 100644 node_modules/everyauth/lib/modules/oauth2.js delete mode 100644 node_modules/everyauth/lib/modules/openid.js delete mode 100644 node_modules/everyauth/lib/modules/osm.js delete mode 100644 node_modules/everyauth/lib/modules/password.js delete mode 100644 node_modules/everyauth/lib/modules/readability.js delete mode 100644 node_modules/everyauth/lib/modules/skyrock.js delete mode 100644 node_modules/everyauth/lib/modules/soundcloud.js delete mode 100644 node_modules/everyauth/lib/modules/tripit.js delete mode 100644 node_modules/everyauth/lib/modules/tumblr.js delete mode 100644 node_modules/everyauth/lib/modules/twitter.js delete mode 100644 node_modules/everyauth/lib/modules/vimeo.js delete mode 100644 node_modules/everyauth/lib/modules/vkontakte.js delete mode 100644 node_modules/everyauth/lib/modules/yahoo.js delete mode 100644 node_modules/everyauth/lib/promise.js delete mode 100644 node_modules/everyauth/lib/routeTriggeredSequence.js delete mode 100644 node_modules/everyauth/lib/step.js delete mode 100644 node_modules/everyauth/lib/stepSequence.js delete mode 100644 node_modules/everyauth/lib/utils.js delete mode 100644 node_modules/everyauth/lib/views/auth-fail.jade delete mode 100644 node_modules/everyauth/media/37signals.ico delete mode 100644 node_modules/everyauth/media/500px.ico delete mode 100644 node_modules/everyauth/media/angellist.ico delete mode 100644 node_modules/everyauth/media/box.ico delete mode 100644 node_modules/everyauth/media/dropbox.ico delete mode 100644 node_modules/everyauth/media/dwolla.ico delete mode 100644 node_modules/everyauth/media/evernote.ico delete mode 100644 node_modules/everyauth/media/facebook.ico delete mode 100644 node_modules/everyauth/media/foursquare.ico delete mode 100644 node_modules/everyauth/media/github.ico delete mode 100644 node_modules/everyauth/media/google.ico delete mode 100644 node_modules/everyauth/media/gowalla.ico delete mode 100644 node_modules/everyauth/media/instagram.ico delete mode 100644 node_modules/everyauth/media/justintv.ico delete mode 100644 node_modules/everyauth/media/linkedin.ico delete mode 100644 node_modules/everyauth/media/mailru.ico delete mode 100644 node_modules/everyauth/media/mendeley.ico delete mode 100644 node_modules/everyauth/media/mixi.ico delete mode 100644 node_modules/everyauth/media/openid.ico delete mode 100644 node_modules/everyauth/media/osm.ico delete mode 100644 node_modules/everyauth/media/readability.ico delete mode 100644 node_modules/everyauth/media/skyrock.ico delete mode 100644 node_modules/everyauth/media/soundcloud.ico delete mode 100644 node_modules/everyauth/media/tripit.png delete mode 100644 node_modules/everyauth/media/tumblr.jpg delete mode 100644 node_modules/everyauth/media/twitter.ico delete mode 100644 node_modules/everyauth/media/vimeo.gif delete mode 100644 node_modules/everyauth/media/vkontakte.ico delete mode 100644 node_modules/everyauth/media/yahoo.ico delete mode 100644 node_modules/everyauth/package.json delete mode 100644 node_modules/everyauth/test/creds.dummy.js delete mode 100644 node_modules/everyauth/test/facebook.tobi.js delete mode 100644 node_modules/everyauth/test/mailchimp.tobi.js delete mode 100644 node_modules/everyauth/test/password.satisfy.js delete mode 100644 node_modules/everyauth/test/password.tobi.js delete mode 100644 node_modules/everyauth/test/promise.test.js delete mode 100644 node_modules/everyauth/test/soundcloud.tobi.js delete mode 100644 node_modules/everyauth/test/twitter.tobi.js delete mode 100644 node_modules/everyauth/test/util/expect.js delete mode 100644 node_modules/everyauth/test/util/satisfy.js delete mode 100644 node_modules/jade/.npmignore delete mode 100644 node_modules/jade/LICENSE delete mode 100644 node_modules/jade/Readme.md delete mode 100644 node_modules/jade/Readme_zh-cn.md delete mode 100755 node_modules/jade/bin/jade delete mode 100644 node_modules/jade/index.js delete mode 100644 node_modules/jade/jade.js delete mode 100644 node_modules/jade/jade.md delete mode 100644 node_modules/jade/jade.min.js delete mode 100644 node_modules/jade/lib/compiler.js delete mode 100644 node_modules/jade/lib/doctypes.js delete mode 100644 node_modules/jade/lib/filters.js delete mode 100644 node_modules/jade/lib/inline-tags.js delete mode 100644 node_modules/jade/lib/jade.js delete mode 100644 node_modules/jade/lib/lexer.js delete mode 100644 node_modules/jade/lib/nodes/attrs.js delete mode 100644 node_modules/jade/lib/nodes/block-comment.js delete mode 100644 node_modules/jade/lib/nodes/block.js delete mode 100644 node_modules/jade/lib/nodes/case.js delete mode 100644 node_modules/jade/lib/nodes/code.js delete mode 100644 node_modules/jade/lib/nodes/comment.js delete mode 100644 node_modules/jade/lib/nodes/doctype.js delete mode 100644 node_modules/jade/lib/nodes/each.js delete mode 100644 node_modules/jade/lib/nodes/filter.js delete mode 100644 node_modules/jade/lib/nodes/index.js delete mode 100644 node_modules/jade/lib/nodes/literal.js delete mode 100644 node_modules/jade/lib/nodes/mixin.js delete mode 100644 node_modules/jade/lib/nodes/node.js delete mode 100644 node_modules/jade/lib/nodes/tag.js delete mode 100644 node_modules/jade/lib/nodes/text.js delete mode 100644 node_modules/jade/lib/parser.js delete mode 100644 node_modules/jade/lib/runtime.js delete mode 100644 node_modules/jade/lib/self-closing.js delete mode 100644 node_modules/jade/lib/utils.js delete mode 120000 node_modules/jade/node_modules/.bin/cake delete mode 120000 node_modules/jade/node_modules/.bin/coffee delete mode 100644 node_modules/jade/node_modules/coffee-script/.npmignore delete mode 100644 node_modules/jade/node_modules/coffee-script/CNAME delete mode 100644 node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md delete mode 100644 node_modules/jade/node_modules/coffee-script/LICENSE delete mode 100644 node_modules/jade/node_modules/coffee-script/README delete mode 100644 node_modules/jade/node_modules/coffee-script/Rakefile delete mode 100755 node_modules/jade/node_modules/coffee-script/bin/cake delete mode 100755 node_modules/jade/node_modules/coffee-script/bin/coffee delete mode 100644 node_modules/jade/node_modules/coffee-script/extras/jsl.conf delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js delete mode 100755 node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js delete mode 100644 node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js delete mode 100644 node_modules/jade/node_modules/coffee-script/package.json delete mode 100644 node_modules/jade/node_modules/commander/.npmignore delete mode 100644 node_modules/jade/node_modules/commander/.travis.yml delete mode 100644 node_modules/jade/node_modules/commander/History.md delete mode 100644 node_modules/jade/node_modules/commander/Makefile delete mode 100644 node_modules/jade/node_modules/commander/Readme.md delete mode 100644 node_modules/jade/node_modules/commander/index.js delete mode 100644 node_modules/jade/node_modules/commander/lib/commander.js delete mode 100644 node_modules/jade/node_modules/commander/package.json delete mode 100644 node_modules/jade/node_modules/mkdirp/.npmignore delete mode 100644 node_modules/jade/node_modules/mkdirp/.travis.yml delete mode 100644 node_modules/jade/node_modules/mkdirp/LICENSE delete mode 100644 node_modules/jade/node_modules/mkdirp/README.markdown delete mode 100644 node_modules/jade/node_modules/mkdirp/examples/pow.js delete mode 100644 node_modules/jade/node_modules/mkdirp/index.js delete mode 100644 node_modules/jade/node_modules/mkdirp/package.json delete mode 100644 node_modules/jade/node_modules/mkdirp/test/chmod.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/clobber.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/mkdirp.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/perm.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/perm_sync.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/race.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/rel.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/return.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/return_sync.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/root.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/sync.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/umask.js delete mode 100644 node_modules/jade/node_modules/mkdirp/test/umask_sync.js delete mode 100644 node_modules/jade/package.json delete mode 100644 node_modules/jade/runtime.js delete mode 100644 node_modules/jade/runtime.min.js delete mode 100644 node_modules/jade/testing/index.html delete mode 100644 node_modules/jade/testing/index.jade delete mode 100644 node_modules/jade/testing/layout.html delete mode 100644 node_modules/jade/testing/layout.jade delete mode 100644 node_modules/jade/testing/mobile.html delete mode 100644 node_modules/jade/testing/mobile.jade delete mode 100644 node_modules/jade/testing/nested/something.html delete mode 100644 node_modules/jade/testing/nested/something.jade delete mode 100644 node_modules/jade/testing/some.js delete mode 100644 node_modules/jade/testing/test.md delete mode 100644 node_modules/passport-github/.npmignore delete mode 100644 node_modules/passport-github/.travis.yml delete mode 100644 node_modules/passport-github/LICENSE delete mode 100644 node_modules/passport-github/examples/login/app.js delete mode 100644 node_modules/passport-github/examples/login/package.json delete mode 100644 node_modules/passport-github/examples/login/views/account.ejs delete mode 100644 node_modules/passport-github/examples/login/views/index.ejs delete mode 100644 node_modules/passport-github/examples/login/views/layout.ejs delete mode 100644 node_modules/passport-github/examples/login/views/login.ejs delete mode 100644 node_modules/passport-github/lib/passport-github/index.js delete mode 100644 node_modules/passport-github/lib/passport-github/strategy.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/.travis.yml delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/LICENSE delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/README.md delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js delete mode 100644 node_modules/passport-github/node_modules/passport-oauth/package.json delete mode 100644 node_modules/passport-github/node_modules/pkginfo/.gitignore delete mode 100644 node_modules/passport-github/node_modules/pkginfo/README.md delete mode 100644 node_modules/passport-github/node_modules/pkginfo/docs/docco.css delete mode 100644 node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/package.json delete mode 100644 node_modules/passport-github/node_modules/pkginfo/examples/single-property.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js delete mode 100644 node_modules/passport-github/node_modules/pkginfo/package.json delete mode 100644 node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js delete mode 100644 node_modules/passport-github/package.json delete mode 100644 node_modules/passport/.npmignore delete mode 100644 node_modules/passport/.travis.yml delete mode 100644 node_modules/passport/LICENSE delete mode 100644 node_modules/passport/lib/passport/context/http/actions.js delete mode 100644 node_modules/passport/lib/passport/context/http/context.js delete mode 100644 node_modules/passport/lib/passport/http/request.js delete mode 100644 node_modules/passport/lib/passport/index.js delete mode 100644 node_modules/passport/lib/passport/middleware/authenticate.js delete mode 100644 node_modules/passport/lib/passport/middleware/initialize.js delete mode 100644 node_modules/passport/lib/passport/strategies/session.js delete mode 100644 node_modules/passport/lib/passport/strategy.js delete mode 100644 node_modules/passport/node_modules/pkginfo/.gitignore delete mode 100644 node_modules/passport/node_modules/pkginfo/README.md delete mode 100644 node_modules/passport/node_modules/pkginfo/docs/docco.css delete mode 100644 node_modules/passport/node_modules/pkginfo/docs/pkginfo.html delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/all-properties.js delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/array-argument.js delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/object-argument.js delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/package.json delete mode 100644 node_modules/passport/node_modules/pkginfo/examples/single-property.js delete mode 100644 node_modules/passport/node_modules/pkginfo/lib/pkginfo.js delete mode 100644 node_modules/passport/node_modules/pkginfo/package.json delete mode 100644 node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js delete mode 100644 node_modules/passport/package.json diff --git a/node_modules/.bin/jade b/node_modules/.bin/jade deleted file mode 120000 index 571fae7..0000000 --- a/node_modules/.bin/jade +++ /dev/null @@ -1 +0,0 @@ -../jade/bin/jade \ No newline at end of file diff --git a/node_modules/everyauth/.gitignore b/node_modules/everyauth/.gitignore deleted file mode 100644 index 8a7afec..0000000 --- a/node_modules/everyauth/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -**.swp -node_modules -test/creds.js -issues -IRC.md -playground.js -CHANGES diff --git a/node_modules/everyauth/Makefile b/node_modules/everyauth/Makefile deleted file mode 100644 index bfd6b9e..0000000 --- a/node_modules/everyauth/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -TESTS = $(shell find test/ -name '*.tobi.js' -o -name '*.test.js') - -test: - mocha --reporter spec $(TESTS) - -.PHONY: test diff --git a/node_modules/everyauth/README.md b/node_modules/everyauth/README.md deleted file mode 100644 index 2f82beb..0000000 --- a/node_modules/everyauth/README.md +++ /dev/null @@ -1,2681 +0,0 @@ -everyauth -========== - -Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps. - -There is a NodeTuts screencast of everyauth [here](http://nodetuts.com/tutorials/26-starting-with-everyauth.html#video) - -There is also a Google Groups (recently created) -[here](http://groups.google.com/group/everyauth) to post questions and discuss -potential ideas and extensions to the library. - -So far, `everyauth` enables you to login via: - - - - - - - - - - -
    Authenticate Via Credits -
    Password -
    Facebook -
    Twitter -
    Google -
    Google Hybrid RocketLabs Development -
    LinkedIn -
    Dropbox Torgeir -
    Tumblr -
    Evernote Danny Amey -
    Github -
    Instagram -
    Foursquare -
    Yahoo! -
    Justin.tv slickplaid -
    Vimeo slickplaid -
    37signals - (Basecamp, Highrise, Backpack, Campfire) -
    Readability Alfred Nerstu -
    AngelList -
    Dwolla Kenan Shifflett -
    OpenStreetMap Christoph Giesel -
    VKontakte (Russian Social Network) Alexey Simonenko -
    Mail.ru (Russian Social Network) Alexey Gordeyev -
    Skyrock Rodolphe Stoclin -
    Gowalla Andrew Kramolisch -
    TripIt Damian Krzeminski -
    500px Danny Amey -
    SoundCloud Chris Leishman -
    mixi - ufssf -
    Mailchimp - Winfred Nadeau -
    Mendeley - Eduard Baun -
    Box.net -
    OpenId RocketLabs Development, Andrew Mee, Brian Noguchi -
    LDAP (experimental; not production-tested) -
    Windows Azure Access Control Service (ACS) Dario Renzulli, Juan Pablo Garcia, Matias Woloski from Southworks -
    - -`everyauth` is: - -- **Modular** - We have you covered with Facebook and Twitter - OAuth logins, basic login/password support, and modules - coming soon for beta invitation support and more. -- **Easily Configurable** - everyauth was built with powerful - configuration needs in mind. Configure an authorization strategy - in a straightforward, easy-to-read & easy-to-write approach, - with as much granularity as you want over the steps and - logic of your authorization strategy. -- **Idiomatic** - The syntax for configuring and extending your authorization strategies are - idiomatic and chainable. - - -## Installation - $ npm install everyauth - -## Quick Start - -Incorporate everyauth into your express app in just 2 easy steps. - -1. **Choose and Configure Auth Strategies** - Find the authentication strategy - you desire in one of the sections below. Follow the configuration - instructions. -2. **Add the Middleware to Express** - - ```javascript - var everyauth = require('everyauth'); - // Step 1 code goes here - - // Step 2 code - var express = require('express'); - var app = express(); - app - .use(express.bodyParser()) - .use(express.cookieParser('mr ripley')) - .use(express.session()) - .use(everyauth.middleware(app)); - ``` - -## Example Application - -There is an example application at [./example](https://github.com/bnoguchi/everyauth/tree/master/example) - -To run it: - - $ cd example - $ node server.js - -**Important** - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a `localhost` -alias called `local.host`. Make sure you set up your /etc/hosts so that 127.0.0.1 is also -associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: - - 127.0.0.1 localhost local.host - -Then point your browser to [http://local.host:3000](http://local.host:3000) - -## Tests - - $ npm install everyauth --dev - -Then, update test/creds.js with credentials that the integration tests use to -login to each 3rd party service. - - $ make test - -## Accessing the User - -If you are using `express` or `connect`, then `everyauth` -provides an easy way to access the user as: - -- `req.user` from your app server -- `everyauth.user` via the `everyauth` helper accessible from your `express` views. -- `user` as a helper accessible from your `express` views - -To access the user, configure `everyauth.everymodule.findUserById` and -optionally `everyauth.everymodule.userPkey`. -For example, using [mongoose](http://github.com/LearnBoost/mongoose): - -```javascript -everyauth.everymodule.findUserById( function (userId, callback) { - User.findById(userId, callback); - // callback has the signature, function (err, user) {...} -}); -``` - -If you need access to the request object the function can have three arguments: - -```javascript -everyauth.everymodule.findUserById( function (req, userId, callback) { - - // use the request in some way ... - - // callback has the signature, function (err, user) {...} -}); -``` - -Once you have configured this method, you now have access to the user object -that was fetched anywhere in your server app code as `req.user`. For instance: - -```javascript -var app = require('express').createServer() - -// Configure your app - -app.get('/', function (req, res) { - console.log(req.user); // FTW! - res.render('home'); -}); -``` - -Moreover, you can access the user in your views as `everyauth.user` or as `user`. - - //- Inside ./views/home.jade - span.user-id= everyauth.user.name - #user-id= user.id - -`everyauth` assumes that you store your users with an `id` property. If not -- -e.g, if you adopt the convention `user.uid` over `user.id` -- then just make -sure to configure the `everyauth.everymodule.userPkey` parameter: - -```javascript -everyauth.everymodule.userPkey('uid'); -``` - -## Express Helpers - -If you are using express, everyauth comes with some useful dynamic helpers. -To enable them: - -```javascript -var express = require('express') - , everyauth = require('everyauth') - , app = express.createServer(); - -everyauth.helpExpress(app); -``` - -Then, from within your views, you will have access to the following helpers methods -attached to the helper, `everyauth`: - -- `everyauth.loggedIn` -- `everyauth.user` - the User document associated with the session -- `everyauth.facebook` - The is equivalent to what is stored at `req.session.auth.facebook`, - so you can do things like ... -- `everyauth.facebook.user` - returns the user json provided from the OAuth provider. -- `everyauth.facebook.accessToken` - returns the access_token provided from the OAuth provider - for authorized API calls on behalf of the user. -- And you also get this pattern for other modules - e.g., `everyauth.twitter.user`, - `everyauth.github.user`, etc. - -You also get access to the view helper - -- `user` - the same as `everyauth.user` above - -As an example of how you would use these, consider the following `./views/user.jade` jade template: - - .user-id - .label User Id - .value #{user.id} - .facebook-id - .label User Facebook Id - .value #{everyauth.facebook.user.id} - -If you already have an express helper named `user`, then you can configure -`everyauth` to use a different helper name to access the user object that -everyauth manages. To do so, leverage the `userAlias` option for -`everyauth.helpExpress`: - -```javascript -everyauth.helpExpress(app, { userAlias: '__user__' }); -``` - -Then, you could access the user object in your view with the helper `__user__` -instead of the default helper `user`. So you can compare with the default use -of helpers given previously, the alternative leveraging userAlias would look like: - - .user-id - .label User Id - .value #{__user__.id} - .facebook-id - .label User Facebook Id - .value #{everyauth.facebook.user.id} - -`everyauth` also provides convenience methods on the `ServerRequest` instance `req`. -From any scope that has access to `req`, you get the following convenience getters and methods: - -- `req.loggedIn` - a Boolean getter that tells you if the request is by a logged in user -- `req.user` - the User document associated with the session -- `req.logout()` - clears the sesion of your auth data - -## Logging Out - -If you integrate `everyauth` with `connect`, then `everyauth` automatically -sets up a `logoutPath` at `GET` `/logout` for your app. It also -sets a default handler for your logout route that clears your session -of auth information and redirects them to '/'. - -To over-write the logout path: - -```javascript -everyauth.everymodule.logoutPath('/bye'); -``` - -To over-write the logout redirect path: - -```javascript -everyauth.everymodule.logoutRedirectPath('/navigate/to/after/logout'); -``` - -To over-write the logout handler: - -```javascript -everyauth.everymodule.handleLogout( function (req, res) { - // Put you extra logic here - - req.logout(); // The logout method is added for you by everyauth, too - - // And/or put your extra logic here - - this.redirect(res, this.logoutRedirectPath()); -}); -``` - -## Custom redirect on password-based login or registration - -You may want your own callback that decides where to send a user after login or registration. One way of doing this is with the `respondToLoginSucceed` and `respondToRegistrationSucceed` methods. This assumes that you have set a `.redirectTo` property on your `req.session` object: - -```javascript -everyauth.password - .respondToLoginSucceed( function (res, user, data) { - if (user) { - this.redirect(res, data.session.redirectTo) - } - }) - .respondToRegistrationSucceed( function (res, user, data) { - this.redirect(res, data.session.redirectTo) - }) -``` - -If you are using express and want your redirects to be subject to [express -redirect mapping](http://expressjs.com/guide.html#res.redirect\(\)), you can -overwrite redirect method employed by everyauth. - -```javascript -everyauth.everymodule - .performRedirect( function (res, location) { - res.redirect(location, 303); - }); -``` - -A newly defined method will be used by everyauth to perform all redirects. - -# Auth Strategy Instructions - -## Facebook Connect - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.facebook - .appId('YOUR APP ID HERE') - .appSecret('YOUR APP SECRET HERE') - .handleAuthCallbackError( function (req, res) { - // If a user denies your app, Facebook will redirect the user to - // /auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request. - // This configurable route handler defines how you want to respond to - // that. - // If you do not configure this, everyauth renders a default fallback - // view notifying the user that their authentication failed and why. - }) - .findOrCreateUser( function (session, accessToken, accessTokExtra, fbUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.facebook - .entryPath('/auth/facebook') - .callbackPath('/auth/facebook/callback') - .scope('email') // Defaults to undefined - .fields('id,name,email,picture') // Controls the returned fields. Defaults to undefined -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.facebook.scope(); // undefined -everyauth.facebook.fields(); // undefined -everyauth.facebook.entryPath(); // '/auth/facebook' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.facebook.configurable(); -``` - -### Dynamic Facebook Connect Scope - -Facebook provides many different -[permissions](http://developers.facebook.com/docs/authentication/permissions/) -for which your app can ask your user. This is bundled up in the `scope` query -paremter sent with the oauth request to Facebook. While your app may require -several different permissions from Facebook, Facebook recommends that you only -ask for these permissions incrementally, as you need them. For example, you might -want to only ask for the "email" scope upon registration. At the same time, for -another user, you may want to ask for "user_status" permissions because they -have progressed further along in your application. - -`everyauth` enables you to specify the "scope" dynamically with a second -variation of the configurable `scope`. In addition to the first variation -that looks like: - -```javascript -everyauth.facebook - .scope('email,user_status'); -``` - -you can have greater dynamic control over "scope" via the second variation of `scope`: - -```javascript -everyauth.facebook - .scope( function (req, res) { - var session = req.session; - switch (session.userPhase) { - case 'registration': - return 'email'; - case 'share-media': - return 'email,user_status'; - } - }); - -``` - -### Facebook Mobile OAuth Dialog -If you are programming for mobile, you can bring up the facebook mobile OAuth -dialog instead of the traditional desktop browser-based one by just adding -`mobile(true)` to your configuration as seen here: - -```javascript -everyauth.facebook - .mobile(true) - .appId('YOUR APP ID HERE') - .appSecret('YOUR APP SECRET HERE') - // rest of configuration -``` - -## Twitter OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.twitter - .consumerKey('YOUR CONSUMER ID HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenSecret, twitterUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -**Important** - Some developers forget to do the following, and it causes them to have issues with `everyauth`. -Please make sure to do the following: When you set up your app at http://dev.twitter.com/, make sure that your callback url is set up to -include that path '/auth/twitter/callback/'. In general, when dealing with OAuth or OAuth2 modules -provided by `everyauth`, the default callback path is always set up to follow the pattern -'/auth/#{moduleName}/callback', so just ensure that you configure your OAuth settings accordingly with -the OAuth provider -- in this case, the "Edit Application Settings" section for your app at http://dev.twitter.com. - -Alternatively, you can specify the callback url at the application level by configuring `callbackPath` (which -has a default configuration of "/auth/twitter/callback"): - -```javascript -everyauth.twitter - .consumerKey('YOUR CONSUMER ID HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .callbackPath('/custom/twitter/callback/path') - .findOrCreateUser( function (session, accessToken, accessTokenSecret, twitterUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); -``` - -So if your hostname is `example.com`, then this configuration will over-ride the `dev.twitter.com` callback url configuration. -Instead, Twitter will redirect back to `example.com/custom/twitter/callback/path` in the example just given above. - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.twitter - .entryPath('/auth/twitter') - .callbackPath('/auth/twitter/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.twitter.callbackPath(); // '/auth/twitter/callback' -everyauth.twitter.entryPath(); // '/auth/twitter' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.twitter.configurable(); -``` - -## Password Authentication - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.password - .getLoginPath('/login') // Uri path to the login page - .postLoginPath('/login') // Uri path that your login form POSTs to - .loginView('a string of html; OR the name of the jade/etc-view-engine view') - .authenticate( function (login, password) { - // Either, we return a user or an array of errors if doing sync auth. - // Or, we return a Promise that can fulfill to promise.fulfill(user) or promise.fulfill(errors) - // `errors` is an array of error message strings - // - // e.g., - // Example 1 - Sync Example - // if (usersByLogin[login] && usersByLogin[login].password === password) { - // return usersByLogin[login]; - // } else { - // return ['Login failed']; - // } - // - // Example 2 - Async Example - // var promise = this.Promise() - // YourUserModel.find({ login: login}, function (err, user) { - // if (err) return promise.fulfill([err]); - // promise.fulfill(user); - // } - // return promise; - }) - .loginSuccessRedirect('/') // Where to redirect to after a login - - // If login fails, we render the errors via the login view template, - // so just make sure your loginView() template incorporates an `errors` local. - // See './example/views/login.jade' - - .getRegisterPath('/register') // Uri path to the registration page - .postRegisterPath('/register') // The Uri path that your registration form POSTs to - .registerView('a string of html; OR the name of the jade/etc-view-engine view') - .validateRegistration( function (newUserAttributes) { - // Validate the registration input - // Return undefined, null, or [] if validation succeeds - // Return an array of error messages (or Promise promising this array) - // if validation fails - // - // e.g., assuming you define validate with the following signature - // var errors = validate(login, password, extraParams); - // return errors; - // - // The `errors` you return show up as an `errors` local in your jade template - }) - .registerUser( function (newUserAttributes) { - // This step is only executed if we pass the validateRegistration step without - // any errors. - // - // Returns a user (or a Promise that promises a user) after adding it to - // some user store. - // - // As an edge case, sometimes your database may make you aware of violation - // of the unique login index, so if this error is sent back in an async - // callback, then you can just return that error as a single element array - // containing just that error message, and everyauth will automatically handle - // that as a failed registration. Again, you will have access to this error via - // the `errors` local in your register view jade template. - // e.g., - // var promise = this.Promise(); - // User.create(newUserAttributes, function (err, user) { - // if (err) return promise.fulfill([err]); - // promise.fulfill(user); - // }); - // return promise; - // - // Note: Index and db-driven validations are the only validations that occur - // here; all other validations occur in the `validateRegistration` step documented above. - }) - .registerSuccessRedirect('/'); // Where to redirect to after a successful registration - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.password - .loginFormFieldName('login') // Defaults to 'login' - .passwordFormFieldName('password') // Defaults to 'password' - .loginLayout('custom_login_layout') // Only with `express` - .registerLayout('custom reg_layout') // Only with `express` - .loginLocals(fn); // See Recipe 3 below -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.password.loginFormFieldName(); // 'login' -everyauth.password.passwordFormFieldName(); // 'password' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.password.configurable(); -``` - -### Password Recipe 1: Extra registration data - -Sometimes your registration will ask for more information from the user besides the login and password. - -For this particular scenario, you can configure the optional step, `extractExtraRegistrationParams`. - -```javascript -everyauth.password.extractExtraRegistrationParams( function (req) { - return { - phone: req.body.phone - , name: { - first: req.body.first_name - , last: req.body.last_name - } - }; -}); -``` - -Then, you will have access to this data from within your configured -`validateRegistration` and `registerUser`: - -```javascript -everyauth.password - .validateRegistration( function (newUserAttributes) { - var phone = newUserAttributes.phone - , firstName = newUserAttributes.name.first - , lastName = newUserAttributes.name.last; - }) - .registerUser( function (newUserAttributes) { - var phone = newUserAttributes.phone - , firstName = newUserAttributes.name.first - , lastName = newUserAttributes.name.last; - }); -``` - -### Password Recipe 2: Logging in with email or phone number - -By default, `everyauth` uses the field and user key name `login` during the -registration and login process. - -Sometimes, you want to use `email` or `phone` instead of `login`. Moreover, -you also want to validate `email` and `phone` fields upon registration. - -`everyauth` provides an easy way to do this: - -```javascript -everyauth.password.loginWith('email'); - -// OR - -everyauth.password.loginWith('phone'); -``` - -With simple login configuration like this, you get email (or phone) validation -in addition to renaming of the form field and user key corresponding to what -otherwise would typically be referred to as 'login'. - -### Password Recipe 3: Adding additional view local variables to login and registration views - -If you are using `express`, you are able to pass variables from your app -context to your view context via local variables. `everyauth` provides -several convenience local vars for your views, but sometimes you will want -to augment this set of local vars with additional locals. - -So `everyauth` also provides a mechanism for you to do so via the following -configurables: - -```javascript -everyauth.password.loginLocals(...); -everyauth.password.registerLocals(...); -``` - -`loginLocals` and `registerLocals` configuration have symmetrical APIs, so I -will only cover `loginLocals` here to illustrate how to use both. - -You can configure this parameter in one of *3* ways. Why 3? Because there are 3 types of ways that you can retrieve your locals. - -1. Static local vars that never change values: - - ```javascript - everyauth.password.loginLocals({ - title: 'Login' - }); - ``` -2. Dynamic synchronous local vars that depend on the incoming request, but whose values are retrieved synchronously - - ```javascript - everyauth.password.loginLocals( function (req, res) { - var sess = req.session; - return { - isReturning: sess.isReturning - }; - }); - ``` -3. Dynamic asynchronous local vars - - ```javascript - everyauth.password.loginLocals( function (req, res, done) { - asyncCall( function ( err, data) { - if (err) return done(err); - done(null, { - title: il8n.titleInLanguage('Login Page', il8n.language(data.geo)) - }); - }); - }); - ``` - -### Password Recipe 4: Customize Your Registration Validation - -By default, `everyauth.password` automatically - -- validates that the login (or email or phone, depending on what you authenticate with -- see Password Recipe 2) is present in the login http request, -- validates that the password is present -- validates that an email login is a correctly formatted email -- validates that a phone login is a valid phone number - -If any of these validations fail, then the appropriate errors are generated and accessible to you in your view via the `errors` view local variable. - -If you want to add additional validations beyond this, you can do so by configuring the step, `validateRegistration`: - -```javascript -everyauth.password - .validateRegistration( function (newUserAttributes, baseErrors) { - // Here, newUserAttributes is the hash of parameters extracted from the incoming request. - // baseErrors is the array of errors generated by the default automatic validation outlined above - // in this same recipe. - - // First, validate your errors. Here, validateUser is a made up function - var moreErrors = validateUser( newUserAttributes ); - if (moreErrors.length) baseErrors.push.apply(baseErrors, moreErrors); - - // Return the array of errors, so your view has access to them. - return baseErrors; - }); -``` - -### Password Recipe 5: Password Hashing - -By default, everyauth is agnostic about how you decide to store your users and -therefore passwords. However, one should *always* use password hashing and -salting for security. - -Here's an example of how to incorporate password hashing into everyauth using -bcrypt hashing. The idea is to store a salt and hash value inside your user object -instead of the password. The hash value is generated from the password (sent with a -registration or login request) and unique salt per user, using the bcrypt algorithm. - -```javascript -// Make sure to `npm install bcrypt` -var bcrypt = require('bcrypt'); - -everyauth.password - .registerUser( function (newUserAttrs) { - var promise = this.Promise() - , password = newUserAttrs.password; - - delete newUserAttrs[password]; // Don't store password - newUserAttrs.salt = bcrypt.genSaltSync(10); - newUserAttrs.hash = bcrypt.hashSync(password, salt); - - // Create a new user in your data store - createUser( newUserAttrs, function (err, createdUser) { - if (err) return promise.fail(err); - return promise.fulfill(createdUser); - }); - - return promise; - }) - .authenticate( function (login, password) { - var promise - , errors = []; - if (!login) errors.push('Missing login.'); - if (!password) errors.push('Missing password.'); - if (errors.length) return errors; - - promise = this.Promise(); - - // findUser passes an error or user to a callback after finding the - // user by login - findUser( login, function (err, user) { - if (err) { - errors.push(err.message || err); - return promise.fulfill(errors); - } - if (!user) { - errors.push('User with login ' + login + ' does not exist.'); - return promise.fulfill(errors); - } - bcrypt.compare(password, user.hash, function (err, didSucceed) { - if (err) { - return promise.fail(err); - errors.push('Wrong password.'); - return promise.fulfill(errors); - } - if (didSucceed) return promise.fulfill(user); - errors.push('Wrong password.'); - return promise.fulfill(errors); - }); - }); - - return promise; - }) -``` - -## Other Modules - -### GitHub OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.github - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .findOrCreateUser( function (session, accessToken, , accessTokenExtra, githubUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.github - .entryPath('/auth/github') - .callbackPath('/auth/github/callback') - .scope('repo'); // Defaults to undefined - // Can be set to a combination of: 'user', 'public_repo', 'repo', 'gist' - // For more details, see http://develop.github.com/p/oauth.html -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.github.scope(); // undefined -everyauth.github.entryPath(); // '/auth/github' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.github.configurable(); -``` - -### Instagram OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.instagram - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, instagramUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.instagram - .entryPath('/auth/instagram') - .callbackPath('/auth/instagram/callback') - .scope('basic') // Defaults to 'basic' - // Can be set to a combination of: 'basic', 'comments', 'relationships', 'likes' - // For more details, see http://instagram.com/developer/auth/#scope - .display(undefined); // Defaults to undefined; Set to 'touch' to see a mobile optimized version - // of the instagram auth page -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.instagram.callbackPath(); // '/auth/instagram/callback' -everyauth.instagram.entryPath(); // '/auth/instagram' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.instagram.configurable(); -``` - -### Foursquare OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.foursquare - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, foursquareUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.foursquare - .entryPath('/auth/foursquare') - .callbackPath('/auth/foursquare/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.foursquare.callbackPath(); // '/auth/foursquare/callback' -everyauth.foursquare.entryPath(); // '/auth/foursquare' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.foursquare.configurable(); -``` - -### LinkedIn OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.linkedin - .consumerKey('YOUR CONSUMER ID HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenSecret, linkedinUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.linkedin - .entryPath('/auth/linkedin') - .callbackPath('/auth/linkedin/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.linkedin.callbackPath(); // '/auth/linkedin/callback' -everyauth.linkedin.entryPath(); // '/auth/linkedin' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.linkedin.configurable(); -``` - -### Google OAuth2 - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.google - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .scope('https://www.google.com/m8/feeds') // What you want access to - .handleAuthCallbackError( function (req, res) { - // If a user denies your app, Google will redirect the user to - // /auth/facebook/callback?error=access_denied - // This configurable route handler defines how you want to respond to - // that. - // If you do not configure this, everyauth renders a default fallback - // view notifying the user that their authentication failed and why. - }) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, googleUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.google - .entryPath('/auth/google') - .callbackPath('/auth/google/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.google.scope(); // undefined -everyauth.google.entryPath(); // '/auth/google' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.google.configurable(); -``` - -### Gowalla OAuth2 - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.gowalla - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .handleAuthCallbackError( function (req, res) { - // TODO - Update this documentation - // This configurable route handler defines how you want to respond to - // a response from Gowalla that something went wrong during the oauth2 process. - // If you do not configure this, everyauth renders a default fallback - // view notifying the user that their authentication failed and why. - }) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, gowallaUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.gowalla - .entryPath('/auth/gowalla') - .callbackPath('/auth/gowalla/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.gowalla.scope(); // undefined -everyauth.gowalla.entryPath(); // '/auth/gowalla' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.gowalla.configurable(); -``` - -### 37signals (Basecamp, Highrise, Backpack, Campfire) OAuth2 - -First, register an app at [integrate.37signals.com](https://integrate.37signals.com). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth['37signals'] - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .handleAuthCallbackError( function (req, res) { - // TODO - Update this documentation - // This configurable route handler defines how you want to respond to - // a response from 37signals that something went wrong during the oauth2 process. - // If you do not configure this, everyauth renders a default fallback - // view notifying the user that their authentication failed and why. - }) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, _37signalsUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth['37signals'] - .entryPath('/auth/37signals') - .callbackPath('/auth/37signals/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth['37signals'].entryPath(); // '/auth/37signals' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth['37signals'].configurable(); -``` - -### AngelList OAuth2 - -First, register an app [on AngelList](http://angel.co/api/oauth/clients). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.angellist - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR TOKEN HERE') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, angelListUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.angellist - .entryPath('/auth/angellist') - .callbackPath('/auth/angellist/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.angellist.entryPath(); // '/auth/angellist' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.angellist.configurable(); -``` - -### Dwolla OAuth2 - -First, register an app [on Dwolla](http://www.dwolla.com/developers). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.dwolla - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR TOKEN HERE') - .scope('accountinfofull') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, dwollaUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; -``` - -### Skyrock OAuth - -First, register an app [on Skyrock](http://www.skyrock.com/developer/). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.skyrock - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, skyrockUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### VKontakte OAuth2 - -First, register an app [on VKontakte](http://vk.com/editapp?act=create&site=1). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.vkontakte - .appId('YOUR APP ID HERE') - .appSecret('YOUR TOKEN HERE') - .scope('photo') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, vkUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Mail.ru OAuth2 - -First, register an app [on mail.ru](http://api.mail.ru/apps/my/add/). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.mailru - .appId('YOUR CONSUMER KEY HERE') - .appSecret('YOUR CONSUMER SECRET HERE') - .scope('messages') - .entryPath('/auth/mailru') - .callbackPath('/auth/mailru/callback') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailruUser) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - // return promise; - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Yahoo OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.yahoo - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (session, accessToken, accessTokenSecret, yahooUserMetadata) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.yahoo - .entryPath('/auth/yahoo') - .callbackPath('/auth/yahoo/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.yahoo.callbackPath(); // '/auth/yahoo/callback' -everyauth.yahoo.entryPath(); // '/auth/yahoo' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.yahoo.configurable(); -``` - -### Readability OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.readability - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, reader) { - // find or create user logic goes here - // - // e.g., - // return usersByReadabilityId[reader.username] || (usersByReadabilityId[reader.username] = reader); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.readability - .entryPath('/auth/readability') - .callbackPath('/auth/readability/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.readability.callbackPath(); // '/auth/readability/callback' -everyauth.readability.entryPath(); // '/auth/readability' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.readability.configurable(); -``` - -### Dropbox OAuth - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.dropbox - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByDropboxId[user.uid] || (usersByDropboxId[user.uid] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.dropbox - .entryPath('/auth/dropbox') - .callbackPath('/auth/dropbox/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.dropbox.callbackPath(); // '/auth/dropbox/callback' -everyauth.dropbox.entryPath(); // '/auth/dropbox' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.dropbox.configurable(); -``` - -### Justin.tv OAuth - -[Sign up for a Justin.tv account](http://www.justin.tv/user/signup) and activate it as a [developer account](http://www.justin.tv/developer/activate) to get your consumer key and secret. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.justintv - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) { - // find or create user logic goes here - // - // e.g., - // return usersByJustintvId[justintvUser.id] || (usersByJustintvId[justintvUser.id] = justintvUser); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -The `justintvUser` parameter in the `.findOrCreateUser()` function above returns the `account/whoami` API call - -[Justin.tv API Wiki - Account/whoami](http://apiwiki.justin.tv/mediawiki/index.php/Account/whoami) - -```javascript -{ - "image_url_huge": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-320x240-4.jpg", - "profile_header_border_color": null, - "favorite_quotes": "I love Justin.tv", - "sex": "Male", - "image_url_large": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-125x94-4.jpg", - "profile_about": "Check out my website:\n\nwww.justin.tv\n", - "profile_background_color": null, - "image_url_medium": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-75x56-4.jpg", - "id": 1698, - "broadcaster": true, - "profile_url": "http:\/\/www.justin.tv\/justin\/profile", - "profile_link_color": null, - "image_url_small": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-50x37-4.jpg", - "profile_header_text_color": null, - "name": "The JUST UN", - "image_url_tiny": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-33x25-4.jpg", - "login": "justin", - "profile_header_bg_color": null, - "location": "San Francisco" -} -``` - -You can also configure more parameters (most are set to defaults) via the same chainable API: - -```javascript -everyauth.justintv - .entryPath('/auth/justintv') - .callbackPath('/auth/justintv/callback'); -``` - -If you want to see what the current value of a configured parameter is, you can do so via: - -```javascript -everyauth.justintv.callbackPath(); // '/auth/justintv/callback' -everyauth.justintv.entryPath(); // '/auth/justintv' -``` - -To see all parameters that are configurable, the following will return an object whose parameter name keys map to description values: - -```javascript -everyauth.justintv.configurable(); -``` - -### Vimeo OAuth - -You will first need to sign up for a [developer application](http://vimeo.com/api/applications) to get the consumer key and secret. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.vimeo - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByVimeoId[user.id] || (usersByVimeoId[user.id] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.vimeo - .entryPath('/auth/vimeo') - .callbackPath('/auth/vimeo/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.vimeo.callbackPath(); // '/auth/vimeo/callback' -everyauth.vimeo.entryPath(); // '/auth/vimeo' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.vimeo.configurable(); -``` - -### Tumblr OAuth (1.a) - -You will first need to [register an app](http://www.tumblr.com/oauth/register) to get the consumer key and secret. -During registration of your new app, enter a "Default callback URL" of "http://:/auth/tumblr/callback". -Once you register your app, copy down your "OAuth Consumer Key" and "Secret Key" and proceed below. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.tumblr - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByTumblrName[user.name] || (usersByTumblrName[user.name] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.tumblr - .entryPath('/auth/tumblr') - .callbackPath('/auth/tumblr/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.tumblr.callbackPath(); // '/auth/tumblr/callback' -everyauth.tumblr.entryPath(); // '/auth/tumblr' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.tumblr.configurable(); -``` - -### Evernote OAuth (1.a) - -You will first need to [request an API key](http://www.evernote.com/about/developer/api/#key) to get the consumer key and secret. Note that this consumer key and secret will only be valid for the sandbox rather than the production OAuth host. By default the Evernote module will use the production host, so you'll need to override this using the chainable API if you're using the sandbox. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.evernote - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByEvernoteId[user.userId] || (usersByEvernoteId[user.userId] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.evernote - .oauthHost('https://sandbox.evernote.com/') - .entryPath('/auth/evernote') - .callbackPath('/auth/evernote/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.evernote.oauthHost(); // 'https://sandbox.evernote.com/' -everyauth.evernote.callbackPath(); // '/auth/evernote/callback' -everyauth.evernote.entryPath(); // '/auth/evernote' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.evernote.configurable(); -``` - -### OpenStreetMap OAuth - -You will first need to [login to OpenStreetMap](http://www.openstreetmap.org). Then register you application on your OpenStreetMap user page via the View my OAuth details link on the bottom of the page to get the consumer key and secret. The registered application does not need any permission listed there to login via OAuth. - -```javascript -var everyauth = require('osm') - , connect = require('connect'); - -everyauth.osm - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByOSMId[user.id] || (usersByOSMId[user.id] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.osm - .oauthHost('http://api06.dev.openstreetmap.org/') - .entryPath('/auth/osm') - .callbackPath('/auth/osm/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.osm.oauthHost(); // 'http://api.openstreetmap.org/' -everyauth.osm.callbackPath(); // '/auth/osm/callback' -everyauth.osm.entryPath(); // '/auth/osm' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.osm.configurable(); -``` - -### TripIt OAuth (1.0) - -Obtain consumer key and consumer secret for your app by [registering it](http://www.tripit.com/developer/create). -Please note that TripIt is using _API Key_ and _API Secret_ terminology: use those values as describe below. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.tripit - .consumerKey('YOUR API KEY') - .consumerSecret('YOUR API SECRET') - .findOrCreateUser( function (sess, accessToken, accessSecret, tripitProfile) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### 500px OAuth (1.0) - -You will first need to [request an API key](http://developer.500px.com/oauth_clients/new) to get the consumer key and secret. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth['500px'] - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersBy500pxId[user.userId] || (usersBy500pxId[user.userId] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### SoundCloud OAuth2 - -You will first need to [register an app](http://soundcloud.com/you/apps) to get the client id and secret. -During registration of your new app, enter a "Default callback URL" of "http://:/auth/soundcloud/callback". -Once you register your app, copy down your "Client ID" and "Client Secret" and proceed below. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.soundcloud - .appId('YOUR CLIENT ID HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .handleAuthCallbackError( function (req, res) { - // TODO - Update this documentation - // This configurable route handler defines how you want to respond to - // a response from SoundCloud that something went wrong during the oauth2 process. - // If you do not configure this, everyauth renders a default fallback - // view notifying the user that their authentication failed and why. - }) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, soundcloudUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.soundcloud - .entryPath('/auth/soundcloud') - .callbackPath('/auth/soundcloud/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.soundcloud.scope(); // undefined -everyauth.soundcloud.display(); // undefined -everyauth.soundcloud.entryPath(); // '/auth/soundcloud' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.soundcloud.configurable(); -``` - -### mixi OAuth2 - -First, register an app [on mixi](http://developer.mixi.co.jp). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.mixi - .appId('YOUR CONSUMER KEY HERE') - .appSecret('YOUR CONSUMER SECRET HERE') - .display('pc') //specify device types of access: See http://developers.mixi.co.jp/ - .scope('r_profile') //specify types of access: See http://developers.mixi.co.jp/ - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mixiUserMetadata) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; -``` - -### Mailchimp OAuth2 - -First, register an app [in Mailchimp](http://login.mailchimp.com). - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.mailchimp - .appId('YOUR CLIENT KEY HERE') - .appSecret('YOUR CLIENT SECRET HERE') - .myHostname(process.env.HOSTNAME || "http://127.0.0.1:3000/")//MC requires 127.0.0.1 for dev - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailchimpUserData) { - // find or create user logic goes here - // Return a user or Promise that promises a user - // Promises are created via - // var promise = this.Promise(); - // The mailchimpUserData object contains everything from the API method getAccountDetails and an apikey. - // You'll want to work with mailchimpUserData.user_id for queries - // and mailchimpUserData.apikey for your API wrapper - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Mendeley OAuth (1.0) - -You will first need to [register your application](http://dev.mendeley.com/applications/register/) to get the consumer key and secret. - -```javascript -everyauth.mendeley - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .findOrCreateUser( function (sess, accessToken, accessSecret, user) { - // find or create user logic goes here - // - // e.g., - // return usersByMendeleyId[user.main.profile_id] || (usersByMendeleyId[user.main.profile_id] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### OpenID protocol - -OpenID protocol allows you to use an openid auth request. You can read more information about it here http://openid.net/ - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.openid - .myHostname('http://localhost:3000/') - .simpleRegistration({ - "nickname" : true - , "email" : true - , "fullname" : true - , "dob" : true - , "gender" : true - , "postcode" : true - , "country" : true - , "language" : true - , "timezone" : true - }) - .attributeExchange({ - "http://axschema.org/contact/email" : "required" - , "http://axschema.org/namePerson/friendly" : "required" - , "http://axschema.org/namePerson" : "required" - , "http://axschema.org/namePerson/first" : "required" - , "http://axschema.org/contact/country/home": "required" - , "http://axschema.org/media/image/default" : "required" - , "http://axschema.org/x/media/signature" : "required" - }) - .openidURLField('openid_identifier'); //The POST variable used to get the OpenID - .findOrCreateUser( function(session, openIdUserAttributes) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Google OpenID+OAuth Hybrid protocol - -OpenID+OAuth Hybrid protocol allows you to combine an openid auth request with a oauth access request. You can read more information about it here http://code.google.com/apis/accounts/docs/OpenID.html - -Register your domain with Google -[here](https://accounts.google.com/ManageDomains) and write down the -consumer key and consumer secret generated during the domain registration. - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.googlehybrid - .consumerKey('YOUR CONSUMER KEY HERE') - .consumerSecret('YOUR CONSUMER SECRET HERE') - .scope(['GOOGLE API SCOPE','GOOGLE API SCOPE']) - .findOrCreateUser( function(session, userAttributes) { - // find or create user logic goes here - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Box.net - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.box - .apiKey('YOUR API KEY') - .findOrCreateUser( function (sess, authToken, boxUser) { - // find or create user logic goes here - // - // e.g., - // return usersByBoxId[user.user_id] || (usersByBoxId[user.user_id] = user); - }) - .redirectPath('/'); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -You can also configure more parameters (most are set to defaults) via -the same chainable API: - -```javascript -everyauth.box - .entryPath('/auth/box') - .callbackPath('/auth/box/callback'); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.box.callbackPath(); // '/auth/box/callback' -everyauth.box.entryPath(); // '/auth/box' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.box.configurable(); -``` - -### LDAP - -The LDAP module is still in development. Do not use it in production yet. - -Install OpenLDAP client libraries: - - $ apt-get install slapd ldap-utils - -Install [node-ldapauth](https://github.com/joewalnes/node-ldapauth): - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.ldap - .host('your.ldap.host') - .port(389) - - // The `ldap` module inherits from the `password` module, so - // refer to the `password` module instructions several sections above - // in this README. - // You do not need to configure the `authenticate` step as instructed - // by `password` because the `ldap` module already does that for you. - // Moreover, all the registration related steps and configurable parameters - // are no longer valid - .getLoginPath(...) - .postLoginPath(...) - .loginView(...) - .loginSuccessRedirect(...); - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -### Windows Azure Access Control Service (ACS) - -You will need to create a [Windows Azure ACS namespace](http://msdn.microsoft.com/en-us/library/windowsazure/hh674478.aspx). The only caveat when creating the namespace is setting the "Return URL". You will probably [create one Relying Party](http://msdn.microsoft.com/en-us/library/windowsazure/gg429779.aspx) for each environment (dev, qa, prod) and each of them will have a different "Return URL". For instance, dev will be `http://localhost:port/auth/azureacs/callback` and prod could be `https://myapp.com/auth/azureacs/callback` (notice the `/auth/azureacs/callback`, that's where the module will listen the POST with the token from ACS) - -```javascript -var everyauth = require('everyauth') - , connect = require('connect'); - -everyauth.azureacs - .identityProviderUrl('https://yournamespace.accesscontrol.windows.net/v2/wsfederation/') - .entryPath('/auth/azureacs') - .callbackPath('/auth/azureacs/callback') - .signingKey('d0jul....YOUR_SIGNINGK=_KEY......OEvz24=') - .realm('YOUR_APPLICATION_REALM_IDENTIFIER') - .homeRealm('') // if you want to use a default idp (like google/liveid) - .tokenFormat('swt') // only swt supported for now - .findOrCreateUser( function (session, acsUser) { - // you could enrich the "user" entity by storing/fetching the user from a db - return null; - }); - .redirectPath('/'); - - -var routes = function (app) { - // Define your routes here -}; - -connect( - connect.bodyParser() - , connect.cookieParser() - , connect.session({secret: 'whodunnit'}) - , everyauth.middleware() - , connect.router(routes); -).listen(3000); -``` - -If you want to see what the current value of a -configured parameter is, you can do so via: - -```javascript -everyauth.box.callbackPath(); // '/auth/azureacs/callback' -``` - -To see all parameters that are configurable, the following will return an -object whose parameter name keys map to description values: - -```javascript -everyauth.box.configurable(); -``` - -## Configuring a Module - -everyauth was built with powerful configuration needs in mind. - -Every module comes with a set of parameters that you can configure -directly. To see a list of those parameters on a per module basis, -with descriptions about what they do, enter the following into the -node REPL (to access the REPL, just type `node` at the command line) - - > var ea = require('everyauth'); - > ea.facebook.configurable(); - -For example, you will see that one of the configuration parameters is -`moduleTimeout`, which is described to be `how long to wait per step -before timing out and invoking any timeout callbacks` - -Every configuration parameter corresponds to a method of the same name -on the auth module under consideration (i.e., in this case -`ea.facebook`). To create or over-write that parameter, just -call that method with the new value as the argument: - -```javascript -ea.facebook - .moduleTimeout( 4000 ); // Wait 4 seconds before timing out any step - // involved in the facebook auth process -``` - -Configuration parameters can be scalars. But they can be anything. For -example, they can also be functions, too. The facebook module has a -configurable step named `findOrCreateUser` that is described as -"STEP FN [findOrCreateUser] function encapsulating the logic for the step -`fetchOAuthUser`.". What this means is that this configures the -function (i.e., "FN") that encapsulates the logic of this step. - -```javascript -ea.facebook - .findOrCreateUser( function (session, accessToken, extra, oauthUser) { - // find or create user logic goes here - }); -``` - -How do we know what arguments the function takes? -We elaborate more about step function configuration in our -`Introspection` section below. - -### For coffee-script lovers - -Everyauth also supports a special method `configure` for coffee-script -aficionados. Coffee and chainable APIs often don't mix well. As an alternative, -you can configure an everyauth module using an `Object` passed to `configure`: - -```coffee -everyauth.dropbox.configure - consumerKey: conf.dropbox.consumerKey - consumerSecret: conf.dropbox.consumerSecret - findOrCreateUser: (sess, accessToken, accessSecret, dbMeta) -> users[dbMeta.uid] or= addUser('dropbox', dbMeta) - redirectPath: '/' -``` - -## Introspection - -everyauth provides convenient methods and getters for finding out -about any module. - -Show all configurable parameters with their descriptions: - -```javascript -everyauth.facebook.configurable(); -``` - -Show the value of a single configurable parameter: - -```javascript -// Get the value of the configurable callbackPath parameter -everyauth.facebook.callbackPath(); // => '/auth/facebook/callback' -``` - -Show the declared routes (pretty printed): - -```javascript -everyauth.facebook.routes; -``` - -Show the steps initiated by a given route: - -```javascript -everyauth.facebook.route.get.entryPath.steps; -everyauth.facebook.route.get.callbackPath.steps; -``` - -Sometimes you need to set up additional steps for a given auth -module, by defining that step in your app. For example, the -set of steps triggered when someone requests the facebook -module's `callbackPath` contains a step that you must define -in your app. To see what that step is, you can introspect -the `callbackPath` route with the facebook module. - -```javascript -everyauth.facebook.route.get.callbackPath.steps.incomplete; -// => [ { name: 'findOrCreateUser', -// error: 'is missing: its function' } ] -``` - -This tells you that you must define the function that defines the -logic for the `findOrCreateUser` step. To see what the function -signature looks like for this step: - -```javascript -var matchingStep = -everyauth.facebook.route.get.callbackPath.steps.filter( function (step) { - return step.name === 'findOrCreateUser'; -})[0]; -// { name: 'findOrCreateUser', -// accepts: [ 'session', 'accessToken', 'extra', 'oauthUser' ], -// promises: [ 'user' ] } -``` - -This tells you that the function should take the following 4 arguments: - -```javascript -function (session, accessToken, extra, oauthUser) { - ... -} -``` - -And that the function should return a `user` that is a user object or -a Promise that promises a user object. - -```javascript -// For synchronous lookup situations, you can return a user -function (session, accessToken, extra, oauthUser) { - ... - return { id: 'some user id', username: 'some user name' }; -} - -// OR - -// For asynchronous lookup situations, you must return a Promise that -// will be fulfilled with a user later on -function (session, accessToken, extra, oauthUser) { - var promise = this.Promise(); - asyncFindUser( function (err, user) { - if (err) return promise.fail(err); - promise.fulfill(user); - }); - return promise; -} -``` - -You add this function as the block for the step `findOrCreateUser` just like -you configure any other configurable parameter in your auth module: - -```javascript -everyauth.facebook - .findOrCreateUser( function (session, accessToken, extra, oauthUser) { - // Logic goes here - }); -``` - -There are also several other introspection tools at your disposal: - -For example, to show the submodules of an auth module by name: - -```javascript -everyauth.oauth2.submodules; -``` - -Other introspection tools to describe (explanations coming soon): - -- *Invalid Steps* - - ```javascript - everyauth.facebook.routes.get.callbackPath.steps.invalid - ``` - -## Debugging - -### Debugging - Logging Module Steps - -To turn on debugging: - -```javascript -everyauth.debug = true; -``` - -Each everyauth auth strategy module is composed of steps. As each step begins and ends, everyauth will print out to the console the beginning and end of each step. So by turning on the debug flag, you get insight into what step everyauth is executing at any time. - -For example, here is some example debugging information output to the console -during a Facebook Connect authorization: - -``` -starting step - getAuthUri -...finished step -starting step - requestAuthUri -...finished step -starting step - getCode -...finished step -starting step - getAccessToken -...finished step -starting step - fetchOAuthUser -...finished step -starting step - getSession -...finished step -starting step - findOrCreateUser -...finished step -starting step - compile -...finished step -starting step - addToSession -...finished step -starting step - sendResponse -...finished step -``` - -### Debugging - Configuring Error Handling - -By default, all modules handle errors by throwing them. That said, `everyauth` allows -you to over-ride this behavior. - -You can configure error handling at the module and step level. To handle *all* -errors in the same manner across all auth modules that you use, do the following. - -```javascript -everyauth.everymodule.moduleErrback( function (err) { - // Do something with the err -- e.g., log it, throw it -}); -``` - -You can also configure your error handling on a per module basis. So, for example, if -you want to handle errors during the Facebook module differently than in other modules: - - -```javascript -everyauth.facebook.moduleErrback( function (err) { - // Do something with the err -- e.g., log it, throw it -}); -``` - -### Debugging - Setting Timeouts - -By default, every module has 10 seconds to complete each step. If a step takes longer than 10 seconds to complete, then everyauth will pass a timeout error to your configured error handler (see section "Configure Error Handling" above). - -If you would like to increase or decrease the timeout period across all modules, you can do so via: - -```javascript -everyauth.everymodule.moduleTimeout(2000); // Wait 2 seconds per step instead before timing out -``` - -You can eliminate the timeout altogether by configuring your timeouts to -1: - -```javascript -everyauth.everymodule.moduleTimeout(-1); -``` - -You can also configure the timeout period on a per module basis. For example, the following will result in the facebook module having 3 seconds to complete each step before timing out; all other modules will have the default 10 seconds per step before timing out. - -```javascript -everyauth.facebook.moduleTimeout(3000); // Wait 3 seconds -``` - -## In the Wild - -The following projects use everyauth. - -If you are using everyauth in a project, app, or module, get on the list below -by getting in touch or submitting a pull request with changes to the README. - -### Startups & Apps - -- [Storify](http://storify.com/) -- [DoodleOrDie](http://doodleordie.com/) -- [Furkot](http://trips.furkot.com/) - -### Modules - -- [mongoose-auth](https://github.com/bnoguchi/mongoose-auth) Authorization plugin - for use with the node.js MongoDB orm. -- [Heroku's Facebook Node.JS - Template](https://github.com/heroku/facebook-template-nodejs) -- [node-express-boilerplate](https://github.com/mape/node-express-boilerplate) -- [ExpressStarter](https://github.com/JustinBeckwith/ExpressStarter) - -## Tutorials - -The following are 3rd party screencasts and blog posts about either getting up -and running with everyauth or writing your own everyauth modules to support a -new service. - -If you would like your blog post to be included, please submit a pull request -with changes to the README. - -- [NodeTuts: Starting with everyauth](http://nodetuts.com/tutorials/26-starting-with-everyauth.html#video) -- [Node.js modules you should know about: - everyauth](http://www.catonmat.net/blog/nodejs-modules-everyauth/) -- [Implementing Windows Azure ACS with - everyauth](http://nodeblog.cloudapp.net/implementing-windows-azure-acs-with-everyauth) -- [OAuth: Logging In with EveryAuth and NodeJS](http://blog.koostudios.com/?p=453) -- [Calling the github API with node.js](http://www.garann.com/dev/2011/calling-the-github-api-with-node-js/) -- [Simple Node.js Express MVR Template](http://benedmunds.com/2012/04/19/simple-nodejs-express-mvr-template/) - ---- -## Author -Brian Noguchi - -## Credits - -Thanks to the following contributors for the following modules: - -- [RocketLabs Development](https://github.com/rocketlabsdev) for contributing - - OpenId - - Google Hybrid -- [Andrew Mee](https://github.com/starfishmod) - - OpenId -- [Alfred Nerstu](https://github.com/alfrednerstu) - - Readability -- [Torgeir](https://github.com/torgeir) - - DropBox -- [slickplaid](https://github.com/slickplaid) - - Justin.tv - - Vimeo -- [Andrew Kramolisch](https://github.com/andykram) - - Gowalla -- [Kenan Shifflett](https://github.com/nanek) - - Dwolla -- [Alexey Simonenko](https://github.com/meritt) - - VKontakte -- [Alexey Gordeyev](https://github.com/biggora) - - Mail.ru -- [Rodolphe Stoclin](https://github.com/srod) - - Skyrock -- [Danny Amey](https://github.com/dannyamey) - - 500px - - Evernote -- [Chris Leishman](https://github.com/chrisleishman) - - SoundCloud - -## MIT License -Copyright (c) 2011 by Brian Noguchi - -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/everyauth/documentup.json b/node_modules/everyauth/documentup.json deleted file mode 100644 index 9203667..0000000 --- a/node_modules/everyauth/documentup.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "twitter": ["everyauth", "briannoguchi"] -} diff --git a/node_modules/everyauth/example/conf.js b/node_modules/everyauth/example/conf.js deleted file mode 100644 index 6a28044..0000000 --- a/node_modules/everyauth/example/conf.js +++ /dev/null @@ -1,119 +0,0 @@ -module.exports = { - fb: { - appId: '111565172259433' - , appSecret: '85f7e0a0cc804886180b887c1f04a3c1' - } - , twit: { - consumerKey: 'JLCGyLzuOK1BjnKPKGyQ' - , consumerSecret: 'GNqKfPqtzOcsCtFbGTMqinoATHvBcy1nzCTimeA9M0' - } - , github: { - appId: '11932f2b6d05d2a5fa18' - , appSecret: '2603d1bc663b74d6732500c1e9ad05b0f4013593' - } - , instagram: { - clientId: 'be147b077ddf49368d6fb5cf3112b9e0' - , clientSecret: 'b65ad83daed242c0aa059ffae42feddd' - } - , foursquare: { - clientId: 'VUGE4VHJMKWALKDKIOH1HLD1OQNHTC0PBZZBUQSHJ3WKW04K' - , clientSecret: '0LVAGARGUN05DEDDRVWNIMH4RFIHEFV0CERU3OITAZW1CXGX' - } - , gowalla: { - apiKey: '11cf666912004d709fa4bbf21718a82e', - apiSecret: 'e1e23f135776452898a6d268129bf153' - } - , linkedin: { - apiKey: 'pv6AWspODUeHIPNZfA531OYcFyB1v23u3y-KIADJdpyw54BXh-ciiQnduWf6FNRH' - , apiSecret: 'Pdx7DCoJRdAk0ai3joXsslZvK1DPCQwsLn-T17Opkae22ZYDP5R7gmAoFes9TNHy' - } - , google: { - clientId: '3335216477.apps.googleusercontent.com' - , clientSecret: 'PJMW_uP39nogdu0WpBuqMhtB' - } - , googlehybrid: { - consumerKey: 'YOUR CONSUMER KEY HERE' - , consumerSecret: 'YOUR CONSUMER SECRET HERE' - } - , _37signals: { - clientId: 'cd4bf9cd9ed828b6bed8b67e6b314cf8b90c8de5' - , clientSecret: '07883c36b4f4493b70f31872ed8fbdb099ff1cef' - } - , angellist: { - clientId: 'e5feda9308f55f16b0ef0e848f5b1e41' - , clientSecret: 'e0ec367efb9d59fa10bdd53ba268b81f' - } - , yahoo: { - consumerKey: 'dj0yJmk9RVExRlhPRE9rV1hSJmQ9WVdrOWEyRTBVMUJoTm1zbWNHbzlNVE13TURFeU9UTTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iYg--' - , consumerSecret: 'efe6ae4982217630fe3aebf6e6fa1e82c02eba0b' - } -, readability: { - consumerKey: 'Alfrednerstu' - , consumerSecret: 'MXGftcxrRNMYn66CVmADR3KRnygCdYSk' - } - , justintv: { - consumerKey: 'enter your consumer key here' - , consumerSecret: 'enter your consumer secret here' - } - , tumblr: { - consumerKey: 'TAofjqRz9iKiAjtPMnXzHELIeQAw8cqKCZVXaEFSAxBrrvV99f' - , consumerSecret: 's8ldFtirtsnWGSiBjwpUwMct8Yh4sliS9Uiocqsv3bw0ovMtlR' - } - , dropbox: { - consumerKey: 'uhfqnbely5stdtm' - , consumerSecret: 'jr7ofuwo32l7vkd' - } - , vimeo: { - consumerKey: 'Enter your consumer key here' - , consumerSecret: 'Enter your consumer secret here' - } - , box: { - apiKey: '5hl66lbfy0quj8qhhzcn57dflb55y4rg' - } - , dwolla: { - clientId: 'Enter your consumer key here' - , clientSecret: 'Enter your consumer secret here' - } - , vkontakte: { - appId: 'Enter your app id here' - , appSecret: 'Enter your app secret here' - } - , mailru: { - appId: 'Enter your app id here' - , appSecret: 'Enter your app secret here' - } - , skyrock: { - consumerKey: 'a0ae943e20c5af88' - , consumerSecret: 'cjucy86r0fg4uxx3' - } - , evernote: { - oauthHost: 'https://www.evernote.com/' - , consumerKey: 'Enter your consumer key here' - , consumerSecret: 'Enter your consumer secret here' - } - , tripit: { - consumerKey: 'a59bb58479f80e24dc6da1b1e61a107db743bc4c' - , consumerSecret: '41dc4c0c39ac3ab162269a79f399eb180f753c66' - } - , _500px: { - consumerKey: 'Enter your consumer key here' - , consumerSecret: 'Enter your consumer secret here' - } - , soundcloud: { - appId: '79dcfcb876e71dc18c1767b9ebe96298' - , appSecret: '6f828028dab96838d07b2407cd5f80cd' - } - , mixi: { - consumerKey: 'Enter your consumer key here' - , consumerSecret: 'Enter your consumer secret here' - , scope: 'r_profile' - } - , mailchimp: { - appId: 'Enter your client/app id here' - , appSecret: 'Enter your client/app secret here' - } - , mendeley: { - consumerKey: 'Enter your consumer key here' - , consumerSecret: 'Enter your consumer secret here' - } -}; diff --git a/node_modules/everyauth/example/server.js b/node_modules/everyauth/example/server.js deleted file mode 100644 index 8ec318c..0000000 --- a/node_modules/everyauth/example/server.js +++ /dev/null @@ -1,435 +0,0 @@ -var express = require('express') - , everyauth = require('../index') - , conf = require('./conf') - , everyauthRoot = __dirname + '/..'; - -everyauth.debug = true; - -var usersById = {}; -var nextUserId = 0; - -function addUser (source, sourceUser) { - var user; - if (arguments.length === 1) { // password-based - user = sourceUser = source; - user.id = ++nextUserId; - return usersById[nextUserId] = user; - } else { // non-password-based - user = usersById[++nextUserId] = {id: nextUserId}; - user[source] = sourceUser; - } - return user; -} - -var usersByVimeoId = {}; -var usersByJustintvId = {}; -var usersBy37signalsId = {}; -var usersByTumblrName = {}; -var usersByDropboxId = {}; -var usersByFbId = {}; -var usersByTwitId = {}; -var usersByGhId = {}; -var usersByInstagramId = {}; -var usersByFoursquareId = {}; -var usersByGowallaId = {}; -var usersByLinkedinId = {}; -var usersByGoogleId = {}; -var usersByAngelListId = {}; -var usersByYahooId = {}; -var usersByGoogleHybridId = {}; -var usersByReadabilityId = {}; -var usersByBoxId = {}; -var usersByOpenId = {}; -var usersByDwollaId = {}; -var usersByVkId = {}; -var usersBySkyrockId = {}; -var usersByEvernoteId = {}; -var usersByAzureAcs = {}; -var usersByTripIt = {}; -var usersBy500pxId = {}; -var usersBySoundCloudId = {}; -var usersByMailchimpId = {}; -var usersMailruId = {}; -var usersByMendeleyId = {}; -var usersByLogin = { - 'brian@example.com': addUser({ login: 'brian@example.com', password: 'password'}) -}; - -everyauth.everymodule - .findUserById( function (id, callback) { - callback(null, usersById[id]); - }); - -everyauth.azureacs - .identityProviderUrl('https://acssample1.accesscontrol.windows.net/v2/wsfederation/') - .entryPath('/auth/azureacs') - .callbackPath('/auth/azureacs/callback') - .signingKey('d0julb9JNbCB8J2ACHzxU33SSiqbylQveQtuwOEvz24=') - .realm('urn:nodeacslocal') - .homeRealm('') - .tokenFormat('swt') - .findOrCreateUser( function (session, acsUser) { - return usersByAzureAcs[acsUser.id] || (usersByAzureAcs[acsUser.id] = addUser('azureAcs', acsUser)); - }) - .redirectPath('/'); - -everyauth - .openid - .myHostname('http://local.host:3000/') - .findOrCreateUser( function (session, userMetadata) { - return usersByOpenId[userMetadata.claimedIdentifier] || - (usersByOpenId[userMetadata.claimedIdentifier] = addUser('openid', userMetadata)); - }) - .redirectPath('/'); - - -everyauth - .facebook - .appId(conf.fb.appId) - .appSecret(conf.fb.appSecret) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, fbUserMetadata) { - return usersByFbId[fbUserMetadata.id] || - (usersByFbId[fbUserMetadata.id] = addUser('facebook', fbUserMetadata)); - }) - .redirectPath('/'); - -everyauth - .twitter - .consumerKey(conf.twit.consumerKey) - .consumerSecret(conf.twit.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, twitUser) { - return usersByTwitId[twitUser.id] || (usersByTwitId[twitUser.id] = addUser('twitter', twitUser)); - }) - .redirectPath('/'); - -everyauth - .password - .loginWith('email') - .getLoginPath('/login') - .postLoginPath('/login') - .loginView('login.jade') -// .loginLocals({ -// title: 'Login' -// }) -// .loginLocals(function (req, res) { -// return { -// title: 'Login' -// } -// }) - .loginLocals( function (req, res, done) { - setTimeout( function () { - done(null, { - title: 'Async login' - }); - }, 200); - }) - .authenticate( function (login, password) { - var errors = []; - if (!login) errors.push('Missing login'); - if (!password) errors.push('Missing password'); - if (errors.length) return errors; - var user = usersByLogin[login]; - if (!user) return ['Login failed']; - if (user.password !== password) return ['Login failed']; - return user; - }) - - .getRegisterPath('/register') - .postRegisterPath('/register') - .registerView('register.jade') -// .registerLocals({ -// title: 'Register' -// }) -// .registerLocals(function (req, res) { -// return { -// title: 'Sync Register' -// } -// }) - .registerLocals( function (req, res, done) { - setTimeout( function () { - done(null, { - title: 'Async Register' - }); - }, 200); - }) - .validateRegistration( function (newUserAttrs, errors) { - var login = newUserAttrs.login; - if (usersByLogin[login]) errors.push('Login already taken'); - return errors; - }) - .registerUser( function (newUserAttrs) { - var login = newUserAttrs[this.loginKey()]; - return usersByLogin[login] = addUser(newUserAttrs); - }) - - .loginSuccessRedirect('/') - .registerSuccessRedirect('/'); - -everyauth.github - .appId(conf.github.appId) - .appSecret(conf.github.appSecret) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, ghUser) { - return usersByGhId[ghUser.id] || (usersByGhId[ghUser.id] = addUser('github', ghUser)); - }) - .redirectPath('/'); - -everyauth.instagram - .appId(conf.instagram.clientId) - .appSecret(conf.instagram.clientSecret) - .scope('basic') - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, hipster) { - return usersByInstagramId[hipster.id] || (usersByInstagramId[hipster.id] = addUser('instagram', hipster)); - }) - .redirectPath('/'); - -everyauth.foursquare - .appId(conf.foursquare.clientId) - .appSecret(conf.foursquare.clientSecret) - .findOrCreateUser( function (sess, accessTok, accessTokExtra, addict) { - return usersByFoursquareId[addict.id] || (usersByFoursquareId[addict.id] = addUser('foursquare', addict)); - }) - .redirectPath('/'); - -everyauth.gowalla - .appId(conf.gowalla.apiKey) - .appSecret(conf.gowalla.apiSecret) - .moduleErrback( function(err) { - console.log("moduleErrback for Gowalla", err); - }) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, loser) { - return usersByGowallaId[loser.url] || (usersByGowallaId[loser.url] = addUser('gowalla', loser)); - }) - .redirectPath('/'); - -everyauth.linkedin - .consumerKey(conf.linkedin.apiKey) - .consumerSecret(conf.linkedin.apiSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, linkedinUser) { - return usersByLinkedinId[linkedinUser.id] || (usersByLinkedinId[linkedinUser.id] = addUser('linkedin', linkedinUser)); - }) - .redirectPath('/'); - -everyauth.google - .appId(conf.google.clientId) - .appSecret(conf.google.clientSecret) - .scope('https://www.googleapis.com/auth/userinfo.profile%20https://www.google.com/m8/feeds/') - .findOrCreateUser( function (sess, accessToken, extra, googleUser) { - googleUser.refreshToken = extra.refresh_token; - googleUser.expiresIn = extra.expires_in; - return usersByGoogleId[googleUser.id] || (usersByGoogleId[googleUser.id] = addUser('google', googleUser)); - }) - .redirectPath('/'); - -everyauth.angellist - .appId(conf.angellist.clientId) - .appSecret(conf.angellist.clientSecret) - .findOrCreateUser( function (sess, accessToken, extra, angellistUser) { - angellistUser.refreshToken = extra.refresh_token; - angellistUser.expiresIn = extra.expires_in; - return usersByAngelListId[angellistUser.id] || (usersByAngelListId[angellistUser.id] = addUser('angellist', angellistUser)); - }) - .redirectPath('/'); - -everyauth.yahoo - .consumerKey(conf.yahoo.consumerKey) - .consumerSecret(conf.yahoo.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, yahooUser) { - return usersByYahooId[yahooUser.id] || (usersByYahooId[yahooUser.id] = addUser('yahoo', yahooUser)); - }) - .redirectPath('/'); - -everyauth.googlehybrid - .myHostname('http://local.host:3000/') - .consumerKey(conf.googlehybrid.consumerKey) - .consumerSecret(conf.googlehybrid.consumerSecret) - .scope(['http://docs.google.com/feeds/','http://spreadsheets.google.com/feeds/']) - .findOrCreateUser( function(session, userAttributes) { - return usersByGoogleHybridId[userAttributes.claimedIdentifier] || (usersByGoogleHybridId[userAttributes.claimedIdentifier] = addUser('googlehybrid', userAttributes)); - }) - .redirectPath('/'); - -everyauth.readability - .consumerKey(conf.readability.consumerKey) - .consumerSecret(conf.readability.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, reader) { - return usersByReadabilityId[reader.username] || (usersByReadabilityId[reader.username] = addUser('readability', reader)); - }) - .redirectPath('/'); - -everyauth - .dropbox - .consumerKey(conf.dropbox.consumerKey) - .consumerSecret(conf.dropbox.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, dropboxUserMetadata) { - return usersByDropboxId[dropboxUserMetadata.uid] || - (usersByDropboxId[dropboxUserMetadata.uid] = addUser('dropbox', dropboxUserMetadata)); - }) - .redirectPath('/') - -everyauth.vimeo - .consumerKey(conf.vimeo.consumerKey) - .consumerSecret(conf.vimeo.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, vimeoUser) { - return usersByVimeoId[vimeoUser.id] || - (usersByVimeoId[vimeoUser.id] = vimeoUser); - }) - .redirectPath('/') - -everyauth.justintv - .consumerKey(conf.justintv.consumerKey) - .consumerSecret(conf.justintv.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) { - return usersByJustintvId[justintvUser.id] || - (usersByJustintvId[justintvUser.id] = addUser('justintv', justintvUser)); - }) - .redirectPath('/') - -everyauth['37signals'] - .appId(conf['_37signals'].clientId) - .appSecret(conf['_37signals'].clientSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, _37signalsUser) { - return usersBy37signalsId[_37signalsUser.id] || - (usersBy37signalsId[_37signalsUser.identity.id] = addUser('37signals', _37signalsUser)); - }) - .redirectPath('/') - -everyauth.tumblr - .consumerKey(conf.tumblr.consumerKey) - .consumerSecret(conf.tumblr.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessSecret, tumblrUser) { - return usersByTumblrName[tumblrUser.name] || - (usersByTumblrName[tumblrUser.name] = addUser('tumblr', tumblrUser)); - }) - .redirectPath('/'); - -everyauth.box - .apiKey(conf.box.apiKey) - .findOrCreateUser( function (sess, authToken, boxUser) { - return usersByBoxId[boxUser.user_id] || - (usersByDropboxId[boxUser.user_id] = addUser('box', boxUser)); - }) - .redirectPath('/'); - -everyauth.dwolla - .appId(conf.dwolla.clientId) - .appSecret(conf.dwolla.clientSecret) - .scope('accountinfofull') - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, dwollaUser) { - return usersByDwollaId[dwollaUser.id] || (usersByDwollaId[dwollaUser.id] = addUser('dwolla', dwollaUser)); - }) - .redirectPath('/'); - -everyauth.vkontakte - .appId(conf.vkontakte.appId) - .appSecret(conf.vkontakte.appSecret) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, vkUserMetadata) { - return usersByVkId[vkUserMetadata.uid] || - (usersByVkId[vkUserMetadata.uid] = addUser('vkontakte', vkUserMetadata)); - }) - .redirectPath('/'); - -everyauth.mailru - .appId(conf.mailru.appId) - .appSecret(conf.mailru.appSecret) - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mlUserMetadata) { - return usersMailruId[mlUserMetadata.uid] || - (usersMailruId[mlUserMetadata.uid] = addUser('mailru', mlUserMetadata)); - }) - .redirectPath('/'); - -everyauth.skyrock - .consumerKey(conf.skyrock.consumerKey) - .consumerSecret(conf.skyrock.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, skyrockUser) { - return usersBySkyrockId[skyrockUser.id_user] || (usersBySkyrockId[skyrockUser.id_user] = addUser('skyrock', skyrockUser)); - }) - .redirectPath('/'); - -everyauth.evernote - .oauthHost(conf.evernote.oauthHost) - .consumerKey(conf.evernote.consumerKey) - .consumerSecret(conf.evernote.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, enUserMetadata) { - return usersByEvernoteId[enUserMetadata.userId] || (usersByEvernoteId[enUserMetadata.userId] = addUser('evernote', enUserMetadata)); - }) - .redirectPath('/'); - -everyauth.tripit - .consumerKey(conf.tripit.consumerKey) - .consumerSecret(conf.tripit.consumerSecret) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, tripitProfile) { - var userId = tripitProfile['@attributes'].ref; - return usersByTripIt[userId] || (usersByTripIt[userId] = addUser('tripit', tripitProfile)); - }) - .redirectPath('/'); - -everyauth['500px'] - .consumerKey(conf._500px.consumerKey) - .consumerSecret(conf._500px.consumerSecret) - .findOrCreateUser(function(sess, accessToken, accessSecret, user) { - return usersBy500pxId[user.id] || (usersBy500pxId[user.id] = addUser('500px', user)); - }) - .redirectPath('/'); - -everyauth.mendeley - .consumerKey(conf.mendeley.consumerKey) - .consumerSecret(conf.mendeley.consumerSecret) - .findOrCreateUser(function(sess, accessToken, accessSecret, user) { - return usersByMendeleyId[user.main.profile_id] || (usersByMendeleyId[user.main.profile_id] = addUser('mendeley', user)); - }) - .redirectPath('/'); - -everyauth - .soundcloud - .appId(conf.soundcloud.appId) - .appSecret(conf.soundcloud.appSecret) - .findOrCreateUser( function (sess, accessToken, accessTokenExtra, soundcloudUser) { - return usersBySoundCloudId[soundcloudUser.id] || (usersBySoundCloudId[soundcloudUser.id] = addUser('soundcloud', soundcloudUser)); - }) - .redirectPath('/'); - -everyauth - .mixi - .appId(conf.mixi.consumerKey) - .appSecret(conf.mixi.consumerSecret) - .scope(conf.mixi.scope) - .display('pc') - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mixiUserMetadata) { - return usersByFbId[mixiUserMetadata.id] || - (usersByFbId[mixiUserMetadata.id] = addUser('mixi', mixiUserMetadata)); - }) - .redirectPath('/'); - -everyauth - .mailchimp - .appId(conf.mailchimp.appId) - .appSecret(conf.mailchimp.appSecret) - .myHostname(process.env.HOSTNAME || "http://127.0.0.1:3000/")//MC requires 127.0.0.1 for dev - .findOrCreateUser( function (session, accessToken, accessTokenExtra, mailchimpUser){ - return usersByMailchimpId[mailchimpUser.id] || - (usersByMailchimpId[mailchimpUser.user_id] = addUser('mailchimp', mailchimpUser)); - }) - .redirectPath("/"); - -var app = express(); -app.use(express.static(__dirname + '/public')) - .use(express.favicon()) - .use(express.bodyParser()) - .use(express.cookieParser('htuayreve')) - .use(express.session()) - .use(everyauth.middleware(app)); - -app.configure( function () { - app.set('view engine', 'jade'); - app.set('views', everyauthRoot + '/example/views'); -}); - -app.get('/', function (req, res) { - res.render('home'); -}); - -app.listen(3000); - -console.log('Go to http://local.host:3000'); - -module.exports = app; diff --git a/node_modules/everyauth/example/views/home.jade b/node_modules/everyauth/example/views/home.jade deleted file mode 100644 index 4b39cd6..0000000 --- a/node_modules/everyauth/example/views/home.jade +++ /dev/null @@ -1,181 +0,0 @@ -- if (!everyauth.loggedIn) - h2 Not Authenticated - #register - a(href='http://github.com/register') Register - #password-login - a(href='http://github.com/login', style='border: 0px') Login with Password - #fb-login.fb_button(style='background-position: left -188px') - a.fb_button_medium(href='http://github.com/auth/facebook') - span#fb_login_text.fb_button_text - Connect with Facebook - #azureacs-login - a(href='http://github.com/auth/azureacs', style='border: 0px') - img(style='border: 0px', src='http://www.microsoft.com/france/etudiants/Files/labo/windows_azure_logo.png') - #twitter-login - a(href='http://github.com/auth/twitter', style='border: 0px') - img(style='border: 0px', src='https://si0.twimg.com/images/dev/buttons/sign-in-with-twitter-l.png') - #github-login - a(href='http://github.com/auth/github', style='border: 0px') - img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/github_64.png') - #instagram-login - a(href='http://github.com/auth/instagram', style='border: 0px') - img(style='border: 0px', src='https://instagram.com/static/images/headerWithTitle.png') - #foursquare-login - a(href='http://github.com/auth/foursquare', style='border: 0px') - img(style='border: 0px', src='https://foursquare.com/img/headerLogo.png') - #gowalla-login - a(href='http://github.com/auth/gowalla', style='border: 0px') - img(style='border: 0px', src='http://static.gowalla.com/gowalla-connect-buttons/button-gowalla_connect-156ool.png') - #linkedin-login - a(href='http://github.com/auth/linkedin', style='border: 0px') - img(style='border: 0px', src='http://press.linkedin.com/sites/all/themes/presslinkedin/images/LinkedIn_WebLogo_LowResExample.jpg') - #google-login - a(href='http://github.com/auth/google', style='border: 0px') - img(style='border: 0px', src='https://www.google.com/favicon.ico') - #angellist-login - a(href='http://github.com/auth/angellist', style="color: black; text-decoration: none; font-weight: bold; font-size: 25px; font-family: 'helvetica neue', arial, helvetica, freesans, 'liberations sans', 'numbus sans l', sans-serif") AngelList - - #yahoo-login - a(href='http://github.com/auth/yahoo', style='border: 0px') - img(style='border: 0px', src='http://l.yimg.com/a/i/reg/openid/buttons/1_new.png') - #googlehybrid-login - a(href='http://github.com/auth/googlehybrid', style='border: 0px') - img(style='border: 0px', src='https://www.google.com/favicon.ico') - | Hybrid - #readability-login - a(href='http://github.com/auth/readability', style='border: 0px') - img(style='border: 0px', src='https://www.readability.com/media/images/logo_chair.png') - #dropbox-login - a(href='http://github.com/auth/dropbox', style='border: 0px') - img(src='https://www.dropbox.com/static/16890/images/logo.png') - #vimeo-login - a(href='http://github.com/auth/vimeo', style='border: 0px') - img(src='http://a.vimeocdn.com/images/logo_vimeo.png') - #justintv-login - a(href='http://github.com/auth/justintv', style='border: 0px') - img(src='http://s.jtvnw.net/jtv_user_pictures/hosted_images/new_logo_148_40_black.png') - #37signals-login - a(href='http://github.com/auth/37signals', style='border: 0px') - img(src='http://37signals.com/svn/images/37slogo-trans.gif') - #tumblr-login - a(href='http://github.com/auth/tumblr', style='border: 0px') - img(src='http://assets.tumblr.com/images/logo.png?alpha&6') - #box-login - a(href='http://github.com/auth/box', style='border: 0px') - img(src='http://sites.box.net/apps/web/simpleshare/img/logo.png') - #dwolla-login - a(href='http://github.com/auth/dwolla', style='border: 0px') Login with Dwolla - #skyrock-login - a(href='http://github.com/auth/skyrock', style='border: 0px') Login with Skyrock - #evernote-login - a(href='http://github.com/auth/evernote', style='border: 0px') - img(src='http://www.evernote.com/about/media/img/logo.png') - #tripit-login - a(href='http://github.com/auth/tripit', style='border: 0px') - img(src='http://www.tripit.com/images/logos/logo_90x40_trans.gif', title='Login with TripIt') - #500px-login - a(href='http://github.com/auth/500px', style='border: 0px') Login with 500px - #soundcloud-login - a(href='http://github.com/auth/soundcloud', style='border: 0px') - img(src='http://connect.soundcloud.com/2/btn-connect-sc-l.png', title='Login with SoundCloud') - #mixi-login - a(href='http://github.com/auth/mixi', style='border: 0px') - img(src='http://mixi.co.jp/press/images/thumb_press_def.gif', title='Login with mixi') - #mailchimp-login - a(href='http://github.com/auth/mailchimp',style='border: 0px') Login with Mailchimp - #mendeley-login - a(href='http://github.com/auth/mendeley', style='border: 0px') - img(src='http://d1rktifm8krpj.cloudfront.net/graphics/commonnew/logo-mendeley_1248201417297118.png', title='Login with Mendeley') - #openid-login - form#openid(action='http://github.com/auth/openid') - label(for='openid_identifier') OpenID Identifier:   - input(type='text', name='openid_identifier') - input(type='submit') Login -- else - h2 Authenticated - - if (everyauth.facebook) - h3 Facebook User Data - p= JSON.stringify(everyauth.facebook.user) - - if (everyauth.azureacs) - h3 Azure ACS User Data - p= JSON.stringify(everyauth.azureacs.user) - - if (everyauth.twitter) - h3 Twitter User Data - p= JSON.stringify(everyauth.twitter.user) - - if (everyauth.github) - h3 GitHub User Data - p= JSON.stringify(everyauth.github.user) - - if (everyauth.instagram) - h3 Instagram User Data - p= JSON.stringify(everyauth.instagram.user) - - if (everyauth.foursquare) - h3 Foursquare User Data - p= JSON.stringify(everyauth.foursquare.user) - - if (everyauth.gowalla) - h3 Gowalla User Data - p= JSON.stringify(everyauth.gowalla.user) - - if (everyauth.linkedin) - h3 LinkedIn User Data - p= JSON.stringify(everyauth.linkedin.user) - - if (everyauth.google) - h3 Google User Data - p= JSON.stringify(everyauth.google.user) - - if (everyauth.angellist) - h3 AngelList User Data - p= JSON.stringify(everyauth.angellist.user) - - if (everyauth.yahoo) - h3 Yahoo User Data - p= JSON.stringify(everyauth.yahoo.user) - - if (everyauth.readability) - h3 Readability User Data - p= JSON.stringify(everyauth.readability.user) - - if (everyauth.dropbox) - h3 Dropbox User Data - p= JSON.stringify(everyauth.dropbox.user) - - if (everyauth.vimeo) - h3 Vimeo User Data - p= JSON.stringify(everyauth.vimeo.user) - - if (everyauth.justintv) - h3 Justin.tv User Data - p= JSON.stringify(everyauth.justintv.user) - - if (everyauth['37signals']) - h3 37signals User Data - p= JSON.stringify(everyauth['37signals'].user) - - if (everyauth.tumblr) - h3 Tumblr User Data - p= JSON.stringify(everyauth.tumblr.user) - - if (everyauth.box) - h3 Box.net User Data - p= JSON.stringify(everyauth.box.user) - - if (everyauth.openid) - h3 Openid User Data - p= JSON.stringify(everyauth.openid.user) - - if (everyauth.dwolla) - h3 Dwolla User Data - p= JSON.stringify(everyauth.dwolla.user) - - if (everyauth.skyrock) - h3 Skyrock User Data - p= JSON.stringify(everyauth.skyrock.user) - - if (everyauth.evernote) - h3 Evernote User Data - p= JSON.stringify(everyauth.evernote.user) - - if (everyauth.tripit) - h3 TripIt User Data - p= JSON.stringify(everyauth.tripit.user) - - if (everyauth['500px']) - h3 500px User Data - p= JSON.stringify(everyauth['500px'].user) - - if (everyauth['soundcloud']) - h3 SoundCloud User Data - p= JSON.stringify(everyauth['soundcloud'].user) - - if (everyauth.mixi) - h3 mixi User Data - p= JSON.stringify(everyauth.mixi.user) - - if (everyauth.mailchimp) - h3 mailchimp User Data - p= JSON.stringify(everyauth.mailchimp.user) - - if (everyauth.mendeley) - h3 Mendeley User Data - p= JSON.stringify(everyauth.mendeley.user) - h3 - a(href='http://github.com/logout') Logout diff --git a/node_modules/everyauth/example/views/layout.jade b/node_modules/everyauth/example/views/layout.jade deleted file mode 100644 index a27059e..0000000 --- a/node_modules/everyauth/example/views/layout.jade +++ /dev/null @@ -1,9 +0,0 @@ -!!! 5 -html - head - title= typeof(title) !== 'undefined' ? title : "everyauth example" - script(src='http://static.ak.fbcdn.net/connect/en_US/core.js') - body - h1 everyauth Example - #main - != body diff --git a/node_modules/everyauth/example/views/login.jade b/node_modules/everyauth/example/views/login.jade deleted file mode 100644 index d124db8..0000000 --- a/node_modules/everyauth/example/views/login.jade +++ /dev/null @@ -1,13 +0,0 @@ -- if ('undefined' !== typeof errors && errors.length) - ul#errors - - each error in errors - li.error= error -form(action='http://github.com/login', method='post') - #login - label(for=everyauth.password.loginFormFieldName) Login - input(type='text', name=everyauth.password.loginFormFieldName, value=email) - #password - label(for=everyauth.password.passwordFormFieldName) Password - input(type='password', name=everyauth.password.passwordFormFieldName) - #submit - input(type='submit') Login diff --git a/node_modules/everyauth/example/views/register.jade b/node_modules/everyauth/example/views/register.jade deleted file mode 100644 index 83d8dda..0000000 --- a/node_modules/everyauth/example/views/register.jade +++ /dev/null @@ -1,14 +0,0 @@ -h2 Register -- if ('undefined' !== typeof errors && errors.length) - ul#errors - - each error in errors - li.error= error -form(action='http://github.com/register', method='post') - #login - label(for=everyauth.password.loginFormFieldName) Login - input(type='text', name=everyauth.password.loginFormFieldName, value=userParams[everyauth.password.loginFormFieldName]) - #password - label(for=everyauth.password.passwordFormFieldName) Password - input(type='password', name=everyauth.password.passwordFormFieldName) - #submit - input(type='submit') Register diff --git a/node_modules/everyauth/index.js b/node_modules/everyauth/index.js deleted file mode 100644 index 460c887..0000000 --- a/node_modules/everyauth/index.js +++ /dev/null @@ -1,162 +0,0 @@ -var connect = require('connect') - , express = require('express') - , __pause = connect.utils.pause - , everyauth = module.exports = {}; - - -everyauth.helpExpress = function () { - console.warn('everyauth.helpExpress is being deprecated. helpExpress is now automatically invoked when it detects express. So remove everyauth.helpExpress from your code'); - return this; -} - -everyauth.debug = false; - -// The connect middleware. e.g., -// connect( -// ... -// , everyauth.middleware() -// , ... -// ) -everyauth.middleware = function (expressApp) { - if (expressApp) { - // Then decorate the parent app as soon as we mount everyauth as middleware - // so that any views accessible from the parent app have dynamic helpers - // related to everyauth. - var userAlias = everyauth.expressHelperUserAlias || 'user'; - - expressApp.use( function (req, res, next) { - var sess = req.session - , auth = sess.auth - , ea = { loggedIn: !!(auth && auth.loggedIn) }; - - // Copy the session.auth properties over - for (var k in auth) { - ea[k] = auth[k]; - } - - if (everyauth.enabled.password) { - // Add in access to loginFormFieldName() + passwordFormFieldName() - ea.password || (ea.password = {}); - ea.password.loginFormFieldName = everyauth.password.loginFormFieldName(); - ea.password.passwordFormFieldName = everyauth.password.passwordFormFieldName(); - } - ea.user = req.user; - - res.locals.everyauth = ea; - next(); - }); - - expressApp.use( function (req, res, next) { - res.locals[userAlias] = req.user; - next(); - }); - } - - var app = express(); - app.use(function registerReqGettersAndMethods (req, res, next) { - var methods = everyauth._req._methods - , getters = everyauth._req._getters; - for (var name in methods) { - req[name] = methods[name]; - } - for (name in getters) { - Object.defineProperty(req, name, { - get: getters[name] - }); - } - next(); - }) - .use(function fetchUserFromSession (req, res, next) { - var sess = req.session - , auth = sess && sess.auth; - if (!auth || !auth.userId) return next(); - var everymodule = everyauth.everymodule; - var pause = __pause(req); - - var findUserById_callback = function (err, user) { - if (err) { - pause.resume(); - return next(err); - } - if (user) req.user = user; - else delete sess.auth; - next(); - pause.resume(); - }; - - var findUserById_function = everymodule.findUserById(); - - findUserById_function.length === 3 - ? findUserById_function( req, auth.userId, findUserById_callback ) - : findUserById_function( auth.userId, findUserById_callback ); - - }) - .use(app.router) - - var modules = everyauth.enabled - , _module; - for (var _name in modules) { - _module = modules[_name]; - _module.validateSequences(); - _module.routeApp(app); - } - - app.everyauth = true; - - return app; -}; - -everyauth._req = { - _methods: {} - , _getters: {} -}; - -everyauth.addRequestMethod = function (name, fn) { - this._req._methods[name] = fn; - return this; -}; - -everyauth.addRequestGetter = function (name, fn, isAsync) { - this._req._getters[name] = fn; - return this; -}; - -everyauth - .addRequestMethod('logout', function () { - var req = this; - delete req.session.auth; - }) - .addRequestGetter('loggedIn', function () { - var req = this; - return !!(req.session && req.session.auth && req.session.auth.loggedIn); - }); - -everyauth.modules = {}; -everyauth.enabled = {}; - -// Grab all filenames in ./modules -- They correspond to the modules of the same name -// as the filename (minus '.js') -var fs = require('fs'); -var files = fs.readdirSync(__dirname + '/lib/modules'); -var includeModules = files.map( function (fname) { - return fname.substring(0, fname.length - 3); -}); -for (var i = 0, l = includeModules.length; i < l; i++) { - var name = includeModules[i]; - - // Lazy enabling of a module via `everyauth` getters - // i.e., the `facebook` module is not loaded into memory - // until `everyauth.facebook` is evaluated - Object.defineProperty(everyauth, name, { - get: (function (name) { - return function () { - var mod = this.modules[name] || (this.modules[name] = require('./lib/modules/' + name)); - // Make `everyauth` accessible from each auth strategy module - if (!mod.everyauth) mod.everyauth = this; - if (mod.shouldSetup) - this.enabled[name] = mod; - return mod; - } - })(name) - }); -}; diff --git a/node_modules/everyauth/lib/modules/37signals.js b/node_modules/everyauth/lib/modules/37signals.js deleted file mode 100644 index 0cdca99..0000000 --- a/node_modules/everyauth/lib/modules/37signals.js +++ /dev/null @@ -1,51 +0,0 @@ -var oauthModule = require('./oauth2'); - -module.exports = -oauthModule.submodule('37signals') - .configurable({ - scope: 'specify types of access: (no scope), user, public_repo, repo, gist' - }) - - .oauthHost('https://launchpad.37signals.com/') - .apiHost('https://launchpad.37signals.com/') - - .authPath('/authorization/new') - .authQueryParam('type', 'web_server') - - .accessTokenPath('/authorization/token') - .accessTokenParam('type', 'web_server') - - .postAccessTokenParamsVia('data') - - .entryPath('/auth/37signals') - .callbackPath('/auth/37signals/callback') - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/authorization.json', accessToken, function (err, data) { - if (err) return p.fail(err); - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var _37sigResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - _37sigResponse.statusCode - , _37sigResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/500px.js b/node_modules/everyauth/lib/modules/500px.js deleted file mode 100644 index 5a7c877..0000000 --- a/node_modules/everyauth/lib/modules/500px.js +++ /dev/null @@ -1,17 +0,0 @@ -var oauthModule = require('./oauth'); - -module.exports = -oauthModule.submodule('500px') - .apiHost('https://api.500px.com/v1') - .oauthHost('https://api.500px.com/v1') - .entryPath('/auth/500px') - .callbackPath('/auth/500px/callback') - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/users', accessToken, accessTokenSecret, function (err, data) { - if (err) { return p.fail(err); } - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }); - return p; - }); diff --git a/node_modules/everyauth/lib/modules/angellist.js b/node_modules/everyauth/lib/modules/angellist.js deleted file mode 100644 index 3d61493..0000000 --- a/node_modules/everyauth/lib/modules/angellist.js +++ /dev/null @@ -1,49 +0,0 @@ -var oauthModule = require('./oauth2'); - -module.exports = -oauthModule.submodule('angellist') - .configurable({ - scope: 'specify types of access: (no scope), user, public_repo, repo, gist' - }) - - .oauthHost('https://angel.co/') - .apiHost('https://api.angel.co/1') - - .authPath('/api/oauth/authorize') - .authQueryParam('response_type', 'code') - - .accessTokenPath('/api/oauth/token') - .accessTokenParam('grant_type', 'authorization_code') - - .entryPath('/auth/angellist') - .callbackPath('/auth/angellist/callback') - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/me', accessToken, function (err, data) { - if (err) return p.fail(err); - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var angellistResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - angellistResponse.statusCode - , angellistResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/azureacs.js b/node_modules/everyauth/lib/modules/azureacs.js deleted file mode 100644 index 2ac8248..0000000 --- a/node_modules/everyauth/lib/modules/azureacs.js +++ /dev/null @@ -1,157 +0,0 @@ -var everyModule = require('./everymodule') - , url = require('url') - , querystring = require('querystring') - , Swt = require('node-swt') - , WsFederation = require('node-wsfederation') - , openId = require('openid') - , extractHostname = require('../utils').extractHostname; - -var azureacs = module.exports = -everyModule.submodule('azureacs') - .definit( function () { - this.wsfederation = new WsFederation(this.realm(), this.homeRealm(), this.identityProviderUrl()); - }) - .configurable({ - identityProviderUrl : 'the federation endpoint at the identity provider' - , signingKey : 'a 256-bit symmetric key for the namespace' - , realm : 'the relying party application identifier, e.g., http://myapp.cloudapp.net' - , redirectPath : 'the path to redirect once the user is authenticated' - , tokenFormat : 'the format used to parse the token' - , homeRealm : 'the indentity provider' - , authCallbackDidErr : 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' - }) - - // Declares a GET route that is aliased - // as 'entryPath'. The handler for this route - // triggers the series of steps that you see - // indented below it. - .get('entryPath', - 'the link a user follows, whereupon you redirect them to ACS url- e.g., "/auth/facebook"') - .step('redirectToIdentityProviderSelector') - .accepts('req res next') - .promises(null) - - .post('callbackPath', - 'the callback path that the ACS redirects to after an authorization result - e.g., "/auth/facebook/callback"') - .step('getToken') - .description('retrieves a verifier code from the url query') - .accepts('req res next') - .promises('token') - .canBreakTo('notValidTokenCallbackErrorSteps') - .canBreakTo('authCallbackErrorSteps') - .step('parseToken') - .description('retrieves a verifier code from the url query') - .accepts('token') - .promises('claims') - .canBreakTo('notValidTokenCallbackErrorSteps') - .step('fetchUser') - .accepts('claims') - .promises('acsUser') - .step('getSession') - .accepts('req') - .promises('session') - .step('findOrCreateUser') - .accepts('session acsUser') - .promises('user') - .step('addToSession') - .accepts('session acsUser token') - .promises(null) - .step('sendResponse') - .accepts('res') - .promises(null) - - .stepseq('authCallbackErrorSteps') - .step('handleAuthCallbackError', - 'a request handler that intercepts a failed authorization message sent from the ACS provider to your service. e.g., the request handler for "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request."') - .accepts('req res next') - .promises(null) - - .stepseq('protocolNotImplementedErrorSteps') - .step('handleProtocolNotImplementedError', - 'the protocol specified is not implemented yet.') - .accepts('tokenFormat') - .promises(null) - - .stepseq('notValidTokenCallbackErrorSteps') - .step('handleNotValidTokenCallbackError', - 'the token is not valid"') - .accepts('token') - .promises(null) - - .redirectToIdentityProviderSelector( function (req, res) { - var identityProviderSelectorUri = this.wsfederation.getRequestSecurityTokenUrl(); - this.redirect(res, identityProviderSelectorUri); - }) - - .getToken( function (req, res) { - var token = this.wsfederation.extractToken(res); - - if (this.tokenFormat() === 'swt') { - var str = token['wsse:BinarySecurityToken']['#']; - var result = new Buffer(str, 'base64').toString('ascii'); - } - else { - return this.breakTo('protocolNotImplementedErrorSteps', this.tokenFormat()); - } - - if (this._authCallbackDidErr(req)) { - return this.breakTo('authCallbackErrorSteps', req, res); - } - - return result; - }) - - .parseToken( function (token) { - if (this.tokenFormat() === 'swt') { - var swt = new Swt(token); - if (!swt.isValid(token, this.realm(), this.signingKey())) { - return this.breakTo('notValidTokenCallbackErrorSteps', token); - } - return swt.claims; - } - - return this.breakTo('protocolNotImplementedErrorSteps', this.tokenFormat()); - }) - - .getSession( function (req) { - return req.session; - }) - - .fetchUser( function (claims) { - var user = {}; - user['azureacs'] = claims; - return user; - }) - - .addToSession( function (sess, acsUser, token) { - var _auth = sess.auth || (sess.auth = {}) - , mod = _auth[this.name] || (_auth[this.name] = {}); - _auth.loggedIn = true; - _auth.userId || (_auth.userId = acsUser.id); - mod.user = acsUser; - mod.accessToken = token; - }) - - .sendResponse( function (res) { - var redirectTo = this.redirectPath(); - if (!redirectTo) - throw new Error('You must configure a redirectPath'); - this.redirect(res, redirectTo); - }) - - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; - }) - - .handleNotValidTokenCallbackError( function (token) { - throw new Error("The token received is NOT valid"); - }) - - .handleAuthCallbackError( function (req, res) { - throw new Error("Authorization Error"); - }) - - .handleProtocolNotImplementedError( function (tokenFormat) { - throw new Error("The protocol specified is not implemented. Token format:" +tokenFormat); - }) diff --git a/node_modules/everyauth/lib/modules/box.js b/node_modules/everyauth/lib/modules/box.js deleted file mode 100644 index 3d4305d..0000000 --- a/node_modules/everyauth/lib/modules/box.js +++ /dev/null @@ -1,161 +0,0 @@ -var everyModule = require('./everymodule') - , request = require('request') - , url = require('url') - , xml2js =require('xml2js'); - -var box = module.exports = -everyModule.submodule('box') - .configurable({ - apiKey: 'The API key obtained when registering a project with OpenBox' - , redirectPath: 'Where to redirect to after a failed or successful auth' - }) - - .get('entryPath', - 'the link a user follows, whereupon you redirect them to Box.net -- e.g., "/auth/box"') - .step('getTicket') - .description('asks Box.net for a unique ticket for each user of your app') - .accepts('req res next') - .promises('ticket') - .step('redirectToBoxAuth') - .description('redirects the user to https://www.box.net/api/1.0/auth/') - .accepts('res ticket') - .promises(null) - .get('callbackPath', - 'the callback path that Box.net redirects to after an authorization result - e.g., "/auth/box/callback"') - .step('extractAuthToken') - .description('extracts auth_token from the url that Box.net redirects to after authorization') - .accepts('req res next') - .promises('authToken') - .step('getSession') - .description('extracts the session from the incoming request') - .accepts('req') - .promises('session') - .step('fetchUser') - .description('fetches the authorizing user via the API with the authToken') - .accepts('authToken') - .promises('boxUser') - .step('findOrCreateUser') - //.optional() - .accepts('session authToken boxUser') - .promises('user') - .step('compileAuth') - .description('combines the ticket, auth token, fetched boxUser, and your app user into a single object') - .accepts('authToken boxUser user') - .promises('auth') - .step('addToSession') - .description('adds the auth token and box.net user metadata to the session') - .accepts('session auth') - .promises(null) - .step('sendResponse') - .description('sends a response to the client by rendering a successful auth view') - .accepts('res') - .promises(null) - - .getTicket( function (req, res) { - var promise = this.Promise(); - request.get({ - url: this._apiHost + '/rest' - , qs: { action: 'get_ticket', api_key: this._apiKey } - }, function (err, res, body) { - var parser = new xml2js.Parser; - console.log(body); - parser.parseString(body, function (xmlErr, json) { - if (xmlErr) { - return promise.fail(xmlErr); - } - if (err) { - err.extra = {res: res, data: json}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: json, res: res}}); - } - var ticket = json.ticket; - return promise.fulfill(ticket); - }); - }); - return promise; - }) - .redirectToBoxAuth( function (res, ticket) { - this.redirect(res, this._apiHost + '/auth/' + ticket); - }) - - .extractAuthToken( function (req, res) { - var parsedUrl = url.parse(req.url, true) - , authToken = parsedUrl.query && parsedUrl.query.auth_token; - return authToken; - }) - .getSession( function (req, res) { - return req.session; - }) - .fetchUser( function (authToken) { - var promise = this.Promise(); - request.get({ - url: this._apiHost + '/rest' - , qs: { - action: 'get_account_info' - , api_key: this._apiKey - , auth_token: authToken - } - }, function (err, res, body) { - var parser = new xml2js.Parser; - parser.parseString(body, function (xmlErr, json) { - if (xmlErr) { - return promise.fail(xmlErr); - } - if (err) { - err.extra = {res: res, data: json}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: json, res: res}}); - } - var user = json.user - return promise.fulfill(user); - }); - }); - return promise; - }) - .compileAuth( function (authToken, boxUser, user) { - return compiled = { - authToken: authToken - , boxUser: boxUser - , user: user - }; - }) - .addToSession( function (sess, auth) { - var _auth = sess.auth || (sess.auth = {}) - , mod = _auth[this.name] || (_auth[this.name] = {}); - _auth.loggedIn = true; - _auth.userId || (_auth.userId = auth.user.user_id); - mod.user = auth.boxUser; - mod.authToken = auth.authToken; - }) - .sendResponse( function (res) { - var redirectTo = this.redirectPath(); - if (!redirectTo) - throw new Error('You must configure a redirectPath'); - this.redirect(res, redirectTo); - }) - - .entryPath('/auth/box') - .callbackPath('/auth/box/callback') - - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var boxResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - boxResponse.statusCode - , boxResponse.headers); - serverResponse.end(err.extra.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); - -box._apiHost = 'https://www.box.net/api/1.0'; diff --git a/node_modules/everyauth/lib/modules/dropbox.js b/node_modules/everyauth/lib/modules/dropbox.js deleted file mode 100644 index 7bcae6d..0000000 --- a/node_modules/everyauth/lib/modules/dropbox.js +++ /dev/null @@ -1,18 +0,0 @@ -var oauthModule = require('./oauth'); - -var dropbox = module.exports = -oauthModule.submodule('dropbox') - .apiHost('https://api.dropbox.com/1') - .oauthHost('https://www.dropbox.com/1') - .entryPath('/auth/dropbox') - .callbackPath('/auth/dropbox/callback') - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/account/info', accessToken, accessTokenSecret, function (err, data) { - if (err) return p.fail(err); - var oauthUser = JSON.parse(data); - oauthUser.id = oauthUser.uid; - p.fulfill(oauthUser); - }); - return p; - }); diff --git a/node_modules/everyauth/lib/modules/dwolla.js b/node_modules/everyauth/lib/modules/dwolla.js deleted file mode 100644 index a3acd5e..0000000 --- a/node_modules/everyauth/lib/modules/dwolla.js +++ /dev/null @@ -1,64 +0,0 @@ -var oauthModule = require('./oauth2') - , request = require('request'); - -var dwolla = module.exports = -oauthModule.submodule('dwolla') - .configurable({ - scope: 'specify types of access: accountinfofull|request|contacts|balance|send|transactions' - }) - - .oauthHost('https://www.dwolla.com/') - .apiHost('https://www.dwolla.com/oauth/rest') - - .authPath('/oauth/v2/authenticate') - .accessTokenPath('/oauth/v2/token') - .accessTokenParam('grant_type', 'authorization_code') - - .entryPath('/auth/dwolla') - .callbackPath('/auth/dwolla/callback') - - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - - .authQueryParam('response_type', 'code') - - .fetchOAuthUser( function (accessToken) { - var promise = this.Promise(); - request.get({ - url: this.apiHost() + '/users' - , qs: { oauth_token: accessToken, alt: 'json' } - }, function (err, res, body) { - if (err) { - err.extra = {res: res, data: body}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: body, res: res}}); - } - var oauthUser = JSON.parse(body).Response; - return promise.fulfill(oauthUser); - }); - - return promise; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var dwollaResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - dwollaResponse.statusCode - , dwollaResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/evernote.js b/node_modules/everyauth/lib/modules/evernote.js deleted file mode 100644 index 0a9ace1..0000000 --- a/node_modules/everyauth/lib/modules/evernote.js +++ /dev/null @@ -1,24 +0,0 @@ -var oauthModule = require('./oauth') - , url = require('url'); - -var evernote = module.exports = -oauthModule.submodule('evernote') - .oauthHost('https://www.evernote.com/') - .entryPath('/auth/evernote') - .callbackPath('/auth/evernote/callback') - .authorizePath('/OAuth.action') - .requestTokenPath('/oauth') - .accessTokenPath('/oauth') - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var oauthUser = { - shardId: params.edam_shard - , userId: parseInt(params.edam_userId, 10) - }; - accessToken.split(':').forEach(function(item) { - item = item.split('='); - if (item[0] === 'A') { - oauthUser['username'] = item[1]; - } - }); - return oauthUser; - }); \ No newline at end of file diff --git a/node_modules/everyauth/lib/modules/everymodule.js b/node_modules/everyauth/lib/modules/everymodule.js deleted file mode 100644 index c3fb1c2..0000000 --- a/node_modules/everyauth/lib/modules/everymodule.js +++ /dev/null @@ -1,365 +0,0 @@ -var url = require('url') - , Step = require('../step') - , StepSequence = require('../stepSequence') - , RouteTriggeredSequence = require('../routeTriggeredSequence') - , clone = require('../utils').clone - , Promise = require('../promise'); - -var everyModule = module.exports = { - name: 'everymodule' - - , definit: function definit (fn) { - // Remove any prior `init` that was assigned directly to the object via - // definit and not assigned via prototypal inheritance - if (this.hasOwnProperty('init')) delete this.init; - - var _super = this.init; - // since this.hasOwnProperty('init') is false - - this.init = function init () { - this._super = _super; - fn.apply(this, arguments); - delete this._super; - - // Do module compilation here, too - }; - return this; - } - - , _stepSequences: {} - , stepseq: function stepseq (name, description) { - this.configurable(name, description); - this._currSeq = - this._stepSequences[name] || (this._stepSequences[name] = new StepSequence(name, this)); - return this; - } - - // _configurable maps parameter names to descriptions - // It is used for introspection with this.configurable() - , _configurable: {} - , configurable: function configurable (arg, description) { - - // Support function signature: - // module.configurable() - // Return a listing of the module's configuration - if (!arguments.length) return this._configurable; - - var property; - if (arg.constructor == Object) { - for (property in arg) { - description = arg[property]; - this.configurable(property, description); - } - return this; - } - - console.assert('string' === typeof arg); - - property = arg; - - // Support function signature: - // module.configurable(paramName); - // Returns the configurable param description - if (arguments.length === 1 && this[property]) { - return this._configurable[property]; - } - - // Support function signature: - // module.configurable('someParam', 'description'); - this[property] = function (setTo) { - var k = '_' + property; - if (arguments.length) { - this[k] = setTo; - return this; - } - // TODO this.everyauth is not yet available here in some contexts - // For example, when we set and try to access a scope in an auth module definition - // but if you look in index, everyauth is not assigned to the module until after it is - // required - if ('undefined' === typeof this[k]) { - var debugMsg = 'WARNING: You are trying to access the attribute/method configured by `' + - property + '`, which you did not configure. Time to configure it.'; - throw new Error(debugMsg); - } - return this[k]; - }; - - this._configurable[property] = description || 'No Description'; - - // Add configurable to submodules that inherit from this supermodule - for (var name in this.submodules) { - this.submodules[name].configurable(arg, description); - } - return this; - } - - // Convenience method for all you coffee-script lovers, e.g., - // - // everyauth.dropbox.configure - // consumerKey: conf.dropbox.consumerKey - // consumerSecret: conf.dropbox.consumerSecret - // findOrCreateUser: (sess, accessToken, accessSecret, dbMeta) -> users[dbMeta.uid] or= addUser('dropbox', dbMeta) - // redirectPath: '/' - , configure: function (conf) { - for (var k in conf) { - this[k](conf[k]); - } - return this; - } - - // TODO Move `.step(name)` behind StepSequence.prototype - , step: function (name) { - var steps = this._steps - , sequence = this._currSeq; - - if (!sequence) - throw new Error("You can only declare a step after declaring a route alias via `get(...)` or `post(...)`."); - - sequence.orderedStepNames.push(name); - - this._currentStep = - steps[name] || (steps[name] = new Step(name, this)); - - // For configuring what the actual business - // logic is: - // fb.step('fetchOAuthUser') generates the method - // fb.fetchOAuthUser whose logic can be configured like - // fb.fetchOAuthUser( function (...) { - // // Business logic goes here - // } ); - this.configurable(name, - 'STEP FN [' + name + '] function encapsulating the logic for the step `' + name + '`.'); - return this; - } - - , accepts: function (input) { - this._currentStep.accepts = input && input.split(/\s+/) || null; - return this; - } - - , promises: function (output) { - this._currentStep.promises = output && output.split(/\s+/) || null; - return this; - } - - , description: function (desc) { - var step = this._currentStep; - step.description = desc; - if (desc) desc = 'STEP FN [' + step.name + '] - ' + desc; - this.configurable(step.name, desc); - return this; - } - - , stepTimeout: function (millis) { - this._currentStep.timeout = millis; - return this; - } - - , stepErrback: function (fn) { - this._currentStep.errback = fn; - return this; - } - - , canBreakTo: function (sequenceName) { - // TODO Implement this (like static typing) - // unless `canBreakTo` only needed for - // readability - return this; - } - - - , cloneOnSubmodule: ['cloneOnSubmodule', '_configurable'] - - , submodules: {} - - // Creates a new submodule using prototypal inheritance - , submodule: function (name) { - var self = this - // So that when we add configurables after - // to the supermodule after the submodule - // creation, we can propagate those configurables - // to the supermodule's submodules - , submodule = this.submodules[name] = Object.create(this, { - name: { value: name } - , submodules: { value: {} } - }); - - this.cloneOnSubmodule.forEach( function (toClone) { - submodule[toClone] = clone(self[toClone]); - }); - - var seqs = this._stepSequences - , newSeqs = submodule._stepSequences = {}; - for (var seqName in seqs) { - newSeqs[seqName] = seqs[seqName].clone(submodule); - } - - var steps = this._steps - , newSteps = submodule._steps = {}; - for (var stepName in steps) { - newSteps[stepName] = steps[stepName].clone(stepName, submodule); - } - - return submodule; - } - - , validateSequences: function () { - var seqs = this._stepSequences; - for (var seqName in seqs) - seqs[seqName].validateSteps(); - } - - // Decorates the app with the routes required of the module - , routeApp: function (app) { - if (this.init) this.init(); - var routes = this._routes - , methods = ['get', 'post']; - for (var method in routes) { - for (var routeAlias in routes[method]) { - var path = this[routeAlias](); - if (!path) - throw new Error('You have not defined a path for the route alias ' + routeAlias + '.'); - var seq = routes[method][routeAlias]; - - // This kicks off a sequence of steps based on a route - // Creates a new chain of promises and exposes the leading promise - // to the incoming (req, res) pair from the route handler - app[method](path, seq.routeHandler.bind(seq)); - } - } - } - - , Promise: function (values) { - return new Promise(this, values); - } - - /** - * Function signature: - * breakTo(sequenceName, arg1, arg2, ...); - * - * [arg1, arg2, ...] are the arguments passed to the `sequence.start(...)` - * where sequence is the sequence with the name `sequenceName` - */ - , breakTo: function (sequenceName) { - // TODO Garbage collect the abandoned sequence - var seq = this._stepSequences[sequenceName]; - if (!seq) { - throw new Error('You are trying to break to a sequence named `' + sequenceName + '`, but there is no sequence with that name in the auth module, `' + this.name + '`.'); - } - var args = Array.prototype.slice.call(arguments, 1); - seq = seq.materialize(); - seq.initialArgs = args; - throw seq; - } - - // _steps maps step names to step objects - // A step object is { accepts: [...], promises: [...] } - , _steps: {} - - , redirect: function (req, location) { - this._performRedirect(req, location); - } -}; - -everyModule.get = route('get'); -everyModule.post = route('post'); - -/** - * Returns a function used for declaring new route triggered sequences - * associated with the uri route and the http `method` - * @param {String} httpMethod (e.g, 'get', 'post') - */ -function route (httpMethod) { - return function (alias, description) { /* `this` is `everyModule` */ - if (description) - description = routeDescPrefix[httpMethod.toLowerCase()] + ' - ' + description; - this.configurable(alias, description); - var name = httpMethod + ':' + alias; - this._currSeq = - this._stepSequences[name] || (this._stepSequences[name] = new RouteTriggeredSequence(name, this)); - return this; - }; -} - -var routeDescPrefix = { - get: 'ROUTE (GET)' - , post: 'ROUTE (POST)' -}; - -// Used to determine if we should validate the module's sequences and setup the -// module's routes. If a module is strictly used as a parent or ancestor module -// to define a shared interface for submodules, then, this should be false. -Object.defineProperty(everyModule, 'shouldSetup', { get: function () { - return ! Object.keys(this.submodules).length; -}}); - -Object.defineProperty(everyModule, '_routes', { get: function () { - var seqs = this._stepSequences - , methods = ['get', 'post']; - return Object.keys(seqs).filter( function (seqName) { - return ~methods.indexOf(seqName.split(':')[0]); - }).reduce( function (_routes, routeName) { - var parts = routeName.split(':') - , method = parts[0] - , routeAlias = parts[1]; - _routes[method] || (_routes[method] = {}); - _routes[method][routeAlias] = seqs[routeName]; - return _routes; - }, {}); -}}); - -Object.defineProperty(everyModule, 'route', { - get: function () { return this._routes; } -}); - -Object.defineProperty(everyModule, 'routes', {get: function () { - var arr = [] - , _routes = this._routes - , _descriptions = this._configurable; - for (var method in _routes) { - for (var alias in _routes[method]) { - method = method.toUpperCase(); - arr.push(method + ' (' + alias + ') [' + - this[alias]() + ']' + - _descriptions[alias].replace(routeDescPrefix[method.toLowerCase()], '')); - } - } - return arr; -}}); - -everyModule - .configurable({ - moduleTimeout: 'How long to wait per step before timing out and invoking any timeout callbacks' - , moduleErrback: 'THE error callback that is invoked any time an error occurs in the module; ' + - 'defaults to passing the error to connect/express `next` callback' - , logoutRedirectPath: 'Where to redirect the app upon logging out' - , findUserById: 'function for fetching a user by his/her id -- used to assign to `req.user` - function ( [req], userId, callback) where function callback (err, user)' - , performRedirect: 'function for redirecting responses' - , userPkey: 'identifying property of the user; defaults to "id"' - }) - .get('logoutPath') - .step('handleLogout') - .accepts('req res next') - .promises(null) - .logoutPath('/logout') - .handleLogout( function (req, res) { - req.logout(); - this.redirect(res, this.logoutRedirectPath()); - }) - .logoutRedirectPath('/') - .userPkey('id'); - -everyModule.performRedirect( function(res, location) { - res.writeHead(303, { 'Location': location }); - res.end(); -}); - -everyModule.moduleTimeout(10000); -everyModule.moduleErrback( function (err, seqValues) { - if (! (err instanceof Error)) { - console.log('Warning: Try to pass only Errors'); - err = new Error(JSON.stringify(err)); - } - var next = seqValues.next; - next(err); -}); diff --git a/node_modules/everyauth/lib/modules/facebook.js b/node_modules/everyauth/lib/modules/facebook.js deleted file mode 100644 index 56da7c5..0000000 --- a/node_modules/everyauth/lib/modules/facebook.js +++ /dev/null @@ -1,86 +0,0 @@ -var oauthModule = require('./oauth2') - , url = require('url'); - -var fb = module.exports = -oauthModule.submodule('facebook') - .configurable({ - scope: 'specify types of access: See http://developers.facebook.com/docs/authentication/permissions/', - fields: 'specify returned fields: See http:/developers.facebook.com/docs/reference/api/user/' - }) - - .apiHost('https://graph.facebook.com/') - .oauthHost('https://graph.facebook.com/') - - .authPath('https://www.facebook.com/dialog/oauth') - - .entryPath('/auth/facebook') - .callbackPath('/auth/facebook/callback') - - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; - }) - .handleAuthCallbackError( function (req, res) { - var parsedUrl = url.parse(req.url, true) - , errorDesc = parsedUrl.query.error_description; - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: errorDesc - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - var fieldsQuery = ""; - if (this._fields && this._fields.length > 0){ - fieldsQuery = "?fields=" + this.fields(); - } - this.oauth.get(this.apiHost() + '/me' + fieldsQuery, accessToken, function (err, data) { - if (err) return p.fail(err); - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var facebookResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - facebookResponse.statusCode - , facebookResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); - -fb.mobile = function (isMobile) { - if (isMobile) { - this.authPath('https://m.facebook.com/dialog/oauth'); - } - return this; -}; - -fb.popup = function (isPopup) { - if (isPopup) { - this.authQueryParam('display', 'popup'); - } - return this; -}; diff --git a/node_modules/everyauth/lib/modules/foursquare.js b/node_modules/everyauth/lib/modules/foursquare.js deleted file mode 100644 index f20754e..0000000 --- a/node_modules/everyauth/lib/modules/foursquare.js +++ /dev/null @@ -1,56 +0,0 @@ -var oauthModule = require('./oauth2') - , request = require('request'); - -var foursquare = module.exports = -oauthModule.submodule('foursquare') - .apiHost('https://api.foursquare.com/v2') - .oauthHost('https://foursquare.com/') - - .authPath('/oauth2/authenticate') - .accessTokenPath('/oauth2/access_token') - - .entryPath('/auth/foursquare') - .callbackPath('/auth/foursquare/callback') - - .authQueryParam('response_type', 'code') - - .accessTokenHttpMethod('get') - .accessTokenParam('grant_type', 'authorization_code') - - .fetchOAuthUser( function (accessToken) { - var promise = this.Promise() - , userUrl = this.apiHost() + '/users/self' - , queryParams = { oauth_token: accessToken } - request.get({ url: userUrl, qs: queryParams}, function (err, res, body) { - if (err) { - err.extra = {res: res, data: body}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: body, res: res}}); - } - var oauthUser = JSON.parse(body).response.user; - return promise.fulfill(oauthUser); - }); - return promise; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var foursquareResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - foursquareResponse.statusCode - , foursquareResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/github.js b/node_modules/everyauth/lib/modules/github.js deleted file mode 100644 index 927a986..0000000 --- a/node_modules/everyauth/lib/modules/github.js +++ /dev/null @@ -1,50 +0,0 @@ -var oauthModule = require('./oauth2'); - -var github = module.exports = -oauthModule.submodule('github') - .configurable({ - scope: 'specify types of access: (no scope), user, public_repo, repo, gist' - }) - - .oauthHost('https://github.com/') - .apiHost('https://github.com/api/v2/json') - - .authPath('/login/oauth/authorize') - .accessTokenPath('/login/oauth/access_token') - - .entryPath('/auth/github') - .callbackPath('/auth/github/callback') - - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/user/show', accessToken, function (err, data) { - if (err) return p.fail(err); - var oauthUser = JSON.parse(data).user; - p.fulfill(oauthUser); - }) - return p; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var ghResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - ghResponse.statusCode - , ghResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/google.js b/node_modules/everyauth/lib/modules/google.js deleted file mode 100644 index e29420b..0000000 --- a/node_modules/everyauth/lib/modules/google.js +++ /dev/null @@ -1,132 +0,0 @@ -var oauthModule = require('./oauth2') - , url = require('url') - , request = require('request'); - -var google = module.exports = -oauthModule.submodule('google') - .configurable({ - scope: "URL identifying the Google service to be accessed. See the documentation for the API you'd like to use for what scope to specify. To specify more than one scope, list each one separated with a space." - }) - - .oauthHost('https://accounts.google.com/') - .apiHost('https://www.google.com/m8/feeds') - - .authPath('/o/oauth2/auth') - .authQueryParam('response_type', 'code') - - .accessTokenPath('/o/oauth2/token') - .accessTokenParam('grant_type', 'authorization_code') - .accessTokenHttpMethod('post') - .postAccessTokenParamsVia('data') - - .entryPath('/auth/google') - .callbackPath('/auth/google/callback') - - .authQueryParam({ - access_type: 'offline' - , approval_prompt: 'force' - , scope: function () { - return this._scope && this.scope(); - } - }) - - .addToSession( function (sess, auth) { - this._super(sess, auth); - if (auth.refresh_token) { - sess.auth[this.name].refreshToken = auth.refresh_token; - sess.auth[this.name].expiresInSeconds = parseInt(auth.expires_in, 10); - } - }) - - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; - }) - - .handleAuthCallbackError( function (req, res) { - var parsedUrl = url.parse(req.url, true) - , errorDesc = parsedUrl.query.error + "; " + parsedUrl.query.error_description; - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: errorDesc - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var googleResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - googleResponse.statusCode - , googleResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }) - - .fetchOAuthUser( function (accessToken) { - var promise = this.Promise() - , userUrl = 'https://www.googleapis.com/oauth2/v1/userinfo' - , queryParams = { access_token: accessToken, alt: 'json' }; - request.get({ - url: userUrl - , qs: queryParams - }, function (err, res, body) { - if (err) return promise.fail(err); - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: body, res: res}}); - } - promise.fulfill(JSON.parse(body)); - }); - return promise; - }); - -/** - * @param {Object} params in an object that includes the keys: - * - refreshToken: The refresh token returned from the authorization code - * exchange - * - clientId: The client_id obtained during application registration - * - clientSecret: The client secret obtained during the application registration - * @param {Function} cb - */ -google.refreshToken = function (params, cb) { - request.post('https://accounts.google.com/o/oauth2/token', { - form: { - refresh_token: params.refreshToken - , client_id: params.clientId - , client_secret: params.clientSecret - , grant_type: 'refresh_token' - } - }, function (err, res, body) { - // `body` should look like: - // { - // "access_token":"1/fFBGRNJru1FQd44AzqT3Zg", - // "expires_in":3920, - // "token_type":"Bearer", - // } - if (err) return cb(err); - if (parseInt(res.statusCode / 100, 10) !== 2) { - cb(null, {}, res); - } else { - body = JSON.parse(body); - cb(null, { - accessToken: body.access_token - , expiresIn: body.expires_in - , idToken: body.id_token - }, res); - } - }); - return this; -} diff --git a/node_modules/everyauth/lib/modules/google1.js b/node_modules/everyauth/lib/modules/google1.js deleted file mode 100644 index 1bcb0cf..0000000 --- a/node_modules/everyauth/lib/modules/google1.js +++ /dev/null @@ -1,60 +0,0 @@ -var oauthModule = require('./oauth') - , extractHostname = require('../utils').extractHostname; - -var google = module.exports = -oauthModule.submodule('google1') - .configurable({ - scope: "URL identifying the Google service to be accessed. See the documentation for the API you'd like to use for what scope to specify. To specify more than one scope, list each one separated with a space." - }) - .apiHost('https://www.google.com/') - .oauthHost('https://www.google.com/') - - .entryPath('/auth/google1') - .callbackPath('/auth/google1/callback') - - .requestTokenPath('/accounts/OAuthGetRequestToken') - .authorizePath('/accounts/OAuthAuthorizeToken') - .accessTokenPath('/accounts/OAuthGetAccessToken') - - .requestTokenQueryParam({ - access_type: 'offline' - , approval_prompt: 'force' - , scope: function () { - return this._scope && this.scope(); - } - }) - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise() - , userUrl = 'https://www.google.com/m8/feeds/contacts/default/full?alt=json'; - this.oauth.get(userUrl, accessToken, accessTokenSecret, function (err, data, res) { - if (err) { - err.extra = {data: data, res: res}; - return promise.fail(err); - } - var oauthUser = JSON.parse(data) - , user = { gmail: oauthUser.feed.id.$t }; - promise.fulfill(user); - }); - return promise; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var twitterResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - twitterResponse.statusCode - , twitterResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/googlehybrid.js b/node_modules/everyauth/lib/modules/googlehybrid.js deleted file mode 100644 index f05c176..0000000 --- a/node_modules/everyauth/lib/modules/googlehybrid.js +++ /dev/null @@ -1,63 +0,0 @@ -var openidModule = require('./openid') - , OAuth = require('oauth').OAuth - , oid = require('openid') - , extractHostname = require('../utils').extractHostname; - -var googlehybrid = module.exports = -openidModule.submodule('googlehybrid') - .configurable({ - scope: 'array of desired google api scopes' - , consumerKey: 'Consumer Key' - , consumerSecret: 'Consumer Secret' - }) - .definit( function () { - this.relyingParty = - new oid.RelyingParty(this._myHostname + this._callbackPath, null, false, false, [ - new oid.AttributeExchange({ - 'http://axschema.org/contact/email': 'required' - , 'http://axschema.org/namePerson/first': 'required' - , 'http://axschema.org/namePerson/last': 'required' - }) - , new oid.OAuthHybrid({ - consumerKey: this._consumerKey - , scope: this._scope.join(' ') - }) - ]); - - this.oauth = new OAuth( - 'https://www.google.com/accounts/OAuthGetRequestToken' - , 'https://www.google.com/accounts/OAuthGetAccessToken' - , this._consumerKey - , this._consumerSecret - , "1.0", null, "HMAC-SHA1"); - }) - .verifyAttributes(function (req,res) { - var p = this.Promise() - oauth = this.oauth; - this.relyingParty.verifyAssertion(req, function (err, userAttributes) { - if(err) return p.fail(err); - oauth.getOAuthAccessToken(userAttributes['request_token'], undefined, function (err, oauthAccessToken, oauthAccessTokenSecret) { - if (err) return p.fail(err); - userAttributes['access_token'] = oauthAccessToken; - userAttributes['access_token_secret'] = oauthAccessTokenSecret; - p.fulfill(userAttributes) - }); - }); - return p; - }) - .sendToAuthenticationUri(function (req, res) { - - // Automatic hostname detection + assignment - if (!this._myHostname || this._alwaysDetectHostname) { - this.myHostname(extractHostname(req)); - } - - var self = this; - - this.relyingParty.authenticate('http://www.google.com/accounts/o8/id', false, function (err,authenticationUrl){ - if(err) return p.fail(err); - self.redirect(res, authenticationUrl); - }); - }) - .entryPath('/auth/googlehybrid') - .callbackPath('/auth/googlehybrid/callback'); diff --git a/node_modules/everyauth/lib/modules/gowalla.js b/node_modules/everyauth/lib/modules/gowalla.js deleted file mode 100644 index 1952f1f..0000000 --- a/node_modules/everyauth/lib/modules/gowalla.js +++ /dev/null @@ -1,62 +0,0 @@ -var oauthModule = require('./oauth2') - , request = require('request'); - -var gowalla = module.exports = -oauthModule.submodule('gowalla') - .apiHost('https://api.gowalla.com/') - .oauthHost('https://gowalla.com/') - - .authPath('/api/oauth/new') - .accessTokenPath('https://api.gowalla.com/api/oauth/token') - - .entryPath('/auth/gowalla') - .callbackPath('/auth/gowalla/callback') - - .accessTokenHttpMethod('post') - .postAccessTokenParamsVia('data') - .accessTokenParam('grant_type', 'authorization_code') - - .fetchOAuthUser( function (accessToken) { - var promise = this.Promise(); - request.get({ - url: this._apiHost + '/users/me' - , qs: { oauth_token: accessToken } - , headers: { - "X-Gowalla-API-Key": this.appId() - , "Accept": "application/json" - } - }, function (err, res, body) { - if (err) { - err.extra = {res: res, data: body}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: body, res: res}}); - } - var oauthUser = JSON.parse(body); - return promise.fulfill(oauthUser); - }); - - return promise; - }) - - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var gowallaResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - gowallaResponse.statusCode - , gowallaResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/instagram.js b/node_modules/everyauth/lib/modules/instagram.js deleted file mode 100644 index 7b131e1..0000000 --- a/node_modules/everyauth/lib/modules/instagram.js +++ /dev/null @@ -1,39 +0,0 @@ -var oauthModule = require('./oauth2') - , querystring= require('querystring'); - -var instagram = module.exports = -oauthModule.submodule('instagram') - .configurable({ - display: 'set to "touch" if you want users to see a mobile optimized version of the auth page' - , scope: 'specify types of access (space separated if > 1): basic (default), comments, relationships, likes' - }) - - .oauthHost('https://api.instagram.com/') - .apiHost('https://api.instagram.com/v1') - - .entryPath('/auth/instagram') - .callbackPath('/auth/instagram/callback') - - .authQueryParam('response_type', 'code') - .authQueryParam('display', function () { - return this._display && this.display(); - }) - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - - .accessTokenParam('grant_type', 'authorization_code') - .postAccessTokenParamsVia('data') - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/users/self', accessToken, function (err, data) { - if (err) return p.fail(err.error_message); - var oauthUser = JSON.parse(data).data; - p.fulfill(oauthUser); - }) - return p; - }) - .convertErr( function (data) { - return new Error(data.error_message); - }); diff --git a/node_modules/everyauth/lib/modules/justintv.js b/node_modules/everyauth/lib/modules/justintv.js deleted file mode 100644 index 27daff9..0000000 --- a/node_modules/everyauth/lib/modules/justintv.js +++ /dev/null @@ -1,24 +0,0 @@ -var oauthModule = require('./oauth'); - -module.exports = -oauthModule.submodule('justintv') - - .apiHost('http://api.justin.tv/') - .oauthHost('http://api.justin.tv/') - - .entryPath('/auth/justintv') - .callbackPath('/auth/justintv/callback') - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/api/account/whoami.json', accessToken, accessTokenSecret, function (err, data) { - if (err) return promise.fail(err); - var oauthUser = JSON.parse(data); - return promise.fulfill(oauthUser); - }); - return promise; - }) - - .convertErr( function (data) { - return new Error(data.data); - }); diff --git a/node_modules/everyauth/lib/modules/ldap.js b/node_modules/everyauth/lib/modules/ldap.js deleted file mode 100644 index 18f8ac0..0000000 --- a/node_modules/everyauth/lib/modules/ldap.js +++ /dev/null @@ -1,28 +0,0 @@ -var passwordModule = require('./password'); - -var ldap = module.exports = -passwordModule.submodule('ldap') - .configurable({ - host: 'the ldap host' - , port: 'the ldap port' - }) - .authenticate( function (login, password, req, res) { - var promise = this.Promise(); - ldapauth.authenticate(this.host(), this.port(), login, password, function (err, result) { - var user, errors; - if (err) { - return promise.fail(err); - } - if (result === false) { - errors = ['Login failed.']; - return promise.fulfill(errors); - } else if (result === true) { - user = {}; - user[this.loginKey()] = login; - return promise.fulfill(user); - } else { - throw new Error('ldapauth returned a result that was neither `true` nor `false`'); - } - }); - return promise; - }); diff --git a/node_modules/everyauth/lib/modules/linkedin.js b/node_modules/everyauth/lib/modules/linkedin.js deleted file mode 100644 index 7dfd81f..0000000 --- a/node_modules/everyauth/lib/modules/linkedin.js +++ /dev/null @@ -1,66 +0,0 @@ -var oauthModule = require('./oauth') - , OAuth = require('oauth').OAuth; - -var linkedin = module.exports = -oauthModule.submodule('linkedin') - .definit( function () { - this.oauth = new OAuth( - this.oauthHost() + this.requestTokenPath() - , this.oauthHost() + this.accessTokenPath() - , this.consumerKey() - , this.consumerSecret() - , '1.0', null, 'HMAC-SHA1', null - , { - Accept: '/' - , Connection: 'close' - , 'User-Agent': 'Node authentication' - , 'x-li-format': 'json' // So we get JSON responses - }); - }) - - .apiHost('https://api.linkedin.com/v1') - .oauthHost('https://api.linkedin.com/') - - .requestTokenPath('/uas/oauth/requestToken') - .authorizePath('/uas/oauth/authenticate') - .accessTokenPath('/uas/oauth/accessToken') - - .entryPath('/auth/linkedin') - .callbackPath('/auth/linkedin/callback') - - .redirectToProviderAuth( function (res, token) { - this.redirect(res, 'https://www.linkedin.com/' + this.authorizePath() + '?oauth_token=' + token); - }) - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/people/~:(id,first-name,last-name,headline,location:(name,country:(code)),industry,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-standard-profile-request:(url,headers),public-profile-url)', accessToken, accessTokenSecret, function (err, data, res) { - if (err) { - err.extra = {data: data, res: res} - return promise.fail(err); - } - var oauthUser = JSON.parse(data); - promise.fulfill(oauthUser); - }); - return promise; - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var linkedInResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - linkedInResponse.statusCode - , linkedInResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/mailchimp.js b/node_modules/everyauth/lib/modules/mailchimp.js deleted file mode 100644 index c3c3000..0000000 --- a/node_modules/everyauth/lib/modules/mailchimp.js +++ /dev/null @@ -1,67 +0,0 @@ -var oauthModule = require('./oauth2') - , request = require('request'); - -var mailchimp = module.exports = -oauthModule.submodule('mailchimp') - .configurable({ - metadataPath: "Although this shouldn't be changed, this is where we get the datacenter for building the API key." - }) - .oauthHost('https://login.mailchimp.com/') - .authPath('/oauth2/authorize') - .accessTokenPath('/oauth2/token') - .metadataPath('/oauth2/metadata') - - .entryPath('/auth/mailchimp') - .callbackPath('/auth/mailchimp/callback') - .fetchOAuthUser( function (accessToken) { - var promise = this.Promise(); - this.oauth._request("GET", this.oauthHost() + this.metadataPath(), { - Authorization: 'OAuth ' + accessToken - },"","", function (err, data){ - if (err) return promise.fail(err); - - var metadata = JSON.parse(data) - , apikey = accessToken + "-"+ metadata.dc; - - request.post({ - url: metadata.api_endpoint + '/1.3/?method=getAccountDetails' - , form: {apikey: apikey} - }, function (err, res, body) { - if (err) { - err.extra = {res: res, data: body}; - return promise.fail(err); - } - if (parseInt(res.statusCode/100, 10) !== 2) { - return promise.fail({extra: {data: body, res: res}}); - } - var oauthUser = JSON.parse(body); - oauthUser.apikey = apikey; - return promise.fulfill(oauthUser); - }); - }); - return promise; - }) - .postAccessTokenParamsVia("data") - .authQueryParam('response_type','code') - .accessTokenParam('grant_type','authorization_code') - - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var mailchimpResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - mailchimpResponse.statusCode - , mailchimpResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/mailru.js b/node_modules/everyauth/lib/modules/mailru.js deleted file mode 100644 index acfceed..0000000 --- a/node_modules/everyauth/lib/modules/mailru.js +++ /dev/null @@ -1,91 +0,0 @@ -var oauthModule = require('./oauth2') -, url = require('url') -, fs = require('fs') -, crypto = require('crypto'); - -var mailru = module.exports = -oauthModule.submodule('mailru') -.configurable({ - display: 'set to "mobile" if you want users to see a mobile optimized version of the auth page', - scope: 'specify types of access: See http://api.mail.ru/docs/guides/restapi/#permissions' -}) -.oauthHost('https://connect.mail.ru/') -.apiHost('http://www.appsmail.ru/platform/api') -.entryPath('/auth/mailru') -.callbackPath('/auth/mailru/callback') - -.authQueryParam('display', function () { - return this._display && this.display(); -}) -.authQueryParam('response_type', 'code') -.authQueryParam('scope', function () { - return this._scope && this.scope(); -}) - -.accessTokenParam('grant_type', 'authorization_code') -.accessTokenHttpMethod('post') -.postAccessTokenParamsVia('data') -.accessTokenPath('/oauth/token') - -.fetchOAuthUser( function (accessToken, http) { - var promise = this.Promise(), - extradata = http.extra; - - if(typeof accessToken === 'undefined'){ - if(typeof extradata.access_token === 'undefined') { - var strextra = JSON.stringify(extradata).replace(/^\{"(.*)":""\}$/,'"$1"'), - extra = eval('(' + JSON.parse(strextra) + ')'); - accessToken = extra.access_token; - } else { - accessToken = extra.access_token; - } - } - - var query = { - app_id: this.appId(), - method: 'users.getInfo', - secure:1, - session_key: accessToken - }, - data = '', - fields = []; - - for ( key in query ) { - data += key + '=' + query[key]; - } - data += this.appSecret(); - query.sig = crypto.createHash('md5').update(data).digest("hex"); - - for ( key in query ) { - fields.push(key + '=' + query[key]); - } - - this.oauth.get(this.apiHost() + '?' + fields.join('&'), accessToken, function (err, data) { - if (err) { - if (err.error) { - promise.fail(err.error.error_msg) - } - else { - promise.fail(err.error_message); - } - } - var data = JSON.parse(data); - if (data.error) { - promise.fail(data.error.error_msg) - } - else { - var oauthUser = data[0]; - promise.fulfill(oauthUser); - } - }); - return promise; -}) - -.authCallbackDidErr(function(req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; -}) - -.convertErr( function (data) { - return new Error(JSON.parse(data).error.error_msg); -}); diff --git a/node_modules/everyauth/lib/modules/mendeley.js b/node_modules/everyauth/lib/modules/mendeley.js deleted file mode 100644 index 6e861a3..0000000 --- a/node_modules/everyauth/lib/modules/mendeley.js +++ /dev/null @@ -1,45 +0,0 @@ -var oauthModule = require('./oauth'), - OAuth = require('oauth').OAuth; - var mendeley = module.exports = - oauthModule.submodule('mendeley') - - // http://apidocs.mendeley.com/home/authentication - .apiHost('http://api.mendeley.com/oapi') - .oauthHost('http://www.mendeley.com/oauth') - - .requestTokenPath('/request_token/') - .accessTokenPath('/access_token/') - .authorizePath('/authorize/') - - // oauth_callback not allowed - .sendCallbackWithAuthorize(false) - - .entryPath('/auth/mendeley') - .callbackPath('/auth/mendeley/callback') - .definit( function () { - this.oauth = new OAuth( - this.oauthHost() + this.requestTokenPath() - , this.oauthHost() + this.accessTokenPath() - , this.consumerKey() - , this.consumerSecret() - , '1.0', null, 'HMAC-SHA1'); - - // Mendeley does not support POST requests - this.oauth.setClientOptions({ - "requestTokenHttpMethod": "GET", - "accessTokenHttpMethod": "GET" - }); - }) - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/profiles/info/me/', accessToken, accessTokenSecret, function (err, data) { - if (err) return p.fail(err.error_message); - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .convertErr( function (data) { - return new Error(data.error_message); - }); - diff --git a/node_modules/everyauth/lib/modules/mixi.js b/node_modules/everyauth/lib/modules/mixi.js deleted file mode 100644 index fa44186..0000000 --- a/node_modules/everyauth/lib/modules/mixi.js +++ /dev/null @@ -1,73 +0,0 @@ -var oauthModule = require('./oauth2') - , url = require('url'); - -var mixi = module.exports = -oauthModule.submodule('mixi') - .configurable({ - scope: 'specify types of access: See http://developers.mixi.co.jp/' - , display: 'specify types of access: See http://developers.mixi.co.jp/' - }) - - .apiHost('https://api.mixi-platform.com/2') - .oauthHost('https://secure.mixi-platform.com/2/token') - - .accessTokenPath('https://secure.mixi-platform.com/2/token') - - .authPath('https://mixi.jp/connect_authorize.pl') - - .entryPath('/auth/mixi') - .callbackPath('/auth/mixi/callback') - - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - .authQueryParam('response_type', function () { - return 'code'; - }) - .authQueryParam('display', function () { - return this._display && this.display(); - }) - - .accessTokenParam('grant_type', function () { - return 'authorization_code'; - }) - - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; - }) - .handleAuthCallbackError( function (req, res) { - var parsedUrl = url.parse(req.url, true) - , errorDesc = parsedUrl.query.error_description; - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: errorDesc - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - - .fetchOAuthUser( function (accessToken) { - var p = this.Promise(); - this.oauth.setAccessTokenName('oauth_token'); - this.oauth.get(this.apiHost() + '/people/@me/@self', accessToken, function (err, data) { - if (err){ - return p.fail(err); - } - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .convertErr( function (data) { - return new Error(JSON.parse(data.data).error.message); - }); - -mixi.mobile = function (isMobile) { - if (isMobile) { - this.authPath('https://m.mixi.jp/connect_authorize.pl'); - } - return this; -}; diff --git a/node_modules/everyauth/lib/modules/oauth.js b/node_modules/everyauth/lib/modules/oauth.js deleted file mode 100644 index 65021a1..0000000 --- a/node_modules/everyauth/lib/modules/oauth.js +++ /dev/null @@ -1,268 +0,0 @@ -var everyModule = require('./everymodule') - , OAuth = require('oauth').OAuth - , url = require('url') - , extractHostname = require('../utils').extractHostname; - -var oauth = module.exports = -everyModule.submodule('oauth') - .configurable({ - apiHost: 'e.g., https://api.twitter.com' - , oauthHost: 'the host for the OAuth provider' - , requestTokenPath: "the path on the OAuth provider's domain where we request the request token, e.g., /oauth/request_token" - , accessTokenPath: "the path on the OAuth provider's domain where we request the access token, e.g., /oauth/access_token" - , authorizePath: 'the path on the OAuth provider where you direct a visitor to login, e.g., /oauth/authorize' - , sendCallbackWithAuthorize: 'whether you want oauth_callback=... as a query param send with your request to /oauth/authorize' - , consumerKey: 'the api key provided by the OAuth provider' - , consumerSecret: 'the api secret provided by the OAuth provider' - , myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash' - , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' - , redirectPath: 'Where to redirect to after a failed or successful OAuth authorization' - , convertErr: '(DEPRECATED) a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request' - , authCallbackDidErr: 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' - }) - .definit( function () { - this.oauth = new OAuth( - this.oauthHost() + this.requestTokenPath() - , this.oauthHost() + this.accessTokenPath() - , this.consumerKey() - , this.consumerSecret() - , '1.0', null, 'HMAC-SHA1'); - }) - - .get('entryPath', - 'the link a user follows, whereupon you redirect them to the 3rd party OAuth provider dialog - e.g., "/auth/twitter"') - .step('getRequestToken') - .description('asks OAuth Provider for a request token') - .accepts('req res next') - .promises('token tokenSecret') - .step('storeRequestToken') - .description('stores the request token and secret in the session') - .accepts('req token tokenSecret') - .promises(null) - .step('redirectToProviderAuth') - .description('sends the user to authorization on the OAuth provider site') - .accepts('res token') - .promises(null) - - .get('callbackPath', - 'the callback path that the 3rd party OAuth provider redirects to after an OAuth authorization result - e.g., "/auth/twitter/callback"') - .step('extractTokenAndVerifier') - .description('extracts the request token and verifier from the url query') - .accepts('req res next') - .promises('requestToken verifier') - .canBreakTo('handleDuplicateCallbackRequest') - .canBreakTo('authCallbackErrorSteps') - .step('getSession') - .accepts('req') - .promises('session') - .step('rememberTokenSecret') - .description('retrieves the request token secret from the session') - .accepts('session') - .promises('requestTokenSecret') - .step('getAccessToken') - .description('requests an access token from the OAuth provider') - .accepts('requestToken requestTokenSecret verifier') - .promises('accessToken accessTokenSecret params') - .step('fetchOAuthUser') - .accepts('accessToken accessTokenSecret params') - .promises('oauthUser') - .step('findOrCreateUser') - .accepts('session accessToken accessTokenSecret oauthUser') - .promises('user') - .step('compileAuth') - .accepts('accessToken accessTokenSecret oauthUser user') - .promises('auth') - .step('addToSession') - .accepts('session auth') - .promises(null) - .step('sendResponse') - .accepts('res') - .promises(null) - - .stepseq('handleDuplicateCallbackRequest', - 'handles the case if you manually click the callback link on Twitter, but Twitter has already sent a redirect request to the callback path with the same token') - .step('waitForPriorRequestToWriteSession') - .accepts('req res next') - .promises(null) - .step('sendResponse') - - .stepseq('authCallbackErrorSteps') - .step('handleAuthCallbackError', - 'a request handler that intercepts a failed authorization message sent from the OAuth provider to your service. e.g., the request handler for "/auth/twitter/callback?denied=blahblahblahblahblah"') - .accepts('req res next') - .promises(null) - - .getRequestToken( function (req, res, next) { - - // Automatic hostname detection + assignment - if (!this._myHostname || this._alwaysDetectHostname) { - this.myHostname(extractHostname(req)); - } - - var p = this.Promise() - , params = {oauth_callback: this._myHostname + this._callbackPath} - , additionalParams = this.moreRequestTokenQueryParams - , param; - - if (additionalParams) for (var k in additionalParams) { - param = additionalParams[k]; - if ('function' === typeof param) { - // e.g., for facebook module, param could be - // function () { - // return this._scope && this.scope(); - // } - additionalParams[k] = // cache the function call - param = param.call(this); - } - if ('function' === typeof param) { - // this.scope() itself could be a function - // to allow for dynamic scope determination - e.g., - // function (req, res) { - // return req.session.onboardingPhase; // => "email" - // } - param = param.call(this, req, res); - } - params[k] = param; - } - this.oauth.getOAuthRequestToken(params, function (err, token, tokenSecret, params) { - if (err) { - return p.fail(err); - } - p.fulfill(token, tokenSecret); - }); - return p; - }) - .storeRequestToken( function (req, token, tokenSecret) { - var sess = req.session - , _auth = sess.auth || (sess.auth = {}) - , _provider = _auth[this.name] || (_auth[this.name] = {}); - _provider.token = token; - _provider.tokenSecret = tokenSecret; - }) - .redirectToProviderAuth( function (res, token) { - // Note: Not all oauth modules need oauth_callback as a uri query parameter. As far as I know, only readability's - // module needs it as a uri query parameter. However, in cases such as twitter, it allows you to over-ride - // the callback url settings at dev.twitter.com from one place, your app code, rather than in two places -- i.e., - // your app code + dev.twitter.com app settings. - var redirectTo = this._oauthHost + this._authorizePath + '?oauth_token=' + token; - if (this._sendCallbackWithAuthorize) { - redirectTo += '&oauth_callback=' + this._myHostname + this._callbackPath; - } - this.redirect(res, redirectTo); - }) - - // Steps for GET `callbackPath` - .extractTokenAndVerifier( function (req, res, next) { - if (this._authCallbackDidErr && this._authCallbackDidErr(req)) { - return this.breakTo('authCallbackErrorSteps', req, res); - } - var parsedUrl = url.parse(req.url, true) - , query = parsedUrl.query - , requestToken = query && query.oauth_token - , verifier = query && query.oauth_verifier - - , sess = req.session - , promise - , _auth = sess.auth || (sess.auth = {}) - , name = this.name - , mod = _auth[name] || (_auth[name] = {}); - if ((name === 'twitter') && (mod.token === requestToken) && (mod.verifier === verifier)) { - return this.breakTo('handleDuplicateCallbackRequest', req, res); - } - - promise = this.Promise(); - mod.verifier = verifier; - sess.save( function (err) { - if (err) return promise.fail(err); - promise.fulfill(requestToken, verifier); - }); - return promise; - }) - .getSession( function(req) { - return req.session; - }) - .rememberTokenSecret( function (sess) { - return sess && sess.auth && sess.auth[this.name] && sess.auth[this.name].tokenSecret; - }) - .getAccessToken( function (reqToken, reqTokenSecret, verifier) { - var promise = this.Promise(); - this.oauth.getOAuthAccessToken(reqToken, reqTokenSecret, verifier, function (err, accessToken, accessTokenSecret, params) { - if (err) return promise.fail(err); - promise.fulfill(accessToken, accessTokenSecret, params); - }); - return promise; - }) - .compileAuth( function (accessToken, accessTokenSecret, oauthUser, user) { - return { - accessToken: accessToken - , accessTokenSecret: accessTokenSecret - , oauthUser: oauthUser - , user: user - }; - }) - .addToSession( function (sess, auth) { - var promise = this.Promise() - , _auth = sess.auth - , mod = _auth[this.name]; - _auth.loggedIn = true; - _auth.userId || (_auth.userId = auth.user[this._userPkey]); - mod.user = auth.oauthUser; - mod.accessToken = auth.accessToken; - mod.accessTokenSecret = auth.accessTokenSecret; - // this._super() ? - sess.save( function (err) { - if (err) return promise.fail(err); - promise.fulfill(); - }); - return promise; - }) - .sendResponse( function (res, data) { - var redirectTo = this.redirectPath(); - if (!redirectTo) - throw new Error('You must configure a redirectPath'); - this.redirect(res, redirectTo); - }) - .waitForPriorRequestToWriteSession( function (req, res, next) { - var promise = this.Promise(); - function check (self, sess, res, promise) { - if (sess.auth[self.name].accessToken) { - return promise.fulfill(); - } - - setTimeout(function () { - sess.reload( function (err) { - if (err) return promise.fail(err); - check(self, req.session, res, promise); - }); - }, 100); - } - check(this, req.session, res, promise); - return promise; - }); - -// Defaults inherited by submodules -oauth - .requestTokenPath('/oauth/request_token') - .authorizePath('/oauth/authorize') - .accessTokenPath('/oauth/access_token') - .handleAuthCallbackError( function (req, res, next) { - next(new Error("You must configure handleAuthCallbackError in this module")); - }) - .sendCallbackWithAuthorize(true); - -oauth.moreRequestTokenQueryParams = {}; -oauth.cloneOnSubmodule.push('moreRequestTokenQueryParams'); - -// Add or over-write existing query params that -// get tacked onto the oauth authorize url. -oauth.requestTokenQueryParam = function (key, val) { - if (arguments.length === 1 && key.constructor == Object) { - for (var k in key) { - this.requestTokenQueryParam(k, key[k]); - } - return this; - } - if (val) - this.moreRequestTokenQueryParams[key] = val; - return this; -}; diff --git a/node_modules/everyauth/lib/modules/oauth2.js b/node_modules/everyauth/lib/modules/oauth2.js deleted file mode 100644 index 23d867b..0000000 --- a/node_modules/everyauth/lib/modules/oauth2.js +++ /dev/null @@ -1,317 +0,0 @@ -var everyModule = require('./everymodule') - , OAuth = require('oauth').OAuth2 - , url = require('url') - , querystring = require('querystring') - , request = require('request') - , extractHostname = require('../utils').extractHostname; - -// Steps define a sequence of logic that pipes data through -// a chain of promises. A new chain of promises is generated -// every time the set of steps is started. - -var oauth2 = module.exports = -everyModule.submodule('oauth2') - .definit( function () { - this.oauth = new OAuth(this._appId, this._appSecret, this._oauthHost, this._authPath, this._accessTokenPath); - }) - .configurable({ - apiHost: 'e.g., https://graph.facebook.com' - , oauthHost: 'the host for the OAuth provider' - , appId: 'the OAuth app id provided by the host' - , appSecret: 'the OAuth secret provided by the host' - , authPath: "the path on the OAuth provider's domain where " + - "we direct the user for authentication, e.g., /oauth/authorize" - , accessTokenPath: "the path on the OAuth provider's domain " + - "where we request the access token, e.g., /oauth/access_token" - , accessTokenHttpMethod: 'the http method ("get" or "post") with which to make our access token request' - , postAccessTokenParamsVia: '"query" to POST the params to the access ' + - 'token endpoint as a querysting; "data" to POST the params to ' + - 'the access token endpoint in the request body' - , myHostname: 'e.g., http://local.host:3000 . Notice no trailing slash' - , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' - , convertErr: '(DEPRECATED) a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request' - , authCallbackDidErr: 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' - }) - - // Declares a GET route that is aliased - // as 'entryPath'. The handler for this route - // triggers the series of steps that you see - // indented below it. - .get('entryPath', - 'the link a user follows, whereupon you redirect them to the 3rd party OAuth provider dialog - e.g., "/auth/facebook"') - .step('getAuthUri') - .accepts('req res next') - .promises('authUri') - .step('requestAuthUri') - .accepts('res authUri') - .promises(null) - - .get('callbackPath', - 'the callback path that the 3rd party OAuth provider redirects to after an OAuth authorization result - e.g., "/auth/facebook/callback"') - .step('getCode') - .description('retrieves a verifier code from the url query') - .accepts('req res next') - .promises('code') - .canBreakTo('authCallbackErrorSteps') - .step('getAccessToken') - .accepts('code') - .promises('accessToken extra') - .step('fetchOAuthUser') - .accepts('accessToken') - .promises('oauthUser') - .step('getSession') - .accepts('req') - .promises('session') - .step('findOrCreateUser') - //.optional() - .accepts('session accessToken extra oauthUser') - .promises('user') - .step('compile') - .accepts('accessToken extra oauthUser user') - .promises('auth') - .step('addToSession') - .accepts('session auth') - .promises(null) - .step('sendResponse') - .accepts('res') - .promises(null) - - .stepseq('authCallbackErrorSteps') - .step('handleAuthCallbackError', - 'a request handler that intercepts a failed authorization message sent from the OAuth2 provider to your service. e.g., the request handler for "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request."') - .accepts('req res next') - .promises(null) - - .getAuthUri( function (req, res, next) { - - // Automatic hostname detection + assignment - if (!this._myHostname || this._alwaysDetectHostname) { - this.myHostname(extractHostname(req)); - } - - var params = { - client_id: this._appId - , redirect_uri: this._myHostname + this._callbackPath - } - , authPath = this._authPath - , url = (/^http/.test(authPath)) - ? authPath - : (this._oauthHost + authPath) - , additionalParams = this.moreAuthQueryParams - , param; - - if (additionalParams) for (var k in additionalParams) { - param = additionalParams[k]; - if ('function' === typeof param) { - // e.g., for facebook module, param could be - // function () { - // return this._scope && this.scope(); - // } - param = param.call(this, req, res); - } - if ('function' === typeof param) { - // this.scope() itself could be a function - // to allow for dynamic scope determination - e.g., - // function (req, res) { - // return req.session.onboardingPhase; // => "email" - // } - param = param.call(this, req, res); - } - params[k] = param; - } - return url + '?' + querystring.stringify(params); - }) - .requestAuthUri( function (res, authUri) { - this.redirect(res, authUri); - }) - .getCode( function (req, res, next) { - var parsedUrl = url.parse(req.url, true); - if (this._authCallbackDidErr(req)) { - return this.breakTo('authCallbackErrorSteps', req, res, next); - } - if (!parsedUrl.query || !parsedUrl.query.code) { - console.error("Missing code in querystring. The url looks like " + req.url); - } - return parsedUrl.query && parsedUrl.query.code; - }) - .getAccessToken( function (code, data) { - var p = this.Promise() - , params = { - client_id: this._appId - , redirect_uri: this._myHostname + this._callbackPath - , code: code - , client_secret: this._appSecret - } - , url = this._oauthHost + this._accessTokenPath - , additionalParams = this.moreAccessTokenParams - , param; - - if (this._accessTokenPath.indexOf("://") != -1) { - // Just in case the access token url uses a different subdomain - // than than the other urls involved in the oauth2 process. - // * cough * ... gowalla - url = this._accessTokenPath; - } - - if (additionalParams) for (var k in additionalParams) { - param = additionalParams[k]; - if ('function' === typeof param) { - additionalParams[k] = // cache the fn call - param = param.call(this, data.req, data.res); - } - if ('function' === typeof param) { - param = param.call(this, data.req, data.res); - } - params[k] = param; - } - - var opts = { url: url } - , paramsVia = this._postAccessTokenParamsVia; - switch (paramsVia) { - case 'query': // Submit as a querystring - opts.headers || (opts.headers = {}); - opts.headers['Content-Length'] = 0; - paramsVia = 'qs'; - break; - case 'data': // Submit via application/x-www-form-urlencoded - paramsVia = 'form'; - break; - default: - throw new Error('postAccessTokenParamsVia must be either "query" or "data"'); - } - opts[paramsVia] = params; - request[this._accessTokenHttpMethod](opts, function (err, res, body) { - if (err) { - err.extra = {data: body, res: res}; - return p.fail(err); - } - if (parseInt(res.statusCode / 100) != 2) return p.fail({extra: {res: res, data: body}}); - var resType = res.headers['content-type'] - , data; - if (resType.substring(0, 10) === 'text/plain') { - data = querystring.parse(body); - } else if (resType.substring(0, 33) === 'application/x-www-form-urlencoded') { - data = querystring.parse(body); - } else if (resType.substring(0, 16) === 'application/json') { - data = JSON.parse(body); - } else { - throw new Error('Unsupported content-type ' + resType); - } - var aToken = data.access_token; - delete data.access_token; - p.fulfill(aToken, data); - }); - - return p; - }) - .compile( function (accessToken, extra, oauthUser, user) { - var compiled = { - accessToken: accessToken - , oauthUser: oauthUser - , user: user - }; - // extra is any extra params returned by the - // oauth provider in response to the access token - // POST request - for (var k in extra) { - // avoid clobbering any of the properties we set just above (user, accessToken, oauthUser) - // instagram in particular sends a "user" which can break your code in strange ways if it's overwritten - if (compiled[k]) { - compiled.extra || (compiled.extra = {}); - compiled.extra[k] = extra[k]; - } else { - compiled[k] = extra[k]; - } - } - return compiled; - }) - .getSession( function (req) { - return req.session; - }) - .addToSession( function (sess, auth) { - var _auth = sess.auth || (sess.auth = {}) - , mod = _auth[this.name] || (_auth[this.name] = {}); - _auth.loggedIn = true; - _auth.userId || (_auth.userId = auth.user[this._userPkey]); - mod.user = auth.oauthUser; - mod.accessToken = auth.accessToken; - // this._super() ? - }) - .sendResponse( function (res, data) { - var req = data.req; - var continueTo = req.query['state']; - - if (continueTo) { - return this.redirect(res, continueTo); - } - - var redirectTo = this._redirectPath; - if (!redirectTo) - throw new Error('You must configure a redirectPath'); - this.redirect(res, redirectTo); - }) - - .authCallbackDidErr( function (req, res) { - return false; - }); - -oauth2.moreAuthQueryParams = {}; -oauth2.moreAccessTokenParams = {}; -oauth2.cloneOnSubmodule.push('moreAuthQueryParams', 'moreAccessTokenParams'); - -oauth2 - .authPath('/oauth/authorize') - .accessTokenPath('/oauth/access_token') - .accessTokenHttpMethod('post') - .postAccessTokenParamsVia('query') - .handleAuthCallbackError( function (req, res, next) { - next(Error("You must configure handleAuthCallbackError in this module")); - }) - -// Add or over-write existing query params that -// get tacked onto the oauth authorize url. -oauth2.authQueryParam = function (key, val) { - if (arguments.length === 1 && key.constructor == Object) { - for (var k in key) { - this.authQueryParam(k, key[k]); - } - return this; - } - if (val) - this.moreAuthQueryParams[key] = val; - return this; -}; - -// Add or over-write existing params that -// get sent with the oauth access token request. -oauth2.accessTokenParam = function (key, val) { - if (arguments.length === 1 && key.constructor == Object) { - for (var k in key) { - this.accessTokenParam(k, key[k]); - } - return this; - } - if (val) - this.moreAccessTokenParams[key] = val; - return this; -}; - -/** - * Where to redirect to after a failed or successful OAuth authorization - */ -oauth2.redirectPath = function (path) { - if (typeof path === 'function') { - var self = this; - // req here is the auth request, not the callback request - this.authQueryParam('state', function (req, res) { - return path.call(self, req, res); - }); - } else { - return path; - } -}; - -// removeConfigurable -// removeStep -// undefinedSteps -> [] -// How about module specific and more generic addToSession? Perhaps just do addToSession with null diff --git a/node_modules/everyauth/lib/modules/openid.js b/node_modules/everyauth/lib/modules/openid.js deleted file mode 100644 index 6f083fd..0000000 --- a/node_modules/everyauth/lib/modules/openid.js +++ /dev/null @@ -1,106 +0,0 @@ -var everyModule = require('./everymodule') - , oid = require('openid') - , url = require('url') - , extractHostname = require('../utils').extractHostname; - -var openid = module.exports = -everyModule.submodule('openid') - .configurable({ - simpleRegistration: 'e.g., {"nickname" : true}' - , attributeExchange: 'eg {"http://axschema.org/contact/email": "required"}' - , myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash' - , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' - , redirectPath : 'The path to redirect To' - , openidURLField : 'The post field to use for open id' - }) - .definit( function () { - this.relyingParty = new oid.RelyingParty(this.myHostname() + this.callbackPath(), null, false, false, [ - new oid.UserInterface() - , new oid.SimpleRegistration(this.simpleRegistration()) - , new oid.AttributeExchange(this.attributeExchange()) - ]); - }) - .get('entryPath', - 'the link a user follows, whereupon you kick off the OpenId auth process - e.g., "/auth/openid"') - .step('sendToAuthenticationUri') - .description('sends the user to the providers openid authUrl') - .accepts('req res next') - .promises(null) - .get('callbackPath', - 'the callback path that the 3rd party Openid provider redirects to after an authorization result - e.g., "/auth/openid/callback"') - .step('verifyAttributes') - .description('verifies the return attributes') - .accepts('req res next') - .promises('userAttributes') - .step('getSession') - .accepts('req') - .promises('session') - .step('findOrCreateUser') - .accepts('session userAttributes') - .promises('user') - .step('addToSession') - .accepts('session user') - .promises(null) - .step('sendResponse') - .accepts('res') - .promises(null) - .sendToAuthenticationUri(function(req,res) { - - // Automatic hostname detection + assignment - if (!this._myHostname || this._alwaysDetectHostname) { - this.myHostname(extractHostname(req)); - } - - this.relyingParty.authenticate(req.query[this.openidURLField()], false, function(err,authenticationUrl){ - if(err) return p.fail(err); - this.redirect(res, authenticationUrl); - }); - }) - .getSession( function(req) { - return req.session; - }) - .verifyAttributes(function(req,res) { - var p = this.Promise(); - this.relyingParty.verifyAssertion(req, function (err,userAttributes) { - if(err) return p.fail(err); - p.fulfill(userAttributes) - }); - return p; - }) - .addToSession( function (sess, user) { - var _auth = sess.auth || (sess.auth = {}) - , mod = _auth[this.name] || (_auth[this.name] = {}); - _auth.loggedIn = true; - _auth.userId = user[this._userPkey]; - mod.user = user; - }) - .sendResponse( function (res) { - var redirectTo = this.redirectPath(); - if (!redirectTo) - throw new Error('You must configure a redirectPath'); - this.redirect(res, redirectTo); - }) - .redirectPath('/') - .entryPath('/auth/openid') - .callbackPath('/auth/openid/callback') - .simpleRegistration({ - "nickname" : true - , "email" : true - , "fullname" : true - , "dob" : true - , "gender" : true - , "postcode" : true - , "country" : true - , "language" : true - , "timezone" : true - }) - .attributeExchange({ - "http://axschema.org/contact/email" : "required" - , "http://axschema.org/namePerson/friendly" : "required" - , "http://axschema.org/namePerson" : "required" - , "http://axschema.org/namePerson/first" : "required" - , "http://axschema.org/contact/country/home": "required" - , "http://axschema.org/media/image/default" : "required" - , "http://axschema.org/x/media/signature" : "required" - }) - .openidURLField('openid_identifier'); diff --git a/node_modules/everyauth/lib/modules/osm.js b/node_modules/everyauth/lib/modules/osm.js deleted file mode 100644 index 326c2ba..0000000 --- a/node_modules/everyauth/lib/modules/osm.js +++ /dev/null @@ -1,40 +0,0 @@ -var oauthModule = require('./oauth') - , url = require('url') - , Parser = require('xml2js').Parser - , parser = new Parser({ mergeAttrs: true }); - -var osm = module.exports = -oauthModule.submodule('osm') - .apiHost('http://api.openstreetmap.org/') - .oauthHost('http://www.openstreetmap.org/') - .entryPath('/auth/osm') - .callbackPath('/auth/osm/callback') - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/api/0.6/user/details', accessToken, accessTokenSecret, function (err, data) { - if (err) return promise.fail(err); - parser.parseString(data, function (err, result) { - if (err) return promise.fail(err); - var oauthUser = result.user; - promise.fulfill(oauthUser); - }); - }); - return promise; - }) - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.denied; - }) - .handleAuthCallbackError( function (req, res) { - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: 'The user denied your request' - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - .convertErr( function (data) { - return new Error(data.data.match(/(.+)<\/error>/)[1]); - }); diff --git a/node_modules/everyauth/lib/modules/password.js b/node_modules/everyauth/lib/modules/password.js deleted file mode 100644 index e64dc1c..0000000 --- a/node_modules/everyauth/lib/modules/password.js +++ /dev/null @@ -1,379 +0,0 @@ -var everyModule = require('./everymodule'); - -/** - * This is used to generate the render methods used with - * - * - `displayLogin` - * - `respondToLoginFail` - * - `displayRegister` - * - `respondToRegistrationFail` - * - * The generated functions have the signature - * - * function (req, res, *extraParams) {...} - * - * @param {String} type is either 'login' or 'register' - * @param {Function} localsDefault is a function that returns the default - * locals object. It has the signature - * - * function (*extraParams) {...} - * - * So, for example, if the generated function can handle incoming args: - * - * function render (req, res, errors, data) - * - * , then the `localsDefault` signature can see the params - * - * function localsDefault (errors, data) - * - * @returns {Function} a generated render function with signature - * - * function (req, res, *extraParams) {...} - */ -function renderGenerator (type, localsDefault) { - return function render (req, res) { - var locals, render, layout - , extraLocals - , view = this[type + 'View'](), arity - , trailingArgs = Array.prototype.slice.call(arguments, 2); - - if (res.render) { - locals = - localsDefault.apply(this, trailingArgs); - layout = this['_' + type + 'Layout']; - render = function render (locals) { - if ('undefined' !== typeof layout) { - locals.layout = layout; - } - res.render(view, locals); - }; - - extraLocals = this['_' + type + 'Locals']; - if ('function' !== typeof extraLocals) { - for (var k in extraLocals) { - locals[k] = extraLocals[k]; - } - return render(locals); - } - - arity = extraLocals.length; - if (arity === 2) { - // Dynamic sync locals - extraLocals = extraLocals(req, res); - for (var k in extraLocals) { - locals[k] = extraLocals[k]; - } - return render(locals); - } else if (arity === 3) { - // Dynamic async locals - return extraLocals(req, res, function (err, extraLocals) { - if (err) throw err; // TODO Call global configurable error handler - for (var k in extraLocals) { - locals[k] = extraLocals[k]; - } - return render(locals); - }); - } else { - throw new Error('Your `locals` function must have arity 2 or 3'); - } - } else { - res.writeHead(200, {'Content-Type': 'text/html'}); - if ('function' === typeof view) { - res.end(view.apply(this, trailingArgs)); - } else { - res.end(view); - } - } - }; -} - -var renderLogin = renderGenerator('login', - function () { - var locals = {}; - locals[this.loginKey()] = null; - return locals; - } -); - -var renderLoginFail = renderGenerator('login', - function (errors, login) { - var locals = {errors: errors}; - locals[this.loginKey()] = login; - return locals; - } -); - -var renderRegister = renderGenerator('register', - function () { - var locals = {}; - locals.userParams = {}; - return locals; - } -); - -var renderRegisterFail = renderGenerator('register', - function (errors, newUserAttributes) { - return { - errors: errors - , userParams: newUserAttributes}; - } -); - -/** - * Let's define our password module - */ -var password = module.exports = -everyModule.submodule('password') - .configurable({ - loginFormFieldName: 'the name of the login field. Same as what you put in your login form ' - + '- e.g., if , then loginFormFieldName ' - + 'should be set to "username".' - , passwordFormFieldName: 'the name of the login field. Same as what you put in your login form ' - + '- e.g., if , then passwordFormFieldName ' - + 'should be set to "pswd".' - , loginHumanName: 'the human readable name of login -- e.g., "login" or "email"' - , loginKey: 'the name of the login field in your data store -- e.g., "email"; defaults to "login"' - , loginWith: 'specify what login type you want to use' - , validLoginTypes: 'specifies the different login types available and associated behavior' - , loginView: 'Either (A) the name of the view (e.g., "login.jade") or (B) the HTML string ' + - 'that corresponds to the login page OR (C) a function (errors, login) {...} that returns the HTML string incorporating the array of `errors` messages and the `login` used in the prior attempt' - , loginLayout: 'the name or path to the layout you want to use for your login' - , loginLocals: 'Configure extra locals to pass to your login view' - , loginSuccessRedirect: 'The path we redirect to after a successful login.' - , registerView: 'Either the name of the view (e.g., "register.jade") or the HTML string ' + - 'that corresponds to the register page.' - , registerLayout: 'the name or path to the layout you want to use for your registration page' - , registerLocals: 'Configure extra locals to pass to your register/registration view' - , registerSuccessRedirect: 'The path we redirect to after a successful registration.' - }) - .loginFormFieldName('login') - .passwordFormFieldName('password') - .loginHumanName('login') - .loginKey('login') - - .get('getLoginPath', "the login page's uri path.") - .step('displayLogin') - .accepts('req res next') - .promises(null) - .displayLogin(renderLogin) - - .post('postLoginPath', "the uri path that the login POSTs to. Same as the 'action' field of the login .") - .step('extractLoginPassword') - .accepts('req res next') - .promises('login password') - .step('authenticate') - .accepts('login password') - .promises('userOrErrors') - .step('interpretUserOrErrors') - .description('Pipes the output of the step `authenticate` into either the `user` or `errors` param') - .accepts('userOrErrors') - .promises('user errors') - .step('getSession') - .description('Retrieves the session of the incoming request and returns in') - .accepts('req') - .promises('session') - .step('addToSession') - .description('Adds the user to the session') - .accepts('session user errors') - .promises(null) - .step('respondToLoginSucceed') // TODO Rename to maybeRespondToLoginSucceed ? - .description('Execute a HTTP response for a successful login') - .accepts('res user') - .promises(null) - .step('respondToLoginFail') - .description('Execute a HTTP response for a failed login') - .accepts('req res errors login') - .promises(null) - .extractLoginPassword( function (req, res) { - return [req.body[this.loginFormFieldName()], req.body[this.passwordFormFieldName()]]; - }) - .interpretUserOrErrors( function (userOrErrors) { - if (Array.isArray(userOrErrors)) { - return [null, userOrErrors]; // We have an array of errors - } else { - return [userOrErrors, []]; // We have a user - } - }) - .getSession( function (req) { - return req.session; - }) - .addToSession( function (sess, user, errors) { - var _auth = sess.auth || (sess.auth = {}); - if (user) - _auth.userId = user[this._userPkey]; - _auth.loggedIn = !!user; - }) - .respondToLoginSucceed( function (res, user) { - if (user) { - this.redirect(res, this.loginSuccessRedirect()); - } - }) - .respondToLoginFail( function (req, res, errors, login) { - if (!errors || !errors.length) return; - return renderLoginFail.apply(this, arguments); - }) - - .get('getRegisterPath', "the registration page's uri path.") - .step('displayRegister') - .accepts('req res next') - .promises(null) - .displayRegister( function (req, res) { - return renderRegister.apply(this, arguments); - }) - - .post('postRegisterPath', "the uri path that the registration POSTs to. Same as the 'action' field of the registration .") - .step('extractLoginPassword') // Re-used (/search for other occurence) - .step('extractExtraRegistrationParams') - .description('Extracts additonal query or body params from the ' + - 'incoming request and returns them in the `extraParams` object') - .accepts('req') - .promises('extraParams') - .step('aggregateParams') - .description('Combines login, password, and extraParams into a newUserAttributes Object containing everything in extraParams plus login and password key/value pairs') - .accepts('login password extraParams') - .promises('newUserAttributes') - .step('validateRegistrationBase') - .description("Basic validation done by `everyauth`. Don't edit this. Configure validateRegistration instead.") - .accepts('newUserAttributes') - .promises('baseErrors') - .step('validateRegistration') - .description('Validates the registration parameters. Default includes check for existing user') - .accepts('newUserAttributes baseErrors') - .promises('errors') - .step('maybeBreakToRegistrationFailSteps') - .accepts('req res errors newUserAttributes') - .promises(null) - .canBreakTo('registrationFailSteps') - .step('registerUser') - .description('Creates and returns a new user with newUserAttributes') - .accepts('newUserAttributes') - .promises('userOrErrors') - .step('extractUserOrHandleErrors') // User registration may throw an error if DB detects a non-unique value for login - .accepts('req res userOrErrors newUserAttributes') - .promises('user') - .canBreakTo('registrationFailSteps') - .step('getSession') - .step('addToSession') - .step('respondToRegistrationSucceed') - .accepts('res user') - .promises(null) - .extractExtraRegistrationParams( function (req) { - return {}; - }) - .aggregateParams( function (login, password, extraParams) { - var params = extraParams; - params[this.loginKey()] = login; - params.password = password; - return params; - }) - .validateRegistrationBase( function (newUserAttributes) { - var loginWith = this.loginWith() - , loginWithSpec, loginWithSanitize, loginWithValidate - , login = newUserAttributes[this.loginKey()] - , password = newUserAttributes.password - , errors = []; - if (!login) { - errors.push('Missing ' + this.loginHumanName()); - } else { - // loginWith specific validations - var validLoginTypes = this.validLoginTypes(); - loginWithSpec = this.validLoginTypes()[loginWith]; - - // Sanitize first - loginWithSanitize = loginWithSpec.sanitize; - if (loginWithSanitize) { - login = loginWithSanitize(login); - } - - // Validate second - var validateLoginWith = loginWithSpec.validate; - if (validateLoginWith) { - if (!validateLoginWith(login)) { - // Add error third - errors.push(loginWithSpec.error); - } - } - } - if (!password) errors.push('Missing password'); - return errors; - }) - .validateRegistration( function (newUserAttributes, baseErrors) { - return baseErrors; - }) - .maybeBreakToRegistrationFailSteps( function (req, res, errors, newUserAttributes) { - var user, loginField, loginKey; - if (errors && errors.length) { - user = newUserAttributes; - loginField = this.loginFormFieldName(); - loginKey = this.loginKey(); - if (loginField !== loginKey) { - user[loginField] = user[loginKey]; - delete user[this.loginKey()]; - } - delete user.password; - return this.breakTo('registrationFailSteps', req, res, errors, user); - } - }) - .extractUserOrHandleErrors( function (req, res, userOrErrors, newUserAttributes) { - var errors, user; - if (Array.isArray(userOrErrors)) { - errors = userOrErrors; - user = newUserAttributes; - delete user.password; - return this.breakTo('registrationFailSteps', req, res, errors, user); - } - user = userOrErrors; - return user; - }) - .respondToRegistrationSucceed( function (res, user) { - this.redirect(res, this.registerSuccessRedirect()); - }) - - .stepseq('registrationFailSteps') - .step('respondToRegistrationFail') - .accepts('req res errors newUserAttributes') - .promises(null) - .respondToRegistrationFail( function (req, res, errors, newUserAttributes) { - return renderRegisterFail.apply(this, arguments); - }); - -function validateEmail (value) { - // From Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ - var isValid = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); - - return isValid; -} - -password.validLoginTypes({ - login: {} - , email: { - validate: validateEmail - , error: 'Please correct your email.' - } - , phone: { - sanitize: function (value) { - // Pull out only +, digits and 'x' for extension - return value.replace(/[^\+\dx]/g, ''); - } - , validate: function (value) { - return value.length >= 7; - } - , error: 'Please correct your phone.' - } -}); - -password.loginWith = function (loginType) { - if (!arguments.length) return this._loginType; - - this._loginType = loginType; - var name - , validLoginTypes = Object.keys(this.validLoginTypes()); - if (-1 === validLoginTypes.indexOf(loginType)) { - throw new Error("loginWith only supports " + validLoginTypes.join(', ')); - } - this.loginFormFieldName(loginType); - this.loginKey(loginType); - this.loginHumanName(loginType); - return this; -}; -password.loginWith('login'); diff --git a/node_modules/everyauth/lib/modules/readability.js b/node_modules/everyauth/lib/modules/readability.js deleted file mode 100644 index ebedd68..0000000 --- a/node_modules/everyauth/lib/modules/readability.js +++ /dev/null @@ -1,28 +0,0 @@ -var oauthModule = require('./oauth'); - - var readability = module.exports = - oauthModule.submodule('readability') - - .apiHost('https://www.readability.com/api/rest/v1') - .oauthHost('https://www.readability.com/api/rest/v1/oauth') - - .requestTokenPath('/request_token') - .authorizePath('/authorize') - .accessTokenPath('/access_token') - - .entryPath('/auth/readability') - .callbackPath('/auth/readability/callback') - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var p = this.Promise(); - this.oauth.get(this.apiHost() + '/users/_current', accessToken, accessTokenSecret, function (err, data) { - if (err) return p.fail(err.error_message); - var oauthUser = JSON.parse(data); - p.fulfill(oauthUser); - }) - return p; - }) - .convertErr( function (data) { - return new Error(data.error_message); - }); - diff --git a/node_modules/everyauth/lib/modules/skyrock.js b/node_modules/everyauth/lib/modules/skyrock.js deleted file mode 100644 index a43feab..0000000 --- a/node_modules/everyauth/lib/modules/skyrock.js +++ /dev/null @@ -1,24 +0,0 @@ -var oauthModule = require('./oauth') - , Parser = require('xml2js').Parser; - -var skyrock = module.exports = - oauthModule.submodule('skyrock') - .apiHost('https://api.skyrock.com/v2') - .oauthHost('https://api.skyrock.com/v2') - .requestTokenPath("/oauth/initiate") - .accessTokenPath("/oauth/token") - .authorizePath("/oauth/authorize") - .entryPath('/auth/skyrock') - .callbackPath('/auth/skyrock/callback') - .sendCallbackWithAuthorize(false) - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/user/get.json', accessToken, accessTokenSecret, function (err, data) { - data = JSON.parse(data); - promise.fulfill(data); - }); - return promise; - }) - .convertErr( function (data) { - return data.data; - }); diff --git a/node_modules/everyauth/lib/modules/soundcloud.js b/node_modules/everyauth/lib/modules/soundcloud.js deleted file mode 100644 index fa3aab4..0000000 --- a/node_modules/everyauth/lib/modules/soundcloud.js +++ /dev/null @@ -1,40 +0,0 @@ -var oauthModule = require('./oauth2') - , request = require('request'); - -var soundcloud = module.exports = -oauthModule.submodule('soundcloud') - .configurable({ - scope: 'specify types of access: (no scope), non-expiring' - , display: 'specify type of auth dialog: (no display), popup' - }) - .apiHost('https://api.soundcloud.com/') - .oauthHost('https://api.soundcloud.com/') - .authPath('/connect') - .accessTokenPath('/oauth2/token') - .entryPath('/auth/soundcloud') - .callbackPath('/auth/soundcloud/callback') - .authQueryParam('response_type', 'code') - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - .authQueryParam('display', function () { - return this._display && this.display(); - }) - .accessTokenHttpMethod('post') - .postAccessTokenParamsVia('data') - .accessTokenParam('grant_type', 'authorization_code') - .fetchOAuthUser(function (accessToken) { - var promise = this.Promise(); - request.get({ - url: this.apiHost() + '/me.json' - , qs: {oauth_token: accessToken} - }, function (err, res, body) { - if (err) return promise.fail(err); - if (parseInt(res.statusCode / 100, 10) !== 2) { - return promise.fail(body); - } - return promise.fulfill(JSON.parse(body)); - }); - - return promise; - }); diff --git a/node_modules/everyauth/lib/modules/tripit.js b/node_modules/everyauth/lib/modules/tripit.js deleted file mode 100644 index 94a6a8e..0000000 --- a/node_modules/everyauth/lib/modules/tripit.js +++ /dev/null @@ -1,45 +0,0 @@ -var oauthModule = require('./oauth') - , url = require('url'); - -var tripitModule = module.exports = -oauthModule.submodule('tripit') - .apiHost('https://api.tripit.com/') - .oauthHost('https://api.tripit.com/') - .entryPath('/auth/tripit') - .callbackPath('/auth/tripit/callback') - .redirectToProviderAuth( function (res, token) { - var redirectTo = 'https://www.tripit.com/' + this.authorizePath() + '?oauth_token=' + token; - if (this.sendCallbackWithAuthorize()) { - redirectTo += '&oauth_callback=' + this.myHostname() + this.callbackPath(); - } - this.redirect(res, redirectTo); - }) - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/v1/get/profile/id/' + params.user_id + '/format/json', - accessToken, accessTokenSecret, function (err, data) { - if (err) { - return promise.fail(err); - } - var oauthUser = JSON.parse(data).Profile; - promise.fulfill(oauthUser); - }); - return promise; - }) - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.denied; - }) - .handleAuthCallbackError( function (req, res) { - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: 'The user denied your request' - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - .convertErr( function (data) { - return new Error(data.data.match(/(.+)<\/error>/)[1]); - }); diff --git a/node_modules/everyauth/lib/modules/tumblr.js b/node_modules/everyauth/lib/modules/tumblr.js deleted file mode 100644 index 52fd7ea..0000000 --- a/node_modules/everyauth/lib/modules/tumblr.js +++ /dev/null @@ -1,26 +0,0 @@ -var oauthModule = require('./oauth') - , Parser = require('xml2js').Parser; - -var twitter = module.exports = -oauthModule.submodule('tumblr') - .apiHost('http://www.tumblr.com/api') - .oauthHost('http://www.tumblr.com/') - .entryPath('/auth/tumblr') - .callbackPath('/auth/tumblr/callback') - .sendCallbackWithAuthorize(false) - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/authenticate', accessToken, accessTokenSecret, function (err, data) { - if (err) return promise.fail(err); - var parser = new Parser(); - parser.on('end', function (result) { - var oauthUser = result.tumblelog['@']; - promise.fulfill(oauthUser); - }); - parser.parseString(data); - }); - return promise; - }) - .convertErr( function (data) { - return data.data; - }); diff --git a/node_modules/everyauth/lib/modules/twitter.js b/node_modules/everyauth/lib/modules/twitter.js deleted file mode 100644 index b07a248..0000000 --- a/node_modules/everyauth/lib/modules/twitter.js +++ /dev/null @@ -1,56 +0,0 @@ -var oauthModule = require('./oauth') - , url = require('url'); - -var twitter = module.exports = -oauthModule.submodule('twitter') - .apiHost('https://api.twitter.com/') - .oauthHost('https://api.twitter.com/') - .entryPath('/auth/twitter') - .callbackPath('/auth/twitter/callback') - .authorizePath('/oauth/authenticate') - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/1/users/show.json?user_id=' + params.user_id, accessToken, accessTokenSecret, function (err, data, res) { - if (err) { - err.extra = {data: data, res: res}; - return promise.fail(err); - } - var oauthUser = JSON.parse(data); - promise.fulfill(oauthUser); - }); - return promise; - }) - .authCallbackDidErr( function (req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.denied; - }) - .handleAuthCallbackError( function (req, res) { - if (res.render) { - res.render(__dirname + '/../views/auth-fail.jade', { - errorDescription: 'The user denied your request' - }); - } else { - // TODO Replace this with a nice fallback - throw new Error("You must configure handleAuthCallbackError if you are not using express"); - } - }) - .moduleErrback( function (err, seqValues) { - if (err instanceof Error) { - var next = seqValues.next; - return next(err); - } else if (err.extra) { - var twitterResponse = err.extra.res - , serverResponse = seqValues.res; - serverResponse.writeHead( - twitterResponse.statusCode - , twitterResponse.headers); - serverResponse.end(err.extra.data); - } else if (err.statusCode) { - var serverResponse = seqValues.res; - serverResponse.writeHead(err.statusCode); - serverResponse.end(err.data); - } else { - console.error(err); - throw new Error('Unsupported error type'); - } - }); diff --git a/node_modules/everyauth/lib/modules/vimeo.js b/node_modules/everyauth/lib/modules/vimeo.js deleted file mode 100644 index b4ecefe..0000000 --- a/node_modules/everyauth/lib/modules/vimeo.js +++ /dev/null @@ -1,20 +0,0 @@ -var oauthModule = require('./oauth'); - -var vimeo = module.exports = -oauthModule.submodule('vimeo') - - .apiHost('http://vimeo.com/api/rest/v2') - .oauthHost('http://vimeo.com/') - - .entryPath('/auth/vimeo') - .callbackPath('/auth/vimeo/callback') - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '?format=json&method=vimeo.people.getInfo&user_id=' + accessTokenSecret, accessToken, accessTokenSecret, function (err, data) { - if (err) return promise.fail(err); - var oauthUser = JSON.parse(data); - return promise.fulfill(oauthUser.person); - }); - return promise; - }); diff --git a/node_modules/everyauth/lib/modules/vkontakte.js b/node_modules/everyauth/lib/modules/vkontakte.js deleted file mode 100644 index 4b5bdb1..0000000 --- a/node_modules/everyauth/lib/modules/vkontakte.js +++ /dev/null @@ -1,47 +0,0 @@ -var oauthModule = require('./oauth2') - , url = require('url'); - -var vkontakte = module.exports = -oauthModule.submodule('vkontakte') - .configurable({ - display: 'set to "touch" if you want users to see a mobile optimized version of the auth page' - , scope: 'specify types of access: See http://vk.com/developers.php?oid=-1&p=Права_доступа_приложений' - , fields: 'specify fields of profile: See http://vk.com/developers.php?oid=-1&p=Описание_полей_параметра_fields' - }) - - .oauthHost('https://api.vk.com/') - .apiHost('https://api.vk.com/') - .entryPath('/auth/vkontakte') - .callbackPath('/auth/vkontakte/callback') - - .authQueryParam('response_type', 'code') - - .authQueryParam('display', function () { - return this._display && this.display(); - }) - .authQueryParam('scope', function () { - return this._scope && this.scope(); - }) - - .fetchOAuthUser( function (accessToken, http) { - var promise = this.Promise(); - var params = this._fields && this.fields(); - var fields = (params) ? '&fields=' + params : ''; - this.oauth.get(this.apiHost() + '/method/getProfiles?uids=' + http.extra.user_id + fields, accessToken, function (err, data) { - if (err) return promise.fail(err.error_message); - var data = JSON.parse(data) - if (data.error) return promise.fail(data.error.error_msg); - var oauthUser = data.response[0]; - promise.fulfill(oauthUser); - }) - return promise; - }) - - .authCallbackDidErr(function(req) { - var parsedUrl = url.parse(req.url, true); - return parsedUrl.query && !!parsedUrl.query.error; - }) - - .convertErr( function (data) { - return new Error(JSON.parse(data).error.error_msg); - }); \ No newline at end of file diff --git a/node_modules/everyauth/lib/modules/yahoo.js b/node_modules/everyauth/lib/modules/yahoo.js deleted file mode 100644 index 649f6b4..0000000 --- a/node_modules/everyauth/lib/modules/yahoo.js +++ /dev/null @@ -1,32 +0,0 @@ -var oauthModule = require('./oauth') - , OAuth = require('oauth').OAuth; - -var yahoo = module.exports = -oauthModule.submodule('yahoo') - .definit( function () { - var oauth = this.oauth = new OAuth( - this.oauthHost() + this.requestTokenPath() - , this.oauthHost() + this.accessTokenPath() - , this.consumerKey() - , this.consumerSecret() - , '1.0', null, 'HMAC-SHA1'); - }) - .apiHost('http://social.yahooapis.com/v1') - .oauthHost('https://api.login.yahoo.com/oauth/v2') - - .requestTokenPath('/get_request_token') - .accessTokenPath('/get_token') - .authorizePath('/request_auth') - - .entryPath('/auth/yahoo') - .callbackPath('/auth/yahoo/callback') - - .fetchOAuthUser( function (accessToken, accessTokenSecret, params) { - var promise = this.Promise(); - this.oauth.get(this.apiHost() + '/user/' + params.xoauth_yahoo_guid + '/profile?format=json', accessToken, accessTokenSecret, function (err, data) { - if (err) return promise.fail(err); - var oauthUser = JSON.parse(data).profile; - promise.fulfill(oauthUser); - }); - return promise; - }); diff --git a/node_modules/everyauth/lib/promise.js b/node_modules/everyauth/lib/promise.js deleted file mode 100644 index 77dd198..0000000 --- a/node_modules/everyauth/lib/promise.js +++ /dev/null @@ -1,93 +0,0 @@ -var Promise = function (values) { - this._callbacks = []; - this._errbacks = []; - this._timebacks = []; - if (arguments.length > 0) { - this.fulfill.apply(this, values); - } -}; - -Promise.prototype = { - callback: function (fn, scope) { - if (this.values) { - fn.apply(scope, this.values); - return this; - } - this._callbacks.push([fn, scope]); - return this; - } - , errback: function (fn, scope) { - if (this.err) { - fn.call(scope, this.err); - return this; - } - this._errbacks.push([fn, scope]); - return this; - } - , timeback: function (fn, scope) { - if (this.timedOut) { - fn.call(scope); - return this; - } - this._timebacks.push([fn, scope]); - return this; - } - , fulfill: function () { - if (this.isFulfilled || this.err || this.timedOut) return; - this.isFulfilled = true; - if (this._timeout) clearTimeout(this._timeout); - var callbacks = this._callbacks; - this.values = arguments; - for (var i = 0, l = callbacks.length; i < l; i++) { - callbacks[i][0].apply(callbacks[i][1], arguments); - } - return this; - } - , fail: function (err) { - if (this._timeout) clearTimeout(this._timeout); - var errbacks = this._errbacks; - if ('string' === typeof err) - err = new Error(err); - this.err = err; - for (var i = 0, l = errbacks.length; i < l; i++) { - errbacks[i][0].call(errbacks[i][1], err); - } - return this; - } - , timeout: function (ms) { - if (this.values || this.err) return this; - var timebacks = this._timebacks - , self = this; - if (ms === -1) return this; - this._timeout = setTimeout(function () { - self.timedOut = true; - for (var i = 0, l = timebacks.length; i < l; i++) { - timebacks[i][0].call(timebacks[i][1]); - } - }, ms); - return this; - } -}; - -var ModulePromise = module.exports = function (_module, values) { - if (values) - Promise.call(this, values); - else - Promise.call(this); - this.module = _module; -}; - -ModulePromise.prototype.__proto__ = Promise.prototype; - -ModulePromise.prototype.breakTo = function (seqName) { - if (this._timeout) clearTimeout(this._timeout); - - var args = Array.prototype.slice.call(arguments, 1); - var _module = this.module - , seq = _module._stepSequences[seqName]; - if (_module.everyauth.debug) - console.log('breaking out to ' + seq.name); - seq = seq.materialize(); - seq.start.apply(seq, args); - // TODO Garbage collect the abandoned sequence -}; diff --git a/node_modules/everyauth/lib/routeTriggeredSequence.js b/node_modules/everyauth/lib/routeTriggeredSequence.js deleted file mode 100644 index 5d29866..0000000 --- a/node_modules/everyauth/lib/routeTriggeredSequence.js +++ /dev/null @@ -1,14 +0,0 @@ -var StepSequence = require('./stepSequence'); - -var RouteTriggeredSequence = module.exports = function RouteTriggeredSequence (name, _module) { - StepSequence.call(this, name, _module); -} - -RouteTriggeredSequence.prototype.__proto__ = StepSequence.prototype; - -RouteTriggeredSequence.prototype.routeHandler = function () { - // Create a shallow clone, so that seq.values are different per HTTP request - var seq = this.materialize(); - // Kicks off a sequence of steps based on a route - seq.start.apply(seq, arguments); // BOOM! -}; diff --git a/node_modules/everyauth/lib/step.js b/node_modules/everyauth/lib/step.js deleted file mode 100644 index c1503e5..0000000 --- a/node_modules/everyauth/lib/step.js +++ /dev/null @@ -1,171 +0,0 @@ -var Promise = require('./promise') - , clone = require('./utils').clone; - -var Step = module.exports = function Step (name, _module) { - this.name = name; - - // defineProperty; otherwise, - // clone will overflow when we clone a module - Object.defineProperty(this, 'module', { value: _module }); -}; - -Step.prototype = { - /** - * @returns {Promise} - */ - exec: function (seq) { - var accepts = this.accepts - , promises = this.promises - , block = this.block - , _module = this.module - , stepName = this.name - , self = this - , errorCallback = function (error) { - // Ensure that seq.values are always passed back to moduleErrback - if (self.errback) { - self.errback(error, seq.values); - } else if (_module._moduleErrback) { - _module._moduleErrback(error, seq.values); - } else { - throw new Error('Missing module or step errback'); - } - }; - - - if (this.debug) { - console.log('starting step - ' + this.name); - } - - var args = this._unwrapArgs(seq); - - // There is a hidden last argument to every step function that - // is all the data promised by prior steps up to the step's point - // in time. We cannot anticipate everything a developer may want via - // `accepts(...)`. Therefore, just in case, we give the developer - // access to all data promised by prior steps via the last argument -- `seq.values` - args.push(seq.values); - - var ret; - try { - // Apply the step logic - - // Add _super access - _module._super = function () { - var step = this.__proto__._steps[stepName]; - if (!step) return; - var superArgs = arguments.length ? arguments : args; - step.block.apply(this, superArgs); - }; - ret = block.apply(_module, args); - delete _module._super; - } catch (breakTo) { - // Catch any sync breakTo's if any - if (breakTo.isSeq) { - if (this.module.everyauth.debug) - console.log("breaking out to " + breakTo.name); - breakTo.start.apply(breakTo, breakTo.initialArgs); - // TODO Garbage collect the promise chain - return; - } else { - // Else, we have a regular exception - errorCallback(breakTo); - } - } - - if (promises && promises.length && - 'undefined' === typeof ret) { - errorCallback( - new Error('Step ' + this.name + ' of `' + _module.name + - '` is promising: ' + promises.join(', ') + - ' ; however, the step returns nothing. ' + - 'Fix the step by returning the expected values OR ' + - 'by returning a Promise that promises said values.') - ); - } - // Convert return value into a Promise - // if it's not yet a Promise - ret = (ret instanceof Promise) - ? ret - : Array.isArray(ret) - ? promises.length === 1 - ? this.module.Promise([ret]) - : this.module.Promise(ret) - : this.module.Promise([ret]); - - if (seq.debug) { - ret.callback( function () { - console.log('...finished step'); - }); - } - - var convertErr = _module._convertErr; - if (convertErr) { - var oldErrback = ret.errback; - ret.errback = function (fn, scope) { - var oldFn = fn; - fn = function (err) { - if (err.constructor === Object) { - err = convertErr(err); - } else if ('string' === typeof err) { - err = new Error(err); - } - return oldFn.call(this, err); - }; - return oldErrback.call(this, fn, scope); - }; - } - - ret.errback(errorCallback); - - ret.callback( function () { - // Store the returned values - // in the sequence's state via seq.values - var returned = arguments - , vals = seq.values; - if (promises !== null) promises.forEach( function (valName, i) { - vals[valName] = returned[i]; - }); - }); - - ret.timeback( function () { - ret.fail(new Error('Step ' + stepName + ' of `' + _module.name + '` module timed out.')); - }); - - var timeoutMs = this.timeout || _module.moduleTimeout(); - ret.timeout(timeoutMs); - - return ret; - } - - /** - * Unwraps values (from the sequence) based on - * the step's this.accepts spec. - */ - , _unwrapArgs: function (seq) { - return this.accepts.reduce( function (args, accept) { - args.push(seq.values[accept]); - return args; - }, []); - } - , clone: function (name, _module) { - var step = new Step(name, _module); - step.accepts = clone(this.accepts); - step.promises = clone(this.promises); - step.description = this.description; - step.timeout = this.timeout; - step.errback = this.errback; - return step; - } -}; - -Object.defineProperty(Step.prototype, 'block', { - get: function () { - return this._block || (this._block = this.module[this.name]()); - } -}); - -Object.defineProperty(Step.prototype, 'debug', { - get: function () { - return this.module.everyauth.debug; - } -}); diff --git a/node_modules/everyauth/lib/stepSequence.js b/node_modules/everyauth/lib/stepSequence.js deleted file mode 100644 index 8ed967b..0000000 --- a/node_modules/everyauth/lib/stepSequence.js +++ /dev/null @@ -1,198 +0,0 @@ -var Promise = require('./promise') - , clone = require('./utils').clone; - -var StepSequence = module.exports = function StepSequence (name, module) { - this.name = name; - this.module = module; - this.orderedStepNames = []; -} - -StepSequence.prototype = { - constructor: StepSequence - - , isSeq: true - /** - * Sets up the immediate or eventual output of priorPromise to pipe to the - * nextStep's promise - * @param {Promise} priorPromise - * @param {Step} nextStep - * @returns {Promise} - */ - , _bind: function (priorPromise, nextStep) { - var nextPromise = new Promise() - , seq = this; - - priorPromise.callback( function () { - var resultPromise = nextStep.exec(seq); - if (!resultPromise) return; // if we have a breakTo - resultPromise.callback( function () { - nextPromise.fulfill(); - }); // TODO breakback? - }); - return nextPromise; - } - - /** - * This kicks off a sequence of steps. - * Creates a new chain of promises and exposes the leading promise - * to the incoming (req, res) pair from the route handler - */ - , start: function () { - var steps = this.steps; - - this._transposeArgs(arguments); - - // Pipe through the steps - var priorStepPromise = steps[0].exec(this); - - // If we have a breakTo - if (!priorStepPromise) return; - - for (var i = 1, l = steps.length; i < l; i++) { - priorStepPromise = this._bind(priorStepPromise, steps[i]); - } - return priorStepPromise; - } - - // Used for exposing the leading promise of a step promise chain to the - // incoming args (e.g., [req, res] pair from the route handler) - , _transposeArgs: function (args) { - var seq = this; - this.steps[0].accepts.forEach( function (paramName, i) { - // Map the incoming arguments to the named parameters - // that the first step is expected to accept. - seq.values[paramName] = args[i]; - }); - } - , clone: function (submodule) { - var sequence = new (this.constructor)(this.name, submodule); - sequence.orderedStepNames = clone(this.orderedStepNames); - return sequence; - } - - , _propertiesToMaterialize: ['isSeq', '_bind', 'start', '_transposeArgs'] - , materialize: function () { - var sequence = Object.create(this) - , materializedMethods = this._propertiesToMaterialize; - sequence.values = {}; - for (var i = materializedMethods.length; i--;) { - var methodName = materializedMethods[i]; - sequence[methodName] = this[methodName]; - } - return sequence; - } - - // TODO Replace logic here with newer introspection code - , validateSteps: function () { - var steps = this.steps - , step - , paramsToDate = [] - , missingParams; - for (var i = 0, l = steps.length; i < l; i++) { - step = steps[i]; - if ('undefined' === typeof step.accepts) - throw new Error('You did not declare accepts for the step: ' + step.name); - if ('undefined' === typeof step.promises) - throw new Error('You did not declare promises for the step: ' + step.name); - - if (i === 0) - paramsToDate = paramsToDate.concat(step.accepts); - - missingParams = step.accepts.filter( function (param) { - return paramsToDate.indexOf(param) === -1; - }); - - if (i > 0 && missingParams.length) - throw new Error('At step, ' + step.name + ', you are trying to access the parameters: ' + - missingParams.join(', ') + ' . However, only the following parameters have been ' + - 'promised from prior steps thus far: ' + paramsToDate.join(', ')); - - paramsToDate = paramsToDate.concat(step.promises); - - if ('undefined' === typeof this.module[step.name]()) - // TODO Remove this Error, since invoking the arg to typeof (see line above) - // already throws an Error - throw new Error('No one defined the function for the following step: ' + step.name + ' in the module ' + this.module.name); - } - } -}; - -Object.defineProperty(StepSequence.prototype, 'steps', { - get: function () { - // Compile the steps by pulling the step names from the module - var allSteps = this.module._steps - , orderedSteps = this.orderedStepNames.map( function (stepName) { - return allSteps[stepName]; - }) - , seq = this; - - function compileSteps () { - var paramsToDate = [] - , missingParams; - - var steps = orderedSteps.map( function (step, i) { - var meta = { missing: [], step: step, missingParams: [], paramsToDate: {} }; - if (! ('promises' in step)) { - meta.missing.push('promises'); - } - if (! ('accepts' in step)) { - meta.missing.push('accepts'); - } - - if (('accepts' in step) && i === 0) - paramsToDate = paramsToDate.concat(step.accepts); - - missingParams = !step.accepts ? [] : step.accepts.filter( function (param) { - return paramsToDate.indexOf(param) === -1; - }); - - if (step.promises) - paramsToDate = paramsToDate.concat(step.promises); - - if (missingParams.length) { - meta.missingParams = missingParams; - meta.paramsToDate = paramsToDate; - } - - if (! (('_' + step.name) in seq.module)) - meta.missing.push('its function'); - - return meta; - }); - - return steps; - } - - var compiledSteps; - - Object.defineProperty(orderedSteps, 'incomplete', { get: function () { - compiledSteps || (compiledSteps = compileSteps()); - return compiledSteps.filter( function (stepMeta) { - return stepMeta.missing.length > 0; - }).map( function (stepMeta) { - var error = 'is missing: ' + stepMeta.missing.join(', '); - return { name: stepMeta.step.name, error: error }; - }); - } }); - - Object.defineProperty(orderedSteps, 'invalid', { get: function () { - compiledSteps || (compiledSteps = compileSteps()); - return compiledSteps.filter( function (stepMeta) { - return stepMeta.missingParams.length > 0; - }).map( function (stepMeta) { - var error = 'is trying to accept the parameters: ' + - stepMeta.missingParams.join(', ') + - ' . However, only the following parameters have ' + - 'been promised from prior steps thus far: ' + - stepMeta.paramsToDate.join(', '); - return { name: stepMeta.step.name, error: error }; - }); - } }); - - return orderedSteps; - } -}); - -Object.defineProperty(StepSequence.prototype, 'debug', { - get: function () { return this.module.everyauth.debug; } -}); diff --git a/node_modules/everyauth/lib/utils.js b/node_modules/everyauth/lib/utils.js deleted file mode 100644 index 9a9718c..0000000 --- a/node_modules/everyauth/lib/utils.js +++ /dev/null @@ -1,35 +0,0 @@ -var tls = require('tls'); - -var clone = exports.clone = function clone (obj) { - if (obj === undefined || obj === null) - return obj - if (Array.isArray(obj)) - return cloneArray(obj); - if (obj.constructor == Object) - return cloneObject(obj); - return obj; -}; - -function cloneObject (obj, shouldMinimizeData) { - var ret = {}; - for (var k in obj) - ret[k] = clone(obj[k]); - return ret; -}; - -function cloneArray (arr) { - var ret = []; - for (var i = 0, l = arr.length; i < l; i++) - ret.push(clone(arr[i])); - return ret; -}; - -exports.extractHostname = function (req) { - var headers = req.headers - , protocol = (req.connection.server instanceof tls.Server || - (req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'].slice(0,5) === 'https')) - ? 'https://' - : 'http://' - , host = headers.host; - return protocol + host; -}; diff --git a/node_modules/everyauth/lib/views/auth-fail.jade b/node_modules/everyauth/lib/views/auth-fail.jade deleted file mode 100644 index 0bb3fe5..0000000 --- a/node_modules/everyauth/lib/views/auth-fail.jade +++ /dev/null @@ -1 +0,0 @@ -p Your authentication failed because: #{errorDescription} diff --git a/node_modules/everyauth/media/37signals.ico b/node_modules/everyauth/media/37signals.ico deleted file mode 100644 index 5b7c3504fc8ce04e7a7e57fee99253e7e69f3a5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2862 zcmeHJu}T9$5S_#*DN_hG7C8_J2r39-cOcjZ{(`lAK47o7Pe^GaHiC^H0TIL?BG_CI z>;w@65kv@r*n}J3V|U3J3Ca;jkqo@unc11UnYZCGA_bX}N~MCmB(;Lbx(IB6U6#FR zkzM$#U6s9($jyvMjWIwKU|zrQ%u7TCOXQTu84(<Q^*#KfUpRTJ}*r}FPUz%8X%ELvrcH3-Z0P{{!b6wDF#q%h)3qL{8}=Urpy5v~A;n&&YDM q37gL#`niH@IKuBtH|))GcBV^B9Q5Y77&9H`xj5|2bDZfo&wT?UIn&$# diff --git a/node_modules/everyauth/media/500px.ico b/node_modules/everyauth/media/500px.ico deleted file mode 100644 index 08fc8bb67bf70c69ee36a1041528b831ba81a00f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 427 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMfq5z)|S0MfW|9>C}VF1~EeSHuS zOcJ7ogM;Jg)29$wW@cs<78bB>hWGE^0|kNPvSrI2J$eKb6cG^tigFeto7#J8D8k(A#dU|^L`}?P-r?gO^uAT0_gx)yvyIFu!WXylva}?K^V(?72%F^gGDD58j>B1yo6Ig2@C&bnq@Ma((p z#M$I#*^Ila^Q!vJz%YRF-q}BIk9AH@byru_?YZ|()mJrufFa74hoo>LpefB99F+BT z6JQ<5e0`O*t2Gc{4!F{iO&n+lkP?xvkgU*$TCK+P>C@rw?~lyPOgK6^A}lNnn>TO9 z=bwL$?%liN-o1O6Fku4H($aA7;6eQS^UrA7v?;D#yM~~kAoT0k4^N*y#mSQ=F>2H( ztXZ=LbLY;*?%lib_19k`K0Y2VU%o`APMvV;)-4PiI1ppTjKPKt8?bQULIeZ^;L)Q; zIDPswMvNGNW5ICbh2jvqgcsHiB6A3q*3F)`S(WeYZL+=yATW?{~pIasx76;`ZRfu&2A7P@~Q z1t0Igzv~WEa%imch1}}~nOWCwmnW%RuCjAY;m=`+$)-VolSMrtnk!2*s$Ry*w~i1^ zG(KvyswS#h8hSVM&?r=`>1<&gP|?*`vsP6wYH!}s#!j;&R?Ps8UY>dD7H!>3JCriW zTQ{k0kJ43I<*i$rxFFE4maSG`)y4-Xt33||LV1#A+HGA|c}OP4O#w{IU7Em|aFrHP3NDp#&7eX!PEL-DwU;kn#`f*o5gr~c<0r>Mj?o-rOO+~xUw{1-<;s=A7himVN|h?%*|TRd zzPr1-!^6Wv##V1{Z}jNV1O5B=M`~)SjEjkhiTM8e@8Rt1EaN`M%|nL{$rzuWo{qI^ z*J9|${WnUNE{)%R{~cw@l!3XqIlle&TUc9LKYuQBoV~q09zT98^Cah&nl)?6{KC1VcJ11z zQ>PB<)~$=HSFhsAl`Cl2upus7xPZou8>4yi<}$~%Y}pb%K0Y{d#=U#I+<5F*K+>k+&5&%5SgnvhjQNJT*Y~e^ZB@O z<7CdBIB_Bp5)z7dBR`7%Kkq=CM|ANAx0_retVZ}~v#CX@Bvo=+Y913A>K`a3r#f<9gBnoQ_D#W7OvUu0N z2#)W|`(i-BZS)`4Ezy^xL$OZo4+&dUK%+s|s2~vxJW7ZKlT%j%?kS>Yje`5Y=!Qa2 zDvWfqsn^R&EHu^I_rO>ox{sdaERQF87rH}XOI=oDp0Yd49*gwsG0SqO3TsP`E!Q*D zFY2eYS(Rsnj?m$hp7#EHc%0drIp-nuYCMoLNw z)s()-$jFd5h4BgJ9L6iUIE8C3uCF-%a6QL4ka5Z%fBYe_%Inv!!FYsm3fFXP+qRY1 zq*t$AvYuj$!gU_!Q_h`nad8r({Povg5~KX`%P$h6a2?9n;QsylvVPOz6waHBLppTm zAh8J7s$6q&j^z54>rk#oxo+dyj%(6s)22xrV{2-%8x_ z(@#H1>{6jZg*^Q7<(FTgdiClO6F50J$y$@^%zE|e;pWYoVC=#efbk3Gd#4m!`}XZ+J>9Wm$Gp7H`JQWB&i|bAx%M13Y#5d;TL#88ix)4(=+UDwfBt+~>oUG! zj5cM;6eJ}j6GaUkO!uI0_l%p?|K{KI&NG0+b` z{D6uTD}r&*H{X0Cu_fc7ufF;UjE5MzF@|Iu$M}tL5!d+KKVVG9IFYd>*WrwjxV~px z$M}vh6897sC)KZCU*cWHNnGDEPGa2Dq)8K8x^xMio}LmvF?M1c$aVYKvuD9rka0BQ zDDFFO|AOoIz`#I>joYtOYF-yk+C%QANK6o1IE_e57@C|hs3$twrxYto;_vV z&v=^gY~Q|pCH`Uz%=nA(C1YIf9Wc)1-URm>h7TVu`y!0LxbMJtoiW(FdGj!K>{yA( z7>jW)fqN)3X3UWIjC&$er%sjFjO&6)lO`cKIhlT;AL-wB2SQ(7Io5BWkHM+5|KYn0 z4~fmQieB@qQ{JLPljbv7&2mxtu2!pDcsl;va%Lr?p7x|S|L(!LgbRcS=xV-;)|S;v zW(?R8R9$j8PC-1%=ca*Ve7Ix|MvA78!<;VR9gDYV5_N6+l#xM)|_K zz)2xa5f~%7C`2e67i;ZBa3WNk*55<1Fl{FY&P3Nr1ZKtw2Q14o7vdUl;628`Q{a&} z1q^T%CL0l3L0p2Nj=i9JX!Sk^ZZJ(~5r}GRtka6vo*wU&g4 z^8&p`DkRD3MC+s_oZn;L7048Z(~?>HnO5(-)|UALpeO{W(cKAb758meaf1r@bmz?& zz+S$8EFfTOeGynkN!%!#7S(vXqL;7LqiR9#K(dIx<6;PL}pF5)0g{q#%+G zSN>(uQP-c^so)^Zg%5Ad?0eU|%KjajH(6C;sW1HX4fNIzpz0*;yVHhYf8|Ch4(anS zjP&&Nm&S-mW%UWGfQURh%_KDugY*sb){g*B)~-sGoxXXpJ5XOwztEEIzro~AM@W97 zpnd9XIy-sz0PUyWy(#_tfJ^!I6Fb|QrI5&w{tqaWbp69)KYq{GI?y@X& zwhsG%sb)LstZ!O9IhW_)nHPB&s@X0PbA%D6aEc&E9Npip^=6<^i3}B`WA*7e9;jUh{~cCy9!p}lM>rMMYJ8; zZ$~018f{kQ@g=rj4{J8@R>6!@&Rt$KE%_5z9*q%fLN7C=vt{VO!6V2Y{YrR%C-9f| zyc%aBrEuJ42%z#-ls#cO zi3IdG^Z%qN-c4OfGNkRa0F|{$j+EJnx_kh@DC$}8nn22Xf&E(h!3vJMUqpXMtCG*_ z;Rs*sQ&3k+LzMV?kmxv6i?yQS`6@gk-Jn?Ar+o!`NVb*!yf5BPyHgA1q#Fr};Q5q< zWTQ8i^H3yo=WdWZB74lbWcuEkcAdQ*g zzc#d>sJPXIX)$|>+xsa0C+|Rh$MA!*4C-PMaR-wrhr5(SS%44o48qFHQ>cDpPN$@n zCpSB(?Wu4!%%wGV9JQR>NJsiSo8>;#`z(e_ecG4YUgJ-P^Y!I{GBiAeIO+5GisTt2 zPo{n5#MD{TIAu;3;P1hP3fHcc@5Nt`zaMc2Etht=1fp4 diff --git a/node_modules/everyauth/media/box.ico b/node_modules/everyauth/media/box.ico deleted file mode 100644 index 6fb09652d2924f60df84ebe08819855f12557889..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmbu9-A__s9LG;vca=F^A{atCvw7cErdwTf*;d!Bi|+gj(pj43n#-&$H*az_@;xm@ zNd=|QQZzv^8X@?Cf=HksATP<=x8FGg&CBXJ`<&nNe80c%bIzWf9fmnZS7s(dcQI3O zoMCbphPgnHL`qVp!j0?`48xKd@9v$%|1eyYfyI{me`2We6lC{LW40;x2#$pcgzT>n z*^?t|m%uuG`-q?FAF0m3Xl*8Dp71!-%>sm-ZxC_KBI?#6y051_77*E;Luf~m?o0K* zugQd>E(^1iXYsB!BI;5j;-19!{&G%RAG?8wM@9M^=cjtvI{q*V%7$#rH}N=P-Y%K&Hbf5=U})pR*df45rvRFldEB|`U*v!#JrV)< zH=e>ibrXI|D-wwV&hl@y!`vf)xmy4e<+W`>Xj<}MYU9D&o=ZJ3BA(vn&m@kB_aiI= zd9d^gu+b;LI_;yQ{D!;;KU6|ElxL|u0wjX)EZ)JPTaH+G8HXMPJi5EENd>SD@nIe0 zW9uz3kPE#;1dF^FyPpf;R25J@%HueAtKcu`MNrh(RF?uM4m? zR1DAjHMrGRDNpa82xE7;9J^CxNmONUeYgUbvJ|e#QaC3r!>M4o1Y=hrR{Kie`_=%z zp^>sNI;${z`bY47t%Fxz5ASj#ccNJ%bOV(U>LZ)54BBcPW#UJ-uK>p-@V^* z@9+0}z#=ThiWT5~84fQ2ehWN%UxmXz07BXJJJH5%6*qC5cx_%Z-#xv3=UMIqDF40; zaz`NX!hZ;*QQmqM-GwY;zptHlVjU4)8&wa}|i@OK{=ni4UkZGmN63(IgD zrh3a^s6NkeeW0(4h9>NNoVQtoBJVdaeeW7(Mmu31>415(8|MBhn6-_V8P{Q&{fhkF zLBIwe{U5(TUy38ft~p@5B?acO9+-tkm>Is0@y0}qxnbbn%;@OWVzR3d7X!Lrit#U?jy3TG={iQ+B~nCxgB@1x3NzAhmuGQX3${{S`dA z!r$`UF|4%4lMH7JrrJW6 z=?Z;=5~l7l2saO5IF;v=ug7qfD{7)XK-|HVNN|1${VF$1HOevBU5bg$VhGtEL0{wv zBcElb%7e%K1UKa0AT#m{sA5h*73+@zpLNJN{RRp$5};NkBInd=DD?h4iVIXo{&GF; z#_j@jrDCqX0P3@wk#{u~YOmKp4MCs|C0dgYA^GGVQJj~F%#eMk^k0VwwHv5O0=?!e zOf5>#U)Ep3TtOLxN+ zFI&iueSoG2E0C!RWSM|@pc>}E256*PF_vzR$*w}o82Vs&(#o~{5w2f2f%LDpp(nux z2F|@U>JJ!7`U`|Rv9L^=AY66Cpgr0ebSD7Qh3*)N+W>90 z8w~Ba7*%e?zzIMX^EL((-^X-=4D{p{+OvJ|ZK4#JU#^BW)gJn!Eif=vh6+w2^Q*U! z9Up?q>KYIcvcGth&zp1GTM1*42eQ1@LKX2D3WIETPeYvZa_F;NKy^O25$%Bo`4W^C z*0l;_pPrPOhNlG3trwOUg#HWpgKuQzjYXR{NI3Z4;}-gf@1k$iPC#mfBb-N4d#@qMyKssA+y9Oce*lQv2j*3* zmOCt~2H2aLg7i8DE1)g zN+Ygg3ivaY&#!^~F0nR+yocS_kN;|vF+q$8(q*_16{RagZ2`#8{*;r4=z2iLpqGMVhXUBE}*y z7Af9&MMd1+7qc1nM9slu;I(RHZxUml82iN7C)Oci{1fA!82`lhClZ>7Ie_B!|1>AY z0g%|>xF%@5-jLJ67dGaKo+>e-xiMg2P zn!T zYXGqZkWhMtSOds(FO4c?``Q1cXt8Gb{8q~ymz1{3?T9*4hz8We+CxDbVI5?Rt*k%9 z`op!QB-S62J1x~ntguG(oyQDgOFTo#b~v-X5$hX;ZpWtQH6FSH8(8Ovb&e$4;3{Km zF2tkwF5;AbF%Dg{#qn6K%Xqelbt+;b!Vbs6|B53EvHYB8rhfgDXGE^~e>}s#Lg>5o HlxO}4LlDl{ diff --git a/node_modules/everyauth/media/dwolla.ico b/node_modules/everyauth/media/dwolla.ico deleted file mode 100644 index dbda31c4638858a87a9189e230e340293d0a3a64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 556 zcmZ?wbhEHb6krfwcoxg>zlq_0GsFKzhW{-L|G$6y`}gnvUg1A~|9=1R^ZU*w; z&ous2&-%8Q;otV07Z-Q^?d1F4%JTogp%<5TKVOpezfb&pHqYi*k$;n9{=T{Q@7MQ# z|Ni~&VEF&%*Z*an|6g6dUdZ!*U(J_02d|_v{hy}#d|BM7Wagho`o6us|McF~qiOtS z@}-_#J@USk;s5T^|DC-58yNo2H2Ob9_4UEY|G$6u|K-*HpI_cQx$}LY+r}u-XUkK+ zeEs&Xo&En5#b5UheSGoY|8(sOIlMo-@*BRrosQSbN+Yod|TlBzlZ<-n>+s=9(lU616%Ziz9KZ|!Vh39_*7YBf=`4TzAQ&@3yb z&n##>qgg1}Gm0^UeL*;5RCF|h(gG<7=Cx5a8Vl?UwlWGhEl_8O4mA?>WnIAM63A^B zF9LCR*ecKn4CHpepP?!i5hs+tHLZMdVtH|p+?0vBRY>%w#X)G4@2DFx5m)Rl)_rLHBdj+wZsl zkLU5<|Ae-)gB&<|nEIAR#uvV1;gK=tF( z=yDAtY>y`^D+`y)h1=~8YW%)~!3^qos2NJ+BD}YUC|n#wGio99z05$x%n9DsZY6%( zb_@msHk*yo(o(!$FU?KOL7jRos;7d20_v21QMfQb^l3%kZwNSU`H9d(vgyrOc4!lk zBni9SPFY!5P*YR0l)a>=n0%)L?-xVJ^T&xE&Sq^-YQTB71Kq{4Ad*`1(d+fW9;y#D zi@K-Ewmd85yj*H#2HEpf7mT;24H3fTY)^04DJ>IY zS_WzQWHO2^l+PVUnrvZRUpgU&c0AWzD#v!uAMBy}h<+=EO;Isy-MAUO%}7>91*YzO zm_}-`OtfR4_LF?AhOq8kM0TYAxp6p`U6(7d+-bw|xpL-Y8K~be%#*-Q##+z zUd6L%q7mtOJzLJ$iRv``n>gg!vHoz{->J-k`3*oN#AKqwW!vFvP diff --git a/node_modules/everyauth/media/facebook.ico b/node_modules/everyauth/media/facebook.ico deleted file mode 100644 index ea0c6a3730e1da3856adc228753f0fffcd879805..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmZQzU<5(|0RbS%!l1#(z#zuJz@P!d0zj+)#2|4HXaHg%ZU_d+f$)q-YleAAt_-Uy z5*XH0CNgYk$z}NR?lr^z|Nnuqgh4qJ6hoAn7rMB(xTUy=!{`E_I9mb(I~JNXEHwZm j&X$&zfK8r(6)MgY29XCE#SXIvW-rK@4M0DWgF$)$&Z{v} diff --git a/node_modules/everyauth/media/foursquare.ico b/node_modules/everyauth/media/foursquare.ico deleted file mode 100644 index c7e0739cd3526cb27d044f81296bb871b317606f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7^?N5_e7>A!F`vd$mDO4zmiXyNIb5=8r$P5~@Zp_6HHAdNVx&@>7mKcL$7(a+o zwF+&eg%J_(B?MCw1f7<)&{mvv0&xpzK=oBP!??$yw+TTMf5BzMgzw3eshHP6R= zM)Hz=z2j9hpNr$3RZFYwOJQel`_KYj_IVlXy1}gjvuVtYqRpzqU$GdkB_UkjTizvl zK1(9rb6R1g?xRcjcd(COFhF2zl-G|tapa{)K5EfeLRjDR|5YLyp2o&aXI3 z#fmB}q}6arTf%lt4qMb)xxQ1)ja?DcOZ3(o2#sK1lfSX<8l^R@P9N zehFi$nHRbRhB-?olZ4T5MM}k^iFMMVkB0nX)6!A-mGnDj*nLManE9}Z~ z|CkeS9!qBUY42-)^*47yUYzi+^>f*yqqAyxc>n!N>2y`6g>^%|@rn1`Mh%XW5rH0i Me#wXT!BqeM2lIEN6951J diff --git a/node_modules/everyauth/media/github.ico b/node_modules/everyauth/media/github.ico deleted file mode 100644 index 9db08f28661458b3b699bcb1dd261cba137c72e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcma)+Pe+7N6o+q`MWbj)k;tJatxBti+Vlb1MhtC=Xxp;%1zNRj6%o<4RT&~;Xxl3K z0MROjdY-1s_4fBSo_Wtb=lt$_-}l~`lzR9y8j0^no3)fiQcBZ6icB}pB`s4M>hI$C z4~kkuq8*YwIbKa>6rWN&$Oer2y7 z@8i4=pa#Hv>8ZwfFZJjx{j+~~oy&fe{jMRef0(!f)q9rX8S3Tw8KyRD7@!j<`^(sx zvR6-*d+`MB%`xb4pYOo;?A6>pe7Aq3KhBGuRhTqUk?(BDIA diff --git a/node_modules/everyauth/media/google.ico b/node_modules/everyauth/media/google.ico deleted file mode 100644 index ee7c943abf1064e3110161deb3a6477fcc7789b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmai!ZEO@(6o&8IDMXq|w?7~;fHp>@yX|&cgxJ_d0|o(W0wkiuMEv;W=W3v( z)q+3~th6X-V-^ZT+iD9Nw5Wh0X<8r_wUvGWQrV^LZkvVebm#HR_?tMBvv>E*ec$uG zXU<)v47oiXC7+q<#T2DxDy6a{Bqf>u^0M6Wii}$XPK8<0I>KX3QJ$1_XGfg4m7sUv z9K~w*c>_2 zz(cQ__{t3m%S;O1RTKz*@mq@CNQ_zaf8Yt-AT1Ony(LC^^Qg=5;GwIGC4|9>Q&KU9 z+)Alip~;tZ;RcOgbc|a!$qBZjz8yiIvPnH*F|93*I(Ute#vW|jhDn>{JMLvcmBP1G z;TQbkjZ;L20ZBOf&luju4pJNYP%W3xUkx(9;R1g~q7Ib)q2DR2yq(-?@&2KSze-b3 zAs#j=&K?Vr91goayGAEyyf{QnXD`>rZb%NS$q8N#7BhdVfp@3W7mnO5;^70~5{_-f zck|h5FU{|*;D_p081C+rjwR)`3CF^`bfAcA!RFTp*1=2ow@Yl6*rcd0oyV8UXS28D zHg-RrL3F6k^?W%pz*BW|$=)UPKGFCjyz<@mk@Ri5fnPLur5^`Y%;3`{9)hnfqOE?D z>(>(9zjhzzt~WFf?@{E`O4NzoU7|z6>(t+3Q1HINzSZ-%&~_MG`k07~(0lxIt`By* z9%_$P@IaZ=tTV~mZIUA%awYP1$Q+1|MS{OR&?D7s;?W^m)@O0-X+>z&bS`&>-29%V zS~6doL(a!ivqok}aF0|?Bm0Fs((m8wygoP1HnErit}HWJGR`}D=O;8PzjVdiD4v!V^lc8!qMjp zh-|VsTE3LfN=5rx&3DgDC-(PW?z`yvElz6MRoR=wG;F~+_2Z%^A|CqPGl-nQ!Jc-4 vYcl!bi4@Kqt`tj2MxqJw3Qx%XF0`I-Ikc-^&W9Ryu^WtA{w@6P0|)yrC_;$3 diff --git a/node_modules/everyauth/media/gowalla.ico b/node_modules/everyauth/media/gowalla.ico deleted file mode 100644 index e99eb9e18767d4bfc4a6d530e9f6b16cec3d01a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmV;}0Vn>6P)I>Y~Wml^(ldBgw>8w?i|VDr-d7e`Rp5CZ~$7V@JT z5P&sMc;pZ^nRPI*L_K0)(#izI%ms`vfZO!>A)L(&)C6a1XMw|p*}N0PRlsS$-%}L` zTjhNiSVAr{FaZM=7hpmU+5eBWGW=(MZWCRu*yP-glaO(vIR0=K15Y%mEEDPrFA1vRULbCm|_s!=#&-e~osxeEv#dF zaUB!>4NL_#F}wN%p0#I`U*UcD8|8QSD07dVFk`yHMRYai@0?Z>CRL(m(WkR!`Mt~?t$ zgB9Ih4O5Rz+5^=FH{o90g5G?I=<3?Y$ZP;EPXOcI74-iwg^F?(#||F=|ILF)NQi_` z7>TkzEiAye}~xEDiMqPZGkG~7)~4IFmsh)^DCe&QKI%#GT#6A zI{ce|VS0H3(}BmRX=ovq3)jd}@G&N47BDnCiSC{+V9HCw)y6`wY!(#R66EJ6Lnaeo z;JXnlu0MyDuI-`c%GF;ab!Y9Qe`pk4H@orn)h;yIuEWvX21AY%IVndG&p!x>@D12( z?HKrJ7GDm!aQn^}oZsAqhC53nnI%NcHN(>6#Fd_J(b;|;wTM>L~{kYSmgsQ3)Wd=J=Q6Igv6J@oR zkwG<4QAcs$)z=Us5JAOW1V1TzH$`5yqcwM+ymTB|=Mn}#RHH=KjuOrWHT%{c#kyvs z=W4*?MIa*LFofb%D9TL`h-EKCsRex%##X4+PROjcaLt^HVyz8DRgF+po`aI2qPbjE zgP6Ev#3dewNGit(+D~+>v@cPb!%I_?_ok+rw_`FiM3tRLr1YO8r4pLkvMuq+<%2(T$JhphH39$nDedsH-jRcVN&$_`Tvjq0MR94 AVE_OC diff --git a/node_modules/everyauth/media/justintv.ico b/node_modules/everyauth/media/justintv.ico deleted file mode 100644 index 2f2c2cbebbb784c9e148b05846463b177e6edc56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 586 zcmV-Q0=4~#P)@M7=_QB`6stGy$mQ^18r8Vlx7i-Jb|rZ!Dnz$XrI7^J6}LBPav%;5f?6`_y8`7 zwAw`|LO_Io2_srPI?>GRCZHtr_PWhlhu|(-)YvmH^Pq%nUf^&RR>>TGnc{ z_5h4(wOTLF^J>4}U$xey?~y#5vyq z;MsWw>6F5I59ge>)-t73v9Pf4GRv}(l=5u|fs8Rs2=S}a>AV9_U~zHrX&lE&2%##K z%Kq%^?2SgFQBTu!Ktw7@lArZ@{T=|GW!YyUQq^kpIRF75q9jRPNhxn9N%Bc4^+szw zJUBS`vb?Uq#f*NdT49p0F2%}6S3rj+i@QF*3 z1ZhH37EO((`@O!euR#<&kMBF*bI$$TdwIhX37IDx7W0nC;*`jYh|C(9mg)5RCJl@W zR~)0lgo^o`nmmc@xtD9AH+vC%xpS@HYv(cRkuirjFC`pX^Uj!+4jpB{f3^y?L?+KU z_Cb$)W_>u1Im7^un*7yZ#_Ri)N4EgIF(Wg|v!+*U8d>`~pIT2MbyRQCCFBfG4vhuyK%%&+qMMa@2G-et_}4E!mK(fk9=rMvb3 diff --git a/node_modules/everyauth/media/mailru.ico b/node_modules/everyauth/media/mailru.ico deleted file mode 100644 index ff56262cf448df6a2d30a6c623a7cc1865f7bfbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7@T}+c#9LE1`EenZR$drNlBAGFpf)><*w7w%n zRzM0AEFx4Kr66r5HXs5<#T7OYT{7J+NMLqj?UG#@XExkO@H{)`HM`l}&YS0aJm>l4 zf6hr>A_f1Fl8E;&P{|6SRYbIoi(A}z?DK($@BO!(@SI$k`W$&p8d@-G=&mV687+K$ zMbx~WqQ$R0mRX~S3ZL%_-4$8E2v)mhrN^ct*!A@2h+YXvr@*l^f=#c2CFfa`Wj}+X zTa>8QDp0vqjjA`5a#k>cElE>Gomm7aQ@LEHBUWKZW}7QLETQv0qdqY5gU|1=UB+D2 zx|vw5Ud2RKFoHd-Rm7SMO0;GY+gF&0#54CmLEx48E6BFiBCDbvtDC>Ywu%Pi9s#C^Jz0K?Atz~N8B9gk|C@ai>`O_k#)`YOZ5x}0^?_yp3CD3^wq2~`A z+L_Kea|nX9Zc)X(+X)+L0*uZAl?5r-{RW*>E3 zMQ!zdtiB4EPYuIcz73s+a^VRPt z`eq3}Zxj4obvPazfh#zSK!?QF4fuHKA$CvxiLl$kBJN!ftnV{Z?1o>$^{z5D+TQ|c z=05iS0344jpl4(pJr~B%bZrjhcL3Y1MT`uz^Q?v4=#?PYKIh)K*|84Hgj~zteObq5 z&bP8qjv;nU8!aevGFXm9iUsNX$5#>a7AV!SVS!tT8e!uQ-RK5S>q6s}E%)X7&;MTTe{Sx1fQ*kyh2UzI1M%#vB=AX3 zWRO^c%^&@zx2PsyC5sDdNQ=A$y)=MtUw^?!%}JVqO??}7k`j6YI%19Ok?i)l^;T()q zn`RmvzGtvgQ{;Zm`k^O_^Pgaf;JL(C^N2qEFc51j?@CIu?jbE|6lP)!AA*T=_@3kb zomG0x-~lzAs+0H9uNOVt%k*4>HD&_u-+iao0DYJlxqj^pTI%NM!<;m;n7jKC8yg#_ zFM9|9%<2|+|N5HhnV#Yv*y`~-oO8G ztJ_Lo6A9RzdFhD}iFr<^Gf$c5Ol&xC*;!HHtl)c~IiU`&j6mJ3R%fV-tE-EOimERZ zb5$1?g(jrt7b+5(jvq_P$xY3_WNU2{jYnE*g{VCpT_wcP0-P(>^Pnz7oQm0g z@tn7=C8V;_TUX{i8@A2mIvgiNyvvm-M5e3Rm69B37DAZPSQ>XFM`>iTz`J=5iyS94 zStW*SA*|;O^+H$@ z+~A)^IsT&Vho2zvR`@Hd=Koka$FaVR0CX=qL2JE)=u5UHP7YkeGcawv0Hw|aJu7aQ zvR=X9)+uP#{UEIRK+wBkHyD>wB;V+dff6|s*K6_v)vaEXM_DI_>n_FXX&Uh4c_@b( zbI3Irvz&sk=HvC^sMRQ*l{l8`1YhJ67ER|lt}=RI)*h02?=yO&o}1xQ4+AEj#256g z3jX+BP^!NZN^oCZpY-WLjYS(a`%&Yc{+9yxoMXRDLF6UJeXT7l`NUTn+#($|PVQ0H z@)@XqM=Z@_pR?~^zI=pOCJ(QLBIq!Vv{0i~6P7cHPtFkb@Z0Rf8Svh5&W>oZf}hM5 zU}Q4@D%7&k97#92SMx`a3a{ zkLQC#D|iwju)ijVw&5$mR3XaE2u_T3=1*OJQc6m_mh|zvP4-EX_D&_)my&k&ZSq`) zJ|9Y2eItpUNOCT0a<3#ckDElV5O;yqQDH5{@X)IPVVb<&~(>}OBq_eQS+y$<}-4lu^1 z^im=@GK(jFq%}j!&Iq0l%|cOUY*p|T-_A`G3V4_od?<)6l+@g|b$udcFBi4tNY5!n zOKX_RDql~PiY%8hv@{zOd@h$x>4?qgnlaEn%7>Q>O)sjHTzWABd(1#$I1nGKAKLBp zLwj~|A*Qor-*l84%tPb;eAi|w&Iw&w9<*Qqg>YJX=cg1MM^%#@E?+xtL=Q4P&nC$camNWKT zy$oD5xg;A znr5x|WLa2yRM>wG_h>a-ctiuB<93R9@}YZ&FVg%oa!Dk_A^XYA(vFjhhIch<|@_dB*ge>vZI|6@8ED)x1JA90-(raHf`jsP}y)6q?Y|Lgeye5xp> diff --git a/node_modules/everyauth/media/osm.ico b/node_modules/everyauth/media/osm.ico deleted file mode 100644 index 4448dd6f612e8500092c3ee50ae0a1cba84d36cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcma)6draF^82uGALt_>+WX>#0Ox%o_O*UXK9fHI$l#B(#besAI^^rwHhXI)mhB`Jk z!eSG$M{GLQwQD<|Wu?$k7|*tpKA`jkr9ApvA3Vz_4#OrKZ<+k9_vYL$_uTJ%Ip0n0 zr6?Mi@$nQ{U!}f&hN8An6!iuHp$PMoCxN2KnPkUPZ0yMbfRad>VsejUC*-_;C|=gu zLW^?$7hbQIN=~A0Pt8AmBQbgJCHkJ-`$|ho;(B{~X~AHS5{t#OqN1Yba&vQEEG{mN z6c%4X={p1Cfo2?@FnAAq5D2gSDnFu{i!(cRw~ZitOi@FgxIZGlLYnX zbE+XCvC3SBi?&<%;%1qaczHJJfyH9QaP(r&y?_QKH5JH6OGjGT+bI6M3PMXCl;eG9 za+)A@Tfnr5HfofsuSRz5dTsma>MG@MIH)q_`MS=40n*SQN|-<6@Oy`lnVA8$kPVSt z500fBwMsG0%h{;xuEif_G13pe^GQYdkFf%QfR_FFN9VXcHH4ErXf$h3cI6@%6&H|S zcnU?;KY^{_LZWF!v!Ml?9wGR>4Jar*^-FT%n_Khp^0qK8{cx8b7y!qvL!(Cnl}8I@ zzXbV5b0Fkjg^~C&Ob=mXeiVVQA6@-29L>);mYTA6TUJ(998)85ZRkgJXb9*a^{b)i zs|TM|4ZFJ^2BIG%dQ&J`V+4UEKWb`zmF`cXCvY1CI~%7BXqq+Rj(rf^2TI&=cYxD= z8#4|SCPQY}X3g+VsxV{kfzhXdn&cQ9sguh;#0d3iZ4hwF z&Y2+a^@643!Qr*SH9rMscnTvS3x?f#v}?r}^^ASH`3B?*wvqZ719+2q$QG=S%^M-~ zb%O0|0n5+?gKC5;nb;P#*#?%J{0EN~KUi6NymRJp zd;t%q8(3 D0iwzd diff --git a/node_modules/everyauth/media/readability.ico b/node_modules/everyauth/media/readability.ico deleted file mode 100644 index 59216b7642f0b6c83a40623c88f0ef7ac0c2a3b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb`GQAm?f6vvN!8=6@g&4mS4D}pH%?ja*+q2hxQd@vK#AorvzKcbo?x=m9UThiE2 z(n`<}%^Iyp5lo@B8Uz^_`65D65*bC1FSD@*xBs0@oSQGv{rK&k@7(`6_kMTh5T)T! zDha>)>AZ|+7ZGUzT=1;=F~x>z8xiM!55|}bYz66HORD_v%l~R{%ESTx&dSPelimL6 z6xSrK62T`MAAgruUf$gVI|ro2HLwM6RHbTMs;GD}3|kM5ZQ!`aGi@bmW>ZriMXasu z0bAMD_PCYE!u0y#0MS)OfTF~!9r&xtM~_7Z3T z*Fih5GOgA*D+pJjSy|4Xp-|*B;?#Y8{xb@N^+$X^lWAh8tLycO!QhMNbUo4hd{?xz z^iITX_pj8}j(U|!*LNZtlgm594Goj+MMaLML=y5lnIPPV=H+$07le*zNy*4>Ntz5> zEP-F5=!;}z+zfFvn%nb4jWK<0ZqEm!@vejD9NsT5jizH>t#0`eKTE2)tjzn2=o<7A zD=c)qz&GrztLwMb)b#e7Oanti^|9QkV!03Z>z5>7Z*_H#dtu?*5ybPl*$#F)9AoCy zvovp-!(e#$0NMk9-@AN64IC;cu)ZZSB0f1sc6R62nVCgiU+M9<^)vjLb8|~4bUNFc z)pOJ#5C0!8vz(l!#lgYgS!j4$Z91^dd*GnkJyBm(b?credc0=y{Z{x6gB>7cZ>&!U z4X@`+paN>Z?&&&ScOH?U3ibJ$^tqExZ0?{XQ_c93Y-~D_t?KG= zZow_Odfln5yX!UQUU1HxJsa-ddcwKe>Z=JnfAulvR-bb2S&fm3YY6oJA7W;i(4Dt$ z`K$?rfGp3`zx=g?5soFpdHI$va_-{PHeWOQ?K7_C!oB<~3j_P(SFO#-{+BW-6A>cRS2;9roU~_ZR&YwST%5PuroN->@`}1dZ{o?-!+{;#Hdwbi? zojbS3Z<>D^7uSsUx#P2V$?VoUA&#SQKUiB^t9)O$a3R=3H%N~LEUG7^^ZeZ{2|4WxH(KQfyK4)?d+>d7QnU0Z-MuN7tiQQ7D`;;HTB9?O8$os|r?GNc235Uv` zSfo>}KlrB}$dO0msOqoeWzYI!?+Y^X-dFmbY5ft?-Me@3P?T|N@k^+?xc{&RvM+@B znYssRTzk^`BX8CuwMM;{e&M$(z*n3%Vi;BXFLOaGVJ$GeL#+FWo)>9t;S>I=eJ0Fl zu5ke0S=pN1>pzNgPhxKjT=b+R5@$Fp0yshZ>4sQb1myNp(PMY3TklZ^NsZ$xL5b&b#{*_8L8f8WiS`xuY>hdBs!KR50Z|J0`W zca7d#v45Veyz@>&CcaNjI~MuPg}HMd^OA4opdIgz)0*vEF?%3v$z)&1Y-?%3`Ys@I zi+WiJ{Y6`IOa7W?*@C;0IkzI5$r^4+?V_-dxfSWI*d1X@usbphwtxjZQ2Q`||0(oW zhT|oFn*USCTTS4deqwvILiQq?%fe7N_IohejIC^T{QLcA-!%>CdqjJ&Re#`vGfD5s zcvhUsjr8h5FFlKu=OuMlXC{1(s&B&ZT{M*&>0o=rx3=PZ1oV5m?ECD$@jV#6d#0WN zq}z+OImd7v-|_MLmU}OpZ8+QFBXHl2-0jz*7voOOkeRx>oZ)zepGw%ncfT2@?qwu z05_arqfIG!+sWAy&UWjE`3>*-&Or{Olc(os?80~ae)2ZMnF`KY{yx?}YapD@5Bg3S z#yTPX@=VCPC>IK$D}>n7@1peEkpD>nUyboxctFgc6u%yIo#6|gGOZ=0-Ja}O~0}ltzXSAEP($9&PnxqyZ zDqfgFIN`rB?I)@3tk=?O2+Ud1uL*7SYvp#L$|Y!)iiZnB^R1 zqaU?jPQmXt&8};$Xq?Pe;`RRhTT~n%zv#dA_a8TVPiy(ldzB4zNB8erx7)Q=t7VNw z!`kh(<#`^AJ-l!Bh4w%6z{k&pe*Bg3E-x=n+@Cs~jv0Q@i@tAtup6ZG^LO9$y4WBN zgtlI<`+nbdQ|FXxDkbcsBK>0Hnq^sLMNw2wQvJbTV7C2J(EaqqYK*@qUjCw_PocCxe z;h!$%s>(ms4f<)#L|xjbzq6C}hU+-z`^Aoq^cA!7b|$SKYL2-Ym$LTJjZ(!DW1{_9 Z?`6%=q-RmDzj&jWE!=22cQ~Mf?tf@u?@a&z diff --git a/node_modules/everyauth/media/soundcloud.ico b/node_modules/everyauth/media/soundcloud.ico deleted file mode 100644 index 4130bea1b97673078f1fc9b79fd7c829678b3a19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7^O=uHA9K}ac5h{dIp;A9EN&+cHiWIz9pn$P(9u%|L-I>|vo7s)2(Mxvu?c4d!dow$;%L=iKXIq=# zH6aeQ2+<*gNE4P=3F{Qm$G%l7LrmKqS?m#6d?jcSlQG$HtRHCU4Vog>ADH>dA{$`E zPSU3%6m=<*?HaW@z08=bp>?+=ib&#z?DEiRaj8pT-TD;7n6|_R6yp1QbPjpgd)C9I z{Z$MWTqH*vY(M5;$9N^=xPxtntMs~v4@hRiG1`YDu0K?`@mOK*ou>Mjd&~AC4?ija z8jlAhh4w)&$}4n?NX)#_n0g}d;=Q7JREepX|L4tkYY(^(qvjbj)=+bIByK*HnE$A# z9@Vs&cmAFK!xxRtgZ2FSqY~?mcsO&{$HJn*?O7l5pCoS0didFp&);*=d)~2ryMFHf z#?u;!Qxb`j9=7DF7@zjA@L6H{IrG)}{3Wg_apD(!uJzmfXFfGS@*2r=lK4pGT=W#H z$V^o5jO%$_*0}#tvgX)6<4NVY_xAk*T^EB0jjp0Xx+sw@_()%HBdVbmJlkhHCR592 zE(4ay02zzM=1Ypm1{C{s7Z+ oIK)0n6KXQULNNCiZ?q7ji~Ki?k<}z-{}c7ga^7wr?C&Z426T_eApigX diff --git a/node_modules/everyauth/media/tripit.png b/node_modules/everyauth/media/tripit.png deleted file mode 100644 index a43465352c836184cc670be7d39ccf51d4e243a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmVPx#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUza!Eu%R5(v#{0{^SlmL(c*uaNxzy5dZxcvX{?U%TefW;Yb$!0A( z@n5iT1sFek`vs>VI1TWbvKMXuK3BjE*mCK~|4UEa!)>Zue-3PbLe<*;An(8c$Y7Ay zU;u7_eC68z(Q^-@IMuFa2a2H}mw*ff8G>N|$ORocuKWkt3_&;0mx>M0if_gNe3VaP#CN` zaryt(HL3qUPmucm>qPed<2Ubsor@gJFgDx(kO0V3bk~5a289oL^kKvTND(N}AV(vz qyFt+haveIrnUwM7AS6kO4FCX}VpX{alvnKl0000w diff --git a/node_modules/everyauth/media/tumblr.jpg b/node_modules/everyauth/media/tumblr.jpg deleted file mode 100644 index 3f02fd6747b4b044b1ca1cdc9902c6f73cb7537e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 509 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivO=p>qZR90YemX^xOzYk;Pu0Cp* zk!P08sX5#Kh@MWw($^K`la%+Ia_T!e(d5s`BAzJ>Qn_>AiYF+|-?Zva(X|-Gm(40$ M19q6czxn?r0Q%{IIRF3v diff --git a/node_modules/everyauth/media/twitter.ico b/node_modules/everyauth/media/twitter.ico deleted file mode 100644 index 00450d4fe367de0e7b12d251ee9965b32d2d0f5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJy!Tl&9eZ;-18zSz3=zE8nj=#FSV+Bw?9f&2+%>jx1 z{Pv;Z?52X_+dAa_@9CBQe`K=a|5MYI{-2o%!KY^^{lB=v>-oo*S0m%m>Hi>ej!jjB>xY?hYPR0@4==8CBfH_y+S9K-R(Sx4RSNg z4WMw{)~o&X>Fp!-SC21G0O<$XE&uZV(S=*OwZ5*bm-)Y>UgO=#ZC#BZxy}6+PY+B` z0Q&`G&h8%h{|A;N?S$D2q95Nn;xngI>i^DpiR)ly!sKt9T%NG5S@!?FJ_Rsd+a&w{ z$*m*yFnJISiofq)-t!}iA+z@{FPOiqM&|#zHm%POu57D8mLrx8au>)?C$>WTMXWyB zt78D>e+GsJ_6!UM_!$@)*cliqfcOV91H%VkVexEyr|!_dZKfAmrG4QSNm%2DLW#oUcx~aMSw)Xbh7Q63S@408Y_nzzIRY`sGQkL#?*mvJ^?`_Y654;XN z@HzA_{Mh5De0tdPd{ya_G#bCF9&ZwK6vNJg}aXqy!vwS^`{3fUcY(s=KYti zAAbJ%|NlS3C>RX^YJ`B|PZppt{~2^ZhJo?~1IH4E;uQ-nELh;!%xAFY#KT7moZAgK z?B<+cY&ys($m3?f_{h0st9eBx zY)uf&Il;!`QnIz-z(N*Yc2)_7fa{6u5`4mQY+pFI^-0KTXvCel(cCM;$jD#~026(? AlmGw# diff --git a/node_modules/everyauth/media/vkontakte.ico b/node_modules/everyauth/media/vkontakte.ico deleted file mode 100644 index 1dc9e63a0dbf49dffeb79b965d709985d902c3bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 894 zcmZQzU<5(|0R|u`!H~hsz#zuJz@P!dKp_SNAO?x!0;`*1W~5sai6DxBB#{VWEKu?0 z{#=3xVmMF>vikW&o^Z6N%y(5I!YHij|097aQK%c<1!)pWnX# zbst>ZPEbA289;P)>wKX4D+ksRRDXWQ;G?0$FM7C8NF(y zflE+OPoIFtoUMeH0YqOmK1W{Us>OZs6jwuWykMn^lYFFT1yD%vMXz z|4BBsVm9Y;adB~8z--L0(#55V0Z8KjASb}^0ZRsk21%eoejw(AVh$h;#SIb+3OuMdrBp (https://github.com/bnoguchi/)", - "keywords": [ - "auth", - "oauth", - "password", - "facebook", - "openid", - "twitter", - "dropbox", - "authorization", - "authentication", - "connect", - "express" - ], - "main": "./index.js", - "directories": { - "lib": "lib" - }, - "dependencies": { - "oauth": "https://github.com/ciaranj/node-oauth/tarball/master", - "request": "2.9.x", - "connect": "2.3.x", - "openid": ">=0.2.0", - "xml2js": ">=0.1.7", - "node-swt": ">=0.1.1", - "node-wsfederation": ">=0.1.1", - "debug": "0.5.0", - "express": "3.x" - }, - "devDependencies": { - "jade": ">=0.12.1", - "tobi": ">=0.2.2", - "expect.js": ">=0.1.2", - "mocha": ">=0.13.0", - "satisfy": ">=0.1.0" - }, - "engines": { - "node": ">=0.4" - }, - "optionalDependencies": {} -} diff --git a/node_modules/everyauth/test/creds.dummy.js b/node_modules/everyauth/test/creds.dummy.js deleted file mode 100644 index 5f1fb78..0000000 --- a/node_modules/everyauth/test/creds.dummy.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - facebook: { - login: '' - , password: '' - } - , twitter: { - login: '' - , password: '' - } - , soundcloud: { - login: '' - , password: '' - } - , mailchimp: { - login: '' - , password: '' - } -}; diff --git a/node_modules/everyauth/test/facebook.tobi.js b/node_modules/everyauth/test/facebook.tobi.js deleted file mode 100644 index 47efe9a..0000000 --- a/node_modules/everyauth/test/facebook.tobi.js +++ /dev/null @@ -1,57 +0,0 @@ -var tobi = require('tobi') - , expect = require('expect.js') - , creds = require('./creds.js'); - -require('./util/expect.js'); - -describe('facebook', function () { - var app, browser; - - beforeEach( function () { - delete require.cache[require.resolve('./app')] - app = require('./app') - var everyauth = require('../index'); - everyauth.debug = false; - tobi.Browser.browsers = {}; - browser = tobi.createBrowser(3000, 'local.host'); - browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; - }); - - afterEach( function () { - app.close(); - }); - - describe('a successful login', function () { - it ('should succeed', function (done) { - this.timeout(10000); - browser.get('/auth/facebook', function (res, $) { - var form = $('#login_form'); - form - .fill({ - email: creds.facebook.login - , pass: creds.facebook.password - - // Need to do this; otherwise, parameters are corrupted, and Facebook responds with an error - // Ideally, $.fn.serializeArray() would do this, but alas... - , next: form.find('input[name="next"]').attr('value').replace(/&/g, '&') }) - .submit(function (res, $) { - var form = $('#uiserver_form'); - if (form.length) { - // If we are at the "Request for Permission" page on Facebook - return form.submit( function (res, $) { - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).not.to.have.text('Not Authenticated'); - done(); - }); - - } - - // Else we are back at local.host - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); - }); -}); diff --git a/node_modules/everyauth/test/mailchimp.tobi.js b/node_modules/everyauth/test/mailchimp.tobi.js deleted file mode 100644 index 7908e53..0000000 --- a/node_modules/everyauth/test/mailchimp.tobi.js +++ /dev/null @@ -1,38 +0,0 @@ -var tobi = require('tobi') - , expect = require('expect.js') - , creds = require('./creds.js'); - -require('./util/expect.js'); - -describe('Mailchimp', function () { - var app, browser; - - beforeEach( function () { - delete require.cache[require.resolve('./app')] - app = require('./app') - tobi.Browser.browsers = {}; - var everyauth = require('../index'); - everyauth.debug = false; - browser = tobi.createBrowser(3000, '127.0.0.1'); //mailchimp requires 127.0.0.1 instead of localhost in dev/test. - browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; - }); - - afterEach( function () { - app.close(); - }); - - it('should successfully login with the right username, password', function (done) { - this.timeout(10000); - browser.get('/auth/mailchimp', function (res, $) { - $('#login-form') - .fill({ - username: creds.mailchimp.login - , password: creds.mailchimp.password }) - .submit(function (res, $) { - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); -}); \ No newline at end of file diff --git a/node_modules/everyauth/test/password.satisfy.js b/node_modules/everyauth/test/password.satisfy.js deleted file mode 100644 index 65f2718..0000000 --- a/node_modules/everyauth/test/password.satisfy.js +++ /dev/null @@ -1,121 +0,0 @@ -var satisfy = require('./util/satisfy'); - -// TODO Add case of person trying to take an existing login - -describe('password', function () { - var app; - - before( function () { - app = require('./app'); - }); - - after( function () { - app.close(); - }); - - describe('registration', function () { - var regUrl = 'http://localhost:3000/register'; - - it('should succeed if provided with a username and password', function (done) { - satisfy(regUrl) - .fill({ email: 'newuser@example.com', password: 'pass'}) - .submit() - - .expect('h2').to.have.text('Authenticated') - .expect('h2').to.not.have.text('Not Authenticated') - - .run(done); - }); - - describe('failing', function () { - it('should fail with no email, no password', function (done) { - satisfy(regUrl) - .fill({email: '', password: ''}) - .submit() - - .expect('#errors li:first').to.have.text('Missing email') - .expect('#errors li:eq(1)').to.have.text('Missing password') - - .run(done); - }); - - it('should fail with an invalid email, non-empty password', function (done) { - satisfy(regUrl) - .fill({ email: 'newuser', password: 'pass' }) - .submit() - - .expect('#errors').to.have.text('Please correct your email.') - .run(done); - }); - - it('should fail with an invalid email, no password', function (done) { - satisfy(regUrl) - .fill({email: 'newuser', password: ''}) - .submit() - - .expect('#errors li:first').to.have.text('Please correct your email.') - .expect('#errors li:eq(1)').to.have.text('Missing password') - - .run(done); - }); - - it('should fail with a valid email, no password', function (done) { - satisfy(regUrl) - .fill({email: 'abc@example.com', password: ''}) - .submit() - - .expect('#errors').to.have.text('Missing password') - - .run(done); - }); - }); - }); - - describe('login', function () { - var loginUrl = 'http://localhost:3000/login'; - - it('should succeed with the right email + password', function (done) { - satisfy(loginUrl) - .fill({ email: 'brian@example.com', password: 'password' }) - .submit() - - .expect('h2').to.have.text('Authenticated') - .expect('h2').to.not.have.text('Not Authenticated') - - .run(done); - }); - - describe('failing', function () { - it('should fail with the wrong password', function (done) { - satisfy(loginUrl) - .fill({ email: 'brian@example.com', password: 'wrongpassword' }) - .submit() - - .expect('#errors').to.have.text('Login failed') - - .run(done); - }); - - it('should fail with an empty password', function (done) { - satisfy(loginUrl) - .fill({ email: 'brian@example.com', password: '' }) - .submit() - - .expect('#errors').to.have.text('Missing password') - - .run(done); - }); - - it('should fail with no email, no password', function (done) { - satisfy(loginUrl) - .fill({ email: '', password: '' }) - .submit() - - .expect('#errors li:first').to.have.text('Missing login') - .expect('#errors li:eq(1)').to.have.text('Missing password') - - .run(done); - }); - }); - }); -}); diff --git a/node_modules/everyauth/test/password.tobi.js b/node_modules/everyauth/test/password.tobi.js deleted file mode 100644 index 13693c4..0000000 --- a/node_modules/everyauth/test/password.tobi.js +++ /dev/null @@ -1,143 +0,0 @@ -var tobi = require('tobi') - , expect = require('expect.js') - -require('./util/expect.js'); - -describe('password', function () { - var app, browser; - - beforeEach( function () { - delete require.cache[require.resolve('./app')] - app = require('./app'); - tobi.Browser.browsers = {}; - var everyauth = require('../index'); - everyauth.debug = false; - browser = tobi.createBrowser(3000, 'local.host'); - browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; - }); - - afterEach( function () { - app.close(); - }); - - describe('registration', function () { - it('should succeed if provided with a username and password', function (done) { - browser.get('/register', function (res, $) { - $('form') - .fill({ email: 'newuser@example.com', password: 'pass' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); - - describe('failing', function () { - it('should fail if no email, no password', function (done) { - browser.get('/register', function (res, $) { - $('form') - .fill({ email: '', password: '' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('#errors li:first')).to.have.text('Missing email'); - expect($('#errors li:eq(1)')).to.have.text('Missing password'); - done(); - }); - }); - - // TODO Add case of person trying to take an existing login - }); - - it('should fail with an invalid email, non-empty password', function (done) { - browser.get('/register', function (res, $) { - $('form') - .fill({ email: 'newuser', password: 'pass' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('#errors')).to.have.text('Please correct your email.'); - done(); - }); - }); - }); - - it('should fail with an invalid email, no password', function (done) { - browser.get('/register', function (res, $) { - $('form') - .fill({ email: 'newuser', password: '' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('#errors li:first')).to.have.text('Please correct your email.'); - expect($('#errors li:eq(1)')).to.have.text('Missing password'); - done(); - }); - }); - }); - - it('should fail with a valid email, no password', function (done) { - browser.get('/register', function (res, $) { - $('form') - .fill({ email: 'abc@example.com', password: '' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('#errors')).to.have.text('Missing password'); - done(); - }); - }); - }); - }); - }); - - describe('login', function () { - it('should succeed with the right email + password', function (done) { - browser.get('/login', function (res, $) { - $('form') - .fill({ email: 'brian@example.com', password: 'password' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); - - describe('failing', function () { - it('should fail with the wrong password', function (done) { - browser.get('/login', function (res, $) { - $('form') - .fill({ email: 'brian@example.com', password: 'wrongpassword' }) - .submit( function (res, $) { - expect(res).to.have.status(200); - expect($('#errors')).to.have.text('Login failed'); - done(); - }); - }); - }); - - it('should fail with an empty password', function (done) { - browser.get('/login', function (res, $) { - $('form') - .fill({ email: 'brian@example.com', password: '' }) - .submit( function (res, $) { - expect($('#errors')).to.have.text('Missing password'); - done(); - }); - }); - }); - - it('should fail with no email, no password', function (done) { - browser.get('/login', function (res, $) { - $('form') - .fill({ email: '', password: '' }) - .submit( function (res, $) { - expect($('#errors li:first')).to.have.text('Missing login'); - expect($('#errors li:eq(1)')).to.have.text('Missing password'); - done(); - }); - }); - }); - }); - }); -}); diff --git a/node_modules/everyauth/test/promise.test.js b/node_modules/everyauth/test/promise.test.js deleted file mode 100644 index ec98bae..0000000 --- a/node_modules/everyauth/test/promise.test.js +++ /dev/null @@ -1,48 +0,0 @@ -var expect = require('expect.js') - , Promise = require('../lib/promise'); - -describe('Promise', function () { - describe('#fulfill', function () { - it('should be idempotent', function (done) { - var p = new Promise() - , test = null; - p.callback( function (val) { - test = val; - }); - p.fulfill(1); - p.fulfill(2); - setTimeout( function () { - expect(test).to.equal(1); - done(); - }, 1000); - }); - - it('should not have an effect if #fail was already called', function (done) { - var p = new Promise(); - p.fail(new Error()); - var fulfillHasImpact = false; - p.callback( function () { - fulfillHasImpact = true; - }); - setTimeout( function () { - p.fulfill(1); - expect(fulfillHasImpact).to.not.be.ok(); - done(); - }, 1000); - }); - - it('should not have an effect if the promise already timed out', function (done) { - var p = new Promise; - p.timeout(1); - var fulfillHasImpact = false; - p.callback( function () { - fulfillHasImpact = true; - }); - setTimeout( function () { - p.fulfill(1); - expect(fulfillHasImpact).to.not.be.ok(); - done(); - }, 200); - }); - }); -}); diff --git a/node_modules/everyauth/test/soundcloud.tobi.js b/node_modules/everyauth/test/soundcloud.tobi.js deleted file mode 100644 index cb52624..0000000 --- a/node_modules/everyauth/test/soundcloud.tobi.js +++ /dev/null @@ -1,38 +0,0 @@ -var tobi = require('tobi') - , expect = require('expect.js') - , creds = require('./creds.js'); - -require('./util/expect.js'); - -describe('SoundCloud', function () { - var app, browser; - - beforeEach( function () { - delete require.cache[require.resolve('./app')] - app = require('./app') - tobi.Browser.browsers = {}; - var everyauth = require('../index'); - everyauth.debug = false; - browser = tobi.createBrowser(3000, 'local.host'); - browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; - }); - - afterEach( function () { - app.close(); - }); - - it('should successfully login with the right username, password', function (done) { - this.timeout(10000); - browser.get('/auth/soundcloud', function (res, $) { - $('#oauth2-login-form') - .fill({ - username: creds.soundcloud.login - , password: creds.soundcloud.password }) - .submit(function (res, $) { - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); -}); diff --git a/node_modules/everyauth/test/twitter.tobi.js b/node_modules/everyauth/test/twitter.tobi.js deleted file mode 100644 index 1f2ceed..0000000 --- a/node_modules/everyauth/test/twitter.tobi.js +++ /dev/null @@ -1,42 +0,0 @@ -var tobi = require('tobi') - , expect = require('expect.js') - , creds = require('./creds.js'); - -require('./util/expect.js'); - -describe('Twitter', function () { - var app, browser; - - beforeEach( function () { - delete require.cache[require.resolve('./app')] - app = require('./app') - tobi.Browser.browsers = {}; - var everyauth = require('../index'); - everyauth.debug = false; - browser = tobi.createBrowser(3000, 'local.host'); - browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'; - }); - - afterEach( function () { - app.close(); - }); - - it('should successfully login with the right username, password', function (done) { - this.timeout(10000); - browser.get('/auth/twitter', function (res, $) { - $('#oauth_form') - .fill({ - 'session[username_or_email]': creds.twitter.login - , 'session[password]': creds.twitter.password }) - .submit(function (res, $) { - expect($('.happy.notice h2')).to.have.text('Redirecting you back to the application. This may take a few moments.'); - $('.happy.notice a').click( function (res, $) { - expect(res).to.have.status(200); - expect($('h2')).to.have.text('Authenticated'); - expect($('h2')).to.not.have.text('Not Authenticated'); - done(); - }); - }); - }); - }); -}); diff --git a/node_modules/everyauth/test/util/expect.js b/node_modules/everyauth/test/util/expect.js deleted file mode 100644 index e9ca46f..0000000 --- a/node_modules/everyauth/test/util/expect.js +++ /dev/null @@ -1,412 +0,0 @@ -var expect = require('expect.js'); - -/** - * Adapted from Tobi to work with expect.js - * - * Tobi - assertions - should - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ -var Assertion = expect.Assertion - , statusCodes = require('http').STATUS_CODES - , j = function(elem){ return '[jQuery ' + i(elem.selector.replace(/^ *\* */, '')) + ']'; } - , i = require('sys').inspect; - -/** - * Number strings. - */ - -var nums = [ - 'none' - , 'one' - , 'two' - , 'three' - , 'four' - , 'five' -]; - -/** - * Return string representation for `n`. - * - * @param {Number} n - * @return {String} - * @api private - */ - -function n(n) { return nums[n] || n; } - -/** - * Assert text as `str` or a `RegExp`. - * - * @param {String|RegExp} str - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.text = function(str){ - var elem = this.obj - , text = elem.text() - , include = this.includes; - - if (str instanceof RegExp) { - this.assert( - str.test(text) - , 'expected ' + j(elem)+ ' to have text matching ' + i(str) - , 'expected ' + j(elem) + ' text ' + i(text) + ' to not match ' + i(str)); - } else if (include) { - this.assert( - ~text.indexOf(str) - , 'expected ' + j(elem) + ' to include text ' + i(str) + ' within ' + i(text) - , 'expected ' + j(elem) + ' to not include text ' + i(str) + ' within ' + i(text)); - } else { - this.assert( - str == text - , 'expected ' + j(elem) + ' to have text ' + i(str) + ', but has ' + i(text) - , 'expected ' + j(elem) + ' to not have text ' + i(str)); - } - - return this; -}; - -/** - * Assert that many child elements are present via `selector`. - * When negated, <= 1 is a valid length. - * - * @param {String} selector - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.many = function(selector){ - var elem = this.obj - , elems = elem.find(selector) - , len = elems.length; - - this.assert( - this.negate ? len > 1 : len - , 'expected ' + j(elem) + ' to have many ' + i(selector) + ' tags, but has ' + n(len) - , 'expected ' + j(elem) + ' to not have many ' + i(selector) + ' tags, but has ' + n(len)); - - return this; -}; - -/** - * Assert that one child element is present via `selector` - * with optional `text` assertion.. - * - * @param {String} selector - * @param {String} text - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.one = function(selector, text){ - var elem = this.obj - , elems = elem.find(selector) - , len = elems.length; - - this.assert( - 1 == len - , 'expected ' + j(elem) + ' to have one ' + i(selector) + ' tag, but has ' + n(len) - , 'expected ' + j(elem) + ' to not have one ' + i(selector) + ' tag, but has ' + n(len)); - - if (undefined != text) { - expect(elems).to.have.text(text); - } - - return this; -}; - -/** - * Assert existance attr `key` with optional `val`. - * - * @param {String} key - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.attr = function(key, val){ - var elem = this.obj - , attr = elem.attr(key); - - if (!val || (val && !this.negate)) { - this.assert( - attr.length - , 'expected ' + j(elem) + ' to have attribute ' + i(key) - , 'expected ' + j(elem) + ' to not have attribute ' + i(key) + ', but has ' + i(attr)); - } - - if (val) { - this.assert( - val == attr - , 'expected ' + j(elem) + ' to have attribute ' + i(key) + ' with ' + i(val) + ', but has ' + i(attr) - , 'expected ' + j(elem) + ' to not have attribute ' + i(key) + ' with ' + i(val)); - } - - return this; -}; - -/** - * Assert presence of the given class `name`. - * - * @param {String} name - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.class = function(name){ - var elem = this.obj; - - this.assert( - elem.hasClass(name) - , 'expected ' + j(elem) + ' to have class ' + i(name) + ', but has ' + i(elem.attr('class')) - , 'expected ' + j(elem) + ' to not have class ' + i(name)); - - return this; -}; - -/** - * Assert that header `field` has the given `val`. - * - * @param {String} field - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.header = function(field, val){ - expect(this.obj).to.have.property('headers'); - expect(this.obj.headers).to.have.property(field.toLowerCase(), val); - return this; -}; - -/** - * Assert `.statusCode` of `code`. - * - * @param {Number} code - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.status = function(code){ - expect(this.obj).to.have.property('statusCode'); - var status = this.obj.statusCode; - - this.assert( - code == status - , 'expected response code of ' + code + ' ' + i(statusCodes[code]) - + ', but got ' + status + ' ' + i(statusCodes[status]) - , 'expected to not respond with ' + code + ' ' + i(statusCodes[code])); - - return this; -}; - -/** - * Assert id attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.id = attr('id'); - -/** - * Assert title attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.title = attr('title'); - -/** - * Assert alt attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.alt = attr('alt'); - -/** - * Assert href attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.href = attr('href'); - -/** - * Assert src attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.src = attr('src'); - -/** - * Assert rel attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.rel = attr('rel'); - -/** - * Assert media attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.media = attr('media'); - -/** - * Assert name attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.name = attr('name'); - -/** - * Assert action attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.action = attr('action'); - -/** - * Assert method attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.method = attr('method'); - -/** - * Assert value attribute. - * - * @param {String} val - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.value = attr('value'); - -/** - * Assert enabled. - * - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.enabled = function () { - var elem = this.obj - , disabled = elem.attr('disabled'); - - this.assert( - !disabled - , 'expected ' + j(elem) + ' to be enabled' - , ''); - - return this; -}; - -/** - * Assert disabled. - * - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.disabled = function () { - var elem = this.obj - , disabled = elem.attr('disabled'); - - this.assert( - disabled - , 'expected ' + j(elem) + ' to be disabled' - , ''); - - return this; -}; - -/** - * Assert checked. - * - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.checked = bool('checked'); - -/** - * Assert selected. - * - * @return {Assertion} for chaining - * @api public - */ - -Assertion.prototype.selected = bool('selected'); - -/** - * Generate a boolean assertion function for the given attr `name`. - * - * @param {String} name - * @return {Function} - * @api private - */ - -function bool(name) { - return function(){ - var elem = this.obj; - - this.assert( - elem.attr(name) - , 'expected ' + j(elem) + ' to be ' + name - , 'expected ' + j(elem) + ' to not be ' + name); - - return this; - } -} - -/** - * Generate an attr assertion function for the given attr `name`. - * - * @param {String} name - * @return {Function} - * @api private - */ - -function attr(name) { - return function(expected){ - var elem = this.obj - , val = elem.attr(name); - - this.assert( - expected == val - , 'expected ' + j(elem) + ' to have ' + name + ' ' + i(expected) + ', but has ' + i(val) - , 'expected ' + j(elem) + ' to not have ' + name + ' ' + i(expected)); - - return this; - } -} diff --git a/node_modules/everyauth/test/util/satisfy.js b/node_modules/everyauth/test/util/satisfy.js deleted file mode 100644 index 996d926..0000000 --- a/node_modules/everyauth/test/util/satisfy.js +++ /dev/null @@ -1,102 +0,0 @@ -var satisfy = require('satisfy') - , Satisfaction = satisfy.Satisfaction; - -var _fill = Satisfaction.prototype.fill; -Satisfaction.prototype.fill = function () { - if (arguments.length === 1) { - var namesToVals = arguments[0]; - for (var name in namesToVals) { - _fill.call(this, 'input[name="' + name + '"]', namesToVals[name]); - } - return this; - } - if (arguments.length === 2) { - if ('string' === typeof arguments[1]) { - return _fill.apply(this, arguments); - } - var formSelector = this._currFormSelector = arguments[0] - , namesToVals = arguments[1]; - for (var name in namesToVals) { - this.fill(formSelector + ' input[name="' + name + '"]', namesToVals[name]); - } - return this; - } - throw new Error("Unsupported function signature for Satisfaction.prototype.fill"); -}; - -Satisfaction.prototype.submit = function submit () { - var submitSelector = '' - , currFormSelector = this._currFormSelector; - if (currFormSelector) { - submitSelector += currFormSelector + ' '; - } - submitSelector += 'input[type=submit]'; - return this.click(submitSelector); -} - -var _expect = Satisfaction.prototype.expect; -Satisfaction.prototype.expect = function (selector) { - return new Assertion(selector, this); -}; - -var flags = { - not: ['to', 'have'] - , to: ['not', 'have'] - , have: [] -}; - -function Assertion (selector, satisfaction, flag, parent) { - this.selector = selector; - this.satisfaction = satisfaction; - - if (flag == 'not') { - this.onComplete = function () { - this.selector = ':not(' + this.selector + ')'; - } - } - - this.flags = {}; - - if (undefined != parent) { - this.flags[flag] = true; - for (var i in parent.flags) if (parent.flags.hasOwnProperty(i)) { - this.flags[i] = true; - } - if (parent.onComplete) this.onComplete = parent.onComplete; - } - - var $flags = flag ? flags[flag] : Object.keys(flags) - , self = this; - - for (var i = $flags.length; i--; ) { - // avoid recursion - if (this.flags[$flags[i]]) continue; - - var name = $flags[i] - , assertion = new Assertion(this.selector, this.satisfaction, name, this); - - this[name] = assertion; - } -} - -Assertion.prototype.text = function (str) { - this.selector += ':contains(' + str + ')' - return this -}; - -// Delegate any methods with satisfaction method names back to satisfaction - -var satisfyMethodNames = ['run', 'fill', 'expect', 'click', 'submit']; -for (var i = satisfyMethodNames.length; i--; ) { - var name = satisfyMethodNames[i]; - (function (name) { - Assertion.prototype[name] = function () { - if (this.onComplete) this.onComplete(); - console.log(this.selector); - _expect.call(this.satisfaction, this.selector); - return this.satisfaction[name].apply(this.satisfaction, arguments); - }; - })(name); -} - -module.exports = satisfy; diff --git a/node_modules/jade/.npmignore b/node_modules/jade/.npmignore deleted file mode 100644 index fdc7b89..0000000 --- a/node_modules/jade/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -test -support -benchmarks -examples -lib-cov -coverage.html -.gitmodules -.travis.yml -History.md -Makefile -test/ -support/ -benchmarks/ -examples/ diff --git a/node_modules/jade/LICENSE b/node_modules/jade/LICENSE deleted file mode 100644 index 8ad0e0d..0000000 --- a/node_modules/jade/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2009-2010 TJ Holowaychuk - -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/jade/Readme.md b/node_modules/jade/Readme.md deleted file mode 100644 index 9f629d9..0000000 --- a/node_modules/jade/Readme.md +++ /dev/null @@ -1,1298 +0,0 @@ - [![Build Status](https://secure.travis-ci.org/visionmedia/jade.png)](http://travis-ci.org/visionmedia/jade) - -# Jade - template engine - - Jade is a high performance template engine heavily influenced by [Haml](http://haml-lang.com) - and implemented with JavaScript for [node](http://nodejs.org). For discussion join the [Google Group](http://groups.google.com/group/jadejs). - -## Test drive - - You can test drive Jade online [here](http://naltatis.github.com/jade-syntax-docs). - -## README Contents - -- [Features](#a1) -- [Implementations](#a2) -- [Installation](#a3) -- [Browser Support](#a4) -- [Public API](#a5) -- [Syntax](#a6) - - [Line Endings](#a6-1) - - [Tags](#a6-2) - - [Tag Text](#a6-3) - - [Comments](#a6-4) - - [Block Comments](#a6-5) - - [Nesting](#a6-6) - - [Block Expansion](#a6-7) - - [Case](#a6-8) - - [Attributes](#a6-9) - - [HTML](#a6-10) - - [Doctypes](#a6-11) -- [Filters](#a7) -- [Code](#a8) -- [Iteration](#a9) -- [Conditionals](#a10) -- [Template inheritance](#a11) -- [Block append / prepend](#a12) -- [Includes](#a13) -- [Mixins](#a14) -- [Generated Output](#a15) -- [Example Makefile](#a16) -- [jade(1)](#a17) -- [Tutorials](#a18) -- [License](#a19) - -
    -## Features - - - client-side support - - great readability - - flexible indentation - - block-expansion - - mixins - - static includes - - attribute interpolation - - code is escaped by default for security - - contextual error reporting at compile & run time - - executable for compiling jade templates via the command line - - html 5 mode (the default doctype) - - optional memory caching - - combine dynamic and static tag classes - - parse tree manipulation via _filters_ - - template inheritance - - block append / prepend - - supports [Express JS](http://expressjs.com) out of the box - - transparent iteration over objects, arrays, and even non-enumerables via `each` - - block comments - - no tag prefix - - filters - - :stylus must have [stylus](http://github.com/LearnBoost/stylus) installed - - :less must have [less.js](http://github.com/cloudhead/less.js) installed - - :markdown must have [markdown-js](http://github.com/evilstreak/markdown-js), [node-discount](http://github.com/visionmedia/node-discount), or [marked](http://github.com/chjj/marked) installed - - :cdata - - :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed - - [Emacs Mode](https://github.com/brianc/jade-mode) - - [Vim Syntax](https://github.com/digitaltoad/vim-jade) - - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) - - [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode) - - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) - - [html2jade](https://github.com/donpark/html2jade) converter - - -## Implementations - - - [php](http://github.com/everzet/jade.php) - - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) - - [ruby](http://github.com/stonean/slim) - - [python](https://github.com/SyrusAkbary/pyjade) - - [java](https://github.com/neuland/jade4j) - - -## Installation - -via npm: - -```bash -$ npm install jade -``` - - -## Browser Support - - To compile jade to a single file compatible for client-side use simply execute: - -```bash -$ make jade.js -``` - - Alternatively, if uglifyjs is installed via npm (`npm install uglify-js`) you may execute the following which will create both files. However each release builds these for you. - -```bash -$ make jade.min.js -``` - - By default Jade instruments templates with line number statements such as `__.lineno = 3` for debugging purposes. When used in a browser it's useful to minimize this boiler plate, you can do so by passing the option `{ compileDebug: false }`. The following template - -```jade -p Hello #{name} -``` - - Can then be as small as the following generated function: - -```js -function anonymous(locals, attrs, escape, rethrow) { - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - - Through the use of Jade's `./runtime.js` you may utilize these pre-compiled templates on the client-side _without_ Jade itself, all you need is the associated utility functions (in runtime.js), which are then available as `jade.attrs`, `jade.escape` etc. To enable this you should pass `{ client: true }` to `jade.compile()` to tell Jade to reference the helper functions - via `jade.attrs`, `jade.escape` etc. - -```js -function anonymous(locals, attrs, escape, rethrow) { - var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - -
    -## Public API - -```js -var jade = require('jade'); - -// Compile a function -var fn = jade.compile('string of jade', options); -fn(locals); -``` - -### Options - - - `self` Use a `self` namespace to hold the locals _(false by default)_ - - `locals` Local variable object - - `filename` Used in exceptions, and required when using includes - - `debug` Outputs tokens and function body generated - - `compiler` Compiler to replace jade's default - - `compileDebug` When `false` no debug instrumentation is compiled - - `pretty` Add pretty-indentation whitespace to output _(false by default)_ - - -## Syntax - - -### Line Endings - -**CRLF** and **CR** are converted to **LF** before parsing. - - -### Tags - -A tag is simply a leading word: - -```jade -html -``` - -for example is converted to `` - -tags can also have ids: - -```jade -div#container -``` - -which would render `
    ` - -how about some classes? - -```jade -div.user-details -``` - -renders `
    ` - -multiple classes? _and_ an id? sure: - -```jade -div#foo.bar.baz -``` - -renders `
    ` - -div div div sure is annoying, how about: - -```jade -#foo -.bar -``` - -which is syntactic sugar for what we have already been doing, and outputs: - -```html -
    -``` - -
    -### Tag Text - -Simply place some content after the tag: - -```jade -p wahoo! -``` - -renders `

    wahoo!

    `. - -well cool, but how about large bodies of text: - -```jade -p - | foo bar baz - | rawr rawr - | super cool - | go jade go -``` - -renders `

    foo bar baz rawr.....

    ` - -interpolation? yup! both types of text can utilize interpolation, -if we passed `{ name: 'tj', email: 'tj@vision-media.ca' }` to the compiled function we can do the following: - -```jade -#user #{name} <#{email}> -``` - -outputs `
    tj <tj@vision-media.ca>
    ` - -Actually want `#{}` for some reason? escape it! - -```jade -p \#{something} -``` - -now we have `

    #{something}

    ` - -We can also utilize the unescaped variant `!{html}`, so the following -will result in a literal script tag: - -```jade -- var html = "" -| !{html} -``` - -Nested tags that also contain text can optionally use a text block: - -```jade -label - | Username: - input(name='user[name]') -``` - -or immediate tag text: - -```jade -label Username: - input(name='user[name]') -``` - -Tags that accept _only_ text such as `script` and `style` do not -need the leading `|` character, for example: - -```jade -html - head - title Example - script - if (foo) { - bar(); - } else { - baz(); - } -``` - -Once again as an alternative, we may use a trailing `.` to indicate a text block, for example: - -```jade -p. - foo asdf - asdf - asdfasdfaf - asdf - asd. -``` - -outputs: - -```html -

    foo asdf -asdf - asdfasdfaf - asdf -asd. -

    -``` - -This however differs from a trailing `.` followed by a space, which although is ignored by the Jade parser, tells Jade that this period is a literal: - -```jade -p . -``` - -outputs: - -```html -

    .

    -``` - -It should be noted that text blocks should be doubled escaped. For example if you desire the following output. - -```html -

    foo\bar

    -``` - -use: - -```jade -p. - foo\\bar -``` - -
    -### Comments - -Single line comments currently look the same as JavaScript comments, -aka `//` and must be placed on their own line: - -```jade -// just some paragraphs -p foo -p bar -``` - -would output - -```html - -

    foo

    -

    bar

    -``` - -Jade also supports unbuffered comments, by simply adding a hyphen: - -```jade -//- will not output within markup -p foo -p bar -``` - -outputting - -```html -

    foo

    -

    bar

    -``` - -
    -### Block Comments - - A block comment is legal as well: - -```jade -body - // - #content - h1 Example -``` - -outputting - -```html - - - -``` - -Jade supports conditional-comments as well, for example: - -```jade -head - //if lt IE 8 - script(src='http://github.com/ie-sucks.js') -``` - -outputs: - -```html - - - -``` - - -### Nesting - - Jade supports nesting to define the tags in a natural way: - -```jade -ul - li.first - a(href='#') foo - li - a(href='#') bar - li.last - a(href='#') baz -``` - - -### Block Expansion - - Block expansion allows you to create terse single-line nested tags, - the following example is equivalent to the nesting example above. - -```jade -ul - li.first: a(href='#') foo - li: a(href='#') bar - li.last: a(href='#') baz -``` - - -### Case - - The case statement takes the following form: - -```jade -html - body - friends = 10 - case friends - when 0 - p you have no friends - when 1 - p you have a friend - default - p you have #{friends} friends -``` - - Block expansion may also be used: - -```jade -friends = 5 - -html - body - case friends - when 0: p you have no friends - when 1: p you have a friend - default: p you have #{friends} friends -``` - - -### Attributes - -Jade currently supports `(` and `)` as attribute delimiters. - -```jade -a(href='http://github.com/login', title='View login page') Login -``` - -When a value is `undefined` or `null` the attribute is _not_ added, -so this is fine, it will not compile `something="null"`. - -```jade -div(something=null) -``` - -Boolean attributes are also supported: - -```jade -input(type="checkbox", checked) -``` - -Boolean attributes with code will only output the attribute when `true`: - -```jade -input(type="checkbox", checked=someValue) -``` - -Multiple lines work too: - -```jade -input(type='checkbox', - name='agreement', - checked) -``` - -Multiple lines without the comma work fine: - -```jade -input(type='checkbox' - name='agreement' - checked) -``` - -Funky whitespace? fine: - -```jade -input( - type='checkbox' - name='agreement' - checked) -``` - -Colons work: - -```jade -rss(xmlns:atom="atom") -``` - -Suppose we have the `user` local `{ id: 12, name: 'tobi' }` -and we wish to create an anchor tag with `href` pointing to "/user/12" -we could use regular javascript concatenation: - -```jade -a(href='http://github.com/user/' + user.id)= user.name -``` - -or we could use jade's interpolation, which I added because everyone -using Ruby or CoffeeScript seems to think this is legal js..: - -```jade -a(href='http://github.com/user/#{user.id}')= user.name -``` - -The `class` attribute is special-cased when an array is given, -allowing you to pass an array such as `bodyClasses = ['user', 'authenticated']` directly: - -```jade -body(class=bodyClasses) -``` - - -### HTML - - Inline html is fine, we can use the pipe syntax to - write arbitrary text, in this case some html: - -```jade -html - body - |

    Title

    - |

    foo bar baz

    -``` - - Or we can use the trailing `.` to indicate to Jade that we - only want text in this block, allowing us to omit the pipes: - -```jade -html - body. -

    Title

    -

    foo bar baz

    -``` - - Both of these examples yield the same result: - -```html -

    Title

    -

    foo bar baz

    - -``` - - The same rule applies for anywhere you can have text - in jade, raw html is fine: - -```jade -html - body - h1 User #{name} -``` - -
    -### Doctypes - -To add a doctype simply use `!!!`, or `doctype` followed by an optional value: - -```jade -!!! -``` - -or - -```jade -doctype -``` - -Will output the _html 5_ doctype, however: - -```jade -!!! transitional -``` - -Will output the _transitional_ doctype. - -Doctypes are case-insensitive, so the following are equivalent: - -```jade -doctype Basic -doctype basic -``` - -it's also possible to simply pass a doctype literal: - -```jade -doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN -``` - -yielding: - -```html - -``` - -Below are the doctypes defined by default, which can easily be extended: - -```js -var doctypes = exports.doctypes = { - '5': '', - 'default': '', - 'xml': '', - 'transitional': '', - 'strict': '', - 'frameset': '', - '1.1': '', - 'basic': '', - 'mobile': '' -}; -``` - -To alter the default simply change: - -```js -jade.doctypes.default = 'whatever you want'; -``` - - -## Filters - -Filters are prefixed with `:`, for example `:markdown` and -pass the following block of text to an arbitrary function for processing. View the _features_ -at the top of this document for available filters. - -```jade -body - :markdown - Woah! jade _and_ markdown, very **cool** - we can even link to [stuff](http://google.com) -``` - -Renders: - -```html -

    Woah! jade and markdown, very cool we can even link to stuff

    -``` - - -## Code - -Jade currently supports three classifications of executable code. The first -is prefixed by `-`, and is not buffered: - -```jade -- var foo = 'bar'; -``` - -This can be used for conditionals, or iteration: - -```jade -- for (var key in obj) - p= obj[key] -``` - -Due to Jade's buffering techniques the following is valid as well: - -```jade -- if (foo) - ul - li yay - li foo - li worked -- else - p oh no! didnt work -``` - -Hell, even verbose iteration: - -```jade -- if (items.length) - ul - - items.forEach(function(item){ - li= item - - }) -``` - -Anything you want! - -Next up we have _escaped_ buffered code, which is used to -buffer a return value, which is prefixed by `=`: - -```jade -- var foo = 'bar' -= foo -h1= foo -``` - -Which outputs `bar

    bar

    `. Code buffered by `=` is escaped -by default for security, however to output unescaped return values -you may use `!=`: - -```jade -p!= aVarContainingMoreHTML -``` - - Jade also has designer-friendly variants, making the literal JavaScript - more expressive and declarative. For example the following assignments - are equivalent, and the expression is still regular javascript: - -```jade -- var foo = 'foo ' + 'bar' -foo = 'foo ' + 'bar' -``` - - Likewise Jade has first-class `if`, `else if`, `else`, `until`, `while`, `unless` among others, however you must remember that the expressions are still regular javascript: - -```jade -if foo == 'bar' - ul - li yay - li foo - li worked -else - p oh no! didnt work -``` - -
    -## Iteration - - Along with vanilla JavaScript Jade also supports a subset of - constructs that allow you to create more designer-friendly templates, - one of these constructs is `each`, taking the form: - -```jade -each VAL[, KEY] in OBJ -``` - -An example iterating over an array: - -```jade -- var items = ["one", "two", "three"] -each item in items - li= item -``` - -outputs: - -```html -
  • one
  • -
  • two
  • -
  • three
  • -``` - -iterating an array with index: - -```jade -items = ["one", "two", "three"] -each item, i in items - li #{item}: #{i} -``` - -outputs: - -```html -
  • one: 0
  • -
  • two: 1
  • -
  • three: 2
  • -``` - -iterating an object's keys and values: - -```jade -obj = { foo: 'bar' } -each val, key in obj - li #{key}: #{val} -``` - -would output `
  • foo: bar
  • ` - -Internally Jade converts these statements to regular -JavaScript loops such as `users.forEach(function(user){`, -so lexical scope and nesting applies as it would with regular -JavaScript: - -```jade -each user in users - each role in user.roles - li= role -``` - - You may also use `for` if you prefer: - -```jade -for user in users - for role in user.roles - li= role -``` - -
    -## Conditionals - - Jade conditionals are equivalent to those using the code (`-`) prefix, - however allow you to ditch parenthesis to become more designer friendly, - however keep in mind the expression given is _regular_ JavaScript: - -```jade -for user in users - if user.role == 'admin' - p #{user.name} is an admin - else - p= user.name -``` - - is equivalent to the following using vanilla JavaScript literals: - -```jade -for user in users - - if (user.role == 'admin') - p #{user.name} is an admin - - else - p= user.name -``` - - Jade also provides have `unless` which is equivalent to `if (!(expr))`: - -```jade -for user in users - unless user.isAnonymous - p - | Click to view - a(href='http://github.com/users/' + user.id)= user.name -``` - - -## Template inheritance - - Jade supports template inheritance via the `block` and `extends` keywords. A block is simply a "block" of Jade that may be replaced within a child template, this process is recursive. To activate template inheritance in Express 2.x you must add: `app.set('view options', { layout: false });`. - - Jade blocks can provide default content if desired, however optional as shown below by `block scripts`, `block content`, and `block foot`. - -```jade -html - head - h1 My Site - #{title} - block scripts - script(src='http://github.com/jquery.js') - body - block content - block foot - #footer - p some footer content -``` - - Now to extend the layout, simply create a new file and use the `extends` directive as shown below, giving the path (with or without the .jade extension). You may now define one or more blocks that will override the parent block content, note that here the `foot` block is _not_ redefined and will output "some footer content". - -```jade -extends layout - -block scripts - script(src='http://github.com/jquery.js') - script(src='http://github.com/pets.js') - -block content - h1= title - each pet in pets - include pet -``` - - It's also possible to override a block to provide additional blocks, as shown in the following example where `content` now exposes a `sidebar` and `primary` block for overriding, or the child template could override `content` all together. - -```jade -extends regular-layout - -block content - .sidebar - block sidebar - p nothing - .primary - block primary - p nothing -``` - - -## Block append / prepend - - Jade allows you to _replace_ (default), _prepend_, or _append_ blocks. Suppose for example you have default scripts in a "head" block that you wish to utilize on _every_ page, you might do this: - -```jade -html - head - block head - script(src='http://github.com/vendor/jquery.js') - script(src='http://github.com/vendor/caustic.js') - body - block content -``` - - Now suppose you have a page of your application for a JavaScript game, you want some game related scripts as well as these defaults, you can simply `append` the block: - -```jade -extends layout - -block append head - script(src='http://github.com/vendor/three.js') - script(src='http://github.com/game.js') -``` - - When using `block append` or `block prepend` the `block` is optional: - -```jade -extends layout - -append head - script(src='http://github.com/vendor/three.js') - script(src='http://github.com/game.js') -``` - - -## Includes - - Includes allow you to statically include chunks of Jade, - or other content like css, or html which lives in separate files. The classical example is including a header and footer. Suppose we have the following directory structure: - - ./layout.jade - ./includes/ - ./head.jade - ./foot.jade - -and the following _layout.jade_: - -```jade -html - include includes/head - body - h1 My Site - p Welcome to my super amazing site. - include includes/foot -``` - -both includes _includes/head_ and _includes/foot_ are -read relative to the `filename` option given to _layout.jade_, -which should be an absolute path to this file, however Express does this for you. Include then parses these files, and injects the AST produced to render what you would expect: - -```html - - - My Site - - - -

    My Site

    -

    Welcome to my super lame site.

    - - - -``` - - As mentioned `include` can be used to include other content - such as html or css. By providing an extension Jade will not - assume that the file is Jade source and will include it as - a literal: - -```jade -html - body - include content.html -``` - - Include directives may also accept a block, in which case the - the given block will be appended to the _last_ block defined - in the file. For example if `head.jade` contains: - -```jade -head - script(src='http://github.com/jquery.js') -``` - - We may append values by providing a block to `include head` - as shown below, adding the two scripts. - -```jade -html - include head - script(src='http://github.com/foo.js') - script(src='http://github.com/bar.js') - body - h1 test -``` - - You may also `yield` within an included template, allowing you to explicitly mark where the block given to `include` will be placed. Suppose for example you wish to prepend scripts rather than append, you might do the following: - -```jade -head - yield - script(src='http://github.com/jquery.js') - script(src='http://github.com/jquery.ui.js') -``` - - Since included Jade is parsed and literally merges the AST, lexically scoped variables function as if the included Jade was written right in the same file. This means `include` may be used as sort of partial, for example suppose we have `user.jade` which utilizes a `user` variable. - -```jade -h1= user.name -p= user.occupation -``` - -We could then simply `include user` while iterating users, and since the `user` variable is already defined within the loop the included template will have access to it. - -```jade -users = [{ name: 'Tobi', occupation: 'Ferret' }] - -each user in users - .user - include user -``` - -yielding: - -```html -
    -

    Tobi

    -

    Ferret

    -
    -``` - -If we wanted to expose a different variable name as `user` since `user.jade` references that name, we could simply define a new variable as shown here with `user = person`: - -```jade -each person in users - .user - user = person - include user -``` - -
    -## Mixins - - Mixins are converted to regular JavaScript functions in - the compiled template that Jade constructs. Mixins may - take arguments, though not required: - -```jade -mixin list - ul - li foo - li bar - li baz -``` - - Utilizing a mixin without args looks similar, just without a block: - -```jade -h2 Groceries -mixin list -``` - - Mixins may take one or more arguments as well, the arguments - are regular javascripts expressions, so for example the following: - -```jade -mixin pets(pets) - ul.pets - - each pet in pets - li= pet - -mixin profile(user) - .user - h2= user.name - mixin pets(user.pets) -``` - - Would yield something similar to the following html: - -```html -
    -

    tj

    -
      -
    • tobi
    • -
    • loki
    • -
    • jane
    • -
    • manny
    • -
    -
    -``` - -
    -## Generated Output - - Suppose we have the following Jade: - -```jade -- var title = 'yay' -h1.title #{title} -p Just an example -``` - - When the `compileDebug` option is not explicitly `false`, Jade - will compile the function instrumented with `__.lineno = n;`, which - in the event of an exception is passed to `rethrow()` which constructs - a useful message relative to the initial Jade input. - -```js -function anonymous(locals) { - var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; - var rethrow = jade.rethrow; - try { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - __.lineno = 1; - var title = 'yay' - __.lineno = 2; - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - __.lineno = 3; - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); - } catch (err) { - rethrow(err, __.input, __.filename, __.lineno); - } -} -``` - -When the `compileDebug` option _is_ explicitly `false`, this instrumentation -is stripped, which is very helpful for light-weight client-side templates. Combining Jade's options with the `./runtime.js` file in this repo allows you -to toString() compiled templates and avoid running the entire Jade library on -the client, increasing performance, and decreasing the amount of JavaScript -required. - -```js -function anonymous(locals) { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - var title = 'yay' - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); -} -``` - -
    -## Example Makefile - - Below is an example Makefile used to compile _pages/*.jade_ - into _pages/*.html_ files by simply executing `make`. - -```make -JADE = $(shell find pages/*.jade) -HTML = $(JADE:.jade=.html) - -all: $(HTML) - -%.html: %.jade - jade < $< --path $< > $@ - -clean: - rm -f $(HTML) - -.PHONY: clean -``` - -this can be combined with the `watch(1)` command to produce -a watcher-like behaviour: - -```bash -$ watch make -``` - - -## jade(1) - -``` - -Usage: jade [options] [dir|file ...] - -Options: - - -h, --help output usage information - -V, --version output the version number - -o, --obj javascript options object - -O, --out output the compiled html to - -p, --path filename used to resolve includes - -P, --pretty compile pretty html output - -c, --client compile for client-side runtime.js - -D, --no-debug compile without debugging (smaller functions) - -Examples: - - # translate jade the templates dir - $ jade templates - - # create {foo,bar}.html - $ jade {foo,bar}.jade - - # jade over stdio - $ jade < my.jade > my.html - - # jade over stdio - $ echo "h1 Jade!" | jade - - # foo, bar dirs rendering to /tmp - $ jade foo bar --out /tmp - -``` - - -## Tutorials - - - cssdeck interactive [Jade syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax) - - cssdeck interactive [Jade logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2) - - in [Japanese](http://blog.craftgear.net/4f501e97c1347ec934000001/title/10%E5%88%86%E3%81%A7%E3%82%8F%E3%81%8B%E3%82%8Bjade%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3) - - -## License - -(The MIT License) - -Copyright (c) 2009-2010 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. diff --git a/node_modules/jade/Readme_zh-cn.md b/node_modules/jade/Readme_zh-cn.md deleted file mode 100644 index cb90608..0000000 --- a/node_modules/jade/Readme_zh-cn.md +++ /dev/null @@ -1,921 +0,0 @@ -# Jade - 模板引擎 - - Jade 是一个高性能的模板引擎,它深受[Haml](http://haml-lang.com)影响,它是用javascript实现的,并且可以供[node](http://nodejs.org)使用. - - 翻译:[草依山](http://jser.me)   [翻译反馈](http://weibo.com/1826461472/z9jriDdmB#pl_profile_nav)  [Fork me](https://github.com/jserme/jade/) - -## 特性 - - - 客户端支持 - - 代码高可读 - - 灵活的缩进 - - 块展开 - - 混合 - - 静态包含 - - 属性改写 - - 安全,默认代码是转义的 - - 运行时和编译时上下文错误报告 - - 命令行下编译jade模板 - - html 5 模式 (使用 _!!! 5_ 文档类型) - - 在内存中缓存(可选) - - 合并动态和静态标签类 - - 可以通过 _filters_ 修改树 - - 模板继承 - - 原生支持 [Express JS](http://expressjs.com) - - 通过 `each` 枚举对象、数组甚至是不能枚举的对象 - - 块注释 - - 没有前缀的标签 - - AST filters - - 过滤器 - - :sass 必须已经安装[sass.js](http://github.com/visionmedia/sass.js) - - :less 必须已经安装[less.js](http://github.com/cloudhead/less.js) - - :markdown 必须已经安装[markdown-js](http://github.com/evilstreak/markdown-js) 或者[node-discount](http://github.com/visionmedia/node-discount) - - :cdata - - :coffeescript 必须已经安装[coffee-script](http://jashkenas.github.com/coffee-script/) - - [Vim Syntax](https://github.com/digitaltoad/vim-jade) - - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) - - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) - - [html2jade](https://github.com/donpark/html2jade) 转换器 - -## 其它实现 - - - [php](http://github.com/everzet/jade.php) - - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) - - [ruby](http://github.com/stonean/slim) - -## 安装 - -通过 npm: - - npm install jade - -## 浏览器支持 - - 把jade编译为一个可供浏览器使用的单文件,只需要简单的执行: - - $ make jade.js - - 如果你已经安装了uglifyjs (`npm install uglify-js`),你可以执行下面的命令它会生成所有的文件。其实每一个正式版本里都帮你做了这事。 - - $ make jade.min.js - - 默认情况下,为了方便调试Jade会把模板组织成带有形如 `__.lineno = 3` 的行号的形式。 - 在浏览器里使用的时候,你可以通过传递一个选项`{ compileDebug: false }`来去掉这个。 - 下面的模板 - - p Hello #{name} - - 会被翻译成下面的函数: - -```js -function anonymous(locals, attrs, escape, rethrow) { - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - - 通过使用Jade的 `./runtime.js`你可以在浏览器使用这些预编译的模板而不需要使用Jade, 你只需要使用runtime.js里的工具函数, 它们会放在`jade.attrs`, `jade.escape` 这些里。 把选项 `{ client: true }` 传递给 `jade.compile()`, Jade 会把这些帮助函数的引用放在`jade.attrs`, `jade.escape`. - -```js -function anonymous(locals, attrs, escape, rethrow) { - var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - -## 公开API - -```javascript - var jade = require('jade'); - - // Compile a function - var fn = jade.compile('string of jade', options); - fn(locals); -``` - -### 选项 - - - `self` 使用`self` 命名空间来持有本地变量. _默认为false_ - - `locals` 本地变量对象 - - `filename` 异常发生时使用,includes时必需 - - `debug` 输出token和翻译后的函数体 - - `compiler` 替换掉jade默认的编译器 - - `compileDebug` `false`的时候调试的结构不会被输出 - -## 语法 - -### 行结束标志 - -**CRLF** 和 **CR** 会在编译之前被转换为 **LF** - -### 标签 - -标签就是一个简单的单词: - - html - -它会被转换为 `` - -标签也是可以有id的: - - div#container - -它会被转换为 `
    ` - -怎么加类呢? - - div.user-details - -转换为 `
    ` - -多个类? 和id? 也是可以搞定的: - - div#foo.bar.baz - -转换为 `
    ` - -不停的div div div 很讨厌啊 , 可以这样: - - #foo - .bar - -这个算是我们的语法糖,它已经被很好的支持了,上面的会输出: - - `
    ` - -### 标签文本 - -只需要简单的把内容放在标签之后: - - p wahoo! - -它会被渲染为 `

    wahoo!

    `. - -很帅吧,但是大段的文本怎么办呢: - - p - | foo bar baz - | rawr rawr - | super cool - | go jade go - -渲染为 `

    foo bar baz rawr.....

    ` - -怎么和数据结合起来? 所有类型的文本展示都可以和数据结合起来,如果我们把`{ name: 'tj', email: 'tj@vision-media.ca' }` 传给编译函数,下面是模板上的写法: - - #user #{name} <#{email}> - -它会被渲染为 `
    tj <tj@vision-media.ca>
    ` - -当就是要输出`#{}` 的时候怎么办? 转义一下! - - p \#{something} - -它会输出`

    #{something}

    ` - -同样可以使用非转义的变量`!{html}`, 下面的模板将直接输出一个script标签 - - - var html = "" - | !{html} - -内联标签同样可以使用文本块来包含文本: - - label - | Username: - input(name='user[name]') - -或者直接使用标签文本: - - label Username: - input(name='user[name]') - -_只_包含文本的标签,比如`script`, `style`, 和 `textarea` 不需要前缀`|` 字符, 比如: - - html - head - title Example - script - if (foo) { - bar(); - } else { - baz(); - } - -这里还有一种选择,可以使用'.' 来开始一段文本块,比如: - - p. - foo asdf - asdf - asdfasdfaf - asdf - asd. - -会被渲染为: - -

    foo asdf - asdf - asdfasdfaf - asdf - asd - . -

    - -这和带一个空格的 '.' 是不一样的, 带空格的会被Jade的解析器忽略,当作一个普通的文字: - - p . - -渲染为: - -

    .

    - - -需要注意的是广西块需要两次转义。比如想要输出下面的文本: - -

    foo\bar

    - -使用: - - p. - foo\\bar - -### 注释 - -单行注释和JavaScript里是一样的,通过"//"来开始,并且必须单独一行: - - // just some paragraphs - p foo - p bar - -渲染为: - - -

    foo

    -

    bar

    - -Jade 同样支持不输出的注释,加一个短横线就行了: - - //- will not output within markup - p foo - p bar - -渲染为: - -

    foo

    -

    bar

    - -### 块注释 - - 块注释也是支持的: - - body - // - #content - h1 Example - -渲染为: - - - - - -Jade 同样很好的支持了条件注释: - - body - //if IE - a(href='http://www.mozilla.com/en-US/firefox/') Get Firefox - - -渲染为: - - - - - -### 内联 - - Jade 支持以自然的方式定义标签嵌套: - - ul - li.first - a(href='#') foo - li - a(href='#') bar - li.last - a(href='#') baz - -### 块展开 - - 块展开可以帮助你在一行内创建嵌套的标签,下面的例子和上面的是一样的: - - ul - li.first: a(href='#') foo - li: a(href='#') bar - li.last: a(href='#') baz - - -### 属性 - -Jade 现在支持使用'(' 和 ')' 作为属性分隔符 - - a(href='http://github.com/login', title='View login page') Login - -当一个值是 `undefined` 或者 `null` 属性_不_会被加上, -所以呢,它不会编译出 'something="null"'. - - div(something=null) - -Boolean 属性也是支持的: - - input(type="checkbox", checked) - -使用代码的Boolean 属性只有当属性为`true`时才会输出: - - input(type="checkbox", checked=someValue) - -多行同样也是可用的: - - input(type='checkbox', - name='agreement', - checked) - -多行的时候可以不加逗号: - - input(type='checkbox' - name='agreement' - checked) - -加点空格,格式好看一点?同样支持 - - input( - type='checkbox' - name='agreement' - checked) - -冒号也是支持的: - - rss(xmlns:atom="atom") - -假如我有一个`user` 对象 `{ id: 12, name: 'tobi' }` -我们希望创建一个指向"/user/12"的链接 `href`, 我们可以使用普通的javascript字符串连接,如下: - - a(href='http://github.com/user/' + user.id)= user.name - -或者我们使用jade的修改方式,这个我想很多使用Ruby或者 CoffeeScript的人会看起来像普通的js..: - - a(href='http://github.com/user/#{user.id}')= user.name - -`class`属性是一个特殊的属性,你可以直接传递一个数组,比如`bodyClasses = ['user', 'authenticated']` : - - body(class=bodyClasses) - -### HTML - - 内联的html是可以的,我们可以使用管道定义一段文本 : - -``` -html - body - |

    Title

    - |

    foo bar baz

    -``` - - 或者我们可以使用`.` 来告诉Jade我们需要一段文本: - -``` -html - body. -

    Title

    -

    foo bar baz

    -``` - - 上面的两个例子都会渲染成相同的结果: - -``` -

    Title

    -

    foo bar baz

    - -``` - - 这条规则适应于在jade里的任何文本: - -``` -html - body - h1 User #{name} -``` - -### Doctypes - -添加文档类型只需要简单的使用 `!!!`, 或者 `doctype` 跟上下面的可选项: - - !!! - -会渲染出 _transitional_ 文档类型, 或者: - - !!! 5 - -or - - !!! html - -or - - doctype html - -doctypes 是大小写不敏感的, 所以下面两个是一样的: - - doctype Basic - doctype basic - -当然也是可以直接传递一段文档类型的文本: - - doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN - -渲染后: - - - -会输出 _html 5_ 文档类型. 下面的默认的文档类型,可以很简单的扩展: - -```javascript - var doctypes = exports.doctypes = { - '5': '', - 'xml': '', - 'default': '', - 'transitional': '', - 'strict': '', - 'frameset': '', - '1.1': '', - 'basic': '', - 'mobile': '' - }; -``` - -通过下面的代码可以很简单的改变默认的文档类型: - -```javascript - jade.doctypes.default = 'whatever you want'; -``` - -## 过滤器 - -过滤器前缀 `:`, 比如 `:markdown` 会把下面块里的文本交给专门的函数进行处理。查看顶部 _特性_ 里有哪些可用的过滤器。 - - body - :markdown - Woah! jade _and_ markdown, very **cool** - we can even link to [stuff](http://google.com) - -渲染为: - -

    Woah! jade and markdown, very cool we can even link to stuff

    - -## 代码 - -Jade目前支持三种类型的可执行代码。第一种是前缀`-`, 这是不会被输出的: - - - var foo = 'bar'; - -这可以用在条件语句或者循环中: - - - for (var key in obj) - p= obj[key] - -由于Jade的缓存技术,下面的代码也是可以的: - - - if (foo) - ul - li yay - li foo - li worked - - else - p oh no! didnt work - -哈哈,甚至是很长的循环也是可以的: - - - if (items.length) - ul - - items.forEach(function(item){ - li= item - - }) - -所以你想要的! - -下一步我们要_转义_输出的代码,比如我们返回一个值,只要前缀一个`=`: - - - var foo = 'bar' - = foo - h1= foo - -它会渲染为`bar

    bar

    `. 为了安全起见,使用`=`输出的代码默认是转义的,如果想直接输出不转义的值可以使用`!=`: - - p!= aVarContainingMoreHTML - -Jade 同样是设计师友好的,它可以使javascript更直接更富表现力。比如下面的赋值语句是相等的,同时表达式还是通常的javascript: - - - var foo = 'foo ' + 'bar' - foo = 'foo ' + 'bar' - -Jade会把 `if`, `else if`, `else`, `until`, `while`, `unless`同别的优先对待, 但是你得记住它们还是普通的javascript: - - if foo == 'bar' - ul - li yay - li foo - li worked - else - p oh no! didnt work - -## 循环 - -尽管已经支持JavaScript原生代码,Jade还是支持了一些特殊的标签,它们可以让模板更加易于理解,其中之一就是`each`, 这种形式: - - each VAL[, KEY] in OBJ - -一个遍历数组的例子 : - - - var items = ["one", "two", "three"] - each item in items - li= item - -渲染为: - -
  • one
  • -
  • two
  • -
  • three
  • - -遍历一个数组同时带上索引: - - items = ["one", "two", "three"] - each item, i in items - li #{item}: #{i} - -渲染为: - -
  • one: 0
  • -
  • two: 1
  • -
  • three: 2
  • - -遍历一个数组的键值: - - obj = { foo: 'bar' } - each val, key in obj - li #{key}: #{val} - -将会渲染为:`
  • foo: bar
  • ` - -Jade在内部会把这些语句转换成原生的JavaScript语句,就像使用 `users.forEach(function(user){`, -词法作用域和嵌套会像在普通的JavaScript中一样: - - each user in users - each role in user.roles - li= role - -如果你喜欢,也可以使用`for` : - - for user in users - for role in user.roles - li= role - -## 条件语句 - -Jade 条件语句和使用了(`-`) 前缀的JavaScript语句是一致的,然后它允许你不使用圆括号,这样会看上去对设计师更友好一点, -同时要在心里记住这个表达式渲染出的是_常规_Javascript: - - for user in users - if user.role == 'admin' - p #{user.name} is an admin - else - p= user.name - -和下面的使用了常规JavaScript的代码是相等的: - - for user in users - - if (user.role == 'admin') - p #{user.name} is an admin - - else - p= user.name - -Jade 同时支持`unless`, 这和`if (!(expr))`是等价的: - - for user in users - unless user.isAnonymous - p - | Click to view - a(href='http://github.com/users/' + user.id)= user.name - -## 模板继承 - - Jade 支持通过 `block` 和 `extends` 关键字来实现模板继承。 一个块就是一个Jade的"block" ,它将在子模板中实现,同时是支持递归的。 - - Jade 块如果没有内容,Jade会添加默认内容,下面的代码默认会输出`block scripts`, `block content`, 和 `block foot`. - -``` -html - head - h1 My Site - #{title} - block scripts - script(src='http://github.com/jquery.js') - body - block content - block foot - #footer - p some footer content -``` - - 现在我们来继承这个布局,简单创建一个新文件,像下面那样直接使用`extends`,给定路径(可以选择带.jade扩展名或者不带). 你可以定义一个或者更多的块来覆盖父级块内容, 注意到这里的`foot`块_没有_定义,所以它还会输出父级的"some footer content"。 - -``` -extends extend-layout - -block scripts - script(src='http://github.com/jquery.js') - script(src='http://github.com/pets.js') - -block content - h1= title - each pet in pets - include pet -``` - - 同样可以在一个子块里添加块,就像下面实现的块`content`里又定义了两个可以被实现的块`sidebar`和`primary`,或者子模板直接实现`content`。 - -``` -extends regular-layout - -block content - .sidebar - block sidebar - p nothing - .primary - block primary - p nothing -``` - -## 包含 - - Includes 允许你静态包含一段Jade, 或者别的存放在单个文件中的东西比如css, html。 非常常见的例子是包含头部和页脚。 假设我们有一个下面目录结构的文件夹: - - ./layout.jade - ./includes/ - ./head.jade - ./tail.jade - -下面是 _layout.jade_ 的内容: - - html - include includes/head - body - h1 My Site - p Welcome to my super amazing site. - include includes/foot - -这两个包含 _includes/head_ 和 _includes/foot_ 都会读取相对于给 _layout.jade_ 参数`filename` 的路径的文件, 这是一个绝对路径,不用担心Express帮你搞定这些了。Include 会解析这些文件,并且插入到已经生成的语法树中,然后渲染为你期待的内容: - -```html - - - My Site - - - -

    My Site

    -

    Welcome to my super lame site.

    - - - -``` - - 前面已经提到,`include` 可以包含比如html或者css这样的内容。给定一个扩展名后,Jade不会把这个文件当作一个Jade源代码,并且会把它当作一个普通文本包含进来: - -``` -html - body - include content.html -``` - - Include 也可以接受块内容,给定的块将会附加到包含文件 _最后_ 的块里。 举个例子,`head.jade` 包含下面的内容: - - - ``` -head - script(src='http://github.com/jquery.js') -``` - - 我们可以像下面给`include head`添加内容, 这里是添加两个脚本. - -``` -html - include head - script(src='http://github.com/foo.js') - script(src='http://github.com/bar.js') - body - h1 test -``` - - -## Mixins - - Mixins在编译的模板里会被Jade转换为普通的JavaScript函数。 Mixins 可以还参数,但不是必需的: - - mixin list - ul - li foo - li bar - li baz - - 使用不带参数的mixin看上去非常简单,在一个块外: - - h2 Groceries - mixin list - - Mixins 也可以带一个或者多个参数,参数就是普通的javascripts表达式,比如下面的例子: - - mixin pets(pets) - ul.pets - - each pet in pets - li= pet - - mixin profile(user) - .user - h2= user.name - mixin pets(user.pets) - - 会输出像下面的html: - -```html -
    -

    tj

    -
      -
    • tobi
    • -
    • loki
    • -
    • jane
    • -
    • manny
    • -
    -
    -``` - -## 产生输出 - - 假设我们有下面的Jade源码: - -``` -- var title = 'yay' -h1.title #{title} -p Just an example -``` - - 当 `compileDebug` 选项不是`false`, Jade 会编译时会把函数里加上 `__.lineno = n;`, 这个参数会在编译出错时传递给`rethrow()`, 而这个函数会在Jade初始输出时给出一个有用的错误信息。 - -```js -function anonymous(locals) { - var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; - var rethrow = jade.rethrow; - try { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - __.lineno = 1; - var title = 'yay' - __.lineno = 2; - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - __.lineno = 3; - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); - } catch (err) { - rethrow(err, __.input, __.filename, __.lineno); - } -} -``` - -当`compileDebug` 参数是`false`, 这个参数会被去掉,这样对于轻量级的浏览器端模板是非常有用的。结合Jade的参数和当前源码库里的 `./runtime.js` 文件,你可以通过toString()来编译模板而不需要在浏览器端运行整个Jade库,这样可以提高性能,也可以减少载入的JavaScript数量。 - -```js -function anonymous(locals) { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - var title = 'yay' - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); -} -``` - -## Makefile的一个例子 - - 通过执行`make`, 下面的Makefile例子可以把 _pages/*.jade_ 编译为 _pages/*.html_ 。 - -```make -JADE = $(shell find pages/*.jade) -HTML = $(JADE:.jade=.html) - -all: $(HTML) - -%.html: %.jade - jade < $< --path $< > $@ - -clean: - rm -f $(HTML) - -.PHONY: clean -``` - -这个可以和`watch(1)` 命令起来产生像下面的行为: - - $ watch make - -## 命令行的jade(1) - -``` - -使用: jade [options] [dir|file ...] - -选项: - - -h, --help 输出帮助信息 - -v, --version 输出版本号 - -o, --obj javascript选项 - -O, --out 输出编译后的html到 - -p, --path 在处理stdio时,查找包含文件时的查找路径 - -Examples: - - # 编译整个目录 - $ jade templates - - # 生成 {foo,bar}.html - $ jade {foo,bar}.jade - - # 在标准IO下使用jade - $ jade < my.jade > my.html - - # 在标准IO下使用jade, 同时指定用于查找包含的文件 - $ jade < my.jade -p my.jade > my.html - - # 在标准IO下使用jade - $ echo "h1 Jade!" | jade - - # foo, bar 目录渲染到 /tmp - $ jade foo bar --out /tmp - -``` - -## License - -(The MIT License) - -Copyright (c) 2009-2010 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. diff --git a/node_modules/jade/bin/jade b/node_modules/jade/bin/jade deleted file mode 100755 index 8f1c816..0000000 --- a/node_modules/jade/bin/jade +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var fs = require('fs') - , program = require('commander') - , path = require('path') - , basename = path.basename - , dirname = path.dirname - , resolve = path.resolve - , exists = fs.existsSync || path.existsSync - , join = path.join - , mkdirp = require('mkdirp') - , jade = require('../'); - -// jade options - -var options = {}; - -// options - -program - .version(jade.version) - .usage('[options] [dir|file ...]') - .option('-o, --obj ', 'javascript options object') - .option('-O, --out ', 'output the compiled html to ') - .option('-p, --path ', 'filename used to resolve includes') - .option('-P, --pretty', 'compile pretty html output') - .option('-c, --client', 'compile function for client-side runtime.js') - .option('-D, --no-debug', 'compile without debugging (smaller functions)') - .option('-w, --watch', 'watch files for changes and automatically re-render') - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' # translate jade the templates dir'); - console.log(' $ jade templates'); - console.log(''); - console.log(' # create {foo,bar}.html'); - console.log(' $ jade {foo,bar}.jade'); - console.log(''); - console.log(' # jade over stdio'); - console.log(' $ jade < my.jade > my.html'); - console.log(''); - console.log(' # jade over stdio'); - console.log(' $ echo "h1 Jade!" | jade'); - console.log(''); - console.log(' # foo, bar dirs rendering to /tmp'); - console.log(' $ jade foo bar --out /tmp '); - console.log(''); -}); - -program.parse(process.argv); - -// options given, parse them - -if (program.obj) { - if (exists(program.obj)) { - options = JSON.parse(fs.readFileSync(program.obj)); - } else { - options = eval('(' + program.obj + ')'); - } -} - -// --filename - -if (program.path) options.filename = program.path; - -// --no-debug - -options.compileDebug = program.debug; - -// --client - -options.client = program.client; - -// --pretty - -options.pretty = program.pretty; - -// --watch - -options.watch = program.watch; - -// left-over args are file paths - -var files = program.args; - -// compile files - -if (files.length) { - console.log(); - files.forEach(renderFile); - if (options.watch) { - files.forEach(function (file) { - fs.watchFile(file, {interval: 100}, function (curr, prev) { - if (curr.mtime > prev.mtime) renderFile(file); - }); - }); - } - process.on('exit', function () { - console.log(); - }); -// stdio -} else { - stdin(); -} - -/** - * Compile from stdin. - */ - -function stdin() { - var buf = ''; - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(chunk){ buf += chunk; }); - process.stdin.on('end', function(){ - var fn = jade.compile(buf, options); - var output = options.client - ? fn.toString() - : fn(options); - process.stdout.write(output); - }).resume(); -} - -/** - * Process the given path, compiling the jade files found. - * Always walk the subdirectories. - */ - -function renderFile(path) { - var re = /\.jade$/; - fs.lstat(path, function(err, stat) { - if (err) throw err; - // Found jade file - if (stat.isFile() && re.test(path)) { - fs.readFile(path, 'utf8', function(err, str){ - if (err) throw err; - options.filename = path; - var fn = jade.compile(str, options); - var extname = options.client ? '.js' : '.html'; - path = path.replace(re, extname); - if (program.out) path = join(program.out, basename(path)); - var dir = resolve(dirname(path)); - mkdirp(dir, 0755, function(err){ - if (err) throw err; - var output = options.client - ? fn.toString() - : fn(options); - fs.writeFile(path, output, function(err){ - if (err) throw err; - console.log(' \033[90mrendered \033[36m%s\033[0m', path); - }); - }); - }); - // Found directory - } else if (stat.isDirectory()) { - fs.readdir(path, function(err, files) { - if (err) throw err; - files.map(function(filename) { - return path + '/' + filename; - }).forEach(renderFile); - }); - } - }); -} diff --git a/node_modules/jade/index.js b/node_modules/jade/index.js deleted file mode 100644 index 8ad059f..0000000 --- a/node_modules/jade/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.JADE_COV - ? require('./lib-cov/jade') - : require('./lib/jade'); \ No newline at end of file diff --git a/node_modules/jade/jade.js b/node_modules/jade/jade.js deleted file mode 100644 index ad22ec3..0000000 --- a/node_modules/jade/jade.js +++ /dev/null @@ -1,3654 +0,0 @@ -(function() { - -// CommonJS require() - -function require(p){ - 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.charAt(0)) 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("compiler.js", function(module, exports, require){ - -/*! - * Jade - Compiler - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('./nodes') - , filters = require('./filters') - , doctypes = require('./doctypes') - , selfClosing = require('./self-closing') - , runtime = require('./runtime') - , utils = require('./utils'); - - - if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } - } - - if (!String.prototype.trimLeft) { - String.prototype.trimLeft = function(){ - return this.replace(/^\s+/, ''); - } - } - - - -/** - * Initialize `Compiler` with the given `node`. - * - * @param {Node} node - * @param {Object} options - * @api public - */ - -var Compiler = module.exports = function Compiler(node, options) { - this.options = options = options || {}; - this.node = node; - this.hasCompiledDoctype = false; - this.hasCompiledTag = false; - this.pp = options.pretty || false; - this.debug = false !== options.compileDebug; - this.indents = 0; - this.parentIndents = 0; - if (options.doctype) this.setDoctype(options.doctype); -}; - -/** - * Compiler prototype. - */ - -Compiler.prototype = { - - /** - * Compile parse tree to JavaScript. - * - * @api public - */ - - compile: function(){ - this.buf = ['var interp;']; - if (this.pp) this.buf.push("var __indent = [];"); - this.lastBufferedIdx = -1; - this.visit(this.node); - return this.buf.join('\n'); - }, - - /** - * Sets the default doctype `name`. Sets terse mode to `true` when - * html 5 is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {string} name - * @api public - */ - - setDoctype: function(name){ - name = (name && name.toLowerCase()) || 'default'; - this.doctype = doctypes[name] || ''; - this.terse = this.doctype.toLowerCase() == ''; - this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) - this.prettyIndent(1, true); - - for (var i = 0; i < len; ++i) { - // Pretty print text - if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) - this.prettyIndent(1, false); - - this.visit(block.nodes[i]); - // Multiple text nodes are separated by newlines - if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) - this.buffer('\\n'); - } - }, - - /** - * Visit `doctype`. Sets terse mode to `true` when html 5 - * is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {Doctype} doctype - * @api public - */ - - visitDoctype: function(doctype){ - if (doctype && (doctype.val || !this.doctype)) { - this.setDoctype(doctype.val || 'default'); - } - - if (this.doctype) this.buffer(this.doctype); - this.hasCompiledDoctype = true; - }, - - /** - * Visit `mixin`, generating a function that - * may be called within the template. - * - * @param {Mixin} mixin - * @api public - */ - - visitMixin: function(mixin){ - var name = mixin.name.replace(/-/g, '_') + '_mixin' - , args = mixin.args || '' - , block = mixin.block - , attrs = mixin.attrs - , pp = this.pp; - - if (mixin.call) { - if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") - if (block || attrs.length) { - - this.buf.push(name + '.call({'); - - if (block) { - this.buf.push('block: function(){'); - - // Render block with no indents, dynamically added when rendered - this.parentIndents++; - var _indents = this.indents; - this.indents = 0; - this.visit(mixin.block); - this.indents = _indents; - this.parentIndents--; - - if (attrs.length) { - this.buf.push('},'); - } else { - this.buf.push('}'); - } - } - - if (attrs.length) { - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push('attributes: merge({' + val.buf - + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); - } else { - this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); - } - } - - if (args) { - this.buf.push('}, ' + args + ');'); - } else { - this.buf.push('});'); - } - - } else { - this.buf.push(name + '(' + args + ');'); - } - if (pp) this.buf.push("__indent.pop();") - } else { - this.buf.push('var ' + name + ' = function(' + args + '){'); - this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); - this.parentIndents++; - this.visit(block); - this.parentIndents--; - this.buf.push('};'); - } - }, - - /** - * Visit `tag` buffering tag markup, generating - * attributes, visiting the `tag`'s code and block. - * - * @param {Tag} tag - * @api public - */ - - visitTag: function(tag){ - this.indents++; - var name = tag.name - , pp = this.pp; - - if (tag.buffer) name = "' + (" + name + ") + '"; - - if (!this.hasCompiledTag) { - if (!this.hasCompiledDoctype && 'html' == name) { - this.visitDoctype(); - } - this.hasCompiledTag = true; - } - - // pretty print - if (pp && !tag.isInline()) - this.prettyIndent(0, true); - - if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { - this.buffer('<' + name); - this.visitAttributes(tag.attrs); - this.terse - ? this.buffer('>') - : this.buffer('/>'); - } else { - // Optimize attributes buffering - if (tag.attrs.length) { - this.buffer('<' + name); - if (tag.attrs.length) this.visitAttributes(tag.attrs); - this.buffer('>'); - } else { - this.buffer('<' + name + '>'); - } - if (tag.code) this.visitCode(tag.code); - this.escape = 'pre' == tag.name; - this.visit(tag.block); - - // pretty print - if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) - this.prettyIndent(0, true); - - this.buffer(''); - } - this.indents--; - }, - - /** - * Visit `filter`, throwing when the filter does not exist. - * - * @param {Filter} filter - * @api public - */ - - visitFilter: function(filter){ - var fn = filters[filter.name]; - - // unknown filter - if (!fn) { - if (filter.isASTFilter) { - throw new Error('unknown ast filter "' + filter.name + ':"'); - } else { - throw new Error('unknown filter ":' + filter.name + '"'); - } - } - - if (filter.isASTFilter) { - this.buf.push(fn(filter.block, this, filter.attrs)); - } else { - var text = filter.block.nodes.map(function(node){ return node.val }).join('\n'); - filter.attrs = filter.attrs || {}; - filter.attrs.filename = this.options.filename; - this.buffer(utils.text(fn(text, filter.attrs))); - } - }, - - /** - * Visit `text` node. - * - * @param {Text} text - * @api public - */ - - visitText: function(text){ - text = utils.text(text.val.replace(/\\/g, '_SLASH_')); - if (this.escape) text = escape(text); - text = text.replace(/_SLASH_/g, '\\\\'); - this.buffer(text); - }, - - /** - * Visit a `comment`, only buffering when the buffer flag is set. - * - * @param {Comment} comment - * @api public - */ - - visitComment: function(comment){ - if (!comment.buffer) return; - if (this.pp) this.prettyIndent(1, true); - this.buffer(''); - }, - - /** - * Visit a `BlockComment`. - * - * @param {Comment} comment - * @api public - */ - - visitBlockComment: function(comment){ - if (!comment.buffer) return; - if (0 == comment.val.trim().indexOf('if')) { - this.buffer(''); - } else { - this.buffer(''); - } - }, - - /** - * Visit `code`, respecting buffer / escape flags. - * If the code is followed by a block, wrap it in - * a self-calling function. - * - * @param {Code} code - * @api public - */ - - visitCode: function(code){ - // Wrap code blocks with {}. - // we only wrap unbuffered code blocks ATM - // since they are usually flow control - - // Buffer code - if (code.buffer) { - var val = code.val.trimLeft(); - this.buf.push('var __val__ = ' + val); - val = 'null == __val__ ? "" : __val__'; - if (code.escape) val = 'escape(' + val + ')'; - this.buf.push("buf.push(" + val + ");"); - } else { - this.buf.push(code.val); - } - - // Block support - if (code.block) { - if (!code.buffer) this.buf.push('{'); - this.visit(code.block); - if (!code.buffer) this.buf.push('}'); - } - }, - - /** - * Visit `each` block. - * - * @param {Each} each - * @api public - */ - - visitEach: function(each){ - this.buf.push('' - + '// iterate ' + each.obj + '\n' - + ';(function(){\n' - + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); - - if (each.alternative) { - this.buf.push(' if (' + each.obj + '.length) {'); - } - - this.buf.push('' - + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - if (each.alternative) { - this.buf.push(' } else {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - - this.buf.push('' - + ' } else {\n' - + ' var $$l = 0;\n' - + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' - + ' $$l++;' - + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - this.buf.push(' }\n'); - if (each.alternative) { - this.buf.push(' if ($$l === 0) {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - this.buf.push(' }\n}).call(this);\n'); - }, - - /** - * Visit `attrs`. - * - * @param {Array} attrs - * @api public - */ - - visitAttributes: function(attrs){ - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push("buf.push(attrs(merge({ " + val.buf + - " }, attributes), merge(" + val.escaped + ", escaped, true)));"); - } else if (val.constant) { - eval('var buf={' + val.buf + '};'); - this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); - } else { - this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); - } - }, - - /** - * Compile attributes. - */ - - attrs: function(attrs){ - var buf = [] - , classes = [] - , escaped = {} - , constant = attrs.every(function(attr){ return isConstant(attr.val) }) - , inherits = false; - - if (this.terse) buf.push('terse: true'); - - attrs.forEach(function(attr){ - if (attr.name == 'attributes') return inherits = true; - escaped[attr.name] = attr.escaped; - if (attr.name == 'class') { - classes.push('(' + attr.val + ')'); - } else { - var pair = "'" + attr.name + "':(" + attr.val + ')'; - buf.push(pair); - } - }); - - if (classes.length) { - classes = classes.join(" + ' ' + "); - buf.push("class: " + classes); - } - - return { - buf: buf.join(', ').replace('class:', '"class":'), - escaped: JSON.stringify(escaped), - inherits: inherits, - constant: constant - }; - } -}; - -/** - * Check if expression can be evaluated to a constant - * - * @param {String} expression - * @return {Boolean} - * @api private - */ - -function isConstant(val){ - // Check strings/literals - if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) - return true; - - // Check numbers - if (!isNaN(Number(val))) - return true; - - // Check arrays - var matches; - if (matches = /^ *\[(.*)\] *$/.exec(val)) - return matches[1].split(',').every(isConstant); - - return false; -} - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -function escape(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -} - -}); // module: compiler.js - -require.register("doctypes.js", function(module, exports, require){ - -/*! - * Jade - doctypes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - '5': '' - , 'default': '' - , 'xml': '' - , 'transitional': '' - , 'strict': '' - , 'frameset': '' - , '1.1': '' - , 'basic': '' - , 'mobile': '' -}; -}); // module: doctypes.js - -require.register("filters.js", function(module, exports, require){ - -/*! - * Jade - filters - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - - /** - * Wrap text with CDATA block. - */ - - cdata: function(str){ - return ''; - }, - - /** - * Transform sass to css, wrapped in style tags. - */ - - sass: function(str){ - str = str.replace(/\\n/g, '\n'); - var sass = require('sass').render(str).replace(/\n/g, '\\n'); - return ''; - }, - - /** - * Transform stylus to css, wrapped in style tags. - */ - - stylus: function(str, options){ - var ret; - str = str.replace(/\\n/g, '\n'); - var stylus = require('stylus'); - stylus(str, options).render(function(err, css){ - if (err) throw err; - ret = css.replace(/\n/g, '\\n'); - }); - return ''; - }, - - /** - * Transform less to css, wrapped in style tags. - */ - - less: function(str){ - var ret; - str = str.replace(/\\n/g, '\n'); - require('less').render(str, function(err, css){ - if (err) throw err; - ret = ''; - }); - return ret; - }, - - /** - * Transform markdown to html. - */ - - markdown: function(str){ - var md; - - // support markdown / discount - try { - md = require('markdown'); - } catch (err){ - try { - md = require('discount'); - } catch (err) { - try { - md = require('markdown-js'); - } catch (err) { - try { - md = require('marked'); - } catch (err) { - throw new - Error('Cannot find markdown library, install markdown, discount, or marked.'); - } - } - } - } - - str = str.replace(/\\n/g, '\n'); - return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); - }, - - /** - * Transform coffeescript to javascript. - */ - - coffeescript: function(str){ - var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); - return ''; - } -}; - -}); // module: filters.js - -require.register("inline-tags.js", function(module, exports, require){ - -/*! - * Jade - inline tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'a' - , 'abbr' - , 'acronym' - , 'b' - , 'br' - , 'code' - , 'em' - , 'font' - , 'i' - , 'img' - , 'ins' - , 'kbd' - , 'map' - , 'samp' - , 'small' - , 'span' - , 'strong' - , 'sub' - , 'sup' -]; -}); // module: inline-tags.js - -require.register("jade.js", function(module, exports, require){ -/*! - * Jade - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Parser = require('./parser') - , Lexer = require('./lexer') - , Compiler = require('./compiler') - , runtime = require('./runtime') - -/** - * Library version. - */ - -exports.version = '0.27.6'; - -/** - * Expose self closing tags. - */ - -exports.selfClosing = require('./self-closing'); - -/** - * Default supported doctypes. - */ - -exports.doctypes = require('./doctypes'); - -/** - * Text filters. - */ - -exports.filters = require('./filters'); - -/** - * Utilities. - */ - -exports.utils = require('./utils'); - -/** - * Expose `Compiler`. - */ - -exports.Compiler = Compiler; - -/** - * Expose `Parser`. - */ - -exports.Parser = Parser; - -/** - * Expose `Lexer`. - */ - -exports.Lexer = Lexer; - -/** - * Nodes. - */ - -exports.nodes = require('./nodes'); - -/** - * Jade runtime helpers. - */ - -exports.runtime = runtime; - -/** - * Template function cache. - */ - -exports.cache = {}; - -/** - * Parse the given `str` of jade and return a function body. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -function parse(str, options){ - try { - // Parse - var parser = new Parser(str, options.filename, options); - - // Compile - var compiler = new (options.compiler || Compiler)(parser.parse(), options) - , js = compiler.compile(); - - // Debug compiler - if (options.debug) { - console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); - } - - return '' - + 'var buf = [];\n' - + (options.self - ? 'var self = locals || {};\n' + js - : 'with (locals || {}) {\n' + js + '\n}\n') - + 'return buf.join("");'; - } catch (err) { - parser = parser.context(); - runtime.rethrow(err, parser.filename, parser.lexer.lineno); - } -} - -/** - * Strip any UTF-8 BOM off of the start of `str`, if it exists. - * - * @param {String} str - * @return {String} - * @api private - */ - -function stripBOM(str){ - return 0xFEFF == str.charCodeAt(0) - ? str.substring(1) - : str; -} - -/** - * Compile a `Function` representation of the given jade `str`. - * - * Options: - * - * - `compileDebug` when `false` debugging code is stripped from the compiled template - * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` - * for use with the Jade client-side runtime.js - * - * @param {String} str - * @param {Options} options - * @return {Function} - * @api public - */ - -exports.compile = function(str, options){ - var options = options || {} - , client = options.client - , filename = options.filename - ? JSON.stringify(options.filename) - : 'undefined' - , fn; - - str = stripBOM(String(str)); - - if (options.compileDebug !== false) { - fn = [ - 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' - , 'try {' - , parse(str, options) - , '} catch (err) {' - , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' - , '}' - ].join('\n'); - } else { - fn = parse(str, options); - } - - if (client) { - fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; - } - - fn = new Function('locals, attrs, escape, rethrow, merge', fn); - - if (client) return fn; - - return function(locals){ - return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); - }; -}; - -/** - * Render the given `str` of jade and invoke - * the callback `fn(err, str)`. - * - * Options: - * - * - `cache` enable template caching - * - `filename` filename required for `include` / `extends` and caching - * - * @param {String} str - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -exports.render = function(str, options, fn){ - // swap args - if ('function' == typeof options) { - fn = options, options = {}; - } - - // cache requires .filename - if (options.cache && !options.filename) { - return fn(new Error('the "filename" option is required for caching')); - } - - try { - var path = options.filename; - var tmpl = options.cache - ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) - : exports.compile(str, options); - fn(null, tmpl(options)); - } catch (err) { - fn(err); - } -}; - -/** - * Render a Jade 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 = {}; - } - - try { - options.filename = path; - var str = options.cache - ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) - : fs.readFileSync(path, 'utf8'); - exports.render(str, options, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Express support. - */ - -exports.__express = exports.renderFile; - -}); // module: jade.js - -require.register("lexer.js", function(module, exports, require){ -/*! - * Jade - Lexer - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -var utils = require('./utils'); - -/** - * Initialize `Lexer` with the given `str`. - * - * Options: - * - * - `colons` allow colons for attr delimiters - * - * @param {String} str - * @param {Object} options - * @api private - */ - -var Lexer = module.exports = function Lexer(str, options) { - options = options || {}; - this.input = str.replace(/\r\n|\r/g, '\n'); - this.colons = options.colons; - this.deferredTokens = []; - this.lastIndents = 0; - this.lineno = 1; - this.stash = []; - this.indentStack = []; - this.indentRe = null; - this.pipeless = false; -}; - -/** - * Lexer prototype. - */ - -Lexer.prototype = { - - /** - * Construct a token with the given `type` and `val`. - * - * @param {String} type - * @param {String} val - * @return {Object} - * @api private - */ - - tok: function(type, val){ - return { - type: type - , line: this.lineno - , val: val - } - }, - - /** - * Consume the given `len` of input. - * - * @param {Number} len - * @api private - */ - - consume: function(len){ - this.input = this.input.substr(len); - }, - - /** - * Scan for `type` with the given `regexp`. - * - * @param {String} type - * @param {RegExp} regexp - * @return {Object} - * @api private - */ - - scan: function(regexp, type){ - var captures; - if (captures = regexp.exec(this.input)) { - this.consume(captures[0].length); - return this.tok(type, captures[1]); - } - }, - - /** - * Defer the given `tok`. - * - * @param {Object} tok - * @api private - */ - - defer: function(tok){ - this.deferredTokens.push(tok); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - var fetch = n - this.stash.length; - while (fetch-- > 0) this.stash.push(this.next()); - return this.stash[--n]; - }, - - /** - * Return the indexOf `start` / `end` delimiters. - * - * @param {String} start - * @param {String} end - * @return {Number} - * @api private - */ - - indexOfDelimiters: function(start, end){ - var str = this.input - , nstart = 0 - , nend = 0 - , pos = 0; - for (var i = 0, len = str.length; i < len; ++i) { - if (start == str.charAt(i)) { - ++nstart; - } else if (end == str.charAt(i)) { - if (++nend == nstart) { - pos = i; - break; - } - } - } - return pos; - }, - - /** - * Stashed token. - */ - - stashed: function() { - return this.stash.length - && this.stash.shift(); - }, - - /** - * Deferred token. - */ - - deferred: function() { - return this.deferredTokens.length - && this.deferredTokens.shift(); - }, - - /** - * end-of-source. - */ - - eos: function() { - if (this.input.length) return; - if (this.indentStack.length) { - this.indentStack.shift(); - return this.tok('outdent'); - } else { - return this.tok('eos'); - } - }, - - /** - * Blank line. - */ - - blank: function() { - var captures; - if (captures = /^\n *\n/.exec(this.input)) { - this.consume(captures[0].length - 1); - - ++this.lineno; - if (this.pipeless) return this.tok('text', ''); - return this.next(); - } - }, - - /** - * Comment. - */ - - comment: function() { - var captures; - if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('comment', captures[2]); - tok.buffer = '-' != captures[1]; - return tok; - } - }, - - /** - * Interpolated tag. - */ - - interpolation: function() { - var captures; - if (captures = /^#\{(.*?)\}/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('interpolation', captures[1]); - } - }, - - /** - * Tag. - */ - - tag: function() { - var captures; - if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { - this.consume(captures[0].length); - var tok, name = captures[1]; - if (':' == name[name.length - 1]) { - name = name.slice(0, -1); - tok = this.tok('tag', name); - this.defer(this.tok(':')); - while (' ' == this.input[0]) this.input = this.input.substr(1); - } else { - tok = this.tok('tag', name); - } - tok.selfClosing = !! captures[2]; - return tok; - } - }, - - /** - * Filter. - */ - - filter: function() { - return this.scan(/^:(\w+)/, 'filter'); - }, - - /** - * Doctype. - */ - - doctype: function() { - return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); - }, - - /** - * Id. - */ - - id: function() { - return this.scan(/^#([\w-]+)/, 'id'); - }, - - /** - * Class. - */ - - className: function() { - return this.scan(/^\.([\w-]+)/, 'class'); - }, - - /** - * Text. - */ - - text: function() { - return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); - }, - - /** - * Extends. - */ - - "extends": function() { - return this.scan(/^extends? +([^\n]+)/, 'extends'); - }, - - /** - * Block prepend. - */ - - prepend: function() { - var captures; - if (captures = /^prepend +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'prepend' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block append. - */ - - append: function() { - var captures; - if (captures = /^append +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'append' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block. - */ - - block: function() { - var captures; - if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = captures[1] || 'replace' - , name = captures[2] - , tok = this.tok('block', name); - - tok.mode = mode; - return tok; - } - }, - - /** - * Yield. - */ - - yield: function() { - return this.scan(/^yield */, 'yield'); - }, - - /** - * Include. - */ - - include: function() { - return this.scan(/^include +([^\n]+)/, 'include'); - }, - - /** - * Case. - */ - - "case": function() { - return this.scan(/^case +([^\n]+)/, 'case'); - }, - - /** - * When. - */ - - when: function() { - return this.scan(/^when +([^:\n]+)/, 'when'); - }, - - /** - * Default. - */ - - "default": function() { - return this.scan(/^default */, 'default'); - }, - - /** - * Assignment. - */ - - assignment: function() { - var captures; - if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { - this.consume(captures[0].length); - var name = captures[1] - , val = captures[2]; - return this.tok('code', 'var ' + name + ' = (' + val + ');'); - } - }, - - /** - * Call mixin. - */ - - call: function(){ - var captures; - if (captures = /^\+([-\w]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('call', captures[1]); - - // Check for args (not attributes) - if (captures = /^ *\((.*?)\)/.exec(this.input)) { - if (!/^ *[-\w]+ *=/.test(captures[1])) { - this.consume(captures[0].length); - tok.args = captures[1]; - } - } - - return tok; - } - }, - - /** - * Mixin. - */ - - mixin: function(){ - var captures; - if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('mixin', captures[1]); - tok.args = captures[2]; - return tok; - } - }, - - /** - * Conditional. - */ - - conditional: function() { - var captures; - if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var type = captures[1] - , js = captures[2]; - - switch (type) { - case 'if': js = 'if (' + js + ')'; break; - case 'unless': js = 'if (!(' + js + '))'; break; - case 'else if': js = 'else if (' + js + ')'; break; - case 'else': js = 'else'; break; - } - - return this.tok('code', js); - } - }, - - /** - * While. - */ - - "while": function() { - var captures; - if (captures = /^while +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('code', 'while (' + captures[1] + ')'); - } - }, - - /** - * Each. - */ - - each: function() { - var captures; - if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('each', captures[1]); - tok.key = captures[2] || '$index'; - tok.code = captures[3]; - return tok; - } - }, - - /** - * Code. - */ - - code: function() { - var captures; - if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var flags = captures[1]; - captures[1] = captures[2]; - var tok = this.tok('code', captures[1]); - tok.escape = flags.charAt(0) === '='; - tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; - return tok; - } - }, - - /** - * Attributes. - */ - - attrs: function() { - if ('(' == this.input.charAt(0)) { - var index = this.indexOfDelimiters('(', ')') - , str = this.input.substr(1, index-1) - , tok = this.tok('attrs') - , len = str.length - , colons = this.colons - , states = ['key'] - , escapedAttr - , key = '' - , val = '' - , quote - , c - , p; - - function state(){ - return states[states.length - 1]; - } - - function interpolate(attr) { - return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ - return escape - ? _ - : quote + " + (" + expr + ") + " + quote; - }); - } - - this.consume(index + 1); - tok.attrs = {}; - tok.escaped = {}; - - function parse(c) { - var real = c; - // TODO: remove when people fix ":" - if (colons && ':' == c) c = '='; - switch (c) { - case ',': - case '\n': - switch (state()) { - case 'expr': - case 'array': - case 'string': - case 'object': - val += c; - break; - default: - states.push('key'); - val = val.trim(); - key = key.trim(); - if ('' == key) return; - key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); - tok.escaped[key] = escapedAttr; - tok.attrs[key] = '' == val - ? true - : interpolate(val); - key = val = ''; - } - break; - case '=': - switch (state()) { - case 'key char': - key += real; - break; - case 'val': - case 'expr': - case 'array': - case 'string': - case 'object': - val += real; - break; - default: - escapedAttr = '!' != p; - states.push('val'); - } - break; - case '(': - if ('val' == state() - || 'expr' == state()) states.push('expr'); - val += c; - break; - case ')': - if ('expr' == state() - || 'val' == state()) states.pop(); - val += c; - break; - case '{': - if ('val' == state()) states.push('object'); - val += c; - break; - case '}': - if ('object' == state()) states.pop(); - val += c; - break; - case '[': - if ('val' == state()) states.push('array'); - val += c; - break; - case ']': - if ('array' == state()) states.pop(); - val += c; - break; - case '"': - case "'": - switch (state()) { - case 'key': - states.push('key char'); - break; - case 'key char': - states.pop(); - break; - case 'string': - if (c == quote) states.pop(); - val += c; - break; - default: - states.push('string'); - val += c; - quote = c; - } - break; - case '': - break; - default: - switch (state()) { - case 'key': - case 'key char': - key += c; - break; - default: - val += c; - } - } - p = c; - } - - for (var i = 0; i < len; ++i) { - parse(str.charAt(i)); - } - - parse(','); - - if ('/' == this.input.charAt(0)) { - this.consume(1); - tok.selfClosing = true; - } - - return tok; - } - }, - - /** - * Indent | Outdent | Newline. - */ - - indent: function() { - var captures, re; - - // established regexp - if (this.indentRe) { - captures = this.indentRe.exec(this.input); - // determine regexp - } else { - // tabs - re = /^\n(\t*) */; - captures = re.exec(this.input); - - // spaces - if (captures && !captures[1].length) { - re = /^\n( *)/; - captures = re.exec(this.input); - } - - // established - if (captures && captures[1].length) this.indentRe = re; - } - - if (captures) { - var tok - , indents = captures[1].length; - - ++this.lineno; - this.consume(indents + 1); - - if (' ' == this.input[0] || '\t' == this.input[0]) { - throw new Error('Invalid indentation, you can use tabs or spaces but not both'); - } - - // blank line - if ('\n' == this.input[0]) return this.tok('newline'); - - // outdent - if (this.indentStack.length && indents < this.indentStack[0]) { - while (this.indentStack.length && this.indentStack[0] > indents) { - this.stash.push(this.tok('outdent')); - this.indentStack.shift(); - } - tok = this.stash.pop(); - // indent - } else if (indents && indents != this.indentStack[0]) { - this.indentStack.unshift(indents); - tok = this.tok('indent', indents); - // newline - } else { - tok = this.tok('newline'); - } - - return tok; - } - }, - - /** - * Pipe-less text consumed only when - * pipeless is true; - */ - - pipelessText: function() { - if (this.pipeless) { - if ('\n' == this.input[0]) return; - var i = this.input.indexOf('\n'); - if (-1 == i) i = this.input.length; - var str = this.input.substr(0, i); - this.consume(str.length); - return this.tok('text', str); - } - }, - - /** - * ':' - */ - - colon: function() { - return this.scan(/^: */, ':'); - }, - - /** - * Return the next token object, or those - * previously stashed by lookahead. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.stashed() - || this.next(); - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - next: function() { - return this.deferred() - || this.blank() - || this.eos() - || this.pipelessText() - || this.yield() - || this.doctype() - || this.interpolation() - || this["case"]() - || this.when() - || this["default"]() - || this["extends"]() - || this.append() - || this.prepend() - || this.block() - || this.include() - || this.mixin() - || this.call() - || this.conditional() - || this.each() - || this["while"]() - || this.assignment() - || this.tag() - || this.filter() - || this.code() - || this.id() - || this.className() - || this.attrs() - || this.indent() - || this.comment() - || this.colon() - || this.text(); - } -}; - -}); // module: lexer.js - -require.register("nodes/attrs.js", function(module, exports, require){ - -/*! - * Jade - nodes - Attrs - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'), - Block = require('./block'); - -/** - * Initialize a `Attrs` node. - * - * @api public - */ - -var Attrs = module.exports = function Attrs() { - this.attrs = []; -}; - -/** - * Inherit from `Node`. - */ - -Attrs.prototype = new Node; -Attrs.prototype.constructor = Attrs; - - -/** - * Set attribute `name` to `val`, keep in mind these become - * part of a raw js object literal, so to quote a value you must - * '"quote me"', otherwise or example 'user.name' is literal JavaScript. - * - * @param {String} name - * @param {String} val - * @param {Boolean} escaped - * @return {Tag} for chaining - * @api public - */ - -Attrs.prototype.setAttribute = function(name, val, escaped){ - this.attrs.push({ name: name, val: val, escaped: escaped }); - return this; -}; - -/** - * Remove attribute `name` when present. - * - * @param {String} name - * @api public - */ - -Attrs.prototype.removeAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - delete this.attrs[i]; - } - } -}; - -/** - * Get attribute value by `name`. - * - * @param {String} name - * @return {String} - * @api public - */ - -Attrs.prototype.getAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - return this.attrs[i].val; - } - } -}; - -}); // module: nodes/attrs.js - -require.register("nodes/block-comment.js", function(module, exports, require){ - -/*! - * Jade - nodes - BlockComment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `BlockComment` with the given `block`. - * - * @param {String} val - * @param {Block} block - * @param {Boolean} buffer - * @api public - */ - -var BlockComment = module.exports = function BlockComment(val, block, buffer) { - this.block = block; - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -BlockComment.prototype = new Node; -BlockComment.prototype.constructor = BlockComment; - -}); // module: nodes/block-comment.js - -require.register("nodes/block.js", function(module, exports, require){ - -/*! - * Jade - nodes - Block - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Block` with an optional `node`. - * - * @param {Node} node - * @api public - */ - -var Block = module.exports = function Block(node){ - this.nodes = []; - if (node) this.push(node); -}; - -/** - * Inherit from `Node`. - */ - -Block.prototype = new Node; -Block.prototype.constructor = Block; - - -/** - * Block flag. - */ - -Block.prototype.isBlock = true; - -/** - * Replace the nodes in `other` with the nodes - * in `this` block. - * - * @param {Block} other - * @api private - */ - -Block.prototype.replace = function(other){ - other.nodes = this.nodes; -}; - -/** - * Pust the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.push = function(node){ - return this.nodes.push(node); -}; - -/** - * Check if this block is empty. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.isEmpty = function(){ - return 0 == this.nodes.length; -}; - -/** - * Unshift the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.unshift = function(node){ - return this.nodes.unshift(node); -}; - -/** - * Return the "last" block, or the first `yield` node. - * - * @return {Block} - * @api private - */ - -Block.prototype.includeBlock = function(){ - var ret = this - , node; - - for (var i = 0, len = this.nodes.length; i < len; ++i) { - node = this.nodes[i]; - if (node.yield) return node; - else if (node.textOnly) continue; - else if (node.includeBlock) ret = node.includeBlock(); - else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); - if (ret.yield) return ret; - } - - return ret; -}; - -/** - * Return a clone of this block. - * - * @return {Block} - * @api private - */ - -Block.prototype.clone = function(){ - var clone = new Block; - for (var i = 0, len = this.nodes.length; i < len; ++i) { - clone.push(this.nodes[i].clone()); - } - return clone; -}; - - -}); // module: nodes/block.js - -require.register("nodes/case.js", function(module, exports, require){ - -/*! - * Jade - nodes - Case - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Case` with `expr`. - * - * @param {String} expr - * @api public - */ - -var Case = exports = module.exports = function Case(expr, block){ - this.expr = expr; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Case.prototype = new Node; -Case.prototype.constructor = Case; - - -var When = exports.When = function When(expr, block){ - this.expr = expr; - this.block = block; - this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -When.prototype = new Node; -When.prototype.constructor = When; - - - -}); // module: nodes/case.js - -require.register("nodes/code.js", function(module, exports, require){ - -/*! - * Jade - nodes - Code - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Code` node with the given code `val`. - * Code may also be optionally buffered and escaped. - * - * @param {String} val - * @param {Boolean} buffer - * @param {Boolean} escape - * @api public - */ - -var Code = module.exports = function Code(val, buffer, escape) { - this.val = val; - this.buffer = buffer; - this.escape = escape; - if (val.match(/^ *else/)) this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -Code.prototype = new Node; -Code.prototype.constructor = Code; - -}); // module: nodes/code.js - -require.register("nodes/comment.js", function(module, exports, require){ - -/*! - * Jade - nodes - Comment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Comment` with the given `val`, optionally `buffer`, - * otherwise the comment may render in the output. - * - * @param {String} val - * @param {Boolean} buffer - * @api public - */ - -var Comment = module.exports = function Comment(val, buffer) { - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -Comment.prototype = new Node; -Comment.prototype.constructor = Comment; - -}); // module: nodes/comment.js - -require.register("nodes/doctype.js", function(module, exports, require){ - -/*! - * Jade - nodes - Doctype - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Doctype` with the given `val`. - * - * @param {String} val - * @api public - */ - -var Doctype = module.exports = function Doctype(val) { - this.val = val; -}; - -/** - * Inherit from `Node`. - */ - -Doctype.prototype = new Node; -Doctype.prototype.constructor = Doctype; - -}); // module: nodes/doctype.js - -require.register("nodes/each.js", function(module, exports, require){ - -/*! - * Jade - nodes - Each - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize an `Each` node, representing iteration - * - * @param {String} obj - * @param {String} val - * @param {String} key - * @param {Block} block - * @api public - */ - -var Each = module.exports = function Each(obj, val, key, block) { - this.obj = obj; - this.val = val; - this.key = key; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Each.prototype = new Node; -Each.prototype.constructor = Each; - -}); // module: nodes/each.js - -require.register("nodes/filter.js", function(module, exports, require){ - -/*! - * Jade - nodes - Filter - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , Block = require('./block'); - -/** - * Initialize a `Filter` node with the given - * filter `name` and `block`. - * - * @param {String} name - * @param {Block|Node} block - * @api public - */ - -var Filter = module.exports = function Filter(name, block, attrs) { - this.name = name; - this.block = block; - this.attrs = attrs; - this.isASTFilter = !block.nodes.every(function(node){ return node.isText }); -}; - -/** - * Inherit from `Node`. - */ - -Filter.prototype = new Node; -Filter.prototype.constructor = Filter; - -}); // module: nodes/filter.js - -require.register("nodes/index.js", function(module, exports, require){ - -/*! - * Jade - nodes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -exports.Node = require('./node'); -exports.Tag = require('./tag'); -exports.Code = require('./code'); -exports.Each = require('./each'); -exports.Case = require('./case'); -exports.Text = require('./text'); -exports.Block = require('./block'); -exports.Mixin = require('./mixin'); -exports.Filter = require('./filter'); -exports.Comment = require('./comment'); -exports.Literal = require('./literal'); -exports.BlockComment = require('./block-comment'); -exports.Doctype = require('./doctype'); - -}); // module: nodes/index.js - -require.register("nodes/literal.js", function(module, exports, require){ - -/*! - * Jade - nodes - Literal - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Literal` node with the given `str. - * - * @param {String} str - * @api public - */ - -var Literal = module.exports = function Literal(str) { - this.str = str - .replace(/\\/g, "\\\\") - .replace(/\n|\r\n/g, "\\n") - .replace(/'/g, "\\'"); -}; - -/** - * Inherit from `Node`. - */ - -Literal.prototype = new Node; -Literal.prototype.constructor = Literal; - - -}); // module: nodes/literal.js - -require.register("nodes/mixin.js", function(module, exports, require){ - -/*! - * Jade - nodes - Mixin - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'); - -/** - * Initialize a new `Mixin` with `name` and `block`. - * - * @param {String} name - * @param {String} args - * @param {Block} block - * @api public - */ - -var Mixin = module.exports = function Mixin(name, args, block, call){ - this.name = name; - this.args = args; - this.block = block; - this.attrs = []; - this.call = call; -}; - -/** - * Inherit from `Attrs`. - */ - -Mixin.prototype = new Attrs; -Mixin.prototype.constructor = Mixin; - - - -}); // module: nodes/mixin.js - -require.register("nodes/node.js", function(module, exports, require){ - -/*! - * Jade - nodes - Node - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Initialize a `Node`. - * - * @api public - */ - -var Node = module.exports = function Node(){}; - -/** - * Clone this node (return itself) - * - * @return {Node} - * @api private - */ - -Node.prototype.clone = function(){ - return this; -}; - -}); // module: nodes/node.js - -require.register("nodes/tag.js", function(module, exports, require){ - -/*! - * Jade - nodes - Tag - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'), - Block = require('./block'), - inlineTags = require('../inline-tags'); - -/** - * Initialize a `Tag` node with the given tag `name` and optional `block`. - * - * @param {String} name - * @param {Block} block - * @api public - */ - -var Tag = module.exports = function Tag(name, block) { - this.name = name; - this.attrs = []; - this.block = block || new Block; -}; - -/** - * Inherit from `Attrs`. - */ - -Tag.prototype = new Attrs; -Tag.prototype.constructor = Tag; - - -/** - * Clone this tag. - * - * @return {Tag} - * @api private - */ - -Tag.prototype.clone = function(){ - var clone = new Tag(this.name, this.block.clone()); - clone.line = this.line; - clone.attrs = this.attrs; - clone.textOnly = this.textOnly; - return clone; -}; - -/** - * Check if this tag is an inline tag. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.isInline = function(){ - return ~inlineTags.indexOf(this.name); -}; - -/** - * Check if this tag's contents can be inlined. Used for pretty printing. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.canInline = function(){ - var nodes = this.block.nodes; - - function isInline(node){ - // Recurse if the node is a block - if (node.isBlock) return node.nodes.every(isInline); - return node.isText || (node.isInline && node.isInline()); - } - - // Empty tag - if (!nodes.length) return true; - - // Text-only or inline-only tag - if (1 == nodes.length) return isInline(nodes[0]); - - // Multi-line inline-only tag - if (this.block.nodes.every(isInline)) { - for (var i = 1, len = nodes.length; i < len; ++i) { - if (nodes[i-1].isText && nodes[i].isText) - return false; - } - return true; - } - - // Mixed tag - return false; -}; -}); // module: nodes/tag.js - -require.register("nodes/text.js", function(module, exports, require){ - -/*! - * Jade - nodes - Text - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Text` node with optional `line`. - * - * @param {String} line - * @api public - */ - -var Text = module.exports = function Text(line) { - this.val = ''; - if ('string' == typeof line) this.val = line; -}; - -/** - * Inherit from `Node`. - */ - -Text.prototype = new Node; -Text.prototype.constructor = Text; - - -/** - * Flag as text. - */ - -Text.prototype.isText = true; -}); // module: nodes/text.js - -require.register("parser.js", function(module, exports, require){ - -/*! - * Jade - Parser - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Lexer = require('./lexer') - , nodes = require('./nodes') - , utils = require('./utils'); - -/** - * Initialize `Parser` with the given input `str` and `filename`. - * - * @param {String} str - * @param {String} filename - * @param {Object} options - * @api public - */ - -var Parser = exports = module.exports = function Parser(str, filename, options){ - this.input = str; - this.lexer = new Lexer(str, options); - this.filename = filename; - this.blocks = {}; - this.mixins = {}; - this.options = options; - this.contexts = [this]; -}; - -/** - * Tags that may not contain tags. - */ - -var textOnly = exports.textOnly = ['script', 'style']; - -/** - * Parser prototype. - */ - -Parser.prototype = { - - /** - * Push `parser` onto the context stack, - * or pop and return a `Parser`. - */ - - context: function(parser){ - if (parser) { - this.contexts.push(parser); - } else { - return this.contexts.pop(); - } - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.lexer.advance(); - }, - - /** - * Skip `n` tokens. - * - * @param {Number} n - * @api private - */ - - skip: function(n){ - while (n--) this.advance(); - }, - - /** - * Single token lookahead. - * - * @return {Object} - * @api private - */ - - peek: function() { - return this.lookahead(1); - }, - - /** - * Return lexer lineno. - * - * @return {Number} - * @api private - */ - - line: function() { - return this.lexer.lineno; - }, - - /** - * `n` token lookahead. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - return this.lexer.lookahead(n); - }, - - /** - * Parse input returning a string of js for evaluation. - * - * @return {String} - * @api public - */ - - parse: function(){ - var block = new nodes.Block, parser; - block.line = this.line(); - - while ('eos' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - - if (parser = this.extending) { - this.context(parser); - var ast = parser.parse(); - this.context(); - // hoist mixins - for (var name in this.mixins) - ast.unshift(this.mixins[name]); - return ast; - } - - return block; - }, - - /** - * Expect the given type, or throw an exception. - * - * @param {String} type - * @api private - */ - - expect: function(type){ - if (this.peek().type === type) { - return this.advance(); - } else { - throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); - } - }, - - /** - * Accept the given `type`. - * - * @param {String} type - * @api private - */ - - accept: function(type){ - if (this.peek().type === type) { - return this.advance(); - } - }, - - /** - * tag - * | doctype - * | mixin - * | include - * | filter - * | comment - * | text - * | each - * | code - * | yield - * | id - * | class - * | interpolation - */ - - parseExpr: function(){ - switch (this.peek().type) { - case 'tag': - return this.parseTag(); - case 'mixin': - return this.parseMixin(); - case 'block': - return this.parseBlock(); - case 'case': - return this.parseCase(); - case 'when': - return this.parseWhen(); - case 'default': - return this.parseDefault(); - case 'extends': - return this.parseExtends(); - case 'include': - return this.parseInclude(); - case 'doctype': - return this.parseDoctype(); - case 'filter': - return this.parseFilter(); - case 'comment': - return this.parseComment(); - case 'text': - return this.parseText(); - case 'each': - return this.parseEach(); - case 'code': - return this.parseCode(); - case 'call': - return this.parseCall(); - case 'interpolation': - return this.parseInterpolation(); - case 'yield': - this.advance(); - var block = new nodes.Block; - block.yield = true; - return block; - case 'id': - case 'class': - var tok = this.advance(); - this.lexer.defer(this.lexer.tok('tag', 'div')); - this.lexer.defer(tok); - return this.parseExpr(); - default: - throw new Error('unexpected token "' + this.peek().type + '"'); - } - }, - - /** - * Text - */ - - parseText: function(){ - var tok = this.expect('text') - , node = new nodes.Text(tok.val); - node.line = this.line(); - return node; - }, - - /** - * ':' expr - * | block - */ - - parseBlockExpansion: function(){ - if (':' == this.peek().type) { - this.advance(); - return new nodes.Block(this.parseExpr()); - } else { - return this.block(); - } - }, - - /** - * case - */ - - parseCase: function(){ - var val = this.expect('case').val - , node = new nodes.Case(val); - node.line = this.line(); - node.block = this.block(); - return node; - }, - - /** - * when - */ - - parseWhen: function(){ - var val = this.expect('when').val - return new nodes.Case.When(val, this.parseBlockExpansion()); - }, - - /** - * default - */ - - parseDefault: function(){ - this.expect('default'); - return new nodes.Case.When('default', this.parseBlockExpansion()); - }, - - /** - * code - */ - - parseCode: function(){ - var tok = this.expect('code') - , node = new nodes.Code(tok.val, tok.buffer, tok.escape) - , block - , i = 1; - node.line = this.line(); - while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; - block = 'indent' == this.lookahead(i).type; - if (block) { - this.skip(i-1); - node.block = this.block(); - } - return node; - }, - - /** - * comment - */ - - parseComment: function(){ - var tok = this.expect('comment') - , node; - - if ('indent' == this.peek().type) { - node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); - } else { - node = new nodes.Comment(tok.val, tok.buffer); - } - - node.line = this.line(); - return node; - }, - - /** - * doctype - */ - - parseDoctype: function(){ - var tok = this.expect('doctype') - , node = new nodes.Doctype(tok.val); - node.line = this.line(); - return node; - }, - - /** - * filter attrs? text-block - */ - - parseFilter: function(){ - var block - , tok = this.expect('filter') - , attrs = this.accept('attrs'); - - this.lexer.pipeless = true; - block = this.parseTextBlock(); - this.lexer.pipeless = false; - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * tag ':' attrs? block - */ - - parseASTFilter: function(){ - var block - , tok = this.expect('tag') - , attrs = this.accept('attrs'); - - this.expect(':'); - block = this.block(); - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * each block - */ - - parseEach: function(){ - var tok = this.expect('each') - , node = new nodes.Each(tok.code, tok.val, tok.key); - node.line = this.line(); - node.block = this.block(); - if (this.peek().type == 'code' && this.peek().val == 'else') { - this.advance(); - node.alternative = this.block(); - } - return node; - }, - - /** - * 'extends' name - */ - - parseExtends: function(){ - var path = require('path') - , fs = require('fs') - , dirname = path.dirname - , basename = path.basename - , join = path.join; - - if (!this.filename) - throw new Error('the "filename" option is required to extend templates'); - - var path = this.expect('extends').val.trim() - , dir = dirname(this.filename); - - var path = join(dir, path + '.jade') - , str = fs.readFileSync(path, 'utf8') - , parser = new Parser(str, path, this.options); - - parser.blocks = this.blocks; - parser.contexts = this.contexts; - this.extending = parser; - - // TODO: null node - return new nodes.Literal(''); - }, - - /** - * 'block' name block - */ - - parseBlock: function(){ - var block = this.expect('block') - , mode = block.mode - , name = block.val.trim(); - - block = 'indent' == this.peek().type - ? this.block() - : new nodes.Block(new nodes.Literal('')); - - var prev = this.blocks[name]; - - if (prev) { - switch (prev.mode) { - case 'append': - block.nodes = block.nodes.concat(prev.nodes); - prev = block; - break; - case 'prepend': - block.nodes = prev.nodes.concat(block.nodes); - prev = block; - break; - } - } - - block.mode = mode; - return this.blocks[name] = prev || block; - }, - - /** - * include block? - */ - - parseInclude: function(){ - var path = require('path') - , fs = require('fs') - , dirname = path.dirname - , basename = path.basename - , join = path.join; - - var path = this.expect('include').val.trim() - , dir = dirname(this.filename); - - if (!this.filename) - throw new Error('the "filename" option is required to use includes'); - - // no extension - if (!~basename(path).indexOf('.')) { - path += '.jade'; - } - - // non-jade - if ('.jade' != path.substr(-5)) { - var path = join(dir, path) - , str = fs.readFileSync(path, 'utf8'); - return new nodes.Literal(str); - } - - var path = join(dir, path) - , str = fs.readFileSync(path, 'utf8') - , parser = new Parser(str, path, this.options); - parser.blocks = utils.merge({}, this.blocks); - parser.mixins = this.mixins; - - this.context(parser); - var ast = parser.parse(); - this.context(); - ast.filename = path; - - if ('indent' == this.peek().type) { - ast.includeBlock().push(this.block()); - } - - return ast; - }, - - /** - * call ident block - */ - - parseCall: function(){ - var tok = this.expect('call') - , name = tok.val - , args = tok.args - , mixin = new nodes.Mixin(name, args, new nodes.Block, true); - - this.tag(mixin); - if (mixin.block.isEmpty()) mixin.block = null; - return mixin; - }, - - /** - * mixin block - */ - - parseMixin: function(){ - var tok = this.expect('mixin') - , name = tok.val - , args = tok.args - , mixin; - - // definition - if ('indent' == this.peek().type) { - mixin = new nodes.Mixin(name, args, this.block(), false); - this.mixins[name] = mixin; - return mixin; - // call - } else { - return new nodes.Mixin(name, args, null, true); - } - }, - - /** - * indent (text | newline)* outdent - */ - - parseTextBlock: function(){ - var block = new nodes.Block; - block.line = this.line(); - var spaces = this.expect('indent').val; - if (null == this._spaces) this._spaces = spaces; - var indent = Array(spaces - this._spaces + 1).join(' '); - while ('outdent' != this.peek().type) { - switch (this.peek().type) { - case 'newline': - this.advance(); - break; - case 'indent': - this.parseTextBlock().nodes.forEach(function(node){ - block.push(node); - }); - break; - default: - var text = new nodes.Text(indent + this.advance().val); - text.line = this.line(); - block.push(text); - } - } - - if (spaces == this._spaces) this._spaces = null; - this.expect('outdent'); - return block; - }, - - /** - * indent expr* outdent - */ - - block: function(){ - var block = new nodes.Block; - block.line = this.line(); - this.expect('indent'); - while ('outdent' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - this.expect('outdent'); - return block; - }, - - /** - * interpolation (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseInterpolation: function(){ - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - tag.buffer = true; - return this.tag(tag); - }, - - /** - * tag (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseTag: function(){ - // ast-filter look-ahead - var i = 2; - if ('attrs' == this.lookahead(i).type) ++i; - if (':' == this.lookahead(i).type) { - if ('indent' == this.lookahead(++i).type) { - return this.parseASTFilter(); - } - } - - var tok = this.advance() - , tag = new nodes.Tag(tok.val); - - tag.selfClosing = tok.selfClosing; - - return this.tag(tag); - }, - - /** - * Parse tag. - */ - - tag: function(tag){ - var dot; - - tag.line = this.line(); - - // (attrs | class | id)* - out: - while (true) { - switch (this.peek().type) { - case 'id': - case 'class': - var tok = this.advance(); - tag.setAttribute(tok.type, "'" + tok.val + "'"); - continue; - case 'attrs': - var tok = this.advance() - , obj = tok.attrs - , escaped = tok.escaped - , names = Object.keys(obj); - - if (tok.selfClosing) tag.selfClosing = true; - - for (var i = 0, len = names.length; i < len; ++i) { - var name = names[i] - , val = obj[name]; - tag.setAttribute(name, val, escaped[name]); - } - continue; - default: - break out; - } - } - - // check immediate '.' - if ('.' == this.peek().val) { - dot = tag.textOnly = true; - this.advance(); - } - - // (text | code | ':')? - switch (this.peek().type) { - case 'text': - tag.block.push(this.parseText()); - break; - case 'code': - tag.code = this.parseCode(); - break; - case ':': - this.advance(); - tag.block = new nodes.Block; - tag.block.push(this.parseExpr()); - break; - } - - // newline* - while ('newline' == this.peek().type) this.advance(); - - tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); - - // script special-case - if ('script' == tag.name) { - var type = tag.getAttribute('type'); - if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { - tag.textOnly = false; - } - } - - // block? - if ('indent' == this.peek().type) { - if (tag.textOnly) { - this.lexer.pipeless = true; - tag.block = this.parseTextBlock(); - this.lexer.pipeless = false; - } else { - var block = this.block(); - if (tag.block) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - tag.block.push(block.nodes[i]); - } - } else { - tag.block = block; - } - } - } - - return tag; - } -}; - -}); // module: parser.js - -require.register("runtime.js", function(module, exports, require){ - -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // 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 || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - -}); // module: runtime.js - -require.register("self-closing.js", function(module, exports, require){ - -/*! - * Jade - self closing tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'meta' - , 'img' - , 'link' - , 'input' - , 'source' - , 'area' - , 'base' - , 'col' - , 'br' - , 'hr' -]; -}); // module: self-closing.js - -require.register("utils.js", function(module, exports, require){ - -/*! - * Jade - utils - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Convert interpolation in the given string to JavaScript. - * - * @param {String} str - * @return {String} - * @api private - */ - -var interpolate = exports.interpolate = function(str){ - return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ - code = code - .replace(/\\'/g, "'") - .replace(/_SLASH_/g, '\\'); - - return escape - ? str.slice(7) - : "' + " - + ('!' == flag ? '' : 'escape') - + "((interp = " + code - + ") == null ? '' : interp) + '"; - }); -}; - -/** - * Escape single quotes in `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -var escape = exports.escape = function(str) { - return str.replace(/'/g, "\\'"); -}; - -/** - * Interpolate, and escape the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.text = function(str){ - return interpolate(escape(str)); -}; - -/** - * Merge `b` into `a`. - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports.merge = function(a, b) { - for (var key in b) a[key] = b[key]; - return a; -}; - - -}); // module: utils.js - -window.jade = require("jade"); -})(); diff --git a/node_modules/jade/jade.md b/node_modules/jade/jade.md deleted file mode 100644 index 051dc03..0000000 --- a/node_modules/jade/jade.md +++ /dev/null @@ -1,510 +0,0 @@ - -# Jade - - The jade template engine for node.js - -## Synopsis - - jade [-h|--help] [-v|--version] [-o|--obj STR] - [-O|--out DIR] [-p|--path PATH] [-P|--pretty] - [-c|--client] [-D|--no-debug] - -## Examples - - translate jade the templates dir - - $ jade templates - - create {foo,bar}.html - - $ jade {foo,bar}.jade - - jade over stdio - - $ jade < my.jade > my.html - - jade over s - - $ echo "h1 Jade!" | jade - - foo, bar dirs rendering to /tmp - - $ jade foo bar --out /tmp - - compile client-side templates without debugging - instrumentation, making the output javascript - very light-weight. This requires runtime.js - in your projects. - - $ jade --client --no-debug < my.jade - -## Tags - - Tags are simply nested via whitespace, closing - tags defined for you. These indents are called "blocks". - - ul - li - a Foo - li - a Bar - - You may have several tags in one "block": - - ul - li - a Foo - a Bar - a Baz - -## Self-closing Tags - - Some tags are flagged as self-closing by default, such - as `meta`, `link`, and so on. To explicitly self-close - a tag simply append the `/` character: - - foo/ - foo(bar='baz')/ - - Would yield: - - - - -## Attributes - - Tag attributes look similar to HTML, however - the values are regular JavaScript, here are - some examples: - - a(href='http://github.com/google.com') Google - a(class='button', href='http://github.com/google.com') Google - - As mentioned the attribute values are just JavaScript, - this means ternary operations and other JavaScript expressions - work just fine: - - body(class=user.authenticated ? 'authenticated' : 'anonymous') - a(href=user.website || 'http://google.com/') - - Multiple lines work too: - - input(type='checkbox', - name='agreement', - checked) - - Multiple lines without the comma work fine: - - input(type='checkbox' - name='agreement' - checked) - - Funky whitespace? fine: - - input( - type='checkbox' - name='agreement' - checked) - -## Boolean attributes - - Boolean attributes are mirrored by Jade, and accept - bools, aka _true_ or _false_. When no value is specified - _true_ is assumed. For example: - - input(type="checkbox", checked) - // => "" - - For example if the checkbox was for an agreement, perhaps `user.agreed` - was _true_ the following would also output 'checked="checked"': - - input(type="checkbox", checked=user.agreed) - -## Class attributes - - The _class_ attribute accepts an array of classes, - this can be handy when generated from a javascript - function etc: - - classes = ['foo', 'bar', 'baz'] - a(class=classes) - // => "" - -## Class literal - - Classes may be defined using a ".CLASSNAME" syntax: - - .button - // => "
    " - - Or chained: - - .large.button - // => "
    " - - The previous defaulted to divs, however you - may also specify the tag type: - - h1.title My Title - // => "

    My Title

    " - -## Id literal - - Much like the class literal there's an id literal: - - #user-1 - // => "
    " - - Again we may specify the tag as well: - - ul#menu - li: a(href='http://github.com/home') Home - li: a(href='http://github.com/store') Store - li: a(href='http://github.com/contact') Contact - - Finally all of these may be used in any combination, - the following are all valid tags: - - a.button#contact(style: 'color: red') Contact - a.button(style: 'color: red')#contact Contact - a(style: 'color: red').button#contact Contact - -## Block expansion - - Jade supports the concept of "block expansion", in which - using a trailing ":" after a tag will inject a block: - - ul - li: a Foo - li: a Bar - li: a Baz - -## Text - - Arbitrary text may follow tags: - - p Welcome to my site - - yields: - -

    Welcome to my site

    - -## Pipe text - - Another form of text is "pipe" text. Pipes act - as the text margin for large bodies of text. - - p - | This is a large - | body of text for - | this tag. - | - | Nothing too - | exciting. - - yields: - -

    This is a large - body of text for - this tag. - - Nothing too - exciting. -

    - - Using pipes we can also specify regular Jade tags - within the text: - - p - | Click to visit - a(href='http://google.com/') Google - | if you want. - -## Text only tags - - As an alternative to pipe text you may add - a trailing "." to indicate that the block - contains nothing but plain-text, no tags: - - p. - This is a large - body of text for - this tag. - - Nothing too - exciting. - - Some tags are text-only by default, for example - _script_, _textarea_, and _style_ tags do not - contain nested HTML so Jade implies the trailing ".": - - script - if (foo) { - bar(); - } - - style - body { - padding: 50px; - font: 14px Helvetica; - } - -## Template script tags - - Sometimes it's useful to define HTML in script - tags using Jade, typically for client-side templates. - - To do this simply give the _script_ tag an arbitrary - _type_ attribute such as _text/x-template_: - - script(type='text/template') - h1 Look! - p Jade still works in here! - -## Interpolation - - Both plain-text and piped-text support interpolation, - which comes in two forms, escapes and non-escaped. The - following will output the _user.name_ in the paragraph - but HTML within it will be escaped to prevent XSS attacks: - - p Welcome #{user.name} - - The following syntax is identical however it will _not_ escape - HTML, and should only be used with strings that you trust: - - p Welcome !{user.name} - -## Inline HTML - - Sometimes constructing small inline snippets of HTML - in Jade can be annoying, luckily we can add plain - HTML as well: - - p Welcome #{user.name} - -## Code - - To buffer output with Jade simply use _=_ at the beginning - of a line or after a tag. This method escapes any HTML - present in the string. - - p= user.description - - To buffer output unescaped use the _!=_ variant, but again - be careful of XSS. - - p!= user.description - - The final way to mess with JavaScript code in Jade is the unbuffered - _-_, which can be used for conditionals, defining variables etc: - - - var user = { description: 'foo bar baz' } - #user - - if (user.description) { - h2 Description - p.description= user.description - - } - - When compiled blocks are wrapped in anonymous functions, so the - following is also valid, without braces: - - - var user = { description: 'foo bar baz' } - #user - - if (user.description) - h2 Description - p.description= user.description - - If you really want you could even use `.forEach()` and others: - - - users.forEach(function(user){ - .user - h2= user.name - p User #{user.name} is #{user.age} years old - - }) - - Taking this further Jade provides some syntax for conditionals, - iteration, switch statements etc. Let's look at those next! - -## Assignment - - Jade's first-class assignment is simple, simply use the _=_ - operator and Jade will _var_ it for you. The following are equivalent: - - - var user = { name: 'tobi' } - user = { name: 'tobi' } - -## Conditionals - - Jade's first-class conditional syntax allows for optional - parenthesis, and you may now omit the leading _-_ otherwise - it's identical, still just regular javascript: - - user = { description: 'foo bar baz' } - #user - if user.description - h2 Description - p.description= user.description - - Jade provides the negated version, _unless_ as well, the following - are equivalent: - - - if (!(user.isAnonymous)) - p You're logged in as #{user.name} - - unless user.isAnonymous - p You're logged in as #{user.name} - -## Iteration - - JavaScript's _for_ loops don't look very declarative, so Jade - also provides its own _for_ loop construct, aliased as _each_: - - for user in users - .user - h2= user.name - p user #{user.name} is #{user.age} year old - - As mentioned _each_ is identical: - - each user in users - .user - h2= user.name - - If necessary the index is available as well: - - for user, i in users - .user(class='user-#{i}') - h2= user.name - - Remember, it's just JavaScript: - - ul#letters - for letter in ['a', 'b', 'c'] - li= letter - -## Mixins - - Mixins provide a way to define jade "functions" which "mix in" - their contents when called. This is useful for abstracting - out large fragments of Jade. - - The simplest possible mixin which accepts no arguments might - look like this: - - mixin hello - p Hello - - You use a mixin by placing `+` before the name: - - +hello - - For something a little more dynamic, mixins can take - arguments, the mixin itself is converted to a javascript - function internally: - - mixin hello(user) - p Hello #{user} - - +hello('Tobi') - - Yields: - -

    Hello Tobi

    - - Mixins may optionally take blocks, when a block is passed - its contents becomes the implicit `block` argument. For - example here is a mixin passed a block, and also invoked - without passing a block: - - mixin article(title) - .article - .article-wrapper - h1= title - if block - block - else - p No content provided - - +article('Hello world') - - +article('Hello world') - p This is my - p Amazing article - - yields: - -
    -
    -

    Hello world

    -

    No content provided

    -
    -
    - -
    -
    -

    Hello world

    -

    This is my

    -

    Amazing article

    -
    -
    - - Mixins can even take attributes, just like a tag. When - attributes are passed they become the implicit `attributes` - argument. Individual attributes can be accessed just like - normal object properties: - - mixin centered - .centered(class=attributes.class) - block - - +centered.bold Hello world - - +centered.red - p This is my - p Amazing article - - yields: - -
    Hello world
    -
    -

    This is my

    -

    Amazing article

    -
    - - If you use `attributes` directly, *all* passed attributes - get used: - - mixin link - a.menu(attributes) - block - - +link.highlight(href='#top') Top - +link#sec1.plain(href='#section1') Section 1 - +link#sec2.plain(href='#section2') Section 2 - - yields: - - Top - Section 1 - Section 2 - - If you pass arguments, they must directly follow the mixin: - - mixin list(arr) - if block - .title - block - ul(attributes) - each item in arr - li= item - - +list(['foo', 'bar', 'baz'])(id='myList', class='bold') - - yields: - -
      -
    • foo
    • -
    • bar
    • -
    • baz
    • -
    diff --git a/node_modules/jade/jade.min.js b/node_modules/jade/jade.min.js deleted file mode 100644 index 93f3b3d..0000000 --- a/node_modules/jade/jade.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){function require(p){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}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.charAt(0))return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i/g,">").replace(/"/g,""")}var nodes=require("./nodes"),filters=require("./filters"),doctypes=require("./doctypes"),selfClosing=require("./self-closing"),runtime=require("./runtime"),utils=require("./utils");Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")});var Compiler=module.exports=function Compiler(node,options){this.options=options=options||{},this.node=node,this.hasCompiledDoctype=!1,this.hasCompiledTag=!1,this.pp=options.pretty||!1,this.debug=!1!==options.compileDebug,this.indents=0,this.parentIndents=0,options.doctype&&this.setDoctype(options.doctype)};Compiler.prototype={compile:function(){return this.buf=["var interp;"],this.pp&&this.buf.push("var __indent = [];"),this.lastBufferedIdx=-1,this.visit(this.node),this.buf.join("\n")},setDoctype:function(name){name=name&&name.toLowerCase()||"default",this.doctype=doctypes[name]||"",this.terse=this.doctype.toLowerCase()=="",this.xml=0==this.doctype.indexOf("1&&!escape&&block.nodes[0].isText&&block.nodes[1].isText&&this.prettyIndent(1,!0);for(var i=0;i0&&!escape&&block.nodes[i].isText&&block.nodes[i-1].isText&&this.prettyIndent(1,!1),this.visit(block.nodes[i]),block.nodes[i+1]&&block.nodes[i].isText&&block.nodes[i+1].isText&&this.buffer("\\n")},visitDoctype:function(doctype){doctype&&(doctype.val||!this.doctype)&&this.setDoctype(doctype.val||"default"),this.doctype&&this.buffer(this.doctype),this.hasCompiledDoctype=!0},visitMixin:function(mixin){var name=mixin.name.replace(/-/g,"_")+"_mixin",args=mixin.args||"",block=mixin.block,attrs=mixin.attrs,pp=this.pp;if(mixin.call){pp&&this.buf.push("__indent.push('"+Array(this.indents+1).join(" ")+"');");if(block||attrs.length){this.buf.push(name+".call({");if(block){this.buf.push("block: function(){"),this.parentIndents++;var _indents=this.indents;this.indents=0,this.visit(mixin.block),this.indents=_indents,this.parentIndents--,attrs.length?this.buf.push("},"):this.buf.push("}")}if(attrs.length){var val=this.attrs(attrs);val.inherits?this.buf.push("attributes: merge({"+val.buf+"}, attributes), escaped: merge("+val.escaped+", escaped, true)"):this.buf.push("attributes: {"+val.buf+"}, escaped: "+val.escaped)}args?this.buf.push("}, "+args+");"):this.buf.push("});")}else this.buf.push(name+"("+args+");");pp&&this.buf.push("__indent.pop();")}else this.buf.push("var "+name+" = function("+args+"){"),this.buf.push("var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};"),this.parentIndents++,this.visit(block),this.parentIndents--,this.buf.push("};")},visitTag:function(tag){this.indents++;var name=tag.name,pp=this.pp;tag.buffer&&(name="' + ("+name+") + '"),this.hasCompiledTag||(!this.hasCompiledDoctype&&"html"==name&&this.visitDoctype(),this.hasCompiledTag=!0),pp&&!tag.isInline()&&this.prettyIndent(0,!0),(~selfClosing.indexOf(name)||tag.selfClosing)&&!this.xml?(this.buffer("<"+name),this.visitAttributes(tag.attrs),this.terse?this.buffer(">"):this.buffer("/>")):(tag.attrs.length?(this.buffer("<"+name),tag.attrs.length&&this.visitAttributes(tag.attrs),this.buffer(">")):this.buffer("<"+name+">"),tag.code&&this.visitCode(tag.code),this.escape="pre"==tag.name,this.visit(tag.block),pp&&!tag.isInline()&&"pre"!=tag.name&&!tag.canInline()&&this.prettyIndent(0,!0),this.buffer("")),this.indents--},visitFilter:function(filter){var fn=filters[filter.name];if(!fn)throw filter.isASTFilter?new Error('unknown ast filter "'+filter.name+':"'):new Error('unknown filter ":'+filter.name+'"');if(filter.isASTFilter)this.buf.push(fn(filter.block,this,filter.attrs));else{var text=filter.block.nodes.map(function(node){return node.val}).join("\n");filter.attrs=filter.attrs||{},filter.attrs.filename=this.options.filename,this.buffer(utils.text(fn(text,filter.attrs)))}},visitText:function(text){text=utils.text(text.val.replace(/\\/g,"_SLASH_")),this.escape&&(text=escape(text)),text=text.replace(/_SLASH_/g,"\\\\"),this.buffer(text)},visitComment:function(comment){if(!comment.buffer)return;this.pp&&this.prettyIndent(1,!0),this.buffer("")},visitBlockComment:function(comment){if(!comment.buffer)return;0==comment.val.trim().indexOf("if")?(this.buffer("")):(this.buffer(""))},visitCode:function(code){if(code.buffer){var val=code.val.trimLeft();this.buf.push("var __val__ = "+val),val='null == __val__ ? "" : __val__',code.escape&&(val="escape("+val+")"),this.buf.push("buf.push("+val+");")}else this.buf.push(code.val);code.block&&(code.buffer||this.buf.push("{"),this.visit(code.block),code.buffer||this.buf.push("}"))},visitEach:function(each){this.buf.push("// iterate "+each.obj+"\n"+";(function(){\n"+" if ('number' == typeof "+each.obj+".length) {\n"),each.alternative&&this.buf.push(" if ("+each.obj+".length) {"),this.buf.push(" for (var "+each.key+" = 0, $$l = "+each.obj+".length; "+each.key+" < $$l; "+each.key+"++) {\n"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" } else {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" } else {\n var $$l = 0;\n for (var "+each.key+" in "+each.obj+") {\n"+" $$l++;"+" if ("+each.obj+".hasOwnProperty("+each.key+")){"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" if ($$l === 0) {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" }\n}).call(this);\n")},visitAttributes:function(attrs){var val=this.attrs(attrs);val.inherits?this.buf.push("buf.push(attrs(merge({ "+val.buf+" }, attributes), merge("+val.escaped+", escaped, true)));"):val.constant?(eval("var buf={"+val.buf+"};"),this.buffer(runtime.attrs(buf,JSON.parse(val.escaped)),!0)):this.buf.push("buf.push(attrs({ "+val.buf+" }, "+val.escaped+"));")},attrs:function(attrs){var buf=[],classes=[],escaped={},constant=attrs.every(function(attr){return isConstant(attr.val)}),inherits=!1;return this.terse&&buf.push("terse: true"),attrs.forEach(function(attr){if(attr.name=="attributes")return inherits=!0;escaped[attr.name]=attr.escaped;if(attr.name=="class")classes.push("("+attr.val+")");else{var pair="'"+attr.name+"':("+attr.val+")";buf.push(pair)}}),classes.length&&(classes=classes.join(" + ' ' + "),buf.push("class: "+classes)),{buf:buf.join(", ").replace("class:",'"class":'),escaped:JSON.stringify(escaped),inherits:inherits,constant:constant}}}}),require.register("doctypes.js",function(module,exports,require){module.exports={5:"","default":"",xml:'',transitional:'',strict:'',frameset:'',1.1:'',basic:'',mobile:''}}),require.register("filters.js",function(module,exports,require){module.exports={cdata:function(str){return""},sass:function(str){str=str.replace(/\\n/g,"\n");var sass=require("sass").render(str).replace(/\n/g,"\\n");return'"},stylus:function(str,options){var ret;str=str.replace(/\\n/g,"\n");var stylus=require("stylus");return stylus(str,options).render(function(err,css){if(err)throw err;ret=css.replace(/\n/g,"\\n")}),'"},less:function(str){var ret;return str=str.replace(/\\n/g,"\n"),require("less").render(str,function(err,css){if(err)throw err;ret='"}),ret},markdown:function(str){var md;try{md=require("markdown")}catch(err){try{md=require("discount")}catch(err){try{md=require("markdown-js")}catch(err){try{md=require("marked")}catch(err){throw new Error("Cannot find markdown library, install markdown, discount, or marked.")}}}}return str=str.replace(/\\n/g,"\n"),md.parse(str).replace(/\n/g,"\\n").replace(/'/g,"'")},coffeescript:function(str){var js=require("coffee-script").compile(str).replace(/\\/g,"\\\\").replace(/\n/g,"\\n");return'"}}}),require.register("inline-tags.js",function(module,exports,require){module.exports=["a","abbr","acronym","b","br","code","em","font","i","img","ins","kbd","map","samp","small","span","strong","sub","sup"]}),require.register("jade.js",function(module,exports,require){function parse(str,options){try{var parser=new Parser(str,options.filename,options),compiler=new(options.compiler||Compiler)(parser.parse(),options),js=compiler.compile();return options.debug&&console.error("\nCompiled Function:\n\n%s",js.replace(/^/gm," ")),"var buf = [];\n"+(options.self?"var self = locals || {};\n"+js:"with (locals || {}) {\n"+js+"\n}\n")+'return buf.join("");'}catch(err){parser=parser.context(),runtime.rethrow(err,parser.filename,parser.lexer.lineno)}}function stripBOM(str){return 65279==str.charCodeAt(0)?str.substring(1):str}var Parser=require("./parser"),Lexer=require("./lexer"),Compiler=require("./compiler"),runtime=require("./runtime");exports.version="0.27.6",exports.selfClosing=require("./self-closing"),exports.doctypes=require("./doctypes"),exports.filters=require("./filters"),exports.utils=require("./utils"),exports.Compiler=Compiler,exports.Parser=Parser,exports.Lexer=Lexer,exports.nodes=require("./nodes"),exports.runtime=runtime,exports.cache={},exports.compile=function(str,options){var options=options||{},client=options.client,filename=options.filename?JSON.stringify(options.filename):"undefined",fn;return str=stripBOM(String(str)),options.compileDebug!==!1?fn=["var __jade = [{ lineno: 1, filename: "+filename+" }];","try {",parse(str,options),"} catch (err) {"," rethrow(err, __jade[0].filename, __jade[0].lineno);","}"].join("\n"):fn=parse(str,options),client&&(fn="attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n"+fn),fn=new Function("locals, attrs, escape, rethrow, merge",fn),client?fn:function(locals){return fn(locals,runtime.attrs,runtime.escape,runtime.rethrow,runtime.merge)}},exports.render=function(str,options,fn){"function"==typeof options&&(fn=options,options={});if(options.cache&&!options.filename)return fn(new Error('the "filename" option is required for caching'));try{var path=options.filename,tmpl=options.cache?exports.cache[path]||(exports.cache[path]=exports.compile(str,options)):exports.compile(str,options);fn(null,tmpl(options))}catch(err){fn(err)}},exports.renderFile=function(path,options,fn){var key=path+":string";"function"==typeof options&&(fn=options,options={});try{options.filename=path;var str=options.cache?exports.cache[key]||(exports.cache[key]=fs.readFileSync(path,"utf8")):fs.readFileSync(path,"utf8");exports.render(str,options,fn)}catch(err){fn(err)}},exports.__express=exports.renderFile}),require.register("lexer.js",function(module,exports,require){var utils=require("./utils"),Lexer=module.exports=function Lexer(str,options){options=options||{},this.input=str.replace(/\r\n|\r/g,"\n"),this.colons=options.colons,this.deferredTokens=[],this.lastIndents=0,this.lineno=1,this.stash=[],this.indentStack=[],this.indentRe=null,this.pipeless=!1};Lexer.prototype={tok:function(type,val){return{type:type,line:this.lineno,val:val}},consume:function(len){this.input=this.input.substr(len)},scan:function(regexp,type){var captures;if(captures=regexp.exec(this.input))return this.consume(captures[0].length),this.tok(type,captures[1])},defer:function(tok){this.deferredTokens.push(tok)},lookahead:function(n){var fetch=n-this.stash.length;while(fetch-->0)this.stash.push(this.next());return this.stash[--n]},indexOfDelimiters:function(start,end){var str=this.input,nstart=0,nend=0,pos=0;for(var i=0,len=str.length;iindents)this.stash.push(this.tok("outdent")),this.indentStack.shift();tok=this.stash.pop()}else indents&&indents!=this.indentStack[0]?(this.indentStack.unshift(indents),tok=this.tok("indent",indents)):tok=this.tok("newline");return tok}},pipelessText:function(){if(this.pipeless){if("\n"==this.input[0])return;var i=this.input.indexOf("\n");-1==i&&(i=this.input.length);var str=this.input.substr(0,i);return this.consume(str.length),this.tok("text",str)}},colon:function(){return this.scan(/^: */,":")},advance:function(){return this.stashed()||this.next()},next:function(){return this.deferred()||this.blank()||this.eos()||this.pipelessText()||this.yield()||this.doctype()||this.interpolation()||this["case"]()||this.when()||this["default"]()||this["extends"]()||this.append()||this.prepend()||this.block()||this.include()||this.mixin()||this.call()||this.conditional()||this.each()||this["while"]()||this.assignment()||this.tag()||this.filter()||this.code()||this.id()||this.className()||this.attrs()||this.indent()||this.comment()||this.colon()||this.text()}}}),require.register("nodes/attrs.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Attrs=module.exports=function Attrs(){this.attrs=[]};Attrs.prototype=new Node,Attrs.prototype.constructor=Attrs,Attrs.prototype.setAttribute=function(name,val,escaped){return this.attrs.push({name:name,val:val,escaped:escaped}),this},Attrs.prototype.removeAttribute=function(name){for(var i=0,len=this.attrs.length;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err}}),require.register("self-closing.js",function(module,exports,require){module.exports=["meta","img","link","input","source","area","base","col","br","hr"]}),require.register("utils.js",function(module,exports,require){var interpolate=exports.interpolate=function(str){return str.replace(/(_SLASH_)?([#!]){(.*?)}/g,function(str,escape,flag,code){return code=code.replace(/\\'/g,"'").replace(/_SLASH_/g,"\\"),escape?str.slice(7):"' + "+("!"==flag?"":"escape")+"((interp = "+code+") == null ? '' : interp) + '"})},escape=exports.escape=function(str){return str.replace(/'/g,"\\'")};exports.text=function(str){return interpolate(escape(str))},exports.merge=function(a,b){for(var key in b)a[key]=b[key];return a}}),window.jade=require("jade")})(); \ No newline at end of file diff --git a/node_modules/jade/lib/compiler.js b/node_modules/jade/lib/compiler.js deleted file mode 100644 index bb56142..0000000 --- a/node_modules/jade/lib/compiler.js +++ /dev/null @@ -1,655 +0,0 @@ - -/*! - * Jade - Compiler - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('./nodes') - , filters = require('./filters') - , doctypes = require('./doctypes') - , selfClosing = require('./self-closing') - , runtime = require('./runtime') - , utils = require('./utils'); - -// if browser -// -// if (!Object.keys) { -// Object.keys = function(obj){ -// var arr = []; -// for (var key in obj) { -// if (obj.hasOwnProperty(key)) { -// arr.push(key); -// } -// } -// return arr; -// } -// } -// -// if (!String.prototype.trimLeft) { -// String.prototype.trimLeft = function(){ -// return this.replace(/^\s+/, ''); -// } -// } -// -// end - - -/** - * Initialize `Compiler` with the given `node`. - * - * @param {Node} node - * @param {Object} options - * @api public - */ - -var Compiler = module.exports = function Compiler(node, options) { - this.options = options = options || {}; - this.node = node; - this.hasCompiledDoctype = false; - this.hasCompiledTag = false; - this.pp = options.pretty || false; - this.debug = false !== options.compileDebug; - this.indents = 0; - this.parentIndents = 0; - if (options.doctype) this.setDoctype(options.doctype); -}; - -/** - * Compiler prototype. - */ - -Compiler.prototype = { - - /** - * Compile parse tree to JavaScript. - * - * @api public - */ - - compile: function(){ - this.buf = ['var interp;']; - if (this.pp) this.buf.push("var __indent = [];"); - this.lastBufferedIdx = -1; - this.visit(this.node); - return this.buf.join('\n'); - }, - - /** - * Sets the default doctype `name`. Sets terse mode to `true` when - * html 5 is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {string} name - * @api public - */ - - setDoctype: function(name){ - name = (name && name.toLowerCase()) || 'default'; - this.doctype = doctypes[name] || ''; - this.terse = this.doctype.toLowerCase() == ''; - this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) - this.prettyIndent(1, true); - - for (var i = 0; i < len; ++i) { - // Pretty print text - if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) - this.prettyIndent(1, false); - - this.visit(block.nodes[i]); - // Multiple text nodes are separated by newlines - if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) - this.buffer('\\n'); - } - }, - - /** - * Visit `doctype`. Sets terse mode to `true` when html 5 - * is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {Doctype} doctype - * @api public - */ - - visitDoctype: function(doctype){ - if (doctype && (doctype.val || !this.doctype)) { - this.setDoctype(doctype.val || 'default'); - } - - if (this.doctype) this.buffer(this.doctype); - this.hasCompiledDoctype = true; - }, - - /** - * Visit `mixin`, generating a function that - * may be called within the template. - * - * @param {Mixin} mixin - * @api public - */ - - visitMixin: function(mixin){ - var name = mixin.name.replace(/-/g, '_') + '_mixin' - , args = mixin.args || '' - , block = mixin.block - , attrs = mixin.attrs - , pp = this.pp; - - if (mixin.call) { - if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") - if (block || attrs.length) { - - this.buf.push(name + '.call({'); - - if (block) { - this.buf.push('block: function(){'); - - // Render block with no indents, dynamically added when rendered - this.parentIndents++; - var _indents = this.indents; - this.indents = 0; - this.visit(mixin.block); - this.indents = _indents; - this.parentIndents--; - - if (attrs.length) { - this.buf.push('},'); - } else { - this.buf.push('}'); - } - } - - if (attrs.length) { - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push('attributes: merge({' + val.buf - + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); - } else { - this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); - } - } - - if (args) { - this.buf.push('}, ' + args + ');'); - } else { - this.buf.push('});'); - } - - } else { - this.buf.push(name + '(' + args + ');'); - } - if (pp) this.buf.push("__indent.pop();") - } else { - this.buf.push('var ' + name + ' = function(' + args + '){'); - this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); - this.parentIndents++; - this.visit(block); - this.parentIndents--; - this.buf.push('};'); - } - }, - - /** - * Visit `tag` buffering tag markup, generating - * attributes, visiting the `tag`'s code and block. - * - * @param {Tag} tag - * @api public - */ - - visitTag: function(tag){ - this.indents++; - var name = tag.name - , pp = this.pp; - - if (tag.buffer) name = "' + (" + name + ") + '"; - - if (!this.hasCompiledTag) { - if (!this.hasCompiledDoctype && 'html' == name) { - this.visitDoctype(); - } - this.hasCompiledTag = true; - } - - // pretty print - if (pp && !tag.isInline()) - this.prettyIndent(0, true); - - if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { - this.buffer('<' + name); - this.visitAttributes(tag.attrs); - this.terse - ? this.buffer('>') - : this.buffer('/>'); - } else { - // Optimize attributes buffering - if (tag.attrs.length) { - this.buffer('<' + name); - if (tag.attrs.length) this.visitAttributes(tag.attrs); - this.buffer('>'); - } else { - this.buffer('<' + name + '>'); - } - if (tag.code) this.visitCode(tag.code); - this.escape = 'pre' == tag.name; - this.visit(tag.block); - - // pretty print - if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) - this.prettyIndent(0, true); - - this.buffer(''); - } - this.indents--; - }, - - /** - * Visit `filter`, throwing when the filter does not exist. - * - * @param {Filter} filter - * @api public - */ - - visitFilter: function(filter){ - var fn = filters[filter.name]; - - // unknown filter - if (!fn) throw new Error('unknown filter ":' + filter.name + '"'); - - var text = filter.block.nodes.map( - function(node){ return node.val; } - ).join('\n'); - filter.attrs = filter.attrs || {}; - filter.attrs.filename = this.options.filename; - this.buffer(utils.text(fn(text, filter.attrs))); - }, - - /** - * Visit `text` node. - * - * @param {Text} text - * @api public - */ - - visitText: function(text){ - text = utils.text(text.val.replace(/\\/g, '_SLASH_')); - if (this.escape) text = escape(text); - text = text.replace(/_SLASH_/g, '\\\\'); - this.buffer(text); - }, - - /** - * Visit a `comment`, only buffering when the buffer flag is set. - * - * @param {Comment} comment - * @api public - */ - - visitComment: function(comment){ - if (!comment.buffer) return; - if (this.pp) this.prettyIndent(1, true); - this.buffer(''); - }, - - /** - * Visit a `BlockComment`. - * - * @param {Comment} comment - * @api public - */ - - visitBlockComment: function(comment){ - if (!comment.buffer) return; - if (0 == comment.val.trim().indexOf('if')) { - this.buffer(''); - } else { - this.buffer(''); - } - }, - - /** - * Visit `code`, respecting buffer / escape flags. - * If the code is followed by a block, wrap it in - * a self-calling function. - * - * @param {Code} code - * @api public - */ - - visitCode: function(code){ - // Wrap code blocks with {}. - // we only wrap unbuffered code blocks ATM - // since they are usually flow control - - // Buffer code - if (code.buffer) { - var val = code.val.trimLeft(); - this.buf.push('var __val__ = ' + val); - val = 'null == __val__ ? "" : __val__'; - if (code.escape) val = 'escape(' + val + ')'; - this.buf.push("buf.push(" + val + ");"); - } else { - this.buf.push(code.val); - } - - // Block support - if (code.block) { - if (!code.buffer) this.buf.push('{'); - this.visit(code.block); - if (!code.buffer) this.buf.push('}'); - } - }, - - /** - * Visit `each` block. - * - * @param {Each} each - * @api public - */ - - visitEach: function(each){ - this.buf.push('' - + '// iterate ' + each.obj + '\n' - + ';(function(){\n' - + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); - - if (each.alternative) { - this.buf.push(' if (' + each.obj + '.length) {'); - } - - this.buf.push('' - + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - if (each.alternative) { - this.buf.push(' } else {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - - this.buf.push('' - + ' } else {\n' - + ' var $$l = 0;\n' - + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' - + ' $$l++;' - // if browser - // + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' - // end - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - // if browser - // this.buf.push(' }\n'); - // end - - this.buf.push(' }\n'); - if (each.alternative) { - this.buf.push(' if ($$l === 0) {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - this.buf.push(' }\n}).call(this);\n'); - }, - - /** - * Visit `attrs`. - * - * @param {Array} attrs - * @api public - */ - - visitAttributes: function(attrs){ - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push("buf.push(attrs(merge({ " + val.buf + - " }, attributes), merge(" + val.escaped + ", escaped, true)));"); - } else if (val.constant) { - eval('var buf={' + val.buf + '};'); - this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); - } else { - this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); - } - }, - - /** - * Compile attributes. - */ - - attrs: function(attrs){ - var buf = [] - , classes = [] - , escaped = {} - , constant = attrs.every(function(attr){ return isConstant(attr.val) }) - , inherits = false; - - if (this.terse) buf.push('terse: true'); - - attrs.forEach(function(attr){ - if (attr.name == 'attributes') return inherits = true; - escaped[attr.name] = attr.escaped; - if (attr.name == 'class') { - classes.push('(' + attr.val + ')'); - } else { - var pair = "'" + attr.name + "':(" + attr.val + ')'; - buf.push(pair); - } - }); - - if (classes.length) { - classes = classes.join(" + ' ' + "); - buf.push('"class": ' + classes); - } - - return { - buf: buf.join(', '), - escaped: JSON.stringify(escaped), - inherits: inherits, - constant: constant - }; - } -}; - -/** - * Check if expression can be evaluated to a constant - * - * @param {String} expression - * @return {Boolean} - * @api private - */ - -function isConstant(val){ - // Check strings/literals - if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) - return true; - - // Check numbers - if (!isNaN(Number(val))) - return true; - - // Check arrays - var matches; - if (matches = /^ *\[(.*)\] *$/.exec(val)) - return matches[1].split(',').every(isConstant); - - return false; -} - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -function escape(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -} diff --git a/node_modules/jade/lib/doctypes.js b/node_modules/jade/lib/doctypes.js deleted file mode 100644 index e87ca1e..0000000 --- a/node_modules/jade/lib/doctypes.js +++ /dev/null @@ -1,18 +0,0 @@ - -/*! - * Jade - doctypes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - '5': '' - , 'default': '' - , 'xml': '' - , 'transitional': '' - , 'strict': '' - , 'frameset': '' - , '1.1': '' - , 'basic': '' - , 'mobile': '' -}; \ No newline at end of file diff --git a/node_modules/jade/lib/filters.js b/node_modules/jade/lib/filters.js deleted file mode 100644 index d633559..0000000 --- a/node_modules/jade/lib/filters.js +++ /dev/null @@ -1,105 +0,0 @@ - -/*! - * Jade - filters - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Wrap text with CDATA block. - */ - -exports.cdata = function(str){ - return ''; -}; - -/** - * Wrap text in script tags. - */ - -exports.js = function(str){ - return ''; -}; - -/** - * Wrap text in style tags. - */ - -exports.css = function(str){ - return ''; -}; - -/** - * Transform stylus to css, wrapped in style tags. - */ - -exports.stylus = function(str, options){ - var ret; - str = str.replace(/\\n/g, '\n'); - var stylus = require('stylus'); - stylus(str, options).render(function(err, css){ - if (err) throw err; - ret = css.replace(/\n/g, '\\n'); - }); - return ''; -}; - -/** - * Transform less to css, wrapped in style tags. - */ - -exports.less = function(str){ - var ret; - str = str.replace(/\\n/g, '\n'); - require('less').render(str, function(err, css){ - if (err) throw err; - ret = ''; - }); - return ret; -}; - -/** - * Transform markdown to html. - */ - -exports.markdown = function(str){ - var md; - - // support markdown / discount - try { - md = require('markdown'); - } catch (err){ - try { - md = require('discount'); - } catch (err) { - try { - md = require('markdown-js'); - } catch (err) { - try { - md = require('marked'); - } catch (err) { - throw new - Error('Cannot find markdown library, install markdown, discount, or marked.'); - } - } - } - } - - str = str.replace(/\\n/g, '\n'); - return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); -}; - -/** - * Transform coffeescript to javascript. - */ - -exports.coffeescript = function(str){ - var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); - return ''; -}; - -// aliases - -exports.md = exports.markdown; -exports.styl = exports.stylus; -exports.coffee = exports.coffeescript; diff --git a/node_modules/jade/lib/inline-tags.js b/node_modules/jade/lib/inline-tags.js deleted file mode 100644 index 491de0b..0000000 --- a/node_modules/jade/lib/inline-tags.js +++ /dev/null @@ -1,28 +0,0 @@ - -/*! - * Jade - inline tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'a' - , 'abbr' - , 'acronym' - , 'b' - , 'br' - , 'code' - , 'em' - , 'font' - , 'i' - , 'img' - , 'ins' - , 'kbd' - , 'map' - , 'samp' - , 'small' - , 'span' - , 'strong' - , 'sub' - , 'sup' -]; \ No newline at end of file diff --git a/node_modules/jade/lib/jade.js b/node_modules/jade/lib/jade.js deleted file mode 100644 index 09d61e6..0000000 --- a/node_modules/jade/lib/jade.js +++ /dev/null @@ -1,253 +0,0 @@ -/*! - * Jade - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Parser = require('./parser') - , Lexer = require('./lexer') - , Compiler = require('./compiler') - , runtime = require('./runtime') -// if node - , fs = require('fs'); -// end - -/** - * Library version. - */ - -exports.version = '0.28.0'; - -/** - * Expose self closing tags. - */ - -exports.selfClosing = require('./self-closing'); - -/** - * Default supported doctypes. - */ - -exports.doctypes = require('./doctypes'); - -/** - * Text filters. - */ - -exports.filters = require('./filters'); - -/** - * Utilities. - */ - -exports.utils = require('./utils'); - -/** - * Expose `Compiler`. - */ - -exports.Compiler = Compiler; - -/** - * Expose `Parser`. - */ - -exports.Parser = Parser; - -/** - * Expose `Lexer`. - */ - -exports.Lexer = Lexer; - -/** - * Nodes. - */ - -exports.nodes = require('./nodes'); - -/** - * Jade runtime helpers. - */ - -exports.runtime = runtime; - -/** - * Template function cache. - */ - -exports.cache = {}; - -/** - * Parse the given `str` of jade and return a function body. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -function parse(str, options){ - try { - // Parse - var parser = new Parser(str, options.filename, options); - - // Compile - var compiler = new (options.compiler || Compiler)(parser.parse(), options) - , js = compiler.compile(); - - // Debug compiler - if (options.debug) { - console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); - } - - return '' - + 'var buf = [];\n' - + (options.self - ? 'var self = locals || {};\n' + js - : 'with (locals || {}) {\n' + js + '\n}\n') - + 'return buf.join("");'; - } catch (err) { - parser = parser.context(); - runtime.rethrow(err, parser.filename, parser.lexer.lineno); - } -} - -/** - * Strip any UTF-8 BOM off of the start of `str`, if it exists. - * - * @param {String} str - * @return {String} - * @api private - */ - -function stripBOM(str){ - return 0xFEFF == str.charCodeAt(0) - ? str.substring(1) - : str; -} - -/** - * Compile a `Function` representation of the given jade `str`. - * - * Options: - * - * - `compileDebug` when `false` debugging code is stripped from the compiled template - * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` - * for use with the Jade client-side runtime.js - * - * @param {String} str - * @param {Options} options - * @return {Function} - * @api public - */ - -exports.compile = function(str, options){ - var options = options || {} - , client = options.client - , filename = options.filename - ? JSON.stringify(options.filename) - : 'undefined' - , fn; - - str = stripBOM(String(str)); - - if (options.compileDebug !== false) { - fn = [ - 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' - , 'try {' - , parse(str, options) - , '} catch (err) {' - , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' - , '}' - ].join('\n'); - } else { - fn = parse(str, options); - } - - if (client) { - fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; - } - - fn = new Function('locals, attrs, escape, rethrow, merge', fn); - - if (client) return fn; - - return function(locals){ - return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); - }; -}; - -/** - * Render the given `str` of jade and invoke - * the callback `fn(err, str)`. - * - * Options: - * - * - `cache` enable template caching - * - `filename` filename required for `include` / `extends` and caching - * - * @param {String} str - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -exports.render = function(str, options, fn){ - // swap args - if ('function' == typeof options) { - fn = options, options = {}; - } - - // cache requires .filename - if (options.cache && !options.filename) { - return fn(new Error('the "filename" option is required for caching')); - } - - try { - var path = options.filename; - var tmpl = options.cache - ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) - : exports.compile(str, options); - fn(null, tmpl(options)); - } catch (err) { - fn(err); - } -}; - -/** - * Render a Jade 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 = {}; - } - - try { - options.filename = path; - var str = options.cache - ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) - : fs.readFileSync(path, 'utf8'); - exports.render(str, options, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Express support. - */ - -exports.__express = exports.renderFile; diff --git a/node_modules/jade/lib/lexer.js b/node_modules/jade/lib/lexer.js deleted file mode 100644 index 1e0bfff..0000000 --- a/node_modules/jade/lib/lexer.js +++ /dev/null @@ -1,775 +0,0 @@ -/*! - * Jade - Lexer - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -var utils = require('./utils'); - -/** - * Initialize `Lexer` with the given `str`. - * - * Options: - * - * - `colons` allow colons for attr delimiters - * - * @param {String} str - * @param {Object} options - * @api private - */ - -var Lexer = module.exports = function Lexer(str, options) { - options = options || {}; - this.input = str.replace(/\r\n|\r/g, '\n'); - this.colons = options.colons; - this.deferredTokens = []; - this.lastIndents = 0; - this.lineno = 1; - this.stash = []; - this.indentStack = []; - this.indentRe = null; - this.pipeless = false; -}; - -/** - * Lexer prototype. - */ - -Lexer.prototype = { - - /** - * Construct a token with the given `type` and `val`. - * - * @param {String} type - * @param {String} val - * @return {Object} - * @api private - */ - - tok: function(type, val){ - return { - type: type - , line: this.lineno - , val: val - } - }, - - /** - * Consume the given `len` of input. - * - * @param {Number} len - * @api private - */ - - consume: function(len){ - this.input = this.input.substr(len); - }, - - /** - * Scan for `type` with the given `regexp`. - * - * @param {String} type - * @param {RegExp} regexp - * @return {Object} - * @api private - */ - - scan: function(regexp, type){ - var captures; - if (captures = regexp.exec(this.input)) { - this.consume(captures[0].length); - return this.tok(type, captures[1]); - } - }, - - /** - * Defer the given `tok`. - * - * @param {Object} tok - * @api private - */ - - defer: function(tok){ - this.deferredTokens.push(tok); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - var fetch = n - this.stash.length; - while (fetch-- > 0) this.stash.push(this.next()); - return this.stash[--n]; - }, - - /** - * Return the indexOf `start` / `end` delimiters. - * - * @param {String} start - * @param {String} end - * @return {Number} - * @api private - */ - - indexOfDelimiters: function(start, end){ - var str = this.input - , nstart = 0 - , nend = 0 - , pos = 0; - for (var i = 0, len = str.length; i < len; ++i) { - if (start == str.charAt(i)) { - ++nstart; - } else if (end == str.charAt(i)) { - if (++nend == nstart) { - pos = i; - break; - } - } - } - return pos; - }, - - /** - * Stashed token. - */ - - stashed: function() { - return this.stash.length - && this.stash.shift(); - }, - - /** - * Deferred token. - */ - - deferred: function() { - return this.deferredTokens.length - && this.deferredTokens.shift(); - }, - - /** - * end-of-source. - */ - - eos: function() { - if (this.input.length) return; - if (this.indentStack.length) { - this.indentStack.shift(); - return this.tok('outdent'); - } else { - return this.tok('eos'); - } - }, - - /** - * Blank line. - */ - - blank: function() { - var captures; - if (captures = /^\n *\n/.exec(this.input)) { - this.consume(captures[0].length - 1); - ++this.lineno; - if (this.pipeless) return this.tok('text', ''); - return this.next(); - } - }, - - /** - * Comment. - */ - - comment: function() { - var captures; - if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('comment', captures[2]); - tok.buffer = '-' != captures[1]; - return tok; - } - }, - - /** - * Interpolated tag. - */ - - interpolation: function() { - var captures; - if (captures = /^#\{(.*?)\}/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('interpolation', captures[1]); - } - }, - - /** - * Tag. - */ - - tag: function() { - var captures; - if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { - this.consume(captures[0].length); - var tok, name = captures[1]; - if (':' == name[name.length - 1]) { - name = name.slice(0, -1); - tok = this.tok('tag', name); - this.defer(this.tok(':')); - while (' ' == this.input[0]) this.input = this.input.substr(1); - } else { - tok = this.tok('tag', name); - } - tok.selfClosing = !! captures[2]; - return tok; - } - }, - - /** - * Filter. - */ - - filter: function() { - return this.scan(/^:(\w+)/, 'filter'); - }, - - /** - * Doctype. - */ - - doctype: function() { - return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); - }, - - /** - * Id. - */ - - id: function() { - return this.scan(/^#([\w-]+)/, 'id'); - }, - - /** - * Class. - */ - - className: function() { - return this.scan(/^\.([\w-]+)/, 'class'); - }, - - /** - * Text. - */ - - text: function() { - return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); - }, - - /** - * Extends. - */ - - "extends": function() { - return this.scan(/^extends? +([^\n]+)/, 'extends'); - }, - - /** - * Block prepend. - */ - - prepend: function() { - var captures; - if (captures = /^prepend +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'prepend' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block append. - */ - - append: function() { - var captures; - if (captures = /^append +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'append' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block. - */ - - block: function() { - var captures; - if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = captures[1] || 'replace' - , name = captures[2] - , tok = this.tok('block', name); - - tok.mode = mode; - return tok; - } - }, - - /** - * Yield. - */ - - yield: function() { - return this.scan(/^yield */, 'yield'); - }, - - /** - * Include. - */ - - include: function() { - return this.scan(/^include +([^\n]+)/, 'include'); - }, - - /** - * Case. - */ - - "case": function() { - return this.scan(/^case +([^\n]+)/, 'case'); - }, - - /** - * When. - */ - - when: function() { - return this.scan(/^when +([^:\n]+)/, 'when'); - }, - - /** - * Default. - */ - - "default": function() { - return this.scan(/^default */, 'default'); - }, - - /** - * Assignment. - */ - - assignment: function() { - var captures; - if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { - this.consume(captures[0].length); - var name = captures[1] - , val = captures[2]; - return this.tok('code', 'var ' + name + ' = (' + val + ');'); - } - }, - - /** - * Call mixin. - */ - - call: function(){ - var captures; - if (captures = /^\+([-\w]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('call', captures[1]); - - // Check for args (not attributes) - if (captures = /^ *\((.*?)\)/.exec(this.input)) { - if (!/^ *[-\w]+ *=/.test(captures[1])) { - this.consume(captures[0].length); - tok.args = captures[1]; - } - } - - return tok; - } - }, - - /** - * Mixin. - */ - - mixin: function(){ - var captures; - if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('mixin', captures[1]); - tok.args = captures[2]; - return tok; - } - }, - - /** - * Conditional. - */ - - conditional: function() { - var captures; - if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var type = captures[1] - , js = captures[2]; - - switch (type) { - case 'if': js = 'if (' + js + ')'; break; - case 'unless': js = 'if (!(' + js + '))'; break; - case 'else if': js = 'else if (' + js + ')'; break; - case 'else': js = 'else'; break; - } - - return this.tok('code', js); - } - }, - - /** - * While. - */ - - "while": function() { - var captures; - if (captures = /^while +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('code', 'while (' + captures[1] + ')'); - } - }, - - /** - * Each. - */ - - each: function() { - var captures; - if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('each', captures[1]); - tok.key = captures[2] || '$index'; - tok.code = captures[3]; - return tok; - } - }, - - /** - * Code. - */ - - code: function() { - var captures; - if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var flags = captures[1]; - captures[1] = captures[2]; - var tok = this.tok('code', captures[1]); - tok.escape = flags.charAt(0) === '='; - tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; - return tok; - } - }, - - /** - * Attributes. - */ - - attrs: function() { - if ('(' == this.input.charAt(0)) { - var index = this.indexOfDelimiters('(', ')') - , str = this.input.substr(1, index-1) - , tok = this.tok('attrs') - , len = str.length - , colons = this.colons - , states = ['key'] - , escapedAttr - , key = '' - , val = '' - , quote - , c - , p; - - function state(){ - return states[states.length - 1]; - } - - function interpolate(attr) { - return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ - return escape - ? _ - : quote + " + (" + expr + ") + " + quote; - }); - } - - this.consume(index + 1); - tok.attrs = {}; - tok.escaped = {}; - - function parse(c) { - var real = c; - // TODO: remove when people fix ":" - if (colons && ':' == c) c = '='; - switch (c) { - case ',': - case '\n': - switch (state()) { - case 'expr': - case 'array': - case 'string': - case 'object': - val += c; - break; - default: - states.push('key'); - val = val.trim(); - key = key.trim(); - if ('' == key) return; - key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); - tok.escaped[key] = escapedAttr; - tok.attrs[key] = '' == val - ? true - : interpolate(val); - key = val = ''; - } - break; - case '=': - switch (state()) { - case 'key char': - key += real; - break; - case 'val': - case 'expr': - case 'array': - case 'string': - case 'object': - val += real; - break; - default: - escapedAttr = '!' != p; - states.push('val'); - } - break; - case '(': - if ('val' == state() - || 'expr' == state()) states.push('expr'); - val += c; - break; - case ')': - if ('expr' == state() - || 'val' == state()) states.pop(); - val += c; - break; - case '{': - if ('val' == state()) states.push('object'); - val += c; - break; - case '}': - if ('object' == state()) states.pop(); - val += c; - break; - case '[': - if ('val' == state()) states.push('array'); - val += c; - break; - case ']': - if ('array' == state()) states.pop(); - val += c; - break; - case '"': - case "'": - switch (state()) { - case 'key': - states.push('key char'); - break; - case 'key char': - states.pop(); - break; - case 'string': - if (c == quote) states.pop(); - val += c; - break; - default: - states.push('string'); - val += c; - quote = c; - } - break; - case '': - break; - default: - switch (state()) { - case 'key': - case 'key char': - key += c; - break; - default: - val += c; - } - } - p = c; - } - - for (var i = 0; i < len; ++i) { - parse(str.charAt(i)); - } - - parse(','); - - if ('/' == this.input.charAt(0)) { - this.consume(1); - tok.selfClosing = true; - } - - return tok; - } - }, - - /** - * Indent | Outdent | Newline. - */ - - indent: function() { - var captures, re; - - // established regexp - if (this.indentRe) { - captures = this.indentRe.exec(this.input); - // determine regexp - } else { - // tabs - re = /^\n(\t*) */; - captures = re.exec(this.input); - - // spaces - if (captures && !captures[1].length) { - re = /^\n( *)/; - captures = re.exec(this.input); - } - - // established - if (captures && captures[1].length) this.indentRe = re; - } - - if (captures) { - var tok - , indents = captures[1].length; - - ++this.lineno; - this.consume(indents + 1); - - if (' ' == this.input[0] || '\t' == this.input[0]) { - throw new Error('Invalid indentation, you can use tabs or spaces but not both'); - } - - // blank line - if ('\n' == this.input[0]) return this.tok('newline'); - - // outdent - if (this.indentStack.length && indents < this.indentStack[0]) { - while (this.indentStack.length && this.indentStack[0] > indents) { - this.stash.push(this.tok('outdent')); - this.indentStack.shift(); - } - tok = this.stash.pop(); - // indent - } else if (indents && indents != this.indentStack[0]) { - this.indentStack.unshift(indents); - tok = this.tok('indent', indents); - // newline - } else { - tok = this.tok('newline'); - } - - return tok; - } - }, - - /** - * Pipe-less text consumed only when - * pipeless is true; - */ - - pipelessText: function() { - if (this.pipeless) { - if ('\n' == this.input[0]) return; - var i = this.input.indexOf('\n'); - if (-1 == i) i = this.input.length; - var str = this.input.substr(0, i); - this.consume(str.length); - return this.tok('text', str); - } - }, - - /** - * ':' - */ - - colon: function() { - return this.scan(/^: */, ':'); - }, - - /** - * Return the next token object, or those - * previously stashed by lookahead. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.stashed() - || this.next(); - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - next: function() { - return this.deferred() - || this.blank() - || this.eos() - || this.pipelessText() - || this.yield() - || this.doctype() - || this.interpolation() - || this["case"]() - || this.when() - || this["default"]() - || this["extends"]() - || this.append() - || this.prepend() - || this.block() - || this.include() - || this.mixin() - || this.call() - || this.conditional() - || this.each() - || this["while"]() - || this.assignment() - || this.tag() - || this.filter() - || this.code() - || this.id() - || this.className() - || this.attrs() - || this.indent() - || this.comment() - || this.colon() - || this.text(); - } -}; diff --git a/node_modules/jade/lib/nodes/attrs.js b/node_modules/jade/lib/nodes/attrs.js deleted file mode 100644 index 5de9b59..0000000 --- a/node_modules/jade/lib/nodes/attrs.js +++ /dev/null @@ -1,77 +0,0 @@ - -/*! - * Jade - nodes - Attrs - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'), - Block = require('./block'); - -/** - * Initialize a `Attrs` node. - * - * @api public - */ - -var Attrs = module.exports = function Attrs() { - this.attrs = []; -}; - -/** - * Inherit from `Node`. - */ - -Attrs.prototype.__proto__ = Node.prototype; - -/** - * Set attribute `name` to `val`, keep in mind these become - * part of a raw js object literal, so to quote a value you must - * '"quote me"', otherwise or example 'user.name' is literal JavaScript. - * - * @param {String} name - * @param {String} val - * @param {Boolean} escaped - * @return {Tag} for chaining - * @api public - */ - -Attrs.prototype.setAttribute = function(name, val, escaped){ - this.attrs.push({ name: name, val: val, escaped: escaped }); - return this; -}; - -/** - * Remove attribute `name` when present. - * - * @param {String} name - * @api public - */ - -Attrs.prototype.removeAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - delete this.attrs[i]; - } - } -}; - -/** - * Get attribute value by `name`. - * - * @param {String} name - * @return {String} - * @api public - */ - -Attrs.prototype.getAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - return this.attrs[i].val; - } - } -}; diff --git a/node_modules/jade/lib/nodes/block-comment.js b/node_modules/jade/lib/nodes/block-comment.js deleted file mode 100644 index 4f41e4a..0000000 --- a/node_modules/jade/lib/nodes/block-comment.js +++ /dev/null @@ -1,33 +0,0 @@ - -/*! - * Jade - nodes - BlockComment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `BlockComment` with the given `block`. - * - * @param {String} val - * @param {Block} block - * @param {Boolean} buffer - * @api public - */ - -var BlockComment = module.exports = function BlockComment(val, block, buffer) { - this.block = block; - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -BlockComment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/block.js b/node_modules/jade/lib/nodes/block.js deleted file mode 100644 index 6bb18c9..0000000 --- a/node_modules/jade/lib/nodes/block.js +++ /dev/null @@ -1,122 +0,0 @@ - -/*! - * Jade - nodes - Block - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Block` with an optional `node`. - * - * @param {Node} node - * @api public - */ - -var Block = module.exports = function Block(node){ - this.nodes = []; - if (node) this.push(node); -}; - -/** - * Inherit from `Node`. - */ - -Block.prototype.__proto__ = Node.prototype; - -/** - * Block flag. - */ - -Block.prototype.isBlock = true; - -/** - * Replace the nodes in `other` with the nodes - * in `this` block. - * - * @param {Block} other - * @api private - */ - -Block.prototype.replace = function(other){ - other.nodes = this.nodes; -}; - -/** - * Pust the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.push = function(node){ - return this.nodes.push(node); -}; - -/** - * Check if this block is empty. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.isEmpty = function(){ - return 0 == this.nodes.length; -}; - -/** - * Unshift the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.unshift = function(node){ - return this.nodes.unshift(node); -}; - -/** - * Return the "last" block, or the first `yield` node. - * - * @return {Block} - * @api private - */ - -Block.prototype.includeBlock = function(){ - var ret = this - , node; - - for (var i = 0, len = this.nodes.length; i < len; ++i) { - node = this.nodes[i]; - if (node.yield) return node; - else if (node.textOnly) continue; - else if (node.includeBlock) ret = node.includeBlock(); - else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); - if (ret.yield) return ret; - } - - return ret; -}; - -/** - * Return a clone of this block. - * - * @return {Block} - * @api private - */ - -Block.prototype.clone = function(){ - var clone = new Block; - for (var i = 0, len = this.nodes.length; i < len; ++i) { - clone.push(this.nodes[i].clone()); - } - return clone; -}; - diff --git a/node_modules/jade/lib/nodes/case.js b/node_modules/jade/lib/nodes/case.js deleted file mode 100644 index 08ff033..0000000 --- a/node_modules/jade/lib/nodes/case.js +++ /dev/null @@ -1,43 +0,0 @@ - -/*! - * Jade - nodes - Case - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Case` with `expr`. - * - * @param {String} expr - * @api public - */ - -var Case = exports = module.exports = function Case(expr, block){ - this.expr = expr; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Case.prototype.__proto__ = Node.prototype; - -var When = exports.When = function When(expr, block){ - this.expr = expr; - this.block = block; - this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -When.prototype.__proto__ = Node.prototype; - diff --git a/node_modules/jade/lib/nodes/code.js b/node_modules/jade/lib/nodes/code.js deleted file mode 100644 index babc675..0000000 --- a/node_modules/jade/lib/nodes/code.js +++ /dev/null @@ -1,35 +0,0 @@ - -/*! - * Jade - nodes - Code - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Code` node with the given code `val`. - * Code may also be optionally buffered and escaped. - * - * @param {String} val - * @param {Boolean} buffer - * @param {Boolean} escape - * @api public - */ - -var Code = module.exports = function Code(val, buffer, escape) { - this.val = val; - this.buffer = buffer; - this.escape = escape; - if (val.match(/^ *else/)) this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -Code.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/comment.js b/node_modules/jade/lib/nodes/comment.js deleted file mode 100644 index 2e1469e..0000000 --- a/node_modules/jade/lib/nodes/comment.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Jade - nodes - Comment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Comment` with the given `val`, optionally `buffer`, - * otherwise the comment may render in the output. - * - * @param {String} val - * @param {Boolean} buffer - * @api public - */ - -var Comment = module.exports = function Comment(val, buffer) { - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -Comment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/doctype.js b/node_modules/jade/lib/nodes/doctype.js deleted file mode 100644 index b8f33e5..0000000 --- a/node_modules/jade/lib/nodes/doctype.js +++ /dev/null @@ -1,29 +0,0 @@ - -/*! - * Jade - nodes - Doctype - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Doctype` with the given `val`. - * - * @param {String} val - * @api public - */ - -var Doctype = module.exports = function Doctype(val) { - this.val = val; -}; - -/** - * Inherit from `Node`. - */ - -Doctype.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/each.js b/node_modules/jade/lib/nodes/each.js deleted file mode 100644 index f54101f..0000000 --- a/node_modules/jade/lib/nodes/each.js +++ /dev/null @@ -1,35 +0,0 @@ - -/*! - * Jade - nodes - Each - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize an `Each` node, representing iteration - * - * @param {String} obj - * @param {String} val - * @param {String} key - * @param {Block} block - * @api public - */ - -var Each = module.exports = function Each(obj, val, key, block) { - this.obj = obj; - this.val = val; - this.key = key; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Each.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/filter.js b/node_modules/jade/lib/nodes/filter.js deleted file mode 100644 index 0d7ff6e..0000000 --- a/node_modules/jade/lib/nodes/filter.js +++ /dev/null @@ -1,34 +0,0 @@ - -/*! - * Jade - nodes - Filter - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , Block = require('./block'); - -/** - * Initialize a `Filter` node with the given - * filter `name` and `block`. - * - * @param {String} name - * @param {Block|Node} block - * @api public - */ - -var Filter = module.exports = function Filter(name, block, attrs) { - this.name = name; - this.block = block; - this.attrs = attrs; -}; - -/** - * Inherit from `Node`. - */ - -Filter.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/index.js b/node_modules/jade/lib/nodes/index.js deleted file mode 100644 index 386ad2f..0000000 --- a/node_modules/jade/lib/nodes/index.js +++ /dev/null @@ -1,20 +0,0 @@ - -/*! - * Jade - nodes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -exports.Node = require('./node'); -exports.Tag = require('./tag'); -exports.Code = require('./code'); -exports.Each = require('./each'); -exports.Case = require('./case'); -exports.Text = require('./text'); -exports.Block = require('./block'); -exports.Mixin = require('./mixin'); -exports.Filter = require('./filter'); -exports.Comment = require('./comment'); -exports.Literal = require('./literal'); -exports.BlockComment = require('./block-comment'); -exports.Doctype = require('./doctype'); diff --git a/node_modules/jade/lib/nodes/literal.js b/node_modules/jade/lib/nodes/literal.js deleted file mode 100644 index fde586b..0000000 --- a/node_modules/jade/lib/nodes/literal.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Jade - nodes - Literal - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Literal` node with the given `str. - * - * @param {String} str - * @api public - */ - -var Literal = module.exports = function Literal(str) { - this.str = str - .replace(/\\/g, "\\\\") - .replace(/\n|\r\n/g, "\\n") - .replace(/'/g, "\\'"); -}; - -/** - * Inherit from `Node`. - */ - -Literal.prototype.__proto__ = Node.prototype; diff --git a/node_modules/jade/lib/nodes/mixin.js b/node_modules/jade/lib/nodes/mixin.js deleted file mode 100644 index 8407bc7..0000000 --- a/node_modules/jade/lib/nodes/mixin.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * Jade - nodes - Mixin - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'); - -/** - * Initialize a new `Mixin` with `name` and `block`. - * - * @param {String} name - * @param {String} args - * @param {Block} block - * @api public - */ - -var Mixin = module.exports = function Mixin(name, args, block, call){ - this.name = name; - this.args = args; - this.block = block; - this.attrs = []; - this.call = call; -}; - -/** - * Inherit from `Attrs`. - */ - -Mixin.prototype.__proto__ = Attrs.prototype; - diff --git a/node_modules/jade/lib/nodes/node.js b/node_modules/jade/lib/nodes/node.js deleted file mode 100644 index e98f042..0000000 --- a/node_modules/jade/lib/nodes/node.js +++ /dev/null @@ -1,25 +0,0 @@ - -/*! - * Jade - nodes - Node - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Initialize a `Node`. - * - * @api public - */ - -var Node = module.exports = function Node(){}; - -/** - * Clone this node (return itself) - * - * @return {Node} - * @api private - */ - -Node.prototype.clone = function(){ - return this; -}; diff --git a/node_modules/jade/lib/nodes/tag.js b/node_modules/jade/lib/nodes/tag.js deleted file mode 100644 index 4b6728a..0000000 --- a/node_modules/jade/lib/nodes/tag.js +++ /dev/null @@ -1,95 +0,0 @@ - -/*! - * Jade - nodes - Tag - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'), - Block = require('./block'), - inlineTags = require('../inline-tags'); - -/** - * Initialize a `Tag` node with the given tag `name` and optional `block`. - * - * @param {String} name - * @param {Block} block - * @api public - */ - -var Tag = module.exports = function Tag(name, block) { - this.name = name; - this.attrs = []; - this.block = block || new Block; -}; - -/** - * Inherit from `Attrs`. - */ - -Tag.prototype.__proto__ = Attrs.prototype; - -/** - * Clone this tag. - * - * @return {Tag} - * @api private - */ - -Tag.prototype.clone = function(){ - var clone = new Tag(this.name, this.block.clone()); - clone.line = this.line; - clone.attrs = this.attrs; - clone.textOnly = this.textOnly; - return clone; -}; - -/** - * Check if this tag is an inline tag. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.isInline = function(){ - return ~inlineTags.indexOf(this.name); -}; - -/** - * Check if this tag's contents can be inlined. Used for pretty printing. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.canInline = function(){ - var nodes = this.block.nodes; - - function isInline(node){ - // Recurse if the node is a block - if (node.isBlock) return node.nodes.every(isInline); - return node.isText || (node.isInline && node.isInline()); - } - - // Empty tag - if (!nodes.length) return true; - - // Text-only or inline-only tag - if (1 == nodes.length) return isInline(nodes[0]); - - // Multi-line inline-only tag - if (this.block.nodes.every(isInline)) { - for (var i = 1, len = nodes.length; i < len; ++i) { - if (nodes[i-1].isText && nodes[i].isText) - return false; - } - return true; - } - - // Mixed tag - return false; -}; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/text.js b/node_modules/jade/lib/nodes/text.js deleted file mode 100644 index 3b5dd55..0000000 --- a/node_modules/jade/lib/nodes/text.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * Jade - nodes - Text - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Text` node with optional `line`. - * - * @param {String} line - * @api public - */ - -var Text = module.exports = function Text(line) { - this.val = ''; - if ('string' == typeof line) this.val = line; -}; - -/** - * Inherit from `Node`. - */ - -Text.prototype.__proto__ = Node.prototype; - -/** - * Flag as text. - */ - -Text.prototype.isText = true; \ No newline at end of file diff --git a/node_modules/jade/lib/parser.js b/node_modules/jade/lib/parser.js deleted file mode 100644 index 5039c90..0000000 --- a/node_modules/jade/lib/parser.js +++ /dev/null @@ -1,699 +0,0 @@ - -/*! - * Jade - Parser - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Lexer = require('./lexer') - , nodes = require('./nodes') - , utils = require('./utils') - , filters = require('./filters') - , path = require('path') - , extname = path.extname; - -/** - * Initialize `Parser` with the given input `str` and `filename`. - * - * @param {String} str - * @param {String} filename - * @param {Object} options - * @api public - */ - -var Parser = exports = module.exports = function Parser(str, filename, options){ - this.input = str; - this.lexer = new Lexer(str, options); - this.filename = filename; - this.blocks = {}; - this.mixins = {}; - this.options = options; - this.contexts = [this]; -}; - -/** - * Tags that may not contain tags. - */ - -var textOnly = exports.textOnly = ['script', 'style']; - -/** - * Parser prototype. - */ - -Parser.prototype = { - - /** - * Push `parser` onto the context stack, - * or pop and return a `Parser`. - */ - - context: function(parser){ - if (parser) { - this.contexts.push(parser); - } else { - return this.contexts.pop(); - } - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.lexer.advance(); - }, - - /** - * Skip `n` tokens. - * - * @param {Number} n - * @api private - */ - - skip: function(n){ - while (n--) this.advance(); - }, - - /** - * Single token lookahead. - * - * @return {Object} - * @api private - */ - - peek: function() { - return this.lookahead(1); - }, - - /** - * Return lexer lineno. - * - * @return {Number} - * @api private - */ - - line: function() { - return this.lexer.lineno; - }, - - /** - * `n` token lookahead. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - return this.lexer.lookahead(n); - }, - - /** - * Parse input returning a string of js for evaluation. - * - * @return {String} - * @api public - */ - - parse: function(){ - var block = new nodes.Block, parser; - block.line = this.line(); - - while ('eos' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - - if (parser = this.extending) { - this.context(parser); - var ast = parser.parse(); - this.context(); - // hoist mixins - for (var name in this.mixins) - ast.unshift(this.mixins[name]); - return ast; - } - - return block; - }, - - /** - * Expect the given type, or throw an exception. - * - * @param {String} type - * @api private - */ - - expect: function(type){ - if (this.peek().type === type) { - return this.advance(); - } else { - throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); - } - }, - - /** - * Accept the given `type`. - * - * @param {String} type - * @api private - */ - - accept: function(type){ - if (this.peek().type === type) { - return this.advance(); - } - }, - - /** - * tag - * | doctype - * | mixin - * | include - * | filter - * | comment - * | text - * | each - * | code - * | yield - * | id - * | class - * | interpolation - */ - - parseExpr: function(){ - switch (this.peek().type) { - case 'tag': - return this.parseTag(); - case 'mixin': - return this.parseMixin(); - case 'block': - return this.parseBlock(); - case 'case': - return this.parseCase(); - case 'when': - return this.parseWhen(); - case 'default': - return this.parseDefault(); - case 'extends': - return this.parseExtends(); - case 'include': - return this.parseInclude(); - case 'doctype': - return this.parseDoctype(); - case 'filter': - return this.parseFilter(); - case 'comment': - return this.parseComment(); - case 'text': - return this.parseText(); - case 'each': - return this.parseEach(); - case 'code': - return this.parseCode(); - case 'call': - return this.parseCall(); - case 'interpolation': - return this.parseInterpolation(); - case 'yield': - this.advance(); - var block = new nodes.Block; - block.yield = true; - return block; - case 'id': - case 'class': - var tok = this.advance(); - this.lexer.defer(this.lexer.tok('tag', 'div')); - this.lexer.defer(tok); - return this.parseExpr(); - default: - throw new Error('unexpected token "' + this.peek().type + '"'); - } - }, - - /** - * Text - */ - - parseText: function(){ - var tok = this.expect('text'); - var node = new nodes.Text(tok.val); - node.line = this.line(); - return node; - }, - - /** - * ':' expr - * | block - */ - - parseBlockExpansion: function(){ - if (':' == this.peek().type) { - this.advance(); - return new nodes.Block(this.parseExpr()); - } else { - return this.block(); - } - }, - - /** - * case - */ - - parseCase: function(){ - var val = this.expect('case').val; - var node = new nodes.Case(val); - node.line = this.line(); - node.block = this.block(); - return node; - }, - - /** - * when - */ - - parseWhen: function(){ - var val = this.expect('when').val - return new nodes.Case.When(val, this.parseBlockExpansion()); - }, - - /** - * default - */ - - parseDefault: function(){ - this.expect('default'); - return new nodes.Case.When('default', this.parseBlockExpansion()); - }, - - /** - * code - */ - - parseCode: function(){ - var tok = this.expect('code'); - var node = new nodes.Code(tok.val, tok.buffer, tok.escape); - var block; - var i = 1; - node.line = this.line(); - while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; - block = 'indent' == this.lookahead(i).type; - if (block) { - this.skip(i-1); - node.block = this.block(); - } - return node; - }, - - /** - * comment - */ - - parseComment: function(){ - var tok = this.expect('comment'); - var node; - - if ('indent' == this.peek().type) { - node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); - } else { - node = new nodes.Comment(tok.val, tok.buffer); - } - - node.line = this.line(); - return node; - }, - - /** - * doctype - */ - - parseDoctype: function(){ - var tok = this.expect('doctype'); - var node = new nodes.Doctype(tok.val); - node.line = this.line(); - return node; - }, - - /** - * filter attrs? text-block - */ - - parseFilter: function(){ - var tok = this.expect('filter'); - var attrs = this.accept('attrs'); - var block; - - this.lexer.pipeless = true; - block = this.parseTextBlock(); - this.lexer.pipeless = false; - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * each block - */ - - parseEach: function(){ - var tok = this.expect('each'); - var node = new nodes.Each(tok.code, tok.val, tok.key); - node.line = this.line(); - node.block = this.block(); - if (this.peek().type == 'code' && this.peek().val == 'else') { - this.advance(); - node.alternative = this.block(); - } - return node; - }, - - /** - * 'extends' name - */ - - parseExtends: function(){ - var path = require('path'); - var fs = require('fs'); - var dirname = path.dirname; - var basename = path.basename; - var join = path.join; - - if (!this.filename) - throw new Error('the "filename" option is required to extend templates'); - - var path = this.expect('extends').val.trim(); - var dir = dirname(this.filename); - - var path = join(dir, path + '.jade'); - var str = fs.readFileSync(path, 'utf8'); - var parser = new Parser(str, path, this.options); - - parser.blocks = this.blocks; - parser.contexts = this.contexts; - this.extending = parser; - - // TODO: null node - return new nodes.Literal(''); - }, - - /** - * 'block' name block - */ - - parseBlock: function(){ - var block = this.expect('block'); - var mode = block.mode; - var name = block.val.trim(); - - block = 'indent' == this.peek().type - ? this.block() - : new nodes.Block(new nodes.Literal('')); - - var prev = this.blocks[name]; - - if (prev) { - switch (prev.mode) { - case 'append': - block.nodes = block.nodes.concat(prev.nodes); - prev = block; - break; - case 'prepend': - block.nodes = prev.nodes.concat(block.nodes); - prev = block; - break; - } - } - - block.mode = mode; - return this.blocks[name] = prev || block; - }, - - /** - * include block? - */ - - parseInclude: function(){ - var path = require('path'); - var fs = require('fs'); - var dirname = path.dirname; - var basename = path.basename; - var join = path.join; - - var path = this.expect('include').val.trim(); - var dir = dirname(this.filename); - - if (!this.filename) - throw new Error('the "filename" option is required to use includes'); - - // no extension - if (!~basename(path).indexOf('.')) { - path += '.jade'; - } - - // non-jade - if ('.jade' != path.substr(-5)) { - var path = join(dir, path); - var str = fs.readFileSync(path, 'utf8'); - var ext = extname(path).slice(1); - var filter = filters[ext]; - if (filter) str = filter(str, { filename: path }).replace(/\\n/g, '\n'); - return new nodes.Literal(str); - } - - var path = join(dir, path); - var str = fs.readFileSync(path, 'utf8'); - var parser = new Parser(str, path, this.options); - parser.blocks = utils.merge({}, this.blocks); - parser.mixins = this.mixins; - - this.context(parser); - var ast = parser.parse(); - this.context(); - ast.filename = path; - - if ('indent' == this.peek().type) { - ast.includeBlock().push(this.block()); - } - - return ast; - }, - - /** - * call ident block - */ - - parseCall: function(){ - var tok = this.expect('call'); - var name = tok.val; - var args = tok.args; - var mixin = new nodes.Mixin(name, args, new nodes.Block, true); - - this.tag(mixin); - if (mixin.block.isEmpty()) mixin.block = null; - return mixin; - }, - - /** - * mixin block - */ - - parseMixin: function(){ - var tok = this.expect('mixin'); - var name = tok.val; - var args = tok.args; - var mixin; - - // definition - if ('indent' == this.peek().type) { - mixin = new nodes.Mixin(name, args, this.block(), false); - this.mixins[name] = mixin; - return mixin; - // call - } else { - return new nodes.Mixin(name, args, null, true); - } - }, - - /** - * indent (text | newline)* outdent - */ - - parseTextBlock: function(){ - var block = new nodes.Block; - block.line = this.line(); - var spaces = this.expect('indent').val; - if (null == this._spaces) this._spaces = spaces; - var indent = Array(spaces - this._spaces + 1).join(' '); - while ('outdent' != this.peek().type) { - switch (this.peek().type) { - case 'newline': - this.advance(); - break; - case 'indent': - this.parseTextBlock().nodes.forEach(function(node){ - block.push(node); - }); - break; - default: - var text = new nodes.Text(indent + this.advance().val); - text.line = this.line(); - block.push(text); - } - } - - if (spaces == this._spaces) this._spaces = null; - this.expect('outdent'); - return block; - }, - - /** - * indent expr* outdent - */ - - block: function(){ - var block = new nodes.Block; - block.line = this.line(); - this.expect('indent'); - while ('outdent' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - this.expect('outdent'); - return block; - }, - - /** - * interpolation (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseInterpolation: function(){ - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - tag.buffer = true; - return this.tag(tag); - }, - - /** - * tag (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseTag: function(){ - // ast-filter look-ahead - var i = 2; - if ('attrs' == this.lookahead(i).type) ++i; - - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - - tag.selfClosing = tok.selfClosing; - - return this.tag(tag); - }, - - /** - * Parse tag. - */ - - tag: function(tag){ - var dot; - - tag.line = this.line(); - - // (attrs | class | id)* - out: - while (true) { - switch (this.peek().type) { - case 'id': - case 'class': - var tok = this.advance(); - tag.setAttribute(tok.type, "'" + tok.val + "'"); - continue; - case 'attrs': - var tok = this.advance() - , obj = tok.attrs - , escaped = tok.escaped - , names = Object.keys(obj); - - if (tok.selfClosing) tag.selfClosing = true; - - for (var i = 0, len = names.length; i < len; ++i) { - var name = names[i] - , val = obj[name]; - tag.setAttribute(name, val, escaped[name]); - } - continue; - default: - break out; - } - } - - // check immediate '.' - if ('.' == this.peek().val) { - dot = tag.textOnly = true; - this.advance(); - } - - // (text | code | ':')? - switch (this.peek().type) { - case 'text': - tag.block.push(this.parseText()); - break; - case 'code': - tag.code = this.parseCode(); - break; - case ':': - this.advance(); - tag.block = new nodes.Block; - tag.block.push(this.parseExpr()); - break; - } - - // newline* - while ('newline' == this.peek().type) this.advance(); - - tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); - - // script special-case - if ('script' == tag.name) { - var type = tag.getAttribute('type'); - if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { - tag.textOnly = false; - } - } - - // block? - if ('indent' == this.peek().type) { - if (tag.textOnly) { - this.lexer.pipeless = true; - tag.block = this.parseTextBlock(); - this.lexer.pipeless = false; - } else { - var block = this.block(); - if (tag.block) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - tag.block.push(block.nodes[i]); - } - } else { - tag.block = block; - } - } - } - - return tag; - } -}; diff --git a/node_modules/jade/lib/runtime.js b/node_modules/jade/lib/runtime.js deleted file mode 100644 index fb711f5..0000000 --- a/node_modules/jade/lib/runtime.js +++ /dev/null @@ -1,174 +0,0 @@ - -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // 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 || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; diff --git a/node_modules/jade/lib/self-closing.js b/node_modules/jade/lib/self-closing.js deleted file mode 100644 index 0548771..0000000 --- a/node_modules/jade/lib/self-closing.js +++ /dev/null @@ -1,19 +0,0 @@ - -/*! - * Jade - self closing tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'meta' - , 'img' - , 'link' - , 'input' - , 'source' - , 'area' - , 'base' - , 'col' - , 'br' - , 'hr' -]; \ No newline at end of file diff --git a/node_modules/jade/lib/utils.js b/node_modules/jade/lib/utils.js deleted file mode 100644 index ca4a7fa..0000000 --- a/node_modules/jade/lib/utils.js +++ /dev/null @@ -1,68 +0,0 @@ - -/*! - * Jade - utils - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Convert interpolation in the given string to JavaScript. - * - * @param {String} str - * @return {String} - * @api private - */ - -var interpolate = exports.interpolate = function(str){ - return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ - code = code - .replace(/\\'/g, "'") - .replace(/_SLASH_/g, '\\'); - - return escape - ? str.slice(7) - : "' + " - + ('!' == flag ? '' : 'escape') - + "((interp = " + code - + ") == null ? '' : interp) + '"; - }); -}; - -/** - * Escape single quotes in `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -var escape = exports.escape = function(str) { - return str.replace(/'/g, "\\'"); -}; - -/** - * Interpolate, and escape the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.text = function(str){ - return interpolate(escape(str)); -}; - -/** - * Merge `b` into `a`. - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports.merge = function(a, b) { - for (var key in b) a[key] = b[key]; - return a; -}; - diff --git a/node_modules/jade/node_modules/.bin/cake b/node_modules/jade/node_modules/.bin/cake deleted file mode 120000 index d95f32a..0000000 --- a/node_modules/jade/node_modules/.bin/cake +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/cake \ No newline at end of file diff --git a/node_modules/jade/node_modules/.bin/coffee b/node_modules/jade/node_modules/.bin/coffee deleted file mode 120000 index b57f275..0000000 --- a/node_modules/jade/node_modules/.bin/coffee +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/coffee \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/.npmignore b/node_modules/jade/node_modules/coffee-script/.npmignore deleted file mode 100644 index 21e430d..0000000 --- a/node_modules/jade/node_modules/coffee-script/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -*.coffee -*.html -.DS_Store -.git* -Cakefile -documentation/ -examples/ -extras/coffee-script.js -raw/ -src/ -test/ diff --git a/node_modules/jade/node_modules/coffee-script/CNAME b/node_modules/jade/node_modules/coffee-script/CNAME deleted file mode 100644 index faadabe..0000000 --- a/node_modules/jade/node_modules/coffee-script/CNAME +++ /dev/null @@ -1 +0,0 @@ -coffeescript.org \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md b/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md deleted file mode 100644 index 6390c68..0000000 --- a/node_modules/jade/node_modules/coffee-script/CONTRIBUTING.md +++ /dev/null @@ -1,9 +0,0 @@ -## How to contribute to CoffeeScript - -* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffee-script/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. - -* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffee-script/tree/master/test). - -* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffee-script/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). - -* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/LICENSE b/node_modules/jade/node_modules/coffee-script/LICENSE deleted file mode 100644 index dbe6b4e..0000000 --- a/node_modules/jade/node_modules/coffee-script/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2009-2012 Jeremy Ashkenas - -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/jade/node_modules/coffee-script/README b/node_modules/jade/node_modules/coffee-script/README deleted file mode 100644 index 69ee6f4..0000000 --- a/node_modules/jade/node_modules/coffee-script/README +++ /dev/null @@ -1,51 +0,0 @@ - - { - } } { - { { } } - } }{ { - { }{ } } _____ __ __ - ( }{ }{ { ) / ____| / _|/ _| - .- { { } { }} -. | | ___ | |_| |_ ___ ___ - ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ - |`-..________ ..-'| | |___| (_) | | | || __/ __/ - | | \_____\___/|_| |_| \___|\___| - | ;--. - | (__ \ _____ _ _ - | | ) ) / ____| (_) | | - | |/ / | (___ ___ _ __ _ _ __ | |_ - | ( / \___ \ / __| '__| | '_ \| __| - | |/ ____) | (__| | | | |_) | |_ - | | |_____/ \___|_| |_| .__/ \__| - `-.._________..-' | | - |_| - - - CoffeeScript is a little language that compiles into JavaScript. - - Install Node.js, and then the CoffeeScript compiler: - sudo bin/cake install - - Or, if you have the Node Package Manager installed: - npm install -g coffee-script - (Leave off the -g if you don't wish to install globally.) - - Execute a script: - coffee /path/to/script.coffee - - Compile a script: - coffee -c /path/to/script.coffee - - For documentation, usage, and examples, see: - http://coffeescript.org/ - - To suggest a feature, report a bug, or general discussion: - http://github.com/jashkenas/coffee-script/issues/ - - If you'd like to chat, drop by #coffeescript on Freenode IRC, - or on webchat.freenode.net. - - The source repository: - git://github.com/jashkenas/coffee-script.git - - All contributors are listed here: - http://github.com/jashkenas/coffee-script/contributors diff --git a/node_modules/jade/node_modules/coffee-script/Rakefile b/node_modules/jade/node_modules/coffee-script/Rakefile deleted file mode 100644 index dfb85da..0000000 --- a/node_modules/jade/node_modules/coffee-script/Rakefile +++ /dev/null @@ -1,78 +0,0 @@ -require 'rubygems' -require 'erb' -require 'fileutils' -require 'rake/testtask' -require 'json' - -desc "Build the documentation page" -task :doc do - source = 'documentation/index.html.erb' - child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" } - at_exit { Process.kill("INT", child) } - Signal.trap("INT") { exit } - loop do - mtime = File.stat(source).mtime - if !@mtime || mtime > @mtime - rendered = ERB.new(File.read(source)).result(binding) - File.open('index.html', 'w+') {|f| f.write(rendered) } - end - @mtime = mtime - sleep 1 - end -end - -desc "Build coffee-script-source gem" -task :gem do - require 'rubygems' - require 'rubygems/package' - - gemspec = Gem::Specification.new do |s| - s.name = 'coffee-script-source' - s.version = JSON.parse(File.read('package.json'))["version"] - s.date = Time.now.strftime("%Y-%m-%d") - - s.homepage = "http://jashkenas.github.com/coffee-script/" - s.summary = "The CoffeeScript Compiler" - s.description = <<-EOS - CoffeeScript is a little language that compiles into JavaScript. - Underneath all of those embarrassing braces and semicolons, - JavaScript has always had a gorgeous object model at its heart. - CoffeeScript is an attempt to expose the good parts of JavaScript - in a simple way. - EOS - - s.files = [ - 'lib/coffee_script/coffee-script.js', - 'lib/coffee_script/source.rb' - ] - - s.authors = ['Jeremy Ashkenas'] - s.email = 'jashkenas@gmail.com' - s.rubyforge_project = 'coffee-script-source' - end - - file = File.open("coffee-script-source.gem", "w") - Gem::Package.open(file, 'w') do |pkg| - pkg.metadata = gemspec.to_yaml - - path = "lib/coffee_script/source.rb" - contents = <<-ERUBY -module CoffeeScript - module Source - def self.bundled_path - File.expand_path("../coffee-script.js", __FILE__) - end - end -end - ERUBY - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - - contents = File.read("extras/coffee-script.js") - path = "lib/coffee_script/coffee-script.js" - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - end -end diff --git a/node_modules/jade/node_modules/coffee-script/bin/cake b/node_modules/jade/node_modules/coffee-script/bin/cake deleted file mode 100755 index 5965f4e..0000000 --- a/node_modules/jade/node_modules/coffee-script/bin/cake +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/coffee-script/cake').run(); diff --git a/node_modules/jade/node_modules/coffee-script/bin/coffee b/node_modules/jade/node_modules/coffee-script/bin/coffee deleted file mode 100755 index 3d1d71c..0000000 --- a/node_modules/jade/node_modules/coffee-script/bin/coffee +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/coffee-script/command').run(); diff --git a/node_modules/jade/node_modules/coffee-script/extras/jsl.conf b/node_modules/jade/node_modules/coffee-script/extras/jsl.conf deleted file mode 100644 index 1190da5..0000000 --- a/node_modules/jade/node_modules/coffee-script/extras/jsl.conf +++ /dev/null @@ -1,44 +0,0 @@ -# JavaScriptLint configuration file for CoffeeScript. - -+no_return_value # function {0} does not always return a value -+duplicate_formal # duplicate formal argument {0} --equal_as_assign # test for equality (==) mistyped as assignment (=)?{0} -+var_hides_arg # variable {0} hides argument -+redeclared_var # redeclaration of {0} {1} --anon_no_return_value # anonymous function does not always return a value -+missing_semicolon # missing semicolon -+meaningless_block # meaningless block; curly braces have no impact --comma_separated_stmts # multiple statements separated by commas (use semicolons?) -+unreachable_code # unreachable code -+missing_break # missing break statement --missing_break_for_last_case # missing break statement for last case in switch --comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) --inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement --useless_void # use of the void type may be unnecessary (void is always undefined) -+multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs -+use_of_label # use of label --block_without_braces # block statement without curly braces -+leading_decimal_point # leading decimal point may indicate a number or an object member -+trailing_decimal_point # trailing decimal point may indicate a number or an object member -+octal_number # leading zeros make an octal number -+nested_comment # nested comment -+misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma -+ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement -+empty_statement # empty statement or extra semicolon --missing_option_explicit # the "option explicit" control comment is missing -+partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag -+dup_option_explicit # duplicate "option explicit" control comment -+useless_assign # useless assignment -+ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity -+ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent) --missing_default_case # missing default case in switch statement -+duplicate_case_in_switch # duplicate case in switch statements -+default_not_at_end # the default case is not at the end of the switch statement -+legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax -+jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax -+useless_comparison # useless comparison; comparing identical expressions -+with_statement # with statement hides undeclared variables; use temporary variable instead -+trailing_comma_in_array # extra comma is not recommended in array initializers -+assign_to_function_call # assignment to a function call -+parseint_missing_radix # parseInt missing radix parameter -+lambda_assign_requires_semicolon diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js deleted file mode 100644 index 045156f..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/browser.js +++ /dev/null @@ -1,92 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var CoffeeScript, runScripts; - - CoffeeScript = require('./coffee-script'); - - CoffeeScript.require = require; - - CoffeeScript["eval"] = function(code, options) { - var _ref; - if (options == null) { - options = {}; - } - if ((_ref = options.bare) == null) { - options.bare = true; - } - return eval(CoffeeScript.compile(code, options)); - }; - - CoffeeScript.run = function(code, options) { - if (options == null) { - options = {}; - } - options.bare = true; - return Function(CoffeeScript.compile(code, options))(); - }; - - if (typeof window === "undefined" || window === null) { - return; - } - - CoffeeScript.load = function(url, callback) { - var xhr; - xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); - xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) { - xhr.overrideMimeType('text/plain'); - } - xhr.onreadystatechange = function() { - var _ref; - if (xhr.readyState === 4) { - if ((_ref = xhr.status) === 0 || _ref === 200) { - CoffeeScript.run(xhr.responseText); - } else { - throw new Error("Could not load " + url); - } - if (callback) { - return callback(); - } - } - }; - return xhr.send(null); - }; - - runScripts = function() { - var coffees, execute, index, length, s, scripts; - scripts = document.getElementsByTagName('script'); - coffees = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = scripts.length; _i < _len; _i++) { - s = scripts[_i]; - if (s.type === 'text/coffeescript') { - _results.push(s); - } - } - return _results; - })(); - index = 0; - length = coffees.length; - (execute = function() { - var script; - script = coffees[index++]; - if ((script != null ? script.type : void 0) === 'text/coffeescript') { - if (script.src) { - return CoffeeScript.load(script.src, execute); - } else { - CoffeeScript.run(script.innerHTML); - return execute(); - } - } - })(); - return null; - }; - - if (window.addEventListener) { - addEventListener('DOMContentLoaded', runScripts, false); - } else { - attachEvent('onload', runScripts); - } - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js deleted file mode 100644 index 0e7f1cc..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/cake.js +++ /dev/null @@ -1,113 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; - - fs = require('fs'); - - path = require('path'); - - helpers = require('./helpers'); - - optparse = require('./optparse'); - - CoffeeScript = require('./coffee-script'); - - existsSync = fs.existsSync || path.existsSync; - - tasks = {}; - - options = {}; - - switches = []; - - oparse = null; - - helpers.extend(global, { - task: function(name, description, action) { - var _ref; - if (!action) { - _ref = [description, action], action = _ref[0], description = _ref[1]; - } - return tasks[name] = { - name: name, - description: description, - action: action - }; - }, - option: function(letter, flag, description) { - return switches.push([letter, flag, description]); - }, - invoke: function(name) { - if (!tasks[name]) { - missingTask(name); - } - return tasks[name].action(options); - } - }); - - exports.run = function() { - var arg, args, _i, _len, _ref, _results; - global.__originalDirname = fs.realpathSync('.'); - process.chdir(cakefileDirectory(__originalDirname)); - args = process.argv.slice(2); - CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { - filename: 'Cakefile' - }); - oparse = new optparse.OptionParser(switches); - if (!args.length) { - return printTasks(); - } - try { - options = oparse.parse(args); - } catch (e) { - return fatalError("" + e); - } - _ref = options["arguments"]; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - arg = _ref[_i]; - _results.push(invoke(arg)); - } - return _results; - }; - - printTasks = function() { - var cakefilePath, desc, name, relative, spaces, task; - relative = path.relative || path.resolve; - cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile'); - console.log("" + cakefilePath + " defines the following tasks:\n"); - for (name in tasks) { - task = tasks[name]; - spaces = 20 - name.length; - spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; - desc = task.description ? "# " + task.description : ''; - console.log("cake " + name + spaces + " " + desc); - } - if (switches.length) { - return console.log(oparse.help()); - } - }; - - fatalError = function(message) { - console.error(message + '\n'); - console.log('To see a list of all tasks/options, run "cake"'); - return process.exit(1); - }; - - missingTask = function(task) { - return fatalError("No such task: " + task); - }; - - cakefileDirectory = function(dir) { - var parent; - if (existsSync(path.join(dir, 'Cakefile'))) { - return dir; - } - parent = path.normalize(path.join(dir, '..')); - if (parent !== dir) { - return cakefileDirectory(parent); - } - throw new Error("Cakefile not found in " + (process.cwd())); - }; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js deleted file mode 100644 index 7ee55cd..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/coffee-script.js +++ /dev/null @@ -1,171 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var Lexer, RESERVED, compile, fs, lexer, parser, path, stripBOM, vm, _ref, - __hasProp = {}.hasOwnProperty; - - fs = require('fs'); - - path = require('path'); - - _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED; - - parser = require('./parser').parser; - - vm = require('vm'); - - stripBOM = function(content) { - if (content.charCodeAt(0) === 0xFEFF) { - return content.substring(1); - } else { - return content; - } - }; - - if (require.extensions) { - require.extensions['.coffee'] = function(module, filename) { - var content; - content = compile(stripBOM(fs.readFileSync(filename, 'utf8')), { - filename: filename - }); - return module._compile(content, filename); - }; - } - - exports.VERSION = '1.4.0'; - - exports.RESERVED = RESERVED; - - exports.helpers = require('./helpers'); - - exports.compile = compile = function(code, options) { - var header, js, merge; - if (options == null) { - options = {}; - } - merge = exports.helpers.merge; - try { - js = (parser.parse(lexer.tokenize(code))).compile(options); - if (!options.header) { - return js; - } - } catch (err) { - if (options.filename) { - err.message = "In " + options.filename + ", " + err.message; - } - throw err; - } - header = "Generated by CoffeeScript " + this.VERSION; - return "// " + header + "\n" + js; - }; - - exports.tokens = function(code, options) { - return lexer.tokenize(code, options); - }; - - exports.nodes = function(source, options) { - if (typeof source === 'string') { - return parser.parse(lexer.tokenize(source, options)); - } else { - return parser.parse(source); - } - }; - - exports.run = function(code, options) { - var mainModule; - if (options == null) { - options = {}; - } - mainModule = require.main; - mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; - mainModule.moduleCache && (mainModule.moduleCache = {}); - mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename))); - if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { - return mainModule._compile(compile(code, options), mainModule.filename); - } else { - return mainModule._compile(code, mainModule.filename); - } - }; - - exports["eval"] = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require; - if (options == null) { - options = {}; - } - if (!(code = code.trim())) { - return; - } - Script = vm.Script; - if (Script) { - if (options.sandbox != null) { - if (options.sandbox instanceof Script.createContext().constructor) { - sandbox = options.sandbox; - } else { - sandbox = Script.createContext(); - _ref1 = options.sandbox; - for (k in _ref1) { - if (!__hasProp.call(_ref1, k)) continue; - v = _ref1[k]; - sandbox[k] = v; - } - } - sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; - } else { - sandbox = global; - } - sandbox.__filename = options.filename || 'eval'; - sandbox.__dirname = path.dirname(sandbox.__filename); - if (!(sandbox !== global || sandbox.module || sandbox.require)) { - Module = require('module'); - sandbox.module = _module = new Module(options.modulename || 'eval'); - sandbox.require = _require = function(path) { - return Module._load(path, _module, true); - }; - _module.filename = sandbox.__filename; - _ref2 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - r = _ref2[_i]; - if (r !== 'paths') { - _require[r] = require[r]; - } - } - _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); - _require.resolve = function(request) { - return Module._resolveFilename(request, _module); - }; - } - } - o = {}; - for (k in options) { - if (!__hasProp.call(options, k)) continue; - v = options[k]; - o[k] = v; - } - o.bare = true; - js = compile(code, o); - if (sandbox === global) { - return vm.runInThisContext(js); - } else { - return vm.runInContext(js, sandbox); - } - }; - - lexer = new Lexer; - - parser.lexer = { - lex: function() { - var tag, _ref1; - _ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2]; - return tag; - }, - setInput: function(tokens) { - this.tokens = tokens; - return this.pos = 0; - }, - upcomingInput: function() { - return ""; - } - }; - - parser.yy = require('./nodes'); - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js deleted file mode 100644 index b0bcfe1..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/command.js +++ /dev/null @@ -1,502 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref; - - fs = require('fs'); - - path = require('path'); - - helpers = require('./helpers'); - - optparse = require('./optparse'); - - CoffeeScript = require('./coffee-script'); - - _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; - - EventEmitter = require('events').EventEmitter; - - exists = fs.exists || path.exists; - - helpers.extend(CoffeeScript, new EventEmitter); - - printLine = function(line) { - return process.stdout.write(line + '\n'); - }; - - printWarn = function(line) { - return process.stderr.write(line + '\n'); - }; - - hidden = function(file) { - return /^\.|~$/.test(file); - }; - - BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.'; - - SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']]; - - opts = {}; - - sources = []; - - sourceCode = []; - - notSources = {}; - - watchers = {}; - - optionParser = null; - - exports.run = function() { - var literals, source, _i, _len, _results; - parseOptions(); - if (opts.nodejs) { - return forkNode(); - } - if (opts.help) { - return usage(); - } - if (opts.version) { - return version(); - } - if (opts.require) { - loadRequires(); - } - if (opts.interactive) { - return require('./repl'); - } - if (opts.watch && !fs.watch) { - return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + "."); - } - if (opts.stdio) { - return compileStdio(); - } - if (opts["eval"]) { - return compileScript(null, sources[0]); - } - if (!sources.length) { - return require('./repl'); - } - literals = opts.run ? sources.splice(1) : []; - process.argv = process.argv.slice(0, 2).concat(literals); - process.argv[0] = 'coffee'; - process.execPath = require.main.filename; - _results = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - source = sources[_i]; - _results.push(compilePath(source, true, path.normalize(source))); - } - return _results; - }; - - compilePath = function(source, topLevel, base) { - return fs.stat(source, function(err, stats) { - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - if (topLevel && source.slice(-7) !== '.coffee') { - source = sources[sources.indexOf(source)] = "" + source + ".coffee"; - return compilePath(source, topLevel, base); - } - if (topLevel) { - console.error("File not found: " + source); - process.exit(1); - } - return; - } - if (stats.isDirectory()) { - if (opts.watch) { - watchDir(source, base); - } - return fs.readdir(source, function(err, files) { - var file, index, _ref1, _ref2; - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - return; - } - index = sources.indexOf(source); - files = files.filter(function(file) { - return !hidden(file); - }); - [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(path.join(source, file)); - } - return _results; - })())), _ref1; - [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() { - return null; - }))), _ref2; - return files.forEach(function(file) { - return compilePath(path.join(source, file), false, base); - }); - }); - } else if (topLevel || path.extname(source) === '.coffee') { - if (opts.watch) { - watch(source, base); - } - return fs.readFile(source, function(err, code) { - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - return; - } - return compileScript(source, code.toString(), base); - }); - } else { - notSources[source] = true; - return removeSource(source, base); - } - }); - }; - - compileScript = function(file, input, base) { - var o, options, t, task; - o = opts; - options = compileOptions(file); - try { - t = task = { - file: file, - input: input, - options: options - }; - CoffeeScript.emit('compile', task); - if (o.tokens) { - return printTokens(CoffeeScript.tokens(t.input)); - } else if (o.nodes) { - return printLine(CoffeeScript.nodes(t.input).toString().trim()); - } else if (o.run) { - return CoffeeScript.run(t.input, t.options); - } else if (o.join && t.file !== o.join) { - sourceCode[sources.indexOf(t.file)] = t.input; - return compileJoin(); - } else { - t.output = CoffeeScript.compile(t.input, t.options); - CoffeeScript.emit('success', task); - if (o.print) { - return printLine(t.output.trim()); - } else if (o.compile) { - return writeJs(t.file, t.output, base); - } else if (o.lint) { - return lint(t.file, t.output); - } - } - } catch (err) { - CoffeeScript.emit('failure', err, task); - if (CoffeeScript.listeners('failure').length) { - return; - } - if (o.watch) { - return printLine(err.message + '\x07'); - } - printWarn(err instanceof Error && err.stack || ("ERROR: " + err)); - return process.exit(1); - } - }; - - compileStdio = function() { - var code, stdin; - code = ''; - stdin = process.openStdin(); - stdin.on('data', function(buffer) { - if (buffer) { - return code += buffer.toString(); - } - }); - return stdin.on('end', function() { - return compileScript(null, code); - }); - }; - - joinTimeout = null; - - compileJoin = function() { - if (!opts.join) { - return; - } - if (!sourceCode.some(function(code) { - return code === null; - })) { - clearTimeout(joinTimeout); - return joinTimeout = wait(100, function() { - return compileScript(opts.join, sourceCode.join('\n'), opts.join); - }); - } - }; - - loadRequires = function() { - var realFilename, req, _i, _len, _ref1; - realFilename = module.filename; - module.filename = '.'; - _ref1 = opts.require; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - req = _ref1[_i]; - require(req); - } - return module.filename = realFilename; - }; - - watch = function(source, base) { - var compile, compileTimeout, prevStats, rewatch, watchErr, watcher; - prevStats = null; - compileTimeout = null; - watchErr = function(e) { - if (e.code === 'ENOENT') { - if (sources.indexOf(source) === -1) { - return; - } - try { - rewatch(); - return compile(); - } catch (e) { - removeSource(source, base, true); - return compileJoin(); - } - } else { - throw e; - } - }; - compile = function() { - clearTimeout(compileTimeout); - return compileTimeout = wait(25, function() { - return fs.stat(source, function(err, stats) { - if (err) { - return watchErr(err); - } - if (prevStats && stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) { - return rewatch(); - } - prevStats = stats; - return fs.readFile(source, function(err, code) { - if (err) { - return watchErr(err); - } - compileScript(source, code.toString(), base); - return rewatch(); - }); - }); - }); - }; - try { - watcher = fs.watch(source, compile); - } catch (e) { - watchErr(e); - } - return rewatch = function() { - if (watcher != null) { - watcher.close(); - } - return watcher = fs.watch(source, compile); - }; - }; - - watchDir = function(source, base) { - var readdirTimeout, watcher; - readdirTimeout = null; - try { - return watcher = fs.watch(source, function() { - clearTimeout(readdirTimeout); - return readdirTimeout = wait(25, function() { - return fs.readdir(source, function(err, files) { - var file, _i, _len, _results; - if (err) { - if (err.code !== 'ENOENT') { - throw err; - } - watcher.close(); - return unwatchDir(source, base); - } - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - if (!(!hidden(file) && !notSources[file])) { - continue; - } - file = path.join(source, file); - if (sources.some(function(s) { - return s.indexOf(file) >= 0; - })) { - continue; - } - sources.push(file); - sourceCode.push(null); - _results.push(compilePath(file, false, base)); - } - return _results; - }); - }); - }); - } catch (e) { - if (e.code !== 'ENOENT') { - throw e; - } - } - }; - - unwatchDir = function(source, base) { - var file, prevSources, toRemove, _i, _len; - prevSources = sources.slice(0); - toRemove = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - file = sources[_i]; - if (file.indexOf(source) >= 0) { - _results.push(file); - } - } - return _results; - })(); - for (_i = 0, _len = toRemove.length; _i < _len; _i++) { - file = toRemove[_i]; - removeSource(file, base, true); - } - if (!sources.some(function(s, i) { - return prevSources[i] !== s; - })) { - return; - } - return compileJoin(); - }; - - removeSource = function(source, base, removeJs) { - var index, jsPath; - index = sources.indexOf(source); - sources.splice(index, 1); - sourceCode.splice(index, 1); - if (removeJs && !opts.join) { - jsPath = outputPath(source, base); - return exists(jsPath, function(itExists) { - if (itExists) { - return fs.unlink(jsPath, function(err) { - if (err && err.code !== 'ENOENT') { - throw err; - } - return timeLog("removed " + source); - }); - } - }); - } - }; - - outputPath = function(source, base) { - var baseDir, dir, filename, srcDir; - filename = path.basename(source, path.extname(source)) + '.js'; - srcDir = path.dirname(source); - baseDir = base === '.' ? srcDir : srcDir.substring(base.length); - dir = opts.output ? path.join(opts.output, baseDir) : srcDir; - return path.join(dir, filename); - }; - - writeJs = function(source, js, base) { - var compile, jsDir, jsPath; - jsPath = outputPath(source, base); - jsDir = path.dirname(jsPath); - compile = function() { - if (js.length <= 0) { - js = ' '; - } - return fs.writeFile(jsPath, js, function(err) { - if (err) { - return printLine(err.message); - } else if (opts.compile && opts.watch) { - return timeLog("compiled " + source); - } - }); - }; - return exists(jsDir, function(itExists) { - if (itExists) { - return compile(); - } else { - return exec("mkdir -p " + jsDir, compile); - } - }); - }; - - wait = function(milliseconds, func) { - return setTimeout(func, milliseconds); - }; - - timeLog = function(message) { - return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); - }; - - lint = function(file, js) { - var conf, jsl, printIt; - printIt = function(buffer) { - return printLine(file + ':\t' + buffer.toString().trim()); - }; - conf = __dirname + '/../../extras/jsl.conf'; - jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]); - jsl.stdout.on('data', printIt); - jsl.stderr.on('data', printIt); - jsl.stdin.write(js); - return jsl.stdin.end(); - }; - - printTokens = function(tokens) { - var strings, tag, token, value; - strings = (function() { - var _i, _len, _ref1, _results; - _results = []; - for (_i = 0, _len = tokens.length; _i < _len; _i++) { - token = tokens[_i]; - _ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1]; - _results.push("[" + tag + " " + value + "]"); - } - return _results; - })(); - return printLine(strings.join(' ')); - }; - - parseOptions = function() { - var i, o, source, _i, _len; - optionParser = new optparse.OptionParser(SWITCHES, BANNER); - o = opts = optionParser.parse(process.argv.slice(2)); - o.compile || (o.compile = !!o.output); - o.run = !(o.compile || o.print || o.lint); - o.print = !!(o.print || (o["eval"] || o.stdio && o.compile)); - sources = o["arguments"]; - for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) { - source = sources[i]; - sourceCode[i] = null; - } - }; - - compileOptions = function(filename) { - return { - filename: filename, - bare: opts.bare, - header: opts.compile - }; - }; - - forkNode = function() { - var args, nodeArgs; - nodeArgs = opts.nodejs.split(/\s+/); - args = process.argv.slice(1); - args.splice(args.indexOf('--nodejs'), 2); - return spawn(process.execPath, nodeArgs.concat(args), { - cwd: process.cwd(), - env: process.env, - customFds: [0, 1, 2] - }); - }; - - usage = function() { - return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help()); - }; - - version = function() { - return printLine("CoffeeScript version " + CoffeeScript.VERSION); - }; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js deleted file mode 100644 index e3513e5..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/grammar.js +++ /dev/null @@ -1,606 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; - - Parser = require('jison').Parser; - - unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; - - o = function(patternString, action, options) { - var match; - patternString = patternString.replace(/\s{2,}/g, ' '); - if (!action) { - return [patternString, '$$ = $1;', options]; - } - action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; - action = action.replace(/\bnew /g, '$&yy.'); - action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&'); - return [patternString, "$$ = " + action + ";", options]; - }; - - grammar = { - Root: [ - o('', function() { - return new Block; - }), o('Body'), o('Block TERMINATOR') - ], - Body: [ - o('Line', function() { - return Block.wrap([$1]); - }), o('Body TERMINATOR Line', function() { - return $1.push($3); - }), o('Body TERMINATOR') - ], - Line: [o('Expression'), o('Statement')], - Statement: [ - o('Return'), o('Comment'), o('STATEMENT', function() { - return new Literal($1); - }) - ], - Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')], - Block: [ - o('INDENT OUTDENT', function() { - return new Block; - }), o('INDENT Body OUTDENT', function() { - return $2; - }) - ], - Identifier: [ - o('IDENTIFIER', function() { - return new Literal($1); - }) - ], - AlphaNumeric: [ - o('NUMBER', function() { - return new Literal($1); - }), o('STRING', function() { - return new Literal($1); - }) - ], - Literal: [ - o('AlphaNumeric'), o('JS', function() { - return new Literal($1); - }), o('REGEX', function() { - return new Literal($1); - }), o('DEBUGGER', function() { - return new Literal($1); - }), o('UNDEFINED', function() { - return new Undefined; - }), o('NULL', function() { - return new Null; - }), o('BOOL', function() { - return new Bool($1); - }) - ], - Assign: [ - o('Assignable = Expression', function() { - return new Assign($1, $3); - }), o('Assignable = TERMINATOR Expression', function() { - return new Assign($1, $4); - }), o('Assignable = INDENT Expression OUTDENT', function() { - return new Assign($1, $4); - }) - ], - AssignObj: [ - o('ObjAssignable', function() { - return new Value($1); - }), o('ObjAssignable : Expression', function() { - return new Assign(new Value($1), $3, 'object'); - }), o('ObjAssignable :\ - INDENT Expression OUTDENT', function() { - return new Assign(new Value($1), $4, 'object'); - }), o('Comment') - ], - ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')], - Return: [ - o('RETURN Expression', function() { - return new Return($2); - }), o('RETURN', function() { - return new Return; - }) - ], - Comment: [ - o('HERECOMMENT', function() { - return new Comment($1); - }) - ], - Code: [ - o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() { - return new Code($2, $5, $4); - }), o('FuncGlyph Block', function() { - return new Code([], $2, $1); - }) - ], - FuncGlyph: [ - o('->', function() { - return 'func'; - }), o('=>', function() { - return 'boundfunc'; - }) - ], - OptComma: [o(''), o(',')], - ParamList: [ - o('', function() { - return []; - }), o('Param', function() { - return [$1]; - }), o('ParamList , Param', function() { - return $1.concat($3); - }), o('ParamList OptComma TERMINATOR Param', function() { - return $1.concat($4); - }), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Param: [ - o('ParamVar', function() { - return new Param($1); - }), o('ParamVar ...', function() { - return new Param($1, null, true); - }), o('ParamVar = Expression', function() { - return new Param($1, $3); - }) - ], - ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')], - Splat: [ - o('Expression ...', function() { - return new Splat($1); - }) - ], - SimpleAssignable: [ - o('Identifier', function() { - return new Value($1); - }), o('Value Accessor', function() { - return $1.add($2); - }), o('Invocation Accessor', function() { - return new Value($1, [].concat($2)); - }), o('ThisProperty') - ], - Assignable: [ - o('SimpleAssignable'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - Value: [ - o('Assignable'), o('Literal', function() { - return new Value($1); - }), o('Parenthetical', function() { - return new Value($1); - }), o('Range', function() { - return new Value($1); - }), o('This') - ], - Accessor: [ - o('. Identifier', function() { - return new Access($2); - }), o('?. Identifier', function() { - return new Access($2, 'soak'); - }), o(':: Identifier', function() { - return [new Access(new Literal('prototype')), new Access($2)]; - }), o('::', function() { - return new Access(new Literal('prototype')); - }), o('Index') - ], - Index: [ - o('INDEX_START IndexValue INDEX_END', function() { - return $2; - }), o('INDEX_SOAK Index', function() { - return extend($2, { - soak: true - }); - }) - ], - IndexValue: [ - o('Expression', function() { - return new Index($1); - }), o('Slice', function() { - return new Slice($1); - }) - ], - Object: [ - o('{ AssignList OptComma }', function() { - return new Obj($2, $1.generated); - }) - ], - AssignList: [ - o('', function() { - return []; - }), o('AssignObj', function() { - return [$1]; - }), o('AssignList , AssignObj', function() { - return $1.concat($3); - }), o('AssignList OptComma TERMINATOR AssignObj', function() { - return $1.concat($4); - }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Class: [ - o('CLASS', function() { - return new Class; - }), o('CLASS Block', function() { - return new Class(null, null, $2); - }), o('CLASS EXTENDS Expression', function() { - return new Class(null, $3); - }), o('CLASS EXTENDS Expression Block', function() { - return new Class(null, $3, $4); - }), o('CLASS SimpleAssignable', function() { - return new Class($2); - }), o('CLASS SimpleAssignable Block', function() { - return new Class($2, null, $3); - }), o('CLASS SimpleAssignable EXTENDS Expression', function() { - return new Class($2, $4); - }), o('CLASS SimpleAssignable EXTENDS Expression Block', function() { - return new Class($2, $4, $5); - }) - ], - Invocation: [ - o('Value OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('Invocation OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('SUPER', function() { - return new Call('super', [new Splat(new Literal('arguments'))]); - }), o('SUPER Arguments', function() { - return new Call('super', $2); - }) - ], - OptFuncExist: [ - o('', function() { - return false; - }), o('FUNC_EXIST', function() { - return true; - }) - ], - Arguments: [ - o('CALL_START CALL_END', function() { - return []; - }), o('CALL_START ArgList OptComma CALL_END', function() { - return $2; - }) - ], - This: [ - o('THIS', function() { - return new Value(new Literal('this')); - }), o('@', function() { - return new Value(new Literal('this')); - }) - ], - ThisProperty: [ - o('@ Identifier', function() { - return new Value(new Literal('this'), [new Access($2)], 'this'); - }) - ], - Array: [ - o('[ ]', function() { - return new Arr([]); - }), o('[ ArgList OptComma ]', function() { - return new Arr($2); - }) - ], - RangeDots: [ - o('..', function() { - return 'inclusive'; - }), o('...', function() { - return 'exclusive'; - }) - ], - Range: [ - o('[ Expression RangeDots Expression ]', function() { - return new Range($2, $4, $3); - }) - ], - Slice: [ - o('Expression RangeDots Expression', function() { - return new Range($1, $3, $2); - }), o('Expression RangeDots', function() { - return new Range($1, null, $2); - }), o('RangeDots Expression', function() { - return new Range(null, $2, $1); - }), o('RangeDots', function() { - return new Range(null, null, $1); - }) - ], - ArgList: [ - o('Arg', function() { - return [$1]; - }), o('ArgList , Arg', function() { - return $1.concat($3); - }), o('ArgList OptComma TERMINATOR Arg', function() { - return $1.concat($4); - }), o('INDENT ArgList OptComma OUTDENT', function() { - return $2; - }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Arg: [o('Expression'), o('Splat')], - SimpleArgs: [ - o('Expression'), o('SimpleArgs , Expression', function() { - return [].concat($1, $3); - }) - ], - Try: [ - o('TRY Block', function() { - return new Try($2); - }), o('TRY Block Catch', function() { - return new Try($2, $3[0], $3[1]); - }), o('TRY Block FINALLY Block', function() { - return new Try($2, null, null, $4); - }), o('TRY Block Catch FINALLY Block', function() { - return new Try($2, $3[0], $3[1], $5); - }) - ], - Catch: [ - o('CATCH Identifier Block', function() { - return [$2, $3]; - }) - ], - Throw: [ - o('THROW Expression', function() { - return new Throw($2); - }) - ], - Parenthetical: [ - o('( Body )', function() { - return new Parens($2); - }), o('( INDENT Body OUTDENT )', function() { - return new Parens($3); - }) - ], - WhileSource: [ - o('WHILE Expression', function() { - return new While($2); - }), o('WHILE Expression WHEN Expression', function() { - return new While($2, { - guard: $4 - }); - }), o('UNTIL Expression', function() { - return new While($2, { - invert: true - }); - }), o('UNTIL Expression WHEN Expression', function() { - return new While($2, { - invert: true, - guard: $4 - }); - }) - ], - While: [ - o('WhileSource Block', function() { - return $1.addBody($2); - }), o('Statement WhileSource', function() { - return $2.addBody(Block.wrap([$1])); - }), o('Expression WhileSource', function() { - return $2.addBody(Block.wrap([$1])); - }), o('Loop', function() { - return $1; - }) - ], - Loop: [ - o('LOOP Block', function() { - return new While(new Literal('true')).addBody($2); - }), o('LOOP Expression', function() { - return new While(new Literal('true')).addBody(Block.wrap([$2])); - }) - ], - For: [ - o('Statement ForBody', function() { - return new For($1, $2); - }), o('Expression ForBody', function() { - return new For($1, $2); - }), o('ForBody Block', function() { - return new For($2, $1); - }) - ], - ForBody: [ - o('FOR Range', function() { - return { - source: new Value($2) - }; - }), o('ForStart ForSource', function() { - $2.own = $1.own; - $2.name = $1[0]; - $2.index = $1[1]; - return $2; - }) - ], - ForStart: [ - o('FOR ForVariables', function() { - return $2; - }), o('FOR OWN ForVariables', function() { - $3.own = true; - return $3; - }) - ], - ForValue: [ - o('Identifier'), o('ThisProperty'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - ForVariables: [ - o('ForValue', function() { - return [$1]; - }), o('ForValue , ForValue', function() { - return [$1, $3]; - }) - ], - ForSource: [ - o('FORIN Expression', function() { - return { - source: $2 - }; - }), o('FOROF Expression', function() { - return { - source: $2, - object: true - }; - }), o('FORIN Expression WHEN Expression', function() { - return { - source: $2, - guard: $4 - }; - }), o('FOROF Expression WHEN Expression', function() { - return { - source: $2, - guard: $4, - object: true - }; - }), o('FORIN Expression BY Expression', function() { - return { - source: $2, - step: $4 - }; - }), o('FORIN Expression WHEN Expression BY Expression', function() { - return { - source: $2, - guard: $4, - step: $6 - }; - }), o('FORIN Expression BY Expression WHEN Expression', function() { - return { - source: $2, - step: $4, - guard: $6 - }; - }) - ], - Switch: [ - o('SWITCH Expression INDENT Whens OUTDENT', function() { - return new Switch($2, $4); - }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() { - return new Switch($2, $4, $6); - }), o('SWITCH INDENT Whens OUTDENT', function() { - return new Switch(null, $3); - }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() { - return new Switch(null, $3, $5); - }) - ], - Whens: [ - o('When'), o('Whens When', function() { - return $1.concat($2); - }) - ], - When: [ - o('LEADING_WHEN SimpleArgs Block', function() { - return [[$2, $3]]; - }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() { - return [[$2, $3]]; - }) - ], - IfBlock: [ - o('IF Expression Block', function() { - return new If($2, $3, { - type: $1 - }); - }), o('IfBlock ELSE IF Expression Block', function() { - return $1.addElse(new If($4, $5, { - type: $3 - })); - }) - ], - If: [ - o('IfBlock'), o('IfBlock ELSE Block', function() { - return $1.addElse($3); - }), o('Statement POST_IF Expression', function() { - return new If($3, Block.wrap([$1]), { - type: $2, - statement: true - }); - }), o('Expression POST_IF Expression', function() { - return new If($3, Block.wrap([$1]), { - type: $2, - statement: true - }); - }) - ], - Operation: [ - o('UNARY Expression', function() { - return new Op($1, $2); - }), o('- Expression', (function() { - return new Op('-', $2); - }), { - prec: 'UNARY' - }), o('+ Expression', (function() { - return new Op('+', $2); - }), { - prec: 'UNARY' - }), o('-- SimpleAssignable', function() { - return new Op('--', $2); - }), o('++ SimpleAssignable', function() { - return new Op('++', $2); - }), o('SimpleAssignable --', function() { - return new Op('--', $1, null, true); - }), o('SimpleAssignable ++', function() { - return new Op('++', $1, null, true); - }), o('Expression ?', function() { - return new Existence($1); - }), o('Expression + Expression', function() { - return new Op('+', $1, $3); - }), o('Expression - Expression', function() { - return new Op('-', $1, $3); - }), o('Expression MATH Expression', function() { - return new Op($2, $1, $3); - }), o('Expression SHIFT Expression', function() { - return new Op($2, $1, $3); - }), o('Expression COMPARE Expression', function() { - return new Op($2, $1, $3); - }), o('Expression LOGIC Expression', function() { - return new Op($2, $1, $3); - }), o('Expression RELATION Expression', function() { - if ($2.charAt(0) === '!') { - return new Op($2.slice(1), $1, $3).invert(); - } else { - return new Op($2, $1, $3); - } - }), o('SimpleAssignable COMPOUND_ASSIGN\ - Expression', function() { - return new Assign($1, $3, $2); - }), o('SimpleAssignable COMPOUND_ASSIGN\ - INDENT Expression OUTDENT', function() { - return new Assign($1, $4, $2); - }), o('SimpleAssignable EXTENDS Expression', function() { - return new Extends($1, $3); - }) - ] - }; - - operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']]; - - tokens = []; - - for (name in grammar) { - alternatives = grammar[name]; - grammar[name] = (function() { - var _i, _j, _len, _len1, _ref, _results; - _results = []; - for (_i = 0, _len = alternatives.length; _i < _len; _i++) { - alt = alternatives[_i]; - _ref = alt[0].split(' '); - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - token = _ref[_j]; - if (!grammar[token]) { - tokens.push(token); - } - } - if (name === 'Root') { - alt[1] = "return " + alt[1]; - } - _results.push(alt); - } - return _results; - })(); - } - - exports.parser = new Parser({ - tokens: tokens.join(' '), - bnf: grammar, - operators: operators.reverse(), - startSymbol: 'Root' - }); - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js deleted file mode 100644 index f9929f7..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/helpers.js +++ /dev/null @@ -1,88 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var extend, flatten, _ref; - - exports.starts = function(string, literal, start) { - return literal === string.substr(start, literal.length); - }; - - exports.ends = function(string, literal, back) { - var len; - len = literal.length; - return literal === string.substr(string.length - len - (back || 0), len); - }; - - exports.compact = function(array) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - item = array[_i]; - if (item) { - _results.push(item); - } - } - return _results; - }; - - exports.count = function(string, substr) { - var num, pos; - num = pos = 0; - if (!substr.length) { - return 1 / 0; - } - while (pos = 1 + string.indexOf(substr, pos)) { - num++; - } - return num; - }; - - exports.merge = function(options, overrides) { - return extend(extend({}, options), overrides); - }; - - extend = exports.extend = function(object, properties) { - var key, val; - for (key in properties) { - val = properties[key]; - object[key] = val; - } - return object; - }; - - exports.flatten = flatten = function(array) { - var element, flattened, _i, _len; - flattened = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - element = array[_i]; - if (element instanceof Array) { - flattened = flattened.concat(flatten(element)); - } else { - flattened.push(element); - } - } - return flattened; - }; - - exports.del = function(obj, key) { - var val; - val = obj[key]; - delete obj[key]; - return val; - }; - - exports.last = function(array, back) { - return array[array.length - (back || 0) - 1]; - }; - - exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) { - var e, _i, _len; - for (_i = 0, _len = this.length; _i < _len; _i++) { - e = this[_i]; - if (fn(e)) { - return true; - } - } - return false; - }; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js deleted file mode 100644 index b1c1765..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/index.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var key, val, _ref; - - _ref = require('./coffee-script'); - for (key in _ref) { - val = _ref[key]; - exports[key] = val; - } - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js deleted file mode 100644 index 1b777cb..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/lexer.js +++ /dev/null @@ -1,788 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; - - _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last; - - exports.Lexer = Lexer = (function() { - - function Lexer() {} - - Lexer.prototype.tokenize = function(code, opts) { - var i, tag; - if (opts == null) { - opts = {}; - } - if (WHITESPACE.test(code)) { - code = "\n" + code; - } - code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); - this.code = code; - this.line = opts.line || 0; - this.indent = 0; - this.indebt = 0; - this.outdebt = 0; - this.indents = []; - this.ends = []; - this.tokens = []; - i = 0; - while (this.chunk = code.slice(i)) { - i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); - } - this.closeIndentation(); - if (tag = this.ends.pop()) { - this.error("missing " + tag); - } - if (opts.rewrite === false) { - return this.tokens; - } - return (new Rewriter).rewrite(this.tokens); - }; - - Lexer.prototype.identifierToken = function() { - var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; - if (!(match = IDENTIFIER.exec(this.chunk))) { - return 0; - } - input = match[0], id = match[1], colon = match[2]; - if (id === 'own' && this.tag() === 'FOR') { - this.token('OWN', id); - return id.length; - } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); - tag = 'IDENTIFIER'; - if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { - tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { - tag = 'LEADING_WHEN'; - } else if (tag === 'FOR') { - this.seenFor = true; - } else if (tag === 'UNLESS') { - tag = 'IF'; - } else if (__indexOf.call(UNARY, tag) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(RELATION, tag) >= 0) { - if (tag !== 'INSTANCEOF' && this.seenFor) { - tag = 'FOR' + tag; - this.seenFor = false; - } else { - tag = 'RELATION'; - if (this.value() === '!') { - this.tokens.pop(); - id = '!' + id; - } - } - } - } - if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { - if (forcedIdentifier) { - tag = 'IDENTIFIER'; - id = new String(id); - id.reserved = true; - } else if (__indexOf.call(RESERVED, id) >= 0) { - this.error("reserved word \"" + id + "\""); - } - } - if (!forcedIdentifier) { - if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { - id = COFFEE_ALIAS_MAP[id]; - } - tag = (function() { - switch (id) { - case '!': - return 'UNARY'; - case '==': - case '!=': - return 'COMPARE'; - case '&&': - case '||': - return 'LOGIC'; - case 'true': - case 'false': - return 'BOOL'; - case 'break': - case 'continue': - return 'STATEMENT'; - default: - return tag; - } - })(); - } - this.token(tag, id); - if (colon) { - this.token(':', ':'); - } - return input.length; - }; - - Lexer.prototype.numberToken = function() { - var binaryLiteral, lexedLength, match, number, octalLiteral; - if (!(match = NUMBER.exec(this.chunk))) { - return 0; - } - number = match[0]; - if (/^0[BOX]/.test(number)) { - this.error("radix prefix '" + number + "' must be lowercase"); - } else if (/E/.test(number) && !/^0x/.test(number)) { - this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'"); - } else if (/^0\d*[89]/.test(number)) { - this.error("decimal literal '" + number + "' must not be prefixed with '0'"); - } else if (/^0\d+/.test(number)) { - this.error("octal literal '" + number + "' must be prefixed with '0o'"); - } - lexedLength = number.length; - if (octalLiteral = /^0o([0-7]+)/.exec(number)) { - number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16); - } - if (binaryLiteral = /^0b([01]+)/.exec(number)) { - number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16); - } - this.token('NUMBER', number); - return lexedLength; - }; - - Lexer.prototype.stringToken = function() { - var match, octalEsc, string; - switch (this.chunk.charAt(0)) { - case "'": - if (!(match = SIMPLESTR.exec(this.chunk))) { - return 0; - } - this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n')); - break; - case '"': - if (!(string = this.balancedString(this.chunk, '"'))) { - return 0; - } - if (0 < string.indexOf('#{', 1)) { - this.interpolateString(string.slice(1, -1)); - } else { - this.token('STRING', this.escapeLines(string)); - } - break; - default: - return 0; - } - if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { - this.error("octal escape sequences " + string + " are not allowed"); - } - this.line += count(string, '\n'); - return string.length; - }; - - Lexer.prototype.heredocToken = function() { - var doc, heredoc, match, quote; - if (!(match = HEREDOC.exec(this.chunk))) { - return 0; - } - heredoc = match[0]; - quote = heredoc.charAt(0); - doc = this.sanitizeHeredoc(match[2], { - quote: quote, - indent: null - }); - if (quote === '"' && 0 <= doc.indexOf('#{')) { - this.interpolateString(doc, { - heredoc: true - }); - } else { - this.token('STRING', this.makeString(doc, quote, true)); - } - this.line += count(heredoc, '\n'); - return heredoc.length; - }; - - Lexer.prototype.commentToken = function() { - var comment, here, match; - if (!(match = this.chunk.match(COMMENT))) { - return 0; - } - comment = match[0], here = match[1]; - if (here) { - this.token('HERECOMMENT', this.sanitizeHeredoc(here, { - herecomment: true, - indent: Array(this.indent + 1).join(' ') - })); - } - this.line += count(comment, '\n'); - return comment.length; - }; - - Lexer.prototype.jsToken = function() { - var match, script; - if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { - return 0; - } - this.token('JS', (script = match[0]).slice(1, -1)); - this.line += count(script, '\n'); - return script.length; - }; - - Lexer.prototype.regexToken = function() { - var flags, length, match, prev, regex, _ref2, _ref3; - if (this.chunk.charAt(0) !== '/') { - return 0; - } - if (match = HEREGEX.exec(this.chunk)) { - length = this.heregexToken(match); - this.line += count(match[0], '\n'); - return length; - } - prev = last(this.tokens); - if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { - return 0; - } - if (!(match = REGEX.exec(this.chunk))) { - return 0; - } - _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; - if (regex.slice(0, 2) === '/*') { - this.error('regular expressions cannot begin with `*`'); - } - if (regex === '//') { - regex = '/(?:)/'; - } - this.token('REGEX', "" + regex + flags); - return match.length; - }; - - Lexer.prototype.heregexToken = function(match) { - var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5; - heregex = match[0], body = match[1], flags = match[2]; - if (0 > body.indexOf('#{')) { - re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); - if (re.match(/^\*/)) { - this.error('regular expressions cannot begin with `*`'); - } - this.token('REGEX', "/" + (re || '(?:)') + "/" + flags); - return heregex.length; - } - this.token('IDENTIFIER', 'RegExp'); - this.tokens.push(['CALL_START', '(']); - tokens = []; - _ref2 = this.interpolateString(body, { - regex: true - }); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - _ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1]; - if (tag === 'TOKENS') { - tokens.push.apply(tokens, value); - } else { - if (!(value = value.replace(HEREGEX_OMIT, ''))) { - continue; - } - value = value.replace(/\\/g, '\\\\'); - tokens.push(['STRING', this.makeString(value, '"', true)]); - } - tokens.push(['+', '+']); - } - tokens.pop(); - if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { - this.tokens.push(['STRING', '""'], ['+', '+']); - } - (_ref5 = this.tokens).push.apply(_ref5, tokens); - if (flags) { - this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); - } - this.token(')', ')'); - return heregex.length; - }; - - Lexer.prototype.lineToken = function() { - var diff, indent, match, noNewlines, size; - if (!(match = MULTI_DENT.exec(this.chunk))) { - return 0; - } - indent = match[0]; - this.line += count(indent, '\n'); - this.seenFor = false; - size = indent.length - 1 - indent.lastIndexOf('\n'); - noNewlines = this.unfinished(); - if (size - this.indebt === this.indent) { - if (noNewlines) { - this.suppressNewlines(); - } else { - this.newlineToken(); - } - return indent.length; - } - if (size > this.indent) { - if (noNewlines) { - this.indebt = size - this.indent; - this.suppressNewlines(); - return indent.length; - } - diff = size - this.indent + this.outdebt; - this.token('INDENT', diff); - this.indents.push(diff); - this.ends.push('OUTDENT'); - this.outdebt = this.indebt = 0; - } else { - this.indebt = 0; - this.outdentToken(this.indent - size, noNewlines); - } - this.indent = size; - return indent.length; - }; - - Lexer.prototype.outdentToken = function(moveOut, noNewlines) { - var dent, len; - while (moveOut > 0) { - len = this.indents.length - 1; - if (this.indents[len] === void 0) { - moveOut = 0; - } else if (this.indents[len] === this.outdebt) { - moveOut -= this.outdebt; - this.outdebt = 0; - } else if (this.indents[len] < this.outdebt) { - this.outdebt -= this.indents[len]; - moveOut -= this.indents[len]; - } else { - dent = this.indents.pop() - this.outdebt; - moveOut -= dent; - this.outdebt = 0; - this.pair('OUTDENT'); - this.token('OUTDENT', dent); - } - } - if (dent) { - this.outdebt -= moveOut; - } - while (this.value() === ';') { - this.tokens.pop(); - } - if (!(this.tag() === 'TERMINATOR' || noNewlines)) { - this.token('TERMINATOR', '\n'); - } - return this; - }; - - Lexer.prototype.whitespaceToken = function() { - var match, nline, prev; - if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { - return 0; - } - prev = last(this.tokens); - if (prev) { - prev[match ? 'spaced' : 'newLine'] = true; - } - if (match) { - return match[0].length; - } else { - return 0; - } - }; - - Lexer.prototype.newlineToken = function() { - while (this.value() === ';') { - this.tokens.pop(); - } - if (this.tag() !== 'TERMINATOR') { - this.token('TERMINATOR', '\n'); - } - return this; - }; - - Lexer.prototype.suppressNewlines = function() { - if (this.value() === '\\') { - this.tokens.pop(); - } - return this; - }; - - Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; - if (match = OPERATOR.exec(this.chunk)) { - value = match[0]; - if (CODE.test(value)) { - this.tagParameters(); - } - } else { - value = this.chunk.charAt(0); - } - tag = value; - prev = last(this.tokens); - if (value === '=' && prev) { - if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { - this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); - } - if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { - prev[0] = 'COMPOUND_ASSIGN'; - prev[1] += '='; - return value.length; - } - } - if (value === ';') { - this.seenFor = false; - tag = 'TERMINATOR'; - } else if (__indexOf.call(MATH, value) >= 0) { - tag = 'MATH'; - } else if (__indexOf.call(COMPARE, value) >= 0) { - tag = 'COMPARE'; - } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { - tag = 'COMPOUND_ASSIGN'; - } else if (__indexOf.call(UNARY, value) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(SHIFT, value) >= 0) { - tag = 'SHIFT'; - } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { - tag = 'LOGIC'; - } else if (prev && !prev.spaced) { - if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { - if (prev[0] === '?') { - prev[0] = 'FUNC_EXIST'; - } - tag = 'CALL_START'; - } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { - tag = 'INDEX_START'; - switch (prev[0]) { - case '?': - prev[0] = 'INDEX_SOAK'; - } - } - } - switch (value) { - case '(': - case '{': - case '[': - this.ends.push(INVERSES[value]); - break; - case ')': - case '}': - case ']': - this.pair(value); - } - this.token(tag, value); - return value.length; - }; - - Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref2; - indent = options.indent, herecomment = options.herecomment; - if (herecomment) { - if (HEREDOC_ILLEGAL.test(doc)) { - this.error("block comment cannot contain \"*/\", starting"); - } - if (doc.indexOf('\n') <= 0) { - return doc; - } - } else { - while (match = HEREDOC_INDENT.exec(doc)) { - attempt = match[1]; - if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { - indent = attempt; - } - } - } - if (indent) { - doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); - } - if (!herecomment) { - doc = doc.replace(/^\n/, ''); - } - return doc; - }; - - Lexer.prototype.tagParameters = function() { - var i, stack, tok, tokens; - if (this.tag() !== ')') { - return this; - } - stack = []; - tokens = this.tokens; - i = tokens.length; - tokens[--i][0] = 'PARAM_END'; - while (tok = tokens[--i]) { - switch (tok[0]) { - case ')': - stack.push(tok); - break; - case '(': - case 'CALL_START': - if (stack.length) { - stack.pop(); - } else if (tok[0] === '(') { - tok[0] = 'PARAM_START'; - return this; - } else { - return this; - } - } - } - return this; - }; - - Lexer.prototype.closeIndentation = function() { - return this.outdentToken(this.indent); - }; - - Lexer.prototype.balancedString = function(str, end) { - var continueCount, i, letter, match, prev, stack, _i, _ref2; - continueCount = 0; - stack = [end]; - for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { - if (continueCount) { - --continueCount; - continue; - } - switch (letter = str.charAt(i)) { - case '\\': - ++continueCount; - continue; - case end: - stack.pop(); - if (!stack.length) { - return str.slice(0, +i + 1 || 9e9); - } - end = stack[stack.length - 1]; - continue; - } - if (end === '}' && (letter === '"' || letter === "'")) { - stack.push(end = letter); - } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { - continueCount += match[0].length - 1; - } else if (end === '}' && letter === '{') { - stack.push(end = '}'); - } else if (end === '"' && prev === '#' && letter === '{') { - stack.push(end = '}'); - } - prev = letter; - } - return this.error("missing " + (stack.pop()) + ", starting"); - }; - - Lexer.prototype.interpolateString = function(str, options) { - var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4; - if (options == null) { - options = {}; - } - heredoc = options.heredoc, regex = options.regex; - tokens = []; - pi = 0; - i = -1; - while (letter = str.charAt(i += 1)) { - if (letter === '\\') { - i += 1; - continue; - } - if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { - continue; - } - if (pi < i) { - tokens.push(['NEOSTRING', str.slice(pi, i)]); - } - inner = expr.slice(1, -1); - if (inner.length) { - nested = new Lexer().tokenize(inner, { - line: this.line, - rewrite: false - }); - nested.pop(); - if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { - nested.shift(); - } - if (len = nested.length) { - if (len > 1) { - nested.unshift(['(', '(', this.line]); - nested.push([')', ')', this.line]); - } - tokens.push(['TOKENS', nested]); - } - } - i += expr.length; - pi = i + 1; - } - if ((i > pi && pi < str.length)) { - tokens.push(['NEOSTRING', str.slice(pi)]); - } - if (regex) { - return tokens; - } - if (!tokens.length) { - return this.token('STRING', '""'); - } - if (tokens[0][0] !== 'NEOSTRING') { - tokens.unshift(['', '']); - } - if (interpolated = tokens.length > 1) { - this.token('(', '('); - } - for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { - _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; - if (i) { - this.token('+', '+'); - } - if (tag === 'TOKENS') { - (_ref4 = this.tokens).push.apply(_ref4, value); - } else { - this.token('STRING', this.makeString(value, '"', heredoc)); - } - } - if (interpolated) { - this.token(')', ')'); - } - return tokens; - }; - - Lexer.prototype.pair = function(tag) { - var size, wanted; - if (tag !== (wanted = last(this.ends))) { - if ('OUTDENT' !== wanted) { - this.error("unmatched " + tag); - } - this.indent -= size = last(this.indents); - this.outdentToken(size, true); - return this.pair(tag); - } - return this.ends.pop(); - }; - - Lexer.prototype.token = function(tag, value) { - return this.tokens.push([tag, value, this.line]); - }; - - Lexer.prototype.tag = function(index, tag) { - var tok; - return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); - }; - - Lexer.prototype.value = function(index, val) { - var tok; - return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); - }; - - Lexer.prototype.unfinished = function() { - var _ref2; - return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); - }; - - Lexer.prototype.escapeLines = function(str, heredoc) { - return str.replace(MULTILINER, heredoc ? '\\n' : ''); - }; - - Lexer.prototype.makeString = function(body, quote, heredoc) { - if (!body) { - return quote + quote; - } - body = body.replace(/\\([\s\S])/g, function(match, contents) { - if (contents === '\n' || contents === quote) { - return contents; - } else { - return match; - } - }); - body = body.replace(RegExp("" + quote, "g"), '\\$&'); - return quote + this.escapeLines(body, heredoc) + quote; - }; - - Lexer.prototype.error = function(message) { - throw SyntaxError("" + message + " on line " + (this.line + 1)); - }; - - return Lexer; - - })(); - - JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; - - COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; - - COFFEE_ALIAS_MAP = { - and: '&&', - or: '||', - is: '==', - isnt: '!=', - not: '!', - yes: 'true', - no: 'false', - on: 'true', - off: 'false' - }; - - COFFEE_ALIASES = (function() { - var _results; - _results = []; - for (key in COFFEE_ALIAS_MAP) { - _results.push(key); - } - return _results; - })(); - - COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); - - RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield']; - - STRICT_PROSCRIBED = ['arguments', 'eval']; - - JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); - - exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); - - exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; - - IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; - - NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; - - HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; - - OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/; - - WHITESPACE = /^[^\n\S]+/; - - COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/; - - CODE = /^[-=]>/; - - MULTI_DENT = /^(?:\n[^\n\S]*)+/; - - SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; - - JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; - - REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; - - HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; - - HEREGEX_OMIT = /\s+(?:#.*)?/g; - - MULTILINER = /\n/g; - - HEREDOC_INDENT = /\n+([^\n\S]*)/g; - - HEREDOC_ILLEGAL = /\*\//; - - LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; - - TRAILING_SPACES = /\s+$/; - - COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; - - UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; - - LOGIC = ['&&', '||', '&', '|', '^']; - - SHIFT = ['<<', '>>', '>>>']; - - COMPARE = ['==', '!=', '<', '>', '<=', '>=']; - - MATH = ['*', '/', '%']; - - RELATION = ['IN', 'OF', 'INSTANCEOF']; - - BOOL = ['TRUE', 'FALSE']; - - NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']']; - - NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING'); - - CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; - - INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED'); - - LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js deleted file mode 100644 index f8e0777..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/nodes.js +++ /dev/null @@ -1,2971 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, some, starts, unfoldSoak, utility, _ref, _ref1, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - Scope = require('./scope').Scope; - - _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; - - _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some; - - exports.extend = extend; - - YES = function() { - return true; - }; - - NO = function() { - return false; - }; - - THIS = function() { - return this; - }; - - NEGATE = function() { - this.negated = !this.negated; - return this; - }; - - exports.Base = Base = (function() { - - function Base() {} - - Base.prototype.compile = function(o, lvl) { - var node; - o = extend({}, o); - if (lvl) { - o.level = lvl; - } - node = this.unfoldSoak(o) || this; - node.tab = o.indent; - if (o.level === LEVEL_TOP || !node.isStatement(o)) { - return node.compileNode(o); - } else { - return node.compileClosure(o); - } - }; - - Base.prototype.compileClosure = function(o) { - if (this.jumps()) { - throw SyntaxError('cannot use a pure statement in an expression.'); - } - o.sharedScope = true; - return Closure.wrap(this).compileNode(o); - }; - - Base.prototype.cache = function(o, level, reused) { - var ref, sub; - if (!this.isComplex()) { - ref = level ? this.compile(o, level) : this; - return [ref, ref]; - } else { - ref = new Literal(reused || o.scope.freeVariable('ref')); - sub = new Assign(ref, this); - if (level) { - return [sub.compile(o, level), ref.value]; - } else { - return [sub, ref]; - } - } - }; - - Base.prototype.compileLoopReference = function(o, name) { - var src, tmp; - src = tmp = this.compile(o, LEVEL_LIST); - if (!((-Infinity < +src && +src < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { - src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; - } - return [src, tmp]; - }; - - Base.prototype.makeReturn = function(res) { - var me; - me = this.unwrapAll(); - if (res) { - return new Call(new Literal("" + res + ".push"), [me]); - } else { - return new Return(me); - } - }; - - Base.prototype.contains = function(pred) { - var contains; - contains = false; - this.traverseChildren(false, function(node) { - if (pred(node)) { - contains = true; - return false; - } - }); - return contains; - }; - - Base.prototype.containsType = function(type) { - return this instanceof type || this.contains(function(node) { - return node instanceof type; - }); - }; - - Base.prototype.lastNonComment = function(list) { - var i; - i = list.length; - while (i--) { - if (!(list[i] instanceof Comment)) { - return list[i]; - } - } - return null; - }; - - Base.prototype.toString = function(idt, name) { - var tree; - if (idt == null) { - idt = ''; - } - if (name == null) { - name = this.constructor.name; - } - tree = '\n' + idt + name; - if (this.soak) { - tree += '?'; - } - this.eachChild(function(node) { - return tree += node.toString(idt + TAB); - }); - return tree; - }; - - Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len1, _ref2, _ref3; - if (!this.children) { - return this; - } - _ref2 = this.children; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - attr = _ref2[_i]; - if (this[attr]) { - _ref3 = flatten([this[attr]]); - for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { - child = _ref3[_j]; - if (func(child) === false) { - return this; - } - } - } - } - return this; - }; - - Base.prototype.traverseChildren = function(crossScope, func) { - return this.eachChild(function(child) { - if (func(child) === false) { - return false; - } - return child.traverseChildren(crossScope, func); - }); - }; - - Base.prototype.invert = function() { - return new Op('!', this); - }; - - Base.prototype.unwrapAll = function() { - var node; - node = this; - while (node !== (node = node.unwrap())) { - continue; - } - return node; - }; - - Base.prototype.children = []; - - Base.prototype.isStatement = NO; - - Base.prototype.jumps = NO; - - Base.prototype.isComplex = YES; - - Base.prototype.isChainable = NO; - - Base.prototype.isAssignable = NO; - - Base.prototype.unwrap = THIS; - - Base.prototype.unfoldSoak = NO; - - Base.prototype.assigns = NO; - - return Base; - - })(); - - exports.Block = Block = (function(_super) { - - __extends(Block, _super); - - function Block(nodes) { - this.expressions = compact(flatten(nodes || [])); - } - - Block.prototype.children = ['expressions']; - - Block.prototype.push = function(node) { - this.expressions.push(node); - return this; - }; - - Block.prototype.pop = function() { - return this.expressions.pop(); - }; - - Block.prototype.unshift = function(node) { - this.expressions.unshift(node); - return this; - }; - - Block.prototype.unwrap = function() { - if (this.expressions.length === 1) { - return this.expressions[0]; - } else { - return this; - } - }; - - Block.prototype.isEmpty = function() { - return !this.expressions.length; - }; - - Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.isStatement(o)) { - return true; - } - } - return false; - }; - - Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.jumps(o)) { - return exp; - } - } - }; - - Block.prototype.makeReturn = function(res) { - var expr, len; - len = this.expressions.length; - while (len--) { - expr = this.expressions[len]; - if (!(expr instanceof Comment)) { - this.expressions[len] = expr.makeReturn(res); - if (expr instanceof Return && !expr.expression) { - this.expressions.splice(len, 1); - } - break; - } - } - return this; - }; - - Block.prototype.compile = function(o, level) { - if (o == null) { - o = {}; - } - if (o.scope) { - return Block.__super__.compile.call(this, o, level); - } else { - return this.compileRoot(o); - } - }; - - Block.prototype.compileNode = function(o) { - var code, codes, node, top, _i, _len, _ref2; - this.tab = o.indent; - top = o.level === LEVEL_TOP; - codes = []; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - node = node.unwrapAll(); - node = node.unfoldSoak(o) || node; - if (node instanceof Block) { - codes.push(node.compileNode(o)); - } else if (top) { - node.front = true; - code = node.compile(o); - if (!node.isStatement(o)) { - code = "" + this.tab + code + ";"; - if (node instanceof Literal) { - code = "" + code + "\n"; - } - } - codes.push(code); - } else { - codes.push(node.compile(o, LEVEL_LIST)); - } - } - if (top) { - if (this.spaced) { - return "\n" + (codes.join('\n\n')) + "\n"; - } else { - return codes.join('\n'); - } - } - code = codes.join(', ') || 'void 0'; - if (codes.length > 1 && o.level >= LEVEL_LIST) { - return "(" + code + ")"; - } else { - return code; - } - }; - - Block.prototype.compileRoot = function(o) { - var code, exp, i, prelude, preludeExps, rest; - o.indent = o.bare ? '' : TAB; - o.scope = new Scope(null, this, null); - o.level = LEVEL_TOP; - this.spaced = true; - prelude = ""; - if (!o.bare) { - preludeExps = (function() { - var _i, _len, _ref2, _results; - _ref2 = this.expressions; - _results = []; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - exp = _ref2[i]; - if (!(exp.unwrap() instanceof Comment)) { - break; - } - _results.push(exp); - } - return _results; - }).call(this); - rest = this.expressions.slice(preludeExps.length); - this.expressions = preludeExps; - if (preludeExps.length) { - prelude = "" + (this.compileNode(merge(o, { - indent: '' - }))) + "\n"; - } - this.expressions = rest; - } - code = this.compileWithDeclarations(o); - if (o.bare) { - return code; - } - return "" + prelude + "(function() {\n" + code + "\n}).call(this);\n"; - }; - - Block.prototype.compileWithDeclarations = function(o) { - var assigns, code, declars, exp, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; - code = post = ''; - _ref2 = this.expressions; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - exp = _ref2[i]; - exp = exp.unwrap(); - if (!(exp instanceof Comment || exp instanceof Literal)) { - break; - } - } - o = merge(o, { - level: LEVEL_TOP - }); - if (i) { - rest = this.expressions.splice(i, 9e9); - _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; - _ref4 = [this.compileNode(o), spaced], code = _ref4[0], this.spaced = _ref4[1]; - this.expressions = rest; - } - post = this.compileNode(o); - scope = o.scope; - if (scope.expressions === this) { - declars = o.scope.hasDeclarations(); - assigns = scope.hasAssignments; - if (declars || assigns) { - if (i) { - code += '\n'; - } - code += "" + this.tab + "var "; - if (declars) { - code += scope.declaredVariables().join(', '); - } - if (assigns) { - if (declars) { - code += ",\n" + (this.tab + TAB); - } - code += scope.assignedVariables().join(",\n" + (this.tab + TAB)); - } - code += ';\n'; - } - } - return code + post; - }; - - Block.wrap = function(nodes) { - if (nodes.length === 1 && nodes[0] instanceof Block) { - return nodes[0]; - } - return new Block(nodes); - }; - - return Block; - - })(Base); - - exports.Literal = Literal = (function(_super) { - - __extends(Literal, _super); - - function Literal(value) { - this.value = value; - } - - Literal.prototype.makeReturn = function() { - if (this.isStatement()) { - return this; - } else { - return Literal.__super__.makeReturn.apply(this, arguments); - } - }; - - Literal.prototype.isAssignable = function() { - return IDENTIFIER.test(this.value); - }; - - Literal.prototype.isStatement = function() { - var _ref2; - return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; - }; - - Literal.prototype.isComplex = NO; - - Literal.prototype.assigns = function(name) { - return name === this.value; - }; - - Literal.prototype.jumps = function(o) { - if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { - return this; - } - if (this.value === 'continue' && !(o != null ? o.loop : void 0)) { - return this; - } - }; - - Literal.prototype.compileNode = function(o) { - var code, _ref2; - code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; - if (this.isStatement()) { - return "" + this.tab + code + ";"; - } else { - return code; - } - }; - - Literal.prototype.toString = function() { - return ' "' + this.value + '"'; - }; - - return Literal; - - })(Base); - - exports.Undefined = (function(_super) { - - __extends(Undefined, _super); - - function Undefined() { - return Undefined.__super__.constructor.apply(this, arguments); - } - - Undefined.prototype.isAssignable = NO; - - Undefined.prototype.isComplex = NO; - - Undefined.prototype.compileNode = function(o) { - if (o.level >= LEVEL_ACCESS) { - return '(void 0)'; - } else { - return 'void 0'; - } - }; - - return Undefined; - - })(Base); - - exports.Null = (function(_super) { - - __extends(Null, _super); - - function Null() { - return Null.__super__.constructor.apply(this, arguments); - } - - Null.prototype.isAssignable = NO; - - Null.prototype.isComplex = NO; - - Null.prototype.compileNode = function() { - return "null"; - }; - - return Null; - - })(Base); - - exports.Bool = (function(_super) { - - __extends(Bool, _super); - - Bool.prototype.isAssignable = NO; - - Bool.prototype.isComplex = NO; - - Bool.prototype.compileNode = function() { - return this.val; - }; - - function Bool(val) { - this.val = val; - } - - return Bool; - - })(Base); - - exports.Return = Return = (function(_super) { - - __extends(Return, _super); - - function Return(expr) { - if (expr && !expr.unwrap().isUndefined) { - this.expression = expr; - } - } - - Return.prototype.children = ['expression']; - - Return.prototype.isStatement = YES; - - Return.prototype.makeReturn = THIS; - - Return.prototype.jumps = THIS; - - Return.prototype.compile = function(o, level) { - var expr, _ref2; - expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; - if (expr && !(expr instanceof Return)) { - return expr.compile(o, level); - } else { - return Return.__super__.compile.call(this, o, level); - } - }; - - Return.prototype.compileNode = function(o) { - return this.tab + ("return" + [this.expression ? " " + (this.expression.compile(o, LEVEL_PAREN)) : void 0] + ";"); - }; - - return Return; - - })(Base); - - exports.Value = Value = (function(_super) { - - __extends(Value, _super); - - function Value(base, props, tag) { - if (!props && base instanceof Value) { - return base; - } - this.base = base; - this.properties = props || []; - if (tag) { - this[tag] = true; - } - return this; - } - - Value.prototype.children = ['base', 'properties']; - - Value.prototype.add = function(props) { - this.properties = this.properties.concat(props); - return this; - }; - - Value.prototype.hasProperties = function() { - return !!this.properties.length; - }; - - Value.prototype.isArray = function() { - return !this.properties.length && this.base instanceof Arr; - }; - - Value.prototype.isComplex = function() { - return this.hasProperties() || this.base.isComplex(); - }; - - Value.prototype.isAssignable = function() { - return this.hasProperties() || this.base.isAssignable(); - }; - - Value.prototype.isSimpleNumber = function() { - return this.base instanceof Literal && SIMPLENUM.test(this.base.value); - }; - - Value.prototype.isString = function() { - return this.base instanceof Literal && IS_STRING.test(this.base.value); - }; - - Value.prototype.isAtomic = function() { - var node, _i, _len, _ref2; - _ref2 = this.properties.concat(this.base); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - if (node.soak || node instanceof Call) { - return false; - } - } - return true; - }; - - Value.prototype.isStatement = function(o) { - return !this.properties.length && this.base.isStatement(o); - }; - - Value.prototype.assigns = function(name) { - return !this.properties.length && this.base.assigns(name); - }; - - Value.prototype.jumps = function(o) { - return !this.properties.length && this.base.jumps(o); - }; - - Value.prototype.isObject = function(onlyGenerated) { - if (this.properties.length) { - return false; - } - return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); - }; - - Value.prototype.isSplice = function() { - return last(this.properties) instanceof Slice; - }; - - Value.prototype.unwrap = function() { - if (this.properties.length) { - return this; - } else { - return this.base; - } - }; - - Value.prototype.cacheReference = function(o) { - var base, bref, name, nref; - name = last(this.properties); - if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { - return [this, this]; - } - base = new Value(this.base, this.properties.slice(0, -1)); - if (base.isComplex()) { - bref = new Literal(o.scope.freeVariable('base')); - base = new Value(new Parens(new Assign(bref, base))); - } - if (!name) { - return [base, bref]; - } - if (name.isComplex()) { - nref = new Literal(o.scope.freeVariable('name')); - name = new Index(new Assign(nref, name.index)); - nref = new Index(nref); - } - return [base.add(name), new Value(bref || base.base, [nref || name])]; - }; - - Value.prototype.compileNode = function(o) { - var code, prop, props, _i, _len; - this.base.front = this.front; - props = this.properties; - code = this.base.compile(o, props.length ? LEVEL_ACCESS : null); - if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(code)) { - code = "" + code + "."; - } - for (_i = 0, _len = props.length; _i < _len; _i++) { - prop = props[_i]; - code += prop.compile(o); - } - return code; - }; - - Value.prototype.unfoldSoak = function(o) { - var result, - _this = this; - if (this.unfoldedSoak != null) { - return this.unfoldedSoak; - } - result = (function() { - var fst, i, ifn, prop, ref, snd, _i, _len, _ref2; - if (ifn = _this.base.unfoldSoak(o)) { - Array.prototype.push.apply(ifn.body.properties, _this.properties); - return ifn; - } - _ref2 = _this.properties; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - prop = _ref2[i]; - if (!prop.soak) { - continue; - } - prop.soak = false; - fst = new Value(_this.base, _this.properties.slice(0, i)); - snd = new Value(_this.base, _this.properties.slice(i)); - if (fst.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, fst)); - snd.base = ref; - } - return new If(new Existence(fst), snd, { - soak: true - }); - } - return null; - })(); - return this.unfoldedSoak = result || false; - }; - - return Value; - - })(Base); - - exports.Comment = Comment = (function(_super) { - - __extends(Comment, _super); - - function Comment(comment) { - this.comment = comment; - } - - Comment.prototype.isStatement = YES; - - Comment.prototype.makeReturn = THIS; - - Comment.prototype.compileNode = function(o, level) { - var code; - code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/\n"); - if ((level || o.level) === LEVEL_TOP) { - code = o.indent + code; - } - return code; - }; - - return Comment; - - })(Base); - - exports.Call = Call = (function(_super) { - - __extends(Call, _super); - - function Call(variable, args, soak) { - this.args = args != null ? args : []; - this.soak = soak; - this.isNew = false; - this.isSuper = variable === 'super'; - this.variable = this.isSuper ? null : variable; - } - - Call.prototype.children = ['variable', 'args']; - - Call.prototype.newInstance = function() { - var base, _ref2; - base = ((_ref2 = this.variable) != null ? _ref2.base : void 0) || this.variable; - if (base instanceof Call && !base.isNew) { - base.newInstance(); - } else { - this.isNew = true; - } - return this; - }; - - Call.prototype.superReference = function(o) { - var accesses, method, name; - method = o.scope.namedMethod(); - if (!method) { - throw SyntaxError('cannot call super outside of a function.'); - } - name = method.name; - if (name == null) { - throw SyntaxError('cannot call super on an anonymous function.'); - } - if (method.klass) { - accesses = [new Access(new Literal('__super__'))]; - if (method["static"]) { - accesses.push(new Access(new Literal('constructor'))); - } - accesses.push(new Access(new Literal(name))); - return (new Value(new Literal(method.klass), accesses)).compile(o); - } else { - return "" + name + ".__super__.constructor"; - } - }; - - Call.prototype.superThis = function(o) { - var method; - method = o.scope.method; - return (method && !method.klass && method.context) || "this"; - }; - - Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; - if (this.soak) { - if (this.variable) { - if (ifn = unfoldSoak(o, this, 'variable')) { - return ifn; - } - _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; - } else { - left = new Literal(this.superReference(o)); - rite = new Value(left); - } - rite = new Call(rite, this.args); - rite.isNew = this.isNew; - left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); - return new If(left, new Value(rite), { - soak: true - }); - } - call = this; - list = []; - while (true) { - if (call.variable instanceof Call) { - list.push(call); - call = call.variable; - continue; - } - if (!(call.variable instanceof Value)) { - break; - } - list.push(call); - if (!((call = call.variable.base) instanceof Call)) { - break; - } - } - _ref3 = list.reverse(); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - call = _ref3[_i]; - if (ifn) { - if (call.variable instanceof Call) { - call.variable = ifn; - } else { - call.variable.base = ifn; - } - } - ifn = unfoldSoak(o, call, 'variable'); - } - return ifn; - }; - - Call.prototype.filterImplicitObjects = function(list) { - var node, nodes, obj, prop, properties, _i, _j, _len, _len1, _ref2; - nodes = []; - for (_i = 0, _len = list.length; _i < _len; _i++) { - node = list[_i]; - if (!((typeof node.isObject === "function" ? node.isObject() : void 0) && node.base.generated)) { - nodes.push(node); - continue; - } - obj = null; - _ref2 = node.base.properties; - for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { - prop = _ref2[_j]; - if (prop instanceof Assign || prop instanceof Comment) { - if (!obj) { - nodes.push(obj = new Obj(properties = [], true)); - } - properties.push(prop); - } else { - nodes.push(prop); - obj = null; - } - } - } - return nodes; - }; - - Call.prototype.compileNode = function(o) { - var arg, args, code, _ref2; - if ((_ref2 = this.variable) != null) { - _ref2.front = this.front; - } - if (code = Splat.compileSplattedArray(o, this.args, true)) { - return this.compileSplat(o, code); - } - args = this.filterImplicitObjects(this.args); - args = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - _results.push(arg.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (this.isSuper) { - return this.superReference(o) + (".call(" + (this.superThis(o)) + (args && ', ' + args) + ")"); - } else { - return (this.isNew ? 'new ' : '') + this.variable.compile(o, LEVEL_ACCESS) + ("(" + args + ")"); - } - }; - - Call.prototype.compileSuper = function(args, o) { - return "" + (this.superReference(o)) + ".call(" + (this.superThis(o)) + (args.length ? ', ' : '') + args + ")"; - }; - - Call.prototype.compileSplat = function(o, splatArgs) { - var base, fun, idt, name, ref; - if (this.isSuper) { - return "" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", " + splatArgs + ")"; - } - if (this.isNew) { - idt = this.tab + TAB; - return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function(){})"; - } - base = new Value(this.variable); - if ((name = base.properties.pop()) && base.isComplex()) { - ref = o.scope.freeVariable('ref'); - fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o)); - } else { - fun = base.compile(o, LEVEL_ACCESS); - if (SIMPLENUM.test(fun)) { - fun = "(" + fun + ")"; - } - if (name) { - ref = fun; - fun += name.compile(o); - } else { - ref = 'null'; - } - } - return "" + fun + ".apply(" + ref + ", " + splatArgs + ")"; - }; - - return Call; - - })(Base); - - exports.Extends = Extends = (function(_super) { - - __extends(Extends, _super); - - function Extends(child, parent) { - this.child = child; - this.parent = parent; - } - - Extends.prototype.children = ['child', 'parent']; - - Extends.prototype.compile = function(o) { - return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o); - }; - - return Extends; - - })(Base); - - exports.Access = Access = (function(_super) { - - __extends(Access, _super); - - function Access(name, tag) { - this.name = name; - this.name.asKey = true; - this.soak = tag === 'soak'; - } - - Access.prototype.children = ['name']; - - Access.prototype.compile = function(o) { - var name; - name = this.name.compile(o); - if (IDENTIFIER.test(name)) { - return "." + name; - } else { - return "[" + name + "]"; - } - }; - - Access.prototype.isComplex = NO; - - return Access; - - })(Base); - - exports.Index = Index = (function(_super) { - - __extends(Index, _super); - - function Index(index) { - this.index = index; - } - - Index.prototype.children = ['index']; - - Index.prototype.compile = function(o) { - return "[" + (this.index.compile(o, LEVEL_PAREN)) + "]"; - }; - - Index.prototype.isComplex = function() { - return this.index.isComplex(); - }; - - return Index; - - })(Base); - - exports.Range = Range = (function(_super) { - - __extends(Range, _super); - - Range.prototype.children = ['from', 'to']; - - function Range(from, to, tag) { - this.from = from; - this.to = to; - this.exclusive = tag === 'exclusive'; - this.equals = this.exclusive ? '' : '='; - } - - Range.prototype.compileVariables = function(o) { - var step, _ref2, _ref3, _ref4, _ref5; - o = merge(o, { - top: true - }); - _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; - _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; - if (step = del(o, 'step')) { - _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; - } - _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; - if (this.stepVar) { - return this.stepNum = this.stepVar.match(SIMPLENUM); - } - }; - - Range.prototype.compileNode = function(o) { - var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref2, _ref3; - if (!this.fromVar) { - this.compileVariables(o); - } - if (!o.index) { - return this.compileArray(o); - } - known = this.fromNum && this.toNum; - idx = del(o, 'index'); - idxName = del(o, 'name'); - namedIndex = idxName && idxName !== idx; - varPart = "" + idx + " = " + this.fromC; - if (this.toC !== this.toVar) { - varPart += ", " + this.toC; - } - if (this.step !== this.stepVar) { - varPart += ", " + this.step; - } - _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; - condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); - stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; - if (namedIndex) { - varPart = "" + idxName + " = " + varPart; - } - if (namedIndex) { - stepPart = "" + idxName + " = " + stepPart; - } - return "" + varPart + "; " + condPart + "; " + stepPart; - }; - - Range.prototype.compileArray = function(o) { - var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; - if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { - range = (function() { - _results = []; - for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } - return _results; - }).apply(this); - if (this.exclusive) { - range.pop(); - } - return "[" + (range.join(', ')) + "]"; - } - idt = this.tab + TAB; - i = o.scope.freeVariable('i'); - result = o.scope.freeVariable('results'); - pre = "\n" + idt + result + " = [];"; - if (this.fromNum && this.toNum) { - o.index = i; - body = this.compileNode(o); - } else { - vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); - cond = "" + this.fromVar + " <= " + this.toVar; - body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; - } - post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; - hasArgs = function(node) { - return node != null ? node.contains(function(n) { - return n instanceof Literal && n.value === 'arguments' && !n.asKey; - }) : void 0; - }; - if (hasArgs(this.from) || hasArgs(this.to)) { - args = ', arguments'; - } - return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")"; - }; - - return Range; - - })(Base); - - exports.Slice = Slice = (function(_super) { - - __extends(Slice, _super); - - Slice.prototype.children = ['range']; - - function Slice(range) { - this.range = range; - Slice.__super__.constructor.call(this); - } - - Slice.prototype.compileNode = function(o) { - var compiled, from, fromStr, to, toStr, _ref2; - _ref2 = this.range, to = _ref2.to, from = _ref2.from; - fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; - compiled = to && to.compile(o, LEVEL_PAREN); - if (to && !(!this.range.exclusive && +compiled === -1)) { - toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? "" + (+compiled + 1) : (compiled = to.compile(o, LEVEL_ACCESS), "+" + compiled + " + 1 || 9e9")); - } - return ".slice(" + fromStr + (toStr || '') + ")"; - }; - - return Slice; - - })(Base); - - exports.Obj = Obj = (function(_super) { - - __extends(Obj, _super); - - function Obj(props, generated) { - this.generated = generated != null ? generated : false; - this.objects = this.properties = props || []; - } - - Obj.prototype.children = ['properties']; - - Obj.prototype.compileNode = function(o) { - var i, idt, indent, join, lastNoncom, node, obj, prop, props, _i, _len; - props = this.properties; - if (!props.length) { - return (this.front ? '({})' : '{}'); - } - if (this.generated) { - for (_i = 0, _len = props.length; _i < _len; _i++) { - node = props[_i]; - if (node instanceof Value) { - throw new Error('cannot have an implicit value in an implicit object'); - } - } - } - idt = o.indent += TAB; - lastNoncom = this.lastNonComment(this.properties); - props = (function() { - var _j, _len1, _results; - _results = []; - for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) { - prop = props[i]; - join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; - indent = prop instanceof Comment ? '' : idt; - if (prop instanceof Value && prop["this"]) { - prop = new Assign(prop.properties[0].name, prop, 'object'); - } - if (!(prop instanceof Comment)) { - if (!(prop instanceof Assign)) { - prop = new Assign(prop, prop, 'object'); - } - (prop.variable.base || prop.variable).asKey = true; - } - _results.push(indent + prop.compile(o, LEVEL_TOP) + join); - } - return _results; - })(); - props = props.join(''); - obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}"; - if (this.front) { - return "(" + obj + ")"; - } else { - return obj; - } - }; - - Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref2; - _ref2 = this.properties; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - prop = _ref2[_i]; - if (prop.assigns(name)) { - return true; - } - } - return false; - }; - - return Obj; - - })(Base); - - exports.Arr = Arr = (function(_super) { - - __extends(Arr, _super); - - function Arr(objs) { - this.objects = objs || []; - } - - Arr.prototype.children = ['objects']; - - Arr.prototype.filterImplicitObjects = Call.prototype.filterImplicitObjects; - - Arr.prototype.compileNode = function(o) { - var code, obj, objs; - if (!this.objects.length) { - return '[]'; - } - o.indent += TAB; - objs = this.filterImplicitObjects(this.objects); - if (code = Splat.compileSplattedArray(o, objs)) { - return code; - } - code = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = objs.length; _i < _len; _i++) { - obj = objs[_i]; - _results.push(obj.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (code.indexOf('\n') >= 0) { - return "[\n" + o.indent + code + "\n" + this.tab + "]"; - } else { - return "[" + code + "]"; - } - }; - - Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref2; - _ref2 = this.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj.assigns(name)) { - return true; - } - } - return false; - }; - - return Arr; - - })(Base); - - exports.Class = Class = (function(_super) { - - __extends(Class, _super); - - function Class(variable, parent, body) { - this.variable = variable; - this.parent = parent; - this.body = body != null ? body : new Block; - this.boundFuncs = []; - this.body.classBody = true; - } - - Class.prototype.children = ['variable', 'parent', 'body']; - - Class.prototype.determineName = function() { - var decl, tail; - if (!this.variable) { - return null; - } - decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; - if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) { - throw SyntaxError("variable name may not be " + decl); - } - return decl && (decl = IDENTIFIER.test(decl) && decl); - }; - - Class.prototype.setContext = function(name) { - return this.body.traverseChildren(false, function(node) { - if (node.classBody) { - return false; - } - if (node instanceof Literal && node.value === 'this') { - return node.value = name; - } else if (node instanceof Code) { - node.klass = name; - if (node.bound) { - return node.context = name; - } - } - }); - }; - - Class.prototype.addBoundFunctions = function(o) { - var bvar, lhs, _i, _len, _ref2, _results; - if (this.boundFuncs.length) { - _ref2 = this.boundFuncs; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - bvar = _ref2[_i]; - lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); - _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); - } - return _results; - } - }; - - Class.prototype.addProperties = function(node, name, o) { - var assign, base, exprs, func, props; - props = node.base.properties.slice(0); - exprs = (function() { - var _results; - _results = []; - while (assign = props.shift()) { - if (assign instanceof Assign) { - base = assign.variable.base; - delete assign.context; - func = assign.value; - if (base.value === 'constructor') { - if (this.ctor) { - throw new Error('cannot define more than one constructor in a class'); - } - if (func.bound) { - throw new Error('cannot define a constructor as a bound function'); - } - if (func instanceof Code) { - assign = this.ctor = func; - } else { - this.externalCtor = o.scope.freeVariable('class'); - assign = new Assign(new Literal(this.externalCtor), func); - } - } else { - if (assign.variable["this"]) { - func["static"] = true; - if (func.bound) { - func.context = name; - } - } else { - assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); - if (func instanceof Code && func.bound) { - this.boundFuncs.push(base); - func.bound = false; - } - } - } - } - _results.push(assign); - } - return _results; - }).call(this); - return compact(exprs); - }; - - Class.prototype.walkBody = function(name, o) { - var _this = this; - return this.traverseChildren(false, function(child) { - var exps, i, node, _i, _len, _ref2; - if (child instanceof Class) { - return false; - } - if (child instanceof Block) { - _ref2 = exps = child.expressions; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - node = _ref2[i]; - if (node instanceof Value && node.isObject(true)) { - exps[i] = _this.addProperties(node, name, o); - } - } - return child.expressions = exps = flatten(exps); - } - }); - }; - - Class.prototype.hoistDirectivePrologue = function() { - var expressions, index, node; - index = 0; - expressions = this.body.expressions; - while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { - ++index; - } - return this.directives = expressions.splice(0, index); - }; - - Class.prototype.ensureConstructor = function(name) { - if (!this.ctor) { - this.ctor = new Code; - if (this.parent) { - this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); - } - if (this.externalCtor) { - this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); - } - this.ctor.body.makeReturn(); - this.body.expressions.unshift(this.ctor); - } - this.ctor.ctor = this.ctor.name = name; - this.ctor.klass = null; - return this.ctor.noReturn = true; - }; - - Class.prototype.compileNode = function(o) { - var call, decl, klass, lname, name, params, _ref2; - decl = this.determineName(); - name = decl || '_Class'; - if (name.reserved) { - name = "_" + name; - } - lname = new Literal(name); - this.hoistDirectivePrologue(); - this.setContext(name); - this.walkBody(name, o); - this.ensureConstructor(name); - this.body.spaced = true; - if (!(this.ctor instanceof Code)) { - this.body.expressions.unshift(this.ctor); - } - this.body.expressions.push(lname); - (_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives); - this.addBoundFunctions(o); - call = Closure.wrap(this.body); - if (this.parent) { - this.superClass = new Literal(o.scope.freeVariable('super', false)); - this.body.expressions.unshift(new Extends(lname, this.superClass)); - call.args.push(this.parent); - params = call.variable.params || call.variable.base.params; - params.push(new Param(this.superClass)); - } - klass = new Parens(call, true); - if (this.variable) { - klass = new Assign(this.variable, klass); - } - return klass.compile(o); - }; - - return Class; - - })(Base); - - exports.Assign = Assign = (function(_super) { - - __extends(Assign, _super); - - function Assign(variable, value, context, options) { - var forbidden, name, _ref2; - this.variable = variable; - this.value = value; - this.context = context; - this.param = options && options.param; - this.subpattern = options && options.subpattern; - forbidden = (_ref2 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0); - if (forbidden && this.context !== 'object') { - throw SyntaxError("variable name may not be \"" + name + "\""); - } - } - - Assign.prototype.children = ['variable', 'value']; - - Assign.prototype.isStatement = function(o) { - return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; - }; - - Assign.prototype.assigns = function(name) { - return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); - }; - - Assign.prototype.unfoldSoak = function(o) { - return unfoldSoak(o, this, 'variable'); - }; - - Assign.prototype.compileNode = function(o) { - var isValue, match, name, val, varBase, _ref2, _ref3, _ref4, _ref5; - if (isValue = this.variable instanceof Value) { - if (this.variable.isArray() || this.variable.isObject()) { - return this.compilePatternMatch(o); - } - if (this.variable.isSplice()) { - return this.compileSplice(o); - } - if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { - return this.compileConditional(o); - } - } - name = this.variable.compile(o, LEVEL_LIST); - if (!this.context) { - if (!(varBase = this.variable.unwrapAll()).isAssignable()) { - throw SyntaxError("\"" + (this.variable.compile(o)) + "\" cannot be assigned."); - } - if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { - if (this.param) { - o.scope.add(name, 'var'); - } else { - o.scope.find(name); - } - } - } - if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { - if (match[1]) { - this.value.klass = match[1]; - } - this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; - } - val = this.value.compile(o, LEVEL_LIST); - if (this.context === 'object') { - return "" + name + ": " + val; - } - val = name + (" " + (this.context || '=') + " ") + val; - if (o.level <= LEVEL_LIST) { - return val; - } else { - return "(" + val + ")"; - } - }; - - Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; - top = o.level === LEVEL_TOP; - value = this.value; - objects = this.variable.base.objects; - if (!(olen = objects.length)) { - code = value.compile(o); - if (o.level >= LEVEL_OP) { - return "(" + code + ")"; - } else { - return code; - } - } - isObject = this.variable.isObject(); - if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { - if (obj instanceof Assign) { - _ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value; - } else { - if (obj.base instanceof Parens) { - _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; - } else { - idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); - } - } - acc = IDENTIFIER.test(idx.unwrap().value || 0); - value = new Value(value); - value.properties.push(new (acc ? Access : Index)(idx)); - if (_ref5 = obj.unwrap().value, __indexOf.call(RESERVED, _ref5) >= 0) { - throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o))); - } - return new Assign(obj, value, null, { - param: this.param - }).compile(o, LEVEL_TOP); - } - vvar = value.compile(o, LEVEL_LIST); - assigns = []; - splat = false; - if (!IDENTIFIER.test(vvar) || this.variable.assigns(vvar)) { - assigns.push("" + (ref = o.scope.freeVariable('ref')) + " = " + vvar); - vvar = ref; - } - for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { - obj = objects[i]; - idx = i; - if (isObject) { - if (obj instanceof Assign) { - _ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value; - } else { - if (obj.base instanceof Parens) { - _ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1]; - } else { - idx = obj["this"] ? obj.properties[0].name : obj; - } - } - } - if (!splat && obj instanceof Splat) { - name = obj.name.unwrap().value; - obj = obj.unwrap(); - val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i; - if (rest = olen - i - 1) { - ivar = o.scope.freeVariable('i'); - val += ", " + ivar + " = " + vvar + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; - } else { - val += ") : []"; - } - val = new Literal(val); - splat = "" + ivar + "++"; - } else { - name = obj.unwrap().value; - if (obj instanceof Splat) { - obj = obj.name.compile(o); - throw new SyntaxError("multiple splats are disallowed in an assignment: " + obj + "..."); - } - if (typeof idx === 'number') { - idx = new Literal(splat || idx); - acc = false; - } else { - acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); - } - val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]); - } - if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { - throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (val.compile(o))); - } - assigns.push(new Assign(obj, val, null, { - param: this.param, - subpattern: true - }).compile(o, LEVEL_LIST)); - } - if (!(top || this.subpattern)) { - assigns.push(vvar); - } - code = assigns.join(', '); - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - - Assign.prototype.compileConditional = function(o) { - var left, right, _ref2; - _ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1]; - if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { - throw new Error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been defined."); - } - if (__indexOf.call(this.context, "?") >= 0) { - o.isExistentialEquals = true; - } - return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compile(o); - }; - - Assign.prototype.compileSplice = function(o) { - var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; - _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; - name = this.variable.compile(o); - _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; - if (to) { - if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { - to = +to.compile(o) - +fromRef; - if (!exclusive) { - to += 1; - } - } else { - to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; - if (!exclusive) { - to += ' + 1'; - } - } - } else { - to = "9e9"; - } - _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; - code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; - if (o.level > LEVEL_TOP) { - return "(" + code + ")"; - } else { - return code; - } - }; - - return Assign; - - })(Base); - - exports.Code = Code = (function(_super) { - - __extends(Code, _super); - - function Code(params, body, tag) { - this.params = params || []; - this.body = body || new Block; - this.bound = tag === 'boundfunc'; - if (this.bound) { - this.context = '_this'; - } - } - - Code.prototype.children = ['params', 'body']; - - Code.prototype.isStatement = function() { - return !!this.ctor; - }; - - Code.prototype.jumps = NO; - - Code.prototype.compileNode = function(o) { - var code, exprs, i, idt, lit, name, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; - o.scope = new Scope(o.scope, this.body, this); - o.scope.shared = del(o, 'sharedScope'); - o.indent += TAB; - delete o.bare; - delete o.isExistentialEquals; - params = []; - exprs = []; - _ref2 = this.paramNames(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - name = _ref2[_i]; - if (!o.scope.check(name)) { - o.scope.parameter(name); - } - } - _ref3 = this.params; - for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { - param = _ref3[_j]; - if (!param.splat) { - continue; - } - _ref4 = this.params; - for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { - p = _ref4[_k].name; - if (p["this"]) { - p = p.properties[0].name; - } - if (p.value) { - o.scope.add(p.value, 'var', true); - } - } - splats = new Assign(new Value(new Arr((function() { - var _l, _len3, _ref5, _results; - _ref5 = this.params; - _results = []; - for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { - p = _ref5[_l]; - _results.push(p.asReference(o)); - } - return _results; - }).call(this))), new Value(new Literal('arguments'))); - break; - } - _ref5 = this.params; - for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { - param = _ref5[_l]; - if (param.isComplex()) { - val = ref = param.asReference(o); - if (param.value) { - val = new Op('?', ref, param.value); - } - exprs.push(new Assign(new Value(param.name), val, '=', { - param: true - })); - } else { - ref = param; - if (param.value) { - lit = new Literal(ref.name.value + ' == null'); - val = new Assign(new Value(param.name), param.value, '='); - exprs.push(new If(lit, val)); - } - } - if (!splats) { - params.push(ref); - } - } - wasEmpty = this.body.isEmpty(); - if (splats) { - exprs.unshift(splats); - } - if (exprs.length) { - (_ref6 = this.body.expressions).unshift.apply(_ref6, exprs); - } - for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { - p = params[i]; - o.scope.parameter(params[i] = p.compile(o)); - } - uniqs = []; - _ref7 = this.paramNames(); - for (_n = 0, _len5 = _ref7.length; _n < _len5; _n++) { - name = _ref7[_n]; - if (__indexOf.call(uniqs, name) >= 0) { - throw SyntaxError("multiple parameters named '" + name + "'"); - } - uniqs.push(name); - } - if (!(wasEmpty || this.noReturn)) { - this.body.makeReturn(); - } - if (this.bound) { - if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { - this.bound = this.context = o.scope.parent.method.context; - } else if (!this["static"]) { - o.scope.parent.assign('_this', 'this'); - } - } - idt = o.indent; - code = 'function'; - if (this.ctor) { - code += ' ' + this.name; - } - code += '(' + params.join(', ') + ') {'; - if (!this.body.isEmpty()) { - code += "\n" + (this.body.compileWithDeclarations(o)) + "\n" + this.tab; - } - code += '}'; - if (this.ctor) { - return this.tab + code; - } - if (this.front || (o.level >= LEVEL_ACCESS)) { - return "(" + code + ")"; - } else { - return code; - } - }; - - Code.prototype.paramNames = function() { - var names, param, _i, _len, _ref2; - names = []; - _ref2 = this.params; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - param = _ref2[_i]; - names.push.apply(names, param.names()); - } - return names; - }; - - Code.prototype.traverseChildren = function(crossScope, func) { - if (crossScope) { - return Code.__super__.traverseChildren.call(this, crossScope, func); - } - }; - - return Code; - - })(Base); - - exports.Param = Param = (function(_super) { - - __extends(Param, _super); - - function Param(name, value, splat) { - var _ref2; - this.name = name; - this.value = value; - this.splat = splat; - if (_ref2 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { - throw SyntaxError("parameter name \"" + name + "\" is not allowed"); - } - } - - Param.prototype.children = ['name', 'value']; - - Param.prototype.compile = function(o) { - return this.name.compile(o, LEVEL_LIST); - }; - - Param.prototype.asReference = function(o) { - var node; - if (this.reference) { - return this.reference; - } - node = this.name; - if (node["this"]) { - node = node.properties[0].name; - if (node.value.reserved) { - node = new Literal(o.scope.freeVariable(node.value)); - } - } else if (node.isComplex()) { - node = new Literal(o.scope.freeVariable('arg')); - } - node = new Value(node); - if (this.splat) { - node = new Splat(node); - } - return this.reference = node; - }; - - Param.prototype.isComplex = function() { - return this.name.isComplex(); - }; - - Param.prototype.names = function(name) { - var atParam, names, obj, _i, _len, _ref2; - if (name == null) { - name = this.name; - } - atParam = function(obj) { - var value; - value = obj.properties[0].name.value; - if (value.reserved) { - return []; - } else { - return [value]; - } - }; - if (name instanceof Literal) { - return [name.value]; - } - if (name instanceof Value) { - return atParam(name); - } - names = []; - _ref2 = name.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj instanceof Assign) { - names.push(obj.value.unwrap().value); - } else if (obj instanceof Splat) { - names.push(obj.name.unwrap().value); - } else if (obj instanceof Value) { - if (obj.isArray() || obj.isObject()) { - names.push.apply(names, this.names(obj.base)); - } else if (obj["this"]) { - names.push.apply(names, atParam(obj)); - } else { - names.push(obj.base.value); - } - } else { - throw SyntaxError("illegal parameter " + (obj.compile())); - } - } - return names; - }; - - return Param; - - })(Base); - - exports.Splat = Splat = (function(_super) { - - __extends(Splat, _super); - - Splat.prototype.children = ['name']; - - Splat.prototype.isAssignable = YES; - - function Splat(name) { - this.name = name.compile ? name : new Literal(name); - } - - Splat.prototype.assigns = function(name) { - return this.name.assigns(name); - }; - - Splat.prototype.compile = function(o) { - if (this.index != null) { - return this.compileParam(o); - } else { - return this.name.compile(o); - } - }; - - Splat.prototype.unwrap = function() { - return this.name; - }; - - Splat.compileSplattedArray = function(o, list, apply) { - var args, base, code, i, index, node, _i, _len; - index = -1; - while ((node = list[++index]) && !(node instanceof Splat)) { - continue; - } - if (index >= list.length) { - return ''; - } - if (list.length === 1) { - code = list[0].compile(o, LEVEL_LIST); - if (apply) { - return code; - } - return "" + (utility('slice')) + ".call(" + code + ")"; - } - args = list.slice(index); - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - node = args[i]; - code = node.compile(o, LEVEL_LIST); - args[i] = node instanceof Splat ? "" + (utility('slice')) + ".call(" + code + ")" : "[" + code + "]"; - } - if (index === 0) { - return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); - } - base = (function() { - var _j, _len1, _ref2, _results; - _ref2 = list.slice(0, index); - _results = []; - for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { - node = _ref2[_j]; - _results.push(node.compile(o, LEVEL_LIST)); - } - return _results; - })(); - return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")"; - }; - - return Splat; - - })(Base); - - exports.While = While = (function(_super) { - - __extends(While, _super); - - function While(condition, options) { - this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; - this.guard = options != null ? options.guard : void 0; - } - - While.prototype.children = ['condition', 'guard', 'body']; - - While.prototype.isStatement = YES; - - While.prototype.makeReturn = function(res) { - if (res) { - return While.__super__.makeReturn.apply(this, arguments); - } else { - this.returns = !this.jumps({ - loop: true - }); - return this; - } - }; - - While.prototype.addBody = function(body) { - this.body = body; - return this; - }; - - While.prototype.jumps = function() { - var expressions, node, _i, _len; - expressions = this.body.expressions; - if (!expressions.length) { - return false; - } - for (_i = 0, _len = expressions.length; _i < _len; _i++) { - node = expressions[_i]; - if (node.jumps({ - loop: true - })) { - return node; - } - } - return false; - }; - - While.prototype.compileNode = function(o) { - var body, code, rvar, set; - o.indent += TAB; - set = ''; - body = this.body; - if (body.isEmpty()) { - body = ''; - } else { - if (this.returns) { - body.makeReturn(rvar = o.scope.freeVariable('results')); - set = "" + this.tab + rvar + " = [];\n"; - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - } - } - body = "\n" + (body.compile(o, LEVEL_TOP)) + "\n" + this.tab; - } - code = set + this.tab + ("while (" + (this.condition.compile(o, LEVEL_PAREN)) + ") {" + body + "}"); - if (this.returns) { - code += "\n" + this.tab + "return " + rvar + ";"; - } - return code; - }; - - return While; - - })(Base); - - exports.Op = Op = (function(_super) { - var CONVERSIONS, INVERSIONS; - - __extends(Op, _super); - - function Op(op, first, second, flip) { - if (op === 'in') { - return new In(first, second); - } - if (op === 'do') { - return this.generateDo(first); - } - if (op === 'new') { - if (first instanceof Call && !first["do"] && !first.isNew) { - return first.newInstance(); - } - if (first instanceof Code && first.bound || first["do"]) { - first = new Parens(first); - } - } - this.operator = CONVERSIONS[op] || op; - this.first = first; - this.second = second; - this.flip = !!flip; - return this; - } - - CONVERSIONS = { - '==': '===', - '!=': '!==', - 'of': 'in' - }; - - INVERSIONS = { - '!==': '===', - '===': '!==' - }; - - Op.prototype.children = ['first', 'second']; - - Op.prototype.isSimpleNumber = NO; - - Op.prototype.isUnary = function() { - return !this.second; - }; - - Op.prototype.isComplex = function() { - var _ref2; - return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); - }; - - Op.prototype.isChainable = function() { - var _ref2; - return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; - }; - - Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref2; - if (this.isChainable() && this.first.isChainable()) { - allInvertable = true; - curr = this; - while (curr && curr.operator) { - allInvertable && (allInvertable = curr.operator in INVERSIONS); - curr = curr.first; - } - if (!allInvertable) { - return new Parens(this).invert(); - } - curr = this; - while (curr && curr.operator) { - curr.invert = !curr.invert; - curr.operator = INVERSIONS[curr.operator]; - curr = curr.first; - } - return this; - } else if (op = INVERSIONS[this.operator]) { - this.operator = op; - if (this.first.unwrap() instanceof Op) { - this.first.invert(); - } - return this; - } else if (this.second) { - return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { - return fst; - } else { - return new Op('!', this); - } - }; - - Op.prototype.unfoldSoak = function(o) { - var _ref2; - return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); - }; - - Op.prototype.generateDo = function(exp) { - var call, func, param, passedParams, ref, _i, _len, _ref2; - passedParams = []; - func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; - _ref2 = func.params || []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - param = _ref2[_i]; - if (param.value) { - passedParams.push(param.value); - delete param.value; - } else { - passedParams.push(param); - } - } - call = new Call(exp, passedParams); - call["do"] = true; - return call; - }; - - Op.prototype.compileNode = function(o) { - var code, isChain, _ref2, _ref3; - isChain = this.isChainable() && this.first.isChainable(); - if (!isChain) { - this.first.front = this.front; - } - if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { - throw SyntaxError('delete operand may not be argument or var'); - } - if (((_ref2 = this.operator) === '--' || _ref2 === '++') && (_ref3 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0)) { - throw SyntaxError('prefix increment/decrement may not have eval or arguments operand'); - } - if (this.isUnary()) { - return this.compileUnary(o); - } - if (isChain) { - return this.compileChain(o); - } - if (this.operator === '?') { - return this.compileExistence(o); - } - code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP); - if (o.level <= LEVEL_OP) { - return code; - } else { - return "(" + code + ")"; - } - }; - - Op.prototype.compileChain = function(o) { - var code, fst, shared, _ref2; - _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; - fst = this.first.compile(o, LEVEL_OP); - code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); - return "(" + code + ")"; - }; - - Op.prototype.compileExistence = function(o) { - var fst, ref; - if (this.first.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, this.first)); - } else { - fst = this.first; - ref = fst; - } - return new If(new Existence(fst), ref, { - type: 'if' - }).addElse(this.second).compile(o); - }; - - Op.prototype.compileUnary = function(o) { - var op, parts, plusMinus; - if (o.level >= LEVEL_ACCESS) { - return (new Parens(this)).compile(o); - } - parts = [op = this.operator]; - plusMinus = op === '+' || op === '-'; - if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { - parts.push(' '); - } - if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { - this.first = new Parens(this.first); - } - parts.push(this.first.compile(o, LEVEL_OP)); - if (this.flip) { - parts.reverse(); - } - return parts.join(''); - }; - - Op.prototype.toString = function(idt) { - return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); - }; - - return Op; - - })(Base); - - exports.In = In = (function(_super) { - - __extends(In, _super); - - function In(object, array) { - this.object = object; - this.array = array; - } - - In.prototype.children = ['object', 'array']; - - In.prototype.invert = NEGATE; - - In.prototype.compileNode = function(o) { - var hasSplat, obj, _i, _len, _ref2; - if (this.array instanceof Value && this.array.isArray()) { - _ref2 = this.array.base.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (!(obj instanceof Splat)) { - continue; - } - hasSplat = true; - break; - } - if (!hasSplat) { - return this.compileOrTest(o); - } - } - return this.compileLoopTest(o); - }; - - In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; - if (this.array.base.objects.length === 0) { - return "" + (!!this.negated); - } - _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; - _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; - tests = (function() { - var _i, _len, _ref4, _results; - _ref4 = this.array.base.objects; - _results = []; - for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { - item = _ref4[i]; - _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_ACCESS)); - } - return _results; - }).call(this); - tests = tests.join(cnj); - if (o.level < LEVEL_OP) { - return tests; - } else { - return "(" + tests + ")"; - } - }; - - In.prototype.compileLoopTest = function(o) { - var code, ref, sub, _ref2; - _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; - code = utility('indexOf') + (".call(" + (this.array.compile(o, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); - if (sub === ref) { - return code; - } - code = sub + ', ' + code; - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - - In.prototype.toString = function(idt) { - return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); - }; - - return In; - - })(Base); - - exports.Try = Try = (function(_super) { - - __extends(Try, _super); - - function Try(attempt, error, recovery, ensure) { - this.attempt = attempt; - this.error = error; - this.recovery = recovery; - this.ensure = ensure; - } - - Try.prototype.children = ['attempt', 'recovery', 'ensure']; - - Try.prototype.isStatement = YES; - - Try.prototype.jumps = function(o) { - var _ref2; - return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); - }; - - Try.prototype.makeReturn = function(res) { - if (this.attempt) { - this.attempt = this.attempt.makeReturn(res); - } - if (this.recovery) { - this.recovery = this.recovery.makeReturn(res); - } - return this; - }; - - Try.prototype.compileNode = function(o) { - var catchPart, ensurePart, errorPart, tryPart; - o.indent += TAB; - errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; - tryPart = this.attempt.compile(o, LEVEL_TOP); - catchPart = (function() { - var _ref2; - if (this.recovery) { - if (_ref2 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { - throw SyntaxError("catch variable may not be \"" + this.error.value + "\""); - } - if (!o.scope.check(this.error.value)) { - o.scope.add(this.error.value, 'param'); - } - return " catch" + errorPart + "{\n" + (this.recovery.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"; - } else if (!(this.ensure || this.recovery)) { - return ' catch (_error) {}'; - } - }).call(this); - ensurePart = this.ensure ? " finally {\n" + (this.ensure.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" : ''; - return "" + this.tab + "try {\n" + tryPart + "\n" + this.tab + "}" + (catchPart || '') + ensurePart; - }; - - return Try; - - })(Base); - - exports.Throw = Throw = (function(_super) { - - __extends(Throw, _super); - - function Throw(expression) { - this.expression = expression; - } - - Throw.prototype.children = ['expression']; - - Throw.prototype.isStatement = YES; - - Throw.prototype.jumps = NO; - - Throw.prototype.makeReturn = THIS; - - Throw.prototype.compileNode = function(o) { - return this.tab + ("throw " + (this.expression.compile(o)) + ";"); - }; - - return Throw; - - })(Base); - - exports.Existence = Existence = (function(_super) { - - __extends(Existence, _super); - - function Existence(expression) { - this.expression = expression; - } - - Existence.prototype.children = ['expression']; - - Existence.prototype.invert = NEGATE; - - Existence.prototype.compileNode = function(o) { - var cmp, cnj, code, _ref2; - this.expression.front = this.front; - code = this.expression.compile(o, LEVEL_OP); - if (IDENTIFIER.test(code) && !o.scope.check(code)) { - _ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1]; - code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; - } else { - code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; - } - if (o.level <= LEVEL_COND) { - return code; - } else { - return "(" + code + ")"; - } - }; - - return Existence; - - })(Base); - - exports.Parens = Parens = (function(_super) { - - __extends(Parens, _super); - - function Parens(body) { - this.body = body; - } - - Parens.prototype.children = ['body']; - - Parens.prototype.unwrap = function() { - return this.body; - }; - - Parens.prototype.isComplex = function() { - return this.body.isComplex(); - }; - - Parens.prototype.compileNode = function(o) { - var bare, code, expr; - expr = this.body.unwrap(); - if (expr instanceof Value && expr.isAtomic()) { - expr.front = this.front; - return expr.compile(o); - } - code = expr.compile(o, LEVEL_PAREN); - bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); - if (bare) { - return code; - } else { - return "(" + code + ")"; - } - }; - - return Parens; - - })(Base); - - exports.For = For = (function(_super) { - - __extends(For, _super); - - function For(body, source) { - var _ref2; - this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; - this.body = Block.wrap([body]); - this.own = !!source.own; - this.object = !!source.object; - if (this.object) { - _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; - } - if (this.index instanceof Value) { - throw SyntaxError('index cannot be a pattern matching expression'); - } - this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; - this.pattern = this.name instanceof Value; - if (this.range && this.index) { - throw SyntaxError('indexes do not apply to range loops'); - } - if (this.range && this.pattern) { - throw SyntaxError('cannot pattern match over range loops'); - } - this.returns = false; - } - - For.prototype.children = ['body', 'source', 'guard', 'step']; - - For.prototype.compileNode = function(o) { - var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; - body = Block.wrap([this.body]); - lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; - if (lastJumps && lastJumps instanceof Return) { - this.returns = false; - } - source = this.range ? this.source.base : this.source; - scope = o.scope; - name = this.name && this.name.compile(o, LEVEL_LIST); - index = this.index && this.index.compile(o, LEVEL_LIST); - if (name && !this.pattern) { - scope.find(name); - } - if (index) { - scope.find(index); - } - if (this.returns) { - rvar = scope.freeVariable('results'); - } - ivar = (this.object && index) || scope.freeVariable('i'); - kvar = (this.range && name) || index || ivar; - kvarAssign = kvar !== ivar ? "" + kvar + " = " : ""; - if (this.step && !this.range) { - stepvar = scope.freeVariable("step"); - } - if (this.pattern) { - name = ivar; - } - varPart = ''; - guardPart = ''; - defPart = ''; - idt1 = this.tab + TAB; - if (this.range) { - forPart = source.compile(merge(o, { - index: ivar, - name: name, - step: this.step - })); - } else { - svar = this.source.compile(o, LEVEL_LIST); - if ((name || this.own) && !IDENTIFIER.test(svar)) { - defPart = "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; - svar = ref; - } - if (name && !this.pattern) { - namePart = "" + name + " = " + svar + "[" + kvar + "]"; - } - if (!this.object) { - lvar = scope.freeVariable('len'); - forVarPart = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; - if (this.step) { - forVarPart += ", " + stepvar + " = " + (this.step.compile(o, LEVEL_OP)); - } - stepPart = "" + kvarAssign + (this.step ? "" + ivar + " += " + stepvar : (kvar !== ivar ? "++" + ivar : "" + ivar + "++")); - forPart = "" + forVarPart + "; " + ivar + " < " + lvar + "; " + stepPart; - } - } - if (this.returns) { - resultPart = "" + this.tab + rvar + " = [];\n"; - returnResult = "\n" + this.tab + "return " + rvar + ";"; - body.makeReturn(rvar); - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - } - } - if (this.pattern) { - body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]"))); - } - defPart += this.pluckDirectCall(o, body); - if (namePart) { - varPart = "\n" + idt1 + namePart + ";"; - } - if (this.object) { - forPart = "" + kvar + " in " + svar; - if (this.own) { - guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; - } - } - body = body.compile(merge(o, { - indent: idt1 - }), LEVEL_TOP); - if (body) { - body = '\n' + body + '\n'; - } - return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); - }; - - For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - defs = ''; - _ref2 = body.expressions; - for (idx = _i = 0, _len = _ref2.length; _i < _len; idx = ++_i) { - expr = _ref2[idx]; - expr = expr.unwrapAll(); - if (!(expr instanceof Call)) { - continue; - } - val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { - continue; - } - fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; - ref = new Literal(o.scope.freeVariable('fn')); - base = new Value(ref); - if (val.base) { - _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; - } - body.expressions[idx] = new Call(base, expr.args); - defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; - } - return defs; - }; - - return For; - - })(While); - - exports.Switch = Switch = (function(_super) { - - __extends(Switch, _super); - - function Switch(subject, cases, otherwise) { - this.subject = subject; - this.cases = cases; - this.otherwise = otherwise; - } - - Switch.prototype.children = ['subject', 'cases', 'otherwise']; - - Switch.prototype.isStatement = YES; - - Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref2, _ref3, _ref4; - if (o == null) { - o = { - block: true - }; - } - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; - if (block.jumps(o)) { - return block; - } - } - return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; - }; - - Switch.prototype.makeReturn = function(res) { - var pair, _i, _len, _ref2, _ref3; - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - pair = _ref2[_i]; - pair[1].makeReturn(res); - } - if (res) { - this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); - } - if ((_ref3 = this.otherwise) != null) { - _ref3.makeReturn(res); - } - return this; - }; - - Switch.prototype.compileNode = function(o) { - var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len1, _ref2, _ref3, _ref4, _ref5; - idt1 = o.indent + TAB; - idt2 = o.indent = idt1 + TAB; - code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); - _ref3 = this.cases; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; - _ref5 = flatten([conditions]); - for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { - cond = _ref5[_j]; - if (!this.subject) { - cond = cond.invert(); - } - code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); - } - if (body = block.compile(o, LEVEL_TOP)) { - code += body + '\n'; - } - if (i === this.cases.length - 1 && !this.otherwise) { - break; - } - expr = this.lastNonComment(block.expressions); - if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { - continue; - } - code += idt2 + 'break;\n'; - } - if (this.otherwise && this.otherwise.expressions.length) { - code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); - } - return code + this.tab + '}'; - }; - - return Switch; - - })(Base); - - exports.If = If = (function(_super) { - - __extends(If, _super); - - function If(condition, body, options) { - this.body = body; - if (options == null) { - options = {}; - } - this.condition = options.type === 'unless' ? condition.invert() : condition; - this.elseBody = null; - this.isChain = false; - this.soak = options.soak; - } - - If.prototype.children = ['condition', 'body', 'elseBody']; - - If.prototype.bodyNode = function() { - var _ref2; - return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; - }; - - If.prototype.elseBodyNode = function() { - var _ref2; - return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; - }; - - If.prototype.addElse = function(elseBody) { - if (this.isChain) { - this.elseBodyNode().addElse(elseBody); - } else { - this.isChain = elseBody instanceof If; - this.elseBody = this.ensureBlock(elseBody); - } - return this; - }; - - If.prototype.isStatement = function(o) { - var _ref2; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); - }; - - If.prototype.jumps = function(o) { - var _ref2; - return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); - }; - - If.prototype.compileNode = function(o) { - if (this.isStatement(o)) { - return this.compileStatement(o); - } else { - return this.compileExpression(o); - } - }; - - If.prototype.makeReturn = function(res) { - if (res) { - this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); - } - this.body && (this.body = new Block([this.body.makeReturn(res)])); - this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); - return this; - }; - - If.prototype.ensureBlock = function(node) { - if (node instanceof Block) { - return node; - } else { - return new Block([node]); - } - }; - - If.prototype.compileStatement = function(o) { - var body, child, cond, exeq, ifPart; - child = del(o, 'chainChild'); - exeq = del(o, 'isExistentialEquals'); - if (exeq) { - return new If(this.condition.invert(), this.elseBodyNode(), { - type: 'if' - }).compile(o); - } - cond = this.condition.compile(o, LEVEL_PAREN); - o.indent += TAB; - body = this.ensureBlock(this.body); - ifPart = "if (" + cond + ") {\n" + (body.compile(o)) + "\n" + this.tab + "}"; - if (!child) { - ifPart = this.tab + ifPart; - } - if (!this.elseBody) { - return ifPart; - } - return ifPart + ' else ' + (this.isChain ? (o.indent = this.tab, o.chainChild = true, this.elseBody.unwrap().compile(o, LEVEL_TOP)) : "{\n" + (this.elseBody.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"); - }; - - If.prototype.compileExpression = function(o) { - var alt, body, code, cond; - cond = this.condition.compile(o, LEVEL_COND); - body = this.bodyNode().compile(o, LEVEL_LIST); - alt = this.elseBodyNode() ? this.elseBodyNode().compile(o, LEVEL_LIST) : 'void 0'; - code = "" + cond + " ? " + body + " : " + alt; - if (o.level >= LEVEL_COND) { - return "(" + code + ")"; - } else { - return code; - } - }; - - If.prototype.unfoldSoak = function() { - return this.soak && this; - }; - - return If; - - })(Base); - - Closure = { - wrap: function(expressions, statement, noReturn) { - var args, call, func, mentionsArgs, meth; - if (expressions.jumps()) { - return expressions; - } - func = new Code([], Block.wrap([expressions])); - args = []; - if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) { - meth = new Literal(mentionsArgs ? 'apply' : 'call'); - args = [new Literal('this')]; - if (mentionsArgs) { - args.push(new Literal('arguments')); - } - func = new Value(func, [new Access(meth)]); - } - func.noReturn = noReturn; - call = new Call(func, args); - if (statement) { - return Block.wrap([call]); - } else { - return call; - } - }, - literalArgs: function(node) { - return node instanceof Literal && node.value === 'arguments' && !node.asKey; - }, - literalThis: function(node) { - return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper); - } - }; - - unfoldSoak = function(o, parent, name) { - var ifn; - if (!(ifn = parent[name].unfoldSoak(o))) { - return; - } - parent[name] = ifn.body; - ifn.body = new Value(parent); - return ifn; - }; - - UTILITIES = { - "extends": function() { - return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"; - }, - bind: function() { - return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; - }, - indexOf: function() { - return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; - }, - hasProp: function() { - return '{}.hasOwnProperty'; - }, - slice: function() { - return '[].slice'; - } - }; - - LEVEL_TOP = 1; - - LEVEL_PAREN = 2; - - LEVEL_LIST = 3; - - LEVEL_COND = 4; - - LEVEL_OP = 5; - - LEVEL_ACCESS = 6; - - TAB = ' '; - - IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; - - IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); - - SIMPLENUM = /^[+-]?\d+$/; - - METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); - - IS_STRING = /^['"]/; - - utility = function(name) { - var ref; - ref = "__" + name; - Scope.root.assign(ref, UTILITIES[name]()); - return ref; - }; - - multident = function(code, tab) { - code = code.replace(/\n/g, '$&' + tab); - return code.replace(/\s+$/, ''); - }; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js deleted file mode 100644 index d9bab41..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/optparse.js +++ /dev/null @@ -1,138 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; - - exports.OptionParser = OptionParser = (function() { - - function OptionParser(rules, banner) { - this.banner = banner; - this.rules = buildRules(rules); - } - - OptionParser.prototype.parse = function(args) { - var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref; - options = { - "arguments": [] - }; - skippingArgument = false; - originalArgs = args; - args = normalizeArguments(args); - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - arg = args[i]; - if (skippingArgument) { - skippingArgument = false; - continue; - } - if (arg === '--') { - pos = originalArgs.indexOf('--'); - options["arguments"] = options["arguments"].concat(originalArgs.slice(pos + 1)); - break; - } - isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); - seenNonOptionArg = options["arguments"].length > 0; - if (!seenNonOptionArg) { - matchedRule = false; - _ref = this.rules; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - rule = _ref[_j]; - if (rule.shortFlag === arg || rule.longFlag === arg) { - value = true; - if (rule.hasArgument) { - skippingArgument = true; - value = args[i + 1]; - } - options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; - matchedRule = true; - break; - } - } - if (isOption && !matchedRule) { - throw new Error("unrecognized option: " + arg); - } - } - if (seenNonOptionArg || !isOption) { - options["arguments"].push(arg); - } - } - return options; - }; - - OptionParser.prototype.help = function() { - var letPart, lines, rule, spaces, _i, _len, _ref; - lines = []; - if (this.banner) { - lines.unshift("" + this.banner + "\n"); - } - _ref = this.rules; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - rule = _ref[_i]; - spaces = 15 - rule.longFlag.length; - spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; - letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; - lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); - } - return "\n" + (lines.join('\n')) + "\n"; - }; - - return OptionParser; - - })(); - - LONG_FLAG = /^(--\w[\w\-]*)/; - - SHORT_FLAG = /^(-\w)$/; - - MULTI_FLAG = /^-(\w{2,})/; - - OPTIONAL = /\[(\w+(\*?))\]/; - - buildRules = function(rules) { - var tuple, _i, _len, _results; - _results = []; - for (_i = 0, _len = rules.length; _i < _len; _i++) { - tuple = rules[_i]; - if (tuple.length < 3) { - tuple.unshift(null); - } - _results.push(buildRule.apply(null, tuple)); - } - return _results; - }; - - buildRule = function(shortFlag, longFlag, description, options) { - var match; - if (options == null) { - options = {}; - } - match = longFlag.match(OPTIONAL); - longFlag = longFlag.match(LONG_FLAG)[1]; - return { - name: longFlag.substr(2), - shortFlag: shortFlag, - longFlag: longFlag, - description: description, - hasArgument: !!(match && match[1]), - isList: !!(match && match[2]) - }; - }; - - normalizeArguments = function(args) { - var arg, l, match, result, _i, _j, _len, _len1, _ref; - args = args.slice(0); - result = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - if (match = arg.match(MULTI_FLAG)) { - _ref = match[1].split(''); - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - l = _ref[_j]; - result.push('-' + l); - } - } else { - result.push(arg); - } - } - return result; - }; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js deleted file mode 100755 index f049903..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/parser.js +++ /dev/null @@ -1,683 +0,0 @@ -/* Jison generated parser */ -var parser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"Index":69,"INDEX_START":70,"IndexValue":71,"INDEX_END":72,"INDEX_SOAK":73,"Slice":74,"{":75,"AssignList":76,"}":77,"CLASS":78,"EXTENDS":79,"OptFuncExist":80,"Arguments":81,"SUPER":82,"FUNC_EXIST":83,"CALL_START":84,"CALL_END":85,"ArgList":86,"THIS":87,"@":88,"[":89,"]":90,"RangeDots":91,"..":92,"Arg":93,"SimpleArgs":94,"TRY":95,"Catch":96,"FINALLY":97,"CATCH":98,"THROW":99,"(":100,")":101,"WhileSource":102,"WHILE":103,"WHEN":104,"UNTIL":105,"Loop":106,"LOOP":107,"ForBody":108,"FOR":109,"ForStart":110,"ForSource":111,"ForVariables":112,"OWN":113,"ForValue":114,"FORIN":115,"FOROF":116,"BY":117,"SWITCH":118,"Whens":119,"ELSE":120,"When":121,"LEADING_WHEN":122,"IfBlock":123,"IF":124,"POST_IF":125,"UNARY":126,"-":127,"+":128,"--":129,"++":130,"?":131,"MATH":132,"SHIFT":133,"COMPARE":134,"LOGIC":135,"RELATION":136,"COMPOUND_ASSIGN":137,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"}, -productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]], -performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { - -var $0 = $$.length - 1; -switch (yystate) { -case 1:return this.$ = new yy.Block; -break; -case 2:return this.$ = $$[$0]; -break; -case 3:return this.$ = $$[$0-1]; -break; -case 4:this.$ = yy.Block.wrap([$$[$0]]); -break; -case 5:this.$ = $$[$0-2].push($$[$0]); -break; -case 6:this.$ = $$[$0-1]; -break; -case 7:this.$ = $$[$0]; -break; -case 8:this.$ = $$[$0]; -break; -case 9:this.$ = $$[$0]; -break; -case 10:this.$ = $$[$0]; -break; -case 11:this.$ = new yy.Literal($$[$0]); -break; -case 12:this.$ = $$[$0]; -break; -case 13:this.$ = $$[$0]; -break; -case 14:this.$ = $$[$0]; -break; -case 15:this.$ = $$[$0]; -break; -case 16:this.$ = $$[$0]; -break; -case 17:this.$ = $$[$0]; -break; -case 18:this.$ = $$[$0]; -break; -case 19:this.$ = $$[$0]; -break; -case 20:this.$ = $$[$0]; -break; -case 21:this.$ = $$[$0]; -break; -case 22:this.$ = $$[$0]; -break; -case 23:this.$ = $$[$0]; -break; -case 24:this.$ = new yy.Block; -break; -case 25:this.$ = $$[$0-1]; -break; -case 26:this.$ = new yy.Literal($$[$0]); -break; -case 27:this.$ = new yy.Literal($$[$0]); -break; -case 28:this.$ = new yy.Literal($$[$0]); -break; -case 29:this.$ = $$[$0]; -break; -case 30:this.$ = new yy.Literal($$[$0]); -break; -case 31:this.$ = new yy.Literal($$[$0]); -break; -case 32:this.$ = new yy.Literal($$[$0]); -break; -case 33:this.$ = new yy.Undefined; -break; -case 34:this.$ = new yy.Null; -break; -case 35:this.$ = new yy.Bool($$[$0]); -break; -case 36:this.$ = new yy.Assign($$[$0-2], $$[$0]); -break; -case 37:this.$ = new yy.Assign($$[$0-3], $$[$0]); -break; -case 38:this.$ = new yy.Assign($$[$0-4], $$[$0-1]); -break; -case 39:this.$ = new yy.Value($$[$0]); -break; -case 40:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object'); -break; -case 41:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object'); -break; -case 42:this.$ = $$[$0]; -break; -case 43:this.$ = $$[$0]; -break; -case 44:this.$ = $$[$0]; -break; -case 45:this.$ = $$[$0]; -break; -case 46:this.$ = new yy.Return($$[$0]); -break; -case 47:this.$ = new yy.Return; -break; -case 48:this.$ = new yy.Comment($$[$0]); -break; -case 49:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]); -break; -case 50:this.$ = new yy.Code([], $$[$0], $$[$0-1]); -break; -case 51:this.$ = 'func'; -break; -case 52:this.$ = 'boundfunc'; -break; -case 53:this.$ = $$[$0]; -break; -case 54:this.$ = $$[$0]; -break; -case 55:this.$ = []; -break; -case 56:this.$ = [$$[$0]]; -break; -case 57:this.$ = $$[$0-2].concat($$[$0]); -break; -case 58:this.$ = $$[$0-3].concat($$[$0]); -break; -case 59:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 60:this.$ = new yy.Param($$[$0]); -break; -case 61:this.$ = new yy.Param($$[$0-1], null, true); -break; -case 62:this.$ = new yy.Param($$[$0-2], $$[$0]); -break; -case 63:this.$ = $$[$0]; -break; -case 64:this.$ = $$[$0]; -break; -case 65:this.$ = $$[$0]; -break; -case 66:this.$ = $$[$0]; -break; -case 67:this.$ = new yy.Splat($$[$0-1]); -break; -case 68:this.$ = new yy.Value($$[$0]); -break; -case 69:this.$ = $$[$0-1].add($$[$0]); -break; -case 70:this.$ = new yy.Value($$[$0-1], [].concat($$[$0])); -break; -case 71:this.$ = $$[$0]; -break; -case 72:this.$ = $$[$0]; -break; -case 73:this.$ = new yy.Value($$[$0]); -break; -case 74:this.$ = new yy.Value($$[$0]); -break; -case 75:this.$ = $$[$0]; -break; -case 76:this.$ = new yy.Value($$[$0]); -break; -case 77:this.$ = new yy.Value($$[$0]); -break; -case 78:this.$ = new yy.Value($$[$0]); -break; -case 79:this.$ = $$[$0]; -break; -case 80:this.$ = new yy.Access($$[$0]); -break; -case 81:this.$ = new yy.Access($$[$0], 'soak'); -break; -case 82:this.$ = [new yy.Access(new yy.Literal('prototype')), new yy.Access($$[$0])]; -break; -case 83:this.$ = new yy.Access(new yy.Literal('prototype')); -break; -case 84:this.$ = $$[$0]; -break; -case 85:this.$ = $$[$0-1]; -break; -case 86:this.$ = yy.extend($$[$0], { - soak: true - }); -break; -case 87:this.$ = new yy.Index($$[$0]); -break; -case 88:this.$ = new yy.Slice($$[$0]); -break; -case 89:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated); -break; -case 90:this.$ = []; -break; -case 91:this.$ = [$$[$0]]; -break; -case 92:this.$ = $$[$0-2].concat($$[$0]); -break; -case 93:this.$ = $$[$0-3].concat($$[$0]); -break; -case 94:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 95:this.$ = new yy.Class; -break; -case 96:this.$ = new yy.Class(null, null, $$[$0]); -break; -case 97:this.$ = new yy.Class(null, $$[$0]); -break; -case 98:this.$ = new yy.Class(null, $$[$0-1], $$[$0]); -break; -case 99:this.$ = new yy.Class($$[$0]); -break; -case 100:this.$ = new yy.Class($$[$0-1], null, $$[$0]); -break; -case 101:this.$ = new yy.Class($$[$0-2], $$[$0]); -break; -case 102:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]); -break; -case 103:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 104:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 105:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]); -break; -case 106:this.$ = new yy.Call('super', $$[$0]); -break; -case 107:this.$ = false; -break; -case 108:this.$ = true; -break; -case 109:this.$ = []; -break; -case 110:this.$ = $$[$0-2]; -break; -case 111:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 112:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 113:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this'); -break; -case 114:this.$ = new yy.Arr([]); -break; -case 115:this.$ = new yy.Arr($$[$0-2]); -break; -case 116:this.$ = 'inclusive'; -break; -case 117:this.$ = 'exclusive'; -break; -case 118:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]); -break; -case 119:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]); -break; -case 120:this.$ = new yy.Range($$[$0-1], null, $$[$0]); -break; -case 121:this.$ = new yy.Range(null, $$[$0], $$[$0-1]); -break; -case 122:this.$ = new yy.Range(null, null, $$[$0]); -break; -case 123:this.$ = [$$[$0]]; -break; -case 124:this.$ = $$[$0-2].concat($$[$0]); -break; -case 125:this.$ = $$[$0-3].concat($$[$0]); -break; -case 126:this.$ = $$[$0-2]; -break; -case 127:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 128:this.$ = $$[$0]; -break; -case 129:this.$ = $$[$0]; -break; -case 130:this.$ = $$[$0]; -break; -case 131:this.$ = [].concat($$[$0-2], $$[$0]); -break; -case 132:this.$ = new yy.Try($$[$0]); -break; -case 133:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]); -break; -case 134:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]); -break; -case 135:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]); -break; -case 136:this.$ = [$$[$0-1], $$[$0]]; -break; -case 137:this.$ = new yy.Throw($$[$0]); -break; -case 138:this.$ = new yy.Parens($$[$0-1]); -break; -case 139:this.$ = new yy.Parens($$[$0-2]); -break; -case 140:this.$ = new yy.While($$[$0]); -break; -case 141:this.$ = new yy.While($$[$0-2], { - guard: $$[$0] - }); -break; -case 142:this.$ = new yy.While($$[$0], { - invert: true - }); -break; -case 143:this.$ = new yy.While($$[$0-2], { - invert: true, - guard: $$[$0] - }); -break; -case 144:this.$ = $$[$0-1].addBody($$[$0]); -break; -case 145:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 146:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 147:this.$ = $$[$0]; -break; -case 148:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]); -break; -case 149:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]])); -break; -case 150:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 151:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 152:this.$ = new yy.For($$[$0], $$[$0-1]); -break; -case 153:this.$ = { - source: new yy.Value($$[$0]) - }; -break; -case 154:this.$ = (function () { - $$[$0].own = $$[$0-1].own; - $$[$0].name = $$[$0-1][0]; - $$[$0].index = $$[$0-1][1]; - return $$[$0]; - }()); -break; -case 155:this.$ = $$[$0]; -break; -case 156:this.$ = (function () { - $$[$0].own = true; - return $$[$0]; - }()); -break; -case 157:this.$ = $$[$0]; -break; -case 158:this.$ = $$[$0]; -break; -case 159:this.$ = new yy.Value($$[$0]); -break; -case 160:this.$ = new yy.Value($$[$0]); -break; -case 161:this.$ = [$$[$0]]; -break; -case 162:this.$ = [$$[$0-2], $$[$0]]; -break; -case 163:this.$ = { - source: $$[$0] - }; -break; -case 164:this.$ = { - source: $$[$0], - object: true - }; -break; -case 165:this.$ = { - source: $$[$0-2], - guard: $$[$0] - }; -break; -case 166:this.$ = { - source: $$[$0-2], - guard: $$[$0], - object: true - }; -break; -case 167:this.$ = { - source: $$[$0-2], - step: $$[$0] - }; -break; -case 168:this.$ = { - source: $$[$0-4], - guard: $$[$0-2], - step: $$[$0] - }; -break; -case 169:this.$ = { - source: $$[$0-4], - step: $$[$0-2], - guard: $$[$0] - }; -break; -case 170:this.$ = new yy.Switch($$[$0-3], $$[$0-1]); -break; -case 171:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]); -break; -case 172:this.$ = new yy.Switch(null, $$[$0-1]); -break; -case 173:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]); -break; -case 174:this.$ = $$[$0]; -break; -case 175:this.$ = $$[$0-1].concat($$[$0]); -break; -case 176:this.$ = [[$$[$0-1], $$[$0]]]; -break; -case 177:this.$ = [[$$[$0-2], $$[$0-1]]]; -break; -case 178:this.$ = new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - }); -break; -case 179:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })); -break; -case 180:this.$ = $$[$0]; -break; -case 181:this.$ = $$[$0-2].addElse($$[$0]); -break; -case 182:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 183:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 184:this.$ = new yy.Op($$[$0-1], $$[$0]); -break; -case 185:this.$ = new yy.Op('-', $$[$0]); -break; -case 186:this.$ = new yy.Op('+', $$[$0]); -break; -case 187:this.$ = new yy.Op('--', $$[$0]); -break; -case 188:this.$ = new yy.Op('++', $$[$0]); -break; -case 189:this.$ = new yy.Op('--', $$[$0-1], null, true); -break; -case 190:this.$ = new yy.Op('++', $$[$0-1], null, true); -break; -case 191:this.$ = new yy.Existence($$[$0-1]); -break; -case 192:this.$ = new yy.Op('+', $$[$0-2], $$[$0]); -break; -case 193:this.$ = new yy.Op('-', $$[$0-2], $$[$0]); -break; -case 194:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 195:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 196:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 197:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 198:this.$ = (function () { - if ($$[$0-1].charAt(0) === '!') { - return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); - } else { - return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); - } - }()); -break; -case 199:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]); -break; -case 200:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]); -break; -case 201:this.$ = new yy.Extends($$[$0-2], $$[$0]); -break; -} -}, -table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2,20],85:[2,20],90:[2,20],92:[2,20],101:[2,20],103:[2,20],104:[2,20],105:[2,20],109:[2,20],117:[2,20],125:[2,20],127:[2,20],128:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],72:[2,21],77:[2,21],85:[2,21],90:[2,21],92:[2,21],101:[2,21],103:[2,21],104:[2,21],105:[2,21],109:[2,21],117:[2,21],125:[2,21],127:[2,21],128:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],72:[2,22],77:[2,22],85:[2,22],90:[2,22],92:[2,22],101:[2,22],103:[2,22],104:[2,22],105:[2,22],109:[2,22],117:[2,22],125:[2,22],127:[2,22],128:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],72:[2,23],77:[2,23],85:[2,23],90:[2,23],92:[2,23],101:[2,23],103:[2,23],104:[2,23],105:[2,23],109:[2,23],117:[2,23],125:[2,23],127:[2,23],128:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23]},{1:[2,9],6:[2,9],26:[2,9],101:[2,9],103:[2,9],105:[2,9],109:[2,9],125:[2,9]},{1:[2,10],6:[2,10],26:[2,10],101:[2,10],103:[2,10],105:[2,10],109:[2,10],125:[2,10]},{1:[2,11],6:[2,11],26:[2,11],101:[2,11],103:[2,11],105:[2,11],109:[2,11],125:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,103],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],70:[2,75],72:[2,75],73:[2,75],77:[2,75],83:[2,75],84:[2,75],85:[2,75],90:[2,75],92:[2,75],101:[2,75],103:[2,75],104:[2,75],105:[2,75],109:[2,75],117:[2,75],125:[2,75],127:[2,75],128:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],70:[2,76],72:[2,76],73:[2,76],77:[2,76],83:[2,76],84:[2,76],85:[2,76],90:[2,76],92:[2,76],101:[2,76],103:[2,76],104:[2,76],105:[2,76],109:[2,76],117:[2,76],125:[2,76],127:[2,76],128:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],70:[2,77],72:[2,77],73:[2,77],77:[2,77],83:[2,77],84:[2,77],85:[2,77],90:[2,77],92:[2,77],101:[2,77],103:[2,77],104:[2,77],105:[2,77],109:[2,77],117:[2,77],125:[2,77],127:[2,77],128:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],70:[2,78],72:[2,78],73:[2,78],77:[2,78],83:[2,78],84:[2,78],85:[2,78],90:[2,78],92:[2,78],101:[2,78],103:[2,78],104:[2,78],105:[2,78],109:[2,78],117:[2,78],125:[2,78],127:[2,78],128:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],70:[2,79],72:[2,79],73:[2,79],77:[2,79],83:[2,79],84:[2,79],85:[2,79],90:[2,79],92:[2,79],101:[2,79],103:[2,79],104:[2,79],105:[2,79],109:[2,79],117:[2,79],125:[2,79],127:[2,79],128:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],70:[2,105],72:[2,105],73:[2,105],77:[2,105],81:104,83:[2,105],84:[1,105],85:[2,105],90:[2,105],92:[2,105],101:[2,105],103:[2,105],104:[2,105],105:[2,105],109:[2,105],117:[2,105],125:[2,105],127:[2,105],128:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105]},{6:[2,55],25:[2,55],27:109,28:[1,73],44:110,48:106,49:[2,55],54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{5:115,25:[1,5]},{8:116,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:118,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:119,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:120,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:124,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,72],73:[2,72],77:[2,72],79:[1,128],83:[2,72],84:[2,72],85:[2,72],90:[2,72],92:[2,72],101:[2,72],103:[2,72],104:[2,72],105:[2,72],109:[2,72],117:[2,72],125:[2,72],127:[2,72],128:[2,72],129:[1,125],130:[1,126],131:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[1,127]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],72:[2,180],77:[2,180],85:[2,180],90:[2,180],92:[2,180],101:[2,180],103:[2,180],104:[2,180],105:[2,180],109:[2,180],117:[2,180],120:[1,129],125:[2,180],127:[2,180],128:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180]},{5:130,25:[1,5]},{5:131,25:[1,5]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],72:[2,147],77:[2,147],85:[2,147],90:[2,147],92:[2,147],101:[2,147],103:[2,147],104:[2,147],105:[2,147],109:[2,147],117:[2,147],125:[2,147],127:[2,147],128:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147]},{5:132,25:[1,5]},{8:133,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,134],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,95],5:135,6:[2,95],13:121,14:122,25:[1,5],26:[2,95],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,49:[2,95],54:[2,95],57:[2,95],58:47,59:48,61:137,63:25,64:26,65:27,72:[2,95],75:[1,70],77:[2,95],79:[1,136],82:[1,28],85:[2,95],87:[1,58],88:[1,59],89:[1,57],90:[2,95],92:[2,95],100:[1,56],101:[2,95],103:[2,95],104:[2,95],105:[2,95],109:[2,95],117:[2,95],125:[2,95],127:[2,95],128:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95]},{8:138,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,47],6:[2,47],8:139,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,47],102:39,103:[2,47],105:[2,47],106:40,107:[1,67],108:41,109:[2,47],110:69,118:[1,42],123:37,124:[1,64],125:[2,47],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],77:[2,48],101:[2,48],103:[2,48],105:[2,48],109:[2,48],125:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],70:[2,73],72:[2,73],73:[2,73],77:[2,73],83:[2,73],84:[2,73],85:[2,73],90:[2,73],92:[2,73],101:[2,73],103:[2,73],104:[2,73],105:[2,73],109:[2,73],117:[2,73],125:[2,73],127:[2,73],128:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],70:[2,74],72:[2,74],73:[2,74],77:[2,74],83:[2,74],84:[2,74],85:[2,74],90:[2,74],92:[2,74],101:[2,74],103:[2,74],104:[2,74],105:[2,74],109:[2,74],117:[2,74],125:[2,74],127:[2,74],128:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],70:[2,29],72:[2,29],73:[2,29],77:[2,29],83:[2,29],84:[2,29],85:[2,29],90:[2,29],92:[2,29],101:[2,29],103:[2,29],104:[2,29],105:[2,29],109:[2,29],117:[2,29],125:[2,29],127:[2,29],128:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],70:[2,30],72:[2,30],73:[2,30],77:[2,30],83:[2,30],84:[2,30],85:[2,30],90:[2,30],92:[2,30],101:[2,30],103:[2,30],104:[2,30],105:[2,30],109:[2,30],117:[2,30],125:[2,30],127:[2,30],128:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],70:[2,31],72:[2,31],73:[2,31],77:[2,31],83:[2,31],84:[2,31],85:[2,31],90:[2,31],92:[2,31],101:[2,31],103:[2,31],104:[2,31],105:[2,31],109:[2,31],117:[2,31],125:[2,31],127:[2,31],128:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],70:[2,32],72:[2,32],73:[2,32],77:[2,32],83:[2,32],84:[2,32],85:[2,32],90:[2,32],92:[2,32],101:[2,32],103:[2,32],104:[2,32],105:[2,32],109:[2,32],117:[2,32],125:[2,32],127:[2,32],128:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],70:[2,33],72:[2,33],73:[2,33],77:[2,33],83:[2,33],84:[2,33],85:[2,33],90:[2,33],92:[2,33],101:[2,33],103:[2,33],104:[2,33],105:[2,33],109:[2,33],117:[2,33],125:[2,33],127:[2,33],128:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],70:[2,34],72:[2,34],73:[2,34],77:[2,34],83:[2,34],84:[2,34],85:[2,34],90:[2,34],92:[2,34],101:[2,34],103:[2,34],104:[2,34],105:[2,34],109:[2,34],117:[2,34],125:[2,34],127:[2,34],128:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],70:[2,35],72:[2,35],73:[2,35],77:[2,35],83:[2,35],84:[2,35],85:[2,35],90:[2,35],92:[2,35],101:[2,35],103:[2,35],104:[2,35],105:[2,35],109:[2,35],117:[2,35],125:[2,35],127:[2,35],128:[2,35],131:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35]},{4:140,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,141],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:142,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],70:[2,111],72:[2,111],73:[2,111],77:[2,111],83:[2,111],84:[2,111],85:[2,111],90:[2,111],92:[2,111],101:[2,111],103:[2,111],104:[2,111],105:[2,111],109:[2,111],117:[2,111],125:[2,111],127:[2,111],128:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:148,28:[1,73],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],70:[2,112],72:[2,112],73:[2,112],77:[2,112],83:[2,112],84:[2,112],85:[2,112],90:[2,112],92:[2,112],101:[2,112],103:[2,112],104:[2,112],105:[2,112],109:[2,112],117:[2,112],125:[2,112],127:[2,112],128:[2,112],131:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],70:[2,68],72:[2,68],73:[2,68],77:[2,68],79:[2,68],83:[2,68],84:[2,68],85:[2,68],90:[2,68],92:[2,68],101:[2,68],103:[2,68],104:[2,68],105:[2,68],109:[2,68],117:[2,68],125:[2,68],127:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],70:[2,71],72:[2,71],73:[2,71],77:[2,71],79:[2,71],83:[2,71],84:[2,71],85:[2,71],90:[2,71],92:[2,71],101:[2,71],103:[2,71],104:[2,71],105:[2,71],109:[2,71],117:[2,71],125:[2,71],127:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71]},{8:149,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:150,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:151,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:152,8:153,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{27:158,28:[1,73],44:159,58:160,59:161,64:154,75:[1,70],88:[1,113],89:[1,57],112:155,113:[1,156],114:157},{111:162,115:[1,163],116:[1,164]},{6:[2,90],11:168,25:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:165,77:[2,90],88:[1,113]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],70:[2,27],72:[2,27],73:[2,27],77:[2,27],83:[2,27],84:[2,27],85:[2,27],90:[2,27],92:[2,27],101:[2,27],103:[2,27],104:[2,27],105:[2,27],109:[2,27],117:[2,27],125:[2,27],127:[2,27],128:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],70:[2,28],72:[2,28],73:[2,28],77:[2,28],83:[2,28],84:[2,28],85:[2,28],90:[2,28],92:[2,28],101:[2,28],103:[2,28],104:[2,28],105:[2,28],109:[2,28],117:[2,28],125:[2,28],127:[2,28],128:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],70:[2,26],72:[2,26],73:[2,26],77:[2,26],79:[2,26],83:[2,26],84:[2,26],85:[2,26],90:[2,26],92:[2,26],101:[2,26],103:[2,26],104:[2,26],105:[2,26],109:[2,26],115:[2,26],116:[2,26],117:[2,26],125:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,6],6:[2,6],7:172,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,6],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],72:[2,24],77:[2,24],85:[2,24],90:[2,24],92:[2,24],97:[2,24],98:[2,24],101:[2,24],103:[2,24],104:[2,24],105:[2,24],109:[2,24],117:[2,24],120:[2,24],122:[2,24],125:[2,24],127:[2,24],128:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24]},{6:[1,74],26:[1,173]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],72:[2,191],77:[2,191],85:[2,191],90:[2,191],92:[2,191],101:[2,191],103:[2,191],104:[2,191],105:[2,191],109:[2,191],117:[2,191],125:[2,191],127:[2,191],128:[2,191],131:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191]},{8:174,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:175,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:176,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:177,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:178,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:179,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:180,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:181,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],72:[2,146],77:[2,146],85:[2,146],90:[2,146],92:[2,146],101:[2,146],103:[2,146],104:[2,146],105:[2,146],109:[2,146],117:[2,146],125:[2,146],127:[2,146],128:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],72:[2,151],77:[2,151],85:[2,151],90:[2,151],92:[2,151],101:[2,151],103:[2,151],104:[2,151],105:[2,151],109:[2,151],117:[2,151],125:[2,151],127:[2,151],128:[2,151],131:[2,151],132:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151]},{8:182,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],72:[2,145],77:[2,145],85:[2,145],90:[2,145],92:[2,145],101:[2,145],103:[2,145],104:[2,145],105:[2,145],109:[2,145],117:[2,145],125:[2,145],127:[2,145],128:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145],135:[2,145],136:[2,145]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],72:[2,150],77:[2,150],85:[2,150],90:[2,150],92:[2,150],101:[2,150],103:[2,150],104:[2,150],105:[2,150],109:[2,150],117:[2,150],125:[2,150],127:[2,150],128:[2,150],131:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150]},{81:183,84:[1,105]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],70:[2,69],72:[2,69],73:[2,69],77:[2,69],79:[2,69],83:[2,69],84:[2,69],85:[2,69],90:[2,69],92:[2,69],101:[2,69],103:[2,69],104:[2,69],105:[2,69],109:[2,69],117:[2,69],125:[2,69],127:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69]},{84:[2,108]},{27:184,28:[1,73]},{27:185,28:[1,73]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:186,28:[1,73],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],70:[2,83],72:[2,83],73:[2,83],77:[2,83],79:[2,83],83:[2,83],84:[2,83],85:[2,83],90:[2,83],92:[2,83],101:[2,83],103:[2,83],104:[2,83],105:[2,83],109:[2,83],117:[2,83],125:[2,83],127:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],70:[2,84],72:[2,84],73:[2,84],77:[2,84],79:[2,84],83:[2,84],84:[2,84],85:[2,84],90:[2,84],92:[2,84],101:[2,84],103:[2,84],104:[2,84],105:[2,84],109:[2,84],117:[2,84],125:[2,84],127:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84]},{8:188,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],57:[1,192],58:47,59:48,61:36,63:25,64:26,65:27,71:187,74:189,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],91:190,92:[1,191],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{69:193,70:[1,99],73:[1,100]},{81:194,84:[1,105]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],70:[2,70],72:[2,70],73:[2,70],77:[2,70],79:[2,70],83:[2,70],84:[2,70],85:[2,70],90:[2,70],92:[2,70],101:[2,70],103:[2,70],104:[2,70],105:[2,70],109:[2,70],117:[2,70],125:[2,70],127:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70]},{6:[1,196],8:195,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,197],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],70:[2,106],72:[2,106],73:[2,106],77:[2,106],83:[2,106],84:[2,106],85:[2,106],90:[2,106],92:[2,106],101:[2,106],103:[2,106],104:[2,106],105:[2,106],109:[2,106],117:[2,106],125:[2,106],127:[2,106],128:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[1,198],86:199,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],49:[1,201],53:203,54:[1,202]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{6:[2,60],25:[2,60],26:[2,60],40:[1,205],49:[2,60],54:[2,60],57:[1,204]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{6:[2,66],25:[2,66],26:[2,66],40:[2,66],49:[2,66],54:[2,66],57:[2,66]},{27:148,28:[1,73]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,50],6:[2,50],25:[2,50],26:[2,50],49:[2,50],54:[2,50],57:[2,50],72:[2,50],77:[2,50],85:[2,50],90:[2,50],92:[2,50],101:[2,50],103:[2,50],104:[2,50],105:[2,50],109:[2,50],117:[2,50],125:[2,50],127:[2,50],128:[2,50],131:[2,50],132:[2,50],133:[2,50],134:[2,50],135:[2,50],136:[2,50]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],72:[2,184],77:[2,184],85:[2,184],90:[2,184],92:[2,184],101:[2,184],102:87,103:[2,184],104:[2,184],105:[2,184],108:88,109:[2,184],110:69,117:[2,184],125:[2,184],127:[2,184],128:[2,184],131:[1,78],132:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184]},{102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],72:[2,185],77:[2,185],85:[2,185],90:[2,185],92:[2,185],101:[2,185],102:87,103:[2,185],104:[2,185],105:[2,185],108:88,109:[2,185],110:69,117:[2,185],125:[2,185],127:[2,185],128:[2,185],131:[1,78],132:[2,185],133:[2,185],134:[2,185],135:[2,185],136:[2,185]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],72:[2,186],77:[2,186],85:[2,186],90:[2,186],92:[2,186],101:[2,186],102:87,103:[2,186],104:[2,186],105:[2,186],108:88,109:[2,186],110:69,117:[2,186],125:[2,186],127:[2,186],128:[2,186],131:[1,78],132:[2,186],133:[2,186],134:[2,186],135:[2,186],136:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,187],73:[2,72],77:[2,187],83:[2,72],84:[2,72],85:[2,187],90:[2,187],92:[2,187],101:[2,187],103:[2,187],104:[2,187],105:[2,187],109:[2,187],117:[2,187],125:[2,187],127:[2,187],128:[2,187],131:[2,187],132:[2,187],133:[2,187],134:[2,187],135:[2,187],136:[2,187]},{62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:92,83:[1,94],84:[2,107]},{62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:101,83:[1,94],84:[2,107]},{66:[2,75],67:[2,75],68:[2,75],70:[2,75],73:[2,75],83:[2,75],84:[2,75]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,188],73:[2,72],77:[2,188],83:[2,72],84:[2,72],85:[2,188],90:[2,188],92:[2,188],101:[2,188],103:[2,188],104:[2,188],105:[2,188],109:[2,188],117:[2,188],125:[2,188],127:[2,188],128:[2,188],131:[2,188],132:[2,188],133:[2,188],134:[2,188],135:[2,188],136:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],72:[2,189],77:[2,189],85:[2,189],90:[2,189],92:[2,189],101:[2,189],103:[2,189],104:[2,189],105:[2,189],109:[2,189],117:[2,189],125:[2,189],127:[2,189],128:[2,189],131:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],72:[2,190],77:[2,190],85:[2,190],90:[2,190],92:[2,190],101:[2,190],103:[2,190],104:[2,190],105:[2,190],109:[2,190],117:[2,190],125:[2,190],127:[2,190],128:[2,190],131:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190]},{8:206,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,207],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:208,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:209,25:[1,5],124:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],72:[2,132],77:[2,132],85:[2,132],90:[2,132],92:[2,132],96:211,97:[1,212],98:[1,213],101:[2,132],103:[2,132],104:[2,132],105:[2,132],109:[2,132],117:[2,132],125:[2,132],127:[2,132],128:[2,132],131:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],72:[2,144],77:[2,144],85:[2,144],90:[2,144],92:[2,144],101:[2,144],103:[2,144],104:[2,144],105:[2,144],109:[2,144],117:[2,144],125:[2,144],127:[2,144],128:[2,144],131:[2,144],132:[2,144],133:[2,144],134:[2,144],135:[2,144],136:[2,144]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],72:[2,152],77:[2,152],85:[2,152],90:[2,152],92:[2,152],101:[2,152],103:[2,152],104:[2,152],105:[2,152],109:[2,152],117:[2,152],125:[2,152],127:[2,152],128:[2,152],131:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152]},{25:[1,214],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{119:215,121:216,122:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],72:[2,96],77:[2,96],85:[2,96],90:[2,96],92:[2,96],101:[2,96],103:[2,96],104:[2,96],105:[2,96],109:[2,96],117:[2,96],125:[2,96],127:[2,96],128:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96]},{8:218,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,99],5:219,6:[2,99],25:[1,5],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,99],73:[2,72],77:[2,99],79:[1,220],83:[2,72],84:[2,72],85:[2,99],90:[2,99],92:[2,99],101:[2,99],103:[2,99],104:[2,99],105:[2,99],109:[2,99],117:[2,99],125:[2,99],127:[2,99],128:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],72:[2,137],77:[2,137],85:[2,137],90:[2,137],92:[2,137],101:[2,137],102:87,103:[2,137],104:[2,137],105:[2,137],108:88,109:[2,137],110:69,117:[2,137],125:[2,137],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,46],6:[2,46],26:[2,46],101:[2,46],102:87,103:[2,46],105:[2,46],108:88,109:[2,46],110:69,125:[2,46],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,74],101:[1,221]},{4:222,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],90:[2,128],91:223,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],70:[2,114],72:[2,114],73:[2,114],77:[2,114],83:[2,114],84:[2,114],85:[2,114],90:[2,114],92:[2,114],101:[2,114],103:[2,114],104:[2,114],105:[2,114],109:[2,114],115:[2,114],116:[2,114],117:[2,114],125:[2,114],127:[2,114],128:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114]},{6:[2,53],25:[2,53],53:225,54:[1,226],90:[2,53]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],85:[2,123],90:[2,123]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:227,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],85:[2,129],90:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],70:[2,113],72:[2,113],73:[2,113],77:[2,113],79:[2,113],83:[2,113],84:[2,113],85:[2,113],90:[2,113],92:[2,113],101:[2,113],103:[2,113],104:[2,113],105:[2,113],109:[2,113],115:[2,113],116:[2,113],117:[2,113],125:[2,113],127:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113]},{5:228,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],72:[2,140],77:[2,140],85:[2,140],90:[2,140],92:[2,140],101:[2,140],102:87,103:[1,65],104:[1,229],105:[1,66],108:88,109:[1,68],110:69,117:[2,140],125:[2,140],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],72:[2,142],77:[2,142],85:[2,142],90:[2,142],92:[2,142],101:[2,142],102:87,103:[1,65],104:[1,230],105:[1,66],108:88,109:[1,68],110:69,117:[2,142],125:[2,142],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],72:[2,148],77:[2,148],85:[2,148],90:[2,148],92:[2,148],101:[2,148],103:[2,148],104:[2,148],105:[2,148],109:[2,148],117:[2,148],125:[2,148],127:[2,148],128:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],72:[2,149],77:[2,149],85:[2,149],90:[2,149],92:[2,149],101:[2,149],102:87,103:[1,65],104:[2,149],105:[1,66],108:88,109:[1,68],110:69,117:[2,149],125:[2,149],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],72:[2,153],77:[2,153],85:[2,153],90:[2,153],92:[2,153],101:[2,153],103:[2,153],104:[2,153],105:[2,153],109:[2,153],117:[2,153],125:[2,153],127:[2,153],128:[2,153],131:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153]},{115:[2,155],116:[2,155]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],112:231,114:157},{54:[1,232],115:[2,161],116:[2,161]},{54:[2,157],115:[2,157],116:[2,157]},{54:[2,158],115:[2,158],116:[2,158]},{54:[2,159],115:[2,159],116:[2,159]},{54:[2,160],115:[2,160],116:[2,160]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],72:[2,154],77:[2,154],85:[2,154],90:[2,154],92:[2,154],101:[2,154],103:[2,154],104:[2,154],105:[2,154],109:[2,154],117:[2,154],125:[2,154],127:[2,154],128:[2,154],131:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154]},{8:233,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:234,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],53:235,54:[1,236],77:[2,53]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],77:[2,91]},{6:[2,39],25:[2,39],26:[2,39],43:[1,237],54:[2,39],77:[2,39]},{6:[2,42],25:[2,42],26:[2,42],54:[2,42],77:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],77:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],77:[2,44]},{6:[2,45],25:[2,45],26:[2,45],43:[2,45],54:[2,45],77:[2,45]},{1:[2,5],6:[2,5],26:[2,5],101:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],49:[2,25],54:[2,25],57:[2,25],72:[2,25],77:[2,25],85:[2,25],90:[2,25],92:[2,25],97:[2,25],98:[2,25],101:[2,25],103:[2,25],104:[2,25],105:[2,25],109:[2,25],117:[2,25],120:[2,25],122:[2,25],125:[2,25],127:[2,25],128:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],72:[2,192],77:[2,192],85:[2,192],90:[2,192],92:[2,192],101:[2,192],102:87,103:[2,192],104:[2,192],105:[2,192],108:88,109:[2,192],110:69,117:[2,192],125:[2,192],127:[2,192],128:[2,192],131:[1,78],132:[1,81],133:[2,192],134:[2,192],135:[2,192],136:[2,192]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],72:[2,193],77:[2,193],85:[2,193],90:[2,193],92:[2,193],101:[2,193],102:87,103:[2,193],104:[2,193],105:[2,193],108:88,109:[2,193],110:69,117:[2,193],125:[2,193],127:[2,193],128:[2,193],131:[1,78],132:[1,81],133:[2,193],134:[2,193],135:[2,193],136:[2,193]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],72:[2,194],77:[2,194],85:[2,194],90:[2,194],92:[2,194],101:[2,194],102:87,103:[2,194],104:[2,194],105:[2,194],108:88,109:[2,194],110:69,117:[2,194],125:[2,194],127:[2,194],128:[2,194],131:[1,78],132:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],72:[2,195],77:[2,195],85:[2,195],90:[2,195],92:[2,195],101:[2,195],102:87,103:[2,195],104:[2,195],105:[2,195],108:88,109:[2,195],110:69,117:[2,195],125:[2,195],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[2,195],134:[2,195],135:[2,195],136:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],72:[2,196],77:[2,196],85:[2,196],90:[2,196],92:[2,196],101:[2,196],102:87,103:[2,196],104:[2,196],105:[2,196],108:88,109:[2,196],110:69,117:[2,196],125:[2,196],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,196],135:[2,196],136:[1,85]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],72:[2,197],77:[2,197],85:[2,197],90:[2,197],92:[2,197],101:[2,197],102:87,103:[2,197],104:[2,197],105:[2,197],108:88,109:[2,197],110:69,117:[2,197],125:[2,197],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[2,197],136:[1,85]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],72:[2,198],77:[2,198],85:[2,198],90:[2,198],92:[2,198],101:[2,198],102:87,103:[2,198],104:[2,198],105:[2,198],108:88,109:[2,198],110:69,117:[2,198],125:[2,198],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,198],135:[2,198],136:[2,198]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],72:[2,183],77:[2,183],85:[2,183],90:[2,183],92:[2,183],101:[2,183],102:87,103:[1,65],104:[2,183],105:[1,66],108:88,109:[1,68],110:69,117:[2,183],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],72:[2,182],77:[2,182],85:[2,182],90:[2,182],92:[2,182],101:[2,182],102:87,103:[1,65],104:[2,182],105:[1,66],108:88,109:[1,68],110:69,117:[2,182],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],70:[2,103],72:[2,103],73:[2,103],77:[2,103],83:[2,103],84:[2,103],85:[2,103],90:[2,103],92:[2,103],101:[2,103],103:[2,103],104:[2,103],105:[2,103],109:[2,103],117:[2,103],125:[2,103],127:[2,103],128:[2,103],131:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],70:[2,80],72:[2,80],73:[2,80],77:[2,80],79:[2,80],83:[2,80],84:[2,80],85:[2,80],90:[2,80],92:[2,80],101:[2,80],103:[2,80],104:[2,80],105:[2,80],109:[2,80],117:[2,80],125:[2,80],127:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],70:[2,81],72:[2,81],73:[2,81],77:[2,81],79:[2,81],83:[2,81],84:[2,81],85:[2,81],90:[2,81],92:[2,81],101:[2,81],103:[2,81],104:[2,81],105:[2,81],109:[2,81],117:[2,81],125:[2,81],127:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],70:[2,82],72:[2,82],73:[2,82],77:[2,82],79:[2,82],83:[2,82],84:[2,82],85:[2,82],90:[2,82],92:[2,82],101:[2,82],103:[2,82],104:[2,82],105:[2,82],109:[2,82],117:[2,82],125:[2,82],127:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82]},{72:[1,238]},{57:[1,192],72:[2,87],91:239,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{72:[2,88]},{8:240,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,122],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{12:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],72:[2,116],75:[2,116],78:[2,116],82:[2,116],87:[2,116],88:[2,116],89:[2,116],95:[2,116],99:[2,116],100:[2,116],103:[2,116],105:[2,116],107:[2,116],109:[2,116],118:[2,116],124:[2,116],126:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116]},{12:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],72:[2,117],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],70:[2,86],72:[2,86],73:[2,86],77:[2,86],79:[2,86],83:[2,86],84:[2,86],85:[2,86],90:[2,86],92:[2,86],101:[2,86],103:[2,86],104:[2,86],105:[2,86],109:[2,86],117:[2,86],125:[2,86],127:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],70:[2,104],72:[2,104],73:[2,104],77:[2,104],83:[2,104],84:[2,104],85:[2,104],90:[2,104],92:[2,104],101:[2,104],103:[2,104],104:[2,104],105:[2,104],109:[2,104],117:[2,104],125:[2,104],127:[2,104],128:[2,104],131:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],72:[2,36],77:[2,36],85:[2,36],90:[2,36],92:[2,36],101:[2,36],102:87,103:[2,36],104:[2,36],105:[2,36],108:88,109:[2,36],110:69,117:[2,36],125:[2,36],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:241,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:242,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],70:[2,109],72:[2,109],73:[2,109],77:[2,109],83:[2,109],84:[2,109],85:[2,109],90:[2,109],92:[2,109],101:[2,109],103:[2,109],104:[2,109],105:[2,109],109:[2,109],117:[2,109],125:[2,109],127:[2,109],128:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109]},{6:[2,53],25:[2,53],53:243,54:[1,226],85:[2,53]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],85:[2,128],90:[2,128],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{50:245,51:[1,60],52:[1,61]},{6:[2,54],25:[2,54],26:[2,54],27:109,28:[1,73],44:110,55:246,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[1,247],25:[1,248]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61]},{8:249,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],72:[2,199],77:[2,199],85:[2,199],90:[2,199],92:[2,199],101:[2,199],102:87,103:[2,199],104:[2,199],105:[2,199],108:88,109:[2,199],110:69,117:[2,199],125:[2,199],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:250,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],72:[2,201],77:[2,201],85:[2,201],90:[2,201],92:[2,201],101:[2,201],102:87,103:[2,201],104:[2,201],105:[2,201],108:88,109:[2,201],110:69,117:[2,201],125:[2,201],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],72:[2,181],77:[2,181],85:[2,181],90:[2,181],92:[2,181],101:[2,181],103:[2,181],104:[2,181],105:[2,181],109:[2,181],117:[2,181],125:[2,181],127:[2,181],128:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181]},{8:251,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],72:[2,133],77:[2,133],85:[2,133],90:[2,133],92:[2,133],97:[1,252],101:[2,133],103:[2,133],104:[2,133],105:[2,133],109:[2,133],117:[2,133],125:[2,133],127:[2,133],128:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133]},{5:253,25:[1,5]},{27:254,28:[1,73]},{119:255,121:216,122:[1,217]},{26:[1,256],120:[1,257],121:258,122:[1,217]},{26:[2,174],120:[2,174],122:[2,174]},{8:260,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],94:259,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,97],5:261,6:[2,97],25:[1,5],26:[2,97],49:[2,97],54:[2,97],57:[2,97],72:[2,97],77:[2,97],85:[2,97],90:[2,97],92:[2,97],101:[2,97],102:87,103:[1,65],104:[2,97],105:[1,66],108:88,109:[1,68],110:69,117:[2,97],125:[2,97],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],72:[2,100],77:[2,100],85:[2,100],90:[2,100],92:[2,100],101:[2,100],103:[2,100],104:[2,100],105:[2,100],109:[2,100],117:[2,100],125:[2,100],127:[2,100],128:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100]},{8:262,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],66:[2,138],67:[2,138],68:[2,138],70:[2,138],72:[2,138],73:[2,138],77:[2,138],83:[2,138],84:[2,138],85:[2,138],90:[2,138],92:[2,138],101:[2,138],103:[2,138],104:[2,138],105:[2,138],109:[2,138],117:[2,138],125:[2,138],127:[2,138],128:[2,138],131:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138]},{6:[1,74],26:[1,263]},{8:264,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,67],12:[2,117],25:[2,67],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,67],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],90:[2,67],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{6:[1,266],25:[1,267],90:[1,265]},{6:[2,54],8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,54],26:[2,54],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[2,54],87:[1,58],88:[1,59],89:[1,57],90:[2,54],93:268,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],26:[2,53],53:269,54:[1,226]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],49:[2,178],54:[2,178],57:[2,178],72:[2,178],77:[2,178],85:[2,178],90:[2,178],92:[2,178],101:[2,178],103:[2,178],104:[2,178],105:[2,178],109:[2,178],117:[2,178],120:[2,178],125:[2,178],127:[2,178],128:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178],135:[2,178],136:[2,178]},{8:270,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:271,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{115:[2,156],116:[2,156]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],114:272},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],49:[2,163],54:[2,163],57:[2,163],72:[2,163],77:[2,163],85:[2,163],90:[2,163],92:[2,163],101:[2,163],102:87,103:[2,163],104:[1,273],105:[2,163],108:88,109:[2,163],110:69,117:[1,274],125:[2,163],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],49:[2,164],54:[2,164],57:[2,164],72:[2,164],77:[2,164],85:[2,164],90:[2,164],92:[2,164],101:[2,164],102:87,103:[2,164],104:[1,275],105:[2,164],108:88,109:[2,164],110:69,117:[2,164],125:[2,164],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,277],25:[1,278],77:[1,276]},{6:[2,54],11:168,25:[2,54],26:[2,54],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:279,42:167,44:171,46:[1,46],77:[2,54],88:[1,113]},{8:280,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,281],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],70:[2,85],72:[2,85],73:[2,85],77:[2,85],79:[2,85],83:[2,85],84:[2,85],85:[2,85],90:[2,85],92:[2,85],101:[2,85],103:[2,85],104:[2,85],105:[2,85],109:[2,85],117:[2,85],125:[2,85],127:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85]},{8:282,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,120],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,121],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],72:[2,37],77:[2,37],85:[2,37],90:[2,37],92:[2,37],101:[2,37],102:87,103:[2,37],104:[2,37],105:[2,37],108:88,109:[2,37],110:69,117:[2,37],125:[2,37],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,283],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],85:[1,284]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],85:[2,67],90:[2,67]},{5:285,25:[1,5]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{27:109,28:[1,73],44:110,55:286,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,55],25:[2,55],26:[2,55],27:109,28:[1,73],44:110,48:287,54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,288],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:289,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:290,25:[1,5]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],72:[2,134],77:[2,134],85:[2,134],90:[2,134],92:[2,134],101:[2,134],103:[2,134],104:[2,134],105:[2,134],109:[2,134],117:[2,134],125:[2,134],127:[2,134],128:[2,134],131:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134]},{5:291,25:[1,5]},{26:[1,292],120:[1,293],121:258,122:[1,217]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],72:[2,172],77:[2,172],85:[2,172],90:[2,172],92:[2,172],101:[2,172],103:[2,172],104:[2,172],105:[2,172],109:[2,172],117:[2,172],125:[2,172],127:[2,172],128:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172]},{5:294,25:[1,5]},{26:[2,175],120:[2,175],122:[2,175]},{5:295,25:[1,5],54:[1,296]},{25:[2,130],54:[2,130],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],72:[2,98],77:[2,98],85:[2,98],90:[2,98],92:[2,98],101:[2,98],103:[2,98],104:[2,98],105:[2,98],109:[2,98],117:[2,98],125:[2,98],127:[2,98],128:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98]},{1:[2,101],5:297,6:[2,101],25:[1,5],26:[2,101],49:[2,101],54:[2,101],57:[2,101],72:[2,101],77:[2,101],85:[2,101],90:[2,101],92:[2,101],101:[2,101],102:87,103:[1,65],104:[2,101],105:[1,66],108:88,109:[1,68],110:69,117:[2,101],125:[2,101],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{101:[1,298]},{90:[1,299],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],70:[2,115],72:[2,115],73:[2,115],77:[2,115],83:[2,115],84:[2,115],85:[2,115],90:[2,115],92:[2,115],101:[2,115],103:[2,115],104:[2,115],105:[2,115],109:[2,115],115:[2,115],116:[2,115],117:[2,115],125:[2,115],127:[2,115],128:[2,115],131:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],93:300,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:301,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],85:[2,124],90:[2,124]},{6:[1,266],25:[1,267],26:[1,302]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],72:[2,141],77:[2,141],85:[2,141],90:[2,141],92:[2,141],101:[2,141],102:87,103:[1,65],104:[2,141],105:[1,66],108:88,109:[1,68],110:69,117:[2,141],125:[2,141],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],72:[2,143],77:[2,143],85:[2,143],90:[2,143],92:[2,143],101:[2,143],102:87,103:[1,65],104:[2,143],105:[1,66],108:88,109:[1,68],110:69,117:[2,143],125:[2,143],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{115:[2,162],116:[2,162]},{8:303,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:304,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:305,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],70:[2,89],72:[2,89],73:[2,89],77:[2,89],83:[2,89],84:[2,89],85:[2,89],90:[2,89],92:[2,89],101:[2,89],103:[2,89],104:[2,89],105:[2,89],109:[2,89],115:[2,89],116:[2,89],117:[2,89],125:[2,89],127:[2,89],128:[2,89],131:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89]},{11:168,27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:306,42:167,44:171,46:[1,46],88:[1,113]},{6:[2,90],11:168,25:[2,90],26:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:307,88:[1,113]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],77:[2,92]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],77:[2,40],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:308,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,119],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,38],6:[2,38],25:[2,38],26:[2,38],49:[2,38],54:[2,38],57:[2,38],72:[2,38],77:[2,38],85:[2,38],90:[2,38],92:[2,38],101:[2,38],103:[2,38],104:[2,38],105:[2,38],109:[2,38],117:[2,38],125:[2,38],127:[2,38],128:[2,38],131:[2,38],132:[2,38],133:[2,38],134:[2,38],135:[2,38],136:[2,38]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],70:[2,110],72:[2,110],73:[2,110],77:[2,110],83:[2,110],84:[2,110],85:[2,110],90:[2,110],92:[2,110],101:[2,110],103:[2,110],104:[2,110],105:[2,110],109:[2,110],117:[2,110],125:[2,110],127:[2,110],128:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],72:[2,49],77:[2,49],85:[2,49],90:[2,49],92:[2,49],101:[2,49],103:[2,49],104:[2,49],105:[2,49],109:[2,49],117:[2,49],125:[2,49],127:[2,49],128:[2,49],131:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{6:[2,53],25:[2,53],26:[2,53],53:309,54:[1,202]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],72:[2,200],77:[2,200],85:[2,200],90:[2,200],92:[2,200],101:[2,200],103:[2,200],104:[2,200],105:[2,200],109:[2,200],117:[2,200],125:[2,200],127:[2,200],128:[2,200],131:[2,200],132:[2,200],133:[2,200],134:[2,200],135:[2,200],136:[2,200]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],49:[2,179],54:[2,179],57:[2,179],72:[2,179],77:[2,179],85:[2,179],90:[2,179],92:[2,179],101:[2,179],103:[2,179],104:[2,179],105:[2,179],109:[2,179],117:[2,179],120:[2,179],125:[2,179],127:[2,179],128:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179],135:[2,179],136:[2,179]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],72:[2,135],77:[2,135],85:[2,135],90:[2,135],92:[2,135],101:[2,135],103:[2,135],104:[2,135],105:[2,135],109:[2,135],117:[2,135],125:[2,135],127:[2,135],128:[2,135],131:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],72:[2,136],77:[2,136],85:[2,136],90:[2,136],92:[2,136],97:[2,136],101:[2,136],103:[2,136],104:[2,136],105:[2,136],109:[2,136],117:[2,136],125:[2,136],127:[2,136],128:[2,136],131:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],72:[2,170],77:[2,170],85:[2,170],90:[2,170],92:[2,170],101:[2,170],103:[2,170],104:[2,170],105:[2,170],109:[2,170],117:[2,170],125:[2,170],127:[2,170],128:[2,170],131:[2,170],132:[2,170],133:[2,170],134:[2,170],135:[2,170],136:[2,170]},{5:310,25:[1,5]},{26:[1,311]},{6:[1,312],26:[2,176],120:[2,176],122:[2,176]},{8:313,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],72:[2,102],77:[2,102],85:[2,102],90:[2,102],92:[2,102],101:[2,102],103:[2,102],104:[2,102],105:[2,102],109:[2,102],117:[2,102],125:[2,102],127:[2,102],128:[2,102],131:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],66:[2,139],67:[2,139],68:[2,139],70:[2,139],72:[2,139],73:[2,139],77:[2,139],83:[2,139],84:[2,139],85:[2,139],90:[2,139],92:[2,139],101:[2,139],103:[2,139],104:[2,139],105:[2,139],109:[2,139],117:[2,139],125:[2,139],127:[2,139],128:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],70:[2,118],72:[2,118],73:[2,118],77:[2,118],83:[2,118],84:[2,118],85:[2,118],90:[2,118],92:[2,118],101:[2,118],103:[2,118],104:[2,118],105:[2,118],109:[2,118],117:[2,118],125:[2,118],127:[2,118],128:[2,118],131:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],85:[2,125],90:[2,125]},{6:[2,53],25:[2,53],26:[2,53],53:314,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],85:[2,126],90:[2,126]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],72:[2,165],77:[2,165],85:[2,165],90:[2,165],92:[2,165],101:[2,165],102:87,103:[2,165],104:[2,165],105:[2,165],108:88,109:[2,165],110:69,117:[1,315],125:[2,165],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],72:[2,167],77:[2,167],85:[2,167],90:[2,167],92:[2,167],101:[2,167],102:87,103:[2,167],104:[1,316],105:[2,167],108:88,109:[2,167],110:69,117:[2,167],125:[2,167],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],72:[2,166],77:[2,166],85:[2,166],90:[2,166],92:[2,166],101:[2,166],102:87,103:[2,166],104:[2,166],105:[2,166],108:88,109:[2,166],110:69,117:[2,166],125:[2,166],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],77:[2,93]},{6:[2,53],25:[2,53],26:[2,53],53:317,54:[1,236]},{26:[1,318],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,247],25:[1,248],26:[1,319]},{26:[1,320]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],72:[2,173],77:[2,173],85:[2,173],90:[2,173],92:[2,173],101:[2,173],103:[2,173],104:[2,173],105:[2,173],109:[2,173],117:[2,173],125:[2,173],127:[2,173],128:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173]},{26:[2,177],120:[2,177],122:[2,177]},{25:[2,131],54:[2,131],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],26:[1,321]},{8:322,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:323,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[1,277],25:[1,278],26:[1,324]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],77:[2,41]},{6:[2,59],25:[2,59],26:[2,59],49:[2,59],54:[2,59]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],72:[2,171],77:[2,171],85:[2,171],90:[2,171],92:[2,171],101:[2,171],103:[2,171],104:[2,171],105:[2,171],109:[2,171],117:[2,171],125:[2,171],127:[2,171],128:[2,171],131:[2,171],132:[2,171],133:[2,171],134:[2,171],135:[2,171],136:[2,171]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],85:[2,127],90:[2,127]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],72:[2,168],77:[2,168],85:[2,168],90:[2,168],92:[2,168],101:[2,168],102:87,103:[2,168],104:[2,168],105:[2,168],108:88,109:[2,168],110:69,117:[2,168],125:[2,168],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],72:[2,169],77:[2,169],85:[2,169],90:[2,169],92:[2,169],101:[2,169],102:87,103:[2,169],104:[2,169],105:[2,169],108:88,109:[2,169],110:69,117:[2,169],125:[2,169],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],77:[2,94]}], -defaultActions: {60:[2,51],61:[2,52],75:[2,3],94:[2,108],189:[2,88]}, -parseError: function parseError(str, hash) { - throw new Error(str); -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - if (typeof this.lexer.yylloc == 'undefined') - this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - if (typeof this.yy.parseError === 'function') - this.parseError = this.yy.parseError; - - function popStack (n) { - stack.length = stack.length - 2*n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || 1; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - } - - var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; - while (true) { - // retreive state number from top of stack - state = stack[stack.length-1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol == null) - symbol = lex(); - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - _handle_error: - if (typeof action === 'undefined' || !action.length || !action[0]) { - - if (!recovering) { - // Report error - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'"+this.terminals_[p]+"'"); - } - var errStr = ''; - if (this.lexer.showPosition) { - errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; - } else { - errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + - (symbol == 1 /*EOF*/ ? "end of input" : - ("'"+(this.terminals_[symbol] || symbol)+"'")); - } - this.parseError(errStr, - {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol == EOF) { - throw new Error(errStr || 'Parsing halted.'); - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - while (1) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - break; - } - if (state == 0) { - throw new Error(errStr || 'Parsing halted.'); - } - popStack(1); - state = stack[stack.length-1]; - } - - preErrorSymbol = symbol; // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); - } - - switch (action[0]) { - - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution/no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - - case 2: // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length-(len||1)].first_line, - last_line: lstack[lstack.length-1].last_line, - first_column: lstack[lstack.length-(len||1)].first_column, - last_column: lstack[lstack.length-1].last_column - }; - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - - if (typeof r !== 'undefined') { - return r; - } - - // pop off stack - if (len) { - stack = stack.slice(0,-1*len*2); - vstack = vstack.slice(0, -1*len); - lstack = lstack.slice(0, -1*len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length-2]][stack[stack.length-1]]; - stack.push(newState); - break; - - case 3: // accept - return true; - } - - } - - return true; -}}; -undefined -return parser; -})(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); } -exports.main = function commonjsMain(args) { - if (!args[1]) - throw new Error('Usage: '+args[0]+' FILE'); - if (typeof process !== 'undefined') { - var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); - } else { - var cwd = require("file").path(require("file").cwd()); - var source = cwd.join(args[1]).read({charset: "utf-8"}); - } - return exports.parser.parse(source); -} -if (typeof module !== 'undefined' && require.main === module) { - exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); -} -} \ No newline at end of file diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js deleted file mode 100644 index 578dc59..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/repl.js +++ /dev/null @@ -1,276 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - stdin = process.openStdin(); - - stdout = process.stdout; - - CoffeeScript = require('./coffee-script'); - - readline = require('readline'); - - inspect = require('util').inspect; - - Script = require('vm').Script; - - Module = require('module'); - - REPL_PROMPT = 'coffee> '; - - REPL_PROMPT_MULTILINE = '------> '; - - REPL_PROMPT_CONTINUATION = '......> '; - - enableColours = false; - - if (process.platform !== 'win32') { - enableColours = !process.env.NODE_DISABLE_COLORS; - } - - error = function(err) { - return stdout.write((err.stack || err.toString()) + '\n'); - }; - - ACCESSOR = /\s*([\w\.]+)(?:\.(\w*))$/; - - SIMPLEVAR = /(\w+)$/i; - - autocomplete = function(text) { - return completeAttribute(text) || completeVariable(text) || [[], text]; - }; - - completeAttribute = function(text) { - var all, candidates, completions, key, match, obj, prefix, _i, _len, _ref; - if (match = text.match(ACCESSOR)) { - all = match[0], obj = match[1], prefix = match[2]; - try { - obj = Script.runInThisContext(obj); - } catch (e) { - return; - } - if (obj == null) { - return; - } - obj = Object(obj); - candidates = Object.getOwnPropertyNames(obj); - while (obj = Object.getPrototypeOf(obj)) { - _ref = Object.getOwnPropertyNames(obj); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - key = _ref[_i]; - if (__indexOf.call(candidates, key) < 0) { - candidates.push(key); - } - } - } - completions = getCompletions(prefix, candidates); - return [completions, prefix]; - } - }; - - completeVariable = function(text) { - var candidates, completions, free, key, keywords, r, vars, _i, _len, _ref; - free = (_ref = text.match(SIMPLEVAR)) != null ? _ref[1] : void 0; - if (text === "") { - free = ""; - } - if (free != null) { - vars = Script.runInThisContext('Object.getOwnPropertyNames(Object(this))'); - keywords = (function() { - var _i, _len, _ref1, _results; - _ref1 = CoffeeScript.RESERVED; - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - r = _ref1[_i]; - if (r.slice(0, 2) !== '__') { - _results.push(r); - } - } - return _results; - })(); - candidates = vars; - for (_i = 0, _len = keywords.length; _i < _len; _i++) { - key = keywords[_i]; - if (__indexOf.call(candidates, key) < 0) { - candidates.push(key); - } - } - completions = getCompletions(free, candidates); - return [completions, free]; - } - }; - - getCompletions = function(prefix, candidates) { - var el, _i, _len, _results; - _results = []; - for (_i = 0, _len = candidates.length; _i < _len; _i++) { - el = candidates[_i]; - if (0 === el.indexOf(prefix)) { - _results.push(el); - } - } - return _results; - }; - - process.on('uncaughtException', error); - - backlog = ''; - - run = function(buffer) { - var code, returnValue, _; - buffer = buffer.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, "$1$2$3"); - buffer = buffer.replace(/[\r\n]+$/, ""); - if (multilineMode) { - backlog += "" + buffer + "\n"; - repl.setPrompt(REPL_PROMPT_CONTINUATION); - repl.prompt(); - return; - } - if (!buffer.toString().trim() && !backlog) { - repl.prompt(); - return; - } - code = backlog += buffer; - if (code[code.length - 1] === '\\') { - backlog = "" + backlog.slice(0, -1) + "\n"; - repl.setPrompt(REPL_PROMPT_CONTINUATION); - repl.prompt(); - return; - } - repl.setPrompt(REPL_PROMPT); - backlog = ''; - try { - _ = global._; - returnValue = CoffeeScript["eval"]("_=(" + code + "\n)", { - filename: 'repl', - modulename: 'repl' - }); - if (returnValue === void 0) { - global._ = _; - } - repl.output.write("" + (inspect(returnValue, false, 2, enableColours)) + "\n"); - } catch (err) { - error(err); - } - return repl.prompt(); - }; - - if (stdin.readable && stdin.isRaw) { - pipedInput = ''; - repl = { - prompt: function() { - return stdout.write(this._prompt); - }, - setPrompt: function(p) { - return this._prompt = p; - }, - input: stdin, - output: stdout, - on: function() {} - }; - stdin.on('data', function(chunk) { - var line, lines, _i, _len, _ref; - pipedInput += chunk; - if (!/\n/.test(pipedInput)) { - return; - } - lines = pipedInput.split("\n"); - pipedInput = lines[lines.length - 1]; - _ref = lines.slice(0, -1); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - line = _ref[_i]; - if (!(line)) { - continue; - } - stdout.write("" + line + "\n"); - run(line); - } - }); - stdin.on('end', function() { - var line, _i, _len, _ref; - _ref = pipedInput.trim().split("\n"); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - line = _ref[_i]; - if (!(line)) { - continue; - } - stdout.write("" + line + "\n"); - run(line); - } - stdout.write('\n'); - return process.exit(0); - }); - } else { - if (readline.createInterface.length < 3) { - repl = readline.createInterface(stdin, autocomplete); - stdin.on('data', function(buffer) { - return repl.write(buffer); - }); - } else { - repl = readline.createInterface(stdin, stdout, autocomplete); - } - } - - multilineMode = false; - - repl.input.on('keypress', function(char, key) { - var cursorPos, newPrompt; - if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { - return; - } - cursorPos = repl.cursor; - repl.output.cursorTo(0); - repl.output.clearLine(1); - multilineMode = !multilineMode; - if (!multilineMode && backlog) { - repl._line(); - } - backlog = ''; - repl.setPrompt((newPrompt = multilineMode ? REPL_PROMPT_MULTILINE : REPL_PROMPT)); - repl.prompt(); - return repl.output.cursorTo(newPrompt.length + (repl.cursor = cursorPos)); - }); - - repl.input.on('keypress', function(char, key) { - if (!(multilineMode && repl.line)) { - return; - } - if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'd')) { - return; - } - multilineMode = false; - return repl._line(); - }); - - repl.on('attemptClose', function() { - if (multilineMode) { - multilineMode = false; - repl.output.cursorTo(0); - repl.output.clearLine(1); - repl._onLine(repl.line); - return; - } - if (backlog || repl.line) { - backlog = ''; - repl.historyIndex = -1; - repl.setPrompt(REPL_PROMPT); - repl.output.write('\n(^C again to quit)'); - return repl._line((repl.line = '')); - } else { - return repl.close(); - } - }); - - repl.on('close', function() { - repl.output.write('\n'); - return repl.input.destroy(); - }); - - repl.on('line', run); - - repl.setPrompt(REPL_PROMPT); - - repl.prompt(); - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js deleted file mode 100644 index fdfeffc..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/rewriter.js +++ /dev/null @@ -1,349 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = [].slice; - - exports.Rewriter = (function() { - - function Rewriter() {} - - Rewriter.prototype.rewrite = function(tokens) { - this.tokens = tokens; - this.removeLeadingNewlines(); - this.removeMidExpressionNewlines(); - this.closeOpenCalls(); - this.closeOpenIndexes(); - this.addImplicitIndentation(); - this.tagPostfixConditionals(); - this.addImplicitBraces(); - this.addImplicitParentheses(); - return this.tokens; - }; - - Rewriter.prototype.scanTokens = function(block) { - var i, token, tokens; - tokens = this.tokens; - i = 0; - while (token = tokens[i]) { - i += block.call(this, token, i, tokens); - } - return true; - }; - - Rewriter.prototype.detectEnd = function(i, condition, action) { - var levels, token, tokens, _ref, _ref1; - tokens = this.tokens; - levels = 0; - while (token = tokens[i]) { - if (levels === 0 && condition.call(this, token, i)) { - return action.call(this, token, i); - } - if (!token || levels < 0) { - return action.call(this, token, i - 1); - } - if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { - levels += 1; - } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { - levels -= 1; - } - i += 1; - } - return i - 1; - }; - - Rewriter.prototype.removeLeadingNewlines = function() { - var i, tag, _i, _len, _ref; - _ref = this.tokens; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - tag = _ref[i][0]; - if (tag !== 'TERMINATOR') { - break; - } - } - if (i) { - return this.tokens.splice(0, i); - } - }; - - Rewriter.prototype.removeMidExpressionNewlines = function() { - return this.scanTokens(function(token, i, tokens) { - var _ref; - if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { - return 1; - } - tokens.splice(i, 1); - return 0; - }); - }; - - Rewriter.prototype.closeOpenCalls = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; - }; - action = function(token, i) { - return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'CALL_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - - Rewriter.prototype.closeOpenIndexes = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; - }; - action = function(token, i) { - return token[0] = 'INDEX_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'INDEX_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - - Rewriter.prototype.addImplicitBraces = function() { - var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine; - stack = []; - start = null; - startsLine = null; - sameLine = true; - startIndent = 0; - startIndex = 0; - condition = function(token, i) { - var one, tag, three, two, _ref, _ref1; - _ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; - if ('HERECOMMENT' === (one != null ? one[0] : void 0)) { - return false; - } - tag = token[0]; - if (__indexOf.call(LINEBREAKS, tag) >= 0) { - sameLine = false; - } - return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT')); - }; - action = function(token, i) { - var tok; - tok = this.generate('}', '}', token[2]); - return this.tokens.splice(i, 0, tok); - }; - return this.scanTokens(function(token, i, tokens) { - var ago, idx, prevTag, tag, tok, value, _ref, _ref1; - if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { - stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); - return 1; - } - if (__indexOf.call(EXPRESSION_END, tag) >= 0) { - start = stack.pop(); - return 1; - } - if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref1 = stack[stack.length - 1]) != null ? _ref1[0] : void 0) !== '{'))) { - return 1; - } - sameLine = true; - startIndex = i + 1; - stack.push(['{']); - idx = ago === '@' ? i - 2 : i - 1; - while (this.tag(idx - 2) === 'HERECOMMENT') { - idx -= 2; - } - prevTag = this.tag(idx - 1); - startsLine = !prevTag || (__indexOf.call(LINEBREAKS, prevTag) >= 0); - value = new String('{'); - value.generated = true; - tok = this.generate('{', value, token[2]); - tokens.splice(idx, 0, tok); - this.detectEnd(i + 2, condition, action); - return 2; - }); - }; - - Rewriter.prototype.addImplicitParentheses = function() { - var action, condition, noCall, seenControl, seenSingle; - noCall = seenSingle = seenControl = false; - condition = function(token, i) { - var post, tag, _ref, _ref1; - tag = token[0]; - if (!seenSingle && token.fromThen) { - return true; - } - if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') { - seenSingle = true; - } - if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') { - seenControl = true; - } - if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { - return true; - } - return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); - }; - action = function(token, i) { - return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2])); - }; - return this.scanTokens(function(token, i, tokens) { - var callObject, current, next, prev, tag, _ref, _ref1, _ref2; - tag = token[0]; - if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') { - noCall = true; - } - _ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; - callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0); - seenSingle = false; - seenControl = false; - if (__indexOf.call(LINEBREAKS, tag) >= 0) { - noCall = false; - } - if (prev && !prev.spaced && tag === '?') { - token.call = true; - } - if (token.fromThen) { - return 1; - } - if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { - return 1; - } - tokens.splice(i, 0, this.generate('CALL_START', '(', token[2])); - this.detectEnd(i + 1, condition, action); - if (prev[0] === '?') { - prev[0] = 'FUNC_EXIST'; - } - return 2; - }); - }; - - Rewriter.prototype.addImplicitIndentation = function() { - var action, condition, indent, outdent, starter; - starter = indent = outdent = null; - condition = function(token, i) { - var _ref; - return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); - }; - action = function(token, i) { - return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); - }; - return this.scanTokens(function(token, i, tokens) { - var tag, _ref, _ref1; - tag = token[0]; - if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { - tokens.splice(i, 1); - return 0; - } - if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { - tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token)))); - return 2; - } - if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { - tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token)))); - return 4; - } - if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { - starter = tag; - _ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1]; - if (starter === 'THEN') { - indent.fromThen = true; - } - tokens.splice(i + 1, 0, indent); - this.detectEnd(i + 2, condition, action); - if (tag === 'THEN') { - tokens.splice(i, 1); - } - return 1; - } - return 1; - }); - }; - - Rewriter.prototype.tagPostfixConditionals = function() { - var action, condition, original; - original = null; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT'; - }; - action = function(token, i) { - if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { - return original[0] = 'POST_' + original[0]; - } - }; - return this.scanTokens(function(token, i) { - if (token[0] !== 'IF') { - return 1; - } - original = token; - this.detectEnd(i + 1, condition, action); - return 1; - }); - }; - - Rewriter.prototype.indentation = function(token, implicit) { - var indent, outdent; - if (implicit == null) { - implicit = false; - } - indent = ['INDENT', 2, token[2]]; - outdent = ['OUTDENT', 2, token[2]]; - if (implicit) { - indent.generated = outdent.generated = true; - } - return [indent, outdent]; - }; - - Rewriter.prototype.generate = function(tag, value, line) { - var tok; - tok = [tag, value, line]; - tok.generated = true; - return tok; - }; - - Rewriter.prototype.tag = function(i) { - var _ref; - return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; - }; - - return Rewriter; - - })(); - - BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; - - exports.INVERSES = INVERSES = {}; - - EXPRESSION_START = []; - - EXPRESSION_END = []; - - for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { - _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; - EXPRESSION_START.push(INVERSES[rite] = left); - EXPRESSION_END.push(INVERSES[left] = rite); - } - - EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); - - IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; - - IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++']; - - IMPLICIT_UNSPACED_CALL = ['+', '-']; - - IMPLICIT_BLOCK = ['->', '=>', '{', '[', ',']; - - IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; - - SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; - - SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; - - LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js b/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js deleted file mode 100644 index 3f35dbf..0000000 --- a/node_modules/jade/node_modules/coffee-script/lib/coffee-script/scope.js +++ /dev/null @@ -1,146 +0,0 @@ -// Generated by CoffeeScript 1.4.0 -(function() { - var Scope, extend, last, _ref; - - _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; - - exports.Scope = Scope = (function() { - - Scope.root = null; - - function Scope(parent, expressions, method) { - this.parent = parent; - this.expressions = expressions; - this.method = method; - this.variables = [ - { - name: 'arguments', - type: 'arguments' - } - ]; - this.positions = {}; - if (!this.parent) { - Scope.root = this; - } - } - - Scope.prototype.add = function(name, type, immediate) { - if (this.shared && !immediate) { - return this.parent.add(name, type, immediate); - } - if (Object.prototype.hasOwnProperty.call(this.positions, name)) { - return this.variables[this.positions[name]].type = type; - } else { - return this.positions[name] = this.variables.push({ - name: name, - type: type - }) - 1; - } - }; - - Scope.prototype.namedMethod = function() { - if (this.method.name || !this.parent) { - return this.method; - } - return this.parent.namedMethod(); - }; - - Scope.prototype.find = function(name) { - if (this.check(name)) { - return true; - } - this.add(name, 'var'); - return false; - }; - - Scope.prototype.parameter = function(name) { - if (this.shared && this.parent.check(name, true)) { - return; - } - return this.add(name, 'param'); - }; - - Scope.prototype.check = function(name) { - var _ref1; - return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); - }; - - Scope.prototype.temporary = function(name, index) { - if (name.length > 1) { - return '_' + name + (index > 1 ? index - 1 : ''); - } else { - return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); - } - }; - - Scope.prototype.type = function(name) { - var v, _i, _len, _ref1; - _ref1 = this.variables; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if (v.name === name) { - return v.type; - } - } - return null; - }; - - Scope.prototype.freeVariable = function(name, reserve) { - var index, temp; - if (reserve == null) { - reserve = true; - } - index = 0; - while (this.check((temp = this.temporary(name, index)))) { - index++; - } - if (reserve) { - this.add(temp, 'var', true); - } - return temp; - }; - - Scope.prototype.assign = function(name, value) { - this.add(name, { - value: value, - assigned: true - }, true); - return this.hasAssignments = true; - }; - - Scope.prototype.hasDeclarations = function() { - return !!this.declaredVariables().length; - }; - - Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref1; - realVars = []; - tempVars = []; - _ref1 = this.variables; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if (v.type === 'var') { - (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); - } - } - return realVars.sort().concat(tempVars.sort()); - }; - - Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref1, _results; - _ref1 = this.variables; - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if (v.type.assigned) { - _results.push("" + v.name + " = " + v.type.value); - } - } - return _results; - }; - - return Scope; - - })(); - -}).call(this); diff --git a/node_modules/jade/node_modules/coffee-script/package.json b/node_modules/jade/node_modules/coffee-script/package.json deleted file mode 100644 index 849e1f6..0000000 --- a/node_modules/jade/node_modules/coffee-script/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "coffee-script", - "description": "Unfancy JavaScript", - "keywords": ["javascript", "language", "coffeescript", "compiler"], - "author": "Jeremy Ashkenas", - "version": "1.4.0", - "licenses": [{ - "type": "MIT", - "url": "https://raw.github.com/jashkenas/coffee-script/master/LICENSE" - }], - "engines": { - "node": ">=0.4.0" - }, - "directories" : { - "lib" : "./lib/coffee-script" - }, - "main" : "./lib/coffee-script/coffee-script", - "bin": { - "coffee": "./bin/coffee", - "cake": "./bin/cake" - }, - "scripts": { - "test": "node ./bin/cake test" - }, - "homepage": "http://coffeescript.org/", - "bugs": "https://github.com/jashkenas/coffee-script/issues", - "repository": { - "type": "git", - "url": "git://github.com/jashkenas/coffee-script.git" - }, - "devDependencies": { - "uglify-js": ">=1.0.0", - "jison": ">=0.2.0" - } -} diff --git a/node_modules/jade/node_modules/commander/.npmignore b/node_modules/jade/node_modules/commander/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/jade/node_modules/commander/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/jade/node_modules/commander/.travis.yml b/node_modules/jade/node_modules/commander/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/jade/node_modules/commander/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/jade/node_modules/commander/History.md b/node_modules/jade/node_modules/commander/History.md deleted file mode 100644 index 4961d2e..0000000 --- a/node_modules/jade/node_modules/commander/History.md +++ /dev/null @@ -1,107 +0,0 @@ - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/jade/node_modules/commander/Makefile b/node_modules/jade/node_modules/commander/Makefile deleted file mode 100644 index 0074625..0000000 --- a/node_modules/jade/node_modules/commander/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -TESTS = $(shell find test/test.*.js) - -test: - @./test/run $(TESTS) - -.PHONY: test \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/Readme.md b/node_modules/jade/node_modules/commander/Readme.md deleted file mode 100644 index b8328c3..0000000 --- a/node_modules/jade/node_modules/commander/Readme.md +++ /dev/null @@ -1,262 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineappe'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineappe - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .prompt(msg, fn) - - Single-line prompt: - -```js -program.prompt('name: ', function(name){ - console.log('hi %s', name); -}); -``` - - Multi-line prompt: - -```js -program.prompt('description:', function(name){ - console.log('hi %s', name); -}); -``` - - Coercion: - -```js -program.prompt('Age: ', Number, function(age){ - console.log('age: %j', age); -}); -``` - -```js -program.prompt('Birthdate: ', Date, function(date){ - console.log('date: %s', date); -}); -``` - -## .password(msg[, mask], fn) - -Prompt for password without echoing: - -```js -program.password('Password: ', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -Prompt for password with mask char "*": - -```js -program.password('Password: ', '*', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -## .confirm(msg, fn) - - Confirm with the given `msg`: - -```js -program.confirm('continue? ', function(ok){ - console.log(' got %j', ok); -}); -``` - -## .choose(list, fn) - - Let the user choose from a `list`: - -```js -var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - -console.log('Choose the coolest pet:'); -program.choose(list, function(i){ - console.log('you chose %d "%s"', i, list[i]); -}); -``` - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## 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/jade/node_modules/commander/index.js b/node_modules/jade/node_modules/commander/index.js deleted file mode 100644 index 06ec1e4..0000000 --- a/node_modules/jade/node_modules/commander/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/lib/commander.js b/node_modules/jade/node_modules/commander/lib/commander.js deleted file mode 100644 index 5ba87eb..0000000 --- a/node_modules/jade/node_modules/commander/lib/commander.js +++ /dev/null @@ -1,1026 +0,0 @@ - -/*! - * commander - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , path = require('path') - , tty = require('tty') - , basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this.args = []; - this.name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name){ - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - return cmd; -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self.args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self.args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - this.parent.on(this.name, function(args, unknown){ - // Parse any so-far unknown options - unknown = unknown || []; - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - self.args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self.args.length) { - args[self.args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to false - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => true - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null != val && fn) val = fn(val); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // store raw args - this.rawArgs = argv; - - // guess name - if (!this.name) this.name = basename(argv[1]); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - this.args = parsed.args; - return this.parseArgs(this.args, parsed.unknown); -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - if ('-' == arg[0]) return this.optionMissingArgument(option, arg); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || '-' == arg[0]) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this.args.length ? ' ' + args : ''); - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return cmd.name - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args - + (cmd.description() - ? '\n' + cmd.description() - : ''); - }).join('\n\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this.name + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Prompt for a `Number`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForNumber = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseNumber(val){ - val = Number(val); - if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); - fn(val); - }); -}; - -/** - * Prompt for a `Date`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForDate = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseDate(val){ - val = new Date(val); - if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); - fn(val); - }); -}; - -/** - * Single-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptSingleLine = function(str, fn){ - if ('function' == typeof arguments[2]) { - return this['promptFor' + (fn.name || fn)](str, arguments[2]); - } - - process.stdout.write(str); - process.stdin.setEncoding('utf8'); - process.stdin.once('data', function(val){ - fn(val.trim()); - }).resume(); -}; - -/** - * Multi-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptMultiLine = function(str, fn){ - var buf = []; - console.log(str); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(val){ - if ('\n' == val || '\r\n' == val) { - process.stdin.removeAllListeners('data'); - fn(buf.join('\n')); - } else { - buf.push(val.trimRight()); - } - }).resume(); -}; - -/** - * Prompt `str` and callback `fn(val)` - * - * Commander supports single-line and multi-line prompts. - * To issue a single-line prompt simply add white-space - * to the end of `str`, something like "name: ", whereas - * for a multi-line prompt omit this "description:". - * - * - * Examples: - * - * program.prompt('Username: ', function(name){ - * console.log('hi %s', name); - * }); - * - * program.prompt('Description:', function(desc){ - * console.log('description was "%s"', desc.trim()); - * }); - * - * @param {String|Object} str - * @param {Function} fn - * @api public - */ - -Command.prototype.prompt = function(str, fn){ - var self = this; - - if ('string' == typeof str) { - if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); - this.promptMultiLine(str, fn); - } else { - var keys = Object.keys(str) - , obj = {}; - - function next() { - var key = keys.shift() - , label = str[key]; - - if (!key) return fn(obj); - self.prompt(label, function(val){ - obj[key] = val; - next(); - }); - } - - next(); - } -}; - -/** - * Prompt for password with `str`, `mask` char and callback `fn(val)`. - * - * The mask string defaults to '', aka no output is - * written while typing, you may want to use "*" etc. - * - * Examples: - * - * program.password('Password: ', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * program.password('Password: ', '*', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {String} mask - * @param {Function} fn - * @api public - */ - -Command.prototype.password = function(str, mask, fn){ - var self = this - , buf = ''; - - // default mask - if ('function' == typeof mask) { - fn = mask; - mask = ''; - } - - process.stdin.resume(); - tty.setRawMode(true); - process.stdout.write(str); - - // keypress - process.stdin.on('keypress', function(c, key){ - if (key && 'enter' == key.name) { - console.log(); - process.stdin.removeAllListeners('keypress'); - tty.setRawMode(false); - if (!buf.trim().length) return self.password(str, mask, fn); - fn(buf); - return; - } - - if (key && key.ctrl && 'c' == key.name) { - console.log('%s', buf); - process.exit(); - } - - process.stdout.write(mask); - buf += c; - }).resume(); -}; - -/** - * Confirmation prompt with `str` and callback `fn(bool)` - * - * Examples: - * - * program.confirm('continue? ', function(ok){ - * console.log(' got %j', ok); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {Function} fn - * @api public - */ - - -Command.prototype.confirm = function(str, fn, verbose){ - var self = this; - this.prompt(str, function(ok){ - if (!ok.trim()) { - if (!verbose) str += '(yes or no) '; - return self.confirm(str, fn, true); - } - fn(parseBool(ok)); - }); -}; - -/** - * Choice prompt with `list` of items and callback `fn(index, item)` - * - * Examples: - * - * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - * - * console.log('Choose the coolest pet:'); - * program.choose(list, function(i){ - * console.log('you chose %d "%s"', i, list[i]); - * process.stdin.destroy(); - * }); - * - * @param {Array} list - * @param {Number|Function} index or fn - * @param {Function} fn - * @api public - */ - -Command.prototype.choose = function(list, index, fn){ - var self = this - , hasDefault = 'number' == typeof index; - - if (!hasDefault) { - fn = index; - index = null; - } - - list.forEach(function(item, i){ - if (hasDefault && i == index) { - console.log('* %d) %s', i + 1, item); - } else { - console.log(' %d) %s', i + 1, item); - } - }); - - function again() { - self.prompt(' : ', function(val){ - val = parseInt(val, 10) - 1; - if (hasDefault && isNaN(val)) val = index; - - if (null == list[val]) { - again(); - } else { - fn(val, list[val]); - } - }); - } - - again(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Parse a boolean `str`. - * - * @param {String} str - * @return {Boolean} - * @api private - */ - -function parseBool(str) { - return /^y|yes|ok|true$/i.test(str); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - process.stdout.write(cmd.helpInformation()); - cmd.emit('--help'); - process.exit(0); - } - } -} diff --git a/node_modules/jade/node_modules/commander/package.json b/node_modules/jade/node_modules/commander/package.json deleted file mode 100644 index 7161a8b..0000000 --- a/node_modules/jade/node_modules/commander/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "commander" - , "version": "0.6.1" - , "description": "the complete solution for node.js command-line programs" - , "keywords": ["command", "option", "parser", "prompt", "stdin"] - , "author": "TJ Holowaychuk " - , "repository": { "type": "git", "url": "https://github.com/visionmedia/commander.js.git" } - , "dependencies": {} - , "devDependencies": { "should": ">= 0.0.1" } - , "scripts": { "test": "make test" } - , "main": "index" - , "engines": { "node": ">= 0.4.x" } -} \ No newline at end of file diff --git a/node_modules/jade/node_modules/mkdirp/.npmignore b/node_modules/jade/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/jade/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/jade/node_modules/mkdirp/.travis.yml b/node_modules/jade/node_modules/mkdirp/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/jade/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/jade/node_modules/mkdirp/LICENSE b/node_modules/jade/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/jade/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/jade/node_modules/mkdirp/README.markdown b/node_modules/jade/node_modules/mkdirp/README.markdown deleted file mode 100644 index 40de04f..0000000 --- a/node_modules/jade/node_modules/mkdirp/README.markdown +++ /dev/null @@ -1,61 +0,0 @@ -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/jade/node_modules/mkdirp/examples/pow.js b/node_modules/jade/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e692421..0000000 --- a/node_modules/jade/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -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/jade/node_modules/mkdirp/index.js b/node_modules/jade/node_modules/mkdirp/index.js deleted file mode 100644 index fda6de8..0000000 --- a/node_modules/jade/node_modules/mkdirp/index.js +++ /dev/null @@ -1,82 +0,0 @@ -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; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - 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; - } - }); -} - -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; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/node_modules/jade/node_modules/mkdirp/package.json b/node_modules/jade/node_modules/mkdirp/package.json deleted file mode 100644 index 7316d9f..0000000 --- a/node_modules/jade/node_modules/mkdirp/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name" : "mkdirp", - "description" : "Recursively mkdir, like `mkdir -p`", - "version" : "0.3.4", - "author" : "James Halliday (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": "*" } -} diff --git a/node_modules/jade/node_modules/mkdirp/test/chmod.js b/node_modules/jade/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -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/jade/node_modules/mkdirp/test/clobber.js b/node_modules/jade/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb7099..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -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/jade/node_modules/mkdirp/test/mkdirp.js b/node_modules/jade/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -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/jade/node_modules/mkdirp/test/perm.js b/node_modules/jade/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abb..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -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/jade/node_modules/mkdirp/test/perm_sync.js b/node_modules/jade/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f60..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -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/jade/node_modules/mkdirp/test/race.js b/node_modules/jade/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a0447..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -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/jade/node_modules/mkdirp/test/rel.js b/node_modules/jade/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 7985824..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -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/jade/node_modules/mkdirp/test/return.js b/node_modules/jade/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e5..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -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/jade/node_modules/mkdirp/test/return_sync.js b/node_modules/jade/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d3..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -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/jade/node_modules/mkdirp/test/root.js b/node_modules/jade/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -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/jade/node_modules/mkdirp/test/sync.js b/node_modules/jade/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cad..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -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/jade/node_modules/mkdirp/test/umask.js b/node_modules/jade/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -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/jade/node_modules/mkdirp/test/umask_sync.js b/node_modules/jade/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 35bd5cb..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -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/jade/package.json b/node_modules/jade/package.json deleted file mode 100644 index 5d105e1..0000000 --- a/node_modules/jade/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "jade", - "description": "Jade template engine", - "version": "0.28.1", - "author": "TJ Holowaychuk ", - "repository": "git://github.com/visionmedia/jade", - "main": "./index.js", - "bin": { - "jade": "./bin/jade" - }, - "man": "./jade.1", - "dependencies": { - "commander": "0.6.1", - "mkdirp": "0.3.x", - "coffee-script": "~1.4.0" - }, - "devDependencies": { - "mocha": "*", - "markdown": "*", - "stylus": "*", - "uubench": "*", - "should": "*", - "less": "*", - "uglify-js": "*" - }, - "component": { - "scripts": { - "jade": "runtime.js" - } - }, - "scripts": { - "prepublish": "npm prune" - } -} diff --git a/node_modules/jade/runtime.js b/node_modules/jade/runtime.js deleted file mode 100644 index 0f54907..0000000 --- a/node_modules/jade/runtime.js +++ /dev/null @@ -1,179 +0,0 @@ - -jade = (function(exports){ -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // 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 || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - - return exports; - -})({}); diff --git a/node_modules/jade/runtime.min.js b/node_modules/jade/runtime.min.js deleted file mode 100644 index 1714efb..0000000 --- a/node_modules/jade/runtime.min.js +++ /dev/null @@ -1 +0,0 @@ -jade=function(exports){Array.isArray||(Array.isArray=function(arr){return"[object Array]"==Object.prototype.toString.call(arr)}),Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),exports.merge=function merge(a,b){var ac=a["class"],bc=b["class"];if(ac||bc)ac=ac||[],bc=bc||[],Array.isArray(ac)||(ac=[ac]),Array.isArray(bc)||(bc=[bc]),ac=ac.filter(nulls),bc=bc.filter(nulls),a["class"]=ac.concat(bc).join(" ");for(var key in b)key!="class"&&(a[key]=b[key]);return a};function nulls(val){return val!=null}return exports.attrs=function attrs(obj,escaped){var buf=[],terse=obj.terse;delete obj.terse;var keys=Object.keys(obj),len=keys.length;if(len){buf.push("");for(var i=0;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err},exports}({}); \ No newline at end of file diff --git a/node_modules/jade/testing/index.html b/node_modules/jade/testing/index.html deleted file mode 100644 index 105c9f4..0000000 --- a/node_modules/jade/testing/index.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/jade/testing/index.jade b/node_modules/jade/testing/index.jade deleted file mode 100644 index a22e82a..0000000 --- a/node_modules/jade/testing/index.jade +++ /dev/null @@ -1,4 +0,0 @@ - -html - body - include some.js diff --git a/node_modules/jade/testing/layout.html b/node_modules/jade/testing/layout.html deleted file mode 100644 index cbbfc7a..0000000 --- a/node_modules/jade/testing/layout.html +++ /dev/null @@ -1 +0,0 @@ -Application \ No newline at end of file diff --git a/node_modules/jade/testing/layout.jade b/node_modules/jade/testing/layout.jade deleted file mode 100644 index a48765c..0000000 --- a/node_modules/jade/testing/layout.jade +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -html - head - title Application - body - block content diff --git a/node_modules/jade/testing/mobile.html b/node_modules/jade/testing/mobile.html deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/jade/testing/mobile.jade b/node_modules/jade/testing/mobile.jade deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/jade/testing/nested/something.html b/node_modules/jade/testing/nested/something.html deleted file mode 100644 index d6b0493..0000000 --- a/node_modules/jade/testing/nested/something.html +++ /dev/null @@ -1 +0,0 @@ -

    out

    \ No newline at end of file diff --git a/node_modules/jade/testing/nested/something.jade b/node_modules/jade/testing/nested/something.jade deleted file mode 100644 index 552c797..0000000 --- a/node_modules/jade/testing/nested/something.jade +++ /dev/null @@ -1 +0,0 @@ -p out \ No newline at end of file diff --git a/node_modules/jade/testing/some.js b/node_modules/jade/testing/some.js deleted file mode 100644 index 3104e71..0000000 --- a/node_modules/jade/testing/some.js +++ /dev/null @@ -1,4 +0,0 @@ - -if (something) { - something('hey'); -} diff --git a/node_modules/jade/testing/test.md b/node_modules/jade/testing/test.md deleted file mode 100644 index 9af1bb2..0000000 --- a/node_modules/jade/testing/test.md +++ /dev/null @@ -1,5 +0,0 @@ -Just a _test_ of some **markdown**: - - - foo - - bar - - baz diff --git a/node_modules/passport-github/.npmignore b/node_modules/passport-github/.npmignore deleted file mode 100644 index d9ceb36..0000000 --- a/node_modules/passport-github/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -*.md -.DS_Store -.git* -Makefile -docs/ -examples/ -support/ -test/ diff --git a/node_modules/passport-github/.travis.yml b/node_modules/passport-github/.travis.yml deleted file mode 100644 index 2644170..0000000 --- a/node_modules/passport-github/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: "node_js" -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/passport-github/LICENSE b/node_modules/passport-github/LICENSE deleted file mode 100644 index 74524ce..0000000 --- a/node_modules/passport-github/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Jared Hanson - -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/passport-github/examples/login/app.js b/node_modules/passport-github/examples/login/app.js deleted file mode 100644 index 7d7e75e..0000000 --- a/node_modules/passport-github/examples/login/app.js +++ /dev/null @@ -1,122 +0,0 @@ -var express = require('express') - , passport = require('passport') - , util = require('util') - , GitHubStrategy = require('passport-github').Strategy; - -var GITHUB_CLIENT_ID = "--insert-github-client-id-here--" -var GITHUB_CLIENT_SECRET = "--insert-github-client-secret-here--"; - - -// Passport session setup. -// To support persistent login sessions, Passport needs to be able to -// serialize users into and deserialize users out of the session. Typically, -// this will be as simple as storing the user ID when serializing, and finding -// the user by ID when deserializing. However, since this example does not -// have a database of user records, the complete GitHub profile is serialized -// and deserialized. -passport.serializeUser(function(user, done) { - done(null, user); -}); - -passport.deserializeUser(function(obj, done) { - done(null, obj); -}); - - -// Use the GitHubStrategy within Passport. -// Strategies in Passport require a `verify` function, which accept -// credentials (in this case, an accessToken, refreshToken, and GitHub -// profile), and invoke a callback with a user object. -passport.use(new GitHubStrategy({ - clientID: GITHUB_CLIENT_ID, - clientSecret: GITHUB_CLIENT_SECRET, - callbackURL: "http://127.0.0.1:3000/auth/github/callback" - }, - function(accessToken, refreshToken, profile, done) { - // asynchronous verification, for effect... - process.nextTick(function () { - - // To keep the example simple, the user's GitHub profile is returned to - // represent the logged-in user. In a typical application, you would want - // to associate the GitHub account with a user record in your database, - // and return that user instead. - return done(null, profile); - }); - } -)); - - - - -var app = express.createServer(); - -// configure Express -app.configure(function() { - app.set('views', __dirname + '/views'); - app.set('view engine', 'ejs'); - app.use(express.logger()); - app.use(express.cookieParser()); - app.use(express.bodyParser()); - app.use(express.methodOverride()); - app.use(express.session({ secret: 'keyboard cat' })); - // Initialize Passport! Also use passport.session() middleware, to support - // persistent login sessions (recommended). - app.use(passport.initialize()); - app.use(passport.session()); - app.use(app.router); - app.use(express.static(__dirname + '/public')); -}); - - -app.get('/', function(req, res){ - res.render('index', { user: req.user }); -}); - -app.get('/account', ensureAuthenticated, function(req, res){ - res.render('account', { user: req.user }); -}); - -app.get('/login', function(req, res){ - res.render('login', { user: req.user }); -}); - -// GET /auth/github -// Use passport.authenticate() as route middleware to authenticate the -// request. The first step in GitHub authentication will involve redirecting -// the user to github.com. After authorization, GitHubwill redirect the user -// back to this application at /auth/github/callback -app.get('/auth/github', - passport.authenticate('github'), - function(req, res){ - // The request will be redirected to GitHub for authentication, so this - // function will not be called. - }); - -// GET /auth/github/callback -// Use passport.authenticate() as route middleware to authenticate the -// request. If authentication fails, the user will be redirected back to the -// login page. Otherwise, the primary route function function will be called, -// which, in this example, will redirect the user to the home page. -app.get('/auth/github/callback', - passport.authenticate('github', { failureRedirect: '/login' }), - function(req, res) { - res.redirect('/'); - }); - -app.get('/logout', function(req, res){ - req.logout(); - res.redirect('/'); -}); - -app.listen(3000); - - -// Simple route middleware to ensure user is authenticated. -// Use this route middleware on any resource that needs to be protected. If -// the request is authenticated (typically via a persistent login session), -// the request will proceed. Otherwise, the user will be redirected to the -// login page. -function ensureAuthenticated(req, res, next) { - if (req.isAuthenticated()) { return next(); } - res.redirect('/login') -} diff --git a/node_modules/passport-github/examples/login/package.json b/node_modules/passport-github/examples/login/package.json deleted file mode 100644 index 413b025..0000000 --- a/node_modules/passport-github/examples/login/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "passport-github-examples-login", - "version": "0.0.0", - "dependencies": { - "express": ">= 0.0.0", - "ejs": ">= 0.0.0", - "passport": ">= 0.0.0", - "passport-github": ">= 0.0.0" - } -} diff --git a/node_modules/passport-github/examples/login/views/account.ejs b/node_modules/passport-github/examples/login/views/account.ejs deleted file mode 100644 index c4633d6..0000000 --- a/node_modules/passport-github/examples/login/views/account.ejs +++ /dev/null @@ -1,4 +0,0 @@ -

    ID: <%= user.id %>

    -

    Username: <%= user.username %>

    -

    Name: <%= user.displayName %>

    -

    Email: <%= user.emails[0].value %>

    diff --git a/node_modules/passport-github/examples/login/views/index.ejs b/node_modules/passport-github/examples/login/views/index.ejs deleted file mode 100644 index 15db9c0..0000000 --- a/node_modules/passport-github/examples/login/views/index.ejs +++ /dev/null @@ -1,5 +0,0 @@ -<% if (!user) { %> -

    Welcome! Please log in.

    -<% } else { %> -

    Hello, <%= user.displayName %>.

    -<% } %> diff --git a/node_modules/passport-github/examples/login/views/layout.ejs b/node_modules/passport-github/examples/login/views/layout.ejs deleted file mode 100644 index b2ef4fa..0000000 --- a/node_modules/passport-github/examples/login/views/layout.ejs +++ /dev/null @@ -1,21 +0,0 @@ - - - - Passport-GitHub Example - - - <% if (!user) { %> -
    - <% } else { %> -

    - Home | - Account | - Log Out -

    - <% } %> - <%- body %> - - diff --git a/node_modules/passport-github/examples/login/views/login.ejs b/node_modules/passport-github/examples/login/views/login.ejs deleted file mode 100644 index d2dc1bb..0000000 --- a/node_modules/passport-github/examples/login/views/login.ejs +++ /dev/null @@ -1 +0,0 @@ -Login with GitHub diff --git a/node_modules/passport-github/lib/passport-github/index.js b/node_modules/passport-github/lib/passport-github/index.js deleted file mode 100644 index 8a2d8c3..0000000 --- a/node_modules/passport-github/lib/passport-github/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Module dependencies. - */ -var Strategy = require('./strategy'); - - -/** - * Framework version. - */ -require('pkginfo')(module, 'version'); - -/** - * Expose constructors. - */ -exports.Strategy = Strategy; diff --git a/node_modules/passport-github/lib/passport-github/strategy.js b/node_modules/passport-github/lib/passport-github/strategy.js deleted file mode 100644 index fdbef53..0000000 --- a/node_modules/passport-github/lib/passport-github/strategy.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Module dependencies. - */ -var util = require('util') - , OAuth2Strategy = require('passport-oauth').OAuth2Strategy - , InternalOAuthError = require('passport-oauth').InternalOAuthError; - - -/** - * `Strategy` constructor. - * - * The GitHub authentication strategy authenticates requests by delegating to - * GitHub using the OAuth 2.0 protocol. - * - * Applications must supply a `verify` callback which accepts an `accessToken`, - * `refreshToken` and service-specific `profile`, and then calls the `done` - * callback supplying a `user`, which should be set to `false` if the - * credentials are not valid. If an exception occured, `err` should be set. - * - * Options: - * - `clientID` your GitHub application's Client ID - * - `clientSecret` your GitHub application's Client Secret - * - `callbackURL` URL to which GitHub will redirect the user after granting authorization - * - `scope` array of permission scopes to request. valid scopes include: - * 'user', 'public_repo', 'repo', 'gist', or none. - * (see http://developer.github.com/v3/oauth/#scopes for more info) - * - * Examples: - * - * passport.use(new GitHubStrategy({ - * clientID: '123-456-789', - * clientSecret: 'shhh-its-a-secret' - * callbackURL: 'https://www.example.net/auth/github/callback' - * }, - * function(accessToken, refreshToken, profile, done) { - * User.findOrCreate(..., function (err, user) { - * done(err, user); - * }); - * } - * )); - * - * @param {Object} options - * @param {Function} verify - * @api public - */ -function Strategy(options, verify) { - options = options || {}; - options.authorizationURL = options.authorizationURL || 'https://github.com/login/oauth/authorize'; - options.tokenURL = options.tokenURL || 'https://github.com/login/oauth/access_token'; - options.scopeSeparator = options.scopeSeparator || ','; - - OAuth2Strategy.call(this, options, verify); - this.name = 'github'; -} - -/** - * Inherit from `OAuth2Strategy`. - */ -util.inherits(Strategy, OAuth2Strategy); - - -/** - * Retrieve user profile from GitHub. - * - * This function constructs a normalized profile, with the following properties: - * - * - `provider` always set to `github` - * - `id` the user's GitHub ID - * - `username` the user's GitHub username - * - `displayName` the user's full name - * - `profileUrl` the URL of the profile for the user on GitHub - * - `emails` the user's email addresses - * - * @param {String} accessToken - * @param {Function} done - * @api protected - */ -Strategy.prototype.userProfile = function(accessToken, done) { - this._oauth2.get('https://api.github.com/user', accessToken, function (err, body, res) { - if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); } - - try { - var json = JSON.parse(body); - - var profile = { provider: 'github' }; - profile.id = json.id; - profile.displayName = json.name; - profile.username = json.login; - profile.profileUrl = json.html_url; - profile.emails = [{ value: json.email }]; - - profile._raw = body; - profile._json = json; - - done(null, profile); - } catch(e) { - done(e); - } - }); -} - - -/** - * Expose `Strategy`. - */ -module.exports = Strategy; diff --git a/node_modules/passport-github/node_modules/passport-oauth/.travis.yml b/node_modules/passport-github/node_modules/passport-oauth/.travis.yml deleted file mode 100644 index a57e4db..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: "node_js" -node_js: - - 0.4 - - 0.6 - - 0.8 diff --git a/node_modules/passport-github/node_modules/passport-oauth/LICENSE b/node_modules/passport-github/node_modules/passport-oauth/LICENSE deleted file mode 100644 index ec885b5..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2011-2013 Jared Hanson - -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/passport-github/node_modules/passport-oauth/README.md b/node_modules/passport-github/node_modules/passport-oauth/README.md deleted file mode 100644 index f149c90..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Passport-OAuth - -General-purpose OAuth 1.0 and OAuth 2.0 authentication strategies for [Passport](https://github.com/jaredhanson/passport). - -This module lets you authenticate using OAuth in your Node.js applications. -By plugging into Passport, OAuth authentication can be easily and unobtrusively -integrated into any application or framework that supports -[Connect](http://www.senchalabs.org/connect/)-style middleware, including -[Express](http://expressjs.com/). - -Note that this strategy provides generic OAuth support. In many cases, a -provider-specific strategy can be used instead, which cuts down on unnecessary -configuration, and accommodates any provider-specific quirks. See the list -below for supported providers. - -Developers who need to implement authentication against an OAuth provider that -is not already supported are encouraged to sub-class this strategy. If you -choose to open source the new provider-specific strategy, send me a message and -I will update the list. - -## Installation - - $ npm install passport-oauth - -## Strategies using OAuth - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    StrategyOAuth Version
    37signals2.0
    AllPlayers.com1.0
    AngelList2.0
    Bitbucket1.0a
    Cloud Foundry (UAA)2.0
    Digg1.0a
    Dropbox1.0
    Dwolla2.0
    Evernote1.0a
    Facebook2.0
    Fitbit1.0a
    Flickr1.0a
    Foursquare2.0
    Geoloqi2.0
    GitHub2.0
    Goodreads1.0
    Google1.0a, 2.0
    Gowalla2.0
    Instagram2.0
    Justin.tv1.0a
    LinkedIn1.0a
    Meetup1.0a
    Netflix1.0a
    Ohloh1.0
    OpenStreetMap1.0a
    picplz2.0
    Rdio1.0a
    Readability1.0a
    RunKeeper2.0
    SmugMug1.0a
    SoundCloud2.0
    TripIt1.0
    Tumblr1.0a
    Twitter1.0a
    Vimeo1.0a
    Windows Live2.0
    Yahoo!1.0a
    Yammer2.0
    - -## Tests - - $ npm install --dev - $ make test - -[![Build Status](https://secure.travis-ci.org/jaredhanson/passport-oauth.png)](http://travis-ci.org/jaredhanson/passport-oauth) - - -## Credits - - - [Jared Hanson](http://github.com/jaredhanson) - -## License - -[The MIT License](http://opensource.org/licenses/MIT) - -Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js deleted file mode 100644 index 72d4081..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/errors/internaloautherror.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * `InternalOAuthError` error. - * - * InternalOAuthError wraps errors generated by node-oauth. By wrapping these - * objects, error messages can be formatted in a manner that aids in debugging - * OAuth issues. - * - * @api public - */ -function InternalOAuthError(message, err) { - Error.call(this); - Error.captureStackTrace(this, arguments.callee); - this.name = 'InternalOAuthError'; - this.message = message; - this.oauthError = err; -}; - -/** - * Inherit from `Error`. - */ -InternalOAuthError.prototype.__proto__ = Error.prototype; - -/** - * Returns a string representing the error. - * - * @return {String} - * @api public - */ -InternalOAuthError.prototype.toString = function() { - var m = this.message; - if (this.oauthError) { - if (this.oauthError instanceof Error) { - m += ' (' + this.oauthError + ')'; - } - else if (this.oauthError.statusCode && this.oauthError.data) { - m += ' (status: ' + this.oauthError.statusCode + ' data: ' + this.oauthError.data + ')'; - } - } - return m; -} - - -/** - * Expose `InternalOAuthError`. - */ -module.exports = InternalOAuthError; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js deleted file mode 100644 index b124124..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Module dependencies. - */ -var OAuthStrategy = require('./strategies/oauth'); -var OAuth2Strategy = require('./strategies/oauth2'); -var InternalOAuthError = require('./errors/internaloautherror'); - - -/** - * Framework version. - */ -require('pkginfo')(module, 'version'); - -/** - * Expose constructors. - */ -exports.OAuthStrategy = OAuthStrategy; -exports.OAuth2Strategy = OAuth2Strategy; - -exports.InternalOAuthError = InternalOAuthError; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js deleted file mode 100644 index eeed51d..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * Module dependencies. - */ -var passport = require('passport') - , url = require('url') - , util = require('util') - , utils = require('./utils') - , OAuth = require('oauth').OAuth - , InternalOAuthError = require('../errors/internaloautherror'); - - -/** - * `OAuthStrategy` constructor. - * - * The OAuth authentication strategy authenticates requests using the OAuth - * protocol. - * - * OAuth provides a facility for delegated authentication, whereby users can - * authenticate using a third-party service such as Twitter. Delegating in this - * manner involves a sequence of events, including redirecting the user to the - * third-party service for authorization. Once authorization has been obtained, - * the user is redirected back to the application and a token can be used to - * obtain credentials. - * - * Applications must supply a `verify` callback which accepts a `token`, - * `tokenSecret` and service-specific `profile`, and then calls the `done` - * callback supplying a `user`, which should be set to `false` if the - * credentials are not valid. If an exception occured, `err` should be set. - * - * Options: - * - `requestTokenURL` URL used to obtain an unauthorized request token - * - `accessTokenURL` URL used to exchange a user-authorized request token for an access token - * - `userAuthorizationURL` URL used to obtain user authorization - * - `consumerKey` identifies client to service provider - * - `consumerSecret` secret used to establish ownership of the consumer key - * - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization - * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) - * - * Examples: - * - * passport.use(new OAuthStrategy({ - * requestTokenURL: 'https://www.example.com/oauth/request_token', - * accessTokenURL: 'https://www.example.com/oauth/access_token', - * userAuthorizationURL: 'https://www.example.com/oauth/authorize', - * consumerKey: '123-456-789', - * consumerSecret: 'shhh-its-a-secret' - * callbackURL: 'https://www.example.net/auth/example/callback' - * }, - * function(token, tokenSecret, profile, done) { - * User.findOrCreate(..., function (err, user) { - * done(err, user); - * }); - * } - * )); - * - * @param {Object} options - * @param {Function} verify - * @api public - */ -function OAuthStrategy(options, verify) { - options = options || {} - passport.Strategy.call(this); - this.name = 'oauth'; - this._verify = verify; - - if (!options.requestTokenURL) throw new Error('OAuthStrategy requires a requestTokenURL option'); - if (!options.accessTokenURL) throw new Error('OAuthStrategy requires a accessTokenURL option'); - if (!options.userAuthorizationURL) throw new Error('OAuthStrategy requires a userAuthorizationURL option'); - if (!options.consumerKey) throw new Error('OAuthStrategy requires a consumerKey option'); - if (options.consumerSecret === undefined) throw new Error('OAuthStrategy requires a consumerSecret option'); - if (!verify) throw new Error('OAuth authentication strategy requires a verify function'); - - // NOTE: The _oauth property is considered "protected". Subclasses are - // allowed to use it when making protected resource requests to retrieve - // the user profile. - this._oauth = new OAuth(options.requestTokenURL, options.accessTokenURL, - options.consumerKey, options.consumerSecret, - "1.0", null, options.signatureMethod || "HMAC-SHA1"); - - this._userAuthorizationURL = options.userAuthorizationURL; - this._callbackURL = options.callbackURL; - this._passReqToCallback = options.passReqToCallback; - this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile; - this._key = options.sessionKey || 'oauth'; -} - -/** - * Inherit from `passport.Strategy`. - */ -util.inherits(OAuthStrategy, passport.Strategy); - - -/** - * Authenticate request by delegating to a service provider using OAuth. - * - * @param {Object} req - * @api protected - */ -OAuthStrategy.prototype.authenticate = function(req, options) { - options = options || {}; - if (!req.session) { return this.error(new Error('OAuth authentication requires session support')); } - - var self = this; - - if (req.query && req.query['oauth_token']) { - // The request being authenticated contains an oauth_token parameter in the - // query portion of the URL. This indicates that the service provider has - // redirected the user back to the application, after authenticating the - // user and obtaining their authorization. - // - // The value of the oauth_token parameter is the request token. Together - // with knowledge of the token secret (stored in the session), the request - // token can be exchanged for an access token and token secret. - // - // This access token and token secret, along with the optional ability to - // fetch profile information from the service provider, is sufficient to - // establish the identity of the user. - - // Bail if the session does not contain the request token and corresponding - // secret. If this happens, it is most likely caused by initiating OAuth - // from a different host than that of the callback endpoint (for example: - // initiating from 127.0.0.1 but handling callbacks at localhost). - if (!req.session[self._key]) { return self.error(new Error('failed to find request token in session')); } - - var oauthToken = req.query['oauth_token']; - var oauthVerifier = req.query['oauth_verifier'] || null; - var oauthTokenSecret = req.session[self._key]["oauth_token_secret"]; - - // NOTE: The oauth_verifier parameter will be supplied in the query portion - // of the redirect URL, if the server supports OAuth 1.0a. - - this._oauth.getOAuthAccessToken(oauthToken, oauthTokenSecret, oauthVerifier, function(err, token, tokenSecret, params) { - if (err) { return self.error(new InternalOAuthError('failed to obtain access token', err)); } - - // The request token has been exchanged for an access token. Since the - // request token is a single-use token, that data can be removed from the - // session. - delete req.session[self._key]['oauth_token']; - delete req.session[self._key]['oauth_token_secret']; - if (Object.keys(req.session[self._key]).length == 0) { - delete req.session[self._key]; - } - - self._loadUserProfile(token, tokenSecret, params, function(err, profile) { - if (err) { return self.error(err); }; - - function verified(err, user, info) { - if (err) { return self.error(err); } - if (!user) { return self.fail(info); } - self.success(user, info); - } - - if (self._passReqToCallback) { - var arity = self._verify.length; - if (arity == 6) { - self._verify(req, token, tokenSecret, params, profile, verified); - } else { // arity == 5 - self._verify(req, token, tokenSecret, profile, verified); - } - } else { - var arity = self._verify.length; - if (arity == 5) { - self._verify(token, tokenSecret, params, profile, verified); - } else { // arity == 4 - self._verify(token, tokenSecret, profile, verified); - } - } - }); - }); - } else { - // In order to authenticate via OAuth, the application must obtain a request - // token from the service provider and redirect the user to the service - // provider to obtain their authorization. After authorization has been - // approved the user will be redirected back the application, at which point - // the application can exchange the request token for an access token. - // - // In order to successfully exchange the request token, its corresponding - // token secret needs to be known. The token secret will be temporarily - // stored in the session, so that it can be retrieved upon the user being - // redirected back to the application. - - var params = this.requestTokenParams(options); - var callbackURL = options.callbackURL || this._callbackURL; - if (callbackURL) { - var parsed = url.parse(callbackURL); - if (!parsed.protocol) { - // The callback URL is relative, resolve a fully qualified URL from the - // URL of the originating request. - callbackURL = url.resolve(utils.originalURL(req), callbackURL); - } - } - params['oauth_callback'] = callbackURL; - - this._oauth.getOAuthRequestToken(params, function(err, token, tokenSecret, params) { - if (err) { return self.error(new InternalOAuthError('failed to obtain request token', err)); } - - // NOTE: params will contain an oauth_callback_confirmed property set to - // true, if the server supports OAuth 1.0a. - // { oauth_callback_confirmed: 'true' } - - if (!req.session[self._key]) { req.session[self._key] = {}; } - req.session[self._key]['oauth_token'] = token; - req.session[self._key]['oauth_token_secret'] = tokenSecret; - - var parsed = url.parse(self._userAuthorizationURL, true); - parsed.query['oauth_token'] = token; - utils.merge(parsed.query, self.userAuthorizationParams(options)) - delete parsed.search; - var location = url.format(parsed); - self.redirect(location); - }); - } -} - -/** - * Retrieve user profile from service provider. - * - * OAuth-based authentication strategies can overrride this function in order to - * load the user's profile from the service provider. This assists applications - * (and users of those applications) in the initial registration process by - * automatically submitting required information. - * - * @param {String} accessToken - * @param {Function} done - * @api protected - */ -OAuthStrategy.prototype.userProfile = function(token, tokenSecret, params, done) { - return done(null, {}); -} - -/** - * Return extra parameters to be included in the request token request. - * - * Some OAuth providers require additional parameters to be included when - * issuing a request token. Since these parameters are not standardized by the - * OAuth specification, OAuth-based authentication strategies can overrride this - * function in order to populate these parameters as required by the provider. - * - * @param {Object} options - * @return {Object} - * @api protected - */ -OAuthStrategy.prototype.requestTokenParams = function(options) { - return {}; -} - -/** - * Return extra parameters to be included in the user authorization request. - * - * Some OAuth providers allow additional, non-standard parameters to be included - * when requesting authorization. Since these parameters are not standardized - * by the OAuth specification, OAuth-based authentication strategies can - * overrride this function in order to populate these parameters as required by - * the provider. - * - * @param {Object} options - * @return {Object} - * @api protected - */ -OAuthStrategy.prototype.userAuthorizationParams = function(options) { - return {}; -} - -/** - * Load user profile, contingent upon options. - * - * @param {String} accessToken - * @param {Function} done - * @api private - */ -OAuthStrategy.prototype._loadUserProfile = function(token, tokenSecret, params, done) { - var self = this; - - function loadIt() { - return self.userProfile(token, tokenSecret, params, done); - } - function skipIt() { - return done(null); - } - - if (typeof this._skipUserProfile == 'function' && this._skipUserProfile.length > 1) { - // async - this._skipUserProfile(token, tokenSecret, function(err, skip) { - if (err) { return done(err); } - if (!skip) { return loadIt(); } - return skipIt(); - }); - } else { - var skip = (typeof this._skipUserProfile == 'function') ? this._skipUserProfile() : this._skipUserProfile; - if (!skip) { return loadIt(); } - return skipIt(); - } -} - - -/** - * Expose `OAuthStrategy`. - */ -module.exports = OAuthStrategy; diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js deleted file mode 100644 index 718a17b..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Module dependencies. - */ -var passport = require('passport') - , url = require('url') - , util = require('util') - , utils = require('./utils') - , OAuth2 = require('oauth').OAuth2 - , InternalOAuthError = require('../errors/internaloautherror'); - - -/** - * `OAuth2Strategy` constructor. - * - * The OAuth 2.0 authentication strategy authenticates requests using the OAuth - * 2.0 protocol. - * - * OAuth 2.0 provides a facility for delegated authentication, whereby users can - * authenticate using a third-party service such as Facebook. Delegating in - * this manner involves a sequence of events, including redirecting the user to - * the third-party service for authorization. Once authorization has been - * granted, the user is redirected back to the application and an authorization - * code can be used to obtain credentials. - * - * Applications must supply a `verify` callback which accepts an `accessToken`, - * `refreshToken` and service-specific `profile`, and then calls the `done` - * callback supplying a `user`, which should be set to `false` if the - * credentials are not valid. If an exception occured, `err` should be set. - * - * Options: - * - `authorizationURL` URL used to obtain an authorization grant - * - `tokenURL` URL used to obtain an access token - * - `clientID` identifies client to service provider - * - `clientSecret` secret used to establish ownership of the client identifer - * - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization - * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) - * - * Examples: - * - * passport.use(new OAuth2Strategy({ - * authorizationURL: 'https://www.example.com/oauth2/authorize', - * tokenURL: 'https://www.example.com/oauth2/token', - * clientID: '123-456-789', - * clientSecret: 'shhh-its-a-secret' - * callbackURL: 'https://www.example.net/auth/example/callback' - * }, - * function(accessToken, refreshToken, profile, done) { - * User.findOrCreate(..., function (err, user) { - * done(err, user); - * }); - * } - * )); - * - * @param {Object} options - * @param {Function} verify - * @api public - */ -function OAuth2Strategy(options, verify) { - options = options || {} - passport.Strategy.call(this); - this.name = 'oauth2'; - this._verify = verify; - - if (!options.authorizationURL) throw new Error('OAuth2Strategy requires a authorizationURL option'); - if (!options.tokenURL) throw new Error('OAuthStrategy requires a tokenURL option'); - if (!options.clientID) throw new Error('OAuth2Strategy requires a clientID option'); - if (!options.clientSecret) throw new Error('OAuth2Strategy requires a clientSecret option'); - - // NOTE: The _oauth2 property is considered "protected". Subclasses are - // allowed to use it when making protected resource requests to retrieve - // the user profile. - this._oauth2 = new OAuth2(options.clientID, options.clientSecret, - '', options.authorizationURL, options.tokenURL, options.customHeaders); - - this._callbackURL = options.callbackURL; - this._scope = options.scope; - this._scopeSeparator = options.scopeSeparator || ' '; - this._passReqToCallback = options.passReqToCallback; - this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile; -} - -/** - * Inherit from `passport.Strategy`. - */ -util.inherits(OAuth2Strategy, passport.Strategy); - - -/** - * Authenticate request by delegating to a service provider using OAuth 2.0. - * - * @param {Object} req - * @api protected - */ -OAuth2Strategy.prototype.authenticate = function(req, options) { - options = options || {}; - var self = this; - - if (req.query && req.query.error) { - // TODO: Error information pertaining to OAuth 2.0 flows is encoded in the - // query parameters, and should be propagated to the application. - return this.fail(); - } - - var callbackURL = options.callbackURL || this._callbackURL; - if (callbackURL) { - var parsed = url.parse(callbackURL); - if (!parsed.protocol) { - // The callback URL is relative, resolve a fully qualified URL from the - // URL of the originating request. - callbackURL = url.resolve(utils.originalURL(req), callbackURL); - } - } - - if (req.query && req.query.code) { - var code = req.query.code; - - // NOTE: The module oauth (0.9.5), which is a dependency, automatically adds - // a 'type=web_server' parameter to the percent-encoded data sent in - // the body of the access token request. This appears to be an - // artifact from an earlier draft of OAuth 2.0 (draft 22, as of the - // time of this writing). This parameter is not necessary, but its - // presence does not appear to cause any issues. - this._oauth2.getOAuthAccessToken(code, { grant_type: 'authorization_code', redirect_uri: callbackURL }, - function(err, accessToken, refreshToken, params) { - if (err) { return self.error(new InternalOAuthError('failed to obtain access token', err)); } - - self._loadUserProfile(accessToken, function(err, profile) { - if (err) { return self.error(err); }; - - function verified(err, user, info) { - if (err) { return self.error(err); } - if (!user) { return self.fail(info); } - self.success(user, info); - } - - if (self._passReqToCallback) { - var arity = self._verify.length; - if (arity == 6) { - self._verify(req, accessToken, refreshToken, params, profile, verified); - } else { // arity == 5 - self._verify(req, accessToken, refreshToken, profile, verified); - } - } else { - var arity = self._verify.length; - if (arity == 5) { - self._verify(accessToken, refreshToken, params, profile, verified); - } else { // arity == 4 - self._verify(accessToken, refreshToken, profile, verified); - } - } - }); - } - ); - } else { - // NOTE: The module oauth (0.9.5), which is a dependency, automatically adds - // a 'type=web_server' parameter to the query portion of the URL. - // This appears to be an artifact from an earlier draft of OAuth 2.0 - // (draft 22, as of the time of this writing). This parameter is not - // necessary, but its presence does not appear to cause any issues. - - var params = this.authorizationParams(options); - params['response_type'] = 'code'; - params['redirect_uri'] = callbackURL; - var scope = options.scope || this._scope; - if (scope) { - if (Array.isArray(scope)) { scope = scope.join(this._scopeSeparator); } - params.scope = scope; - } - var state = options.state; - if (state) { params.state = state; } - - var location = this._oauth2.getAuthorizeUrl(params); - this.redirect(location); - } -} - -/** - * Retrieve user profile from service provider. - * - * OAuth 2.0-based authentication strategies can overrride this function in - * order to load the user's profile from the service provider. This assists - * applications (and users of those applications) in the initial registration - * process by automatically submitting required information. - * - * @param {String} accessToken - * @param {Function} done - * @api protected - */ -OAuth2Strategy.prototype.userProfile = function(accessToken, done) { - return done(null, {}); -} - -/** - * Return extra parameters to be included in the authorization request. - * - * Some OAuth 2.0 providers allow additional, non-standard parameters to be - * included when requesting authorization. Since these parameters are not - * standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication - * strategies can overrride this function in order to populate these parameters - * as required by the provider. - * - * @param {Object} options - * @return {Object} - * @api protected - */ -OAuth2Strategy.prototype.authorizationParams = function(options) { - return {}; -} - -/** - * Load user profile, contingent upon options. - * - * @param {String} accessToken - * @param {Function} done - * @api private - */ -OAuth2Strategy.prototype._loadUserProfile = function(accessToken, done) { - var self = this; - - function loadIt() { - return self.userProfile(accessToken, done); - } - function skipIt() { - return done(null); - } - - if (typeof this._skipUserProfile == 'function' && this._skipUserProfile.length > 1) { - // async - this._skipUserProfile(accessToken, function(err, skip) { - if (err) { return done(err); } - if (!skip) { return loadIt(); } - return skipIt(); - }); - } else { - var skip = (typeof this._skipUserProfile == 'function') ? this._skipUserProfile() : this._skipUserProfile; - if (!skip) { return loadIt(); } - return skipIt(); - } -} - - -/** - * Expose `OAuth2Strategy`. - */ -module.exports = OAuth2Strategy; - diff --git a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js b/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js deleted file mode 100644 index dd401b6..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/lib/passport-oauth/strategies/utils.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Reconstructs the original URL of the request. - * - * This function builds a URL that corresponds the original URL requested by the - * client, including the protocol (http or https) and host. - * - * If the request passed through any proxies that terminate SSL, the - * `X-Forwarded-Proto` header is used to detect if the request was encrypted to - * the proxy. - * - * @return {String} - * @api private - */ -exports.originalURL = function(req) { - var headers = req.headers - , protocol = (req.connection.encrypted || req.headers['x-forwarded-proto'] == 'https') - ? 'https' - : 'http' - , host = headers.host - , path = req.url || ''; - return protocol + '://' + host + path; -}; - -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * utils.merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api private - */ - -exports.merge = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE deleted file mode 100644 index f8049f8..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) <2010-2012> - -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/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile deleted file mode 100644 index be7c339..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Run all tests -# -test: - @@node_modules/.bin/vows tests/* --spec - -.PHONY: test install diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md deleted file mode 100644 index 620a13b..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/Readme.md +++ /dev/null @@ -1,91 +0,0 @@ -node-oauth -=========== -A simple oauth API for node.js . This API allows users to authenticate against OAUTH providers, and thus act as OAuth consumers. It also has support for OAuth Echo, which is used for communicating with 3rd party media providers such as TwitPic and yFrog. - -Tested against Twitter (http://twitter.com), term.ie (http://term.ie/oauth/example/), TwitPic, and Yahoo! - -Also provides rudimentary OAuth2 support, tested against facebook, github, foursquare, google and Janrain. For more complete usage examples please take a look at connect-auth (http://github.com/ciaranj/connect-auth) - - -Installation -============== - - $ npm install oauth - - -Change History -============== - -* 0.9.8 - - OAuth: Support overly-strict OAuth server's that require whitespace separating the Authorization Header parameters (e.g. 500px.com) (Thanks to Christian Schwarz) - - OAuth: Fix incorrect double-encoding of PLAINTEXT OAuth connections (Thanks to Joe Rozner) - - OAuth: Minor safety check added when checking hostnames. (Thanks to Garrick Cheung) -* 0.9.7 - - OAuth2: Pass back any extra response data for calls to getOAuthAccessToken (Thanks to Tang Bo Hao) - - OAuth2: Don't force a https request if given a http url (Thanks to Damien Mathieu) - - OAuth2: Supports specifying a grant-type of 'refresh-token' (Thanks to Luke Baker) -* 0.9.6 - - OAuth2: Support for 302 redirects (Thanks Patrick Negri). - - OAuth1/2: Some code tidying. ( Thanks to Raoul Millais ) -* 0.9.5 - - OAuth1: Allow usage of HTTP verbs other than GET for retrieving the access and request tokens (Thanks to Raoul Millais) -* 0.9.4 - - OAuth1/2: Support for OAuth providers that drop connections (don't send response lengths? [Google]) - - OAuth2: Change getOAuthAccessToken to POST rather than GET ( Possible Breaking change!!! ... re-tested against Google, Github, Facebook, FourSquare and Janrain and seems ok .. is closer to the spec (v20) ) -* 0.9.3 - - OAuth1: Adds support for following 301 redirects (Thanks bdickason) -* 0.9.2 - - OAuth1: Correct content length calculated for non-ascii post bodies (Thanks selead) - - OAuth1: Allowed for configuration of the 'access token' name used when requesting protected resources (OAuth2) -* 0.9.1 - - OAuth1: Added support for automatically following 302 redirects (Thanks neyric) - - OAuth1: Added support for OAuth Echo (Thanks Ryan LeFevre). - - OAuth1: Improved handling of 2xx responses (Thanks Neil Mansilla). -* 0.9.0 - - OAuth1/2: Compatibility fixes to bring node-oauth up to speed with node.js 0.4x [thanks to Rasmus Andersson for starting the work ] -* 0.8.4 - - OAuth1: Fixed issue #14 (Parameter ordering ignored encodings). - - OAuth1: Added support for repeated parameter names. - - OAuth1/2: Implements issue #15 (Use native SHA1 if available, 10x speed improvement!). - - OAuth2: Fixed issue #16 (Should use POST when requesting access tokens.). - - OAuth2: Fixed Issue #17 (OAuth2 spec compliance). - - OAuth1: Implemented enhancement #13 (Adds support for PUT & DELETE http verbs). - - OAuth1: Fixes issue #18 (Complex/Composite url arguments [thanks novemberborn]) -* 0.8.3 - - OAuth1: Fixed an issue where the auth header code depended on the Array's toString method (Yohei Sasaki) Updated the getOAuthRequestToken method so we can access google's OAuth secured methods. Also re-implemented and fleshed out the test suite. -* 0.8.2 - - OAuth1: The request returning methods will now write the POST body if provided (Chris Anderson), the code responsible for manipulating the headers is a bit safe now when working with other code (Paul McKellar) - - Package: Tweaked the package.json to use index.js instead of main.js -* 0.8.1 - - OAuth1: Added mechanism to get hold of a signed Node Request object, ready for attaching response listeners etc. (Perfect for streaming APIs) -* 0.8.0 - - OAuth1: Standardised method capitalisation, the old getOauthAccessToken is now getOAuthAccessToken (Breaking change to existing code) -* 0.7.7 - - OAuth1: Looks like non oauth_ parameters where appearing within the Authorization headers, which I believe to be incorrect. -* 0.7.6 - - OAuth1: Added in oauth_verifier property to getAccessToken required for 1.0A -* 0.7.5 - - Package: Added in a main.js to simplify the require'ing of OAuth -* 0.7.4 - - OAuth1: Minor change to add an error listener to the OAuth client (thanks troyk) -* 0.7.3 - - OAuth2: Now sends a Content-Length Http header to keep nginx happy :) -* 0.7.2 - - OAuth1: Fixes some broken unit tests! -* 0.7.0 - - OAuth1/2: Introduces support for HTTPS end points and callback URLS for OAuth 1.0A and Oauth 2 (Please be aware that this was a breaking change to the constructor arguments order) - -Contributors (In no particular order) -===================================== - -* Ciaran Jessup - ciaranj@gmail.com -* Mark Wubben - http://equalmedia.com/ -* Ryan LeFevre - http://meltingice.net -* Raoul Millais -* Patrick Negri - http://github.com/pnegri -* Tang Bo Hao - http://github.com/btspoony -* Damien Mathieu - http://42.dmathieu.com -* Luke Baker - http://github.com/lukebaker -* Christian Schwarz - http://github.com/chrischw/ -* Joe Rozer - http://www.deadbytes.net -* Garrick Cheung - http://www.garrickcheung.com/ diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js deleted file mode 100644 index 3c7bf7f..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/server.js +++ /dev/null @@ -1,168 +0,0 @@ -var express = require('express'), - OAuth = require('oauth').OAuth, - querystring = require('querystring'); - -// Setup the Express.js server -var app = express.createServer(); -app.use(express.logger()); -app.use(express.bodyParser()); -app.use(express.cookieParser()); -app.use(express.session({ - secret: "skjghskdjfhbqigohqdiouk" -})); - -// Home Page -app.get('/', function(req, res){ - if(!req.session.oauth_access_token) { - res.redirect("/google_login"); - } - else { - res.redirect("/google_contacts"); - } -}); - -// Request an OAuth Request Token, and redirects the user to authorize it -app.get('/google_login', function(req, res) { - - var getRequestTokenUrl = "https://www.google.com/accounts/OAuthGetRequestToken"; - - // GData specifid: scopes that wa want access to - var gdataScopes = [ - querystring.escape("https://www.google.com/m8/feeds/"), - querystring.escape("https://www.google.com/calendar/feeds/") - ]; - - var oa = new OAuth(getRequestTokenUrl+"?scope="+gdataScopes.join('+'), - "https://www.google.com/accounts/OAuthGetAccessToken", - "anonymous", - "anonymous", - "1.0", - "http://localhost:3000/google_cb"+( req.param('action') && req.param('action') != "" ? "?action="http://github.com/+querystring.escape(req.param('action')) : "" ), - "HMAC-SHA1"); - - oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){ - if(error) { - console.log('error'); - console.log(error); - } - else { - // store the tokens in the session - req.session.oa = oa; - req.session.oauth_token = oauth_token; - req.session.oauth_token_secret = oauth_token_secret; - - // redirect the user to authorize the token - res.redirect("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="+oauth_token); - } - }) - -}); - -// Callback for the authorization page -app.get('/google_cb', function(req, res) { - - // get the OAuth access token with the 'oauth_verifier' that we received - - var oa = new OAuth(req.session.oa._requestUrl, - req.session.oa._accessUrl, - req.session.oa._consumerKey, - req.session.oa._consumerSecret, - req.session.oa._version, - req.session.oa._authorize_callback, - req.session.oa._signatureMethod); - - console.log(oa); - - oa.getOAuthAccessToken( - req.session.oauth_token, - req.session.oauth_token_secret, - req.param('oauth_verifier'), - function(error, oauth_access_token, oauth_access_token_secret, results2) { - - if(error) { - console.log('error'); - console.log(error); - } - else { - - // store the access token in the session - req.session.oauth_access_token = oauth_access_token; - req.session.oauth_access_token_secret = oauth_access_token_secret; - - res.redirect((req.param('action') && req.param('action') != "") ? req.param('action') : "/google_contacts"); - } - - }); - -}); - - -function require_google_login(req, res, next) { - if(!req.session.oauth_access_token) { - res.redirect("/google_login?action="+querystring.escape(req.originalUrl)); - return; - } - next(); -}; - -app.get('/google_contacts', require_google_login, function(req, res) { - var oa = new OAuth(req.session.oa._requestUrl, - req.session.oa._accessUrl, - req.session.oa._consumerKey, - req.session.oa._consumerSecret, - req.session.oa._version, - req.session.oa._authorize_callback, - req.session.oa._signatureMethod); - - console.log(oa); - - // Example using GData API v3 - // GData Specific Header - oa._headers['GData-Version'] = '3.0'; - - oa.getProtectedResource( - "https://www.google.com/m8/feeds/contacts/default/full?alt=json", - "GET", - req.session.oauth_access_token, - req.session.oauth_access_token_secret, - function (error, data, response) { - - var feed = JSON.parse(data); - - res.render('google_contacts.ejs', { - locals: { feed: feed } - }); - }); - -}); - -app.get('/google_calendars', require_google_login, function(req, res) { - var oa = new OAuth(req.session.oa._requestUrl, - req.session.oa._accessUrl, - req.session.oa._consumerKey, - req.session.oa._consumerSecret, - req.session.oa._version, - req.session.oa._authorize_callback, - req.session.oa._signatureMethod); - // Example using GData API v2 - // GData Specific Header - oa._headers['GData-Version'] = '2'; - - oa.getProtectedResource( - "https://www.google.com/calendar/feeds/default/allcalendars/full?alt=jsonc", - "GET", - req.session.oauth_access_token, - req.session.oauth_access_token_secret, - function (error, data, response) { - - var feed = JSON.parse(data); - - res.render('google_calendars.ejs', { - locals: { feed: feed } - }); - }); - -}); - -app.listen(3000); -console.log("listening on http://localhost:3000"); diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs deleted file mode 100644 index 15b826f..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs +++ /dev/null @@ -1,21 +0,0 @@ - -

    Check google_contacts

    - -

    Google Calendars

    - -<% for(var i = 0 ; i < feed.data.items.length ; i++ ) { - - var calendar = feed.data.items[i]; %> -
    - -

    "><%= calendar["title"] %>

    - -

    canEdit: <%= calendar["canEdit"] %>

    -

    accessLevel: <%= calendar["accessLevel"] %>

    -

    timeZone: <%= calendar["timeZone"] %>

    -

    kind: <%= calendar["kind"] %>

    -

    updated: <%= calendar["updated"] %>

    -

    created: <%= calendar["created"] %>

    - -
    -<% } %> \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs deleted file mode 100644 index a2050b2..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs +++ /dev/null @@ -1,24 +0,0 @@ - -

    Check google_calendars

    - -

    Google Contacts

    - -<% for(var i = 0 ; i < feed.feed.entry.length ; i++ ) { - - var contact = feed.feed.entry[i]; %> - -
    - - <%= contact["title"]["$t"] %> - <% emails = contact["gd$email"] %> - -
      - <% for(var j = 0 ; j < emails.length ; j++) { %> -
    • <%= emails[j]["address" ]%>
    • - <% } %> -
    - -
    - - -<% } %> diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs deleted file mode 100644 index 8d1ac6d..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/express-gdata/views/layout.ejs +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -<%- body %> - - - \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js deleted file mode 100644 index 91af05d..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js +++ /dev/null @@ -1,31 +0,0 @@ -var util= require('util') - -var OAuth= require('../lib/oauth').OAuth; - -var oa= new OAuth("http://term.ie/oauth/example/request_token.php", - "http://term.ie/oauth/example/access_token.php", - "key", - "secret", - "1.0", - null, - "HMAC-SHA1") - -oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){ - if(error) util.puts('error :' + error) - else { - util.puts('oauth_token :' + oauth_token) - util.puts('oauth_token_secret :' + oauth_token_secret) - util.puts('requestoken results :' + util.inspect(results)) - util.puts("Requesting access token") - oa.getOAuthAccessToken(oauth_token, oauth_token_secret, function(error, oauth_access_token, oauth_access_token_secret, results2) { - util.puts('oauth_access_token :' + oauth_access_token) - util.puts('oauth_token_secret :' + oauth_access_token_secret) - util.puts('accesstoken results :' + util.inspect(results2)) - util.puts("Requesting access token") - var data= ""; - oa.getProtectedResource("http://term.ie/oauth/example/echo_api.php?foo=bar&too=roo", "GET", oauth_access_token, oauth_access_token_secret, function (error, data, response) { - util.puts(data); - }); - }); - } -}) diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js deleted file mode 100644 index e20716d..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/index.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.OAuth = require("./lib/oauth").OAuth; -exports.OAuthEcho = require("./lib/oauth").OAuthEcho; -exports.OAuth2 = require("./lib/oauth2").OAuth2; \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js deleted file mode 100644 index 69fc300..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/_utils.js +++ /dev/null @@ -1,4 +0,0 @@ -// Returns true if this is a host that closes *before* it ends?!?! -module.exports.isAnEarlyCloseHost= function( hostName ) { - return hostName && hostName.match(".*google(apis)?.com$") -} \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js deleted file mode 100644 index be3c6d6..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js +++ /dev/null @@ -1,550 +0,0 @@ -var crypto= require('crypto'), - sha1= require('./sha1'), - http= require('http'), - https= require('https'), - URL= require('url'), - querystring= require('querystring'), - OAuthUtils= require('./_utils'); - -exports.OAuth= function(requestUrl, accessUrl, consumerKey, consumerSecret, version, authorize_callback, signatureMethod, nonceSize, customHeaders) { - this._isEcho = false; - - this._requestUrl= requestUrl; - this._accessUrl= accessUrl; - this._consumerKey= consumerKey; - this._consumerSecret= this._encodeData( consumerSecret ); - this._version= version; - if( authorize_callback === undefined ) { - this._authorize_callback= "oob"; - } - else { - this._authorize_callback= authorize_callback; - } - - if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1") - throw new Error("Un-supported signature method: " + signatureMethod ) - this._signatureMethod= signatureMethod; - this._nonceSize= nonceSize || 32; - this._headers= customHeaders || {"Accept" : "*/*", - "Connection" : "close", - "User-Agent" : "Node authentication"} - this._clientOptions= this._defaultClientOptions= {"requestTokenHttpMethod": "POST", - "accessTokenHttpMethod": "POST"}; - this._oauthParameterSeperator = ","; -}; - -exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) { - this._isEcho = true; - - this._realm= realm; - this._verifyCredentials = verify_credentials; - this._consumerKey= consumerKey; - this._consumerSecret= this._encodeData( consumerSecret ); - this._version= version; - - if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1") - throw new Error("Un-supported signature method: " + signatureMethod ); - this._signatureMethod= signatureMethod; - this._nonceSize= nonceSize || 32; - this._headers= customHeaders || {"Accept" : "*/*", - "Connection" : "close", - "User-Agent" : "Node authentication"}; - this._oauthParameterSeperator = ","; -} - -exports.OAuthEcho.prototype = exports.OAuth.prototype; - -exports.OAuth.prototype._getTimestamp= function() { - return Math.floor( (new Date()).getTime() / 1000 ); -} - -exports.OAuth.prototype._encodeData= function(toEncode){ - if( toEncode == null || toEncode == "" ) return "" - else { - var result= encodeURIComponent(toEncode); - // Fix the mismatch between OAuth's RFC3986's and Javascript's beliefs in what is right and wrong ;) - return result.replace(/\!/g, "%21") - .replace(/\'/g, "%27") - .replace(/\(/g, "%28") - .replace(/\)/g, "%29") - .replace(/\*/g, "%2A"); - } -} - -exports.OAuth.prototype._decodeData= function(toDecode) { - if( toDecode != null ) { - toDecode = toDecode.replace(/\+/g, " "); - } - return decodeURIComponent( toDecode); -} - -exports.OAuth.prototype._getSignature= function(method, url, parameters, tokenSecret) { - var signatureBase= this._createSignatureBase(method, url, parameters); - return this._createSignature( signatureBase, tokenSecret ); -} - -exports.OAuth.prototype._normalizeUrl= function(url) { - var parsedUrl= URL.parse(url, true) - var port =""; - if( parsedUrl.port ) { - if( (parsedUrl.protocol == "http:" && parsedUrl.port != "80" ) || - (parsedUrl.protocol == "https:" && parsedUrl.port != "443") ) { - port= ":" + parsedUrl.port; - } - } - - if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/"; - - return parsedUrl.protocol + "//" + parsedUrl.hostname + port + parsedUrl.pathname; -} - -// Is the parameter considered an OAuth parameter -exports.OAuth.prototype._isParameterNameAnOAuthParameter= function(parameter) { - var m = parameter.match('^oauth_'); - if( m && ( m[0] === "oauth_" ) ) { - return true; - } - else { - return false; - } -}; - -// build the OAuth request authorization header -exports.OAuth.prototype._buildAuthorizationHeaders= function(orderedParameters) { - var authHeader="OAuth "; - if( this._isEcho ) { - authHeader += 'realm="' + this._realm + '",'; - } - - for( var i= 0 ; i < orderedParameters.length; i++) { - // Whilst the all the parameters should be included within the signature, only the oauth_ arguments - // should appear within the authorization header. - if( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) { - authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\""+ this._oauthParameterSeperator; - } - } - - authHeader= authHeader.substring(0, authHeader.length-this._oauthParameterSeperator.length); - return authHeader; -} - -// Takes an object literal that represents the arguments, and returns an array -// of argument/value pairs. -exports.OAuth.prototype._makeArrayOfArgumentsHash= function(argumentsHash) { - var argument_pairs= []; - for(var key in argumentsHash ) { - var value= argumentsHash[key]; - if( Array.isArray(value) ) { - for(var i=0;i= 200 && response.statusCode <= 299 ) { - callback(null, data, response); - } else { - // Follow 301 or 302 redirects with Location HTTP header - if((response.statusCode == 301 || response.statusCode == 302) && response.headers && response.headers.location) { - self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback); - } - else { - callback({ statusCode: response.statusCode, data: data }, data, response); - } - } - } - } - - request.on('response', function (response) { - response.setEncoding('utf8'); - response.on('data', function (chunk) { - data+=chunk; - }); - response.on('end', function () { - passBackControl( response ); - }); - response.on('close', function () { - if( allowEarlyClose ) { - passBackControl( response ); - } - }); - }); - - request.on("error", function(err) { - callbackCalled= true; - callback( err ) - }); - - if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) { - request.write(post_body); - } - request.end(); - } - else { - if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) { - request.write(post_body); - } - return request; - } - - return; -} - -exports.OAuth.prototype.setClientOptions= function(options) { - var key, - mergedOptions= {}, - hasOwnProperty= Object.prototype.hasOwnProperty; - - for( key in this._defaultClientOptions ) { - if( !hasOwnProperty.call(options, key) ) { - mergedOptions[key]= this._defaultClientOptions[key]; - } else { - mergedOptions[key]= options[key]; - } - } - - this._clientOptions= mergedOptions; -}; - -exports.OAuth.prototype.getOAuthAccessToken= function(oauth_token, oauth_token_secret, oauth_verifier, callback) { - var extraParams= {}; - if( typeof oauth_verifier == "function" ) { - callback= oauth_verifier; - } else { - extraParams.oauth_verifier= oauth_verifier; - } - - this._performSecureRequest( oauth_token, oauth_token_secret, this._clientOptions.accessTokenHttpMethod, this._accessUrl, extraParams, null, null, function(error, data, response) { - if( error ) callback(error); - else { - var results= querystring.parse( data ); - var oauth_access_token= results["oauth_token"]; - delete results["oauth_token"]; - var oauth_access_token_secret= results["oauth_token_secret"]; - delete results["oauth_token_secret"]; - callback(null, oauth_access_token, oauth_access_token_secret, results ); - } - }) -} - -// Deprecated -exports.OAuth.prototype.getProtectedResource= function(url, method, oauth_token, oauth_token_secret, callback) { - this._performSecureRequest( oauth_token, oauth_token_secret, method, url, null, "", null, callback ); -} - -exports.OAuth.prototype.delete= function(url, oauth_token, oauth_token_secret, callback) { - return this._performSecureRequest( oauth_token, oauth_token_secret, "DELETE", url, null, "", null, callback ); -} - -exports.OAuth.prototype.get= function(url, oauth_token, oauth_token_secret, callback) { - return this._performSecureRequest( oauth_token, oauth_token_secret, "GET", url, null, "", null, callback ); -} - -exports.OAuth.prototype._putOrPost= function(method, url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { - var extra_params= null; - if( typeof post_content_type == "function" ) { - callback= post_content_type; - post_content_type= null; - } - if( typeof post_body != "string" ) { - post_content_type= "application/x-www-form-urlencoded" - extra_params= post_body; - post_body= null; - } - return this._performSecureRequest( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ); -} - - -exports.OAuth.prototype.put= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { - return this._putOrPost("PUT", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback); -} - -exports.OAuth.prototype.post= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) { - return this._putOrPost("POST", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback); -} - -/** - * Gets a request token from the OAuth provider and passes that information back - * to the calling code. - * - * The callback should expect a function of the following form: - * - * function(err, token, token_secret, parsedQueryString) {} - * - * This method has optional parameters so can be called in the following 2 ways: - * - * 1) Primary use case: Does a basic request with no extra parameters - * getOAuthRequestToken( callbackFunction ) - * - * 2) As above but allows for provision of extra parameters to be sent as part of the query to the server. - * getOAuthRequestToken( extraParams, callbackFunction ) - * - * N.B. This method will HTTP POST verbs by default, if you wish to override this behaviour you will - * need to provide a requestTokenHttpMethod option when creating the client. - * - **/ -exports.OAuth.prototype.getOAuthRequestToken= function( extraParams, callback ) { - if( typeof extraParams == "function" ){ - callback = extraParams; - extraParams = {}; - } - // Callbacks are 1.0A related - if( this._authorize_callback ) { - extraParams["oauth_callback"]= this._authorize_callback; - } - this._performSecureRequest( null, null, this._clientOptions.requestTokenHttpMethod, this._requestUrl, extraParams, null, null, function(error, data, response) { - if( error ) callback(error); - else { - var results= querystring.parse(data); - - var oauth_token= results["oauth_token"]; - var oauth_token_secret= results["oauth_token_secret"]; - delete results["oauth_token"]; - delete results["oauth_token_secret"]; - callback(null, oauth_token, oauth_token_secret, results ); - } - }); -} - -exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) { - - if( method === undefined ) { - var method= "GET"; - } - - var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {}); - var parsedUrl= URL.parse( url, false ); - - var query=""; - for( var i= 0 ; i < orderedParameters.length; i++) { - query+= orderedParameters[i][0]+"="+ this._encodeData(orderedParameters[i][1]) + "&"; - } - query= query.substring(0, query.length-1); - - return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query; -}; - -exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method) { - if( method === undefined ) { - var method= "GET"; - } - - var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {}); - return this._buildAuthorizationHeaders(orderedParameters); -}; diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js deleted file mode 100644 index 191d3ef..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js +++ /dev/null @@ -1,161 +0,0 @@ -var querystring= require('querystring'), - crypto= require('crypto'), - https= require('https'), - http= require('http'), - URL= require('url'), - OAuthUtils= require('./_utils'); - -exports.OAuth2= function(clientId, clientSecret, baseSite, authorizePath, accessTokenPath) { - this._clientId= clientId; - this._clientSecret= clientSecret; - this._baseSite= baseSite; - this._authorizeUrl= authorizePath || "/oauth/authorize"; - this._accessTokenUrl= accessTokenPath || "/oauth/access_token"; - this._accessTokenName= "access_token"; -} - -// This 'hack' method is required for sites that don't use -// 'access_token' as the name of the access token (for requests). -// ( http://tools.ietf.org/html/draft-ietf-oauth-v2-16#section-7 ) -// it isn't clear what the correct value should be atm, so allowing -// for specific (temporary?) override for now. -exports.OAuth2.prototype.setAccessTokenName= function ( name ) { - this._accessTokenName= name; -} - -exports.OAuth2.prototype._getAccessTokenUrl= function() { - return this._baseSite + this._accessTokenUrl; /* + "?" + querystring.stringify(params); */ -} - -exports.OAuth2.prototype._request= function(method, url, headers, post_body, access_token, callback) { - - var http_library= https; - var creds = crypto.createCredentials({ }); - var parsedUrl= URL.parse( url, true ); - if( parsedUrl.protocol == "https:" && !parsedUrl.port ) { - parsedUrl.port= 443; - } - - // As this is OAUth2, we *assume* https unless told explicitly otherwise. - if( parsedUrl.protocol != "https:" ) { - http_library= http; - } - - var realHeaders= {}; - if( headers ) { - for(var key in headers) { - realHeaders[key] = headers[key]; - } - } - realHeaders['Host']= parsedUrl.host; - - realHeaders['Content-Length']= post_body ? Buffer.byteLength(post_body) : 0; - if( access_token ) { - if( ! parsedUrl.query ) parsedUrl.query= {}; - parsedUrl.query[this._accessTokenName]= access_token; - } - - var result= ""; - var queryStr= querystring.stringify(parsedUrl.query); - if( queryStr ) queryStr= "?" + queryStr; - var options = { - host:parsedUrl.hostname, - port: parsedUrl.port, - path: parsedUrl.pathname + queryStr, - method: method, - headers: realHeaders - }; - - // Some hosts *cough* google appear to close the connection early / send no content-length header - // allow this behaviour. - var allowEarlyClose= OAuthUtils.isAnEarlyCloseHost(options.host); - var callbackCalled= false; - function passBackControl( response, result ) { - if(!callbackCalled) { - callbackCalled=true; - if( response.statusCode != 200 && (response.statusCode != 301) && (response.statusCode != 302) ) { - callback({ statusCode: response.statusCode, data: result }); - } else { - callback(null, result, response); - } - } - } - - var request = http_library.request(options, function (response) { - response.on("data", function (chunk) { - result+= chunk - }); - response.on("close", function (err) { - if( allowEarlyClose ) { - passBackControl( response, result ); - } - }); - response.addListener("end", function () { - passBackControl( response, result ); - }); - }); - request.on('error', function(e) { - callbackCalled= true; - callback(e); - }); - - if( method == 'POST' && post_body ) { - request.write(post_body); - } - request.end(); -} - - -exports.OAuth2.prototype.getAuthorizeUrl= function( params ) { - var params= params || {}; - params['client_id'] = this._clientId; - params['type'] = 'web_server'; - return this._baseSite + this._authorizeUrl + "?" + querystring.stringify(params); -} - -exports.OAuth2.prototype.getOAuthAccessToken= function(code, params, callback) { - var params= params || {}; - params['client_id'] = this._clientId; - params['client_secret'] = this._clientSecret; - params['type']= 'web_server'; - var codeParam = (params.grant_type === 'refresh_token') ? 'refresh_token' : 'code'; - params[codeParam]= code; - - var post_data= querystring.stringify( params ); - var post_headers= { - 'Content-Type': 'application/x-www-form-urlencoded' - }; - - - this._request("POST", this._getAccessTokenUrl(), post_headers, post_data, null, function(error, data, response) { - if( error ) callback(error); - else { - var results; - try { - // As of http://tools.ietf.org/html/draft-ietf-oauth-v2-07 - // responses should be in JSON - results= JSON.parse( data ); - } - catch(e) { - // .... However both Facebook + Github currently use rev05 of the spec - // and neither seem to specify a content-type correctly in their response headers :( - // clients of these services will suffer a *minor* performance cost of the exception - // being thrown - results= querystring.parse( data ); - } - var access_token= results["access_token"]; - var refresh_token= results["refresh_token"]; - delete results["refresh_token"]; - callback(null, access_token, refresh_token, results); // callback results =-= - } - }); -} - -// Deprecated -exports.OAuth2.prototype.getProtectedResource= function(url, access_token, callback) { - this._request("GET", url, {}, "", access_token, callback ); -} - -exports.OAuth2.prototype.get= function(url, access_token, callback) { - this._request("GET", url, {}, "", access_token, callback ); -} diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js deleted file mode 100644 index d73277a..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/sha1.js +++ /dev/null @@ -1,334 +0,0 @@ -/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS 180-1 - * Version 2.2 Copyright Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. - */ - -/* - * Configurable variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - */ -var hexcase = 1; /* hex output format. 0 - lowercase; 1 - uppercase */ -var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ - -/* - * These are the functions you'll usually want to call - * They take string arguments and return either hex or base-64 encoded strings - */ -function hex_sha1(s) { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); } -function b64_sha1(s) { return rstr2b64(rstr_sha1(str2rstr_utf8(s))); } -function any_sha1(s, e) { return rstr2any(rstr_sha1(str2rstr_utf8(s)), e); } -function hex_hmac_sha1(k, d) - { return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); } -function b64_hmac_sha1(k, d) - { return rstr2b64(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); } -function any_hmac_sha1(k, d, e) - { return rstr2any(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d)), e); } - -/* - * Perform a simple self-test to see if the VM is working - */ -function sha1_vm_test() -{ - return hex_sha1("abc").toLowerCase() == "a9993e364706816aba3e25717850c26c9cd0d89d"; -} - -/* - * Calculate the SHA1 of a raw string - */ -function rstr_sha1(s) -{ - return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8)); -} - -/* - * Calculate the HMAC-SHA1 of a key and some data (raw strings) - */ -function rstr_hmac_sha1(key, data) -{ - var bkey = rstr2binb(key); - if(bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8); - - var ipad = Array(16), opad = Array(16); - for(var i = 0; i < 16; i++) - { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8); - return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160)); -} - -/* - * Convert a raw string to a hex string - */ -function rstr2hex(input) -{ - try { hexcase } catch(e) { hexcase=0; } - var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; - var output = ""; - var x; - for(var i = 0; i < input.length; i++) - { - x = input.charCodeAt(i); - output += hex_tab.charAt((x >>> 4) & 0x0F) - + hex_tab.charAt( x & 0x0F); - } - return output; -} - -/* - * Convert a raw string to a base-64 string - */ -function rstr2b64(input) -{ - try { b64pad } catch(e) { b64pad=''; } - var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var output = ""; - var len = input.length; - for(var i = 0; i < len; i += 3) - { - var triplet = (input.charCodeAt(i) << 16) - | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0) - | (i + 2 < len ? input.charCodeAt(i+2) : 0); - for(var j = 0; j < 4; j++) - { - if(i * 8 + j * 6 > input.length * 8) output += b64pad; - else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F); - } - } - return output; -} - -/* - * Convert a raw string to an arbitrary string encoding - */ -function rstr2any(input, encoding) -{ - var divisor = encoding.length; - var remainders = Array(); - var i, q, x, quotient; - - /* Convert to an array of 16-bit big-endian values, forming the dividend */ - var dividend = Array(Math.ceil(input.length / 2)); - for(i = 0; i < dividend.length; i++) - { - dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1); - } - - /* - * Repeatedly perform a long division. The binary array forms the dividend, - * the length of the encoding is the divisor. Once computed, the quotient - * forms the dividend for the next step. We stop when the dividend is zero. - * All remainders are stored for later use. - */ - while(dividend.length > 0) - { - quotient = Array(); - x = 0; - for(i = 0; i < dividend.length; i++) - { - x = (x << 16) + dividend[i]; - q = Math.floor(x / divisor); - x -= q * divisor; - if(quotient.length > 0 || q > 0) - quotient[quotient.length] = q; - } - remainders[remainders.length] = x; - dividend = quotient; - } - - /* Convert the remainders to the output string */ - var output = ""; - for(i = remainders.length - 1; i >= 0; i--) - output += encoding.charAt(remainders[i]); - - /* Append leading zero equivalents */ - var full_length = Math.ceil(input.length * 8 / - (Math.log(encoding.length) / Math.log(2))) - for(i = output.length; i < full_length; i++) - output = encoding[0] + output; - - return output; -} - -/* - * Encode a string as utf-8. - * For efficiency, this assumes the input is valid utf-16. - */ -function str2rstr_utf8(input) -{ - var output = ""; - var i = -1; - var x, y; - - while(++i < input.length) - { - /* Decode utf-16 surrogate pairs */ - x = input.charCodeAt(i); - y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; - if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) - { - x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF); - i++; - } - - /* Encode output as utf-8 */ - if(x <= 0x7F) - output += String.fromCharCode(x); - else if(x <= 0x7FF) - output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F), - 0x80 | ( x & 0x3F)); - else if(x <= 0xFFFF) - output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), - 0x80 | ((x >>> 6 ) & 0x3F), - 0x80 | ( x & 0x3F)); - else if(x <= 0x1FFFFF) - output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), - 0x80 | ((x >>> 12) & 0x3F), - 0x80 | ((x >>> 6 ) & 0x3F), - 0x80 | ( x & 0x3F)); - } - return output; -} - -/* - * Encode a string as utf-16 - */ -function str2rstr_utf16le(input) -{ - var output = ""; - for(var i = 0; i < input.length; i++) - output += String.fromCharCode( input.charCodeAt(i) & 0xFF, - (input.charCodeAt(i) >>> 8) & 0xFF); - return output; -} - -function str2rstr_utf16be(input) -{ - var output = ""; - for(var i = 0; i < input.length; i++) - output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, - input.charCodeAt(i) & 0xFF); - return output; -} - -/* - * Convert a raw string to an array of big-endian words - * Characters >255 have their high-byte silently ignored. - */ -function rstr2binb(input) -{ - var output = Array(input.length >> 2); - for(var i = 0; i < output.length; i++) - output[i] = 0; - for(var i = 0; i < input.length * 8; i += 8) - output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32); - return output; -} - -/* - * Convert an array of big-endian words to a string - */ -function binb2rstr(input) -{ - var output = ""; - for(var i = 0; i < input.length * 32; i += 8) - output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF); - return output; -} - -/* - * Calculate the SHA-1 of an array of big-endian words, and a bit length - */ -function binb_sha1(x, len) -{ - /* append padding */ - x[len >> 5] |= 0x80 << (24 - len % 32); - x[((len + 64 >> 9) << 4) + 15] = len; - - var w = Array(80); - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - var e = -1009589776; - - for(var i = 0; i < x.length; i += 16) - { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - var olde = e; - - for(var j = 0; j < 80; j++) - { - if(j < 16) w[j] = x[i + j]; - else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); - var t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), - safe_add(safe_add(e, w[j]), sha1_kt(j))); - e = d; - d = c; - c = bit_rol(b, 30); - b = a; - a = t; - } - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - e = safe_add(e, olde); - } - return Array(a, b, c, d, e); - -} - -/* - * Perform the appropriate triplet combination function for the current - * iteration - */ -function sha1_ft(t, b, c, d) -{ - if(t < 20) return (b & c) | ((~b) & d); - if(t < 40) return b ^ c ^ d; - if(t < 60) return (b & c) | (b & d) | (c & d); - return b ^ c ^ d; -} - -/* - * Determine the appropriate additive constant for the current iteration - */ -function sha1_kt(t) -{ - return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : - (t < 60) ? -1894007588 : -899497514; -} - -/* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ -function safe_add(x, y) -{ - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); -} - -/* - * Bitwise rotate a 32-bit number to the left. - */ -function bit_rol(num, cnt) -{ - return (num << cnt) | (num >>> (32 - cnt)); -} - -exports.HMACSHA1= function(key, data) { - return b64_hmac_sha1(key, data); -} \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json deleted file mode 100644 index e685046..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ "name" : "oauth" -, "description" : "Library for interacting with OAuth 1.0, 1.0A, 2 and Echo. Provides simplified client access and allows for construction of more complex apis and OAuth providers." -, "version" : "0.9.8" -, "directories" : { "lib" : "./lib" } -, "main" : "index.js" -, "author" : "Ciaran Jessup " -, "repository" : { "type":"git", "url":"http://github.com/ciaranj/node-oauth.git" } -, "devDependencies": { - "vows": "0.5.x" - } -, "scripts": { - "test": "make test" - } -, "licenses" : - [ { "type" : "MIT" - , "url" : "http://github.com/ciaranj/node-oauth/raw/master/LICENSE" - } - ] -} diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js deleted file mode 100644 index b0a4a90..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth.js +++ /dev/null @@ -1,792 +0,0 @@ -var vows = require('vows'), - assert = require('assert'), - events = require('events'), - OAuth= require('../lib/oauth').OAuth, - OAuthEcho= require('../lib/oauth').OAuthEcho; - -var DummyResponse =function( statusCode ) { - this.statusCode= statusCode; - this.headers= {}; -} -DummyResponse.prototype= events.EventEmitter.prototype; -DummyResponse.prototype.setEncoding= function() {} - -var DummyRequest =function( response ) { - this.response= response; -} -DummyRequest.prototype= events.EventEmitter.prototype; -DummyRequest.prototype.write= function(post_body){} -DummyRequest.prototype.write= function(post_body){ - this.emit('response',this.response); -} -DummyRequest.prototype.end= function(){ - this.response.emit('end'); -} - -vows.describe('OAuth').addBatch({ - 'When generating the signature base string described in http://oauth.net/core/1.0/#sig_base_example': { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'we get the expected result string': function (oa) { - var result= oa._createSignatureBase("GET", "http://photos.example.net/photos", - "file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original") - assert.equal( result, "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"); - } - }, - 'When generating the signature base string with PLAINTEXT': { - topic: new OAuth(null, null, null, null, null, null, "PLAINTEXT"), - 'we get the expected result string': function (oa) { - var result= oa._getSignature("GET", "http://photos.example.net/photos", - "file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=PLAINTEXT&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original", - "test"); - assert.equal( result, "&test"); - } - }, - 'When normalising a url': { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'default ports should be stripped': function(oa) { - assert.equal( oa._normalizeUrl("https://somehost.com/foo/bar"), "https://somehost.com/foo/bar" ); - }, - 'should leave in non-default ports from urls for use in signature generation': function(oa) { - assert.equal( oa._normalizeUrl("https://somehost.com:446/foo/bar"), "https://somehost.com:446/foo/bar" ); - assert.equal( oa._normalizeUrl("http://somehost.com:81/foo/bar"), "http://somehost.com:81/foo/bar" ); - }, - 'should add a trailing slash when no path at all is present': function(oa) { - assert.equal( oa._normalizeUrl("http://somehost.com/"), "http://somehost.com/") - } - }, - 'When making an array out of the arguments hash' : { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'flatten out arguments that are arrays' : function(oa) { - var parameters= {"z": "a", - "a": ["1", "2"], - "1": "c" }; - var parameterResults= oa._makeArrayOfArgumentsHash(parameters); - assert.equal(parameterResults.length, 4); - assert.equal(parameterResults[0][0], "1"); - assert.equal(parameterResults[1][0], "z"); - assert.equal(parameterResults[2][0], "a"); - assert.equal(parameterResults[3][0], "a"); - } - }, - 'When ordering the request parameters' : { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'Order them by name' : function(oa) { - var parameters= {"z": "a", - "a": "b", - "1": "c" }; - var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters)) - assert.equal(parameterResults[0][0], "1"); - assert.equal(parameterResults[1][0], "a"); - assert.equal(parameterResults[2][0], "z"); - }, - 'If two parameter names are the same then order by the value': function(oa) { - var parameters= {"z": "a", - "a": ["z", "b", "b", "a", "y"], - "1": "c" }; - var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters)) - assert.equal(parameterResults[0][0], "1"); - assert.equal(parameterResults[1][0], "a"); - assert.equal(parameterResults[1][1], "a"); - assert.equal(parameterResults[2][0], "a"); - assert.equal(parameterResults[2][1], "b"); - assert.equal(parameterResults[3][0], "a"); - assert.equal(parameterResults[3][1], "b"); - assert.equal(parameterResults[4][0], "a"); - assert.equal(parameterResults[4][1], "y"); - assert.equal(parameterResults[5][0], "a"); - assert.equal(parameterResults[5][1], "z"); - assert.equal(parameterResults[6][0], "z"); - } - }, - 'When normalising the request parameters': { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'the resulting parameters should be encoded and ordered as per http://tools.ietf.org/html/rfc5849#section-3.1 (3.4.1.3.2)' : function(oa) { - var parameters= {"b5" : "=%3D", - "a3": ["a", "2 q"], - "c@": "", - "a2": "r b", - "oauth_consumer_key": "9djdj82h48djs9d2", - "oauth_token":"kkk9d7dh3k39sjv7", - "oauth_signature_method": "HMAC-SHA1", - "oauth_timestamp": "137131201", - "oauth_nonce": "7d8f3e4a", - "c2" : ""}; - var normalisedParameterString= oa._normaliseRequestParams(parameters); - assert.equal(normalisedParameterString, "a2=r%20b&a3=2%20q&a3=a&b5=%3D%253D&c%40=&c2=&oauth_consumer_key=9djdj82h48djs9d2&oauth_nonce=7d8f3e4a&oauth_signature_method=HMAC-SHA1&oauth_timestamp=137131201&oauth_token=kkk9d7dh3k39sjv7"); - } - }, - 'When preparing the parameters for use in signing': { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'We need to be wary of node\'s auto object creation from foo[bar] style url parameters' : function(oa) { - var result= oa._prepareParameters( "", "", "", "http://foo.com/?foo[bar]=xxx&bar[foo]=yyy", {} ); - assert.equal( result[0][0], "bar[foo]") - assert.equal( result[0][1], "yyy") - assert.equal( result[1][0], "foo[bar]") - assert.equal( result[1][1], "xxx") - } - }, - 'When signing a url': { - topic: function() { - var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); - oa._getTimestamp= function(){ return "1272399856"; } - oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } - return oa; - }, - 'Provide a valid signature when no token present': function(oa) { - assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_version=1.0&oauth_signature=7ytO8vPSLut2GzHjU9pn1SV9xjc%3D"); - }, - 'Provide a valid signature when a token is present': function(oa) { - assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_token=token&oauth_version=1.0&oauth_signature=9LwCuCWw5sURtpMroIolU3YwsdI%3D"); - }, - 'Provide a valid signature when a token and a token secret is present': function(oa) { - assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_token=token&oauth_version=1.0&oauth_signature=zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"); - } - }, - 'When getting a request token': { - topic: function() { - var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); - oa._getTimestamp= function(){ return "1272399856"; } - oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } - oa._performSecureRequest= function(){ return this.requestArguments = arguments; } - return oa; - }, - 'Use the HTTP method in the client options': function(oa) { - oa.setClientOptions({ requestTokenHttpMethod: "GET" }); - oa.getOAuthRequestToken(function() {}); - assert.equal(oa.requestArguments[2], "GET"); - }, - 'Use a POST by default': function(oa) { - oa.setClientOptions({}); - oa.getOAuthRequestToken(function() {}); - assert.equal(oa.requestArguments[2], "POST"); - } - }, - 'When getting an access token': { - topic: function() { - var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); - oa._getTimestamp= function(){ return "1272399856"; } - oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } - oa._performSecureRequest= function(){ return this.requestArguments = arguments; } - return oa; - }, - 'Use the HTTP method in the client options': function(oa) { - oa.setClientOptions({ accessTokenHttpMethod: "GET" }); - oa.getOAuthAccessToken(function() {}); - assert.equal(oa.requestArguments[2], "GET"); - }, - 'Use a POST by default': function(oa) { - oa.setClientOptions({}); - oa.getOAuthAccessToken(function() {}); - assert.equal(oa.requestArguments[2], "POST"); - } - }, - 'When get authorization header' : { - topic: function() { - var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1"); - oa._getTimestamp= function(){ return "1272399856"; } - oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } - return oa; - }, - 'Provide a valid signature when a token and a token secret is present': function(oa) { - assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0",oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); - }, - 'Support variable whitespace separating the arguments': function(oa) { - oa._oauthParameterSeperator= ", "; - assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey", oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1272399856", oauth_token="token", oauth_version="1.0", oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); - } - }, - 'When get the OAuth Echo authorization header': { - topic: function () { - var realm = "http://foobar.com/"; - var verifyCredentials = "http://api.foobar.com/verify.json"; - var oa = new OAuthEcho(realm, verifyCredentials, "consumerkey", "consumersecret", "1.0A", "HMAC-SHA1"); - oa._getTimestamp= function(){ return "1272399856"; } - oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; } - return oa; - }, - 'Provide a valid signature when a token and token secret is present': function (oa) { - assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth realm="http://foobar.com/",oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0A",oauth_signature="0rr1LhSxACX2IEWRq3uCb4IwtOs%3D"'); - } - }, - 'When non standard ports are used': { - topic: function() { - var oa= new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - mockProvider= {}; - - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers.Host, "somehost.com:8080"); - assert.equal(hostname, "somehost.com"); - assert.equal(port, "8080"); - return { - on: function() {}, - end: function() {} - }; - } - return oa; - }, - 'getProtectedResource should correctly define the host headers': function(oa) { - oa.getProtectedResource("http://somehost.com:8080/", "GET", "oauth_token", null, function(){}) - } - }, - 'When building the OAuth Authorization header': { - topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), - 'All provided oauth arguments should be concatentated correctly' : function(oa) { - var parameters= [ - ["oauth_timestamp", "1234567"], - ["oauth_nonce", "ABCDEF"], - ["oauth_version", "1.0"], - ["oauth_signature_method", "HMAC-SHA1"], - ["oauth_consumer_key", "asdasdnm2321b3"]]; - assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); - }, - '*Only* Oauth arguments should be concatentated, others should be disregarded' : function(oa) { - var parameters= [ - ["foo", "2343"], - ["oauth_timestamp", "1234567"], - ["oauth_nonce", "ABCDEF"], - ["bar", "dfsdfd"], - ["oauth_version", "1.0"], - ["oauth_signature_method", "HMAC-SHA1"], - ["oauth_consumer_key", "asdasdnm2321b3"], - ["foobar", "asdasdnm2321b3"]]; - assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); - }, - '_buildAuthorizationHeaders should not depends on Array.prototype.toString' : function(oa) { - var _toString = Array.prototype.toString; - Array.prototype.toString = function(){ return '[Array] ' + this.length; }; // toString overwrite example used in jsdom. - var parameters= [ - ["foo", "2343"], - ["oauth_timestamp", "1234567"], - ["oauth_nonce", "ABCDEF"], - ["bar", "dfsdfd"], - ["oauth_version", "1.0"], - ["oauth_signature_method", "HMAC-SHA1"], - ["oauth_consumer_key", "asdasdnm2321b3"], - ["foobar", "asdasdnm2321b3"]]; - assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"'); - Array.prototype.toString = _toString; - } - }, - 'When performing the Secure Request' : { - topic: new OAuth("http://foo.com/RequestToken", - "http://foo.com/AccessToken", - "anonymous", "anonymous", - "1.0A", "http://foo.com/callback", "HMAC-SHA1"), - 'using the POST method' : { - 'Any passed extra_params should form part of the POST body': function(oa) { - var post_body_written= false; - var op= oa._createClient; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return { - write: function(post_body){ - post_body_written= true; - assert.equal(post_body,"scope=foobar%2C1%2C2"); - } - }; - } - oa._performSecureRequest("token", "token_secret", 'POST', 'http://foo.com/protected_resource', {"scope": "foobar,1,2"}); - assert.equal(post_body_written, true); - } - finally { - oa._createClient= op; - } - } - } - }, - 'When performing a secure' : { - topic: new OAuth("http://foo.com/RequestToken", - "http://foo.com/AccessToken", - "anonymous", "anonymous", - "1.0A", "http://foo.com/callback", "HMAC-SHA1"), - 'POST' : { - 'if no callback is passed' : { - 'it should return a request object': function(oa) { - var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain") - assert.isObject(request); - assert.equal(request.method, "POST"); - request.end(); - } - }, - 'if a callback is passed' : { - "it should call the internal request's end method and return nothing": function(oa) { - var callbackCalled= false; - var op= oa._createClient; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return { - write: function(){}, - on: function() {}, - end: function() { - callbackCalled= true; - } - }; - } - var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){}) - assert.equal(callbackCalled, true); - assert.isUndefined(request); - } - finally { - oa._createClient= op; - } - } - }, - 'if the post_body is not a string' : { - "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded") - return { - write: function(data){ - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - }, - on: function() {}, - end: function() { - } - }; - } - var request= oa.post("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"}) - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - }, - 'if the post_body is a string' : { - "and it contains non ascii (7/8bit) characters" : { - "the content length should be the byte count, and not the string length" : function(oa) { - var testString= "Tôi yêu node"; - var testStringLength= testString.length; - var testStringBytesLength= Buffer.byteLength(testString); - assert.notEqual(testStringLength, testStringBytesLength); // Make sure we're testing a string that differs between byte-length and char-length! - - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-length"], testStringBytesLength); - return { - write: function(data){ - callbackCalled= true; - assert.equal(data, testString); - }, - on: function() {}, - end: function() { - } - }; - } - var request= oa.post("http://foo.com/blah", "token", "token_secret", "Tôi yêu node") - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - }, - "and no post_content_type is specified" : { - "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded"); - assert.equal(headers["Content-length"], 23); - return { - write: function(data){ - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - }, - on: function() {}, - end: function() { - } - }; - } - var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2") - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - }, - "and a post_content_type is specified" : { - "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "unicorn/encoded"); - assert.equal(headers["Content-length"], 23); - return { - write: function(data){ - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - }, - on: function() {}, - end: function() { - } - }; - } - var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded") - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - } - } - }, - 'GET' : { - 'if no callback is passed' : { - 'it should return a request object': function(oa) { - var request= oa.get("http://foo.com/blah", "token", "token_secret") - assert.isObject(request); - assert.equal(request.method, "GET"); - request.end(); - } - }, - 'if a callback is passed' : { - "it should call the internal request's end method and return nothing": function(oa) { - var callbackCalled= false; - var op= oa._createClient; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return { - on: function() {}, - end: function() { - callbackCalled= true; - } - }; - } - var request= oa.get("http://foo.com/blah", "token", "token_secret", function(e,d) {}) - assert.equal(callbackCalled, true); - assert.isUndefined(request); - } - finally { - oa._createClient= op; - } - } - } - }, - 'PUT' : { - 'if no callback is passed' : { - 'it should return a request object': function(oa) { - var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain") - assert.isObject(request); - assert.equal(request.method, "PUT"); - request.end(); - } - }, - 'if a callback is passed' : { - "it should call the internal request's end method and return nothing": function(oa) { - var callbackCalled= 0; - var op= oa._createClient; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return { - on: function() {}, - write: function(data) { - callbackCalled++; - }, - end: function() { - callbackCalled++; - } - }; - } - var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){}) - assert.equal(callbackCalled, 2); - assert.isUndefined(request); - } - finally { - oa._createClient= op; - } - } - }, - 'if the post_body is not a string' : { - "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded") - return { - write: function(data) { - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - } - }; - } - var request= oa.put("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"}) - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - }, - 'if the post_body is a string' : { - "and no post_content_type is specified" : { - "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded"); - assert.equal(headers["Content-length"], 23); - return { - write: function(data) { - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - } - }; - } - var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2") - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - }, - "and a post_content_type is specified" : { - "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) { - var op= oa._createClient; - try { - var callbackCalled= false; - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - assert.equal(headers["Content-Type"], "unicorn/encoded"); - assert.equal(headers["Content-length"], 23); - return { - write: function(data) { - callbackCalled= true; - assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2"); - } - }; - } - var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded") - assert.equal(callbackCalled, true); - } - finally { - oa._createClient= op; - } - } - } - } - }, - 'DELETE' : { - 'if no callback is passed' : { - 'it should return a request object': function(oa) { - var request= oa.delete("http://foo.com/blah", "token", "token_secret") - assert.isObject(request); - assert.equal(request.method, "DELETE"); - request.end(); - } - }, - 'if a callback is passed' : { - "it should call the internal request's end method and return nothing": function(oa) { - var callbackCalled= false; - var op= oa._createClient; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return { - on: function() {}, - end: function() { - callbackCalled= true; - } - }; - } - var request= oa.delete("http://foo.com/blah", "token", "token_secret", function(e,d) {}) - assert.equal(callbackCalled, true); - assert.isUndefined(request); - } - finally { - oa._createClient= op; - } - } - } - }, - 'Request With a Callback' : { - 'and a 200 response code is received' : { - 'it should callback successfully' : function(oa) { - var op= oa._createClient; - var callbackCalled = false; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse(200) ); - } - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { - // callback - callbackCalled= true; - assert.equal(error, undefined); - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - } - } - }, - 'and a 210 response code is received' : { - 'it should callback successfully' : function(oa) { - var op= oa._createClient; - var callbackCalled = false; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse(210) ); - } - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { - // callback - callbackCalled= true; - assert.equal(error, undefined); - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - } - } - }, - 'And A 301 redirect is received' : { - 'and there is a location header' : { - 'it should (re)perform the secure request but with the new location' : function(oa) { - var op= oa._createClient; - var psr= oa._performSecureRequest; - var responseCounter = 1; - var callbackCalled = false; - var DummyResponse =function() { - if( responseCounter == 1 ){ - this.statusCode= 301; - this.headers= {location:"http://redirectto.com/"}; - responseCounter++; - } - else { - this.statusCode= 200; - } - } - DummyResponse.prototype= events.EventEmitter.prototype; - DummyResponse.prototype.setEncoding= function() {} - - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse() ); - } - oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) { - if( responseCounter == 1 ) { - assert.equal(url, "http://originalurl.com/"); - } - else { - assert.equal(url, "http://redirectto.com/"); - } - return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) - } - - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function() { - // callback - assert.equal(responseCounter, 2); - callbackCalled= true; - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - oa._performSecureRequest= psr; - } - } - }, - 'but there is no location header' : { - 'it should execute the callback, passing the HTTP Response code' : function(oa) { - var op= oa._createClient; - var callbackCalled = false; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse(301) ); - } - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { - // callback - assert.equal(error.statusCode, 301); - callbackCalled= true; - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - } - } - } - }, - 'And A 302 redirect is received' : { - 'and there is a location header' : { - 'it should (re)perform the secure request but with the new location' : function(oa) { - var op= oa._createClient; - var psr= oa._performSecureRequest; - var responseCounter = 1; - var callbackCalled = false; - var DummyResponse =function() { - if( responseCounter == 1 ){ - this.statusCode= 302; - this.headers= {location:"http://redirectto.com/"}; - responseCounter++; - } - else { - this.statusCode= 200; - } - } - DummyResponse.prototype= events.EventEmitter.prototype; - DummyResponse.prototype.setEncoding= function() {} - - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse() ); - } - oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) { - if( responseCounter == 1 ) { - assert.equal(url, "http://originalurl.com/"); - } - else { - assert.equal(url, "http://redirectto.com/"); - } - return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) - } - - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function() { - // callback - assert.equal(responseCounter, 2); - callbackCalled= true; - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - oa._performSecureRequest= psr; - } - } - }, - 'but there is no location header' : { - 'it should execute the callback, passing the HTTP Response code' : function(oa) { - var op= oa._createClient; - var callbackCalled = false; - try { - oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) { - return new DummyRequest( new DummyResponse(302) ); - } - oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com/', {"scope": "foobar,1,2"}, null, null, function(error) { - // callback - assert.equal(error.statusCode, 302); - callbackCalled= true; - }); - assert.equal(callbackCalled, true) - } - finally { - oa._createClient= op; - } - } - } - } - } - } -}).export(module); diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js deleted file mode 100644 index 4eb47cd..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/oauth2.js +++ /dev/null @@ -1,67 +0,0 @@ -var vows = require('vows'), - assert = require('assert'), - OAuth2= require('../lib/oauth2').OAuth2; - -vows.describe('OAuth2').addBatch({ - 'Given an OAuth2 instance, ': { - topic: new OAuth2(), - 'When handling the access token response': { - 'we should correctly extract the token if received as form-data': function (oa) { - oa._request= function( method, url, fo, bar, bleh, callback) { - callback(null, "access_token=access&refresh_token=refresh"); - }; - oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) { - assert.equal( access_token, "access"); - assert.equal( refresh_token, "refresh"); - }); - }, - 'we should correctly extract the token if received as a JSON literal': function (oa) { - oa._request= function(method, url, headers, post_body, access_token, callback) { - callback(null, '{"access_token":"access","refresh_token":"refresh"}'); - }; - oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) { - assert.equal( access_token, "access"); - assert.equal( refresh_token, "refresh"); - }); - }, - 'we should return the received data to the calling method': function (oa) { - oa._request= function(method, url, headers, post_body, access_token, callback) { - callback(null, '{"access_token":"access","refresh_token":"refresh","extra_1":1, "extra_2":"foo"}'); - }; - oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token, results) { - assert.equal( access_token, "access"); - assert.equal( refresh_token, "refresh"); - assert.isNotNull( results ); - assert.equal( results.extra_1, 1); - assert.equal( results.extra_2, "foo"); - }); - } - }, - 'When no grant_type parameter is specified': { - 'we should pass the value of the code argument as the code parameter': function(oa) { - oa._request= function(method, url, headers, post_body, access_token, callback) { - assert.isTrue( post_body.indexOf("code=xsds23") != -1 ) - } - oa.getOAuthAccessToken("xsds23", {} ); - } - }, - 'When an invalid grant_type parameter is specified': { - 'we should pass the value of the code argument as the code parameter': function(oa) { - oa._request= function(method, url, headers, post_body, access_token, callback) { - assert.isTrue( post_body.indexOf("code=xsds23") != -1 ) - } - oa.getOAuthAccessToken("xsds23", {grant_type:"refresh_toucan"} ); - } - }, - 'When a grant_type parameter of value "refresh_token" is specified': { - 'we should pass the value of the code argument as the refresh_token parameter, should pass a grant_type parameter, but shouldn\'t pass a code parameter' : function(oa) { - oa._request= function(method, url, headers, post_body, access_token, callback) { - assert.isTrue( post_body.indexOf("refresh_token=sdsds2") != -1 ) - assert.isTrue( post_body.indexOf("grant_type=refresh_token") != -1 ) - assert.isTrue( post_body.indexOf("code=") == -1 ) - } - oa.getOAuthAccessToken("sdsds2", {grant_type:"refresh_token"} ); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js b/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js deleted file mode 100644 index 18ba0ae..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/tests/sha1.js +++ /dev/null @@ -1,13 +0,0 @@ -var vows = require('vows'), - assert = require('assert'); - -vows.describe('SHA1 Hashing').addBatch({ - 'When using the SHA1 Hashing function': { - topic: require('../lib/sha1'), - 'we get the specified digest as described in http://oauth.net/core/1.0/#sig_base_example (A.5.2)': function (sha1) { - assert.equal (sha1.HMACSHA1( "kd94hf93k423kf44&pfkkdhi9sl3r4s00", - "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"), - "tR3+Ty81lMeYAr/Fid0kMTYa/WM="); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/passport-oauth/package.json b/node_modules/passport-github/node_modules/passport-oauth/package.json deleted file mode 100644 index 52d0a82..0000000 --- a/node_modules/passport-github/node_modules/passport-oauth/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "passport-oauth", - "version": "0.1.14", - "description": "OAuth 1.0 and 2.0 authentication strategies for Passport.", - "keywords": ["passport", "oauth", "auth", "authn", "authentication"], - "repository": { - "type": "git", - "url": "git://github.com/jaredhanson/passport-oauth.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/passport-oauth/issues" - }, - "author": { - "name": "Jared Hanson", - "email": "jaredhanson@gmail.com", - "url": "http://www.jaredhanson.net/" - }, - "licenses": [ { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } ], - "main": "./lib/passport-oauth", - "dependencies": { - "pkginfo": "0.2.x", - "passport": "~0.1.1", - "oauth": "0.9.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "scripts": { - "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js" - }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/passport-github/node_modules/pkginfo/.gitignore b/node_modules/passport-github/node_modules/pkginfo/.gitignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/README.md b/node_modules/passport-github/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/docs/docco.css b/node_modules/passport-github/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html b/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

    pkginfo.js

    /*
    - * pkginfo.js: Top-level include for the pkginfo module
    - *
    - * (C) 2011, Charlie Robbins
    - *
    - */
    - 
    -var fs = require('fs'),
    -    path = require('path');

    function pkginfo ([options, 'property', 'property' ..])

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @options {Object|Array|string} Optional Options used when exposing properties.

    - -

    @arguments {string...} Optional Specified properties to expose.

    - -

    Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

    - -

    require('pkginfo')()

    - -

    require('pkginfo')('version', 'author');

    - -

    require('pkginfo')(['version', 'author']);

    - -

    require('pkginfo')({ include: ['version', 'author'] });

    var pkginfo = module.exports = function (pmodule, options) {
    -  var args = [].slice.call(arguments, 2).filter(function (arg) {
    -    return typeof arg === 'string';
    -  });
    -  

    Parse variable arguments

      if (Array.isArray(options)) {

    If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

        options = { include: options };
    -  }
    -  else if (typeof options === 'string') {

    Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

        options = { include: [options] };
    -  }
    -  

    Setup default options

      options = options || { include: [] };
    -  
    -  if (args.length > 0) {

    If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

        options.include = options.include.concat(args);
    -  }
    -  
    -  var pkg = pkginfo.read(pmodule, options.dir).package;
    -  Object.keys(pkg).forEach(function (key) {
    -    if (options.include.length > 0 && !~options.include.indexOf(key)) {
    -      return;
    -    }
    -    
    -    if (!pmodule.exports[key]) {
    -      pmodule.exports[key] = pkg[key];
    -    }
    -  });
    -  
    -  return pkginfo;
    -};

    function find (dir)

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @dir {string} Optional Directory to start search from.

    - -

    Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

    pkginfo.find = function (pmodule, dir) {
    -  dir = dir || pmodule.filename;
    -  dir = path.dirname(dir); 
    -  
    -  var files = fs.readdirSync(dir);
    -  
    -  if (~files.indexOf('package.json')) {
    -    return path.join(dir, 'package.json');
    -  }
    -  
    -  if (dir === '/') {
    -    throw new Error('Could not find package.json up from: ' + dir);
    -  }
    -  
    -  return pkginfo.find(dir);
    -};

    function read (pmodule, dir)

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @dir {string} Optional Directory to start search from.

    - -

    Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

    pkginfo.read = function (pmodule, dir) { 
    -  dir = pkginfo.find(pmodule, dir);
    -  
    -  var data = fs.readFileSync(dir).toString();
    -      
    -  return {
    -    dir: dir, 
    -    package: JSON.parse(data)
    -  };
    -};

    Call pkginfo on this module and expose version.

    pkginfo(module, {
    -  dir: __dirname,
    -  include: ['version'],
    -  target: pkginfo
    -});
    -
    -
    \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js b/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js b/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js b/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/package.json b/node_modules/passport-github/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js b/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js b/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/passport-github/node_modules/pkginfo/package.json b/node_modules/passport-github/node_modules/pkginfo/package.json deleted file mode 100644 index 0e9e4e7..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": "Charlie Robbins ", - "repository": { - "type": "git", - "url": "http://github.com/indexzero/node-pkginfo.git" - }, - "keywords": ["info", "tools", "package.json"], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/passport-github/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/passport-github/package.json b/node_modules/passport-github/package.json deleted file mode 100644 index 6799272..0000000 --- a/node_modules/passport-github/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "passport-github", - "version": "0.1.3", - "description": "GitHub authentication strategy for Passport.", - "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, - "repository": { - "type": "git", - "url": "http://github.com/jaredhanson/passport-github.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/passport-github/issues" - }, - "main": "./lib/passport-github", - "dependencies": { - "pkginfo": "0.2.x", - "passport-oauth": "0.1.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "scripts": { - "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js" - }, - "engines": { "node": ">= 0.4.0" }, - "licenses": [ { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } ], - "keywords": ["passport", "github", "auth", "authn", "authentication", "identity"] -} diff --git a/node_modules/passport/.npmignore b/node_modules/passport/.npmignore deleted file mode 100644 index d9ceb36..0000000 --- a/node_modules/passport/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -*.md -.DS_Store -.git* -Makefile -docs/ -examples/ -support/ -test/ diff --git a/node_modules/passport/.travis.yml b/node_modules/passport/.travis.yml deleted file mode 100644 index a57e4db..0000000 --- a/node_modules/passport/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: "node_js" -node_js: - - 0.4 - - 0.6 - - 0.8 diff --git a/node_modules/passport/LICENSE b/node_modules/passport/LICENSE deleted file mode 100644 index 74524ce..0000000 --- a/node_modules/passport/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Jared Hanson - -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/passport/lib/passport/context/http/actions.js b/node_modules/passport/lib/passport/context/http/actions.js deleted file mode 100644 index 1182027..0000000 --- a/node_modules/passport/lib/passport/context/http/actions.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Export actions prototype for strategies operating within an HTTP context. - */ -var actions = module.exports = {}; - - -/** - * Authenticate `user`, with optional `info`. - * - * Strategies should call this function to successfully authenticate a user. - * `user` should be an object supplied by the application after it has been - * given an opportunity to verify credentials. `info` is an optional argument - * containing additional user information. This is useful for third-party - * authentication strategies to pass profile details. - * - * @param {Object} user - * @param {Object} info - * @api public - */ -actions.success = function(user, info) { - this.delegate.success.apply(this, arguments); -} - -/** - * Fail authentication, with optional `challenge` and `status`, defaulting to - * 401. - * - * Strategies should call this function to fail an authentication attempt. - * - * @param {String} challenge - * @param {Number} status - * @api public - */ -actions.fail = function(challenge, status) { - this.delegate.fail.apply(this, arguments); -} - -/** - * Redirect to `url` with optional `status`, defaulting to 302. - * - * Strategies should call this function to redirect the user (via their user - * agent) to a third-party website for authentication. - * - * @param {String} url - * @param {Number} status - * @api public - */ -actions.redirect = function(url, status) { - var res = this.res; - if (typeof res.redirect == 'function') { - // If possible use redirect method on the response - // Assume Express API, optional status param comes first - if (status) { - res.redirect(status, url); - } else { - res.redirect(url); - } - } else { - // Otherwise fall back to native methods - res.statusCode = status || 302; - res.setHeader('Location', url); - res.setHeader('Content-Length', '0'); - res.end(); - } -} - -/** - * Pass without making a success or fail decision. - * - * Under most circumstances, Strategies should not need to call this function. - * It exists primarily to allow previous authentication state to be restored, - * for example from an HTTP session. - * - * @api public - */ -actions.pass = function() { - this.next(); -} - -/** - * Internal error while performing authentication. - * - * Strategies should call this function when an internal error occurs during the - * process of performing authentication; for example, if the user directory is - * not available. - * - * @param {Error} err - * @api public - */ -actions.error = function(err) { - this.next(err); -} - diff --git a/node_modules/passport/lib/passport/context/http/context.js b/node_modules/passport/lib/passport/context/http/context.js deleted file mode 100644 index 27eb9ee..0000000 --- a/node_modules/passport/lib/passport/context/http/context.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * `Context` constructor. - * - * @api private - */ -function Context(delegate, req, res, next) { - this.delegate = delegate; - this.req = req; - this.res = res; - this.next = next; -} - - -/** - * Expose `Context`. - */ -module.exports = Context; diff --git a/node_modules/passport/lib/passport/http/request.js b/node_modules/passport/lib/passport/http/request.js deleted file mode 100644 index 889fef4..0000000 --- a/node_modules/passport/lib/passport/http/request.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Module dependencies. - */ -var http = require('http') - , req = http.IncomingMessage.prototype; - - -/** - * Intiate a login session for `user`. - * - * Options: - * - `session` Save login state in session, defaults to _true_ - * - * Examples: - * - * req.logIn(user, { session: false }); - * - * req.logIn(user, function(err) { - * if (err) { throw err; } - * // session saved - * }); - * - * @param {User} user - * @param {Object} options - * @param {Function} done - * @api public - */ -req.login = -req.logIn = function(user, options, done) { - if (!this._passport) throw new Error('passport.initialize() middleware not in use'); - - if (!done && typeof options === 'function') { - done = options; - options = {}; - } - options = options || {}; - var property = this._passport.instance._userProperty || 'user'; - var session = (options.session === undefined) ? true : options.session; - - this[property] = user; - if (session) { - var self = this; - this._passport.instance.serializeUser(user, function(err, obj) { - if (err) { self[property] = null; return done(err); } - self._passport.session.user = obj; - done(); - }); - } else { - done && done(); - } -} - -/** - * Terminate an existing login session. - * - * @api public - */ -req.logout = -req.logOut = function() { - if (!this._passport) throw new Error('passport.initialize() middleware not in use'); - - var property = this._passport.instance._userProperty || 'user'; - - this[property] = null; - delete this._passport.session.user; -}; - -/** - * Test if request is authenticated. - * - * @return {Boolean} - * @api public - */ -req.isAuthenticated = function() { - var property = 'user'; - if (this._passport && this._passport.instance._userProperty) { - property = this._passport.instance._userProperty; - } - - return (this[property]) ? true : false; -}; - -/** - * Test if request is unauthenticated. - * - * @return {Boolean} - * @api public - */ -req.isUnauthenticated = function() { - return !this.isAuthenticated(); -}; diff --git a/node_modules/passport/lib/passport/index.js b/node_modules/passport/lib/passport/index.js deleted file mode 100644 index 3f08b36..0000000 --- a/node_modules/passport/lib/passport/index.js +++ /dev/null @@ -1,412 +0,0 @@ -/** - * Module dependencies. - */ -var fs = require('fs') - , path = require('path') - , util = require('util') - , Strategy = require('./strategy') - , SessionStrategy = require('./strategies/session') - , initialize = require('./middleware/initialize') - , authenticate = require('./middleware/authenticate'); - - -/** - * `Passport` constructor. - * - * @api public - */ -function Passport() { - this._key = 'passport'; - this._strategies = {}; - this._serializers = []; - this._deserializers = []; - this._infoTransformers = []; - - this._userProperty = 'user'; - - this.use(new SessionStrategy()); -}; - -/** - * Utilize the given `strategy` with optional `name`, overridding the strategy's - * default name. - * - * Examples: - * - * passport.use(new TwitterStrategy(...)); - * - * passport.use('api', new http.BasicStrategy(...)); - * - * @param {String|Strategy} name - * @param {Strategy} strategy - * @return {Passport} for chaining - * @api public - */ -Passport.prototype.use = function(name, strategy) { - if (!strategy) { - strategy = name; - name = strategy.name; - } - if (!name) throw new Error('authentication strategies must have a name'); - - this._strategies[name] = strategy; - return this; -}; - -/** - * Un-utilize the `strategy` with given `name`. - * - * In typical applications, the necessary authentication strategies are static, - * configured once and always available. As such, there is often no need to - * invoke this function. - * - * However, in certain situations, applications may need dynamically configure - * and de-configure authentication strategies. The `use()`/`unuse()` - * combination satisfies these scenarios. - * - * Examples: - * - * passport.unuse('legacy-api'); - * - * @param {String} name - * @return {Passport} for chaining - * @api public - */ -Passport.prototype.unuse = function(name) { - delete this._strategies[name]; - return this; -} - -/** - * Passport's primary initialization middleware. - * - * This middleware must be in use by the Connect/Express application for - * Passport to operate. - * - * Options: - * - `userProperty` Property to set on `req` upon login, defaults to _user_ - * - * Examples: - * - * app.configure(function() { - * app.use(passport.initialize()); - * }); - * - * app.configure(function() { - * app.use(passport.initialize({ userProperty: 'currentUser' })); - * }); - * - * @param {Object} options - * @return {Function} middleware - * @api public - */ -Passport.prototype.initialize = function(options) { - options = options || {}; - this._userProperty = options.userProperty || 'user'; - - return initialize().bind(this); -} - -/** - * Middleware that will restore login state from a session. - * - * Web applications typically use sessions to maintain login state between - * requests. For example, a user will authenticate by entering credentials into - * a form which is submitted to the server. If the credentials are valid, a - * login session is established by setting a cookie containing a session - * identifier in the user's web browser. The web browser will send this cookie - * in subsequent requests to the server, allowing a session to be maintained. - * - * If sessions are being utilized, and a login session has been established, - * this middleware will populate `req.user` with the current user. - * - * Note that sessions are not strictly required for Passport to operate. - * However, as a general rule, most web applications will make use of sessions. - * An exception to this rule would be an API server, which expects each HTTP - * request to provide credentials in an Authorization header. - * - * Examples: - * - * app.configure(function() { - * app.use(connect.cookieParser()); - * app.use(connect.session({ secret: 'keyboard cat' })); - * app.use(passport.initialize()); - * app.use(passport.session()); - * }); - * - * @return {Function} middleware - * @api public - */ -Passport.prototype.session = function() { - return this.authenticate('session'); -} - -/** - * Middleware that will authenticate a request using the given `strategy` name, - * with optional `options` and `callback`. - * - * Examples: - * - * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' })(req, res); - * - * passport.authenticate('local', function(err, user) { - * if (!user) { return res.redirect('/login'); } - * res.end('Authenticated!'); - * })(req, res); - * - * passport.authenticate('basic', { session: false })(req, res); - * - * app.get('/auth/twitter', passport.authenticate('twitter'), function(req, res) { - * // request will be redirected to Twitter - * }); - * app.get('/auth/twitter/callback', passport.authenticate('twitter'), function(req, res) { - * res.json(req.user); - * }); - * - * @param {String} strategy - * @param {Object} options - * @param {Function} callback - * @return {Function} middleware - * @api public - */ -Passport.prototype.authenticate = function(strategy, options, callback) { - return authenticate(strategy, options, callback).bind(this); -} - -/** - * Middleware that will authorize a third-party account using the given - * `strategy` name, with optional `options`. - * - * If authorization is successful, the result provided by the strategy's verify - * callback will be assigned to `req.account`. The existing login session and - * `req.user` will be unaffected. - * - * This function is particularly useful when connecting third-party accounts - * to the local account of a user that is currently authenticated. - * - * Examples: - * - * passport.authorize('twitter-authz', { failureRedirect: '/account' }); - * - * @param {String} strategy - * @param {Object} options - * @return {Function} middleware - * @api public - */ -Passport.prototype.authorize = function(strategy, options, callback) { - options = options || {}; - options.assignProperty = 'account'; - - return authenticate(strategy, options, callback).bind(this); -} - -/** - * Registers a function used to serialize user objects into the session. - * - * Examples: - * - * passport.serializeUser(function(user, done) { - * done(null, user.id); - * }); - * - * @api public - */ -Passport.prototype.serializeUser = function(fn, done) { - if (typeof fn === 'function') { - return this._serializers.push(fn); - } - - // private implementation that traverses the chain of serializers, attempting - // to serialize a user - var user = fn; - - var stack = this._serializers; - (function pass(i, err, obj) { - // serializers use 'pass' as an error to skip processing - if ('pass' === err) { - err = undefined; - } - // an error or serialized object was obtained, done - if (err || obj || obj === 0) { return done(err, obj); } - - var layer = stack[i]; - if (!layer) { - return done(new Error('failed to serialize user into session')); - } - - try { - layer(user, function(e, o) { pass(i + 1, e, o); } ) - } catch(e) { - return done(e); - } - })(0); -} - -/** - * Registers a function used to deserialize user objects out of the session. - * - * Examples: - * - * passport.deserializeUser(function(id, done) { - * User.findById(id, function (err, user) { - * done(err, user); - * }); - * }); - * - * @api public - */ -Passport.prototype.deserializeUser = function(fn, done) { - if (typeof fn === 'function') { - return this._deserializers.push(fn); - } - - // private implementation that traverses the chain of deserializers, - // attempting to deserialize a user - var obj = fn; - - var stack = this._deserializers; - (function pass(i, err, user) { - // deserializers use 'pass' as an error to skip processing - if ('pass' === err) { - err = undefined; - } - // an error or deserialized user was obtained, done - if (err || user) { return done(err, user); } - // a valid user existed when establishing the session, but that user has - // since been removed - if (user === null || user === false) { return done(null, false); } - - var layer = stack[i]; - if (!layer) { - return done(new Error('failed to deserialize user out of session')); - } - - try { - layer(obj, function(e, u) { pass(i + 1, e, u); } ) - } catch(e) { - return done(e); - } - })(0); -} - -/** - * Registers a function used to transform auth info. - * - * In some circumstances authorization details are contained in authentication - * credentials or loaded as part of verification. - * - * For example, when using bearer tokens for API authentication, the tokens may - * encode (either directly or indirectly in a database), details such as scope - * of access or the client to which the token was issued. - * - * Such authorization details should be enforced separately from authentication. - * Because Passport deals only with the latter, this is the responsiblity of - * middleware or routes further along the chain. However, it is not optimal to - * decode the same data or execute the same database query later. To avoid - * this, Passport accepts optional `info` along with the authenticated `user` - * in a strategy's `success()` action. This info is set at `req.authInfo`, - * where said later middlware or routes can access it. - * - * Optionally, applications can register transforms to proccess this info, - * which take effect prior to `req.authInfo` being set. This is useful, for - * example, when the info contains a client ID. The transform can load the - * client from the database and include the instance in the transformed info, - * allowing the full set of client properties to be convieniently accessed. - * - * If no transforms are registered, `info` supplied by the strategy will be left - * unmodified. - * - * Examples: - * - * passport.transformAuthInfo(function(info, done) { - * Client.findById(info.clientID, function (err, client) { - * info.client = client; - * done(err, info); - * }); - * }); - * - * @api public - */ -Passport.prototype.transformAuthInfo = function(fn, done) { - if (typeof fn === 'function') { - return this._infoTransformers.push(fn); - } - - // private implementation that traverses the chain of transformers, - // attempting to transform auth info - var info = fn; - - var stack = this._infoTransformers; - (function pass(i, err, tinfo) { - // transformers use 'pass' as an error to skip processing - if ('pass' === err) { - err = undefined; - } - // an error or transformed info was obtained, done - if (err || tinfo) { return done(err, tinfo); } - - var layer = stack[i]; - if (!layer) { - // if no transformers are registered (or they all pass), the default - // behavior is to use the un-transformed info as-is - return done(null, info); - } - - try { - var arity = layer.length; - if (arity == 1) { - // sync - var t = layer(info); - pass(i + 1, null, t); - } else { - // async - layer(info, function(e, t) { pass(i + 1, e, t); } ) - } - } catch(e) { - return done(e); - } - })(0); -} - -/** - * Return strategy with given `name`. - * - * @param {String} name - * @return {Strategy} - * @api private - */ -Passport.prototype._strategy = function(name) { - return this._strategies[name]; -} - - -/** - * Export default singleton. - * - * @api public - */ -exports = module.exports = new Passport(); - -/** - * Framework version. - */ -require('pkginfo')(module, 'version'); - -/** - * Expose constructors. - */ -exports.Passport = Passport; -exports.Strategy = Strategy; - - -/** - * Expose strategies. - */ -exports.strategies = {}; -exports.strategies.SessionStrategy = SessionStrategy; - - -/** - * HTTP extensions. - */ -require('./http/request'); diff --git a/node_modules/passport/lib/passport/middleware/authenticate.js b/node_modules/passport/lib/passport/middleware/authenticate.js deleted file mode 100644 index d02f498..0000000 --- a/node_modules/passport/lib/passport/middleware/authenticate.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * Module dependencies. - */ -var util = require('util') - , actions = require('../context/http/actions') - , Context = require('../context/http/context') - - -/** - * Authenticates requests. - * - * Applies the `name`ed strategy (or strategies) to the incoming request, in - * order to authenticate the request. If authentication is successful, the user - * will be logged in and populated at `req.user` and a session will be - * established by default. If authentication fails, an unauthorized response - * will be sent. - * - * Options: - * - `session` Save login state in session, defaults to _true_ - * - `successRedirect` After successful login, redirect to given URL - * - `failureRedirect` After failed login, redirect to given URL - * - `assignProperty` Assign the object provided by the verify callback to given property - * - * An optional `callback` can be supplied to allow the application to overrride - * the default manner in which authentication attempts are handled. The - * callback has the following signature, where `user` will be set to the - * authenticated user on a successful authentication attempt, or `false` - * otherwise. An optional `info` argument will be passed, containing additional - * details provided by the strategy's verify callback. - * - * app.get('/protected', function(req, res, next) { - * passport.authenticate('local', function(err, user, info) { - * if (err) { return next(err) } - * if (!user) { return res.redirect('/signin') } - * res.redirect('/account'); - * })(req, res, next); - * }); - * - * Note that if a callback is supplied, it becomes the application's - * responsibility to log-in the user, establish a session, and otherwise perform - * the desired operations. - * - * Examples: - * - * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' }); - * - * passport.authenticate('basic', { session: false }); - * - * passport.authenticate('twitter'); - * - * @param {String} name - * @param {Object} options - * @param {Function} callback - * @return {Function} - * @api public - */ -module.exports = function authenticate(name, options, callback) { - if (!callback && typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - - // Cast `name` to an array, allowing authentication to pass through a chain of - // strategies. The first strategy to succeed, redirect, or error will halt - // the chain. Authentication failures will proceed through each strategy in - // series, ultimately failing if all strategies fail. - // - // This is typically used on API endpoints to allow clients to authenticate - // using their preferred choice of Basic, Digest, token-based schemes, etc. - // It is not feasible to construct a chain of multiple strategies that involve - // redirection (for example both Facebook and Twitter), since the first one to - // redirect will halt the chain. - if (!Array.isArray(name)) { - name = [ name ]; - } - - return function authenticate(req, res, next) { - var passport = this; - - // accumulator for failures from each strategy in the chain - var failures = []; - - function allFailed() { - if (callback) { - if (failures.length == 1) { - return callback(null, false, failures[0].challenge, failures[0].status); - } else { - var challenges = failures.map(function(f) { return f.challenge; }); - var statuses = failures.map(function(f) { return f.status; }) - return callback(null, false, challenges, statuses); - } - } - - // Strategies are ordered by priority. For the purpose of flashing a - // message, the first failure will be displayed. - var failure = failures[0] || {} - , challenge = failure.challenge || {}; - - if (options.failureFlash) { - var flash = options.failureFlash; - if (typeof flash == 'string') { - flash = { type: 'error', message: flash }; - } - flash.type = flash.type || 'error'; - - var type = flash.type || challenge.type || 'error'; - var msg = flash.message || challenge.message || challenge; - if (typeof msg == 'string') { - req.flash(type, msg); - } - } - if (options.failureMessage) { - var msg = options.failureMessage; - if (typeof msg == 'boolean') { - msg = challenge.message || challenge; - } - if (typeof msg == 'string') { - req.session.messages = req.session.messages || []; - req.session.messages.push(msg); - } - } - if (options.failureRedirect) { - return res.redirect(options.failureRedirect); - } - - // When failure handling is not delegated to the application, the default - // is to respond with 401 Unauthorized. Note that the WWW-Authenticate - // header will be set according to the strategies in use (see - // actions#fail). If multiple strategies failed, each of their challenges - // will be included in the response. - var rchallenge = [] - , rstatus; - - for (var j = 0, len = failures.length; j < len; j++) { - var failure = failures[j] - , challenge = failure.challenge || {} - , status = failure.status; - if (typeof challenge == 'number') { - status = challenge; - challenge = null; - } - - rstatus = rstatus || status; - if (typeof challenge == 'string') { - rchallenge.push(challenge) - } - } - - res.statusCode = rstatus || 401; - if (rchallenge.length) { - res.setHeader('WWW-Authenticate', rchallenge); - } - res.end('Unauthorized'); - } - - (function attempt(i) { - var delegate = {}; - delegate.success = function(user, info) { - if (callback) { - return callback(null, user, info); - } - - info = info || {} - - if (options.successFlash) { - var flash = options.successFlash; - if (typeof flash == 'string') { - flash = { type: 'success', message: flash }; - } - flash.type = flash.type || 'success'; - - var type = flash.type || info.type || 'success'; - var msg = flash.message || info.message || info; - if (typeof msg == 'string') { - req.flash(type, msg); - } - } - if (options.successMessage) { - var msg = options.successMessage; - if (typeof msg == 'boolean') { - msg = info.message || info; - } - if (typeof msg == 'string') { - req.session.messages = req.session.messages || []; - req.session.messages.push(msg); - } - } - if (options.assignProperty) { - req[options.assignProperty] = user; - return next(); - } - - req.logIn(user, options, function(err) { - if (err) { return next(err); } - if (options.authInfo || options.authInfo === undefined) { - passport.transformAuthInfo(info, function(err, tinfo) { - if (err) { return next(err); } - req.authInfo = tinfo; - complete(); - }); - } else { - complete(); - } - - function complete() { - if (options.successReturnToOrRedirect) { - var url = options.successReturnToOrRedirect; - if (req.session && req.session.returnTo) { - url = req.session.returnTo; - delete req.session.returnTo; - } - return res.redirect(url); - } - if (options.successRedirect) { - return res.redirect(options.successRedirect); - } - next(); - } - }); - } - delegate.fail = function(challenge, status) { - // push this failure into the accumulator and attempt authentication - // using the next strategy - failures.push({ challenge: challenge, status: status }); - attempt(i + 1); - } - - var layer = name[i]; - // If no more strategies exist in the chain, authentication has failed. - if (!layer) { return allFailed(); } - - // Get the strategy, which will be used as prototype from which to create - // a new instance. Action functions will then be bound to the strategy - // within the context of the HTTP request/response pair. - var prototype = passport._strategy(layer); - if (!prototype) { return next(new Error('no strategy registered under name: ' + layer)); } - - var strategy = Object.create(prototype); - var context = new Context(delegate, req, res, next); - augment(strategy, actions, context); - - strategy.authenticate(req, options); - })(0); // attempt - } -} - - -function augment(strategy, actions, ctx) { - for (var method in actions) { - strategy[method] = actions[method].bind(ctx); - } -} diff --git a/node_modules/passport/lib/passport/middleware/initialize.js b/node_modules/passport/lib/passport/middleware/initialize.js deleted file mode 100644 index c44e391..0000000 --- a/node_modules/passport/lib/passport/middleware/initialize.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Module dependencies. - */ -var util = require('util'); - - -/** - * Passport initialization. - * - * Intializes Passport for incoming requests, allowing authentication strategies - * to be applied. - * - * If sessions are being utilized, applications must set up Passport with - * functions to serialize a user into and out of a session. For example, a - * common pattern is to serialize just the user ID into the session (due to the - * fact that it is desirable to store the minimum amount of data in a session). - * When a subsequent request arrives for the session, the full User object can - * be loaded from the database by ID. - * - * Note that additional middleware is required to persist login state, so we - * must use the `connect.session()` middleware _before_ `passport.initialize()`. - * - * This middleware must be in use by the Connect/Express application for - * Passport to operate. - * - * Examples: - * - * app.configure(function() { - * app.use(connect.cookieParser()); - * app.use(connect.session({ secret: 'keyboard cat' })); - * app.use(passport.initialize()); - * app.use(passport.session()); - * }); - * - * passport.serializeUser(function(user, done) { - * done(null, user.id); - * }); - * - * passport.deserializeUser(function(id, done) { - * User.findById(id, function (err, user) { - * done(err, user); - * }); - * }); - * - * @return {Function} - * @api public - */ -module.exports = function initialize() { - - return function initialize(req, res, next) { - var passport = this; - req._passport = {}; - req._passport.instance = passport; - - //console.log('!! session: ' + util.inspect(req.session)); - - if (req.session && req.session[passport._key]) { - // load data from existing session - req._passport.session = req.session[passport._key]; - } else if (req.session) { - // initialize new session - req.session[passport._key] = {}; - req._passport.session = req.session[passport._key]; - } else { - // no session is available - req._passport.session = {}; - } - - next(); - } -} diff --git a/node_modules/passport/lib/passport/strategies/session.js b/node_modules/passport/lib/passport/strategies/session.js deleted file mode 100644 index e258999..0000000 --- a/node_modules/passport/lib/passport/strategies/session.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Module dependencies. - */ -var util = require('util') - , Strategy = require('../strategy'); - - -/** - * `SessionStrategy` constructor. - * - * @api protected - */ -function SessionStrategy() { - Strategy.call(this); - this.name = 'session'; -} - -/** - * Inherit from `Strategy`. - */ -util.inherits(SessionStrategy, Strategy); - -/** - * Authenticate request based on the current session state. - * - * The session authentication strategy uses the session to restore any login - * state across requests. If a login session has been established, `req.user` - * will be populated with the current user. - * - * This strategy is registered automatically by Passport. - * - * @param {Object} req - * @api protected - */ -SessionStrategy.prototype.authenticate = function(req) { - if (!req._passport) { return this.error(new Error('passport.initialize() middleware not in use')); } - - var self = this - , su = req._passport.session.user; - if (su || su === 0) { - req._passport.instance.deserializeUser(su, function(err, user) { - if (err) { return self.error(err); } - if (!user) { - delete req._passport.session.user; - return self.pass(); - }; - var property = req._passport.instance._userProperty || 'user'; - req[property] = user; - self.pass(); - }); - } else { - self.pass(); - } -} - - -/** - * Expose `SessionStrategy`. - */ -module.exports = SessionStrategy; diff --git a/node_modules/passport/lib/passport/strategy.js b/node_modules/passport/lib/passport/strategy.js deleted file mode 100644 index 7a93852..0000000 --- a/node_modules/passport/lib/passport/strategy.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Module dependencies. - */ -var util = require('util'); - - -/** - * `Strategy` constructor. - * - * @api public - */ -function Strategy() { -} - -/** - * Authenticate request. - * - * This function must be overridden by subclasses. In abstract form, it always - * throws an exception. - * - * @param {Object} req - * @param {Object} options - * @api protected - */ -Strategy.prototype.authenticate = function(req, options) { - throw new Error('Strategy#authenticate must be overridden by subclass'); -} - - -/** - * Expose `Strategy`. - */ -module.exports = Strategy; diff --git a/node_modules/passport/node_modules/pkginfo/.gitignore b/node_modules/passport/node_modules/pkginfo/.gitignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/passport/node_modules/pkginfo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/README.md b/node_modules/passport/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/passport/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/docs/docco.css b/node_modules/passport/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/passport/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html b/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/passport/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

    pkginfo.js

    /*
    - * pkginfo.js: Top-level include for the pkginfo module
    - *
    - * (C) 2011, Charlie Robbins
    - *
    - */
    - 
    -var fs = require('fs'),
    -    path = require('path');

    function pkginfo ([options, 'property', 'property' ..])

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @options {Object|Array|string} Optional Options used when exposing properties.

    - -

    @arguments {string...} Optional Specified properties to expose.

    - -

    Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

    - -

    require('pkginfo')()

    - -

    require('pkginfo')('version', 'author');

    - -

    require('pkginfo')(['version', 'author']);

    - -

    require('pkginfo')({ include: ['version', 'author'] });

    var pkginfo = module.exports = function (pmodule, options) {
    -  var args = [].slice.call(arguments, 2).filter(function (arg) {
    -    return typeof arg === 'string';
    -  });
    -  

    Parse variable arguments

      if (Array.isArray(options)) {

    If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

        options = { include: options };
    -  }
    -  else if (typeof options === 'string') {

    Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

        options = { include: [options] };
    -  }
    -  

    Setup default options

      options = options || { include: [] };
    -  
    -  if (args.length > 0) {

    If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

        options.include = options.include.concat(args);
    -  }
    -  
    -  var pkg = pkginfo.read(pmodule, options.dir).package;
    -  Object.keys(pkg).forEach(function (key) {
    -    if (options.include.length > 0 && !~options.include.indexOf(key)) {
    -      return;
    -    }
    -    
    -    if (!pmodule.exports[key]) {
    -      pmodule.exports[key] = pkg[key];
    -    }
    -  });
    -  
    -  return pkginfo;
    -};

    function find (dir)

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @dir {string} Optional Directory to start search from.

    - -

    Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

    pkginfo.find = function (pmodule, dir) {
    -  dir = dir || pmodule.filename;
    -  dir = path.dirname(dir); 
    -  
    -  var files = fs.readdirSync(dir);
    -  
    -  if (~files.indexOf('package.json')) {
    -    return path.join(dir, 'package.json');
    -  }
    -  
    -  if (dir === '/') {
    -    throw new Error('Could not find package.json up from: ' + dir);
    -  }
    -  
    -  return pkginfo.find(dir);
    -};

    function read (pmodule, dir)

    - -

    @pmodule {Module} Parent module to read from.

    - -

    @dir {string} Optional Directory to start search from.

    - -

    Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

    pkginfo.read = function (pmodule, dir) { 
    -  dir = pkginfo.find(pmodule, dir);
    -  
    -  var data = fs.readFileSync(dir).toString();
    -      
    -  return {
    -    dir: dir, 
    -    package: JSON.parse(data)
    -  };
    -};

    Call pkginfo on this module and expose version.

    pkginfo(module, {
    -  dir: __dirname,
    -  include: ['version'],
    -  target: pkginfo
    -});
    -
    -
    \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/all-properties.js b/node_modules/passport/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/array-argument.js b/node_modules/passport/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/object-argument.js b/node_modules/passport/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/examples/package.json b/node_modules/passport/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/passport/node_modules/pkginfo/examples/single-property.js b/node_modules/passport/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/passport/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js b/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/passport/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/passport/node_modules/pkginfo/package.json b/node_modules/passport/node_modules/pkginfo/package.json deleted file mode 100644 index 0e9e4e7..0000000 --- a/node_modules/passport/node_modules/pkginfo/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": "Charlie Robbins ", - "repository": { - "type": "git", - "url": "http://github.com/indexzero/node-pkginfo.git" - }, - "keywords": ["info", "tools", "package.json"], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/passport/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/passport/package.json b/node_modules/passport/package.json deleted file mode 100644 index f2876a5..0000000 --- a/node_modules/passport/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "passport", - "version": "0.1.15", - "description": "Simple, unobtrusive authentication for Node.js.", - "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, - "homepage": "http://passportjs.org/", - "repository": { - "type": "git", - "url": "git://github.com/jaredhanson/passport.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/passport/issues" - }, - "main": "./lib/passport", - "dependencies": { - "pkginfo": "0.2.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "scripts": { - "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js test/context/http/*-test.js" - }, - "engines": { "node": ">= 0.4.0" }, - "licenses": [ { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } ], - "keywords": ["express", "connect", "auth", "authn", "authentication"] -} From 06b1c5c0f8c348b06f11c121bc90105d03e177f2 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Tue, 19 Feb 2013 07:41:38 -0800 Subject: [PATCH 06/11] adding user logging for auth --- src/app.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index 846b125..99279db 100644 --- a/src/app.js +++ b/src/app.js @@ -4,7 +4,7 @@ var qs = require('querystring'); var express = require('express'); var app = express(); var config = eval('(' + fs.readFileSync('../config/app.config', 'utf8') + ')'); - +var authLog = fs.createWriteStream('/var/log/josh-auth.log', {flags: 'a'}); app.configure(function() { app.use(express.cookieParser()); app.use(express.bodyParser()); @@ -16,6 +16,7 @@ app.get("/github", function(req, res) { app.get("/github-token", function(req, res) { var token = req.cookies.access_token; console.log("token: " + token); + res.set('Access-Control-Allow-Credentials', 'true'); res.set('Access-Control-Allow-Origin', 'http://sdether.github.com/'); res.send({access_token: token}); }); @@ -35,9 +36,21 @@ app.get("/github-auth", function(req, res) { } }, function(error, response, body) { console.log(body); - body = JSON.parse(body); - res.cookie('access_token', body.access_token); - res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); + var auth = JSON.parse(body) + request({ + method: 'get', + uri: 'https://api.github.com/user', + headers: { + Accept: 'application/json', + Authorization: 'token ' + auth.access_token + } + }, + function(error, response, body) { + var user = JSON.parse(body); + authLog.write(new Date().toJSON()+"\t"+user.login+"\n"); + res.cookie('access_token', auth.access_token); + res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); + }); }); }); app.listen(80); \ No newline at end of file From 4888294cfcbf5c2f2d218634e0f25eedf9352d8e Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Fri, 22 Feb 2013 07:28:32 +0000 Subject: [PATCH 07/11] configure port via config file --- src/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 846b125..8e59d9e 100644 --- a/src/app.js +++ b/src/app.js @@ -40,4 +40,4 @@ app.get("/github-auth", function(req, res) { res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); }); }); -app.listen(80); \ No newline at end of file +app.listen(config.port); \ No newline at end of file From 143848e584e49fda6b059d9b94fd1a66d5dd1315 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Sat, 23 Feb 2013 08:03:33 +0000 Subject: [PATCH 08/11] log file comes from config, all unhandled paths are redirected to github side --- .gitignore | 1 + src/app.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1f9d03c..e9350e7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ output-min/* __* .#* config/ +log/ .idea/workspace.xml .idea/tasks.xml .DS_Store diff --git a/src/app.js b/src/app.js index 951f91b..5caf33d 100644 --- a/src/app.js +++ b/src/app.js @@ -4,12 +4,13 @@ var qs = require('querystring'); var express = require('express'); var app = express(); var config = eval('(' + fs.readFileSync('../config/app.config', 'utf8') + ')'); -var authLog = fs.createWriteStream('/var/log/josh-auth.log', {flags: 'a'}); +var authLog = fs.createWriteStream(config.authLog, {flags: 'a'}); app.configure(function() { app.use(express.cookieParser()); app.use(express.bodyParser()); }); + app.get("/github", function(req, res) { res.redirect("https://github.com/login/oauth/authorize?client_id=" + config.github.client_id); }); @@ -53,4 +54,10 @@ app.get("/github-auth", function(req, res) { }); }); }); +app.get('/hello',function(req,res) { + res.send({hello:'world'}); + }); +app.get('*', function(req,res) { + res.redirect("http://sdether.github.com/josh.js/"); + }); app.listen(config.port); From 6ade77e6194200a7093eb8b8db4ab4551ca27274 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Tue, 5 Mar 2013 07:16:07 -0800 Subject: [PATCH 09/11] changing github auth api to always proxy requests to github --- src/app.js | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/app.js b/src/app.js index 5caf33d..c0bbc6d 100644 --- a/src/app.js +++ b/src/app.js @@ -8,20 +8,21 @@ var authLog = fs.createWriteStream(config.authLog, {flags: 'a'}); app.configure(function() { app.use(express.cookieParser()); app.use(express.bodyParser()); + app.use(express.session(config.session)); + app.use(accessControlHeaders); }); -app.get("/github", function(req, res) { +app.get("/auth", function(req, res) { res.redirect("https://github.com/login/oauth/authorize?client_id=" + config.github.client_id); }); -app.get("/github-token", function(req, res) { - var token = req.cookies.access_token; - console.log("token: " + token); - res.set('Access-Control-Allow-Credentials', 'true'); - res.set('Access-Control-Allow-Origin', 'http://sdether.github.com/'); - res.send({access_token: token}); +app.get("/status", function(req,res) { + if(req.session.access_token) { + res.send({authenticated: true}); + } else { + res.send({authenticated: false}); + } }); - app.get("/github-auth", function(req, res) { console.log("code: " + req.query.code); request({ @@ -49,15 +50,39 @@ app.get("/github-auth", function(req, res) { function(error, response, body) { var user = JSON.parse(body); authLog.write(new Date().toJSON()+"\t"+user.login+"\n"); - res.cookie('access_token', auth.access_token); + req.session.access_token = auth.access_token; res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); }); }); }); app.get('/hello',function(req,res) { res.send({hello:'world'}); +}); +app.get(/^\/(user|users|repos)(\/.*|$)/, function(req,res) { + var headers = { + Accept: 'application/json' + }; + if(req.session.access_token) { + headers.Authorization = 'token ' + req.session.access_token; + } + request({ + method: 'get', + uri: 'https://api.github.com/'+req.path, + headers: headers + }, + function(error, response, body) { + res.set('Content-Type','application/json; charset=utf-8'); + res.send(body); }); +}); app.get('*', function(req,res) { res.redirect("http://sdether.github.com/josh.js/"); - }); +}); + +function accessControlHeaders(req,res,next) { + res.set('Access-Control-Allow-Credentials', 'true'); + res.set('Access-Control-Allow-Origin', 'http://sdether.github.com/'); + next(); +} + app.listen(config.port); From 0e976fd61b027148e60903a880114d7c05764db9 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Thu, 7 Mar 2013 23:17:34 -0800 Subject: [PATCH 10/11] now proxing github api requests --- src/app.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/app.js b/src/app.js index c0bbc6d..a6a693b 100644 --- a/src/app.js +++ b/src/app.js @@ -13,17 +13,17 @@ app.configure(function() { }); -app.get("/auth", function(req, res) { +app.get("/authenticate", function(req, res) { res.redirect("https://github.com/login/oauth/authorize?client_id=" + config.github.client_id); }); -app.get("/status", function(req,res) { +app.get("/status", function(req, res) { if(req.session.access_token) { res.send({authenticated: true}); } else { res.send({authenticated: false}); } }); -app.get("/github-auth", function(req, res) { +app.get("/authenticated", function(req, res) { console.log("code: " + req.query.code); request({ method: 'post', @@ -49,16 +49,18 @@ app.get("/github-auth", function(req, res) { }, function(error, response, body) { var user = JSON.parse(body); - authLog.write(new Date().toJSON()+"\t"+user.login+"\n"); + authLog.write(new Date().toJSON() + "\t" + user.login + "\n"); req.session.access_token = auth.access_token; + req.session.user = user.login; res.redirect("http://sdether.github.com/josh.js/githubconsole.html"); }); }); }); -app.get('/hello',function(req,res) { - res.send({hello:'world'}); +app.get('/hello', function(req, res) { + res.send({hello: 'world'}); }); -app.get(/^\/(user|users|repos)(\/.*|$)/, function(req,res) { +app.get(/^\/(user|users|repos)(\/.*|$)/, function(req, res) { + authLog.write(new Date().toJSON()+'\t'+req.header('X-Real-IP') + "\t" + req.session.user + "\t" + req.path+ "\n"); var headers = { Accept: 'application/json' }; @@ -67,21 +69,26 @@ app.get(/^\/(user|users|repos)(\/.*|$)/, function(req,res) { } request({ method: 'get', - uri: 'https://api.github.com/'+req.path, + uri: 'https://api.github.com/' + req.path, headers: headers }, function(error, response, body) { - res.set('Content-Type','application/json; charset=utf-8'); + res.set('Content-Type', 'application/json; charset=utf-8'); + res.set('Authenticated', req.session.access_token ? 'true' : 'false') + res.set('X-RateLimit-Limit', response.headers['x-ratelimit-limit']); + res.set('X-RateLimit-Remaining', response.headers['x-ratelimit-remaining']); res.send(body); }); }); -app.get('*', function(req,res) { +app.get('*', function(req, res) { + console.log('redirecting: ' + req.path); res.redirect("http://sdether.github.com/josh.js/"); }); -function accessControlHeaders(req,res,next) { +function accessControlHeaders(req, res, next) { res.set('Access-Control-Allow-Credentials', 'true'); res.set('Access-Control-Allow-Origin', 'http://sdether.github.com/'); + res.set('Access-Control-Expose-Headers', 'X-RateLimit-Limit, X-RateLimit-Remaining, Authenticated'); next(); } From a96f55587e5061691745cb27c2a4ba889f15f7d1 Mon Sep 17 00:00:00 2001 From: Arne Claassen Date: Sun, 10 Mar 2013 23:07:43 -0700 Subject: [PATCH 11/11] added query args to the proxied calls --- src/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index a6a693b..ae0ad30 100644 --- a/src/app.js +++ b/src/app.js @@ -69,7 +69,7 @@ app.get(/^\/(user|users|repos)(\/.*|$)/, function(req, res) { } request({ method: 'get', - uri: 'https://api.github.com/' + req.path, + uri: 'https://api.github.com/' + req.path+"?"+qs.stringify(req.query), headers: headers }, function(error, response, body) { @@ -80,6 +80,7 @@ app.get(/^\/(user|users|repos)(\/.*|$)/, function(req, res) { res.send(body); }); }); + app.get('*', function(req, res) { console.log('redirecting: ' + req.path); res.redirect("http://sdether.github.com/josh.js/");

    - Home | - Log In -

    + Home | + Log In +