Merge lp:~robru/cordova-cli/3.4-release into lp:cordova-cli
- 3.4-release
- Merge into trunk
Proposed by
Robert Bruce Park
Status: | Merged |
---|---|
Approved by: | Robert Bruce Park |
Approved revision: | 49 |
Merged at revision: | 45 |
Proposed branch: | lp:~robru/cordova-cli/3.4-release |
Merge into: | lp:cordova-cli |
Diff against target: |
19544 lines (+10808/-6917) 214 files modified
debian/changelog (+1/-2) debian/control (+1/-1) debian/rules (+3/-1) node_modules/cordova/RELEASENOTES.md (+9/-1) node_modules/cordova/_vendor/combined-stream/0.0.4/package.json (+2/-1) node_modules/cordova/_vendor/commander/1.1.1/.npmignore (+0/-4) node_modules/cordova/_vendor/commander/1.1.1/.travis.yml (+0/-4) node_modules/cordova/_vendor/commander/1.1.1/History.md (+0/-152) node_modules/cordova/_vendor/commander/1.1.1/Makefile (+0/-7) node_modules/cordova/_vendor/commander/1.1.1/Readme.md (+0/-270) node_modules/cordova/_vendor/commander/1.1.1/index.js (+0/-1131) node_modules/cordova/_vendor/commander/1.1.1/package.json (+0/-40) node_modules/cordova/_vendor/forever-agent/0.5.0/LICENSE (+0/-55) node_modules/cordova/_vendor/forever-agent/0.5.0/README.md (+0/-4) node_modules/cordova/_vendor/forever-agent/0.5.0/index.js (+0/-119) node_modules/cordova/_vendor/forever-agent/0.5.0/package.json (+0/-27) node_modules/cordova/_vendor/forever-agent/0.5.2/LICENSE (+55/-0) node_modules/cordova/_vendor/forever-agent/0.5.2/README.md (+4/-0) node_modules/cordova/_vendor/forever-agent/0.5.2/index.js (+119/-0) node_modules/cordova/_vendor/forever-agent/0.5.2/package.json (+27/-0) node_modules/cordova/_vendor/graceful-fs/2.0.1/.npmignore (+0/-1) node_modules/cordova/_vendor/graceful-fs/2.0.1/LICENSE (+0/-27) node_modules/cordova/_vendor/graceful-fs/2.0.1/README.md (+0/-26) node_modules/cordova/_vendor/graceful-fs/2.0.1/graceful-fs.js (+0/-159) node_modules/cordova/_vendor/graceful-fs/2.0.1/package.json (+0/-48) node_modules/cordova/_vendor/graceful-fs/2.0.1/polyfills.js (+0/-228) node_modules/cordova/_vendor/graceful-fs/2.0.1/test/open.js (+0/-39) node_modules/cordova/_vendor/graceful-fs/2.0.2/.npmignore (+1/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/LICENSE (+27/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/README.md (+26/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/graceful-fs.js (+161/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/package.json (+48/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/polyfills.js (+228/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/test/open.js (+39/-0) node_modules/cordova/_vendor/graceful-fs/2.0.2/test/readdir-sort.js (+21/-0) node_modules/cordova/_vendor/http-signature/0.10.0/.dir-locals.el (+6/-0) node_modules/cordova/_vendor/http-signature/0.10.0/.npmignore (+7/-0) node_modules/cordova/_vendor/http-signature/0.10.0/LICENSE (+18/-0) node_modules/cordova/_vendor/http-signature/0.10.0/README.md (+75/-0) node_modules/cordova/_vendor/http-signature/0.10.0/http_signing.md (+296/-0) node_modules/cordova/_vendor/http-signature/0.10.0/lib/index.js (+25/-0) node_modules/cordova/_vendor/http-signature/0.10.0/lib/parser.js (+304/-0) node_modules/cordova/_vendor/http-signature/0.10.0/lib/signer.js (+179/-0) node_modules/cordova/_vendor/http-signature/0.10.0/lib/util.js (+249/-0) node_modules/cordova/_vendor/http-signature/0.10.0/lib/verify.js (+42/-0) node_modules/cordova/_vendor/http-signature/0.10.0/package.json (+35/-0) node_modules/cordova/_vendor/keypress/0.1.0/README.md (+0/-101) node_modules/cordova/_vendor/keypress/0.1.0/index.js (+0/-346) node_modules/cordova/_vendor/keypress/0.1.0/package.json (+0/-31) node_modules/cordova/_vendor/keypress/0.1.0/test.js (+0/-28) node_modules/cordova/_vendor/minimist/0.0.5/.travis.yml (+0/-4) node_modules/cordova/_vendor/minimist/0.0.5/LICENSE (+0/-18) node_modules/cordova/_vendor/minimist/0.0.5/example/parse.js (+0/-2) node_modules/cordova/_vendor/minimist/0.0.5/index.js (+0/-193) node_modules/cordova/_vendor/minimist/0.0.5/package.json (+0/-50) node_modules/cordova/_vendor/minimist/0.0.5/readme.markdown (+0/-73) node_modules/cordova/_vendor/minimist/0.0.5/test/dash.js (+0/-24) node_modules/cordova/_vendor/minimist/0.0.5/test/default_bool.js (+0/-20) node_modules/cordova/_vendor/minimist/0.0.5/test/dotted.js (+0/-16) node_modules/cordova/_vendor/minimist/0.0.5/test/long.js (+0/-31) node_modules/cordova/_vendor/minimist/0.0.5/test/parse.js (+0/-297) node_modules/cordova/_vendor/minimist/0.0.5/test/parse_modified.js (+0/-9) node_modules/cordova/_vendor/minimist/0.0.5/test/short.js (+0/-85) node_modules/cordova/_vendor/minimist/0.0.5/test/whitespace.js (+0/-8) node_modules/cordova/_vendor/minimist/0.0.8/.travis.yml (+4/-0) node_modules/cordova/_vendor/minimist/0.0.8/LICENSE (+18/-0) node_modules/cordova/_vendor/minimist/0.0.8/example/parse.js (+2/-0) node_modules/cordova/_vendor/minimist/0.0.8/index.js (+187/-0) node_modules/cordova/_vendor/minimist/0.0.8/package.json (+50/-0) node_modules/cordova/_vendor/minimist/0.0.8/readme.markdown (+73/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/dash.js (+24/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/default_bool.js (+20/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/dotted.js (+16/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/long.js (+31/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/parse.js (+318/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/parse_modified.js (+9/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/short.js (+67/-0) node_modules/cordova/_vendor/minimist/0.0.8/test/whitespace.js (+8/-0) node_modules/cordova/_vendor/nopt/2.1.2/.npmignore (+0/-1) node_modules/cordova/_vendor/nopt/2.1.2/LICENSE (+0/-23) node_modules/cordova/_vendor/nopt/2.1.2/README.md (+0/-210) node_modules/cordova/_vendor/nopt/2.1.2/bin/nopt.js (+0/-51) node_modules/cordova/_vendor/nopt/2.1.2/examples/my-program.js (+0/-30) node_modules/cordova/_vendor/nopt/2.1.2/lib/nopt.js (+0/-612) node_modules/cordova/_vendor/nopt/2.1.2/package.json (+0/-35) node_modules/cordova/_vendor/nopt/2.2.0/.npmignore (+1/-0) node_modules/cordova/_vendor/nopt/2.2.0/LICENSE (+23/-0) node_modules/cordova/_vendor/nopt/2.2.0/README.md (+210/-0) node_modules/cordova/_vendor/nopt/2.2.0/bin/nopt.js (+51/-0) node_modules/cordova/_vendor/nopt/2.2.0/examples/my-program.js (+30/-0) node_modules/cordova/_vendor/nopt/2.2.0/lib/nopt.js (+407/-0) node_modules/cordova/_vendor/nopt/2.2.0/package.json (+38/-0) node_modules/cordova/_vendor/nopt/2.2.0/test/basic.js (+235/-0) node_modules/cordova/_vendor/npmconf/0.1.12/.npmignore (+0/-1) node_modules/cordova/_vendor/npmconf/0.1.12/LICENSE (+0/-27) node_modules/cordova/_vendor/npmconf/0.1.12/README.md (+0/-33) node_modules/cordova/_vendor/npmconf/0.1.12/config-defs.js (+0/-353) node_modules/cordova/_vendor/npmconf/0.1.12/npmconf.js (+0/-338) node_modules/cordova/_vendor/npmconf/0.1.12/package.json (+0/-49) node_modules/cordova/_vendor/npmconf/0.1.12/test/00-setup.js (+0/-27) node_modules/cordova/_vendor/npmconf/0.1.12/test/basic.js (+0/-74) node_modules/cordova/_vendor/npmconf/0.1.12/test/builtin.js (+0/-74) node_modules/cordova/_vendor/npmconf/0.1.12/test/fixtures/builtin (+0/-1) node_modules/cordova/_vendor/npmconf/0.1.12/test/fixtures/globalconfig (+0/-1) node_modules/cordova/_vendor/npmconf/0.1.12/test/fixtures/userconfig (+0/-22) node_modules/cordova/_vendor/npmconf/0.1.12/test/save.js (+0/-74) node_modules/cordova/_vendor/npmconf/0.1.13/.npmignore (+1/-0) node_modules/cordova/_vendor/npmconf/0.1.13/LICENSE (+27/-0) node_modules/cordova/_vendor/npmconf/0.1.13/README.md (+33/-0) node_modules/cordova/_vendor/npmconf/0.1.13/config-defs.js (+356/-0) node_modules/cordova/_vendor/npmconf/0.1.13/npmconf.js (+338/-0) node_modules/cordova/_vendor/npmconf/0.1.13/package.json (+49/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/00-setup.js (+27/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/basic.js (+74/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/builtin.js (+74/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/fixtures/builtin (+1/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/fixtures/globalconfig (+1/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/fixtures/userconfig (+22/-0) node_modules/cordova/_vendor/npmconf/0.1.13/test/save.js (+74/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/README.md (+27/-1) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/base.js (+5/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/help.txt (+31/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/platforms/android/android.xml (+12/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/platforms/android/base.java (+32/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/platforms/ios/base.m (+28/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/doc/platforms/ios/ios.xml (+9/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/main.js (+2/-2) node_modules/cordova/_vendor/plugman/0.19.1-dev/package.json (+4/-3) node_modules/cordova/_vendor/plugman/0.19.1-dev/plugman.js (+42/-2) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/create.js (+81/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/fetch.js (+1/-1) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/install.js (+48/-31) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platform.js (+119/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platform_operation.js (+5/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platforms/android.js (+2/-2) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platforms/ios.js (+24/-8) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platforms/windows8.js (+30/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/platforms/wp8.js (+30/-0) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/prepare.js (+1/-1) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/registry/registry.js (+80/-37) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/util/config-changes.js (+648/-422) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/util/csproj.js (+60/-50) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/util/plugins.js (+0/-15) node_modules/cordova/_vendor/plugman/0.19.1-dev/src/util/w8jsproj.js (+53/-2) node_modules/cordova/_vendor/request/2.22.0/LICENSE (+55/-0) node_modules/cordova/_vendor/request/2.22.0/README.md (+344/-0) node_modules/cordova/_vendor/request/2.22.0/index.js (+1377/-0) node_modules/cordova/_vendor/request/2.22.0/package.json (+47/-0) node_modules/cordova/_vendor/request/2.22.0/tests/run.js (+40/-0) node_modules/cordova/_vendor/request/2.22.0/tests/server.js (+90/-0) node_modules/cordova/_vendor/request/2.22.0/tests/squid.conf (+77/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/ca.cnf (+20/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/ca.crt (+17/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/ca.csr (+13/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/ca.key (+18/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/ca.srl (+1/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/server.cnf (+19/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/server.crt (+16/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/server.csr (+11/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/server.js (+28/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/ca/server.key (+9/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/npm-ca.crt (+16/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/test.crt (+15/-0) node_modules/cordova/_vendor/request/2.22.0/tests/ssl/test.key (+15/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-agentOptions.js (+23/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-basic-auth.js (+143/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-body.js (+122/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-defaults.js (+129/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-digest-auth.js (+69/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-emptyBody.js (+20/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-errors.js (+37/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-follow-all-303.js (+30/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-follow-all.js (+35/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-form.js (+79/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-hawk.js (+33/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-headers.js (+52/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-http-signature.js (+106/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-httpModule.js (+94/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-https-strict.js (+97/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-https.js (+87/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-localAddress.js (+15/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-oauth.js (+117/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-onelineproxy.js (+46/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-params.js (+93/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-piped-redirect.js (+42/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-pipes.js (+216/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-pool.js (+16/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-protocol-changing-redirect.js (+61/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-proxy.js (+39/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-qs.js (+42/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-redirect.js (+155/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-s3.js (+13/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-timeout.js (+87/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-toJSON.js (+14/-0) node_modules/cordova/_vendor/request/2.22.0/tests/test-tunnel.js (+75/-0) node_modules/cordova/_vendor/tar.gz/0.1.1/.npmignore (+0/-3) node_modules/cordova/_vendor/tar.gz/0.1.1/Cakefile (+0/-75) node_modules/cordova/_vendor/tar.gz/0.1.1/LICENSE (+0/-20) node_modules/cordova/_vendor/tar.gz/0.1.1/README.md (+0/-103) node_modules/cordova/_vendor/tar.gz/0.1.1/bin/targz (+0/-55) node_modules/cordova/_vendor/tar.gz/0.1.1/example/example.coffee (+0/-10) node_modules/cordova/_vendor/tar.gz/0.1.1/example/example.js (+0/-10) node_modules/cordova/_vendor/tar.gz/0.1.1/lib/targz.js (+0/-82) node_modules/cordova/_vendor/tar.gz/0.1.1/package.json (+0/-61) node_modules/cordova/_vendor/tar.gz/0.1.1/src/targz.coffee (+0/-80) node_modules/cordova/_vendor/tar.gz/0.1.1/test/compress/test.txt (+0/-47) node_modules/cordova/doc/help.txt (+1/-0) node_modules/cordova/package.json (+3/-3) node_modules/cordova/platforms.js (+10/-10) node_modules/cordova/src/cli.js (+0/-4) node_modules/cordova/src/metadata/amazon_fireos_parser.js (+23/-57) node_modules/cordova/src/metadata/android_parser.js (+35/-0) node_modules/cordova/src/platform.js (+39/-0) node_modules/cordova/templates/hooks-README.md (+1/-1) |
To merge this branch: | bzr merge lp:~robru/cordova-cli/3.4-release |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Cordova Ubuntu Team | Pending | ||
Review via email: mp+207736@code.launchpad.net |
Commit message
Update to the Cordova 3.4 release.
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-02-04 16:30:54 +0000 | |||
3 | +++ debian/changelog 2014-02-21 20:33:03 +0000 | |||
4 | @@ -1,7 +1,6 @@ | |||
6 | 1 | cordova-cli (3.4-pre-0ubuntu1) UNRELEASED; urgency=low | 1 | cordova-cli (3.4-0ubuntu1) UNRELEASED; urgency=low |
7 | 2 | 2 | ||
8 | 3 | [ Robert Bruce Park ] | 3 | [ Robert Bruce Park ] |
9 | 4 | * Initial release. | 4 | * Initial release. |
10 | 5 | * Automatic snapshot from revision 41 (bootstrap) | ||
11 | 6 | 5 | ||
12 | 7 | -- Robert Bruce Park <robert.park@canonical.com> Tue, 04 Feb 2014 15:54:38 +0000 | 6 | -- Robert Bruce Park <robert.park@canonical.com> Tue, 04 Feb 2014 15:54:38 +0000 |
13 | 8 | 7 | ||
14 | === modified file 'debian/control' | |||
15 | --- debian/control 2014-02-04 15:37:46 +0000 | |||
16 | +++ debian/control 2014-02-21 20:33:03 +0000 | |||
17 | @@ -1,6 +1,6 @@ | |||
18 | 1 | Source: cordova-cli | 1 | Source: cordova-cli |
19 | 2 | Section: misc | 2 | Section: misc |
21 | 3 | Priority: extra | 3 | Priority: optional |
22 | 4 | Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com> |
23 | 5 | Build-Depends: bzr, | 5 | Build-Depends: bzr, |
24 | 6 | debhelper (>= 9), | 6 | debhelper (>= 9), |
25 | 7 | 7 | ||
26 | === modified file 'debian/rules' | |||
27 | --- debian/rules 2014-02-05 14:12:31 +0000 | |||
28 | +++ debian/rules 2014-02-21 20:33:03 +0000 | |||
29 | @@ -12,9 +12,10 @@ | |||
30 | 12 | FIND := find debian/cordova-cli/ | 12 | FIND := find debian/cordova-cli/ |
31 | 13 | 13 | ||
32 | 14 | cordova-%: | 14 | cordova-%: |
34 | 15 | git clone --depth=1 git://git.apache.org/cordova-$*.git | 15 | git clone --depth=1 https://git-wip-us.apache.org/repos/asf/cordova-$* |
35 | 16 | 16 | ||
36 | 17 | node_modules: cordova-cli cordova-plugman | 17 | node_modules: cordova-cli cordova-plugman |
37 | 18 | cd cordova-cli && git fetch --tags && git checkout 3.4.0-0.1.0 | ||
38 | 18 | npm install ./cordova-plugman/ ./cordova-cli/ | 19 | npm install ./cordova-plugman/ ./cordova-cli/ |
39 | 19 | rm -rf ./node_modules/cordova/node_modules/plugman/ | 20 | rm -rf ./node_modules/cordova/node_modules/plugman/ |
40 | 20 | mv ./node_modules/plugman/ ./node_modules/cordova/node_modules/ | 21 | mv ./node_modules/plugman/ ./node_modules/cordova/node_modules/ |
41 | @@ -30,6 +31,7 @@ | |||
42 | 30 | override_dh_install: | 31 | override_dh_install: |
43 | 31 | dh_install --fail-missing | 32 | dh_install --fail-missing |
44 | 32 | $(FIND) -name '*.sln' -delete | 33 | $(FIND) -name '*.sln' -delete |
45 | 34 | $(FIND) -name '.gitmodules' -delete | ||
46 | 33 | $(FIND) -name '*[Ll][Ii][Cc][Ee][Nn][CcSs][Ee]*' -delete | 35 | $(FIND) -name '*[Ll][Ii][Cc][Ee][Nn][CcSs][Ee]*' -delete |
47 | 34 | $(FIND) -name 'examples' -type d -prune -exec rm -rf \{} \; | 36 | $(FIND) -name 'examples' -type d -prune -exec rm -rf \{} \; |
48 | 35 | $(FIND) ! -path '*/bin/*' -type f -exec chmod -x \{} \; | 37 | $(FIND) ! -path '*/bin/*' -type f -exec chmod -x \{} \; |
49 | 36 | 38 | ||
50 | === modified file 'node_modules/cordova/RELEASENOTES.md' | |||
51 | --- node_modules/cordova/RELEASENOTES.md 2014-02-04 15:29:21 +0000 | |||
52 | +++ node_modules/cordova/RELEASENOTES.md 2014-02-21 20:33:03 +0000 | |||
53 | @@ -20,6 +20,15 @@ | |||
54 | 20 | --> | 20 | --> |
55 | 21 | # Cordova-cli Release Notes | 21 | # Cordova-cli Release Notes |
56 | 22 | 22 | ||
57 | 23 | ## 3.4.0-0.1.0 (Feb 14, 2014) | ||
58 | 24 | * CB-5638 Clean-up: remove unreachable info case from function | ||
59 | 25 | * CB-5937 Add "platform check" command: Shows platforms that are out of date | ||
60 | 26 | * CB-5634 Minor refactoring + tests for Android's orientation preference. | ||
61 | 27 | * CB-5634 Set Android orientation from config.xml | ||
62 | 28 | * Upleveled amazon_fireos_parser. Making it at par with android_parser.js | ||
63 | 29 | * CB-5947 Throw when trying to create project inside custom www. | ||
64 | 30 | * CB-4153 Update help.txt about --source -> --copy-from | ||
65 | 31 | |||
66 | 23 | ## 3.3.1-0.3.1 (Jan 31, 2014) | 32 | ## 3.3.1-0.3.1 (Jan 31, 2014) |
67 | 24 | * CB-4153 Rename --source and --link flags to --copy-from and --link-to | 33 | * CB-4153 Rename --source and --link flags to --copy-from and --link-to |
68 | 25 | 34 | ||
69 | @@ -222,4 +231,3 @@ | |||
70 | 222 | 231 | ||
71 | 223 | - Plugins are now installed serially across all installed platforms, rather than in parallel. This avoids race conditions in dependency installation. [CB-4184](https://issues.apache.org/jira/browse/CB-4184) | 232 | - Plugins are now installed serially across all installed platforms, rather than in parallel. This avoids race conditions in dependency installation. [CB-4184](https://issues.apache.org/jira/browse/CB-4184) |
72 | 224 | - (WP8) All files from project www dir are now copied into the binary, not the top-level www. This means merges and plugin assets are correctly handled. | 233 | - (WP8) All files from project www dir are now copied into the binary, not the top-level www. This means merges and plugin assets are correctly handled. |
73 | 225 | |||
74 | 226 | 234 | ||
75 | === modified file 'node_modules/cordova/_vendor/combined-stream/0.0.4/package.json' | |||
76 | --- node_modules/cordova/_vendor/combined-stream/0.0.4/package.json 2013-12-12 20:49:30 +0000 | |||
77 | +++ node_modules/cordova/_vendor/combined-stream/0.0.4/package.json 2014-02-21 20:33:03 +0000 | |||
78 | @@ -28,5 +28,6 @@ | |||
79 | 28 | "url": "https://github.com/felixge/node-combined-stream/issues" | 28 | "url": "https://github.com/felixge/node-combined-stream/issues" |
80 | 29 | }, | 29 | }, |
81 | 30 | "_id": "combined-stream@0.0.4", | 30 | "_id": "combined-stream@0.0.4", |
83 | 31 | "_from": "combined-stream@~0.0.4" | 31 | "_from": "combined-stream@~0.0.4", |
84 | 32 | "scripts": {} | ||
85 | 32 | } | 33 | } |
86 | 33 | 34 | ||
87 | === removed directory 'node_modules/cordova/_vendor/commander' | |||
88 | === removed directory 'node_modules/cordova/_vendor/commander/1.1.1' | |||
89 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/.npmignore' | |||
90 | --- node_modules/cordova/_vendor/commander/1.1.1/.npmignore 2013-12-12 20:49:30 +0000 | |||
91 | +++ node_modules/cordova/_vendor/commander/1.1.1/.npmignore 1970-01-01 00:00:00 +0000 | |||
92 | @@ -1,4 +0,0 @@ | |||
93 | 1 | support | ||
94 | 2 | test | ||
95 | 3 | examples | ||
96 | 4 | *.sock | ||
97 | 5 | 0 | ||
98 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/.travis.yml' | |||
99 | --- node_modules/cordova/_vendor/commander/1.1.1/.travis.yml 2013-12-12 20:49:30 +0000 | |||
100 | +++ node_modules/cordova/_vendor/commander/1.1.1/.travis.yml 1970-01-01 00:00:00 +0000 | |||
101 | @@ -1,4 +0,0 @@ | |||
102 | 1 | language: node_js | ||
103 | 2 | node_js: | ||
104 | 3 | - 0.4 | ||
105 | 4 | - 0.6 | ||
106 | 5 | 0 | ||
107 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/History.md' | |||
108 | --- node_modules/cordova/_vendor/commander/1.1.1/History.md 2013-12-12 20:49:30 +0000 | |||
109 | +++ node_modules/cordova/_vendor/commander/1.1.1/History.md 1970-01-01 00:00:00 +0000 | |||
110 | @@ -1,152 +0,0 @@ | |||
111 | 1 | |||
112 | 2 | 1.1.1 / 2012-11-20 | ||
113 | 3 | ================== | ||
114 | 4 | |||
115 | 5 | * add more sub-command padding | ||
116 | 6 | * fix .usage() when args are present. Closes #106 | ||
117 | 7 | |||
118 | 8 | 1.1.0 / 2012-11-16 | ||
119 | 9 | ================== | ||
120 | 10 | |||
121 | 11 | * add git-style executable subcommand support. Closes #94 | ||
122 | 12 | |||
123 | 13 | 1.0.5 / 2012-10-09 | ||
124 | 14 | ================== | ||
125 | 15 | |||
126 | 16 | * fix `--name` clobbering. Closes #92 | ||
127 | 17 | * fix examples/help. Closes #89 | ||
128 | 18 | |||
129 | 19 | 1.0.4 / 2012-09-03 | ||
130 | 20 | ================== | ||
131 | 21 | |||
132 | 22 | * add `outputHelp()` method. | ||
133 | 23 | |||
134 | 24 | 1.0.3 / 2012-08-30 | ||
135 | 25 | ================== | ||
136 | 26 | |||
137 | 27 | * remove invalid .version() defaulting | ||
138 | 28 | |||
139 | 29 | 1.0.2 / 2012-08-24 | ||
140 | 30 | ================== | ||
141 | 31 | |||
142 | 32 | * add `--foo=bar` support [arv] | ||
143 | 33 | * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus] | ||
144 | 34 | |||
145 | 35 | 1.0.1 / 2012-08-03 | ||
146 | 36 | ================== | ||
147 | 37 | |||
148 | 38 | * fix issue #56 | ||
149 | 39 | * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode()) | ||
150 | 40 | |||
151 | 41 | 1.0.0 / 2012-07-05 | ||
152 | 42 | ================== | ||
153 | 43 | |||
154 | 44 | * add support for optional option descriptions | ||
155 | 45 | * add defaulting of `.version()` to package.json's version | ||
156 | 46 | |||
157 | 47 | 0.6.1 / 2012-06-01 | ||
158 | 48 | ================== | ||
159 | 49 | |||
160 | 50 | * Added: append (yes or no) on confirmation | ||
161 | 51 | * Added: allow node.js v0.7.x | ||
162 | 52 | |||
163 | 53 | 0.6.0 / 2012-04-10 | ||
164 | 54 | ================== | ||
165 | 55 | |||
166 | 56 | * Added `.prompt(obj, callback)` support. Closes #49 | ||
167 | 57 | * Added default support to .choose(). Closes #41 | ||
168 | 58 | * Fixed the choice example | ||
169 | 59 | |||
170 | 60 | 0.5.1 / 2011-12-20 | ||
171 | 61 | ================== | ||
172 | 62 | |||
173 | 63 | * Fixed `password()` for recent nodes. Closes #36 | ||
174 | 64 | |||
175 | 65 | 0.5.0 / 2011-12-04 | ||
176 | 66 | ================== | ||
177 | 67 | |||
178 | 68 | * Added sub-command option support [itay] | ||
179 | 69 | |||
180 | 70 | 0.4.3 / 2011-12-04 | ||
181 | 71 | ================== | ||
182 | 72 | |||
183 | 73 | * Fixed custom help ordering. Closes #32 | ||
184 | 74 | |||
185 | 75 | 0.4.2 / 2011-11-24 | ||
186 | 76 | ================== | ||
187 | 77 | |||
188 | 78 | * Added travis support | ||
189 | 79 | * Fixed: line-buffered input automatically trimmed. Closes #31 | ||
190 | 80 | |||
191 | 81 | 0.4.1 / 2011-11-18 | ||
192 | 82 | ================== | ||
193 | 83 | |||
194 | 84 | * Removed listening for "close" on --help | ||
195 | 85 | |||
196 | 86 | 0.4.0 / 2011-11-15 | ||
197 | 87 | ================== | ||
198 | 88 | |||
199 | 89 | * Added support for `--`. Closes #24 | ||
200 | 90 | |||
201 | 91 | 0.3.3 / 2011-11-14 | ||
202 | 92 | ================== | ||
203 | 93 | |||
204 | 94 | * Fixed: wait for close event when writing help info [Jerry Hamlet] | ||
205 | 95 | |||
206 | 96 | 0.3.2 / 2011-11-01 | ||
207 | 97 | ================== | ||
208 | 98 | |||
209 | 99 | * Fixed long flag definitions with values [felixge] | ||
210 | 100 | |||
211 | 101 | 0.3.1 / 2011-10-31 | ||
212 | 102 | ================== | ||
213 | 103 | |||
214 | 104 | * Changed `--version` short flag to `-V` from `-v` | ||
215 | 105 | * Changed `.version()` so it's configurable [felixge] | ||
216 | 106 | |||
217 | 107 | 0.3.0 / 2011-10-31 | ||
218 | 108 | ================== | ||
219 | 109 | |||
220 | 110 | * Added support for long flags only. Closes #18 | ||
221 | 111 | |||
222 | 112 | 0.2.1 / 2011-10-24 | ||
223 | 113 | ================== | ||
224 | 114 | |||
225 | 115 | * "node": ">= 0.4.x < 0.7.0". Closes #20 | ||
226 | 116 | |||
227 | 117 | 0.2.0 / 2011-09-26 | ||
228 | 118 | ================== | ||
229 | 119 | |||
230 | 120 | * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] | ||
231 | 121 | |||
232 | 122 | 0.1.0 / 2011-08-24 | ||
233 | 123 | ================== | ||
234 | 124 | |||
235 | 125 | * Added support for custom `--help` output | ||
236 | 126 | |||
237 | 127 | 0.0.5 / 2011-08-18 | ||
238 | 128 | ================== | ||
239 | 129 | |||
240 | 130 | * Changed: when the user enters nothing prompt for password again | ||
241 | 131 | * Fixed issue with passwords beginning with numbers [NuckChorris] | ||
242 | 132 | |||
243 | 133 | 0.0.4 / 2011-08-15 | ||
244 | 134 | ================== | ||
245 | 135 | |||
246 | 136 | * Fixed `Commander#args` | ||
247 | 137 | |||
248 | 138 | 0.0.3 / 2011-08-15 | ||
249 | 139 | ================== | ||
250 | 140 | |||
251 | 141 | * Added default option value support | ||
252 | 142 | |||
253 | 143 | 0.0.2 / 2011-08-15 | ||
254 | 144 | ================== | ||
255 | 145 | |||
256 | 146 | * Added mask support to `Command#password(str[, mask], fn)` | ||
257 | 147 | * Added `Command#password(str, fn)` | ||
258 | 148 | |||
259 | 149 | 0.0.1 / 2010-01-03 | ||
260 | 150 | ================== | ||
261 | 151 | |||
262 | 152 | * Initial release | ||
263 | 153 | 0 | ||
264 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/Makefile' | |||
265 | --- node_modules/cordova/_vendor/commander/1.1.1/Makefile 2013-12-12 20:49:30 +0000 | |||
266 | +++ node_modules/cordova/_vendor/commander/1.1.1/Makefile 1970-01-01 00:00:00 +0000 | |||
267 | @@ -1,7 +0,0 @@ | |||
268 | 1 | |||
269 | 2 | TESTS = $(shell find test/test.*.js) | ||
270 | 3 | |||
271 | 4 | test: | ||
272 | 5 | @./test/run $(TESTS) | ||
273 | 6 | |||
274 | 7 | .PHONY: test | ||
275 | 8 | \ No newline at end of file | 0 | \ No newline at end of file |
276 | 9 | 1 | ||
277 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/Readme.md' | |||
278 | --- node_modules/cordova/_vendor/commander/1.1.1/Readme.md 2013-12-12 20:49:30 +0000 | |||
279 | +++ node_modules/cordova/_vendor/commander/1.1.1/Readme.md 1970-01-01 00:00:00 +0000 | |||
280 | @@ -1,270 +0,0 @@ | |||
281 | 1 | # Commander.js | ||
282 | 2 | |||
283 | 3 | The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). | ||
284 | 4 | |||
285 | 5 | [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) | ||
286 | 6 | |||
287 | 7 | ## Installation | ||
288 | 8 | |||
289 | 9 | $ npm install commander | ||
290 | 10 | |||
291 | 11 | ## Option parsing | ||
292 | 12 | |||
293 | 13 | 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. | ||
294 | 14 | |||
295 | 15 | ```js | ||
296 | 16 | #!/usr/bin/env node | ||
297 | 17 | |||
298 | 18 | /** | ||
299 | 19 | * Module dependencies. | ||
300 | 20 | */ | ||
301 | 21 | |||
302 | 22 | var program = require('commander'); | ||
303 | 23 | |||
304 | 24 | program | ||
305 | 25 | .version('0.0.1') | ||
306 | 26 | .option('-p, --peppers', 'Add peppers') | ||
307 | 27 | .option('-P, --pineapple', 'Add pineapple') | ||
308 | 28 | .option('-b, --bbq', 'Add bbq sauce') | ||
309 | 29 | .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') | ||
310 | 30 | .parse(process.argv); | ||
311 | 31 | |||
312 | 32 | console.log('you ordered a pizza with:'); | ||
313 | 33 | if (program.peppers) console.log(' - peppers'); | ||
314 | 34 | if (program.pineapple) console.log(' - pineappe'); | ||
315 | 35 | if (program.bbq) console.log(' - bbq'); | ||
316 | 36 | console.log(' - %s cheese', program.cheese); | ||
317 | 37 | ``` | ||
318 | 38 | |||
319 | 39 | 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. | ||
320 | 40 | |||
321 | 41 | ## Automated --help | ||
322 | 42 | |||
323 | 43 | The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: | ||
324 | 44 | |||
325 | 45 | ``` | ||
326 | 46 | $ ./examples/pizza --help | ||
327 | 47 | |||
328 | 48 | Usage: pizza [options] | ||
329 | 49 | |||
330 | 50 | Options: | ||
331 | 51 | |||
332 | 52 | -V, --version output the version number | ||
333 | 53 | -p, --peppers Add peppers | ||
334 | 54 | -P, --pineapple Add pineappe | ||
335 | 55 | -b, --bbq Add bbq sauce | ||
336 | 56 | -c, --cheese <type> Add the specified type of cheese [marble] | ||
337 | 57 | -h, --help output usage information | ||
338 | 58 | |||
339 | 59 | ``` | ||
340 | 60 | |||
341 | 61 | ## Coercion | ||
342 | 62 | |||
343 | 63 | ```js | ||
344 | 64 | function range(val) { | ||
345 | 65 | return val.split('..').map(Number); | ||
346 | 66 | } | ||
347 | 67 | |||
348 | 68 | function list(val) { | ||
349 | 69 | return val.split(','); | ||
350 | 70 | } | ||
351 | 71 | |||
352 | 72 | program | ||
353 | 73 | .version('0.0.1') | ||
354 | 74 | .usage('[options] <file ...>') | ||
355 | 75 | .option('-i, --integer <n>', 'An integer argument', parseInt) | ||
356 | 76 | .option('-f, --float <n>', 'A float argument', parseFloat) | ||
357 | 77 | .option('-r, --range <a>..<b>', 'A range', range) | ||
358 | 78 | .option('-l, --list <items>', 'A list', list) | ||
359 | 79 | .option('-o, --optional [value]', 'An optional value') | ||
360 | 80 | .parse(process.argv); | ||
361 | 81 | |||
362 | 82 | console.log(' int: %j', program.integer); | ||
363 | 83 | console.log(' float: %j', program.float); | ||
364 | 84 | console.log(' optional: %j', program.optional); | ||
365 | 85 | program.range = program.range || []; | ||
366 | 86 | console.log(' range: %j..%j', program.range[0], program.range[1]); | ||
367 | 87 | console.log(' list: %j', program.list); | ||
368 | 88 | console.log(' args: %j', program.args); | ||
369 | 89 | ``` | ||
370 | 90 | |||
371 | 91 | ## Custom help | ||
372 | 92 | |||
373 | 93 | You can display arbitrary `-h, --help` information | ||
374 | 94 | by listening for "--help". Commander will automatically | ||
375 | 95 | exit once you are done so that the remainder of your program | ||
376 | 96 | does not execute causing undesired behaviours, for example | ||
377 | 97 | in the following executable "stuff" will not output when | ||
378 | 98 | `--help` is used. | ||
379 | 99 | |||
380 | 100 | ```js | ||
381 | 101 | #!/usr/bin/env node | ||
382 | 102 | |||
383 | 103 | /** | ||
384 | 104 | * Module dependencies. | ||
385 | 105 | */ | ||
386 | 106 | |||
387 | 107 | var program = require('../'); | ||
388 | 108 | |||
389 | 109 | function list(val) { | ||
390 | 110 | return val.split(',').map(Number); | ||
391 | 111 | } | ||
392 | 112 | |||
393 | 113 | program | ||
394 | 114 | .version('0.0.1') | ||
395 | 115 | .option('-f, --foo', 'enable some foo') | ||
396 | 116 | .option('-b, --bar', 'enable some bar') | ||
397 | 117 | .option('-B, --baz', 'enable some baz'); | ||
398 | 118 | |||
399 | 119 | // must be before .parse() since | ||
400 | 120 | // node's emit() is immediate | ||
401 | 121 | |||
402 | 122 | program.on('--help', function(){ | ||
403 | 123 | console.log(' Examples:'); | ||
404 | 124 | console.log(''); | ||
405 | 125 | console.log(' $ custom-help --help'); | ||
406 | 126 | console.log(' $ custom-help -h'); | ||
407 | 127 | console.log(''); | ||
408 | 128 | }); | ||
409 | 129 | |||
410 | 130 | program.parse(process.argv); | ||
411 | 131 | |||
412 | 132 | console.log('stuff'); | ||
413 | 133 | ``` | ||
414 | 134 | |||
415 | 135 | yielding the following help output: | ||
416 | 136 | |||
417 | 137 | ``` | ||
418 | 138 | |||
419 | 139 | Usage: custom-help [options] | ||
420 | 140 | |||
421 | 141 | Options: | ||
422 | 142 | |||
423 | 143 | -h, --help output usage information | ||
424 | 144 | -V, --version output the version number | ||
425 | 145 | -f, --foo enable some foo | ||
426 | 146 | -b, --bar enable some bar | ||
427 | 147 | -B, --baz enable some baz | ||
428 | 148 | |||
429 | 149 | Examples: | ||
430 | 150 | |||
431 | 151 | $ custom-help --help | ||
432 | 152 | $ custom-help -h | ||
433 | 153 | |||
434 | 154 | ``` | ||
435 | 155 | |||
436 | 156 | ## .prompt(msg, fn) | ||
437 | 157 | |||
438 | 158 | Single-line prompt: | ||
439 | 159 | |||
440 | 160 | ```js | ||
441 | 161 | program.prompt('name: ', function(name){ | ||
442 | 162 | console.log('hi %s', name); | ||
443 | 163 | }); | ||
444 | 164 | ``` | ||
445 | 165 | |||
446 | 166 | Multi-line prompt: | ||
447 | 167 | |||
448 | 168 | ```js | ||
449 | 169 | program.prompt('description:', function(name){ | ||
450 | 170 | console.log('hi %s', name); | ||
451 | 171 | }); | ||
452 | 172 | ``` | ||
453 | 173 | |||
454 | 174 | Coercion: | ||
455 | 175 | |||
456 | 176 | ```js | ||
457 | 177 | program.prompt('Age: ', Number, function(age){ | ||
458 | 178 | console.log('age: %j', age); | ||
459 | 179 | }); | ||
460 | 180 | ``` | ||
461 | 181 | |||
462 | 182 | ```js | ||
463 | 183 | program.prompt('Birthdate: ', Date, function(date){ | ||
464 | 184 | console.log('date: %s', date); | ||
465 | 185 | }); | ||
466 | 186 | ``` | ||
467 | 187 | |||
468 | 188 | ## .password(msg[, mask], fn) | ||
469 | 189 | |||
470 | 190 | Prompt for password without echoing: | ||
471 | 191 | |||
472 | 192 | ```js | ||
473 | 193 | program.password('Password: ', function(pass){ | ||
474 | 194 | console.log('got "%s"', pass); | ||
475 | 195 | process.stdin.destroy(); | ||
476 | 196 | }); | ||
477 | 197 | ``` | ||
478 | 198 | |||
479 | 199 | Prompt for password with mask char "*": | ||
480 | 200 | |||
481 | 201 | ```js | ||
482 | 202 | program.password('Password: ', '*', function(pass){ | ||
483 | 203 | console.log('got "%s"', pass); | ||
484 | 204 | process.stdin.destroy(); | ||
485 | 205 | }); | ||
486 | 206 | ``` | ||
487 | 207 | |||
488 | 208 | ## .confirm(msg, fn) | ||
489 | 209 | |||
490 | 210 | Confirm with the given `msg`: | ||
491 | 211 | |||
492 | 212 | ```js | ||
493 | 213 | program.confirm('continue? ', function(ok){ | ||
494 | 214 | console.log(' got %j', ok); | ||
495 | 215 | }); | ||
496 | 216 | ``` | ||
497 | 217 | |||
498 | 218 | ## .choose(list, fn) | ||
499 | 219 | |||
500 | 220 | Let the user choose from a `list`: | ||
501 | 221 | |||
502 | 222 | ```js | ||
503 | 223 | var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; | ||
504 | 224 | |||
505 | 225 | console.log('Choose the coolest pet:'); | ||
506 | 226 | program.choose(list, function(i){ | ||
507 | 227 | console.log('you chose %d "%s"', i, list[i]); | ||
508 | 228 | }); | ||
509 | 229 | ``` | ||
510 | 230 | |||
511 | 231 | ## .outputHelp() | ||
512 | 232 | |||
513 | 233 | Output help information without exiting. | ||
514 | 234 | |||
515 | 235 | ## .help() | ||
516 | 236 | |||
517 | 237 | Output help information and exit immediately. | ||
518 | 238 | |||
519 | 239 | ## Links | ||
520 | 240 | |||
521 | 241 | - [API documentation](http://visionmedia.github.com/commander.js/) | ||
522 | 242 | - [ascii tables](https://github.com/LearnBoost/cli-table) | ||
523 | 243 | - [progress bars](https://github.com/visionmedia/node-progress) | ||
524 | 244 | - [more progress bars](https://github.com/substack/node-multimeter) | ||
525 | 245 | - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) | ||
526 | 246 | |||
527 | 247 | ## License | ||
528 | 248 | |||
529 | 249 | (The MIT License) | ||
530 | 250 | |||
531 | 251 | Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||
532 | 252 | |||
533 | 253 | Permission is hereby granted, free of charge, to any person obtaining | ||
534 | 254 | a copy of this software and associated documentation files (the | ||
535 | 255 | 'Software'), to deal in the Software without restriction, including | ||
536 | 256 | without limitation the rights to use, copy, modify, merge, publish, | ||
537 | 257 | distribute, sublicense, and/or sell copies of the Software, and to | ||
538 | 258 | permit persons to whom the Software is furnished to do so, subject to | ||
539 | 259 | the following conditions: | ||
540 | 260 | |||
541 | 261 | The above copyright notice and this permission notice shall be | ||
542 | 262 | included in all copies or substantial portions of the Software. | ||
543 | 263 | |||
544 | 264 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
545 | 265 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
546 | 266 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
547 | 267 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
548 | 268 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
549 | 269 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
550 | 270 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
551 | 271 | \ No newline at end of file | 0 | \ No newline at end of file |
552 | 272 | 1 | ||
553 | === removed symlink 'node_modules/cordova/_vendor/commander/1.1.1/_vendor' | |||
554 | === target was u'../..' | |||
555 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/index.js' | |||
556 | --- node_modules/cordova/_vendor/commander/1.1.1/index.js 2013-12-12 20:49:30 +0000 | |||
557 | +++ node_modules/cordova/_vendor/commander/1.1.1/index.js 1970-01-01 00:00:00 +0000 | |||
558 | @@ -1,1131 +0,0 @@ | |||
559 | 1 | /*! | ||
560 | 2 | * commander | ||
561 | 3 | * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||
562 | 4 | * MIT Licensed | ||
563 | 5 | */ | ||
564 | 6 | |||
565 | 7 | /** | ||
566 | 8 | * Module dependencies. | ||
567 | 9 | */ | ||
568 | 10 | |||
569 | 11 | var EventEmitter = require('events').EventEmitter | ||
570 | 12 | , spawn = require('child_process').spawn | ||
571 | 13 | , keypress = require('keypress') | ||
572 | 14 | , fs = require('fs') | ||
573 | 15 | , exists = fs.existsSync | ||
574 | 16 | , path = require('path') | ||
575 | 17 | , tty = require('tty') | ||
576 | 18 | , dirname = path.dirname | ||
577 | 19 | , basename = path.basename; | ||
578 | 20 | |||
579 | 21 | /** | ||
580 | 22 | * Expose the root command. | ||
581 | 23 | */ | ||
582 | 24 | |||
583 | 25 | exports = module.exports = new Command; | ||
584 | 26 | |||
585 | 27 | /** | ||
586 | 28 | * Expose `Command`. | ||
587 | 29 | */ | ||
588 | 30 | |||
589 | 31 | exports.Command = Command; | ||
590 | 32 | |||
591 | 33 | /** | ||
592 | 34 | * Expose `Option`. | ||
593 | 35 | */ | ||
594 | 36 | |||
595 | 37 | exports.Option = Option; | ||
596 | 38 | |||
597 | 39 | /** | ||
598 | 40 | * Initialize a new `Option` with the given `flags` and `description`. | ||
599 | 41 | * | ||
600 | 42 | * @param {String} flags | ||
601 | 43 | * @param {String} description | ||
602 | 44 | * @api public | ||
603 | 45 | */ | ||
604 | 46 | |||
605 | 47 | function Option(flags, description) { | ||
606 | 48 | this.flags = flags; | ||
607 | 49 | this.required = ~flags.indexOf('<'); | ||
608 | 50 | this.optional = ~flags.indexOf('['); | ||
609 | 51 | this.bool = !~flags.indexOf('-no-'); | ||
610 | 52 | flags = flags.split(/[ ,|]+/); | ||
611 | 53 | if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); | ||
612 | 54 | this.long = flags.shift(); | ||
613 | 55 | this.description = description || ''; | ||
614 | 56 | } | ||
615 | 57 | |||
616 | 58 | /** | ||
617 | 59 | * Return option name. | ||
618 | 60 | * | ||
619 | 61 | * @return {String} | ||
620 | 62 | * @api private | ||
621 | 63 | */ | ||
622 | 64 | |||
623 | 65 | Option.prototype.name = function(){ | ||
624 | 66 | return this.long | ||
625 | 67 | .replace('--', '') | ||
626 | 68 | .replace('no-', ''); | ||
627 | 69 | }; | ||
628 | 70 | |||
629 | 71 | /** | ||
630 | 72 | * Check if `arg` matches the short or long flag. | ||
631 | 73 | * | ||
632 | 74 | * @param {String} arg | ||
633 | 75 | * @return {Boolean} | ||
634 | 76 | * @api private | ||
635 | 77 | */ | ||
636 | 78 | |||
637 | 79 | Option.prototype.is = function(arg){ | ||
638 | 80 | return arg == this.short | ||
639 | 81 | || arg == this.long; | ||
640 | 82 | }; | ||
641 | 83 | |||
642 | 84 | /** | ||
643 | 85 | * Initialize a new `Command`. | ||
644 | 86 | * | ||
645 | 87 | * @param {String} name | ||
646 | 88 | * @api public | ||
647 | 89 | */ | ||
648 | 90 | |||
649 | 91 | function Command(name) { | ||
650 | 92 | this.commands = []; | ||
651 | 93 | this.options = []; | ||
652 | 94 | this._args = []; | ||
653 | 95 | this._name = name; | ||
654 | 96 | } | ||
655 | 97 | |||
656 | 98 | /** | ||
657 | 99 | * Inherit from `EventEmitter.prototype`. | ||
658 | 100 | */ | ||
659 | 101 | |||
660 | 102 | Command.prototype.__proto__ = EventEmitter.prototype; | ||
661 | 103 | |||
662 | 104 | /** | ||
663 | 105 | * Add command `name`. | ||
664 | 106 | * | ||
665 | 107 | * The `.action()` callback is invoked when the | ||
666 | 108 | * command `name` is specified via __ARGV__, | ||
667 | 109 | * and the remaining arguments are applied to the | ||
668 | 110 | * function for access. | ||
669 | 111 | * | ||
670 | 112 | * When the `name` is "*" an un-matched command | ||
671 | 113 | * will be passed as the first arg, followed by | ||
672 | 114 | * the rest of __ARGV__ remaining. | ||
673 | 115 | * | ||
674 | 116 | * Examples: | ||
675 | 117 | * | ||
676 | 118 | * program | ||
677 | 119 | * .version('0.0.1') | ||
678 | 120 | * .option('-C, --chdir <path>', 'change the working directory') | ||
679 | 121 | * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf') | ||
680 | 122 | * .option('-T, --no-tests', 'ignore test hook') | ||
681 | 123 | * | ||
682 | 124 | * program | ||
683 | 125 | * .command('setup') | ||
684 | 126 | * .description('run remote setup commands') | ||
685 | 127 | * .action(function(){ | ||
686 | 128 | * console.log('setup'); | ||
687 | 129 | * }); | ||
688 | 130 | * | ||
689 | 131 | * program | ||
690 | 132 | * .command('exec <cmd>') | ||
691 | 133 | * .description('run the given remote command') | ||
692 | 134 | * .action(function(cmd){ | ||
693 | 135 | * console.log('exec "%s"', cmd); | ||
694 | 136 | * }); | ||
695 | 137 | * | ||
696 | 138 | * program | ||
697 | 139 | * .command('*') | ||
698 | 140 | * .description('deploy the given env') | ||
699 | 141 | * .action(function(env){ | ||
700 | 142 | * console.log('deploying "%s"', env); | ||
701 | 143 | * }); | ||
702 | 144 | * | ||
703 | 145 | * program.parse(process.argv); | ||
704 | 146 | * | ||
705 | 147 | * @param {String} name | ||
706 | 148 | * @param {String} [desc] | ||
707 | 149 | * @return {Command} the new command | ||
708 | 150 | * @api public | ||
709 | 151 | */ | ||
710 | 152 | |||
711 | 153 | Command.prototype.command = function(name, desc){ | ||
712 | 154 | var args = name.split(/ +/); | ||
713 | 155 | var cmd = new Command(args.shift()); | ||
714 | 156 | if (desc) cmd.description(desc); | ||
715 | 157 | if (desc) this.executables = true; | ||
716 | 158 | this.commands.push(cmd); | ||
717 | 159 | cmd.parseExpectedArgs(args); | ||
718 | 160 | cmd.parent = this; | ||
719 | 161 | if (desc) return this; | ||
720 | 162 | return cmd; | ||
721 | 163 | }; | ||
722 | 164 | |||
723 | 165 | /** | ||
724 | 166 | * Add an implicit `help [cmd]` subcommand | ||
725 | 167 | * which invokes `--help` for the given command. | ||
726 | 168 | * | ||
727 | 169 | * @api private | ||
728 | 170 | */ | ||
729 | 171 | |||
730 | 172 | Command.prototype.addImplicitHelpCommand = function() { | ||
731 | 173 | this.command('help [cmd]', 'display help for [cmd]'); | ||
732 | 174 | }; | ||
733 | 175 | |||
734 | 176 | /** | ||
735 | 177 | * Parse expected `args`. | ||
736 | 178 | * | ||
737 | 179 | * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. | ||
738 | 180 | * | ||
739 | 181 | * @param {Array} args | ||
740 | 182 | * @return {Command} for chaining | ||
741 | 183 | * @api public | ||
742 | 184 | */ | ||
743 | 185 | |||
744 | 186 | Command.prototype.parseExpectedArgs = function(args){ | ||
745 | 187 | if (!args.length) return; | ||
746 | 188 | var self = this; | ||
747 | 189 | args.forEach(function(arg){ | ||
748 | 190 | switch (arg[0]) { | ||
749 | 191 | case '<': | ||
750 | 192 | self._args.push({ required: true, name: arg.slice(1, -1) }); | ||
751 | 193 | break; | ||
752 | 194 | case '[': | ||
753 | 195 | self._args.push({ required: false, name: arg.slice(1, -1) }); | ||
754 | 196 | break; | ||
755 | 197 | } | ||
756 | 198 | }); | ||
757 | 199 | return this; | ||
758 | 200 | }; | ||
759 | 201 | |||
760 | 202 | /** | ||
761 | 203 | * Register callback `fn` for the command. | ||
762 | 204 | * | ||
763 | 205 | * Examples: | ||
764 | 206 | * | ||
765 | 207 | * program | ||
766 | 208 | * .command('help') | ||
767 | 209 | * .description('display verbose help') | ||
768 | 210 | * .action(function(){ | ||
769 | 211 | * // output help here | ||
770 | 212 | * }); | ||
771 | 213 | * | ||
772 | 214 | * @param {Function} fn | ||
773 | 215 | * @return {Command} for chaining | ||
774 | 216 | * @api public | ||
775 | 217 | */ | ||
776 | 218 | |||
777 | 219 | Command.prototype.action = function(fn){ | ||
778 | 220 | var self = this; | ||
779 | 221 | this.parent.on(this._name, function(args, unknown){ | ||
780 | 222 | // Parse any so-far unknown options | ||
781 | 223 | unknown = unknown || []; | ||
782 | 224 | var parsed = self.parseOptions(unknown); | ||
783 | 225 | |||
784 | 226 | // Output help if necessary | ||
785 | 227 | outputHelpIfNecessary(self, parsed.unknown); | ||
786 | 228 | |||
787 | 229 | // If there are still any unknown options, then we simply | ||
788 | 230 | // die, unless someone asked for help, in which case we give it | ||
789 | 231 | // to them, and then we die. | ||
790 | 232 | if (parsed.unknown.length > 0) { | ||
791 | 233 | self.unknownOption(parsed.unknown[0]); | ||
792 | 234 | } | ||
793 | 235 | |||
794 | 236 | // Leftover arguments need to be pushed back. Fixes issue #56 | ||
795 | 237 | if (parsed.args.length) args = parsed.args.concat(args); | ||
796 | 238 | |||
797 | 239 | self._args.forEach(function(arg, i){ | ||
798 | 240 | if (arg.required && null == args[i]) { | ||
799 | 241 | self.missingArgument(arg.name); | ||
800 | 242 | } | ||
801 | 243 | }); | ||
802 | 244 | |||
803 | 245 | // Always append ourselves to the end of the arguments, | ||
804 | 246 | // to make sure we match the number of arguments the user | ||
805 | 247 | // expects | ||
806 | 248 | if (self._args.length) { | ||
807 | 249 | args[self._args.length] = self; | ||
808 | 250 | } else { | ||
809 | 251 | args.push(self); | ||
810 | 252 | } | ||
811 | 253 | |||
812 | 254 | fn.apply(this, args); | ||
813 | 255 | }); | ||
814 | 256 | return this; | ||
815 | 257 | }; | ||
816 | 258 | |||
817 | 259 | /** | ||
818 | 260 | * Define option with `flags`, `description` and optional | ||
819 | 261 | * coercion `fn`. | ||
820 | 262 | * | ||
821 | 263 | * The `flags` string should contain both the short and long flags, | ||
822 | 264 | * separated by comma, a pipe or space. The following are all valid | ||
823 | 265 | * all will output this way when `--help` is used. | ||
824 | 266 | * | ||
825 | 267 | * "-p, --pepper" | ||
826 | 268 | * "-p|--pepper" | ||
827 | 269 | * "-p --pepper" | ||
828 | 270 | * | ||
829 | 271 | * Examples: | ||
830 | 272 | * | ||
831 | 273 | * // simple boolean defaulting to false | ||
832 | 274 | * program.option('-p, --pepper', 'add pepper'); | ||
833 | 275 | * | ||
834 | 276 | * --pepper | ||
835 | 277 | * program.pepper | ||
836 | 278 | * // => Boolean | ||
837 | 279 | * | ||
838 | 280 | * // simple boolean defaulting to false | ||
839 | 281 | * program.option('-C, --no-cheese', 'remove cheese'); | ||
840 | 282 | * | ||
841 | 283 | * program.cheese | ||
842 | 284 | * // => true | ||
843 | 285 | * | ||
844 | 286 | * --no-cheese | ||
845 | 287 | * program.cheese | ||
846 | 288 | * // => true | ||
847 | 289 | * | ||
848 | 290 | * // required argument | ||
849 | 291 | * program.option('-C, --chdir <path>', 'change the working directory'); | ||
850 | 292 | * | ||
851 | 293 | * --chdir /tmp | ||
852 | 294 | * program.chdir | ||
853 | 295 | * // => "/tmp" | ||
854 | 296 | * | ||
855 | 297 | * // optional argument | ||
856 | 298 | * program.option('-c, --cheese [type]', 'add cheese [marble]'); | ||
857 | 299 | * | ||
858 | 300 | * @param {String} flags | ||
859 | 301 | * @param {String} description | ||
860 | 302 | * @param {Function|Mixed} fn or default | ||
861 | 303 | * @param {Mixed} defaultValue | ||
862 | 304 | * @return {Command} for chaining | ||
863 | 305 | * @api public | ||
864 | 306 | */ | ||
865 | 307 | |||
866 | 308 | Command.prototype.option = function(flags, description, fn, defaultValue){ | ||
867 | 309 | var self = this | ||
868 | 310 | , option = new Option(flags, description) | ||
869 | 311 | , oname = option.name() | ||
870 | 312 | , name = camelcase(oname); | ||
871 | 313 | |||
872 | 314 | // default as 3rd arg | ||
873 | 315 | if ('function' != typeof fn) defaultValue = fn, fn = null; | ||
874 | 316 | |||
875 | 317 | // preassign default value only for --no-*, [optional], or <required> | ||
876 | 318 | if (false == option.bool || option.optional || option.required) { | ||
877 | 319 | // when --no-* we make sure default is true | ||
878 | 320 | if (false == option.bool) defaultValue = true; | ||
879 | 321 | // preassign only if we have a default | ||
880 | 322 | if (undefined !== defaultValue) self[name] = defaultValue; | ||
881 | 323 | } | ||
882 | 324 | |||
883 | 325 | // register the option | ||
884 | 326 | this.options.push(option); | ||
885 | 327 | |||
886 | 328 | // when it's passed assign the value | ||
887 | 329 | // and conditionally invoke the callback | ||
888 | 330 | this.on(oname, function(val){ | ||
889 | 331 | // coercion | ||
890 | 332 | if (null != val && fn) val = fn(val); | ||
891 | 333 | |||
892 | 334 | // unassigned or bool | ||
893 | 335 | if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { | ||
894 | 336 | // if no value, bool true, and we have a default, then use it! | ||
895 | 337 | if (null == val) { | ||
896 | 338 | self[name] = option.bool | ||
897 | 339 | ? defaultValue || true | ||
898 | 340 | : false; | ||
899 | 341 | } else { | ||
900 | 342 | self[name] = val; | ||
901 | 343 | } | ||
902 | 344 | } else if (null !== val) { | ||
903 | 345 | // reassign | ||
904 | 346 | self[name] = val; | ||
905 | 347 | } | ||
906 | 348 | }); | ||
907 | 349 | |||
908 | 350 | return this; | ||
909 | 351 | }; | ||
910 | 352 | |||
911 | 353 | /** | ||
912 | 354 | * Parse `argv`, settings options and invoking commands when defined. | ||
913 | 355 | * | ||
914 | 356 | * @param {Array} argv | ||
915 | 357 | * @return {Command} for chaining | ||
916 | 358 | * @api public | ||
917 | 359 | */ | ||
918 | 360 | |||
919 | 361 | Command.prototype.parse = function(argv){ | ||
920 | 362 | // implicit help | ||
921 | 363 | if (this.executables) this.addImplicitHelpCommand(); | ||
922 | 364 | |||
923 | 365 | // store raw args | ||
924 | 366 | this.rawArgs = argv; | ||
925 | 367 | |||
926 | 368 | // guess name | ||
927 | 369 | this._name = this._name || basename(argv[1]); | ||
928 | 370 | |||
929 | 371 | // process argv | ||
930 | 372 | var parsed = this.parseOptions(this.normalize(argv.slice(2))); | ||
931 | 373 | var args = this.args = parsed.args; | ||
932 | 374 | |||
933 | 375 | // executable sub-commands, skip .parseArgs() | ||
934 | 376 | if (this.executables) return this.executeSubCommand(argv, args, parsed.unknown); | ||
935 | 377 | |||
936 | 378 | return this.parseArgs(this.args, parsed.unknown); | ||
937 | 379 | }; | ||
938 | 380 | |||
939 | 381 | /** | ||
940 | 382 | * Execute a sub-command executable. | ||
941 | 383 | * | ||
942 | 384 | * @param {Array} argv | ||
943 | 385 | * @param {Array} args | ||
944 | 386 | * @param {Array} unknown | ||
945 | 387 | * @api private | ||
946 | 388 | */ | ||
947 | 389 | |||
948 | 390 | Command.prototype.executeSubCommand = function(argv, args, unknown) { | ||
949 | 391 | args = args.concat(unknown); | ||
950 | 392 | |||
951 | 393 | if (!args.length) this.help(); | ||
952 | 394 | if ('help' == args[0] && 1 == args.length) this.help(); | ||
953 | 395 | |||
954 | 396 | // <cmd> --help | ||
955 | 397 | if ('help' == args[0]) { | ||
956 | 398 | args[0] = args[1]; | ||
957 | 399 | args[1] = '--help'; | ||
958 | 400 | } | ||
959 | 401 | |||
960 | 402 | // executable | ||
961 | 403 | var dir = dirname(argv[1]); | ||
962 | 404 | var bin = basename(argv[1]) + '-' + args[0]; | ||
963 | 405 | |||
964 | 406 | // check for ./<bin> first | ||
965 | 407 | var local = path.join(dir, bin); | ||
966 | 408 | if (exists(local)) bin = local; | ||
967 | 409 | |||
968 | 410 | // run it | ||
969 | 411 | args = args.slice(1); | ||
970 | 412 | var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); | ||
971 | 413 | proc.on('exit', function(code){ | ||
972 | 414 | if (code == 127) { | ||
973 | 415 | console.error('\n %s(1) does not exist\n', bin); | ||
974 | 416 | } | ||
975 | 417 | }); | ||
976 | 418 | }; | ||
977 | 419 | |||
978 | 420 | /** | ||
979 | 421 | * Normalize `args`, splitting joined short flags. For example | ||
980 | 422 | * the arg "-abc" is equivalent to "-a -b -c". | ||
981 | 423 | * This also normalizes equal sign and splits "--abc=def" into "--abc def". | ||
982 | 424 | * | ||
983 | 425 | * @param {Array} args | ||
984 | 426 | * @return {Array} | ||
985 | 427 | * @api private | ||
986 | 428 | */ | ||
987 | 429 | |||
988 | 430 | Command.prototype.normalize = function(args){ | ||
989 | 431 | var ret = [] | ||
990 | 432 | , arg | ||
991 | 433 | , index; | ||
992 | 434 | |||
993 | 435 | for (var i = 0, len = args.length; i < len; ++i) { | ||
994 | 436 | arg = args[i]; | ||
995 | 437 | if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { | ||
996 | 438 | arg.slice(1).split('').forEach(function(c){ | ||
997 | 439 | ret.push('-' + c); | ||
998 | 440 | }); | ||
999 | 441 | } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { | ||
1000 | 442 | ret.push(arg.slice(0, index), arg.slice(index + 1)); | ||
1001 | 443 | } else { | ||
1002 | 444 | ret.push(arg); | ||
1003 | 445 | } | ||
1004 | 446 | } | ||
1005 | 447 | |||
1006 | 448 | return ret; | ||
1007 | 449 | }; | ||
1008 | 450 | |||
1009 | 451 | /** | ||
1010 | 452 | * Parse command `args`. | ||
1011 | 453 | * | ||
1012 | 454 | * When listener(s) are available those | ||
1013 | 455 | * callbacks are invoked, otherwise the "*" | ||
1014 | 456 | * event is emitted and those actions are invoked. | ||
1015 | 457 | * | ||
1016 | 458 | * @param {Array} args | ||
1017 | 459 | * @return {Command} for chaining | ||
1018 | 460 | * @api private | ||
1019 | 461 | */ | ||
1020 | 462 | |||
1021 | 463 | Command.prototype.parseArgs = function(args, unknown){ | ||
1022 | 464 | var cmds = this.commands | ||
1023 | 465 | , len = cmds.length | ||
1024 | 466 | , name; | ||
1025 | 467 | |||
1026 | 468 | if (args.length) { | ||
1027 | 469 | name = args[0]; | ||
1028 | 470 | if (this.listeners(name).length) { | ||
1029 | 471 | this.emit(args.shift(), args, unknown); | ||
1030 | 472 | } else { | ||
1031 | 473 | this.emit('*', args); | ||
1032 | 474 | } | ||
1033 | 475 | } else { | ||
1034 | 476 | outputHelpIfNecessary(this, unknown); | ||
1035 | 477 | |||
1036 | 478 | // If there were no args and we have unknown options, | ||
1037 | 479 | // then they are extraneous and we need to error. | ||
1038 | 480 | if (unknown.length > 0) { | ||
1039 | 481 | this.unknownOption(unknown[0]); | ||
1040 | 482 | } | ||
1041 | 483 | } | ||
1042 | 484 | |||
1043 | 485 | return this; | ||
1044 | 486 | }; | ||
1045 | 487 | |||
1046 | 488 | /** | ||
1047 | 489 | * Return an option matching `arg` if any. | ||
1048 | 490 | * | ||
1049 | 491 | * @param {String} arg | ||
1050 | 492 | * @return {Option} | ||
1051 | 493 | * @api private | ||
1052 | 494 | */ | ||
1053 | 495 | |||
1054 | 496 | Command.prototype.optionFor = function(arg){ | ||
1055 | 497 | for (var i = 0, len = this.options.length; i < len; ++i) { | ||
1056 | 498 | if (this.options[i].is(arg)) { | ||
1057 | 499 | return this.options[i]; | ||
1058 | 500 | } | ||
1059 | 501 | } | ||
1060 | 502 | }; | ||
1061 | 503 | |||
1062 | 504 | /** | ||
1063 | 505 | * Parse options from `argv` returning `argv` | ||
1064 | 506 | * void of these options. | ||
1065 | 507 | * | ||
1066 | 508 | * @param {Array} argv | ||
1067 | 509 | * @return {Array} | ||
1068 | 510 | * @api public | ||
1069 | 511 | */ | ||
1070 | 512 | |||
1071 | 513 | Command.prototype.parseOptions = function(argv){ | ||
1072 | 514 | var args = [] | ||
1073 | 515 | , len = argv.length | ||
1074 | 516 | , literal | ||
1075 | 517 | , option | ||
1076 | 518 | , arg; | ||
1077 | 519 | |||
1078 | 520 | var unknownOptions = []; | ||
1079 | 521 | |||
1080 | 522 | // parse options | ||
1081 | 523 | for (var i = 0; i < len; ++i) { | ||
1082 | 524 | arg = argv[i]; | ||
1083 | 525 | |||
1084 | 526 | // literal args after -- | ||
1085 | 527 | if ('--' == arg) { | ||
1086 | 528 | literal = true; | ||
1087 | 529 | continue; | ||
1088 | 530 | } | ||
1089 | 531 | |||
1090 | 532 | if (literal) { | ||
1091 | 533 | args.push(arg); | ||
1092 | 534 | continue; | ||
1093 | 535 | } | ||
1094 | 536 | |||
1095 | 537 | // find matching Option | ||
1096 | 538 | option = this.optionFor(arg); | ||
1097 | 539 | |||
1098 | 540 | // option is defined | ||
1099 | 541 | if (option) { | ||
1100 | 542 | // requires arg | ||
1101 | 543 | if (option.required) { | ||
1102 | 544 | arg = argv[++i]; | ||
1103 | 545 | if (null == arg) return this.optionMissingArgument(option); | ||
1104 | 546 | if ('-' == arg[0]) return this.optionMissingArgument(option, arg); | ||
1105 | 547 | this.emit(option.name(), arg); | ||
1106 | 548 | // optional arg | ||
1107 | 549 | } else if (option.optional) { | ||
1108 | 550 | arg = argv[i+1]; | ||
1109 | 551 | if (null == arg || '-' == arg[0]) { | ||
1110 | 552 | arg = null; | ||
1111 | 553 | } else { | ||
1112 | 554 | ++i; | ||
1113 | 555 | } | ||
1114 | 556 | this.emit(option.name(), arg); | ||
1115 | 557 | // bool | ||
1116 | 558 | } else { | ||
1117 | 559 | this.emit(option.name()); | ||
1118 | 560 | } | ||
1119 | 561 | continue; | ||
1120 | 562 | } | ||
1121 | 563 | |||
1122 | 564 | // looks like an option | ||
1123 | 565 | if (arg.length > 1 && '-' == arg[0]) { | ||
1124 | 566 | unknownOptions.push(arg); | ||
1125 | 567 | |||
1126 | 568 | // If the next argument looks like it might be | ||
1127 | 569 | // an argument for this option, we pass it on. | ||
1128 | 570 | // If it isn't, then it'll simply be ignored | ||
1129 | 571 | if (argv[i+1] && '-' != argv[i+1][0]) { | ||
1130 | 572 | unknownOptions.push(argv[++i]); | ||
1131 | 573 | } | ||
1132 | 574 | continue; | ||
1133 | 575 | } | ||
1134 | 576 | |||
1135 | 577 | // arg | ||
1136 | 578 | args.push(arg); | ||
1137 | 579 | } | ||
1138 | 580 | |||
1139 | 581 | return { args: args, unknown: unknownOptions }; | ||
1140 | 582 | }; | ||
1141 | 583 | |||
1142 | 584 | /** | ||
1143 | 585 | * Argument `name` is missing. | ||
1144 | 586 | * | ||
1145 | 587 | * @param {String} name | ||
1146 | 588 | * @api private | ||
1147 | 589 | */ | ||
1148 | 590 | |||
1149 | 591 | Command.prototype.missingArgument = function(name){ | ||
1150 | 592 | console.error(); | ||
1151 | 593 | console.error(" error: missing required argument `%s'", name); | ||
1152 | 594 | console.error(); | ||
1153 | 595 | process.exit(1); | ||
1154 | 596 | }; | ||
1155 | 597 | |||
1156 | 598 | /** | ||
1157 | 599 | * `Option` is missing an argument, but received `flag` or nothing. | ||
1158 | 600 | * | ||
1159 | 601 | * @param {String} option | ||
1160 | 602 | * @param {String} flag | ||
1161 | 603 | * @api private | ||
1162 | 604 | */ | ||
1163 | 605 | |||
1164 | 606 | Command.prototype.optionMissingArgument = function(option, flag){ | ||
1165 | 607 | console.error(); | ||
1166 | 608 | if (flag) { | ||
1167 | 609 | console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); | ||
1168 | 610 | } else { | ||
1169 | 611 | console.error(" error: option `%s' argument missing", option.flags); | ||
1170 | 612 | } | ||
1171 | 613 | console.error(); | ||
1172 | 614 | process.exit(1); | ||
1173 | 615 | }; | ||
1174 | 616 | |||
1175 | 617 | /** | ||
1176 | 618 | * Unknown option `flag`. | ||
1177 | 619 | * | ||
1178 | 620 | * @param {String} flag | ||
1179 | 621 | * @api private | ||
1180 | 622 | */ | ||
1181 | 623 | |||
1182 | 624 | Command.prototype.unknownOption = function(flag){ | ||
1183 | 625 | console.error(); | ||
1184 | 626 | console.error(" error: unknown option `%s'", flag); | ||
1185 | 627 | console.error(); | ||
1186 | 628 | process.exit(1); | ||
1187 | 629 | }; | ||
1188 | 630 | |||
1189 | 631 | |||
1190 | 632 | /** | ||
1191 | 633 | * Set the program version to `str`. | ||
1192 | 634 | * | ||
1193 | 635 | * This method auto-registers the "-V, --version" flag | ||
1194 | 636 | * which will print the version number when passed. | ||
1195 | 637 | * | ||
1196 | 638 | * @param {String} str | ||
1197 | 639 | * @param {String} flags | ||
1198 | 640 | * @return {Command} for chaining | ||
1199 | 641 | * @api public | ||
1200 | 642 | */ | ||
1201 | 643 | |||
1202 | 644 | Command.prototype.version = function(str, flags){ | ||
1203 | 645 | if (0 == arguments.length) return this._version; | ||
1204 | 646 | this._version = str; | ||
1205 | 647 | flags = flags || '-V, --version'; | ||
1206 | 648 | this.option(flags, 'output the version number'); | ||
1207 | 649 | this.on('version', function(){ | ||
1208 | 650 | console.log(str); | ||
1209 | 651 | process.exit(0); | ||
1210 | 652 | }); | ||
1211 | 653 | return this; | ||
1212 | 654 | }; | ||
1213 | 655 | |||
1214 | 656 | /** | ||
1215 | 657 | * Set the description `str`. | ||
1216 | 658 | * | ||
1217 | 659 | * @param {String} str | ||
1218 | 660 | * @return {String|Command} | ||
1219 | 661 | * @api public | ||
1220 | 662 | */ | ||
1221 | 663 | |||
1222 | 664 | Command.prototype.description = function(str){ | ||
1223 | 665 | if (0 == arguments.length) return this._description; | ||
1224 | 666 | this._description = str; | ||
1225 | 667 | return this; | ||
1226 | 668 | }; | ||
1227 | 669 | |||
1228 | 670 | /** | ||
1229 | 671 | * Set / get the command usage `str`. | ||
1230 | 672 | * | ||
1231 | 673 | * @param {String} str | ||
1232 | 674 | * @return {String|Command} | ||
1233 | 675 | * @api public | ||
1234 | 676 | */ | ||
1235 | 677 | |||
1236 | 678 | Command.prototype.usage = function(str){ | ||
1237 | 679 | var args = this._args.map(function(arg){ | ||
1238 | 680 | return arg.required | ||
1239 | 681 | ? '<' + arg.name + '>' | ||
1240 | 682 | : '[' + arg.name + ']'; | ||
1241 | 683 | }); | ||
1242 | 684 | |||
1243 | 685 | var usage = '[options' | ||
1244 | 686 | + (this.commands.length ? '] [command' : '') | ||
1245 | 687 | + ']' | ||
1246 | 688 | + (this._args.length ? ' ' + args : ''); | ||
1247 | 689 | |||
1248 | 690 | if (0 == arguments.length) return this._usage || usage; | ||
1249 | 691 | this._usage = str; | ||
1250 | 692 | |||
1251 | 693 | return this; | ||
1252 | 694 | }; | ||
1253 | 695 | |||
1254 | 696 | /** | ||
1255 | 697 | * Return the largest option length. | ||
1256 | 698 | * | ||
1257 | 699 | * @return {Number} | ||
1258 | 700 | * @api private | ||
1259 | 701 | */ | ||
1260 | 702 | |||
1261 | 703 | Command.prototype.largestOptionLength = function(){ | ||
1262 | 704 | return this.options.reduce(function(max, option){ | ||
1263 | 705 | return Math.max(max, option.flags.length); | ||
1264 | 706 | }, 0); | ||
1265 | 707 | }; | ||
1266 | 708 | |||
1267 | 709 | /** | ||
1268 | 710 | * Return help for options. | ||
1269 | 711 | * | ||
1270 | 712 | * @return {String} | ||
1271 | 713 | * @api private | ||
1272 | 714 | */ | ||
1273 | 715 | |||
1274 | 716 | Command.prototype.optionHelp = function(){ | ||
1275 | 717 | var width = this.largestOptionLength(); | ||
1276 | 718 | |||
1277 | 719 | // Prepend the help information | ||
1278 | 720 | return [pad('-h, --help', width) + ' ' + 'output usage information'] | ||
1279 | 721 | .concat(this.options.map(function(option){ | ||
1280 | 722 | return pad(option.flags, width) | ||
1281 | 723 | + ' ' + option.description; | ||
1282 | 724 | })) | ||
1283 | 725 | .join('\n'); | ||
1284 | 726 | }; | ||
1285 | 727 | |||
1286 | 728 | /** | ||
1287 | 729 | * Return command help documentation. | ||
1288 | 730 | * | ||
1289 | 731 | * @return {String} | ||
1290 | 732 | * @api private | ||
1291 | 733 | */ | ||
1292 | 734 | |||
1293 | 735 | Command.prototype.commandHelp = function(){ | ||
1294 | 736 | if (!this.commands.length) return ''; | ||
1295 | 737 | return [ | ||
1296 | 738 | '' | ||
1297 | 739 | , ' Commands:' | ||
1298 | 740 | , '' | ||
1299 | 741 | , this.commands.map(function(cmd){ | ||
1300 | 742 | var args = cmd._args.map(function(arg){ | ||
1301 | 743 | return arg.required | ||
1302 | 744 | ? '<' + arg.name + '>' | ||
1303 | 745 | : '[' + arg.name + ']'; | ||
1304 | 746 | }).join(' '); | ||
1305 | 747 | |||
1306 | 748 | return pad(cmd._name | ||
1307 | 749 | + (cmd.options.length | ||
1308 | 750 | ? ' [options]' | ||
1309 | 751 | : '') + ' ' + args, 22) | ||
1310 | 752 | + (cmd.description() | ||
1311 | 753 | ? ' ' + cmd.description() | ||
1312 | 754 | : ''); | ||
1313 | 755 | }).join('\n').replace(/^/gm, ' ') | ||
1314 | 756 | , '' | ||
1315 | 757 | ].join('\n'); | ||
1316 | 758 | }; | ||
1317 | 759 | |||
1318 | 760 | /** | ||
1319 | 761 | * Return program help documentation. | ||
1320 | 762 | * | ||
1321 | 763 | * @return {String} | ||
1322 | 764 | * @api private | ||
1323 | 765 | */ | ||
1324 | 766 | |||
1325 | 767 | Command.prototype.helpInformation = function(){ | ||
1326 | 768 | return [ | ||
1327 | 769 | '' | ||
1328 | 770 | , ' Usage: ' + this._name + ' ' + this.usage() | ||
1329 | 771 | , '' + this.commandHelp() | ||
1330 | 772 | , ' Options:' | ||
1331 | 773 | , '' | ||
1332 | 774 | , '' + this.optionHelp().replace(/^/gm, ' ') | ||
1333 | 775 | , '' | ||
1334 | 776 | , '' | ||
1335 | 777 | ].join('\n'); | ||
1336 | 778 | }; | ||
1337 | 779 | |||
1338 | 780 | /** | ||
1339 | 781 | * Prompt for a `Number`. | ||
1340 | 782 | * | ||
1341 | 783 | * @param {String} str | ||
1342 | 784 | * @param {Function} fn | ||
1343 | 785 | * @api private | ||
1344 | 786 | */ | ||
1345 | 787 | |||
1346 | 788 | Command.prototype.promptForNumber = function(str, fn){ | ||
1347 | 789 | var self = this; | ||
1348 | 790 | this.promptSingleLine(str, function parseNumber(val){ | ||
1349 | 791 | val = Number(val); | ||
1350 | 792 | if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); | ||
1351 | 793 | fn(val); | ||
1352 | 794 | }); | ||
1353 | 795 | }; | ||
1354 | 796 | |||
1355 | 797 | /** | ||
1356 | 798 | * Prompt for a `Date`. | ||
1357 | 799 | * | ||
1358 | 800 | * @param {String} str | ||
1359 | 801 | * @param {Function} fn | ||
1360 | 802 | * @api private | ||
1361 | 803 | */ | ||
1362 | 804 | |||
1363 | 805 | Command.prototype.promptForDate = function(str, fn){ | ||
1364 | 806 | var self = this; | ||
1365 | 807 | this.promptSingleLine(str, function parseDate(val){ | ||
1366 | 808 | val = new Date(val); | ||
1367 | 809 | if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); | ||
1368 | 810 | fn(val); | ||
1369 | 811 | }); | ||
1370 | 812 | }; | ||
1371 | 813 | |||
1372 | 814 | /** | ||
1373 | 815 | * Single-line prompt. | ||
1374 | 816 | * | ||
1375 | 817 | * @param {String} str | ||
1376 | 818 | * @param {Function} fn | ||
1377 | 819 | * @api private | ||
1378 | 820 | */ | ||
1379 | 821 | |||
1380 | 822 | Command.prototype.promptSingleLine = function(str, fn){ | ||
1381 | 823 | if ('function' == typeof arguments[2]) { | ||
1382 | 824 | return this['promptFor' + (fn.name || fn)](str, arguments[2]); | ||
1383 | 825 | } | ||
1384 | 826 | |||
1385 | 827 | process.stdout.write(str); | ||
1386 | 828 | process.stdin.setEncoding('utf8'); | ||
1387 | 829 | process.stdin.once('data', function(val){ | ||
1388 | 830 | fn(val.trim()); | ||
1389 | 831 | }).resume(); | ||
1390 | 832 | }; | ||
1391 | 833 | |||
1392 | 834 | /** | ||
1393 | 835 | * Multi-line prompt. | ||
1394 | 836 | * | ||
1395 | 837 | * @param {String} str | ||
1396 | 838 | * @param {Function} fn | ||
1397 | 839 | * @api private | ||
1398 | 840 | */ | ||
1399 | 841 | |||
1400 | 842 | Command.prototype.promptMultiLine = function(str, fn){ | ||
1401 | 843 | var buf = []; | ||
1402 | 844 | console.log(str); | ||
1403 | 845 | process.stdin.setEncoding('utf8'); | ||
1404 | 846 | process.stdin.on('data', function(val){ | ||
1405 | 847 | if ('\n' == val || '\r\n' == val) { | ||
1406 | 848 | process.stdin.removeAllListeners('data'); | ||
1407 | 849 | fn(buf.join('\n')); | ||
1408 | 850 | } else { | ||
1409 | 851 | buf.push(val.trimRight()); | ||
1410 | 852 | } | ||
1411 | 853 | }).resume(); | ||
1412 | 854 | }; | ||
1413 | 855 | |||
1414 | 856 | /** | ||
1415 | 857 | * Prompt `str` and callback `fn(val)` | ||
1416 | 858 | * | ||
1417 | 859 | * Commander supports single-line and multi-line prompts. | ||
1418 | 860 | * To issue a single-line prompt simply add white-space | ||
1419 | 861 | * to the end of `str`, something like "name: ", whereas | ||
1420 | 862 | * for a multi-line prompt omit this "description:". | ||
1421 | 863 | * | ||
1422 | 864 | * | ||
1423 | 865 | * Examples: | ||
1424 | 866 | * | ||
1425 | 867 | * program.prompt('Username: ', function(name){ | ||
1426 | 868 | * console.log('hi %s', name); | ||
1427 | 869 | * }); | ||
1428 | 870 | * | ||
1429 | 871 | * program.prompt('Description:', function(desc){ | ||
1430 | 872 | * console.log('description was "%s"', desc.trim()); | ||
1431 | 873 | * }); | ||
1432 | 874 | * | ||
1433 | 875 | * @param {String|Object} str | ||
1434 | 876 | * @param {Function} fn | ||
1435 | 877 | * @api public | ||
1436 | 878 | */ | ||
1437 | 879 | |||
1438 | 880 | Command.prototype.prompt = function(str, fn){ | ||
1439 | 881 | var self = this; | ||
1440 | 882 | |||
1441 | 883 | if ('string' == typeof str) { | ||
1442 | 884 | if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); | ||
1443 | 885 | this.promptMultiLine(str, fn); | ||
1444 | 886 | } else { | ||
1445 | 887 | var keys = Object.keys(str) | ||
1446 | 888 | , obj = {}; | ||
1447 | 889 | |||
1448 | 890 | function next() { | ||
1449 | 891 | var key = keys.shift() | ||
1450 | 892 | , label = str[key]; | ||
1451 | 893 | |||
1452 | 894 | if (!key) return fn(obj); | ||
1453 | 895 | self.prompt(label, function(val){ | ||
1454 | 896 | obj[key] = val; | ||
1455 | 897 | next(); | ||
1456 | 898 | }); | ||
1457 | 899 | } | ||
1458 | 900 | |||
1459 | 901 | next(); | ||
1460 | 902 | } | ||
1461 | 903 | }; | ||
1462 | 904 | |||
1463 | 905 | /** | ||
1464 | 906 | * Prompt for password with `str`, `mask` char and callback `fn(val)`. | ||
1465 | 907 | * | ||
1466 | 908 | * The mask string defaults to '', aka no output is | ||
1467 | 909 | * written while typing, you may want to use "*" etc. | ||
1468 | 910 | * | ||
1469 | 911 | * Examples: | ||
1470 | 912 | * | ||
1471 | 913 | * program.password('Password: ', function(pass){ | ||
1472 | 914 | * console.log('got "%s"', pass); | ||
1473 | 915 | * process.stdin.destroy(); | ||
1474 | 916 | * }); | ||
1475 | 917 | * | ||
1476 | 918 | * program.password('Password: ', '*', function(pass){ | ||
1477 | 919 | * console.log('got "%s"', pass); | ||
1478 | 920 | * process.stdin.destroy(); | ||
1479 | 921 | * }); | ||
1480 | 922 | * | ||
1481 | 923 | * @param {String} str | ||
1482 | 924 | * @param {String} mask | ||
1483 | 925 | * @param {Function} fn | ||
1484 | 926 | * @api public | ||
1485 | 927 | */ | ||
1486 | 928 | |||
1487 | 929 | Command.prototype.password = function(str, mask, fn){ | ||
1488 | 930 | var self = this | ||
1489 | 931 | , buf = ''; | ||
1490 | 932 | |||
1491 | 933 | // default mask | ||
1492 | 934 | if ('function' == typeof mask) { | ||
1493 | 935 | fn = mask; | ||
1494 | 936 | mask = ''; | ||
1495 | 937 | } | ||
1496 | 938 | |||
1497 | 939 | keypress(process.stdin); | ||
1498 | 940 | |||
1499 | 941 | function setRawMode(mode) { | ||
1500 | 942 | if (process.stdin.setRawMode) { | ||
1501 | 943 | process.stdin.setRawMode(mode); | ||
1502 | 944 | } else { | ||
1503 | 945 | tty.setRawMode(mode); | ||
1504 | 946 | } | ||
1505 | 947 | }; | ||
1506 | 948 | setRawMode(true); | ||
1507 | 949 | process.stdout.write(str); | ||
1508 | 950 | |||
1509 | 951 | // keypress | ||
1510 | 952 | process.stdin.on('keypress', function(c, key){ | ||
1511 | 953 | if (key && 'enter' == key.name) { | ||
1512 | 954 | console.log(); | ||
1513 | 955 | process.stdin.pause(); | ||
1514 | 956 | process.stdin.removeAllListeners('keypress'); | ||
1515 | 957 | setRawMode(false); | ||
1516 | 958 | if (!buf.trim().length) return self.password(str, mask, fn); | ||
1517 | 959 | fn(buf); | ||
1518 | 960 | return; | ||
1519 | 961 | } | ||
1520 | 962 | |||
1521 | 963 | if (key && key.ctrl && 'c' == key.name) { | ||
1522 | 964 | console.log('%s', buf); | ||
1523 | 965 | process.exit(); | ||
1524 | 966 | } | ||
1525 | 967 | |||
1526 | 968 | process.stdout.write(mask); | ||
1527 | 969 | buf += c; | ||
1528 | 970 | }).resume(); | ||
1529 | 971 | }; | ||
1530 | 972 | |||
1531 | 973 | /** | ||
1532 | 974 | * Confirmation prompt with `str` and callback `fn(bool)` | ||
1533 | 975 | * | ||
1534 | 976 | * Examples: | ||
1535 | 977 | * | ||
1536 | 978 | * program.confirm('continue? ', function(ok){ | ||
1537 | 979 | * console.log(' got %j', ok); | ||
1538 | 980 | * process.stdin.destroy(); | ||
1539 | 981 | * }); | ||
1540 | 982 | * | ||
1541 | 983 | * @param {String} str | ||
1542 | 984 | * @param {Function} fn | ||
1543 | 985 | * @api public | ||
1544 | 986 | */ | ||
1545 | 987 | |||
1546 | 988 | |||
1547 | 989 | Command.prototype.confirm = function(str, fn, verbose){ | ||
1548 | 990 | var self = this; | ||
1549 | 991 | this.prompt(str, function(ok){ | ||
1550 | 992 | if (!ok.trim()) { | ||
1551 | 993 | if (!verbose) str += '(yes or no) '; | ||
1552 | 994 | return self.confirm(str, fn, true); | ||
1553 | 995 | } | ||
1554 | 996 | fn(parseBool(ok)); | ||
1555 | 997 | }); | ||
1556 | 998 | }; | ||
1557 | 999 | |||
1558 | 1000 | /** | ||
1559 | 1001 | * Choice prompt with `list` of items and callback `fn(index, item)` | ||
1560 | 1002 | * | ||
1561 | 1003 | * Examples: | ||
1562 | 1004 | * | ||
1563 | 1005 | * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; | ||
1564 | 1006 | * | ||
1565 | 1007 | * console.log('Choose the coolest pet:'); | ||
1566 | 1008 | * program.choose(list, function(i){ | ||
1567 | 1009 | * console.log('you chose %d "%s"', i, list[i]); | ||
1568 | 1010 | * process.stdin.destroy(); | ||
1569 | 1011 | * }); | ||
1570 | 1012 | * | ||
1571 | 1013 | * @param {Array} list | ||
1572 | 1014 | * @param {Number|Function} index or fn | ||
1573 | 1015 | * @param {Function} fn | ||
1574 | 1016 | * @api public | ||
1575 | 1017 | */ | ||
1576 | 1018 | |||
1577 | 1019 | Command.prototype.choose = function(list, index, fn){ | ||
1578 | 1020 | var self = this | ||
1579 | 1021 | , hasDefault = 'number' == typeof index; | ||
1580 | 1022 | |||
1581 | 1023 | if (!hasDefault) { | ||
1582 | 1024 | fn = index; | ||
1583 | 1025 | index = null; | ||
1584 | 1026 | } | ||
1585 | 1027 | |||
1586 | 1028 | list.forEach(function(item, i){ | ||
1587 | 1029 | if (hasDefault && i == index) { | ||
1588 | 1030 | console.log('* %d) %s', i + 1, item); | ||
1589 | 1031 | } else { | ||
1590 | 1032 | console.log(' %d) %s', i + 1, item); | ||
1591 | 1033 | } | ||
1592 | 1034 | }); | ||
1593 | 1035 | |||
1594 | 1036 | function again() { | ||
1595 | 1037 | self.prompt(' : ', function(val){ | ||
1596 | 1038 | val = parseInt(val, 10) - 1; | ||
1597 | 1039 | if (hasDefault && isNaN(val)) val = index; | ||
1598 | 1040 | |||
1599 | 1041 | if (null == list[val]) { | ||
1600 | 1042 | again(); | ||
1601 | 1043 | } else { | ||
1602 | 1044 | fn(val, list[val]); | ||
1603 | 1045 | } | ||
1604 | 1046 | }); | ||
1605 | 1047 | } | ||
1606 | 1048 | |||
1607 | 1049 | again(); | ||
1608 | 1050 | }; | ||
1609 | 1051 | |||
1610 | 1052 | |||
1611 | 1053 | /** | ||
1612 | 1054 | * Output help information for this command | ||
1613 | 1055 | * | ||
1614 | 1056 | * @api public | ||
1615 | 1057 | */ | ||
1616 | 1058 | |||
1617 | 1059 | Command.prototype.outputHelp = function(){ | ||
1618 | 1060 | process.stdout.write(this.helpInformation()); | ||
1619 | 1061 | this.emit('--help'); | ||
1620 | 1062 | }; | ||
1621 | 1063 | |||
1622 | 1064 | /** | ||
1623 | 1065 | * Output help information and exit. | ||
1624 | 1066 | * | ||
1625 | 1067 | * @api public | ||
1626 | 1068 | */ | ||
1627 | 1069 | |||
1628 | 1070 | Command.prototype.help = function(){ | ||
1629 | 1071 | this.outputHelp(); | ||
1630 | 1072 | process.exit(); | ||
1631 | 1073 | }; | ||
1632 | 1074 | |||
1633 | 1075 | /** | ||
1634 | 1076 | * Camel-case the given `flag` | ||
1635 | 1077 | * | ||
1636 | 1078 | * @param {String} flag | ||
1637 | 1079 | * @return {String} | ||
1638 | 1080 | * @api private | ||
1639 | 1081 | */ | ||
1640 | 1082 | |||
1641 | 1083 | function camelcase(flag) { | ||
1642 | 1084 | return flag.split('-').reduce(function(str, word){ | ||
1643 | 1085 | return str + word[0].toUpperCase() + word.slice(1); | ||
1644 | 1086 | }); | ||
1645 | 1087 | } | ||
1646 | 1088 | |||
1647 | 1089 | /** | ||
1648 | 1090 | * Parse a boolean `str`. | ||
1649 | 1091 | * | ||
1650 | 1092 | * @param {String} str | ||
1651 | 1093 | * @return {Boolean} | ||
1652 | 1094 | * @api private | ||
1653 | 1095 | */ | ||
1654 | 1096 | |||
1655 | 1097 | function parseBool(str) { | ||
1656 | 1098 | return /^y|yes|ok|true$/i.test(str); | ||
1657 | 1099 | } | ||
1658 | 1100 | |||
1659 | 1101 | /** | ||
1660 | 1102 | * Pad `str` to `width`. | ||
1661 | 1103 | * | ||
1662 | 1104 | * @param {String} str | ||
1663 | 1105 | * @param {Number} width | ||
1664 | 1106 | * @return {String} | ||
1665 | 1107 | * @api private | ||
1666 | 1108 | */ | ||
1667 | 1109 | |||
1668 | 1110 | function pad(str, width) { | ||
1669 | 1111 | var len = Math.max(0, width - str.length); | ||
1670 | 1112 | return str + Array(len + 1).join(' '); | ||
1671 | 1113 | } | ||
1672 | 1114 | |||
1673 | 1115 | /** | ||
1674 | 1116 | * Output help information if necessary | ||
1675 | 1117 | * | ||
1676 | 1118 | * @param {Command} command to output help for | ||
1677 | 1119 | * @param {Array} array of options to search for -h or --help | ||
1678 | 1120 | * @api private | ||
1679 | 1121 | */ | ||
1680 | 1122 | |||
1681 | 1123 | function outputHelpIfNecessary(cmd, options) { | ||
1682 | 1124 | options = options || []; | ||
1683 | 1125 | for (var i = 0; i < options.length; i++) { | ||
1684 | 1126 | if (options[i] == '--help' || options[i] == '-h') { | ||
1685 | 1127 | cmd.outputHelp(); | ||
1686 | 1128 | process.exit(0); | ||
1687 | 1129 | } | ||
1688 | 1130 | } | ||
1689 | 1131 | } | ||
1690 | 1132 | 0 | ||
1691 | === removed directory 'node_modules/cordova/_vendor/commander/1.1.1/node_modules' | |||
1692 | === removed symlink 'node_modules/cordova/_vendor/commander/1.1.1/node_modules/keypress' | |||
1693 | === target was u'../_vendor/keypress/0.1.0' | |||
1694 | === removed file 'node_modules/cordova/_vendor/commander/1.1.1/package.json' | |||
1695 | --- node_modules/cordova/_vendor/commander/1.1.1/package.json 2013-12-12 20:49:30 +0000 | |||
1696 | +++ node_modules/cordova/_vendor/commander/1.1.1/package.json 1970-01-01 00:00:00 +0000 | |||
1697 | @@ -1,40 +0,0 @@ | |||
1698 | 1 | { | ||
1699 | 2 | "name": "commander", | ||
1700 | 3 | "version": "1.1.1", | ||
1701 | 4 | "description": "the complete solution for node.js command-line programs", | ||
1702 | 5 | "keywords": [ | ||
1703 | 6 | "command", | ||
1704 | 7 | "option", | ||
1705 | 8 | "parser", | ||
1706 | 9 | "prompt", | ||
1707 | 10 | "stdin" | ||
1708 | 11 | ], | ||
1709 | 12 | "author": { | ||
1710 | 13 | "name": "TJ Holowaychuk", | ||
1711 | 14 | "email": "tj@vision-media.ca" | ||
1712 | 15 | }, | ||
1713 | 16 | "repository": { | ||
1714 | 17 | "type": "git", | ||
1715 | 18 | "url": "https://github.com/visionmedia/commander.js.git" | ||
1716 | 19 | }, | ||
1717 | 20 | "dependencies": { | ||
1718 | 21 | "keypress": "0.1.x" | ||
1719 | 22 | }, | ||
1720 | 23 | "devDependencies": { | ||
1721 | 24 | "should": ">= 0.0.1" | ||
1722 | 25 | }, | ||
1723 | 26 | "scripts": { | ||
1724 | 27 | "test": "make test" | ||
1725 | 28 | }, | ||
1726 | 29 | "main": "index", | ||
1727 | 30 | "engines": { | ||
1728 | 31 | "node": ">= 0.6.x" | ||
1729 | 32 | }, | ||
1730 | 33 | "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n 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.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n 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.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese <type> Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] <file ...>')\n .option('-i, --integer <n>', 'An integer argument', parseInt)\n .option('-f, --float <n>', 'A float argument', parseFloat)\n .option('-r, --range <a>..<b>', 'A range', range)\n .option('-l, --list <items>', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## .outputHelp()\n\n Output help information without exiting.\n\n## .help()\n\n Output help information and exit immediately.\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", | ||
1731 | 34 | "readmeFilename": "Readme.md", | ||
1732 | 35 | "bugs": { | ||
1733 | 36 | "url": "https://github.com/visionmedia/commander.js/issues" | ||
1734 | 37 | }, | ||
1735 | 38 | "_id": "commander@1.1.1", | ||
1736 | 39 | "_from": "commander@1.1.x" | ||
1737 | 40 | } | ||
1738 | 41 | 0 | ||
1739 | === removed directory 'node_modules/cordova/_vendor/forever-agent/0.5.0' | |||
1740 | === removed file 'node_modules/cordova/_vendor/forever-agent/0.5.0/LICENSE' | |||
1741 | --- node_modules/cordova/_vendor/forever-agent/0.5.0/LICENSE 2013-12-12 20:49:30 +0000 | |||
1742 | +++ node_modules/cordova/_vendor/forever-agent/0.5.0/LICENSE 1970-01-01 00:00:00 +0000 | |||
1743 | @@ -1,55 +0,0 @@ | |||
1744 | 1 | Apache License | ||
1745 | 2 | |||
1746 | 3 | Version 2.0, January 2004 | ||
1747 | 4 | |||
1748 | 5 | http://www.apache.org/licenses/ | ||
1749 | 6 | |||
1750 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
1751 | 8 | |||
1752 | 9 | 1. Definitions. | ||
1753 | 10 | |||
1754 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. | ||
1755 | 12 | |||
1756 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. | ||
1757 | 14 | |||
1758 | 15 | "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. | ||
1759 | 16 | |||
1760 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. | ||
1761 | 18 | |||
1762 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. | ||
1763 | 20 | |||
1764 | 21 | "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. | ||
1765 | 22 | |||
1766 | 23 | "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). | ||
1767 | 24 | |||
1768 | 25 | "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. | ||
1769 | 26 | |||
1770 | 27 | "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." | ||
1771 | 28 | |||
1772 | 29 | "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. | ||
1773 | 30 | |||
1774 | 31 | 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. | ||
1775 | 32 | |||
1776 | 33 | 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. | ||
1777 | 34 | |||
1778 | 35 | 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: | ||
1779 | 36 | |||
1780 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and | ||
1781 | 38 | |||
1782 | 39 | You must cause any modified files to carry prominent notices stating that You changed the files; and | ||
1783 | 40 | |||
1784 | 41 | 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 | ||
1785 | 42 | |||
1786 | 43 | 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. | ||
1787 | 44 | |||
1788 | 45 | 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. | ||
1789 | 46 | |||
1790 | 47 | 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. | ||
1791 | 48 | |||
1792 | 49 | 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. | ||
1793 | 50 | |||
1794 | 51 | 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. | ||
1795 | 52 | |||
1796 | 53 | 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. | ||
1797 | 54 | |||
1798 | 55 | END OF TERMS AND CONDITIONS | ||
1799 | 56 | \ No newline at end of file | 0 | \ No newline at end of file |
1800 | 57 | 1 | ||
1801 | === removed file 'node_modules/cordova/_vendor/forever-agent/0.5.0/README.md' | |||
1802 | --- node_modules/cordova/_vendor/forever-agent/0.5.0/README.md 2013-12-12 20:49:30 +0000 | |||
1803 | +++ node_modules/cordova/_vendor/forever-agent/0.5.0/README.md 1970-01-01 00:00:00 +0000 | |||
1804 | @@ -1,4 +0,0 @@ | |||
1805 | 1 | forever-agent | ||
1806 | 2 | ============= | ||
1807 | 3 | |||
1808 | 4 | HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module. | ||
1809 | 5 | 0 | ||
1810 | === removed symlink 'node_modules/cordova/_vendor/forever-agent/0.5.0/_vendor' | |||
1811 | === target was u'../..' | |||
1812 | === removed file 'node_modules/cordova/_vendor/forever-agent/0.5.0/index.js' | |||
1813 | --- node_modules/cordova/_vendor/forever-agent/0.5.0/index.js 2013-12-12 20:49:30 +0000 | |||
1814 | +++ node_modules/cordova/_vendor/forever-agent/0.5.0/index.js 1970-01-01 00:00:00 +0000 | |||
1815 | @@ -1,119 +0,0 @@ | |||
1816 | 1 | module.exports = ForeverAgent | ||
1817 | 2 | ForeverAgent.SSL = ForeverAgentSSL | ||
1818 | 3 | |||
1819 | 4 | var util = require('util') | ||
1820 | 5 | , Agent = require('http').Agent | ||
1821 | 6 | , net = require('net') | ||
1822 | 7 | , tls = require('tls') | ||
1823 | 8 | , AgentSSL = require('https').Agent | ||
1824 | 9 | |||
1825 | 10 | function ForeverAgent(options) { | ||
1826 | 11 | var self = this | ||
1827 | 12 | self.options = options || {} | ||
1828 | 13 | self.requests = {} | ||
1829 | 14 | self.sockets = {} | ||
1830 | 15 | self.freeSockets = {} | ||
1831 | 16 | self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets | ||
1832 | 17 | self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets | ||
1833 | 18 | self.on('free', function(socket, host, port) { | ||
1834 | 19 | var name = host + ':' + port | ||
1835 | 20 | if (self.requests[name] && self.requests[name].length) { | ||
1836 | 21 | self.requests[name].shift().onSocket(socket) | ||
1837 | 22 | } else if (self.sockets[name].length < self.minSockets) { | ||
1838 | 23 | if (!self.freeSockets[name]) self.freeSockets[name] = [] | ||
1839 | 24 | self.freeSockets[name].push(socket) | ||
1840 | 25 | |||
1841 | 26 | // if an error happens while we don't use the socket anyway, meh, throw the socket away | ||
1842 | 27 | function onIdleError() { | ||
1843 | 28 | socket.destroy() | ||
1844 | 29 | } | ||
1845 | 30 | socket._onIdleError = onIdleError | ||
1846 | 31 | socket.on('error', onIdleError) | ||
1847 | 32 | } else { | ||
1848 | 33 | // If there are no pending requests just destroy the | ||
1849 | 34 | // socket and it will get removed from the pool. This | ||
1850 | 35 | // gets us out of timeout issues and allows us to | ||
1851 | 36 | // default to Connection:keep-alive. | ||
1852 | 37 | socket.destroy() | ||
1853 | 38 | } | ||
1854 | 39 | }) | ||
1855 | 40 | |||
1856 | 41 | } | ||
1857 | 42 | util.inherits(ForeverAgent, Agent) | ||
1858 | 43 | |||
1859 | 44 | ForeverAgent.defaultMinSockets = 5 | ||
1860 | 45 | |||
1861 | 46 | |||
1862 | 47 | ForeverAgent.prototype.createConnection = net.createConnection | ||
1863 | 48 | ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest | ||
1864 | 49 | ForeverAgent.prototype.addRequest = function(req, host, port) { | ||
1865 | 50 | var name = host + ':' + port | ||
1866 | 51 | if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { | ||
1867 | 52 | var idleSocket = this.freeSockets[name].pop() | ||
1868 | 53 | idleSocket.removeListener('error', idleSocket._onIdleError) | ||
1869 | 54 | delete idleSocket._onIdleError | ||
1870 | 55 | req._reusedSocket = true | ||
1871 | 56 | req.onSocket(idleSocket) | ||
1872 | 57 | } else { | ||
1873 | 58 | this.addRequestNoreuse(req, host, port) | ||
1874 | 59 | } | ||
1875 | 60 | } | ||
1876 | 61 | |||
1877 | 62 | ForeverAgent.prototype.removeSocket = function(s, name, host, port) { | ||
1878 | 63 | if (this.sockets[name]) { | ||
1879 | 64 | var index = this.sockets[name].indexOf(s) | ||
1880 | 65 | if (index !== -1) { | ||
1881 | 66 | this.sockets[name].splice(index, 1) | ||
1882 | 67 | } | ||
1883 | 68 | } else if (this.sockets[name] && this.sockets[name].length === 0) { | ||
1884 | 69 | // don't leak | ||
1885 | 70 | delete this.sockets[name] | ||
1886 | 71 | delete this.requests[name] | ||
1887 | 72 | } | ||
1888 | 73 | |||
1889 | 74 | if (this.freeSockets[name]) { | ||
1890 | 75 | var index = this.freeSockets[name].indexOf(s) | ||
1891 | 76 | if (index !== -1) { | ||
1892 | 77 | this.freeSockets[name].splice(index, 1) | ||
1893 | 78 | if (this.freeSockets[name].length === 0) { | ||
1894 | 79 | delete this.freeSockets[name] | ||
1895 | 80 | } | ||
1896 | 81 | } | ||
1897 | 82 | } | ||
1898 | 83 | |||
1899 | 84 | if (this.requests[name] && this.requests[name].length) { | ||
1900 | 85 | // If we have pending requests and a socket gets closed a new one | ||
1901 | 86 | // needs to be created to take over in the pool for the one that closed. | ||
1902 | 87 | this.createSocket(name, host, port).emit('free') | ||
1903 | 88 | } | ||
1904 | 89 | } | ||
1905 | 90 | |||
1906 | 91 | function ForeverAgentSSL (options) { | ||
1907 | 92 | ForeverAgent.call(this, options) | ||
1908 | 93 | } | ||
1909 | 94 | util.inherits(ForeverAgentSSL, ForeverAgent) | ||
1910 | 95 | |||
1911 | 96 | ForeverAgentSSL.prototype.createConnection = createConnectionSSL | ||
1912 | 97 | ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest | ||
1913 | 98 | |||
1914 | 99 | function createConnectionSSL (port, host, options) { | ||
1915 | 100 | if (typeof port === 'object') { | ||
1916 | 101 | options = port; | ||
1917 | 102 | } else if (typeof host === 'object') { | ||
1918 | 103 | options = host; | ||
1919 | 104 | } else if (typeof options === 'object') { | ||
1920 | 105 | options = options; | ||
1921 | 106 | } else { | ||
1922 | 107 | options = {}; | ||
1923 | 108 | } | ||
1924 | 109 | |||
1925 | 110 | if (typeof port === 'number') { | ||
1926 | 111 | options.port = port; | ||
1927 | 112 | } | ||
1928 | 113 | |||
1929 | 114 | if (typeof host === 'string') { | ||
1930 | 115 | options.host = host; | ||
1931 | 116 | } | ||
1932 | 117 | |||
1933 | 118 | return tls.connect(options); | ||
1934 | 119 | } | ||
1935 | 120 | 0 | ||
1936 | === removed file 'node_modules/cordova/_vendor/forever-agent/0.5.0/package.json' | |||
1937 | --- node_modules/cordova/_vendor/forever-agent/0.5.0/package.json 2013-12-12 20:49:30 +0000 | |||
1938 | +++ node_modules/cordova/_vendor/forever-agent/0.5.0/package.json 1970-01-01 00:00:00 +0000 | |||
1939 | @@ -1,27 +0,0 @@ | |||
1940 | 1 | { | ||
1941 | 2 | "author": { | ||
1942 | 3 | "name": "Mikeal Rogers", | ||
1943 | 4 | "email": "mikeal.rogers@gmail.com", | ||
1944 | 5 | "url": "http://www.futurealoof.com" | ||
1945 | 6 | }, | ||
1946 | 7 | "name": "forever-agent", | ||
1947 | 8 | "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.", | ||
1948 | 9 | "version": "0.5.0", | ||
1949 | 10 | "repository": { | ||
1950 | 11 | "url": "https://github.com/mikeal/forever-agent" | ||
1951 | 12 | }, | ||
1952 | 13 | "main": "index.js", | ||
1953 | 14 | "dependencies": {}, | ||
1954 | 15 | "devDependencies": {}, | ||
1955 | 16 | "optionalDependencies": {}, | ||
1956 | 17 | "engines": { | ||
1957 | 18 | "node": "*" | ||
1958 | 19 | }, | ||
1959 | 20 | "readme": "forever-agent\n=============\n\nHTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.\n", | ||
1960 | 21 | "readmeFilename": "README.md", | ||
1961 | 22 | "bugs": { | ||
1962 | 23 | "url": "https://github.com/mikeal/forever-agent/issues" | ||
1963 | 24 | }, | ||
1964 | 25 | "_id": "forever-agent@0.5.0", | ||
1965 | 26 | "_from": "forever-agent@~0.5.0" | ||
1966 | 27 | } | ||
1967 | 28 | 0 | ||
1968 | === added directory 'node_modules/cordova/_vendor/forever-agent/0.5.2' | |||
1969 | === added file 'node_modules/cordova/_vendor/forever-agent/0.5.2/LICENSE' | |||
1970 | --- node_modules/cordova/_vendor/forever-agent/0.5.2/LICENSE 1970-01-01 00:00:00 +0000 | |||
1971 | +++ node_modules/cordova/_vendor/forever-agent/0.5.2/LICENSE 2014-02-21 20:33:03 +0000 | |||
1972 | @@ -0,0 +1,55 @@ | |||
1973 | 1 | Apache License | ||
1974 | 2 | |||
1975 | 3 | Version 2.0, January 2004 | ||
1976 | 4 | |||
1977 | 5 | http://www.apache.org/licenses/ | ||
1978 | 6 | |||
1979 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
1980 | 8 | |||
1981 | 9 | 1. Definitions. | ||
1982 | 10 | |||
1983 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. | ||
1984 | 12 | |||
1985 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. | ||
1986 | 14 | |||
1987 | 15 | "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. | ||
1988 | 16 | |||
1989 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. | ||
1990 | 18 | |||
1991 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. | ||
1992 | 20 | |||
1993 | 21 | "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. | ||
1994 | 22 | |||
1995 | 23 | "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). | ||
1996 | 24 | |||
1997 | 25 | "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. | ||
1998 | 26 | |||
1999 | 27 | "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." | ||
2000 | 28 | |||
2001 | 29 | "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. | ||
2002 | 30 | |||
2003 | 31 | 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. | ||
2004 | 32 | |||
2005 | 33 | 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. | ||
2006 | 34 | |||
2007 | 35 | 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: | ||
2008 | 36 | |||
2009 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and | ||
2010 | 38 | |||
2011 | 39 | You must cause any modified files to carry prominent notices stating that You changed the files; and | ||
2012 | 40 | |||
2013 | 41 | 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 | ||
2014 | 42 | |||
2015 | 43 | 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. | ||
2016 | 44 | |||
2017 | 45 | 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. | ||
2018 | 46 | |||
2019 | 47 | 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. | ||
2020 | 48 | |||
2021 | 49 | 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. | ||
2022 | 50 | |||
2023 | 51 | 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. | ||
2024 | 52 | |||
2025 | 53 | 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. | ||
2026 | 54 | |||
2027 | 55 | END OF TERMS AND CONDITIONS | ||
2028 | 0 | \ No newline at end of file | 56 | \ No newline at end of file |
2029 | 1 | 57 | ||
2030 | === added file 'node_modules/cordova/_vendor/forever-agent/0.5.2/README.md' | |||
2031 | --- node_modules/cordova/_vendor/forever-agent/0.5.2/README.md 1970-01-01 00:00:00 +0000 | |||
2032 | +++ node_modules/cordova/_vendor/forever-agent/0.5.2/README.md 2014-02-21 20:33:03 +0000 | |||
2033 | @@ -0,0 +1,4 @@ | |||
2034 | 1 | forever-agent | ||
2035 | 2 | ============= | ||
2036 | 3 | |||
2037 | 4 | HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module. | ||
2038 | 0 | 5 | ||
2039 | === added symlink 'node_modules/cordova/_vendor/forever-agent/0.5.2/_vendor' | |||
2040 | === target is u'../..' | |||
2041 | === added file 'node_modules/cordova/_vendor/forever-agent/0.5.2/index.js' | |||
2042 | --- node_modules/cordova/_vendor/forever-agent/0.5.2/index.js 1970-01-01 00:00:00 +0000 | |||
2043 | +++ node_modules/cordova/_vendor/forever-agent/0.5.2/index.js 2014-02-21 20:33:03 +0000 | |||
2044 | @@ -0,0 +1,119 @@ | |||
2045 | 1 | module.exports = ForeverAgent | ||
2046 | 2 | ForeverAgent.SSL = ForeverAgentSSL | ||
2047 | 3 | |||
2048 | 4 | var util = require('util') | ||
2049 | 5 | , Agent = require('http').Agent | ||
2050 | 6 | , net = require('net') | ||
2051 | 7 | , tls = require('tls') | ||
2052 | 8 | , AgentSSL = require('https').Agent | ||
2053 | 9 | |||
2054 | 10 | function ForeverAgent(options) { | ||
2055 | 11 | var self = this | ||
2056 | 12 | self.options = options || {} | ||
2057 | 13 | self.requests = {} | ||
2058 | 14 | self.sockets = {} | ||
2059 | 15 | self.freeSockets = {} | ||
2060 | 16 | self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets | ||
2061 | 17 | self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets | ||
2062 | 18 | self.on('free', function(socket, host, port) { | ||
2063 | 19 | var name = host + ':' + port | ||
2064 | 20 | if (self.requests[name] && self.requests[name].length) { | ||
2065 | 21 | self.requests[name].shift().onSocket(socket) | ||
2066 | 22 | } else if (self.sockets[name].length < self.minSockets) { | ||
2067 | 23 | if (!self.freeSockets[name]) self.freeSockets[name] = [] | ||
2068 | 24 | self.freeSockets[name].push(socket) | ||
2069 | 25 | |||
2070 | 26 | // if an error happens while we don't use the socket anyway, meh, throw the socket away | ||
2071 | 27 | var onIdleError = function() { | ||
2072 | 28 | socket.destroy() | ||
2073 | 29 | } | ||
2074 | 30 | socket._onIdleError = onIdleError | ||
2075 | 31 | socket.on('error', onIdleError) | ||
2076 | 32 | } else { | ||
2077 | 33 | // If there are no pending requests just destroy the | ||
2078 | 34 | // socket and it will get removed from the pool. This | ||
2079 | 35 | // gets us out of timeout issues and allows us to | ||
2080 | 36 | // default to Connection:keep-alive. | ||
2081 | 37 | socket.destroy() | ||
2082 | 38 | } | ||
2083 | 39 | }) | ||
2084 | 40 | |||
2085 | 41 | } | ||
2086 | 42 | util.inherits(ForeverAgent, Agent) | ||
2087 | 43 | |||
2088 | 44 | ForeverAgent.defaultMinSockets = 5 | ||
2089 | 45 | |||
2090 | 46 | |||
2091 | 47 | ForeverAgent.prototype.createConnection = net.createConnection | ||
2092 | 48 | ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest | ||
2093 | 49 | ForeverAgent.prototype.addRequest = function(req, host, port) { | ||
2094 | 50 | var name = host + ':' + port | ||
2095 | 51 | if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { | ||
2096 | 52 | var idleSocket = this.freeSockets[name].pop() | ||
2097 | 53 | idleSocket.removeListener('error', idleSocket._onIdleError) | ||
2098 | 54 | delete idleSocket._onIdleError | ||
2099 | 55 | req._reusedSocket = true | ||
2100 | 56 | req.onSocket(idleSocket) | ||
2101 | 57 | } else { | ||
2102 | 58 | this.addRequestNoreuse(req, host, port) | ||
2103 | 59 | } | ||
2104 | 60 | } | ||
2105 | 61 | |||
2106 | 62 | ForeverAgent.prototype.removeSocket = function(s, name, host, port) { | ||
2107 | 63 | if (this.sockets[name]) { | ||
2108 | 64 | var index = this.sockets[name].indexOf(s) | ||
2109 | 65 | if (index !== -1) { | ||
2110 | 66 | this.sockets[name].splice(index, 1) | ||
2111 | 67 | } | ||
2112 | 68 | } else if (this.sockets[name] && this.sockets[name].length === 0) { | ||
2113 | 69 | // don't leak | ||
2114 | 70 | delete this.sockets[name] | ||
2115 | 71 | delete this.requests[name] | ||
2116 | 72 | } | ||
2117 | 73 | |||
2118 | 74 | if (this.freeSockets[name]) { | ||
2119 | 75 | var index = this.freeSockets[name].indexOf(s) | ||
2120 | 76 | if (index !== -1) { | ||
2121 | 77 | this.freeSockets[name].splice(index, 1) | ||
2122 | 78 | if (this.freeSockets[name].length === 0) { | ||
2123 | 79 | delete this.freeSockets[name] | ||
2124 | 80 | } | ||
2125 | 81 | } | ||
2126 | 82 | } | ||
2127 | 83 | |||
2128 | 84 | if (this.requests[name] && this.requests[name].length) { | ||
2129 | 85 | // If we have pending requests and a socket gets closed a new one | ||
2130 | 86 | // needs to be created to take over in the pool for the one that closed. | ||
2131 | 87 | this.createSocket(name, host, port).emit('free') | ||
2132 | 88 | } | ||
2133 | 89 | } | ||
2134 | 90 | |||
2135 | 91 | function ForeverAgentSSL (options) { | ||
2136 | 92 | ForeverAgent.call(this, options) | ||
2137 | 93 | } | ||
2138 | 94 | util.inherits(ForeverAgentSSL, ForeverAgent) | ||
2139 | 95 | |||
2140 | 96 | ForeverAgentSSL.prototype.createConnection = createConnectionSSL | ||
2141 | 97 | ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest | ||
2142 | 98 | |||
2143 | 99 | function createConnectionSSL (port, host, options) { | ||
2144 | 100 | if (typeof port === 'object') { | ||
2145 | 101 | options = port; | ||
2146 | 102 | } else if (typeof host === 'object') { | ||
2147 | 103 | options = host; | ||
2148 | 104 | } else if (typeof options === 'object') { | ||
2149 | 105 | options = options; | ||
2150 | 106 | } else { | ||
2151 | 107 | options = {}; | ||
2152 | 108 | } | ||
2153 | 109 | |||
2154 | 110 | if (typeof port === 'number') { | ||
2155 | 111 | options.port = port; | ||
2156 | 112 | } | ||
2157 | 113 | |||
2158 | 114 | if (typeof host === 'string') { | ||
2159 | 115 | options.host = host; | ||
2160 | 116 | } | ||
2161 | 117 | |||
2162 | 118 | return tls.connect(options); | ||
2163 | 119 | } | ||
2164 | 0 | 120 | ||
2165 | === added file 'node_modules/cordova/_vendor/forever-agent/0.5.2/package.json' | |||
2166 | --- node_modules/cordova/_vendor/forever-agent/0.5.2/package.json 1970-01-01 00:00:00 +0000 | |||
2167 | +++ node_modules/cordova/_vendor/forever-agent/0.5.2/package.json 2014-02-21 20:33:03 +0000 | |||
2168 | @@ -0,0 +1,27 @@ | |||
2169 | 1 | { | ||
2170 | 2 | "author": { | ||
2171 | 3 | "name": "Mikeal Rogers", | ||
2172 | 4 | "email": "mikeal.rogers@gmail.com", | ||
2173 | 5 | "url": "http://www.futurealoof.com" | ||
2174 | 6 | }, | ||
2175 | 7 | "name": "forever-agent", | ||
2176 | 8 | "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.", | ||
2177 | 9 | "version": "0.5.2", | ||
2178 | 10 | "repository": { | ||
2179 | 11 | "url": "https://github.com/mikeal/forever-agent" | ||
2180 | 12 | }, | ||
2181 | 13 | "main": "index.js", | ||
2182 | 14 | "dependencies": {}, | ||
2183 | 15 | "devDependencies": {}, | ||
2184 | 16 | "optionalDependencies": {}, | ||
2185 | 17 | "engines": { | ||
2186 | 18 | "node": "*" | ||
2187 | 19 | }, | ||
2188 | 20 | "readme": "forever-agent\n=============\n\nHTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.\n", | ||
2189 | 21 | "readmeFilename": "README.md", | ||
2190 | 22 | "bugs": { | ||
2191 | 23 | "url": "https://github.com/mikeal/forever-agent/issues" | ||
2192 | 24 | }, | ||
2193 | 25 | "_id": "forever-agent@0.5.2", | ||
2194 | 26 | "_from": "forever-agent@~0.5.0" | ||
2195 | 27 | } | ||
2196 | 0 | 28 | ||
2197 | === modified symlink 'node_modules/cordova/_vendor/fstream/0.1.25/node_modules/graceful-fs' | |||
2198 | === target changed u'../_vendor/graceful-fs/2.0.1' => u'../_vendor/graceful-fs/2.0.2' | |||
2199 | === removed directory 'node_modules/cordova/_vendor/graceful-fs/2.0.1' | |||
2200 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/.npmignore' | |||
2201 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/.npmignore 2013-12-12 20:49:30 +0000 | |||
2202 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/.npmignore 1970-01-01 00:00:00 +0000 | |||
2203 | @@ -1,1 +0,0 @@ | |||
2204 | 1 | node_modules/ | ||
2205 | 2 | 0 | ||
2206 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/LICENSE' | |||
2207 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/LICENSE 2013-12-12 20:49:30 +0000 | |||
2208 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/LICENSE 1970-01-01 00:00:00 +0000 | |||
2209 | @@ -1,27 +0,0 @@ | |||
2210 | 1 | Copyright (c) Isaac Z. Schlueter ("Author") | ||
2211 | 2 | All rights reserved. | ||
2212 | 3 | |||
2213 | 4 | The BSD License | ||
2214 | 5 | |||
2215 | 6 | Redistribution and use in source and binary forms, with or without | ||
2216 | 7 | modification, are permitted provided that the following conditions | ||
2217 | 8 | are met: | ||
2218 | 9 | |||
2219 | 10 | 1. Redistributions of source code must retain the above copyright | ||
2220 | 11 | notice, this list of conditions and the following disclaimer. | ||
2221 | 12 | |||
2222 | 13 | 2. Redistributions in binary form must reproduce the above copyright | ||
2223 | 14 | notice, this list of conditions and the following disclaimer in the | ||
2224 | 15 | documentation and/or other materials provided with the distribution. | ||
2225 | 16 | |||
2226 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
2227 | 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
2228 | 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
2229 | 20 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | ||
2230 | 21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
2231 | 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
2232 | 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
2233 | 24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
2234 | 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
2235 | 26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
2236 | 27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
2237 | 28 | 0 | ||
2238 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/README.md' | |||
2239 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/README.md 2013-12-12 20:49:30 +0000 | |||
2240 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/README.md 1970-01-01 00:00:00 +0000 | |||
2241 | @@ -1,26 +0,0 @@ | |||
2242 | 1 | # graceful-fs | ||
2243 | 2 | |||
2244 | 3 | graceful-fs functions as a drop-in replacement for the fs module, | ||
2245 | 4 | making various improvements. | ||
2246 | 5 | |||
2247 | 6 | The improvements are meant to normalize behavior across different | ||
2248 | 7 | platforms and environments, and to make filesystem access more | ||
2249 | 8 | resilient to errors. | ||
2250 | 9 | |||
2251 | 10 | ## Improvements over fs module | ||
2252 | 11 | |||
2253 | 12 | graceful-fs: | ||
2254 | 13 | |||
2255 | 14 | * Queues up `open` and `readdir` calls, and retries them once | ||
2256 | 15 | something closes if there is an EMFILE error from too many file | ||
2257 | 16 | descriptors. | ||
2258 | 17 | * fixes `lchmod` for Node versions prior to 0.6.2. | ||
2259 | 18 | * implements `fs.lutimes` if possible. Otherwise it becomes a noop. | ||
2260 | 19 | * ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or | ||
2261 | 20 | `lchown` if the user isn't root. | ||
2262 | 21 | * makes `lchmod` and `lchown` become noops, if not available. | ||
2263 | 22 | * retries reading a file if `read` results in EAGAIN error. | ||
2264 | 23 | |||
2265 | 24 | On Windows, it retries renaming a file for up to one second if `EACCESS` | ||
2266 | 25 | or `EPERM` error occurs, likely because antivirus software has locked | ||
2267 | 26 | the directory. | ||
2268 | 27 | 0 | ||
2269 | === removed symlink 'node_modules/cordova/_vendor/graceful-fs/2.0.1/_vendor' | |||
2270 | === target was u'../..' | |||
2271 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/graceful-fs.js' | |||
2272 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/graceful-fs.js 2013-12-12 20:49:30 +0000 | |||
2273 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/graceful-fs.js 1970-01-01 00:00:00 +0000 | |||
2274 | @@ -1,159 +0,0 @@ | |||
2275 | 1 | // Monkey-patching the fs module. | ||
2276 | 2 | // It's ugly, but there is simply no other way to do this. | ||
2277 | 3 | var fs = module.exports = require('fs') | ||
2278 | 4 | |||
2279 | 5 | var assert = require('assert') | ||
2280 | 6 | |||
2281 | 7 | // fix up some busted stuff, mostly on windows and old nodes | ||
2282 | 8 | require('./polyfills.js') | ||
2283 | 9 | |||
2284 | 10 | // The EMFILE enqueuing stuff | ||
2285 | 11 | |||
2286 | 12 | var util = require('util') | ||
2287 | 13 | |||
2288 | 14 | function noop () {} | ||
2289 | 15 | |||
2290 | 16 | var debug = noop | ||
2291 | 17 | var util = require('util') | ||
2292 | 18 | if (util.debuglog) | ||
2293 | 19 | debug = util.debuglog('gfs') | ||
2294 | 20 | else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) | ||
2295 | 21 | debug = function() { | ||
2296 | 22 | var m = util.format.apply(util, arguments) | ||
2297 | 23 | m = 'GFS: ' + m.split(/\n/).join('\nGFS: ') | ||
2298 | 24 | console.error(m) | ||
2299 | 25 | } | ||
2300 | 26 | |||
2301 | 27 | if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) { | ||
2302 | 28 | process.on('exit', function() { | ||
2303 | 29 | debug('fds', fds) | ||
2304 | 30 | debug(queue) | ||
2305 | 31 | assert.equal(queue.length, 0) | ||
2306 | 32 | }) | ||
2307 | 33 | } | ||
2308 | 34 | |||
2309 | 35 | |||
2310 | 36 | var originalOpen = fs.open | ||
2311 | 37 | fs.open = open | ||
2312 | 38 | |||
2313 | 39 | function open(path, flags, mode, cb) { | ||
2314 | 40 | if (typeof mode === "function") cb = mode, mode = null | ||
2315 | 41 | if (typeof cb !== "function") cb = noop | ||
2316 | 42 | new OpenReq(path, flags, mode, cb) | ||
2317 | 43 | } | ||
2318 | 44 | |||
2319 | 45 | function OpenReq(path, flags, mode, cb) { | ||
2320 | 46 | this.path = path | ||
2321 | 47 | this.flags = flags | ||
2322 | 48 | this.mode = mode | ||
2323 | 49 | this.cb = cb | ||
2324 | 50 | Req.call(this) | ||
2325 | 51 | } | ||
2326 | 52 | |||
2327 | 53 | util.inherits(OpenReq, Req) | ||
2328 | 54 | |||
2329 | 55 | OpenReq.prototype.process = function() { | ||
2330 | 56 | originalOpen.call(fs, this.path, this.flags, this.mode, this.done) | ||
2331 | 57 | } | ||
2332 | 58 | |||
2333 | 59 | var fds = {} | ||
2334 | 60 | OpenReq.prototype.done = function(er, fd) { | ||
2335 | 61 | debug('open done', er, fd) | ||
2336 | 62 | if (fd) | ||
2337 | 63 | fds['fd' + fd] = this.path | ||
2338 | 64 | Req.prototype.done.call(this, er, fd) | ||
2339 | 65 | } | ||
2340 | 66 | |||
2341 | 67 | |||
2342 | 68 | var originalReaddir = fs.readdir | ||
2343 | 69 | fs.readdir = readdir | ||
2344 | 70 | |||
2345 | 71 | function readdir(path, cb) { | ||
2346 | 72 | if (typeof cb !== "function") cb = noop | ||
2347 | 73 | new ReaddirReq(path, cb) | ||
2348 | 74 | } | ||
2349 | 75 | |||
2350 | 76 | function ReaddirReq(path, cb) { | ||
2351 | 77 | this.path = path | ||
2352 | 78 | this.cb = cb | ||
2353 | 79 | Req.call(this) | ||
2354 | 80 | } | ||
2355 | 81 | |||
2356 | 82 | util.inherits(ReaddirReq, Req) | ||
2357 | 83 | |||
2358 | 84 | ReaddirReq.prototype.process = function() { | ||
2359 | 85 | originalReaddir.call(fs, this.path, this.done) | ||
2360 | 86 | } | ||
2361 | 87 | |||
2362 | 88 | ReaddirReq.prototype.done = function(er, files) { | ||
2363 | 89 | Req.prototype.done.call(this, er, files) | ||
2364 | 90 | onclose() | ||
2365 | 91 | } | ||
2366 | 92 | |||
2367 | 93 | |||
2368 | 94 | var originalClose = fs.close | ||
2369 | 95 | fs.close = close | ||
2370 | 96 | |||
2371 | 97 | function close (fd, cb) { | ||
2372 | 98 | debug('close', fd) | ||
2373 | 99 | if (typeof cb !== "function") cb = noop | ||
2374 | 100 | delete fds['fd' + fd] | ||
2375 | 101 | originalClose.call(fs, fd, function(er) { | ||
2376 | 102 | onclose() | ||
2377 | 103 | cb(er) | ||
2378 | 104 | }) | ||
2379 | 105 | } | ||
2380 | 106 | |||
2381 | 107 | |||
2382 | 108 | var originalCloseSync = fs.closeSync | ||
2383 | 109 | fs.closeSync = closeSync | ||
2384 | 110 | |||
2385 | 111 | function closeSync (fd) { | ||
2386 | 112 | try { | ||
2387 | 113 | return originalCloseSync(fd) | ||
2388 | 114 | } finally { | ||
2389 | 115 | onclose() | ||
2390 | 116 | } | ||
2391 | 117 | } | ||
2392 | 118 | |||
2393 | 119 | |||
2394 | 120 | // Req class | ||
2395 | 121 | function Req () { | ||
2396 | 122 | // start processing | ||
2397 | 123 | this.done = this.done.bind(this) | ||
2398 | 124 | this.failures = 0 | ||
2399 | 125 | this.process() | ||
2400 | 126 | } | ||
2401 | 127 | |||
2402 | 128 | Req.prototype.done = function (er, result) { | ||
2403 | 129 | var tryAgain = false | ||
2404 | 130 | if (er) { | ||
2405 | 131 | var code = er.code | ||
2406 | 132 | var tryAgain = code === "EMFILE" | ||
2407 | 133 | if (process.platform === "win32") | ||
2408 | 134 | tryAgain = tryAgain || code === "OK" | ||
2409 | 135 | } | ||
2410 | 136 | |||
2411 | 137 | if (tryAgain) { | ||
2412 | 138 | this.failures ++ | ||
2413 | 139 | enqueue(this) | ||
2414 | 140 | } else { | ||
2415 | 141 | var cb = this.cb | ||
2416 | 142 | cb(er, result) | ||
2417 | 143 | } | ||
2418 | 144 | } | ||
2419 | 145 | |||
2420 | 146 | var queue = [] | ||
2421 | 147 | |||
2422 | 148 | function enqueue(req) { | ||
2423 | 149 | queue.push(req) | ||
2424 | 150 | debug('enqueue %d %s', queue.length, req.constructor.name, req) | ||
2425 | 151 | } | ||
2426 | 152 | |||
2427 | 153 | function onclose() { | ||
2428 | 154 | var req = queue.shift() | ||
2429 | 155 | if (req) { | ||
2430 | 156 | debug('process', req.constructor.name, req) | ||
2431 | 157 | req.process() | ||
2432 | 158 | } | ||
2433 | 159 | } | ||
2434 | 160 | 0 | ||
2435 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/package.json' | |||
2436 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/package.json 2013-12-12 20:49:30 +0000 | |||
2437 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/package.json 1970-01-01 00:00:00 +0000 | |||
2438 | @@ -1,48 +0,0 @@ | |||
2439 | 1 | { | ||
2440 | 2 | "author": { | ||
2441 | 3 | "name": "Isaac Z. Schlueter", | ||
2442 | 4 | "email": "i@izs.me", | ||
2443 | 5 | "url": "http://blog.izs.me" | ||
2444 | 6 | }, | ||
2445 | 7 | "name": "graceful-fs", | ||
2446 | 8 | "description": "A drop-in replacement for fs, making various improvements.", | ||
2447 | 9 | "version": "2.0.1", | ||
2448 | 10 | "repository": { | ||
2449 | 11 | "type": "git", | ||
2450 | 12 | "url": "git://github.com/isaacs/node-graceful-fs.git" | ||
2451 | 13 | }, | ||
2452 | 14 | "main": "graceful-fs.js", | ||
2453 | 15 | "engines": { | ||
2454 | 16 | "node": ">=0.4.0" | ||
2455 | 17 | }, | ||
2456 | 18 | "directories": { | ||
2457 | 19 | "test": "test" | ||
2458 | 20 | }, | ||
2459 | 21 | "scripts": { | ||
2460 | 22 | "test": "tap test/*.js" | ||
2461 | 23 | }, | ||
2462 | 24 | "keywords": [ | ||
2463 | 25 | "fs", | ||
2464 | 26 | "module", | ||
2465 | 27 | "reading", | ||
2466 | 28 | "retry", | ||
2467 | 29 | "retries", | ||
2468 | 30 | "queue", | ||
2469 | 31 | "error", | ||
2470 | 32 | "errors", | ||
2471 | 33 | "handling", | ||
2472 | 34 | "EMFILE", | ||
2473 | 35 | "EAGAIN", | ||
2474 | 36 | "EINVAL", | ||
2475 | 37 | "EPERM", | ||
2476 | 38 | "EACCESS" | ||
2477 | 39 | ], | ||
2478 | 40 | "license": "BSD", | ||
2479 | 41 | "readme": "# graceful-fs\n\ngraceful-fs functions as a drop-in replacement for the fs module,\nmaking various improvements.\n\nThe improvements are meant to normalize behavior across different\nplatforms and environments, and to make filesystem access more\nresilient to errors.\n\n## Improvements over fs module\n\ngraceful-fs:\n\n* Queues up `open` and `readdir` calls, and retries them once\n something closes if there is an EMFILE error from too many file\n descriptors.\n* fixes `lchmod` for Node versions prior to 0.6.2.\n* implements `fs.lutimes` if possible. Otherwise it becomes a noop.\n* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or\n `lchown` if the user isn't root.\n* makes `lchmod` and `lchown` become noops, if not available.\n* retries reading a file if `read` results in EAGAIN error.\n\nOn Windows, it retries renaming a file for up to one second if `EACCESS`\nor `EPERM` error occurs, likely because antivirus software has locked\nthe directory.\n", | ||
2480 | 42 | "readmeFilename": "README.md", | ||
2481 | 43 | "bugs": { | ||
2482 | 44 | "url": "https://github.com/isaacs/node-graceful-fs/issues" | ||
2483 | 45 | }, | ||
2484 | 46 | "_id": "graceful-fs@2.0.1", | ||
2485 | 47 | "_from": "graceful-fs@~2.0.0" | ||
2486 | 48 | } | ||
2487 | 49 | 0 | ||
2488 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/polyfills.js' | |||
2489 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/polyfills.js 2013-12-12 20:49:30 +0000 | |||
2490 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/polyfills.js 1970-01-01 00:00:00 +0000 | |||
2491 | @@ -1,228 +0,0 @@ | |||
2492 | 1 | var fs = require('fs') | ||
2493 | 2 | var constants = require('constants') | ||
2494 | 3 | |||
2495 | 4 | var origCwd = process.cwd | ||
2496 | 5 | var cwd = null | ||
2497 | 6 | process.cwd = function() { | ||
2498 | 7 | if (!cwd) | ||
2499 | 8 | cwd = origCwd.call(process) | ||
2500 | 9 | return cwd | ||
2501 | 10 | } | ||
2502 | 11 | var chdir = process.chdir | ||
2503 | 12 | process.chdir = function(d) { | ||
2504 | 13 | cwd = null | ||
2505 | 14 | chdir.call(process, d) | ||
2506 | 15 | } | ||
2507 | 16 | |||
2508 | 17 | // (re-)implement some things that are known busted or missing. | ||
2509 | 18 | |||
2510 | 19 | // lchmod, broken prior to 0.6.2 | ||
2511 | 20 | // back-port the fix here. | ||
2512 | 21 | if (constants.hasOwnProperty('O_SYMLINK') && | ||
2513 | 22 | process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { | ||
2514 | 23 | fs.lchmod = function (path, mode, callback) { | ||
2515 | 24 | callback = callback || noop | ||
2516 | 25 | fs.open( path | ||
2517 | 26 | , constants.O_WRONLY | constants.O_SYMLINK | ||
2518 | 27 | , mode | ||
2519 | 28 | , function (err, fd) { | ||
2520 | 29 | if (err) { | ||
2521 | 30 | callback(err) | ||
2522 | 31 | return | ||
2523 | 32 | } | ||
2524 | 33 | // prefer to return the chmod error, if one occurs, | ||
2525 | 34 | // but still try to close, and report closing errors if they occur. | ||
2526 | 35 | fs.fchmod(fd, mode, function (err) { | ||
2527 | 36 | fs.close(fd, function(err2) { | ||
2528 | 37 | callback(err || err2) | ||
2529 | 38 | }) | ||
2530 | 39 | }) | ||
2531 | 40 | }) | ||
2532 | 41 | } | ||
2533 | 42 | |||
2534 | 43 | fs.lchmodSync = function (path, mode) { | ||
2535 | 44 | var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) | ||
2536 | 45 | |||
2537 | 46 | // prefer to return the chmod error, if one occurs, | ||
2538 | 47 | // but still try to close, and report closing errors if they occur. | ||
2539 | 48 | var err, err2 | ||
2540 | 49 | try { | ||
2541 | 50 | var ret = fs.fchmodSync(fd, mode) | ||
2542 | 51 | } catch (er) { | ||
2543 | 52 | err = er | ||
2544 | 53 | } | ||
2545 | 54 | try { | ||
2546 | 55 | fs.closeSync(fd) | ||
2547 | 56 | } catch (er) { | ||
2548 | 57 | err2 = er | ||
2549 | 58 | } | ||
2550 | 59 | if (err || err2) throw (err || err2) | ||
2551 | 60 | return ret | ||
2552 | 61 | } | ||
2553 | 62 | } | ||
2554 | 63 | |||
2555 | 64 | |||
2556 | 65 | // lutimes implementation, or no-op | ||
2557 | 66 | if (!fs.lutimes) { | ||
2558 | 67 | if (constants.hasOwnProperty("O_SYMLINK")) { | ||
2559 | 68 | fs.lutimes = function (path, at, mt, cb) { | ||
2560 | 69 | fs.open(path, constants.O_SYMLINK, function (er, fd) { | ||
2561 | 70 | cb = cb || noop | ||
2562 | 71 | if (er) return cb(er) | ||
2563 | 72 | fs.futimes(fd, at, mt, function (er) { | ||
2564 | 73 | fs.close(fd, function (er2) { | ||
2565 | 74 | return cb(er || er2) | ||
2566 | 75 | }) | ||
2567 | 76 | }) | ||
2568 | 77 | }) | ||
2569 | 78 | } | ||
2570 | 79 | |||
2571 | 80 | fs.lutimesSync = function (path, at, mt) { | ||
2572 | 81 | var fd = fs.openSync(path, constants.O_SYMLINK) | ||
2573 | 82 | , err | ||
2574 | 83 | , err2 | ||
2575 | 84 | , ret | ||
2576 | 85 | |||
2577 | 86 | try { | ||
2578 | 87 | var ret = fs.futimesSync(fd, at, mt) | ||
2579 | 88 | } catch (er) { | ||
2580 | 89 | err = er | ||
2581 | 90 | } | ||
2582 | 91 | try { | ||
2583 | 92 | fs.closeSync(fd) | ||
2584 | 93 | } catch (er) { | ||
2585 | 94 | err2 = er | ||
2586 | 95 | } | ||
2587 | 96 | if (err || err2) throw (err || err2) | ||
2588 | 97 | return ret | ||
2589 | 98 | } | ||
2590 | 99 | |||
2591 | 100 | } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) { | ||
2592 | 101 | // maybe utimensat will be bound soonish? | ||
2593 | 102 | fs.lutimes = function (path, at, mt, cb) { | ||
2594 | 103 | fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb) | ||
2595 | 104 | } | ||
2596 | 105 | |||
2597 | 106 | fs.lutimesSync = function (path, at, mt) { | ||
2598 | 107 | return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW) | ||
2599 | 108 | } | ||
2600 | 109 | |||
2601 | 110 | } else { | ||
2602 | 111 | fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) } | ||
2603 | 112 | fs.lutimesSync = function () {} | ||
2604 | 113 | } | ||
2605 | 114 | } | ||
2606 | 115 | |||
2607 | 116 | |||
2608 | 117 | // https://github.com/isaacs/node-graceful-fs/issues/4 | ||
2609 | 118 | // Chown should not fail on einval or eperm if non-root. | ||
2610 | 119 | |||
2611 | 120 | fs.chown = chownFix(fs.chown) | ||
2612 | 121 | fs.fchown = chownFix(fs.fchown) | ||
2613 | 122 | fs.lchown = chownFix(fs.lchown) | ||
2614 | 123 | |||
2615 | 124 | fs.chownSync = chownFixSync(fs.chownSync) | ||
2616 | 125 | fs.fchownSync = chownFixSync(fs.fchownSync) | ||
2617 | 126 | fs.lchownSync = chownFixSync(fs.lchownSync) | ||
2618 | 127 | |||
2619 | 128 | function chownFix (orig) { | ||
2620 | 129 | if (!orig) return orig | ||
2621 | 130 | return function (target, uid, gid, cb) { | ||
2622 | 131 | return orig.call(fs, target, uid, gid, function (er, res) { | ||
2623 | 132 | if (chownErOk(er)) er = null | ||
2624 | 133 | cb(er, res) | ||
2625 | 134 | }) | ||
2626 | 135 | } | ||
2627 | 136 | } | ||
2628 | 137 | |||
2629 | 138 | function chownFixSync (orig) { | ||
2630 | 139 | if (!orig) return orig | ||
2631 | 140 | return function (target, uid, gid) { | ||
2632 | 141 | try { | ||
2633 | 142 | return orig.call(fs, target, uid, gid) | ||
2634 | 143 | } catch (er) { | ||
2635 | 144 | if (!chownErOk(er)) throw er | ||
2636 | 145 | } | ||
2637 | 146 | } | ||
2638 | 147 | } | ||
2639 | 148 | |||
2640 | 149 | function chownErOk (er) { | ||
2641 | 150 | // if there's no getuid, or if getuid() is something other than 0, | ||
2642 | 151 | // and the error is EINVAL or EPERM, then just ignore it. | ||
2643 | 152 | // This specific case is a silent failure in cp, install, tar, | ||
2644 | 153 | // and most other unix tools that manage permissions. | ||
2645 | 154 | // When running as root, or if other types of errors are encountered, | ||
2646 | 155 | // then it's strict. | ||
2647 | 156 | if (!er || (!process.getuid || process.getuid() !== 0) | ||
2648 | 157 | && (er.code === "EINVAL" || er.code === "EPERM")) return true | ||
2649 | 158 | } | ||
2650 | 159 | |||
2651 | 160 | |||
2652 | 161 | // if lchmod/lchown do not exist, then make them no-ops | ||
2653 | 162 | if (!fs.lchmod) { | ||
2654 | 163 | fs.lchmod = function (path, mode, cb) { | ||
2655 | 164 | process.nextTick(cb) | ||
2656 | 165 | } | ||
2657 | 166 | fs.lchmodSync = function () {} | ||
2658 | 167 | } | ||
2659 | 168 | if (!fs.lchown) { | ||
2660 | 169 | fs.lchown = function (path, uid, gid, cb) { | ||
2661 | 170 | process.nextTick(cb) | ||
2662 | 171 | } | ||
2663 | 172 | fs.lchownSync = function () {} | ||
2664 | 173 | } | ||
2665 | 174 | |||
2666 | 175 | |||
2667 | 176 | |||
2668 | 177 | // on Windows, A/V software can lock the directory, causing this | ||
2669 | 178 | // to fail with an EACCES or EPERM if the directory contains newly | ||
2670 | 179 | // created files. Try again on failure, for up to 1 second. | ||
2671 | 180 | if (process.platform === "win32") { | ||
2672 | 181 | var rename_ = fs.rename | ||
2673 | 182 | fs.rename = function rename (from, to, cb) { | ||
2674 | 183 | var start = Date.now() | ||
2675 | 184 | rename_(from, to, function CB (er) { | ||
2676 | 185 | if (er | ||
2677 | 186 | && (er.code === "EACCES" || er.code === "EPERM") | ||
2678 | 187 | && Date.now() - start < 1000) { | ||
2679 | 188 | return rename_(from, to, CB) | ||
2680 | 189 | } | ||
2681 | 190 | cb(er) | ||
2682 | 191 | }) | ||
2683 | 192 | } | ||
2684 | 193 | } | ||
2685 | 194 | |||
2686 | 195 | |||
2687 | 196 | // if read() returns EAGAIN, then just try it again. | ||
2688 | 197 | var read = fs.read | ||
2689 | 198 | fs.read = function (fd, buffer, offset, length, position, callback_) { | ||
2690 | 199 | var callback | ||
2691 | 200 | if (callback_ && typeof callback_ === 'function') { | ||
2692 | 201 | var eagCounter = 0 | ||
2693 | 202 | callback = function (er, _, __) { | ||
2694 | 203 | if (er && er.code === 'EAGAIN' && eagCounter < 10) { | ||
2695 | 204 | eagCounter ++ | ||
2696 | 205 | return read.call(fs, fd, buffer, offset, length, position, callback) | ||
2697 | 206 | } | ||
2698 | 207 | callback_.apply(this, arguments) | ||
2699 | 208 | } | ||
2700 | 209 | } | ||
2701 | 210 | return read.call(fs, fd, buffer, offset, length, position, callback) | ||
2702 | 211 | } | ||
2703 | 212 | |||
2704 | 213 | var readSync = fs.readSync | ||
2705 | 214 | fs.readSync = function (fd, buffer, offset, length, position) { | ||
2706 | 215 | var eagCounter = 0 | ||
2707 | 216 | while (true) { | ||
2708 | 217 | try { | ||
2709 | 218 | return readSync.call(fs, fd, buffer, offset, length, position) | ||
2710 | 219 | } catch (er) { | ||
2711 | 220 | if (er.code === 'EAGAIN' && eagCounter < 10) { | ||
2712 | 221 | eagCounter ++ | ||
2713 | 222 | continue | ||
2714 | 223 | } | ||
2715 | 224 | throw er | ||
2716 | 225 | } | ||
2717 | 226 | } | ||
2718 | 227 | } | ||
2719 | 228 | |||
2720 | 229 | 0 | ||
2721 | === removed directory 'node_modules/cordova/_vendor/graceful-fs/2.0.1/test' | |||
2722 | === removed file 'node_modules/cordova/_vendor/graceful-fs/2.0.1/test/open.js' | |||
2723 | --- node_modules/cordova/_vendor/graceful-fs/2.0.1/test/open.js 2013-12-12 20:49:30 +0000 | |||
2724 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.1/test/open.js 1970-01-01 00:00:00 +0000 | |||
2725 | @@ -1,39 +0,0 @@ | |||
2726 | 1 | var test = require('tap').test | ||
2727 | 2 | var fs = require('../graceful-fs.js') | ||
2728 | 3 | |||
2729 | 4 | test('graceful fs is monkeypatched fs', function (t) { | ||
2730 | 5 | t.equal(fs, require('fs')) | ||
2731 | 6 | t.end() | ||
2732 | 7 | }) | ||
2733 | 8 | |||
2734 | 9 | test('open an existing file works', function (t) { | ||
2735 | 10 | var fd = fs.openSync(__filename, 'r') | ||
2736 | 11 | fs.closeSync(fd) | ||
2737 | 12 | fs.open(__filename, 'r', function (er, fd) { | ||
2738 | 13 | if (er) throw er | ||
2739 | 14 | fs.close(fd, function (er) { | ||
2740 | 15 | if (er) throw er | ||
2741 | 16 | t.pass('works') | ||
2742 | 17 | t.end() | ||
2743 | 18 | }) | ||
2744 | 19 | }) | ||
2745 | 20 | }) | ||
2746 | 21 | |||
2747 | 22 | test('open a non-existing file throws', function (t) { | ||
2748 | 23 | var er | ||
2749 | 24 | try { | ||
2750 | 25 | var fd = fs.openSync('this file does not exist', 'r') | ||
2751 | 26 | } catch (x) { | ||
2752 | 27 | er = x | ||
2753 | 28 | } | ||
2754 | 29 | t.ok(er, 'should throw') | ||
2755 | 30 | t.notOk(fd, 'should not get an fd') | ||
2756 | 31 | t.equal(er.code, 'ENOENT') | ||
2757 | 32 | |||
2758 | 33 | fs.open('neither does this file', 'r', function (er, fd) { | ||
2759 | 34 | t.ok(er, 'should throw') | ||
2760 | 35 | t.notOk(fd, 'should not get an fd') | ||
2761 | 36 | t.equal(er.code, 'ENOENT') | ||
2762 | 37 | t.end() | ||
2763 | 38 | }) | ||
2764 | 39 | }) | ||
2765 | 40 | 0 | ||
2766 | === added directory 'node_modules/cordova/_vendor/graceful-fs/2.0.2' | |||
2767 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/.npmignore' | |||
2768 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/.npmignore 1970-01-01 00:00:00 +0000 | |||
2769 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/.npmignore 2014-02-21 20:33:03 +0000 | |||
2770 | @@ -0,0 +1,1 @@ | |||
2771 | 1 | node_modules/ | ||
2772 | 0 | 2 | ||
2773 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/LICENSE' | |||
2774 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/LICENSE 1970-01-01 00:00:00 +0000 | |||
2775 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/LICENSE 2014-02-21 20:33:03 +0000 | |||
2776 | @@ -0,0 +1,27 @@ | |||
2777 | 1 | Copyright (c) Isaac Z. Schlueter ("Author") | ||
2778 | 2 | All rights reserved. | ||
2779 | 3 | |||
2780 | 4 | The BSD License | ||
2781 | 5 | |||
2782 | 6 | Redistribution and use in source and binary forms, with or without | ||
2783 | 7 | modification, are permitted provided that the following conditions | ||
2784 | 8 | are met: | ||
2785 | 9 | |||
2786 | 10 | 1. Redistributions of source code must retain the above copyright | ||
2787 | 11 | notice, this list of conditions and the following disclaimer. | ||
2788 | 12 | |||
2789 | 13 | 2. Redistributions in binary form must reproduce the above copyright | ||
2790 | 14 | notice, this list of conditions and the following disclaimer in the | ||
2791 | 15 | documentation and/or other materials provided with the distribution. | ||
2792 | 16 | |||
2793 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
2794 | 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
2795 | 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
2796 | 20 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | ||
2797 | 21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
2798 | 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
2799 | 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
2800 | 24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
2801 | 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
2802 | 26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
2803 | 27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
2804 | 0 | 28 | ||
2805 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/README.md' | |||
2806 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/README.md 1970-01-01 00:00:00 +0000 | |||
2807 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/README.md 2014-02-21 20:33:03 +0000 | |||
2808 | @@ -0,0 +1,26 @@ | |||
2809 | 1 | # graceful-fs | ||
2810 | 2 | |||
2811 | 3 | graceful-fs functions as a drop-in replacement for the fs module, | ||
2812 | 4 | making various improvements. | ||
2813 | 5 | |||
2814 | 6 | The improvements are meant to normalize behavior across different | ||
2815 | 7 | platforms and environments, and to make filesystem access more | ||
2816 | 8 | resilient to errors. | ||
2817 | 9 | |||
2818 | 10 | ## Improvements over fs module | ||
2819 | 11 | |||
2820 | 12 | graceful-fs: | ||
2821 | 13 | |||
2822 | 14 | * Queues up `open` and `readdir` calls, and retries them once | ||
2823 | 15 | something closes if there is an EMFILE error from too many file | ||
2824 | 16 | descriptors. | ||
2825 | 17 | * fixes `lchmod` for Node versions prior to 0.6.2. | ||
2826 | 18 | * implements `fs.lutimes` if possible. Otherwise it becomes a noop. | ||
2827 | 19 | * ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or | ||
2828 | 20 | `lchown` if the user isn't root. | ||
2829 | 21 | * makes `lchmod` and `lchown` become noops, if not available. | ||
2830 | 22 | * retries reading a file if `read` results in EAGAIN error. | ||
2831 | 23 | |||
2832 | 24 | On Windows, it retries renaming a file for up to one second if `EACCESS` | ||
2833 | 25 | or `EPERM` error occurs, likely because antivirus software has locked | ||
2834 | 26 | the directory. | ||
2835 | 0 | 27 | ||
2836 | === added symlink 'node_modules/cordova/_vendor/graceful-fs/2.0.2/_vendor' | |||
2837 | === target is u'../..' | |||
2838 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/graceful-fs.js' | |||
2839 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/graceful-fs.js 1970-01-01 00:00:00 +0000 | |||
2840 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/graceful-fs.js 2014-02-21 20:33:03 +0000 | |||
2841 | @@ -0,0 +1,161 @@ | |||
2842 | 1 | // Monkey-patching the fs module. | ||
2843 | 2 | // It's ugly, but there is simply no other way to do this. | ||
2844 | 3 | var fs = module.exports = require('fs') | ||
2845 | 4 | |||
2846 | 5 | var assert = require('assert') | ||
2847 | 6 | |||
2848 | 7 | // fix up some busted stuff, mostly on windows and old nodes | ||
2849 | 8 | require('./polyfills.js') | ||
2850 | 9 | |||
2851 | 10 | // The EMFILE enqueuing stuff | ||
2852 | 11 | |||
2853 | 12 | var util = require('util') | ||
2854 | 13 | |||
2855 | 14 | function noop () {} | ||
2856 | 15 | |||
2857 | 16 | var debug = noop | ||
2858 | 17 | var util = require('util') | ||
2859 | 18 | if (util.debuglog) | ||
2860 | 19 | debug = util.debuglog('gfs') | ||
2861 | 20 | else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) | ||
2862 | 21 | debug = function() { | ||
2863 | 22 | var m = util.format.apply(util, arguments) | ||
2864 | 23 | m = 'GFS: ' + m.split(/\n/).join('\nGFS: ') | ||
2865 | 24 | console.error(m) | ||
2866 | 25 | } | ||
2867 | 26 | |||
2868 | 27 | if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) { | ||
2869 | 28 | process.on('exit', function() { | ||
2870 | 29 | debug('fds', fds) | ||
2871 | 30 | debug(queue) | ||
2872 | 31 | assert.equal(queue.length, 0) | ||
2873 | 32 | }) | ||
2874 | 33 | } | ||
2875 | 34 | |||
2876 | 35 | |||
2877 | 36 | var originalOpen = fs.open | ||
2878 | 37 | fs.open = open | ||
2879 | 38 | |||
2880 | 39 | function open(path, flags, mode, cb) { | ||
2881 | 40 | if (typeof mode === "function") cb = mode, mode = null | ||
2882 | 41 | if (typeof cb !== "function") cb = noop | ||
2883 | 42 | new OpenReq(path, flags, mode, cb) | ||
2884 | 43 | } | ||
2885 | 44 | |||
2886 | 45 | function OpenReq(path, flags, mode, cb) { | ||
2887 | 46 | this.path = path | ||
2888 | 47 | this.flags = flags | ||
2889 | 48 | this.mode = mode | ||
2890 | 49 | this.cb = cb | ||
2891 | 50 | Req.call(this) | ||
2892 | 51 | } | ||
2893 | 52 | |||
2894 | 53 | util.inherits(OpenReq, Req) | ||
2895 | 54 | |||
2896 | 55 | OpenReq.prototype.process = function() { | ||
2897 | 56 | originalOpen.call(fs, this.path, this.flags, this.mode, this.done) | ||
2898 | 57 | } | ||
2899 | 58 | |||
2900 | 59 | var fds = {} | ||
2901 | 60 | OpenReq.prototype.done = function(er, fd) { | ||
2902 | 61 | debug('open done', er, fd) | ||
2903 | 62 | if (fd) | ||
2904 | 63 | fds['fd' + fd] = this.path | ||
2905 | 64 | Req.prototype.done.call(this, er, fd) | ||
2906 | 65 | } | ||
2907 | 66 | |||
2908 | 67 | |||
2909 | 68 | var originalReaddir = fs.readdir | ||
2910 | 69 | fs.readdir = readdir | ||
2911 | 70 | |||
2912 | 71 | function readdir(path, cb) { | ||
2913 | 72 | if (typeof cb !== "function") cb = noop | ||
2914 | 73 | new ReaddirReq(path, cb) | ||
2915 | 74 | } | ||
2916 | 75 | |||
2917 | 76 | function ReaddirReq(path, cb) { | ||
2918 | 77 | this.path = path | ||
2919 | 78 | this.cb = cb | ||
2920 | 79 | Req.call(this) | ||
2921 | 80 | } | ||
2922 | 81 | |||
2923 | 82 | util.inherits(ReaddirReq, Req) | ||
2924 | 83 | |||
2925 | 84 | ReaddirReq.prototype.process = function() { | ||
2926 | 85 | originalReaddir.call(fs, this.path, this.done) | ||
2927 | 86 | } | ||
2928 | 87 | |||
2929 | 88 | ReaddirReq.prototype.done = function(er, files) { | ||
2930 | 89 | if (files && files.sort) | ||
2931 | 90 | files = files.sort() | ||
2932 | 91 | Req.prototype.done.call(this, er, files) | ||
2933 | 92 | onclose() | ||
2934 | 93 | } | ||
2935 | 94 | |||
2936 | 95 | |||
2937 | 96 | var originalClose = fs.close | ||
2938 | 97 | fs.close = close | ||
2939 | 98 | |||
2940 | 99 | function close (fd, cb) { | ||
2941 | 100 | debug('close', fd) | ||
2942 | 101 | if (typeof cb !== "function") cb = noop | ||
2943 | 102 | delete fds['fd' + fd] | ||
2944 | 103 | originalClose.call(fs, fd, function(er) { | ||
2945 | 104 | onclose() | ||
2946 | 105 | cb(er) | ||
2947 | 106 | }) | ||
2948 | 107 | } | ||
2949 | 108 | |||
2950 | 109 | |||
2951 | 110 | var originalCloseSync = fs.closeSync | ||
2952 | 111 | fs.closeSync = closeSync | ||
2953 | 112 | |||
2954 | 113 | function closeSync (fd) { | ||
2955 | 114 | try { | ||
2956 | 115 | return originalCloseSync(fd) | ||
2957 | 116 | } finally { | ||
2958 | 117 | onclose() | ||
2959 | 118 | } | ||
2960 | 119 | } | ||
2961 | 120 | |||
2962 | 121 | |||
2963 | 122 | // Req class | ||
2964 | 123 | function Req () { | ||
2965 | 124 | // start processing | ||
2966 | 125 | this.done = this.done.bind(this) | ||
2967 | 126 | this.failures = 0 | ||
2968 | 127 | this.process() | ||
2969 | 128 | } | ||
2970 | 129 | |||
2971 | 130 | Req.prototype.done = function (er, result) { | ||
2972 | 131 | var tryAgain = false | ||
2973 | 132 | if (er) { | ||
2974 | 133 | var code = er.code | ||
2975 | 134 | var tryAgain = code === "EMFILE" | ||
2976 | 135 | if (process.platform === "win32") | ||
2977 | 136 | tryAgain = tryAgain || code === "OK" | ||
2978 | 137 | } | ||
2979 | 138 | |||
2980 | 139 | if (tryAgain) { | ||
2981 | 140 | this.failures ++ | ||
2982 | 141 | enqueue(this) | ||
2983 | 142 | } else { | ||
2984 | 143 | var cb = this.cb | ||
2985 | 144 | cb(er, result) | ||
2986 | 145 | } | ||
2987 | 146 | } | ||
2988 | 147 | |||
2989 | 148 | var queue = [] | ||
2990 | 149 | |||
2991 | 150 | function enqueue(req) { | ||
2992 | 151 | queue.push(req) | ||
2993 | 152 | debug('enqueue %d %s', queue.length, req.constructor.name, req) | ||
2994 | 153 | } | ||
2995 | 154 | |||
2996 | 155 | function onclose() { | ||
2997 | 156 | var req = queue.shift() | ||
2998 | 157 | if (req) { | ||
2999 | 158 | debug('process', req.constructor.name, req) | ||
3000 | 159 | req.process() | ||
3001 | 160 | } | ||
3002 | 161 | } | ||
3003 | 0 | 162 | ||
3004 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/package.json' | |||
3005 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/package.json 1970-01-01 00:00:00 +0000 | |||
3006 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/package.json 2014-02-21 20:33:03 +0000 | |||
3007 | @@ -0,0 +1,48 @@ | |||
3008 | 1 | { | ||
3009 | 2 | "author": { | ||
3010 | 3 | "name": "Isaac Z. Schlueter", | ||
3011 | 4 | "email": "i@izs.me", | ||
3012 | 5 | "url": "http://blog.izs.me" | ||
3013 | 6 | }, | ||
3014 | 7 | "name": "graceful-fs", | ||
3015 | 8 | "description": "A drop-in replacement for fs, making various improvements.", | ||
3016 | 9 | "version": "2.0.2", | ||
3017 | 10 | "repository": { | ||
3018 | 11 | "type": "git", | ||
3019 | 12 | "url": "git://github.com/isaacs/node-graceful-fs.git" | ||
3020 | 13 | }, | ||
3021 | 14 | "main": "graceful-fs.js", | ||
3022 | 15 | "engines": { | ||
3023 | 16 | "node": ">=0.4.0" | ||
3024 | 17 | }, | ||
3025 | 18 | "directories": { | ||
3026 | 19 | "test": "test" | ||
3027 | 20 | }, | ||
3028 | 21 | "scripts": { | ||
3029 | 22 | "test": "tap test/*.js" | ||
3030 | 23 | }, | ||
3031 | 24 | "keywords": [ | ||
3032 | 25 | "fs", | ||
3033 | 26 | "module", | ||
3034 | 27 | "reading", | ||
3035 | 28 | "retry", | ||
3036 | 29 | "retries", | ||
3037 | 30 | "queue", | ||
3038 | 31 | "error", | ||
3039 | 32 | "errors", | ||
3040 | 33 | "handling", | ||
3041 | 34 | "EMFILE", | ||
3042 | 35 | "EAGAIN", | ||
3043 | 36 | "EINVAL", | ||
3044 | 37 | "EPERM", | ||
3045 | 38 | "EACCESS" | ||
3046 | 39 | ], | ||
3047 | 40 | "license": "BSD", | ||
3048 | 41 | "readme": "# graceful-fs\n\ngraceful-fs functions as a drop-in replacement for the fs module,\nmaking various improvements.\n\nThe improvements are meant to normalize behavior across different\nplatforms and environments, and to make filesystem access more\nresilient to errors.\n\n## Improvements over fs module\n\ngraceful-fs:\n\n* Queues up `open` and `readdir` calls, and retries them once\n something closes if there is an EMFILE error from too many file\n descriptors.\n* fixes `lchmod` for Node versions prior to 0.6.2.\n* implements `fs.lutimes` if possible. Otherwise it becomes a noop.\n* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or\n `lchown` if the user isn't root.\n* makes `lchmod` and `lchown` become noops, if not available.\n* retries reading a file if `read` results in EAGAIN error.\n\nOn Windows, it retries renaming a file for up to one second if `EACCESS`\nor `EPERM` error occurs, likely because antivirus software has locked\nthe directory.\n", | ||
3049 | 42 | "readmeFilename": "README.md", | ||
3050 | 43 | "bugs": { | ||
3051 | 44 | "url": "https://github.com/isaacs/node-graceful-fs/issues" | ||
3052 | 45 | }, | ||
3053 | 46 | "_id": "graceful-fs@2.0.2", | ||
3054 | 47 | "_from": "graceful-fs@~2.0.0" | ||
3055 | 48 | } | ||
3056 | 0 | 49 | ||
3057 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/polyfills.js' | |||
3058 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/polyfills.js 1970-01-01 00:00:00 +0000 | |||
3059 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/polyfills.js 2014-02-21 20:33:03 +0000 | |||
3060 | @@ -0,0 +1,228 @@ | |||
3061 | 1 | var fs = require('fs') | ||
3062 | 2 | var constants = require('constants') | ||
3063 | 3 | |||
3064 | 4 | var origCwd = process.cwd | ||
3065 | 5 | var cwd = null | ||
3066 | 6 | process.cwd = function() { | ||
3067 | 7 | if (!cwd) | ||
3068 | 8 | cwd = origCwd.call(process) | ||
3069 | 9 | return cwd | ||
3070 | 10 | } | ||
3071 | 11 | var chdir = process.chdir | ||
3072 | 12 | process.chdir = function(d) { | ||
3073 | 13 | cwd = null | ||
3074 | 14 | chdir.call(process, d) | ||
3075 | 15 | } | ||
3076 | 16 | |||
3077 | 17 | // (re-)implement some things that are known busted or missing. | ||
3078 | 18 | |||
3079 | 19 | // lchmod, broken prior to 0.6.2 | ||
3080 | 20 | // back-port the fix here. | ||
3081 | 21 | if (constants.hasOwnProperty('O_SYMLINK') && | ||
3082 | 22 | process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { | ||
3083 | 23 | fs.lchmod = function (path, mode, callback) { | ||
3084 | 24 | callback = callback || noop | ||
3085 | 25 | fs.open( path | ||
3086 | 26 | , constants.O_WRONLY | constants.O_SYMLINK | ||
3087 | 27 | , mode | ||
3088 | 28 | , function (err, fd) { | ||
3089 | 29 | if (err) { | ||
3090 | 30 | callback(err) | ||
3091 | 31 | return | ||
3092 | 32 | } | ||
3093 | 33 | // prefer to return the chmod error, if one occurs, | ||
3094 | 34 | // but still try to close, and report closing errors if they occur. | ||
3095 | 35 | fs.fchmod(fd, mode, function (err) { | ||
3096 | 36 | fs.close(fd, function(err2) { | ||
3097 | 37 | callback(err || err2) | ||
3098 | 38 | }) | ||
3099 | 39 | }) | ||
3100 | 40 | }) | ||
3101 | 41 | } | ||
3102 | 42 | |||
3103 | 43 | fs.lchmodSync = function (path, mode) { | ||
3104 | 44 | var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) | ||
3105 | 45 | |||
3106 | 46 | // prefer to return the chmod error, if one occurs, | ||
3107 | 47 | // but still try to close, and report closing errors if they occur. | ||
3108 | 48 | var err, err2 | ||
3109 | 49 | try { | ||
3110 | 50 | var ret = fs.fchmodSync(fd, mode) | ||
3111 | 51 | } catch (er) { | ||
3112 | 52 | err = er | ||
3113 | 53 | } | ||
3114 | 54 | try { | ||
3115 | 55 | fs.closeSync(fd) | ||
3116 | 56 | } catch (er) { | ||
3117 | 57 | err2 = er | ||
3118 | 58 | } | ||
3119 | 59 | if (err || err2) throw (err || err2) | ||
3120 | 60 | return ret | ||
3121 | 61 | } | ||
3122 | 62 | } | ||
3123 | 63 | |||
3124 | 64 | |||
3125 | 65 | // lutimes implementation, or no-op | ||
3126 | 66 | if (!fs.lutimes) { | ||
3127 | 67 | if (constants.hasOwnProperty("O_SYMLINK")) { | ||
3128 | 68 | fs.lutimes = function (path, at, mt, cb) { | ||
3129 | 69 | fs.open(path, constants.O_SYMLINK, function (er, fd) { | ||
3130 | 70 | cb = cb || noop | ||
3131 | 71 | if (er) return cb(er) | ||
3132 | 72 | fs.futimes(fd, at, mt, function (er) { | ||
3133 | 73 | fs.close(fd, function (er2) { | ||
3134 | 74 | return cb(er || er2) | ||
3135 | 75 | }) | ||
3136 | 76 | }) | ||
3137 | 77 | }) | ||
3138 | 78 | } | ||
3139 | 79 | |||
3140 | 80 | fs.lutimesSync = function (path, at, mt) { | ||
3141 | 81 | var fd = fs.openSync(path, constants.O_SYMLINK) | ||
3142 | 82 | , err | ||
3143 | 83 | , err2 | ||
3144 | 84 | , ret | ||
3145 | 85 | |||
3146 | 86 | try { | ||
3147 | 87 | var ret = fs.futimesSync(fd, at, mt) | ||
3148 | 88 | } catch (er) { | ||
3149 | 89 | err = er | ||
3150 | 90 | } | ||
3151 | 91 | try { | ||
3152 | 92 | fs.closeSync(fd) | ||
3153 | 93 | } catch (er) { | ||
3154 | 94 | err2 = er | ||
3155 | 95 | } | ||
3156 | 96 | if (err || err2) throw (err || err2) | ||
3157 | 97 | return ret | ||
3158 | 98 | } | ||
3159 | 99 | |||
3160 | 100 | } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) { | ||
3161 | 101 | // maybe utimensat will be bound soonish? | ||
3162 | 102 | fs.lutimes = function (path, at, mt, cb) { | ||
3163 | 103 | fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb) | ||
3164 | 104 | } | ||
3165 | 105 | |||
3166 | 106 | fs.lutimesSync = function (path, at, mt) { | ||
3167 | 107 | return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW) | ||
3168 | 108 | } | ||
3169 | 109 | |||
3170 | 110 | } else { | ||
3171 | 111 | fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) } | ||
3172 | 112 | fs.lutimesSync = function () {} | ||
3173 | 113 | } | ||
3174 | 114 | } | ||
3175 | 115 | |||
3176 | 116 | |||
3177 | 117 | // https://github.com/isaacs/node-graceful-fs/issues/4 | ||
3178 | 118 | // Chown should not fail on einval or eperm if non-root. | ||
3179 | 119 | |||
3180 | 120 | fs.chown = chownFix(fs.chown) | ||
3181 | 121 | fs.fchown = chownFix(fs.fchown) | ||
3182 | 122 | fs.lchown = chownFix(fs.lchown) | ||
3183 | 123 | |||
3184 | 124 | fs.chownSync = chownFixSync(fs.chownSync) | ||
3185 | 125 | fs.fchownSync = chownFixSync(fs.fchownSync) | ||
3186 | 126 | fs.lchownSync = chownFixSync(fs.lchownSync) | ||
3187 | 127 | |||
3188 | 128 | function chownFix (orig) { | ||
3189 | 129 | if (!orig) return orig | ||
3190 | 130 | return function (target, uid, gid, cb) { | ||
3191 | 131 | return orig.call(fs, target, uid, gid, function (er, res) { | ||
3192 | 132 | if (chownErOk(er)) er = null | ||
3193 | 133 | cb(er, res) | ||
3194 | 134 | }) | ||
3195 | 135 | } | ||
3196 | 136 | } | ||
3197 | 137 | |||
3198 | 138 | function chownFixSync (orig) { | ||
3199 | 139 | if (!orig) return orig | ||
3200 | 140 | return function (target, uid, gid) { | ||
3201 | 141 | try { | ||
3202 | 142 | return orig.call(fs, target, uid, gid) | ||
3203 | 143 | } catch (er) { | ||
3204 | 144 | if (!chownErOk(er)) throw er | ||
3205 | 145 | } | ||
3206 | 146 | } | ||
3207 | 147 | } | ||
3208 | 148 | |||
3209 | 149 | function chownErOk (er) { | ||
3210 | 150 | // if there's no getuid, or if getuid() is something other than 0, | ||
3211 | 151 | // and the error is EINVAL or EPERM, then just ignore it. | ||
3212 | 152 | // This specific case is a silent failure in cp, install, tar, | ||
3213 | 153 | // and most other unix tools that manage permissions. | ||
3214 | 154 | // When running as root, or if other types of errors are encountered, | ||
3215 | 155 | // then it's strict. | ||
3216 | 156 | if (!er || (!process.getuid || process.getuid() !== 0) | ||
3217 | 157 | && (er.code === "EINVAL" || er.code === "EPERM")) return true | ||
3218 | 158 | } | ||
3219 | 159 | |||
3220 | 160 | |||
3221 | 161 | // if lchmod/lchown do not exist, then make them no-ops | ||
3222 | 162 | if (!fs.lchmod) { | ||
3223 | 163 | fs.lchmod = function (path, mode, cb) { | ||
3224 | 164 | process.nextTick(cb) | ||
3225 | 165 | } | ||
3226 | 166 | fs.lchmodSync = function () {} | ||
3227 | 167 | } | ||
3228 | 168 | if (!fs.lchown) { | ||
3229 | 169 | fs.lchown = function (path, uid, gid, cb) { | ||
3230 | 170 | process.nextTick(cb) | ||
3231 | 171 | } | ||
3232 | 172 | fs.lchownSync = function () {} | ||
3233 | 173 | } | ||
3234 | 174 | |||
3235 | 175 | |||
3236 | 176 | |||
3237 | 177 | // on Windows, A/V software can lock the directory, causing this | ||
3238 | 178 | // to fail with an EACCES or EPERM if the directory contains newly | ||
3239 | 179 | // created files. Try again on failure, for up to 1 second. | ||
3240 | 180 | if (process.platform === "win32") { | ||
3241 | 181 | var rename_ = fs.rename | ||
3242 | 182 | fs.rename = function rename (from, to, cb) { | ||
3243 | 183 | var start = Date.now() | ||
3244 | 184 | rename_(from, to, function CB (er) { | ||
3245 | 185 | if (er | ||
3246 | 186 | && (er.code === "EACCES" || er.code === "EPERM") | ||
3247 | 187 | && Date.now() - start < 1000) { | ||
3248 | 188 | return rename_(from, to, CB) | ||
3249 | 189 | } | ||
3250 | 190 | cb(er) | ||
3251 | 191 | }) | ||
3252 | 192 | } | ||
3253 | 193 | } | ||
3254 | 194 | |||
3255 | 195 | |||
3256 | 196 | // if read() returns EAGAIN, then just try it again. | ||
3257 | 197 | var read = fs.read | ||
3258 | 198 | fs.read = function (fd, buffer, offset, length, position, callback_) { | ||
3259 | 199 | var callback | ||
3260 | 200 | if (callback_ && typeof callback_ === 'function') { | ||
3261 | 201 | var eagCounter = 0 | ||
3262 | 202 | callback = function (er, _, __) { | ||
3263 | 203 | if (er && er.code === 'EAGAIN' && eagCounter < 10) { | ||
3264 | 204 | eagCounter ++ | ||
3265 | 205 | return read.call(fs, fd, buffer, offset, length, position, callback) | ||
3266 | 206 | } | ||
3267 | 207 | callback_.apply(this, arguments) | ||
3268 | 208 | } | ||
3269 | 209 | } | ||
3270 | 210 | return read.call(fs, fd, buffer, offset, length, position, callback) | ||
3271 | 211 | } | ||
3272 | 212 | |||
3273 | 213 | var readSync = fs.readSync | ||
3274 | 214 | fs.readSync = function (fd, buffer, offset, length, position) { | ||
3275 | 215 | var eagCounter = 0 | ||
3276 | 216 | while (true) { | ||
3277 | 217 | try { | ||
3278 | 218 | return readSync.call(fs, fd, buffer, offset, length, position) | ||
3279 | 219 | } catch (er) { | ||
3280 | 220 | if (er.code === 'EAGAIN' && eagCounter < 10) { | ||
3281 | 221 | eagCounter ++ | ||
3282 | 222 | continue | ||
3283 | 223 | } | ||
3284 | 224 | throw er | ||
3285 | 225 | } | ||
3286 | 226 | } | ||
3287 | 227 | } | ||
3288 | 228 | |||
3289 | 0 | 229 | ||
3290 | === added directory 'node_modules/cordova/_vendor/graceful-fs/2.0.2/test' | |||
3291 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/test/open.js' | |||
3292 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/test/open.js 1970-01-01 00:00:00 +0000 | |||
3293 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/test/open.js 2014-02-21 20:33:03 +0000 | |||
3294 | @@ -0,0 +1,39 @@ | |||
3295 | 1 | var test = require('tap').test | ||
3296 | 2 | var fs = require('../graceful-fs.js') | ||
3297 | 3 | |||
3298 | 4 | test('graceful fs is monkeypatched fs', function (t) { | ||
3299 | 5 | t.equal(fs, require('fs')) | ||
3300 | 6 | t.end() | ||
3301 | 7 | }) | ||
3302 | 8 | |||
3303 | 9 | test('open an existing file works', function (t) { | ||
3304 | 10 | var fd = fs.openSync(__filename, 'r') | ||
3305 | 11 | fs.closeSync(fd) | ||
3306 | 12 | fs.open(__filename, 'r', function (er, fd) { | ||
3307 | 13 | if (er) throw er | ||
3308 | 14 | fs.close(fd, function (er) { | ||
3309 | 15 | if (er) throw er | ||
3310 | 16 | t.pass('works') | ||
3311 | 17 | t.end() | ||
3312 | 18 | }) | ||
3313 | 19 | }) | ||
3314 | 20 | }) | ||
3315 | 21 | |||
3316 | 22 | test('open a non-existing file throws', function (t) { | ||
3317 | 23 | var er | ||
3318 | 24 | try { | ||
3319 | 25 | var fd = fs.openSync('this file does not exist', 'r') | ||
3320 | 26 | } catch (x) { | ||
3321 | 27 | er = x | ||
3322 | 28 | } | ||
3323 | 29 | t.ok(er, 'should throw') | ||
3324 | 30 | t.notOk(fd, 'should not get an fd') | ||
3325 | 31 | t.equal(er.code, 'ENOENT') | ||
3326 | 32 | |||
3327 | 33 | fs.open('neither does this file', 'r', function (er, fd) { | ||
3328 | 34 | t.ok(er, 'should throw') | ||
3329 | 35 | t.notOk(fd, 'should not get an fd') | ||
3330 | 36 | t.equal(er.code, 'ENOENT') | ||
3331 | 37 | t.end() | ||
3332 | 38 | }) | ||
3333 | 39 | }) | ||
3334 | 0 | 40 | ||
3335 | === added file 'node_modules/cordova/_vendor/graceful-fs/2.0.2/test/readdir-sort.js' | |||
3336 | --- node_modules/cordova/_vendor/graceful-fs/2.0.2/test/readdir-sort.js 1970-01-01 00:00:00 +0000 | |||
3337 | +++ node_modules/cordova/_vendor/graceful-fs/2.0.2/test/readdir-sort.js 2014-02-21 20:33:03 +0000 | |||
3338 | @@ -0,0 +1,21 @@ | |||
3339 | 1 | var test = require("tap").test | ||
3340 | 2 | var fs = require("fs") | ||
3341 | 3 | |||
3342 | 4 | var readdir = fs.readdir | ||
3343 | 5 | fs.readdir = function(path, cb) { | ||
3344 | 6 | process.nextTick(function() { | ||
3345 | 7 | cb(null, ["b", "z", "a"]) | ||
3346 | 8 | }) | ||
3347 | 9 | } | ||
3348 | 10 | |||
3349 | 11 | var g = require("../") | ||
3350 | 12 | |||
3351 | 13 | test("readdir reorder", function (t) { | ||
3352 | 14 | g.readdir("whatevers", function (er, files) { | ||
3353 | 15 | if (er) | ||
3354 | 16 | throw er | ||
3355 | 17 | console.error(files) | ||
3356 | 18 | t.same(files, [ "a", "b", "z" ]) | ||
3357 | 19 | t.end() | ||
3358 | 20 | }) | ||
3359 | 21 | }) | ||
3360 | 0 | 22 | ||
3361 | === added directory 'node_modules/cordova/_vendor/http-signature/0.10.0' | |||
3362 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/.dir-locals.el' | |||
3363 | --- node_modules/cordova/_vendor/http-signature/0.10.0/.dir-locals.el 1970-01-01 00:00:00 +0000 | |||
3364 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/.dir-locals.el 2014-02-21 20:33:03 +0000 | |||
3365 | @@ -0,0 +1,6 @@ | |||
3366 | 1 | ((nil . ((indent-tabs-mode . nil) | ||
3367 | 2 | (tab-width . 8) | ||
3368 | 3 | (fill-column . 80))) | ||
3369 | 4 | (js-mode . ((js-indent-level . 2) | ||
3370 | 5 | (indent-tabs-mode . nil) | ||
3371 | 6 | ))) | ||
3372 | 0 | \ No newline at end of file | 7 | \ No newline at end of file |
3373 | 1 | 8 | ||
3374 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/.npmignore' | |||
3375 | --- node_modules/cordova/_vendor/http-signature/0.10.0/.npmignore 1970-01-01 00:00:00 +0000 | |||
3376 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/.npmignore 2014-02-21 20:33:03 +0000 | |||
3377 | @@ -0,0 +1,7 @@ | |||
3378 | 1 | .gitmodules | ||
3379 | 2 | deps | ||
3380 | 3 | docs | ||
3381 | 4 | Makefile | ||
3382 | 5 | node_modules | ||
3383 | 6 | test | ||
3384 | 7 | tools | ||
3385 | 0 | \ No newline at end of file | 8 | \ No newline at end of file |
3386 | 1 | 9 | ||
3387 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/LICENSE' | |||
3388 | --- node_modules/cordova/_vendor/http-signature/0.10.0/LICENSE 1970-01-01 00:00:00 +0000 | |||
3389 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/LICENSE 2014-02-21 20:33:03 +0000 | |||
3390 | @@ -0,0 +1,18 @@ | |||
3391 | 1 | Copyright Joyent, Inc. All rights reserved. | ||
3392 | 2 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
3393 | 3 | of this software and associated documentation files (the "Software"), to | ||
3394 | 4 | deal in the Software without restriction, including without limitation the | ||
3395 | 5 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
3396 | 6 | sell copies of the Software, and to permit persons to whom the Software is | ||
3397 | 7 | furnished to do so, subject to the following conditions: | ||
3398 | 8 | |||
3399 | 9 | The above copyright notice and this permission notice shall be included in | ||
3400 | 10 | all copies or substantial portions of the Software. | ||
3401 | 11 | |||
3402 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
3403 | 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
3404 | 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
3405 | 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
3406 | 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
3407 | 17 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
3408 | 18 | IN THE SOFTWARE. | ||
3409 | 0 | 19 | ||
3410 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/README.md' | |||
3411 | --- node_modules/cordova/_vendor/http-signature/0.10.0/README.md 1970-01-01 00:00:00 +0000 | |||
3412 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/README.md 2014-02-21 20:33:03 +0000 | |||
3413 | @@ -0,0 +1,75 @@ | |||
3414 | 1 | # node-http-signature | ||
3415 | 2 | |||
3416 | 3 | node-http-signature is a node.js library that has client and server components | ||
3417 | 4 | for Joyent's [HTTP Signature Scheme](http_signing.md). | ||
3418 | 5 | |||
3419 | 6 | ## Usage | ||
3420 | 7 | |||
3421 | 8 | Note the example below signs a request with the same key/cert used to start an | ||
3422 | 9 | HTTP server. This is almost certainly not what you actaully want, but is just | ||
3423 | 10 | used to illustrate the API calls; you will need to provide your own key | ||
3424 | 11 | management in addition to this library. | ||
3425 | 12 | |||
3426 | 13 | ### Client | ||
3427 | 14 | |||
3428 | 15 | var fs = require('fs'); | ||
3429 | 16 | var https = require('https'); | ||
3430 | 17 | var httpSignature = require('http-signature'); | ||
3431 | 18 | |||
3432 | 19 | var key = fs.readFileSync('./key.pem', 'ascii'); | ||
3433 | 20 | |||
3434 | 21 | var options = { | ||
3435 | 22 | host: 'localhost', | ||
3436 | 23 | port: 8443, | ||
3437 | 24 | path: '/', | ||
3438 | 25 | method: 'GET', | ||
3439 | 26 | headers: {} | ||
3440 | 27 | }; | ||
3441 | 28 | |||
3442 | 29 | // Adds a 'Date' header in, signs it, and adds the | ||
3443 | 30 | // 'Authorization' header in. | ||
3444 | 31 | var req = https.request(options, function(res) { | ||
3445 | 32 | console.log(res.statusCode); | ||
3446 | 33 | }); | ||
3447 | 34 | |||
3448 | 35 | |||
3449 | 36 | httpSignature.sign(req, { | ||
3450 | 37 | key: key, | ||
3451 | 38 | keyId: './cert.pem' | ||
3452 | 39 | }); | ||
3453 | 40 | |||
3454 | 41 | req.end(); | ||
3455 | 42 | |||
3456 | 43 | ### Server | ||
3457 | 44 | |||
3458 | 45 | var fs = require('fs'); | ||
3459 | 46 | var https = require('https'); | ||
3460 | 47 | var httpSignature = require('http-signature'); | ||
3461 | 48 | |||
3462 | 49 | var options = { | ||
3463 | 50 | key: fs.readFileSync('./key.pem'), | ||
3464 | 51 | cert: fs.readFileSync('./cert.pem') | ||
3465 | 52 | }; | ||
3466 | 53 | |||
3467 | 54 | https.createServer(options, function (req, res) { | ||
3468 | 55 | var rc = 200; | ||
3469 | 56 | var parsed = httpSignature.parseRequest(req); | ||
3470 | 57 | var pub = fs.readFileSync(parsed.keyId, 'ascii'); | ||
3471 | 58 | if (!httpSignature.verifySignature(parsed, pub)) | ||
3472 | 59 | rc = 401; | ||
3473 | 60 | |||
3474 | 61 | res.writeHead(rc); | ||
3475 | 62 | res.end(); | ||
3476 | 63 | }).listen(8443); | ||
3477 | 64 | |||
3478 | 65 | ## Installation | ||
3479 | 66 | |||
3480 | 67 | npm install http-signature | ||
3481 | 68 | |||
3482 | 69 | ## License | ||
3483 | 70 | |||
3484 | 71 | MIT. | ||
3485 | 72 | |||
3486 | 73 | ## Bugs | ||
3487 | 74 | |||
3488 | 75 | See <https://github.com/joyent/node-http-signature/issues>. | ||
3489 | 0 | 76 | ||
3490 | === added symlink 'node_modules/cordova/_vendor/http-signature/0.10.0/_vendor' | |||
3491 | === target is u'../..' | |||
3492 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/http_signing.md' | |||
3493 | --- node_modules/cordova/_vendor/http-signature/0.10.0/http_signing.md 1970-01-01 00:00:00 +0000 | |||
3494 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/http_signing.md 2014-02-21 20:33:03 +0000 | |||
3495 | @@ -0,0 +1,296 @@ | |||
3496 | 1 | # Abstract | ||
3497 | 2 | |||
3498 | 3 | This document describes a way to add origin authentication, message integrity, | ||
3499 | 4 | and replay resistance to HTTP REST requests. It is intended to be used over | ||
3500 | 5 | the HTTPS protocol. | ||
3501 | 6 | |||
3502 | 7 | # Copyright Notice | ||
3503 | 8 | |||
3504 | 9 | Copyright (c) 2011 Joyent, Inc. and the persons identified as document authors. | ||
3505 | 10 | All rights reserved. | ||
3506 | 11 | |||
3507 | 12 | Code Components extracted from this document must include MIT License text. | ||
3508 | 13 | |||
3509 | 14 | # Introduction | ||
3510 | 15 | |||
3511 | 16 | This protocol is intended to provide a standard way for clients to sign HTTP | ||
3512 | 17 | requests. RFC2617 (HTTP Authentication) defines Basic and Digest authentication | ||
3513 | 18 | mechanisms, and RFC5246 (TLS 1.2) defines client-auth, both of which are widely | ||
3514 | 19 | employed on the Internet today. However, it is common place that the burdens of | ||
3515 | 20 | PKI prevent web service operators from deploying that methodoloy, and so many | ||
3516 | 21 | fall back to Basic authentication, which has poor security characteristics. | ||
3517 | 22 | |||
3518 | 23 | Additionally, OAuth provides a fully-specified alternative for authorization | ||
3519 | 24 | of web service requests, but is not (always) ideal for machine to machine | ||
3520 | 25 | communication, as the key acquisition steps (generally) imply a fixed | ||
3521 | 26 | infrastructure that may not make sense to a service provider (e.g., symmetric | ||
3522 | 27 | keys). | ||
3523 | 28 | |||
3524 | 29 | Several web service providers have invented their own schemes for signing | ||
3525 | 30 | HTTP requests, but to date, none have been placed in the public domain as a | ||
3526 | 31 | standard. This document serves that purpose. There are no techniques in this | ||
3527 | 32 | proposal that are novel beyond previous art, however, this aims to be a simple | ||
3528 | 33 | mechanism for signing these requests. | ||
3529 | 34 | |||
3530 | 35 | # Signature Authentication Scheme | ||
3531 | 36 | |||
3532 | 37 | The "signature" authentication scheme is based on the model that the client must | ||
3533 | 38 | authenticate itself with a digital signature produced by either a private | ||
3534 | 39 | asymmetric key (e.g., RSA) or a shared symmetric key (e.g., HMAC). The scheme | ||
3535 | 40 | is parameterized enough such that it is not bound to any particular key type or | ||
3536 | 41 | signing algorithm. However, it does explicitly assume that clients can send an | ||
3537 | 42 | HTTP `Date` header. | ||
3538 | 43 | |||
3539 | 44 | ## Authorization Header | ||
3540 | 45 | |||
3541 | 46 | The client is expected to send an Authorization header (as defined in RFC 2617) | ||
3542 | 47 | with the following parameterization: | ||
3543 | 48 | |||
3544 | 49 | credentials := "Signature" params | ||
3545 | 50 | params := 1#(keyId | algorithm | [headers] | [ext] | signature) | ||
3546 | 51 | digitalSignature := plain-string | ||
3547 | 52 | |||
3548 | 53 | keyId := "keyId" "=" <"> plain-string <"> | ||
3549 | 54 | algorithm := "algorithm" "=" <"> plain-string <"> | ||
3550 | 55 | headers := "headers" "=" <"> 1#headers-value <"> | ||
3551 | 56 | ext := "ext" "=" <"> plain-string <"> | ||
3552 | 57 | signature := "signature" "=" <"> plain-string <"> | ||
3553 | 58 | |||
3554 | 59 | headers-value := plain-string | ||
3555 | 60 | plain-string = 1*( %x20-21 / %x23-5B / %x5D-7E ) | ||
3556 | 61 | |||
3557 | 62 | ### Signature Parameters | ||
3558 | 63 | |||
3559 | 64 | #### keyId | ||
3560 | 65 | |||
3561 | 66 | REQUIRED. The `keyId` field is an opaque string that the server can use to look | ||
3562 | 67 | up the component they need to validate the signature. It could be an SSH key | ||
3563 | 68 | fingerprint, an LDAP DN, etc. Management of keys and assignment of `keyId` is | ||
3564 | 69 | out of scope for this document. | ||
3565 | 70 | |||
3566 | 71 | #### algorithm | ||
3567 | 72 | |||
3568 | 73 | REQUIRED. The `algorithm` parameter is used if the client and server agree on a | ||
3569 | 74 | non-standard digital signature algorithm. The full list of supported signature | ||
3570 | 75 | mechanisms is listed below. | ||
3571 | 76 | |||
3572 | 77 | #### headers | ||
3573 | 78 | |||
3574 | 79 | OPTIONAL. The `headers` parameter is used to specify the list of HTTP headers | ||
3575 | 80 | used to sign the request. If specified, it should be a quoted list of HTTP | ||
3576 | 81 | header names, separated by a single space character. By default, only one | ||
3577 | 82 | HTTP header is signed, which is the `Date` header. Note that the list MUST be | ||
3578 | 83 | specified in the order the values are concatenated together during signing. To | ||
3579 | 84 | include the HTTP request line in the signature calculation, use the special | ||
3580 | 85 | `request-line` value. While this is overloading the definition of `headers` in | ||
3581 | 86 | HTTP linguism, the request-line is defined in RFC 2616, and as the outlier from | ||
3582 | 87 | headers in useful signature calculation, it is deemed simpler to simply use | ||
3583 | 88 | `request-line` than to add a separate parameter for it. | ||
3584 | 89 | |||
3585 | 90 | #### extensions | ||
3586 | 91 | |||
3587 | 92 | OPTIONAL. The `extensions` parameter is used to include additional information | ||
3588 | 93 | which is covered by the request. The content and format of the string is out of | ||
3589 | 94 | scope for this document, and expected to be specified by implementors. | ||
3590 | 95 | |||
3591 | 96 | #### signature | ||
3592 | 97 | |||
3593 | 98 | REQUIRED. The `signature` parameter is a `Base64` encoded digital signature | ||
3594 | 99 | generated by the client. The client uses the `algorithm` and `headers` request | ||
3595 | 100 | parameters to form a canonicalized `signing string`. This `signing string` is | ||
3596 | 101 | then signed with the key associated with `keyId` and the algorithm | ||
3597 | 102 | corresponding to `algorithm`. The `signature` parameter is then set to the | ||
3598 | 103 | `Base64` encoding of the signature. | ||
3599 | 104 | |||
3600 | 105 | ### Signing String Composition | ||
3601 | 106 | |||
3602 | 107 | In order to generate the string that is signed with a key, the client MUST take | ||
3603 | 108 | the values of each HTTP header specified by `headers` in the order they appear. | ||
3604 | 109 | |||
3605 | 110 | 1. If the header name is not `request-line` then append the lowercased header | ||
3606 | 111 | name followed with an ASCII colon `:` and an ASCII space ` `. | ||
3607 | 112 | 2. If the header name is `request-line` then appened the HTTP request line, | ||
3608 | 113 | otherwise append the header value. | ||
3609 | 114 | 3. If value is not the last value then append an ASCII newline `\n`. The string | ||
3610 | 115 | MUST NOT include a trailing ASCII newline. | ||
3611 | 116 | |||
3612 | 117 | # Example Requests | ||
3613 | 118 | |||
3614 | 119 | All requests refer to the following request (body ommitted): | ||
3615 | 120 | |||
3616 | 121 | POST /foo HTTP/1.1 | ||
3617 | 122 | Host: example.org | ||
3618 | 123 | Date: Tue, 07 Jun 2011 20:51:35 GMT | ||
3619 | 124 | Content-Type: application/json | ||
3620 | 125 | Content-MD5: h0auK8hnYJKmHTLhKtMTkQ== | ||
3621 | 126 | Content-Length: 123 | ||
3622 | 127 | |||
3623 | 128 | The "rsa-key-1" keyId refers to a private key known to the client and a public | ||
3624 | 129 | key known to the server. The "hmac-key-1" keyId refers to key known to the | ||
3625 | 130 | client and server. | ||
3626 | 131 | |||
3627 | 132 | ## Default parameterization | ||
3628 | 133 | |||
3629 | 134 | The authorization header and signature would be generated as: | ||
3630 | 135 | |||
3631 | 136 | Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",signature="Base64(RSA-SHA256(signing string))" | ||
3632 | 137 | |||
3633 | 138 | The client would compose the signing string as: | ||
3634 | 139 | |||
3635 | 140 | date: Tue, 07 Jun 2011 20:51:35 GMT | ||
3636 | 141 | |||
3637 | 142 | ## Header List | ||
3638 | 143 | |||
3639 | 144 | The authorization header and signature would be generated as: | ||
3640 | 145 | |||
3641 | 146 | Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="request-line date content-type content-md5",signature="Base64(RSA-SHA256(signing string))" | ||
3642 | 147 | |||
3643 | 148 | The client would compose the signing string as (`+ "\n"` inserted for | ||
3644 | 149 | readability): | ||
3645 | 150 | |||
3646 | 151 | POST /foo HTTP/1.1 + "\n" | ||
3647 | 152 | date: Tue, 07 Jun 2011 20:51:35 GMT + "\n" | ||
3648 | 153 | content-type: application/json + "\n" | ||
3649 | 154 | content-md5: h0auK8hnYJKmHTLhKtMTkQ== | ||
3650 | 155 | |||
3651 | 156 | ## Algorithm | ||
3652 | 157 | |||
3653 | 158 | The authorization header and signature would be generated as: | ||
3654 | 159 | |||
3655 | 160 | Authorization: Signature keyId="hmac-key-1",algorithm="hmac-sha1",signature="Base64(HMAC-SHA1(signing string))" | ||
3656 | 161 | |||
3657 | 162 | The client would compose the signing string as: | ||
3658 | 163 | |||
3659 | 164 | date: Tue, 07 Jun 2011 20:51:35 GMT | ||
3660 | 165 | |||
3661 | 166 | # Signing Algorithms | ||
3662 | 167 | |||
3663 | 168 | Currently supported algorithm names are: | ||
3664 | 169 | |||
3665 | 170 | * rsa-sha1 | ||
3666 | 171 | * rsa-sha256 | ||
3667 | 172 | * rsa-sha512 | ||
3668 | 173 | * dsa-sha1 | ||
3669 | 174 | * hmac-sha1 | ||
3670 | 175 | * hmac-sha256 | ||
3671 | 176 | * hmac-sha512 | ||
3672 | 177 | |||
3673 | 178 | # Security Considerations | ||
3674 | 179 | |||
3675 | 180 | ## Default Parameters | ||
3676 | 181 | |||
3677 | 182 | Note the default parameterization of the `Signature` scheme is only safe if all | ||
3678 | 183 | requests are carried over a secure transport (i.e., TLS). Sending the default | ||
3679 | 184 | scheme over a non-secure transport will leave the request vulnerable to | ||
3680 | 185 | spoofing, tampering, replay/repudiaton, and integrity violations (if using the | ||
3681 | 186 | STRIDE threat-modeling methodology). | ||
3682 | 187 | |||
3683 | 188 | ## Insecure Transports | ||
3684 | 189 | |||
3685 | 190 | If sending the request over plain HTTP, service providers SHOULD require clients | ||
3686 | 191 | to sign ALL HTTP headers, and the `request-line`. Additionally, service | ||
3687 | 192 | providers SHOULD require `Content-MD5` calculations to be performed to ensure | ||
3688 | 193 | against any tampering from clients. | ||
3689 | 194 | |||
3690 | 195 | ## Nonces | ||
3691 | 196 | |||
3692 | 197 | Nonces are out of scope for this document simply because many service providers | ||
3693 | 198 | fail to implement them correctly, or do not adopt security specfiications | ||
3694 | 199 | because of the infrastructure complexity. Given the `header` parameterization, | ||
3695 | 200 | a service provider is fully enabled to add nonce semantics into this scheme by | ||
3696 | 201 | using something like an `x-request-nonce` header, and ensuring it is signed | ||
3697 | 202 | with the `Date` header. | ||
3698 | 203 | |||
3699 | 204 | ## Clock Skew | ||
3700 | 205 | |||
3701 | 206 | As the default scheme is to sign the `Date` header, service providers SHOULD | ||
3702 | 207 | protect against logged replay attacks by enforcing a clock skew. The server | ||
3703 | 208 | SHOULD be synchronized with NTP, and the recommendation in this specification | ||
3704 | 209 | is to allow 300s of clock skew (in either direction). | ||
3705 | 210 | |||
3706 | 211 | ## Required Headers to Sign | ||
3707 | 212 | |||
3708 | 213 | It is out of scope for this document to dictate what headers a service provider | ||
3709 | 214 | will want to enforce, but service providers SHOULD at minimum include the | ||
3710 | 215 | `Date` header. | ||
3711 | 216 | |||
3712 | 217 | # References | ||
3713 | 218 | |||
3714 | 219 | ## Normative References | ||
3715 | 220 | |||
3716 | 221 | * [RFC2616] Hypertext Transfer Protocol -- HTTP/1.1 | ||
3717 | 222 | * [RFC2617] HTTP Authentication: Basic and Digest Access Authentication | ||
3718 | 223 | * [RFC5246] The Transport Layer Security (TLS) Protocol Version 1.2 | ||
3719 | 224 | |||
3720 | 225 | ## Informative References | ||
3721 | 226 | |||
3722 | 227 | Name: Mark Cavage (editor) | ||
3723 | 228 | Company: Joyent, Inc. | ||
3724 | 229 | Email: mark.cavage@joyent.com | ||
3725 | 230 | URI: http://www.joyent.com | ||
3726 | 231 | |||
3727 | 232 | # Appendix A - Test Values | ||
3728 | 233 | |||
3729 | 234 | The following test data uses the RSA (2048b) keys, which we will refer | ||
3730 | 235 | to as `keyId=Test` in the following samples: | ||
3731 | 236 | |||
3732 | 237 | -----BEGIN PUBLIC KEY----- | ||
3733 | 238 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3 | ||
3734 | 239 | 6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6 | ||
3735 | 240 | Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw | ||
3736 | 241 | oYi+1hqp1fIekaxsyQIDAQAB | ||
3737 | 242 | -----END PUBLIC KEY----- | ||
3738 | 243 | |||
3739 | 244 | -----BEGIN RSA PRIVATE KEY----- | ||
3740 | 245 | MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF | ||
3741 | 246 | NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F | ||
3742 | 247 | UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB | ||
3743 | 248 | AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA | ||
3744 | 249 | QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK | ||
3745 | 250 | kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg | ||
3746 | 251 | f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u | ||
3747 | 252 | 412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc | ||
3748 | 253 | mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 | ||
3749 | 254 | kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA | ||
3750 | 255 | gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW | ||
3751 | 256 | G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI | ||
3752 | 257 | 7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== | ||
3753 | 258 | -----END RSA PRIVATE KEY----- | ||
3754 | 259 | |||
3755 | 260 | And all examples use this request: | ||
3756 | 261 | |||
3757 | 262 | POST /foo?param=value&pet=dog HTTP/1.1 | ||
3758 | 263 | Host: example.com | ||
3759 | 264 | Date: Thu, 05 Jan 2012 21:31:40 GMT | ||
3760 | 265 | Content-Type: application/json | ||
3761 | 266 | Content-MD5: Sd/dVLAcvNLSq16eXua5uQ== | ||
3762 | 267 | Content-Length: 18 | ||
3763 | 268 | |||
3764 | 269 | {"hello": "world"} | ||
3765 | 270 | |||
3766 | 271 | ### Default | ||
3767 | 272 | |||
3768 | 273 | The string to sign would be: | ||
3769 | 274 | |||
3770 | 275 | date: Thu, 05 Jan 2012 21:31:40 GMT | ||
3771 | 276 | |||
3772 | 277 | The Authorization header would be: | ||
3773 | 278 | |||
3774 | 279 | Authorization: Signature keyId="Test",algorithm="rsa-sha256",signature="JldXnt8W9t643M2Sce10gqCh/+E7QIYLiI+bSjnFBGCti7s+mPPvOjVb72sbd1FjeOUwPTDpKbrQQORrm+xBYfAwCxF3LBSSzORvyJ5nRFCFxfJ3nlQD6Kdxhw8wrVZX5nSem4A/W3C8qH5uhFTRwF4ruRjh+ENHWuovPgO/HGQ=" | ||
3775 | 280 | |||
3776 | 281 | ### All Headers | ||
3777 | 282 | |||
3778 | 283 | Parameterized to include all headers, the string to sign would be (`+ "\n"` | ||
3779 | 284 | inserted for readability): | ||
3780 | 285 | |||
3781 | 286 | POST /foo?param=value&pet=dog HTTP/1.1 + "\n" | ||
3782 | 287 | host: example.com + "\n" | ||
3783 | 288 | date: Thu, 05 Jan 2012 21:31:40 GMT + "\n" | ||
3784 | 289 | content-type: application/json + "\n" | ||
3785 | 290 | content-md5: Sd/dVLAcvNLSq16eXua5uQ== + "\n" | ||
3786 | 291 | content-length: 18 | ||
3787 | 292 | |||
3788 | 293 | The Authorization header would be: | ||
3789 | 294 | |||
3790 | 295 | Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="request-line host date content-type content-md5 content-length",signature="Gm7W/r+e90REDpWytALMrft4MqZxCmslOTOvwJX17ViEBA5E65QqvWI0vIH3l/vSsGiaMVmuUgzYsJLYMLcm5dGrv1+a+0fCoUdVKPZWHyImQEqpLkopVwqEH67LVECFBqFTAKlQgBn676zrfXQbb+b/VebAsNUtvQMe6cTjnDY=" | ||
3791 | 296 | |||
3792 | 0 | 297 | ||
3793 | === added directory 'node_modules/cordova/_vendor/http-signature/0.10.0/lib' | |||
3794 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/lib/index.js' | |||
3795 | --- node_modules/cordova/_vendor/http-signature/0.10.0/lib/index.js 1970-01-01 00:00:00 +0000 | |||
3796 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/lib/index.js 2014-02-21 20:33:03 +0000 | |||
3797 | @@ -0,0 +1,25 @@ | |||
3798 | 1 | // Copyright 2011 Joyent, Inc. All rights reserved. | ||
3799 | 2 | |||
3800 | 3 | var parser = require('./parser'); | ||
3801 | 4 | var signer = require('./signer'); | ||
3802 | 5 | var verify = require('./verify'); | ||
3803 | 6 | var util = require('./util'); | ||
3804 | 7 | |||
3805 | 8 | |||
3806 | 9 | |||
3807 | 10 | ///--- API | ||
3808 | 11 | |||
3809 | 12 | module.exports = { | ||
3810 | 13 | |||
3811 | 14 | parse: parser.parseRequest, | ||
3812 | 15 | parseRequest: parser.parseRequest, | ||
3813 | 16 | |||
3814 | 17 | sign: signer.signRequest, | ||
3815 | 18 | signRequest: signer.signRequest, | ||
3816 | 19 | |||
3817 | 20 | sshKeyToPEM: util.sshKeyToPEM, | ||
3818 | 21 | sshKeyFingerprint: util.fingerprint, | ||
3819 | 22 | |||
3820 | 23 | verify: verify.verifySignature, | ||
3821 | 24 | verifySignature: verify.verifySignature | ||
3822 | 25 | }; | ||
3823 | 0 | 26 | ||
3824 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/lib/parser.js' | |||
3825 | --- node_modules/cordova/_vendor/http-signature/0.10.0/lib/parser.js 1970-01-01 00:00:00 +0000 | |||
3826 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/lib/parser.js 2014-02-21 20:33:03 +0000 | |||
3827 | @@ -0,0 +1,304 @@ | |||
3828 | 1 | // Copyright 2012 Joyent, Inc. All rights reserved. | ||
3829 | 2 | |||
3830 | 3 | var assert = require('assert-plus'); | ||
3831 | 4 | var util = require('util'); | ||
3832 | 5 | |||
3833 | 6 | |||
3834 | 7 | |||
3835 | 8 | ///--- Globals | ||
3836 | 9 | |||
3837 | 10 | var Algorithms = { | ||
3838 | 11 | 'rsa-sha1': true, | ||
3839 | 12 | 'rsa-sha256': true, | ||
3840 | 13 | 'rsa-sha512': true, | ||
3841 | 14 | 'dsa-sha1': true, | ||
3842 | 15 | 'hmac-sha1': true, | ||
3843 | 16 | 'hmac-sha256': true, | ||
3844 | 17 | 'hmac-sha512': true | ||
3845 | 18 | }; | ||
3846 | 19 | |||
3847 | 20 | var State = { | ||
3848 | 21 | New: 0, | ||
3849 | 22 | Params: 1 | ||
3850 | 23 | }; | ||
3851 | 24 | |||
3852 | 25 | var ParamsState = { | ||
3853 | 26 | Name: 0, | ||
3854 | 27 | Quote: 1, | ||
3855 | 28 | Value: 2, | ||
3856 | 29 | Comma: 3 | ||
3857 | 30 | }; | ||
3858 | 31 | |||
3859 | 32 | |||
3860 | 33 | |||
3861 | 34 | ///--- Specific Errors | ||
3862 | 35 | |||
3863 | 36 | function HttpSignatureError(message, caller) { | ||
3864 | 37 | if (Error.captureStackTrace) | ||
3865 | 38 | Error.captureStackTrace(this, caller || HttpSignatureError); | ||
3866 | 39 | |||
3867 | 40 | this.message = message; | ||
3868 | 41 | this.name = caller.name; | ||
3869 | 42 | } | ||
3870 | 43 | util.inherits(HttpSignatureError, Error); | ||
3871 | 44 | |||
3872 | 45 | function ExpiredRequestError(message) { | ||
3873 | 46 | HttpSignatureError.call(this, message, ExpiredRequestError); | ||
3874 | 47 | } | ||
3875 | 48 | util.inherits(ExpiredRequestError, HttpSignatureError); | ||
3876 | 49 | |||
3877 | 50 | |||
3878 | 51 | function InvalidHeaderError(message) { | ||
3879 | 52 | HttpSignatureError.call(this, message, InvalidHeaderError); | ||
3880 | 53 | } | ||
3881 | 54 | util.inherits(InvalidHeaderError, HttpSignatureError); | ||
3882 | 55 | |||
3883 | 56 | |||
3884 | 57 | function InvalidParamsError(message) { | ||
3885 | 58 | HttpSignatureError.call(this, message, InvalidParamsError); | ||
3886 | 59 | } | ||
3887 | 60 | util.inherits(InvalidParamsError, HttpSignatureError); | ||
3888 | 61 | |||
3889 | 62 | |||
3890 | 63 | function MissingHeaderError(message) { | ||
3891 | 64 | HttpSignatureError.call(this, message, MissingHeaderError); | ||
3892 | 65 | } | ||
3893 | 66 | util.inherits(MissingHeaderError, HttpSignatureError); | ||
3894 | 67 | |||
3895 | 68 | |||
3896 | 69 | |||
3897 | 70 | ///--- Exported API | ||
3898 | 71 | |||
3899 | 72 | module.exports = { | ||
3900 | 73 | |||
3901 | 74 | /** | ||
3902 | 75 | * Parses the 'Authorization' header out of an http.ServerRequest object. | ||
3903 | 76 | * | ||
3904 | 77 | * Note that this API will fully validate the Authorization header, and throw | ||
3905 | 78 | * on any error. It will not however check the signature, or the keyId format | ||
3906 | 79 | * as those are specific to your environment. You can use the options object | ||
3907 | 80 | * to pass in extra constraints. | ||
3908 | 81 | * | ||
3909 | 82 | * As a response object you can expect this: | ||
3910 | 83 | * | ||
3911 | 84 | * { | ||
3912 | 85 | * "scheme": "Signature", | ||
3913 | 86 | * "params": { | ||
3914 | 87 | * "keyId": "foo", | ||
3915 | 88 | * "algorithm": "rsa-sha256", | ||
3916 | 89 | * "headers": [ | ||
3917 | 90 | * "date" or "x-date", | ||
3918 | 91 | * "content-md5" | ||
3919 | 92 | * ], | ||
3920 | 93 | * "signature": "base64" | ||
3921 | 94 | * }, | ||
3922 | 95 | * "signingString": "ready to be passed to crypto.verify()" | ||
3923 | 96 | * } | ||
3924 | 97 | * | ||
3925 | 98 | * @param {Object} request an http.ServerRequest. | ||
3926 | 99 | * @param {Object} options an optional options object with: | ||
3927 | 100 | * - clockSkew: allowed clock skew in seconds (default 300). | ||
3928 | 101 | * - headers: required header names (def: date or x-date) | ||
3929 | 102 | * - algorithms: algorithms to support (default: all). | ||
3930 | 103 | * @return {Object} parsed out object (see above). | ||
3931 | 104 | * @throws {TypeError} on invalid input. | ||
3932 | 105 | * @throws {InvalidHeaderError} on an invalid Authorization header error. | ||
3933 | 106 | * @throws {InvalidParamsError} if the params in the scheme are invalid. | ||
3934 | 107 | * @throws {MissingHeaderError} if the params indicate a header not present, | ||
3935 | 108 | * either in the request headers from the params, | ||
3936 | 109 | * or not in the params from a required header | ||
3937 | 110 | * in options. | ||
3938 | 111 | * @throws {ExpiredRequestError} if the value of date or x-date exceeds skew. | ||
3939 | 112 | */ | ||
3940 | 113 | parseRequest: function parseRequest(request, options) { | ||
3941 | 114 | assert.object(request, 'request'); | ||
3942 | 115 | assert.object(request.headers, 'request.headers'); | ||
3943 | 116 | if (options === undefined) { | ||
3944 | 117 | options = {}; | ||
3945 | 118 | } | ||
3946 | 119 | if (options.headers === undefined) { | ||
3947 | 120 | options.headers = [request.headers['x-date'] ? 'x-date' : 'date']; | ||
3948 | 121 | } | ||
3949 | 122 | assert.object(options, 'options'); | ||
3950 | 123 | assert.arrayOfString(options.headers, 'options.headers'); | ||
3951 | 124 | assert.optionalNumber(options.clockSkew, 'options.clockSkew'); | ||
3952 | 125 | |||
3953 | 126 | if (!request.headers.authorization) | ||
3954 | 127 | throw new MissingHeaderError('no authorization header present in ' + | ||
3955 | 128 | 'the request'); | ||
3956 | 129 | |||
3957 | 130 | options.clockSkew = options.clockSkew || 300; | ||
3958 | 131 | |||
3959 | 132 | |||
3960 | 133 | var i = 0; | ||
3961 | 134 | var state = State.New; | ||
3962 | 135 | var substate = ParamsState.Name; | ||
3963 | 136 | var tmpName = ''; | ||
3964 | 137 | var tmpValue = ''; | ||
3965 | 138 | |||
3966 | 139 | var parsed = { | ||
3967 | 140 | scheme: '', | ||
3968 | 141 | params: {}, | ||
3969 | 142 | signingString: '', | ||
3970 | 143 | |||
3971 | 144 | get algorithm() { | ||
3972 | 145 | return this.params.algorithm.toUpperCase(); | ||
3973 | 146 | }, | ||
3974 | 147 | |||
3975 | 148 | get keyId() { | ||
3976 | 149 | return this.params.keyId; | ||
3977 | 150 | } | ||
3978 | 151 | |||
3979 | 152 | }; | ||
3980 | 153 | |||
3981 | 154 | var authz = request.headers.authorization; | ||
3982 | 155 | for (i = 0; i < authz.length; i++) { | ||
3983 | 156 | var c = authz.charAt(i); | ||
3984 | 157 | |||
3985 | 158 | switch (Number(state)) { | ||
3986 | 159 | |||
3987 | 160 | case State.New: | ||
3988 | 161 | if (c !== ' ') parsed.scheme += c; | ||
3989 | 162 | else state = State.Params; | ||
3990 | 163 | break; | ||
3991 | 164 | |||
3992 | 165 | case State.Params: | ||
3993 | 166 | switch (Number(substate)) { | ||
3994 | 167 | |||
3995 | 168 | case ParamsState.Name: | ||
3996 | 169 | var code = c.charCodeAt(0); | ||
3997 | 170 | // restricted name of A-Z / a-z | ||
3998 | 171 | if ((code >= 0x41 && code <= 0x5a) || // A-Z | ||
3999 | 172 | (code >= 0x61 && code <= 0x7a)) { // a-z | ||
4000 | 173 | tmpName += c; | ||
4001 | 174 | } else if (c === '=') { | ||
4002 | 175 | if (tmpName.length === 0) | ||
4003 | 176 | throw new InvalidHeaderError('bad param format'); | ||
4004 | 177 | substate = ParamsState.Quote; | ||
4005 | 178 | } else { | ||
4006 | 179 | throw new InvalidHeaderError('bad param format'); | ||
4007 | 180 | } | ||
4008 | 181 | break; | ||
4009 | 182 | |||
4010 | 183 | case ParamsState.Quote: | ||
4011 | 184 | if (c === '"') { | ||
4012 | 185 | tmpValue = ''; | ||
4013 | 186 | substate = ParamsState.Value; | ||
4014 | 187 | } else { | ||
4015 | 188 | throw new InvalidHeaderError('bad param format'); | ||
4016 | 189 | } | ||
4017 | 190 | break; | ||
4018 | 191 | |||
4019 | 192 | case ParamsState.Value: | ||
4020 | 193 | if (c === '"') { | ||
4021 | 194 | parsed.params[tmpName] = tmpValue; | ||
4022 | 195 | substate = ParamsState.Comma; | ||
4023 | 196 | } else { | ||
4024 | 197 | tmpValue += c; | ||
4025 | 198 | } | ||
4026 | 199 | break; | ||
4027 | 200 | |||
4028 | 201 | case ParamsState.Comma: | ||
4029 | 202 | if (c === ',') { | ||
4030 | 203 | tmpName = ''; | ||
4031 | 204 | substate = ParamsState.Name; | ||
4032 | 205 | } else { | ||
4033 | 206 | throw new InvalidHeaderError('bad param format'); | ||
4034 | 207 | } | ||
4035 | 208 | break; | ||
4036 | 209 | |||
4037 | 210 | default: | ||
4038 | 211 | throw new Error('Invalid substate'); | ||
4039 | 212 | } | ||
4040 | 213 | break; | ||
4041 | 214 | |||
4042 | 215 | default: | ||
4043 | 216 | throw new Error('Invalid substate'); | ||
4044 | 217 | } | ||
4045 | 218 | |||
4046 | 219 | } | ||
4047 | 220 | |||
4048 | 221 | if (!parsed.params.headers || parsed.params.headers === '') { | ||
4049 | 222 | if (request.headers['x-date']) { | ||
4050 | 223 | parsed.params.headers = ['x-date']; | ||
4051 | 224 | } else { | ||
4052 | 225 | parsed.params.headers = ['date']; | ||
4053 | 226 | } | ||
4054 | 227 | } else { | ||
4055 | 228 | parsed.params.headers = parsed.params.headers.split(' '); | ||
4056 | 229 | } | ||
4057 | 230 | |||
4058 | 231 | // Minimally validate the parsed object | ||
4059 | 232 | if (!parsed.scheme || parsed.scheme !== 'Signature') | ||
4060 | 233 | throw new InvalidHeaderError('scheme was not "Signature"'); | ||
4061 | 234 | |||
4062 | 235 | if (!parsed.params.keyId) | ||
4063 | 236 | throw new InvalidHeaderError('keyId was not specified'); | ||
4064 | 237 | |||
4065 | 238 | if (!parsed.params.algorithm) | ||
4066 | 239 | throw new InvalidHeaderError('algorithm was not specified'); | ||
4067 | 240 | |||
4068 | 241 | if (!parsed.params.signature) | ||
4069 | 242 | throw new InvalidHeaderError('signature was not specified'); | ||
4070 | 243 | |||
4071 | 244 | // Check the algorithm against the official list | ||
4072 | 245 | parsed.params.algorithm = parsed.params.algorithm.toLowerCase(); | ||
4073 | 246 | if (!Algorithms[parsed.params.algorithm]) | ||
4074 | 247 | throw new InvalidParamsError(parsed.params.algorithm + | ||
4075 | 248 | ' is not supported'); | ||
4076 | 249 | |||
4077 | 250 | // Build the signingString | ||
4078 | 251 | for (i = 0; i < parsed.params.headers.length; i++) { | ||
4079 | 252 | var h = parsed.params.headers[i].toLowerCase(); | ||
4080 | 253 | parsed.params.headers[i] = h; | ||
4081 | 254 | |||
4082 | 255 | if (h !== 'request-line') { | ||
4083 | 256 | var value = request.headers[h]; | ||
4084 | 257 | if (!value) | ||
4085 | 258 | throw new MissingHeaderError(h + ' was not in the request'); | ||
4086 | 259 | parsed.signingString += h + ': ' + value; | ||
4087 | 260 | } else { | ||
4088 | 261 | parsed.signingString += | ||
4089 | 262 | request.method + ' ' + request.url + ' HTTP/' + request.httpVersion; | ||
4090 | 263 | } | ||
4091 | 264 | |||
4092 | 265 | if ((i + 1) < parsed.params.headers.length) | ||
4093 | 266 | parsed.signingString += '\n'; | ||
4094 | 267 | } | ||
4095 | 268 | |||
4096 | 269 | // Check against the constraints | ||
4097 | 270 | var date; | ||
4098 | 271 | if (request.headers.date || request.headers['x-date']) { | ||
4099 | 272 | if (request.headers['x-date']) { | ||
4100 | 273 | date = new Date(request.headers['x-date']); | ||
4101 | 274 | } else { | ||
4102 | 275 | date = new Date(request.headers.date); | ||
4103 | 276 | } | ||
4104 | 277 | var now = new Date(); | ||
4105 | 278 | var skew = Math.abs(now.getTime() - date.getTime()); | ||
4106 | 279 | |||
4107 | 280 | if (skew > options.clockSkew * 1000) { | ||
4108 | 281 | throw new ExpiredRequestError('clock skew of ' + | ||
4109 | 282 | (skew / 1000) + | ||
4110 | 283 | 's was greater than ' + | ||
4111 | 284 | options.clockSkew + 's'); | ||
4112 | 285 | } | ||
4113 | 286 | } | ||
4114 | 287 | |||
4115 | 288 | options.headers.forEach(function (hdr) { | ||
4116 | 289 | // Remember that we already checked any headers in the params | ||
4117 | 290 | // were in the request, so if this passes we're good. | ||
4118 | 291 | if (parsed.params.headers.indexOf(hdr) < 0) | ||
4119 | 292 | throw new MissingHeaderError(hdr + ' was not a signed header'); | ||
4120 | 293 | }); | ||
4121 | 294 | |||
4122 | 295 | if (options.algorithms) { | ||
4123 | 296 | if (options.algorithms.indexOf(parsed.params.algorithm) === -1) | ||
4124 | 297 | throw new InvalidParamsError(parsed.params.algorithm + | ||
4125 | 298 | ' is not a supported algorithm'); | ||
4126 | 299 | } | ||
4127 | 300 | |||
4128 | 301 | return parsed; | ||
4129 | 302 | } | ||
4130 | 303 | |||
4131 | 304 | }; | ||
4132 | 0 | 305 | ||
4133 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/lib/signer.js' | |||
4134 | --- node_modules/cordova/_vendor/http-signature/0.10.0/lib/signer.js 1970-01-01 00:00:00 +0000 | |||
4135 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/lib/signer.js 2014-02-21 20:33:03 +0000 | |||
4136 | @@ -0,0 +1,179 @@ | |||
4137 | 1 | // Copyright 2012 Joyent, Inc. All rights reserved. | ||
4138 | 2 | |||
4139 | 3 | var assert = require('assert-plus'); | ||
4140 | 4 | var crypto = require('crypto'); | ||
4141 | 5 | var http = require('http'); | ||
4142 | 6 | |||
4143 | 7 | var sprintf = require('util').format; | ||
4144 | 8 | |||
4145 | 9 | |||
4146 | 10 | |||
4147 | 11 | ///--- Globals | ||
4148 | 12 | |||
4149 | 13 | var Algorithms = { | ||
4150 | 14 | 'rsa-sha1': true, | ||
4151 | 15 | 'rsa-sha256': true, | ||
4152 | 16 | 'rsa-sha512': true, | ||
4153 | 17 | 'dsa-sha1': true, | ||
4154 | 18 | 'hmac-sha1': true, | ||
4155 | 19 | 'hmac-sha256': true, | ||
4156 | 20 | 'hmac-sha512': true | ||
4157 | 21 | }; | ||
4158 | 22 | |||
4159 | 23 | var Authorization = | ||
4160 | 24 | 'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"'; | ||
4161 | 25 | |||
4162 | 26 | |||
4163 | 27 | |||
4164 | 28 | ///--- Specific Errors | ||
4165 | 29 | |||
4166 | 30 | function MissingHeaderError(message) { | ||
4167 | 31 | this.name = 'MissingHeaderError'; | ||
4168 | 32 | this.message = message; | ||
4169 | 33 | this.stack = (new Error()).stack; | ||
4170 | 34 | } | ||
4171 | 35 | MissingHeaderError.prototype = new Error(); | ||
4172 | 36 | |||
4173 | 37 | |||
4174 | 38 | function InvalidAlgorithmError(message) { | ||
4175 | 39 | this.name = 'InvalidAlgorithmError'; | ||
4176 | 40 | this.message = message; | ||
4177 | 41 | this.stack = (new Error()).stack; | ||
4178 | 42 | } | ||
4179 | 43 | InvalidAlgorithmError.prototype = new Error(); | ||
4180 | 44 | |||
4181 | 45 | |||
4182 | 46 | |||
4183 | 47 | ///--- Internal Functions | ||
4184 | 48 | |||
4185 | 49 | function _pad(val) { | ||
4186 | 50 | if (parseInt(val, 10) < 10) { | ||
4187 | 51 | val = '0' + val; | ||
4188 | 52 | } | ||
4189 | 53 | return val; | ||
4190 | 54 | } | ||
4191 | 55 | |||
4192 | 56 | |||
4193 | 57 | function _rfc1123() { | ||
4194 | 58 | var date = new Date(); | ||
4195 | 59 | |||
4196 | 60 | var months = ['Jan', | ||
4197 | 61 | 'Feb', | ||
4198 | 62 | 'Mar', | ||
4199 | 63 | 'Apr', | ||
4200 | 64 | 'May', | ||
4201 | 65 | 'Jun', | ||
4202 | 66 | 'Jul', | ||
4203 | 67 | 'Aug', | ||
4204 | 68 | 'Sep', | ||
4205 | 69 | 'Oct', | ||
4206 | 70 | 'Nov', | ||
4207 | 71 | 'Dec']; | ||
4208 | 72 | var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | ||
4209 | 73 | return days[date.getUTCDay()] + ', ' + | ||
4210 | 74 | _pad(date.getUTCDate()) + ' ' + | ||
4211 | 75 | months[date.getUTCMonth()] + ' ' + | ||
4212 | 76 | date.getUTCFullYear() + ' ' + | ||
4213 | 77 | _pad(date.getUTCHours()) + ':' + | ||
4214 | 78 | _pad(date.getUTCMinutes()) + ':' + | ||
4215 | 79 | _pad(date.getUTCSeconds()) + | ||
4216 | 80 | ' GMT'; | ||
4217 | 81 | } | ||
4218 | 82 | |||
4219 | 83 | |||
4220 | 84 | |||
4221 | 85 | ///--- Exported API | ||
4222 | 86 | |||
4223 | 87 | module.exports = { | ||
4224 | 88 | |||
4225 | 89 | /** | ||
4226 | 90 | * Adds an 'Authorization' header to an http.ClientRequest object. | ||
4227 | 91 | * | ||
4228 | 92 | * Note that this API will add a Date header if it's not already set. Any | ||
4229 | 93 | * other headers in the options.headers array MUST be present, or this | ||
4230 | 94 | * will throw. | ||
4231 | 95 | * | ||
4232 | 96 | * You shouldn't need to check the return type; it's just there if you want | ||
4233 | 97 | * to be pedantic. | ||
4234 | 98 | * | ||
4235 | 99 | * @param {Object} request an instance of http.ClientRequest. | ||
4236 | 100 | * @param {Object} options signing parameters object: | ||
4237 | 101 | * - {String} keyId required. | ||
4238 | 102 | * - {String} key required (either a PEM or HMAC key). | ||
4239 | 103 | * - {Array} headers optional; defaults to ['date']. | ||
4240 | 104 | * - {String} algorithm optional; defaults to 'rsa-sha256'. | ||
4241 | 105 | * - {String} httpVersion optional; defaults to '1.1'. | ||
4242 | 106 | * @return {Boolean} true if Authorization (and optionally Date) were added. | ||
4243 | 107 | * @throws {TypeError} on bad parameter types (input). | ||
4244 | 108 | * @throws {InvalidAlgorithmError} if algorithm was bad. | ||
4245 | 109 | * @throws {MissingHeaderError} if a header to be signed was specified but | ||
4246 | 110 | * was not present. | ||
4247 | 111 | */ | ||
4248 | 112 | signRequest: function signRequest(request, options) { | ||
4249 | 113 | assert.object(request, 'request'); | ||
4250 | 114 | assert.object(options, 'options'); | ||
4251 | 115 | assert.optionalString(options.algorithm, 'options.algorithm'); | ||
4252 | 116 | assert.string(options.keyId, 'options.keyId'); | ||
4253 | 117 | assert.optionalArrayOfString(options.headers, 'options.headers'); | ||
4254 | 118 | assert.optionalString(options.httpVersion, 'options.httpVersion'); | ||
4255 | 119 | |||
4256 | 120 | if (!request.getHeader('Date')) | ||
4257 | 121 | request.setHeader('Date', _rfc1123()); | ||
4258 | 122 | if (!options.headers) | ||
4259 | 123 | options.headers = ['date']; | ||
4260 | 124 | if (!options.algorithm) | ||
4261 | 125 | options.algorithm = 'rsa-sha256'; | ||
4262 | 126 | if (!options.httpVersion) | ||
4263 | 127 | options.httpVersion = '1.1'; | ||
4264 | 128 | |||
4265 | 129 | options.algorithm = options.algorithm.toLowerCase(); | ||
4266 | 130 | |||
4267 | 131 | if (!Algorithms[options.algorithm]) | ||
4268 | 132 | throw new InvalidAlgorithmError(options.algorithm + ' is not supported'); | ||
4269 | 133 | |||
4270 | 134 | var i; | ||
4271 | 135 | var stringToSign = ''; | ||
4272 | 136 | for (i = 0; i < options.headers.length; i++) { | ||
4273 | 137 | if (typeof (options.headers[i]) !== 'string') | ||
4274 | 138 | throw new TypeError('options.headers must be an array of Strings'); | ||
4275 | 139 | |||
4276 | 140 | var h = options.headers[i].toLowerCase(); | ||
4277 | 141 | |||
4278 | 142 | if (h !== 'request-line') { | ||
4279 | 143 | var value = request.getHeader(h); | ||
4280 | 144 | if (!value) { | ||
4281 | 145 | throw new MissingHeaderError(h + ' was not in the request'); | ||
4282 | 146 | } | ||
4283 | 147 | stringToSign += h + ': ' + value; | ||
4284 | 148 | } else { | ||
4285 | 149 | value = | ||
4286 | 150 | stringToSign += | ||
4287 | 151 | request.method + ' ' + request.path + ' HTTP/' + options.httpVersion; | ||
4288 | 152 | } | ||
4289 | 153 | |||
4290 | 154 | if ((i + 1) < options.headers.length) | ||
4291 | 155 | stringToSign += '\n'; | ||
4292 | 156 | } | ||
4293 | 157 | |||
4294 | 158 | var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/); | ||
4295 | 159 | var signature; | ||
4296 | 160 | if (alg[1] === 'hmac') { | ||
4297 | 161 | var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key); | ||
4298 | 162 | hmac.update(stringToSign); | ||
4299 | 163 | signature = hmac.digest('base64'); | ||
4300 | 164 | } else { | ||
4301 | 165 | var signer = crypto.createSign(options.algorithm.toUpperCase()); | ||
4302 | 166 | signer.update(stringToSign); | ||
4303 | 167 | signature = signer.sign(options.key, 'base64'); | ||
4304 | 168 | } | ||
4305 | 169 | |||
4306 | 170 | request.setHeader('Authorization', sprintf(Authorization, | ||
4307 | 171 | options.keyId, | ||
4308 | 172 | options.algorithm, | ||
4309 | 173 | options.headers.join(' '), | ||
4310 | 174 | signature)); | ||
4311 | 175 | |||
4312 | 176 | return true; | ||
4313 | 177 | } | ||
4314 | 178 | |||
4315 | 179 | }; | ||
4316 | 0 | 180 | ||
4317 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/lib/util.js' | |||
4318 | --- node_modules/cordova/_vendor/http-signature/0.10.0/lib/util.js 1970-01-01 00:00:00 +0000 | |||
4319 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/lib/util.js 2014-02-21 20:33:03 +0000 | |||
4320 | @@ -0,0 +1,249 @@ | |||
4321 | 1 | // Copyright 2012 Joyent, Inc. All rights reserved. | ||
4322 | 2 | |||
4323 | 3 | var assert = require('assert-plus'); | ||
4324 | 4 | var crypto = require('crypto'); | ||
4325 | 5 | |||
4326 | 6 | var asn1 = require('asn1'); | ||
4327 | 7 | var ctype = require('ctype'); | ||
4328 | 8 | |||
4329 | 9 | |||
4330 | 10 | |||
4331 | 11 | ///--- Helpers | ||
4332 | 12 | |||
4333 | 13 | function readNext(buffer, offset) { | ||
4334 | 14 | var len = ctype.ruint32(buffer, 'big', offset); | ||
4335 | 15 | offset += 4; | ||
4336 | 16 | |||
4337 | 17 | var newOffset = offset + len; | ||
4338 | 18 | |||
4339 | 19 | return { | ||
4340 | 20 | data: buffer.slice(offset, newOffset), | ||
4341 | 21 | offset: newOffset | ||
4342 | 22 | }; | ||
4343 | 23 | } | ||
4344 | 24 | |||
4345 | 25 | |||
4346 | 26 | function writeInt(writer, buffer) { | ||
4347 | 27 | writer.writeByte(0x02); // ASN1.Integer | ||
4348 | 28 | writer.writeLength(buffer.length); | ||
4349 | 29 | |||
4350 | 30 | for (var i = 0; i < buffer.length; i++) | ||
4351 | 31 | writer.writeByte(buffer[i]); | ||
4352 | 32 | |||
4353 | 33 | return writer; | ||
4354 | 34 | } | ||
4355 | 35 | |||
4356 | 36 | |||
4357 | 37 | function rsaToPEM(key) { | ||
4358 | 38 | var buffer; | ||
4359 | 39 | var der; | ||
4360 | 40 | var exponent; | ||
4361 | 41 | var i; | ||
4362 | 42 | var modulus; | ||
4363 | 43 | var newKey = ''; | ||
4364 | 44 | var offset = 0; | ||
4365 | 45 | var type; | ||
4366 | 46 | var tmp; | ||
4367 | 47 | |||
4368 | 48 | try { | ||
4369 | 49 | buffer = new Buffer(key.split(' ')[1], 'base64'); | ||
4370 | 50 | |||
4371 | 51 | tmp = readNext(buffer, offset); | ||
4372 | 52 | type = tmp.data.toString(); | ||
4373 | 53 | offset = tmp.offset; | ||
4374 | 54 | |||
4375 | 55 | if (type !== 'ssh-rsa') | ||
4376 | 56 | throw new Error('Invalid ssh key type: ' + type); | ||
4377 | 57 | |||
4378 | 58 | tmp = readNext(buffer, offset); | ||
4379 | 59 | exponent = tmp.data; | ||
4380 | 60 | offset = tmp.offset; | ||
4381 | 61 | |||
4382 | 62 | tmp = readNext(buffer, offset); | ||
4383 | 63 | modulus = tmp.data; | ||
4384 | 64 | } catch (e) { | ||
4385 | 65 | throw new Error('Invalid ssh key: ' + key); | ||
4386 | 66 | } | ||
4387 | 67 | |||
4388 | 68 | // DER is a subset of BER | ||
4389 | 69 | der = new asn1.BerWriter(); | ||
4390 | 70 | |||
4391 | 71 | der.startSequence(); | ||
4392 | 72 | |||
4393 | 73 | der.startSequence(); | ||
4394 | 74 | der.writeOID('1.2.840.113549.1.1.1'); | ||
4395 | 75 | der.writeNull(); | ||
4396 | 76 | der.endSequence(); | ||
4397 | 77 | |||
4398 | 78 | der.startSequence(0x03); // bit string | ||
4399 | 79 | der.writeByte(0x00); | ||
4400 | 80 | |||
4401 | 81 | // Actual key | ||
4402 | 82 | der.startSequence(); | ||
4403 | 83 | writeInt(der, modulus); | ||
4404 | 84 | writeInt(der, exponent); | ||
4405 | 85 | der.endSequence(); | ||
4406 | 86 | |||
4407 | 87 | // bit string | ||
4408 | 88 | der.endSequence(); | ||
4409 | 89 | |||
4410 | 90 | der.endSequence(); | ||
4411 | 91 | |||
4412 | 92 | tmp = der.buffer.toString('base64'); | ||
4413 | 93 | for (i = 0; i < tmp.length; i++) { | ||
4414 | 94 | if ((i % 64) === 0) | ||
4415 | 95 | newKey += '\n'; | ||
4416 | 96 | newKey += tmp.charAt(i); | ||
4417 | 97 | } | ||
4418 | 98 | |||
4419 | 99 | if (!/\\n$/.test(newKey)) | ||
4420 | 100 | newKey += '\n'; | ||
4421 | 101 | |||
4422 | 102 | return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n'; | ||
4423 | 103 | } | ||
4424 | 104 | |||
4425 | 105 | |||
4426 | 106 | function dsaToPEM(key) { | ||
4427 | 107 | var buffer; | ||
4428 | 108 | var offset = 0; | ||
4429 | 109 | var tmp; | ||
4430 | 110 | var der; | ||
4431 | 111 | var newKey = ''; | ||
4432 | 112 | |||
4433 | 113 | var type; | ||
4434 | 114 | var p; | ||
4435 | 115 | var q; | ||
4436 | 116 | var g; | ||
4437 | 117 | var y; | ||
4438 | 118 | |||
4439 | 119 | try { | ||
4440 | 120 | buffer = new Buffer(key.split(' ')[1], 'base64'); | ||
4441 | 121 | |||
4442 | 122 | tmp = readNext(buffer, offset); | ||
4443 | 123 | type = tmp.data.toString(); | ||
4444 | 124 | offset = tmp.offset; | ||
4445 | 125 | |||
4446 | 126 | /* JSSTYLED */ | ||
4447 | 127 | if (!/^ssh-ds[as].*/.test(type)) | ||
4448 | 128 | throw new Error('Invalid ssh key type: ' + type); | ||
4449 | 129 | |||
4450 | 130 | tmp = readNext(buffer, offset); | ||
4451 | 131 | p = tmp.data; | ||
4452 | 132 | offset = tmp.offset; | ||
4453 | 133 | |||
4454 | 134 | tmp = readNext(buffer, offset); | ||
4455 | 135 | q = tmp.data; | ||
4456 | 136 | offset = tmp.offset; | ||
4457 | 137 | |||
4458 | 138 | tmp = readNext(buffer, offset); | ||
4459 | 139 | g = tmp.data; | ||
4460 | 140 | offset = tmp.offset; | ||
4461 | 141 | |||
4462 | 142 | tmp = readNext(buffer, offset); | ||
4463 | 143 | y = tmp.data; | ||
4464 | 144 | } catch (e) { | ||
4465 | 145 | console.log(e.stack); | ||
4466 | 146 | throw new Error('Invalid ssh key: ' + key); | ||
4467 | 147 | } | ||
4468 | 148 | |||
4469 | 149 | // DER is a subset of BER | ||
4470 | 150 | der = new asn1.BerWriter(); | ||
4471 | 151 | |||
4472 | 152 | der.startSequence(); | ||
4473 | 153 | |||
4474 | 154 | der.startSequence(); | ||
4475 | 155 | der.writeOID('1.2.840.10040.4.1'); | ||
4476 | 156 | |||
4477 | 157 | der.startSequence(); | ||
4478 | 158 | writeInt(der, p); | ||
4479 | 159 | writeInt(der, q); | ||
4480 | 160 | writeInt(der, g); | ||
4481 | 161 | der.endSequence(); | ||
4482 | 162 | |||
4483 | 163 | der.endSequence(); | ||
4484 | 164 | |||
4485 | 165 | der.startSequence(0x03); // bit string | ||
4486 | 166 | der.writeByte(0x00); | ||
4487 | 167 | writeInt(der, y); | ||
4488 | 168 | der.endSequence(); | ||
4489 | 169 | |||
4490 | 170 | der.endSequence(); | ||
4491 | 171 | |||
4492 | 172 | tmp = der.buffer.toString('base64'); | ||
4493 | 173 | for (var i = 0; i < tmp.length; i++) { | ||
4494 | 174 | if ((i % 64) === 0) | ||
4495 | 175 | newKey += '\n'; | ||
4496 | 176 | newKey += tmp.charAt(i); | ||
4497 | 177 | } | ||
4498 | 178 | |||
4499 | 179 | if (!/\\n$/.test(newKey)) | ||
4500 | 180 | newKey += '\n'; | ||
4501 | 181 | |||
4502 | 182 | return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n'; | ||
4503 | 183 | } | ||
4504 | 184 | |||
4505 | 185 | |||
4506 | 186 | ///--- API | ||
4507 | 187 | |||
4508 | 188 | module.exports = { | ||
4509 | 189 | |||
4510 | 190 | /** | ||
4511 | 191 | * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file. | ||
4512 | 192 | * | ||
4513 | 193 | * The intent of this module is to interoperate with OpenSSL only, | ||
4514 | 194 | * specifically the node crypto module's `verify` method. | ||
4515 | 195 | * | ||
4516 | 196 | * @param {String} key an OpenSSH public key. | ||
4517 | 197 | * @return {String} PEM encoded form of the RSA public key. | ||
4518 | 198 | * @throws {TypeError} on bad input. | ||
4519 | 199 | * @throws {Error} on invalid ssh key formatted data. | ||
4520 | 200 | */ | ||
4521 | 201 | sshKeyToPEM: function sshKeyToPEM(key) { | ||
4522 | 202 | assert.string(key, 'ssh_key'); | ||
4523 | 203 | |||
4524 | 204 | /* JSSTYLED */ | ||
4525 | 205 | if (/^ssh-rsa.*/.test(key)) | ||
4526 | 206 | return rsaToPEM(key); | ||
4527 | 207 | |||
4528 | 208 | /* JSSTYLED */ | ||
4529 | 209 | if (/^ssh-ds[as].*/.test(key)) | ||
4530 | 210 | return dsaToPEM(key); | ||
4531 | 211 | |||
4532 | 212 | throw new Error('Only RSA and DSA public keys are allowed'); | ||
4533 | 213 | }, | ||
4534 | 214 | |||
4535 | 215 | |||
4536 | 216 | /** | ||
4537 | 217 | * Generates an OpenSSH fingerprint from an ssh public key. | ||
4538 | 218 | * | ||
4539 | 219 | * @param {String} key an OpenSSH public key. | ||
4540 | 220 | * @return {String} key fingerprint. | ||
4541 | 221 | * @throws {TypeError} on bad input. | ||
4542 | 222 | * @throws {Error} if what you passed doesn't look like an ssh public key. | ||
4543 | 223 | */ | ||
4544 | 224 | fingerprint: function fingerprint(key) { | ||
4545 | 225 | assert.string(key, 'ssh_key'); | ||
4546 | 226 | |||
4547 | 227 | var pieces = key.split(' '); | ||
4548 | 228 | if (!pieces || !pieces.length || pieces.length < 2) | ||
4549 | 229 | throw new Error('invalid ssh key'); | ||
4550 | 230 | |||
4551 | 231 | var data = new Buffer(pieces[1], 'base64'); | ||
4552 | 232 | |||
4553 | 233 | var hash = crypto.createHash('md5'); | ||
4554 | 234 | hash.update(data); | ||
4555 | 235 | var digest = hash.digest('hex'); | ||
4556 | 236 | |||
4557 | 237 | var fp = ''; | ||
4558 | 238 | for (var i = 0; i < digest.length; i++) { | ||
4559 | 239 | if (i && i % 2 === 0) | ||
4560 | 240 | fp += ':'; | ||
4561 | 241 | |||
4562 | 242 | fp += digest[i]; | ||
4563 | 243 | } | ||
4564 | 244 | |||
4565 | 245 | return fp; | ||
4566 | 246 | } | ||
4567 | 247 | |||
4568 | 248 | |||
4569 | 249 | }; | ||
4570 | 0 | 250 | ||
4571 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/lib/verify.js' | |||
4572 | --- node_modules/cordova/_vendor/http-signature/0.10.0/lib/verify.js 1970-01-01 00:00:00 +0000 | |||
4573 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/lib/verify.js 2014-02-21 20:33:03 +0000 | |||
4574 | @@ -0,0 +1,42 @@ | |||
4575 | 1 | // Copyright 2011 Joyent, Inc. All rights reserved. | ||
4576 | 2 | |||
4577 | 3 | var assert = require('assert-plus'); | ||
4578 | 4 | var crypto = require('crypto'); | ||
4579 | 5 | |||
4580 | 6 | |||
4581 | 7 | |||
4582 | 8 | ///--- Exported API | ||
4583 | 9 | |||
4584 | 10 | module.exports = { | ||
4585 | 11 | |||
4586 | 12 | /** | ||
4587 | 13 | * Simply wraps up the node crypto operations for you, and returns | ||
4588 | 14 | * true or false. You are expected to pass in an object that was | ||
4589 | 15 | * returned from `parse()`. | ||
4590 | 16 | * | ||
4591 | 17 | * @param {Object} parsedSignature the object you got from `parse`. | ||
4592 | 18 | * @param {String} key either an RSA private key PEM or HMAC secret. | ||
4593 | 19 | * @return {Boolean} true if valid, false otherwise. | ||
4594 | 20 | * @throws {TypeError} if you pass in bad arguments. | ||
4595 | 21 | */ | ||
4596 | 22 | verifySignature: function verifySignature(parsedSignature, key) { | ||
4597 | 23 | assert.object(parsedSignature, 'parsedSignature'); | ||
4598 | 24 | assert.string(key, 'key'); | ||
4599 | 25 | |||
4600 | 26 | var alg = parsedSignature.algorithm.match(/(HMAC|RSA|DSA)-(\w+)/); | ||
4601 | 27 | if (!alg || alg.length !== 3) | ||
4602 | 28 | throw new TypeError('parsedSignature: unsupported algorithm ' + | ||
4603 | 29 | parsedSignature.algorithm); | ||
4604 | 30 | |||
4605 | 31 | if (alg[1] === 'HMAC') { | ||
4606 | 32 | var hmac = crypto.createHmac(alg[2].toUpperCase(), key); | ||
4607 | 33 | hmac.update(parsedSignature.signingString); | ||
4608 | 34 | return (hmac.digest('base64') === parsedSignature.params.signature); | ||
4609 | 35 | } else { | ||
4610 | 36 | var verify = crypto.createVerify(alg[0]); | ||
4611 | 37 | verify.update(parsedSignature.signingString); | ||
4612 | 38 | return verify.verify(key, parsedSignature.params.signature, 'base64'); | ||
4613 | 39 | } | ||
4614 | 40 | } | ||
4615 | 41 | |||
4616 | 42 | }; | ||
4617 | 0 | 43 | ||
4618 | === added directory 'node_modules/cordova/_vendor/http-signature/0.10.0/node_modules' | |||
4619 | === added symlink 'node_modules/cordova/_vendor/http-signature/0.10.0/node_modules/asn1' | |||
4620 | === target is u'../_vendor/asn1/0.1.11' | |||
4621 | === added symlink 'node_modules/cordova/_vendor/http-signature/0.10.0/node_modules/assert-plus' | |||
4622 | === target is u'../_vendor/assert-plus/0.1.2' | |||
4623 | === added symlink 'node_modules/cordova/_vendor/http-signature/0.10.0/node_modules/ctype' | |||
4624 | === target is u'../_vendor/ctype/0.5.2' | |||
4625 | === added file 'node_modules/cordova/_vendor/http-signature/0.10.0/package.json' | |||
4626 | --- node_modules/cordova/_vendor/http-signature/0.10.0/package.json 1970-01-01 00:00:00 +0000 | |||
4627 | +++ node_modules/cordova/_vendor/http-signature/0.10.0/package.json 2014-02-21 20:33:03 +0000 | |||
4628 | @@ -0,0 +1,35 @@ | |||
4629 | 1 | { | ||
4630 | 2 | "author": { | ||
4631 | 3 | "name": "Joyent, Inc" | ||
4632 | 4 | }, | ||
4633 | 5 | "name": "http-signature", | ||
4634 | 6 | "description": "Reference implementation of Joyent's HTTP Signature Scheme", | ||
4635 | 7 | "version": "0.10.0", | ||
4636 | 8 | "repository": { | ||
4637 | 9 | "type": "git", | ||
4638 | 10 | "url": "git://github.com/joyent/node-http-signature.git" | ||
4639 | 11 | }, | ||
4640 | 12 | "engines": { | ||
4641 | 13 | "node": ">=0.8" | ||
4642 | 14 | }, | ||
4643 | 15 | "main": "lib/index.js", | ||
4644 | 16 | "scripts": { | ||
4645 | 17 | "test": "./node_modules/.bin/tap tst/*.js" | ||
4646 | 18 | }, | ||
4647 | 19 | "dependencies": { | ||
4648 | 20 | "assert-plus": "0.1.2", | ||
4649 | 21 | "asn1": "0.1.11", | ||
4650 | 22 | "ctype": "0.5.2" | ||
4651 | 23 | }, | ||
4652 | 24 | "devDependencies": { | ||
4653 | 25 | "node-uuid": "1.4.0", | ||
4654 | 26 | "tap": "0.4.2" | ||
4655 | 27 | }, | ||
4656 | 28 | "readme": "# node-http-signature\n\nnode-http-signature is a node.js library that has client and server components\nfor Joyent's [HTTP Signature Scheme](http_signing.md).\n\n## Usage\n\nNote the example below signs a request with the same key/cert used to start an\nHTTP server. This is almost certainly not what you actaully want, but is just\nused to illustrate the API calls; you will need to provide your own key\nmanagement in addition to this library.\n\n### Client\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var key = fs.readFileSync('./key.pem', 'ascii');\n\n var options = {\n host: 'localhost',\n port: 8443,\n path: '/',\n method: 'GET',\n headers: {}\n };\n\n // Adds a 'Date' header in, signs it, and adds the\n // 'Authorization' header in.\n var req = https.request(options, function(res) {\n console.log(res.statusCode);\n });\n\n\n httpSignature.sign(req, {\n key: key,\n keyId: './cert.pem'\n });\n\n req.end();\n\n### Server\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var options = {\n key: fs.readFileSync('./key.pem'),\n cert: fs.readFileSync('./cert.pem')\n };\n\n https.createServer(options, function (req, res) {\n var rc = 200;\n var parsed = httpSignature.parseRequest(req);\n var pub = fs.readFileSync(parsed.keyId, 'ascii');\n if (!httpSignature.verifySignature(parsed, pub))\n rc = 401;\n\n res.writeHead(rc);\n res.end();\n }).listen(8443);\n\n## Installation\n\n npm install http-signature\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/joyent/node-http-signature/issues>.\n", | ||
4657 | 29 | "readmeFilename": "README.md", | ||
4658 | 30 | "bugs": { | ||
4659 | 31 | "url": "https://github.com/joyent/node-http-signature/issues" | ||
4660 | 32 | }, | ||
4661 | 33 | "_id": "http-signature@0.10.0", | ||
4662 | 34 | "_from": "http-signature@~0.10.0" | ||
4663 | 35 | } | ||
4664 | 0 | 36 | ||
4665 | === removed directory 'node_modules/cordova/_vendor/keypress' | |||
4666 | === removed directory 'node_modules/cordova/_vendor/keypress/0.1.0' | |||
4667 | === removed file 'node_modules/cordova/_vendor/keypress/0.1.0/README.md' | |||
4668 | --- node_modules/cordova/_vendor/keypress/0.1.0/README.md 2013-12-12 20:49:30 +0000 | |||
4669 | +++ node_modules/cordova/_vendor/keypress/0.1.0/README.md 1970-01-01 00:00:00 +0000 | |||
4670 | @@ -1,101 +0,0 @@ | |||
4671 | 1 | keypress | ||
4672 | 2 | ======== | ||
4673 | 3 | ### Make any Node ReadableStream emit "keypress" events | ||
4674 | 4 | |||
4675 | 5 | |||
4676 | 6 | Previous to Node `v0.8.x`, there was an undocumented `"keypress"` event that | ||
4677 | 7 | `process.stdin` would emit when it was a TTY. Some people discovered this hidden | ||
4678 | 8 | gem, and started using it in their own code. | ||
4679 | 9 | |||
4680 | 10 | Now in Node `v0.8.x`, this `"keypress"` event does not get emitted by default, | ||
4681 | 11 | but rather only when it is being used in conjuction with the `readline` (or by | ||
4682 | 12 | extension, the `repl`) module. | ||
4683 | 13 | |||
4684 | 14 | This module is the exact logic from the node `v0.8.x` releases ripped out into its | ||
4685 | 15 | own module. | ||
4686 | 16 | |||
4687 | 17 | __Bonus:__ Now with mouse support! | ||
4688 | 18 | |||
4689 | 19 | Installation | ||
4690 | 20 | ------------ | ||
4691 | 21 | |||
4692 | 22 | Install with `npm`: | ||
4693 | 23 | |||
4694 | 24 | ``` bash | ||
4695 | 25 | $ npm install keypress | ||
4696 | 26 | ``` | ||
4697 | 27 | |||
4698 | 28 | Or add it to the `"dependencies"` section of your _package.json_ file. | ||
4699 | 29 | |||
4700 | 30 | |||
4701 | 31 | Example | ||
4702 | 32 | ------- | ||
4703 | 33 | |||
4704 | 34 | #### Listening for "keypress" events | ||
4705 | 35 | |||
4706 | 36 | ``` js | ||
4707 | 37 | var keypress = require('keypress'); | ||
4708 | 38 | |||
4709 | 39 | // make `process.stdin` begin emitting "keypress" events | ||
4710 | 40 | keypress(process.stdin); | ||
4711 | 41 | |||
4712 | 42 | // listen for the "keypress" event | ||
4713 | 43 | process.stdin.on('keypress', function (ch, key) { | ||
4714 | 44 | console.log('got "keypress"', key); | ||
4715 | 45 | if (key && key.ctrl && key.name == 'c') { | ||
4716 | 46 | process.stdin.pause(); | ||
4717 | 47 | } | ||
4718 | 48 | }); | ||
4719 | 49 | |||
4720 | 50 | process.stdin.setRawMode(true); | ||
4721 | 51 | process.stdin.resume(); | ||
4722 | 52 | ``` | ||
4723 | 53 | |||
4724 | 54 | #### Listening for "mousepress" events | ||
4725 | 55 | |||
4726 | 56 | ``` js | ||
4727 | 57 | var keypress = require('keypress'); | ||
4728 | 58 | |||
4729 | 59 | // make `process.stdin` begin emitting "mousepress" (and "keypress") events | ||
4730 | 60 | keypress(process.stdin); | ||
4731 | 61 | |||
4732 | 62 | // you must enable the mouse events before they will begin firing | ||
4733 | 63 | keypress.enableMouse(process.stdout); | ||
4734 | 64 | |||
4735 | 65 | process.stdin.on('mousepress', function (info) { | ||
4736 | 66 | console.log('got "mousepress" event at %d x %d', info.x, info.y); | ||
4737 | 67 | }); | ||
4738 | 68 | |||
4739 | 69 | process.on('exit', function () { | ||
4740 | 70 | // disable mouse on exit, so that the state | ||
4741 | 71 | // is back to normal for the terminal | ||
4742 | 72 | keypress.disableMouse(process.stdout); | ||
4743 | 73 | }); | ||
4744 | 74 | ``` | ||
4745 | 75 | |||
4746 | 76 | |||
4747 | 77 | License | ||
4748 | 78 | ------- | ||
4749 | 79 | |||
4750 | 80 | (The MIT License) | ||
4751 | 81 | |||
4752 | 82 | Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> | ||
4753 | 83 | |||
4754 | 84 | Permission is hereby granted, free of charge, to any person obtaining | ||
4755 | 85 | a copy of this software and associated documentation files (the | ||
4756 | 86 | 'Software'), to deal in the Software without restriction, including | ||
4757 | 87 | without limitation the rights to use, copy, modify, merge, publish, | ||
4758 | 88 | distribute, sublicense, and/or sell copies of the Software, and to | ||
4759 | 89 | permit persons to whom the Software is furnished to do so, subject to | ||
4760 | 90 | the following conditions: | ||
4761 | 91 | |||
4762 | 92 | The above copyright notice and this permission notice shall be | ||
4763 | 93 | included in all copies or substantial portions of the Software. | ||
4764 | 94 | |||
4765 | 95 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
4766 | 96 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
4767 | 97 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
4768 | 98 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
4769 | 99 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
4770 | 100 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
4771 | 101 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
4772 | 102 | 0 | ||
4773 | === removed symlink 'node_modules/cordova/_vendor/keypress/0.1.0/_vendor' | |||
4774 | === target was u'../..' | |||
4775 | === removed file 'node_modules/cordova/_vendor/keypress/0.1.0/index.js' | |||
4776 | --- node_modules/cordova/_vendor/keypress/0.1.0/index.js 2013-12-12 20:49:30 +0000 | |||
4777 | +++ node_modules/cordova/_vendor/keypress/0.1.0/index.js 1970-01-01 00:00:00 +0000 | |||
4778 | @@ -1,346 +0,0 @@ | |||
4779 | 1 | |||
4780 | 2 | /** | ||
4781 | 3 | * This module offers the internal "keypress" functionality from node-core's | ||
4782 | 4 | * `readline` module, for your own programs and modules to use. | ||
4783 | 5 | * | ||
4784 | 6 | * Usage: | ||
4785 | 7 | * | ||
4786 | 8 | * require('keypress')(process.stdin); | ||
4787 | 9 | * | ||
4788 | 10 | * process.stdin.on('keypress', function (ch, key) { | ||
4789 | 11 | * console.log(ch, key); | ||
4790 | 12 | * if (key.ctrl && key.name == 'c') { | ||
4791 | 13 | * process.stdin.pause(); | ||
4792 | 14 | * } | ||
4793 | 15 | * }); | ||
4794 | 16 | * proces.stdin.resume(); | ||
4795 | 17 | */ | ||
4796 | 18 | var exports = module.exports = keypress; | ||
4797 | 19 | |||
4798 | 20 | exports.enableMouse = function (stream) { | ||
4799 | 21 | stream.write('\x1b' +'[?1000h') | ||
4800 | 22 | } | ||
4801 | 23 | |||
4802 | 24 | exports.disableMouse = function (stream) { | ||
4803 | 25 | stream.write('\x1b' +'[?1000l') | ||
4804 | 26 | } | ||
4805 | 27 | |||
4806 | 28 | |||
4807 | 29 | /** | ||
4808 | 30 | * accepts a readable Stream instance and makes it emit "keypress" events | ||
4809 | 31 | */ | ||
4810 | 32 | |||
4811 | 33 | function keypress(stream) { | ||
4812 | 34 | if (isEmittingKeypress(stream)) return; | ||
4813 | 35 | stream._emitKeypress = true; | ||
4814 | 36 | |||
4815 | 37 | function onData(b) { | ||
4816 | 38 | if (stream.listeners('keypress').length > 0) { | ||
4817 | 39 | emitKey(stream, b); | ||
4818 | 40 | } else { | ||
4819 | 41 | // Nobody's watching anyway | ||
4820 | 42 | stream.removeListener('data', onData); | ||
4821 | 43 | stream.on('newListener', onNewListener); | ||
4822 | 44 | } | ||
4823 | 45 | } | ||
4824 | 46 | |||
4825 | 47 | function onNewListener(event) { | ||
4826 | 48 | if (event == 'keypress') { | ||
4827 | 49 | stream.on('data', onData); | ||
4828 | 50 | stream.removeListener('newListener', onNewListener); | ||
4829 | 51 | } | ||
4830 | 52 | } | ||
4831 | 53 | |||
4832 | 54 | if (stream.listeners('keypress').length > 0) { | ||
4833 | 55 | stream.on('data', onData); | ||
4834 | 56 | } else { | ||
4835 | 57 | stream.on('newListener', onNewListener); | ||
4836 | 58 | } | ||
4837 | 59 | } | ||
4838 | 60 | |||
4839 | 61 | /** | ||
4840 | 62 | * Returns `true` if the stream is already emitting "keypress" events. | ||
4841 | 63 | * `false` otherwise. | ||
4842 | 64 | */ | ||
4843 | 65 | |||
4844 | 66 | function isEmittingKeypress(stream) { | ||
4845 | 67 | var rtn = stream._emitKeypress; | ||
4846 | 68 | if (!rtn) { | ||
4847 | 69 | // hack: check for the v0.6.x "data" event | ||
4848 | 70 | stream.listeners('data').forEach(function (l) { | ||
4849 | 71 | if (l.name == 'onData' && /emitKey/.test(l.toString())) { | ||
4850 | 72 | rtn = true; | ||
4851 | 73 | stream._emitKeypress = true; | ||
4852 | 74 | } | ||
4853 | 75 | }); | ||
4854 | 76 | } | ||
4855 | 77 | if (!rtn) { | ||
4856 | 78 | // hack: check for the v0.6.x "newListener" event | ||
4857 | 79 | stream.listeners('newListener').forEach(function (l) { | ||
4858 | 80 | if (l.name == 'onNewListener' && /keypress/.test(l.toString())) { | ||
4859 | 81 | rtn = true; | ||
4860 | 82 | stream._emitKeypress = true; | ||
4861 | 83 | } | ||
4862 | 84 | }); | ||
4863 | 85 | } | ||
4864 | 86 | return rtn; | ||
4865 | 87 | } | ||
4866 | 88 | |||
4867 | 89 | |||
4868 | 90 | /* | ||
4869 | 91 | Some patterns seen in terminal key escape codes, derived from combos seen | ||
4870 | 92 | at http://www.midnight-commander.org/browser/lib/tty/key.c | ||
4871 | 93 | |||
4872 | 94 | ESC letter | ||
4873 | 95 | ESC [ letter | ||
4874 | 96 | ESC [ modifier letter | ||
4875 | 97 | ESC [ 1 ; modifier letter | ||
4876 | 98 | ESC [ num char | ||
4877 | 99 | ESC [ num ; modifier char | ||
4878 | 100 | ESC O letter | ||
4879 | 101 | ESC O modifier letter | ||
4880 | 102 | ESC O 1 ; modifier letter | ||
4881 | 103 | ESC N letter | ||
4882 | 104 | ESC [ [ num ; modifier char | ||
4883 | 105 | ESC [ [ 1 ; modifier letter | ||
4884 | 106 | ESC ESC [ num char | ||
4885 | 107 | ESC ESC O letter | ||
4886 | 108 | |||
4887 | 109 | - char is usually ~ but $ and ^ also happen with rxvt | ||
4888 | 110 | - modifier is 1 + | ||
4889 | 111 | (shift * 1) + | ||
4890 | 112 | (left_alt * 2) + | ||
4891 | 113 | (ctrl * 4) + | ||
4892 | 114 | (right_alt * 8) | ||
4893 | 115 | - two leading ESCs apparently mean the same as one leading ESC | ||
4894 | 116 | */ | ||
4895 | 117 | |||
4896 | 118 | // Regexes used for ansi escape code splitting | ||
4897 | 119 | var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/; | ||
4898 | 120 | var functionKeyCodeRe = | ||
4899 | 121 | /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/; | ||
4900 | 122 | |||
4901 | 123 | function emitKey(stream, s) { | ||
4902 | 124 | var ch, | ||
4903 | 125 | key = { | ||
4904 | 126 | name: undefined, | ||
4905 | 127 | ctrl: false, | ||
4906 | 128 | meta: false, | ||
4907 | 129 | shift: false | ||
4908 | 130 | }, | ||
4909 | 131 | parts; | ||
4910 | 132 | |||
4911 | 133 | if (Buffer.isBuffer(s)) { | ||
4912 | 134 | if (s[0] > 127 && s[1] === undefined) { | ||
4913 | 135 | s[0] -= 128; | ||
4914 | 136 | s = '\x1b' + s.toString(stream.encoding || 'utf-8'); | ||
4915 | 137 | } else { | ||
4916 | 138 | s = s.toString(stream.encoding || 'utf-8'); | ||
4917 | 139 | } | ||
4918 | 140 | } | ||
4919 | 141 | |||
4920 | 142 | key.sequence = s; | ||
4921 | 143 | |||
4922 | 144 | if (s === '\r' || s === '\n') { | ||
4923 | 145 | // enter | ||
4924 | 146 | key.name = 'enter'; | ||
4925 | 147 | |||
4926 | 148 | } else if (s === '\t') { | ||
4927 | 149 | // tab | ||
4928 | 150 | key.name = 'tab'; | ||
4929 | 151 | |||
4930 | 152 | } else if (s === '\b' || s === '\x7f' || | ||
4931 | 153 | s === '\x1b\x7f' || s === '\x1b\b') { | ||
4932 | 154 | // backspace or ctrl+h | ||
4933 | 155 | key.name = 'backspace'; | ||
4934 | 156 | key.meta = (s.charAt(0) === '\x1b'); | ||
4935 | 157 | |||
4936 | 158 | } else if (s === '\x1b' || s === '\x1b\x1b') { | ||
4937 | 159 | // escape key | ||
4938 | 160 | key.name = 'escape'; | ||
4939 | 161 | key.meta = (s.length === 2); | ||
4940 | 162 | |||
4941 | 163 | } else if (s === ' ' || s === '\x1b ') { | ||
4942 | 164 | key.name = 'space'; | ||
4943 | 165 | key.meta = (s.length === 2); | ||
4944 | 166 | |||
4945 | 167 | } else if (s <= '\x1a') { | ||
4946 | 168 | // ctrl+letter | ||
4947 | 169 | key.name = String.fromCharCode(s.charCodeAt(0) + 'a'.charCodeAt(0) - 1); | ||
4948 | 170 | key.ctrl = true; | ||
4949 | 171 | |||
4950 | 172 | } else if (s.length === 1 && s >= 'a' && s <= 'z') { | ||
4951 | 173 | // lowercase letter | ||
4952 | 174 | key.name = s; | ||
4953 | 175 | |||
4954 | 176 | } else if (s.length === 1 && s >= 'A' && s <= 'Z') { | ||
4955 | 177 | // shift+letter | ||
4956 | 178 | key.name = s.toLowerCase(); | ||
4957 | 179 | key.shift = true; | ||
4958 | 180 | |||
4959 | 181 | } else if (parts = metaKeyCodeRe.exec(s)) { | ||
4960 | 182 | // meta+character key | ||
4961 | 183 | key.name = parts[1].toLowerCase(); | ||
4962 | 184 | key.meta = true; | ||
4963 | 185 | key.shift = /^[A-Z]$/.test(parts[1]); | ||
4964 | 186 | |||
4965 | 187 | } else if (parts = functionKeyCodeRe.exec(s)) { | ||
4966 | 188 | // ansi escape sequence | ||
4967 | 189 | |||
4968 | 190 | // reassemble the key code leaving out leading \x1b's, | ||
4969 | 191 | // the modifier key bitflag and any meaningless "1;" sequence | ||
4970 | 192 | var code = (parts[1] || '') + (parts[2] || '') + | ||
4971 | 193 | (parts[4] || '') + (parts[6] || ''), | ||
4972 | 194 | modifier = (parts[3] || parts[5] || 1) - 1; | ||
4973 | 195 | |||
4974 | 196 | // Parse the key modifier | ||
4975 | 197 | key.ctrl = !!(modifier & 4); | ||
4976 | 198 | key.meta = !!(modifier & 10); | ||
4977 | 199 | key.shift = !!(modifier & 1); | ||
4978 | 200 | key.code = code; | ||
4979 | 201 | |||
4980 | 202 | // Parse the key itself | ||
4981 | 203 | switch (code) { | ||
4982 | 204 | /* xterm/gnome ESC O letter */ | ||
4983 | 205 | case 'OP': key.name = 'f1'; break; | ||
4984 | 206 | case 'OQ': key.name = 'f2'; break; | ||
4985 | 207 | case 'OR': key.name = 'f3'; break; | ||
4986 | 208 | case 'OS': key.name = 'f4'; break; | ||
4987 | 209 | |||
4988 | 210 | /* xterm/rxvt ESC [ number ~ */ | ||
4989 | 211 | case '[11~': key.name = 'f1'; break; | ||
4990 | 212 | case '[12~': key.name = 'f2'; break; | ||
4991 | 213 | case '[13~': key.name = 'f3'; break; | ||
4992 | 214 | case '[14~': key.name = 'f4'; break; | ||
4993 | 215 | |||
4994 | 216 | /* from Cygwin and used in libuv */ | ||
4995 | 217 | case '[[A': key.name = 'f1'; break; | ||
4996 | 218 | case '[[B': key.name = 'f2'; break; | ||
4997 | 219 | case '[[C': key.name = 'f3'; break; | ||
4998 | 220 | case '[[D': key.name = 'f4'; break; | ||
4999 | 221 | case '[[E': key.name = 'f5'; break; | ||
5000 | 222 |
The diff has been truncated for viewing.
PASSED: Continuous integration, rev:49 jenkins. qa.ubuntu. com/job/ cordova- cli-ci/ 4/ jenkins. qa.ubuntu. com/job/ cordova- cli-trusty- amd64-ci/ 4
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/cordova- cli-ci/ 4/rebuild
http://