Switch from NPM to Yarn for NodeJS deps

And switch docker base to mozmeao/base:python-2.7.
The official Nodejs image commands are now run in the
bedrock_build dockerfile.
This commit is contained in:
Paul McLanahan 2017-09-21 14:09:17 -04:00
Родитель bd63103757
Коммит b81e99c59c
440 изменённых файлов: 4241 добавлений и 32356 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -46,3 +46,4 @@ tests/functional/assets
Dockerfile-*
root_files/sitemap.xml
root_files/default-urls.json
node_modules

Просмотреть файл

@ -2,7 +2,7 @@ machine:
services:
- docker
node:
version: 6.1.0
version: 6.11.3
checkout:
post:
@ -16,7 +16,7 @@ dependencies:
override:
- docker/bin/build_images.sh --test
- npm install -g gulp-cli
- npm install
- yarn install --pure-lockfile
test:
pre:

Просмотреть файл

@ -1,21 +1,10 @@
FROM quay.io/mozmar/base:latest
# Set Python-related environment variables to reduce annoying-ness
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV LANG=C.UTF-8
RUN update-alternatives --install /bin/sh sh /bin/bash 10
RUN adduser --uid 1000 --disabled-password --gecos '' --no-create-home webdev
FROM mozmeao/base:python-2.7
WORKDIR /app
EXPOSE 8000
CMD ["./bin/run.sh"]
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gettext build-essential python-{dev,pip,setuptools} \
libxml2-dev libxslt1.1 libxslt1-dev git libpq-dev
RUN apt-install gettext build-essential libxml2-dev libxslt1.1 libxslt1-dev git libpq-dev
COPY ./requirements /app/requirements

Просмотреть файл

@ -1,15 +1,77 @@
FROM mozorg/bedrock_base:${GIT_COMMIT}
ENV PATH=/node_modules/.bin:$PATH
### from the official nodejs dockerfile ###
# https://github.com/nodejs/docker-node/blob/master/6.11/slim/Dockerfile
# gpg keys listed at https://github.com/nodejs/node#release-team
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
56730D5401028683275BD23C23EFEFE93C4CFFFE \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
done
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 6.11.3
RUN buildDeps='xz-utils' \
&& ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& set -x \
&& apt-get update && apt-get install -y curl $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
&& apt-get purge -y --auto-remove $buildDeps \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
ENV YARN_VERSION 0.27.5
RUN set -ex \
&& for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
done \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
### End official Node image ###
ENV PATH=/tmp/node_modules/.bin:$PATH
ENV PIPELINE_LESS_BINARY=lessc
ENV PIPELINE_SASS_BINARY=node-sass
ENV PIPELINE_UGLIFYJS_BINARY=uglifyjs
ENV PIPELINE_CLEANCSS_BINARY=cleancss
ENV NODE_ENV=production
RUN apt-get install -y --no-install-recommends nodejs-legacy npm
COPY ./node_modules /
COPY ./package.json /
COPY ./lockdown.json /
# --unsafe-perm required for lockdown to function
RUN cd / && npm install --production --unsafe-perm
COPY package.json yarn.lock /tmp/
RUN cd /tmp && yarn install --pure-lockfile && rm -rf /usr/local/share/.cache/yarn

Просмотреть файл

@ -7,10 +7,7 @@ COPY ./lib ./lib
COPY ./root_files ./root_files
COPY ./scripts ./scripts
COPY ./wsgi ./wsgi
COPY ./manage.py ./
COPY ./LICENSE ./
COPY ./newrelic.ini ./
COPY ./contribute.json ./
COPY manage.py LICENSE newrelic.ini contribute.json ./
# changes more frequently
COPY ./docker ./docker

Просмотреть файл

@ -48,18 +48,20 @@ Sync the database and all of the external data locally. This gets product-detail
$ bin/sync-all.sh
Lastly, you need to have `Node.js <https://nodejs.org/>`_ and
`NPM <https://docs.npmjs.com/getting-started/installing-node>`_ installed. The node
dependencies for running the site can be installed with ``npm``::
`Yarn <https://yarnpkg.com/>`_ installed. The node
dependencies for running the site can be installed with ``yarn``::
$ npm install
$ yarn
You may also need to install the `Gulp <http://gulpjs.com/>`_ cli globally.
You may also need to install the `Gulp <http://gulpjs.com/>`_ cli globally::
$ npm install -g gulp-cli
.. note::
Bedrock uses `npm-lockdown <https://github.com/mozilla/npm-lockdown>`_ to ensure that Node.js
packages that get installed are the exact ones we meant (similar to peep.py for python). Refer
to the `lockdown documentation <https://github.com/mozilla/npm-lockdown#adding-new-modules>`_
Bedrock uses yarn to ensure that Node.js
packages that get installed are the exact ones we meant (similar to pip hash checking mode for python). Refer
to the `yarn documentation <https://yarnpkg.com/en/docs/yarn-workflow>`_
for adding or upgrading Node.js dependencies.
.. _run-python-tests:

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1
node_modules/.bin/lockdown сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
../lockdown/lockdown.js

1
node_modules/.bin/lockdown-relock сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
../lockdown/relock.js

10
node_modules/.gitignore сгенерированный поставляемый
Просмотреть файл

@ -1,10 +0,0 @@
# Ignore everything in this directory
*
# Except these things
!.gitignore
# less for less -> css
!.bin/lockdown*
!lockdown/
!lockdown/**

2
node_modules/lockdown/.npmignore сгенерированный поставляемый
Просмотреть файл

@ -1,2 +0,0 @@
/node_modules
/example/node_modules

11
node_modules/lockdown/ChangeLog сгенерированный поставляемый
Просмотреть файл

@ -1,11 +0,0 @@
0.0.8 -
* Fixes caching issues
0.0.6 -
* 0.10.29 fix (thanks @tomgco)
* Added NPM_CONFIG_REGISTRY env var
0.0.4 -
* 0.10.x support
0.0.1 -
* First attempt

373
node_modules/lockdown/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,373 +0,0 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

124
node_modules/lockdown/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,124 +0,0 @@
# npm-lockdown
Put your dependencies on lockdown.
![lockdown](https://github.com/mozilla/npm-lockdown/raw/master/npm-lockdown.png)
## What's this?
NPM Lockdown is a tool that locks your node.js app to
specific versions of dependencies... So that you can:
1. know that the code you develop against is what you test and deploy
2. `npm install` and get the same code, every time.
3. not have to copy all of your dependencies into your project
4. not have to stand up a private npm repository to solve this problem.
## Who is this for?
Node.JS application developers, but not library authors. Stuff published
in npm as libraries probably wouldn't be interested.
## Why Care?
Even if you express verbatim versions in your package.json file, you're still
vulnerable to your code breaking at any time. This can happen if a dependency
of a project you depend on with a specific version *itself* depends on another
packages with a version range.
How can other people accidentally or intentionally break your node.js app?
Well, they might...
* ... push a new version that no longer supports your preferred version of node.js.
* ... fix a subtle bug that you actually depend on.
* ... accidentally introduce a subtle bug.
* ... be having a bad day.
And, any author at any time can overwrite the package version they have published
so one under-thought `npm publish -f` can mean a subtle bug that steals days
of your week.
## Usage!
npm install --save foo@0.8.1
./node_modules/.bin/lockdown-relock
`npm-lockdown` is easy to get started with. It generates a single file that lists
the versions and check-sums of the software you depend on, so any time something
changes out from under you, `npm install` will fail and tell you what package has
changed.
### One Time Project Setup
1. npm install the version of lockdown you want: `npm install --save lockdown`
2. add a line to your package.json file: `"scripts": { "preinstall": "lockdown" }`
3. generate a lockdown.json: `node_modules/.bin/lockdown-relock`
4. commit: `git add package.json lockdown.json && git commit -m "be safe"`
### Adding new modules
1. npm install the specific dependencies of your app `npm install --save foo@0.8.1`
4. re-generate your lockdown.json: `node_modules/.bin/lockdown-relock`
5. commit: `git add package.json lockdown.json && git commit -m "be safe"`
### Changing dependencies once locked down
You update your dependencies explicitly, relock, and commit:
npm install --save foo@1.2.3
node_modules/.bin/lockdown-relock
git add lockdown.json package.json
git commit -m "move to foo v1.2.3"
done!
### Using an npm mirror
You can fetch resources from an npm mirror by specifying the NPM_CONFIG_REGISTRY
environment variable when invoking `npm install`. If NPM_CONFIG_REGISTRY is not
specified, http://registry.npmjs.org will be used.
NPM_CONFIG_REGISTRY=http://registry.npmjs.eu/ npm install
## Notes:
* You should use the latest stable version of lockdown, find it from the [npm registry](https://npmjs.org/package/lockdown)
## Installing dependencies once locked down
npm install
## Related Tools
**[npm shrinkwrap][]** - NPM itself has a feature called "shrinkwrap" that
> locks down the versions of a package's dependencies so that you can control exactly which
> versions of each dependency will be used when your package is installed.
At present (as of npm v1.1.33), the implementation of shrinkwrap has a couple flaws
which make it unusable for certain applications:
1. No checksums! NPM shrinkwrap does not guarantee bit-wise equality of the installed
dependencies, so if an upstream server or author decides to change the contents of
version 1.2.3 of `foo`, you'll install something different than you intended without
knowing.
2. Does not play nice with `optionalDependencies` - If you "shrinkwrap" your app and you
have an installed dep that is optional, the dependency is no longer optional. This might
not be what you want.
[npm shrinkwrap]: https://npmjs.org/doc/shrinkwrap.html
*NOTE:* you can combine lockdown with shrinkwrap just fine. If all you care about is #1 above.
The path forward is to build checksums into shrinkwrap and kick lockdown to the curb, but until
then, lockdown solves some problems. (@izs is [interested in patches][]).
[interested in patches]: https://twitter.com/izs/status/234330784931143682
**[npm-seal][]** - Solves the same problem as lockdown in a very different way. Because seal
is built to be used in concert with shrinkwrap, it suffers from the `optionalDependencies` issue
described above.
[npm-seal]: https://github.com/zaach/npm-seal

59
node_modules/lockdown/example/lockdown.json сгенерированный поставляемый
Просмотреть файл

@ -1,59 +0,0 @@
{
"ansi": {
"0.1.2": "2627e29498f06e2a1c2ece9c21e28fd494430827"
},
"connect": {
"1.9.1": "199fb7c9d73b397d4d1af615914eaa19f8ec14e2"
},
"express": {
"2.5.8": "f166b55d4e8c6d2307ef88ad1768209613f7452a"
},
"formidable": {
"1.0.11": "68f63325a035e644b6f7bb3d11243b9761de1b30"
},
"glob": {
"3.1.12": "4b3fd0889a68d9805f47ef4b3c6950e88455dc29"
},
"graceful-fs": {
"1.1.10": "388a63917e823bc695afd57c76d7f3ee3db54ad3"
},
"inherits": {
"1.0.0": "38e1975285bf1f7ba9c84da102bb12771322ac48"
},
"lockdown": {
"0.0.1": "*"
},
"lru-cache": {
"1.1.1": "d6f24f75c28c9ec1239ca206952689696ec11e62"
},
"mime": {
"1.2.4": "11b5fdaf29c2509255176b80ad520294f5de92b7"
},
"minimatch": {
"0.2.5": "a85048c04cc707538cdcb6fb798c421c3cbc7026"
},
"mkdirp": {
"0.3.0": "1bbf5ab1ba827af23575143490426455f481fe1e"
},
"node-markdown": {
"0.1.1": "e365baba38d4ac56d8563dd69ca6d7215b08fb94"
},
"npmlog": {
"0.0.2": "f0cf4b2c519950c00e91ba8e2868b62bf86254f6"
},
"qs": {
"0.4.2": "3cac4c861e371a8c9c4770ac23cda8de639b8e5f"
},
"read-installed": {
"0.0.1": "2d9b9086ae33ae42793210f519701169edabd2e2"
},
"read-package-json": {
"0.1.2": "693749f4db7336829fe60dd02ecad39d32e987bb"
},
"semver": {
"1.0.14": "cac5e2d55a6fbf958cb220ae844045071c78f676"
},
"slide": {
"1.1.3": "a16975ba76b766b92f98ef337243336c1fa3238f"
}
}

13
node_modules/lockdown/example/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,13 +0,0 @@
{
"name": "example_lockdown_usage",
"version": "0.0.1",
"private": "true",
"dependencies": {
"express": "2.5.x",
"node-markdown": ">= 0.1.1",
"lockdown": "0.0.1"
},
"scripts": {
"preinstall": "../lockdown.js"
}
}

202
node_modules/lockdown/lockdown.js сгенерированный поставляемый
Просмотреть файл

@ -1,202 +0,0 @@
#!/usr/bin/env node
if (process.env['NPM_LOCKDOWN_RUNNING']) process.exit(0);
console.log("NPM Lockdown is here to check your dependencies! Never fear!");
var http = require('http'),
crypto = require('crypto'),
exec = require('child_process').exec,
fs = require('fs'),
path = require('path');
try {
var lockdownJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'lockdown.json')));
} catch(e) {
console.log("\nERROR: I cannot read lockdown.json! run node_modules/.bin/lockdown-relock to generate!\n");
process.exit(1);
}
const registry = process.env['NPM_CONFIG_REGISTRY'] || 'registry.npmjs.org';
console.log("using registry: " + registry);
var boundPort;
// during execution fatal errors will be appended to this list
var errors = [];
// during execution non-fatal warnings will be appended to this list
var warn = [];
function rewriteURL(u) {
return u.replace(registry, '127.0.0.1:' + boundPort);
}
function packageOk(name, ver, sha, required) {
if (!lockdownJson[name]) {
if (required) {
errors.push("package '" + name + "' not in lockdown.json!");
}
return false;
}
if (lockdownJson[name][ver] === undefined) {
if (required) {
errors.push("package version " + name + "@" + ver + " not in lockdown.json!");
}
return false;
}
// a '*' shasum is not checked
var wantSHA = lockdownJson[name][ver];
if (wantSHA !== '*' && wantSHA !== sha) {
if (required) {
errors.push("package " + name + "@" + ver + " has a different checksum (" +
wantSHA + " v. " + sha + ")");
}
return false;
}
if (wantSHA === '*') {
warn.push("Lockdown cannot guarantee your safety! No sha for pkg " + name + "@" + ver +
" in lockdown.json");
}
return true;
}
function rewriteVersionMD(json) {
if (typeof json === 'string') json = JSON.parse(json);
if (!json.error) {
json.dist.tarball = rewriteURL(json.dist.tarball);
// is the name/version/sha in our lockdown.json?
if (!packageOk(json.name, json.version, json.dist.shasum, true)) return null;
}
return JSON.stringify(json);
}
function rewritePackageMD(json) {
if (typeof json === 'string') json = JSON.parse(json);
if (!json.error) {
Object.keys(json.versions).forEach(function(ver) {
var data = json.versions[ver];
var name = data.name;
var sha = data.dist ? data.dist.shasum : undefined;
if (packageOk(name, ver, sha, false)) {
data.dist.tarball = rewriteURL(data.dist.tarball);
} else {
delete json.versions[ver];
}
});
}
return JSON.stringify(json);
}
function copy(from, to) {
for (var k in from) {
to[k] = from[k];
}
return to;
}
var server = http.createServer(function (req, res) {
if (req.method !== 'GET') {
return res.end('non GET requests not supported', 501);
}
// what type of request is this?
// 1. specific version json metadata (when explicit dependency is expressed)
// - for these requests we should verify the name/version/sha advertised is allowed
// 2. package version json metadata (when version range is expressed - including '*')
// XXX: for these requests we should prune all versions that are not allowed
// 3. tarball - actual bits
// XXX: for these requests we should verify the name/version/sha matches something
// allowed, otherwise block the transaction
var arr = req.url.substr(1).split('/');
var type = [ '', 'package_metadata', 'version_metadata', 'tarball' ][arr.length];
// let's extract pkg name and version sensitive to the type of request being performed.
var pkgname, pkgver;
if (type === 'tarball') {
pkgname = arr[0];
var getVer = new RegExp("^" + pkgname + "-(.*)\\.tgz$");
pkgver = getVer.exec(arr[2])[1];
} else if (type === 'version_metadata') {
pkgname = arr[0];
pkgver = arr[1];
} else if (type === 'package_metadata') {
pkgname = arr[0];
}
var hash = crypto.createHash('sha1');
var r = http.request({
host: registry,
port: 80,
method: req.method,
path: req.url,
agent: false
}, function(rres) {
res.setHeader('Content-Type', rres.headers['content-type']);
if (type === 'tarball') res.setHeader('Content-Length', rres.headers['content-length']);
var b = "";
rres.on('data', function(d) {
hash.update(d);
if (type != 'tarball') b += d;
else res.write(d);
});
rres.on('end', function() {
if (type === 'tarball') {
res.end();
} else {
if (type === 'package_metadata') {
b = rewritePackageMD(b);
} else if (type === 'version_metadata') {
b = rewriteVersionMD(b);
}
if (b === null) {
res.writeHead(404);
res.end("package installation disallowed by lockdown");
} else {
res.setHeader('Content-Length', Buffer.byteLength(b));
res.writeHead(rres.statusCode);
res.end(b);
}
}
});
});
r.end();
});
server.listen(process.env['LOCKDOWN_PORT'] || 0, '127.0.0.1', function() {
boundPort = server.address().port;
var env = copy(process.env, {
NPM_CONFIG_REGISTRY: 'http://127.0.0.1:' + boundPort,
NPM_LOCKDOWN_RUNNING: "true"
});
var child = exec('npm install', {
cwd: process.cwd(),
env: env
}, function(e) {
if (warn.length) {
console.log();
console.log("LOCKDOWN WARNINGS:");
warn.forEach(function(e) { console.log(" ", e); });
console.log();
}
if (errors.length) {
console.log();
console.log("LOCKDOWN ERRORS:");
errors.forEach(function(e) { console.log(" ", e); });
console.log();
}
process.exit(e ? 1 : 0);
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
});

1
node_modules/lockdown/node_modules/npmconf/.npmignore сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
/test/fixtures/userconfig-with-gc

15
node_modules/lockdown/node_modules/npmconf/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

33
node_modules/lockdown/node_modules/npmconf/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,33 +0,0 @@
# npmconf
The config thing npm uses
If you are interested in interacting with the config settings that npm
uses, then use this module.
However, if you are writing a new Node.js program, and want
configuration functionality similar to what npm has, but for your
own thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),
which is probably what you want.
If I were to do it all over again, that's what I'd do for npm. But,
alas, there are many systems depending on many of the particulars of
npm's configuration setup, so it's not worth the cost of changing.
## USAGE
```javascript
var npmconf = require('npmconf')
// pass in the cli options that you read from the cli
// or whatever top-level configs you want npm to use for now.
npmconf.load({some:'configs'}, function (er, conf) {
// do stuff with conf
conf.get('some', 'cli') // 'configs'
conf.get('username') // 'joebobwhatevers'
conf.set('foo', 'bar', 'user')
conf.save('user', function (er) {
// foo = bar is now saved to ~/.npmrc or wherever
})
})
```

370
node_modules/lockdown/node_modules/npmconf/config-defs.js сгенерированный поставляемый
Просмотреть файл

@ -1,370 +0,0 @@
// defaults, types, and shorthands.
var path = require("path")
, url = require("url")
, Stream = require("stream").Stream
, semver = require("semver")
, stableFamily = semver.parse(process.version)
, nopt = require("nopt")
, os = require("os")
, osenv = require("osenv")
var log
try {
log = require("npmlog")
} catch (er) {
var util = require("util")
log = { warn: function (m) {
console.warn(m + util.format.apply(util, [].slice.call(arguments, 1)))
} }
}
exports.Octal = Octal
function Octal () {}
function validateOctal (data, k, val) {
// must be either an integer or an octal string.
if (typeof val === "number") {
data[k] = val
return true
}
if (typeof val === "string") {
if (val.charAt(0) !== "0" || isNaN(val)) return false
data[k] = parseInt(val, 8).toString(8)
}
}
function validateSemver (data, k, val) {
if (!semver.valid(val)) return false
data[k] = semver.valid(val)
}
function validateStream (data, k, val) {
if (!(val instanceof Stream)) return false
data[k] = val
}
nopt.typeDefs.semver = { type: semver, validate: validateSemver }
nopt.typeDefs.Octal = { type: Octal, validate: validateOctal }
nopt.typeDefs.Stream = { type: Stream, validate: validateStream }
nopt.invalidHandler = function (k, val, type) {
log.warn("invalid config", k + "=" + JSON.stringify(val))
if (Array.isArray(type)) {
if (type.indexOf(url) !== -1) type = url
else if (type.indexOf(path) !== -1) type = path
}
switch (type) {
case Octal:
log.warn("invalid config", "Must be octal number, starting with 0")
break
case url:
log.warn("invalid config", "Must be a full url with 'http://'")
break
case path:
log.warn("invalid config", "Must be a valid filesystem path")
break
case Number:
log.warn("invalid config", "Must be a numeric value")
break
case Stream:
log.warn("invalid config", "Must be an instance of the Stream class")
break
}
}
if (!stableFamily || (+stableFamily.minor % 2)) stableFamily = null
else stableFamily = stableFamily.major + "." + stableFamily.minor
var defaults
var temp = osenv.tmpdir()
var home = osenv.home()
var uidOrPid = process.getuid ? process.getuid() : process.pid
if (home) process.env.HOME = home
else home = path.resolve(temp, "npm-" + uidOrPid)
var cacheExtra = process.platform === "win32" ? "npm-cache" : ".npm"
var cacheRoot = process.platform === "win32" && process.env.APPDATA || home
var cache = path.resolve(cacheRoot, cacheExtra)
var globalPrefix
Object.defineProperty(exports, "defaults", {get: function () {
if (defaults) return defaults
if (process.env.PREFIX) {
globalPrefix = process.env.PREFIX
} else if (process.platform === "win32") {
// c:\node\node.exe --> prefix=c:\node\
globalPrefix = path.dirname(process.execPath)
} else {
// /usr/local/bin/node --> prefix=/usr/local
globalPrefix = path.dirname(path.dirname(process.execPath))
// destdir only is respected on Unix
if (process.env.DESTDIR) {
globalPrefix = path.join(process.env.DESTDIR, globalPrefix)
}
}
return defaults =
{ "always-auth" : false
, "bin-links" : true
, browser : null
, ca: null
, cafile: null
, cache : cache
, "cache-lock-stale": 60000
, "cache-lock-retries": 10
, "cache-lock-wait": 10000
, "cache-max": Infinity
, "cache-min": 10
, cert: null
, color : true
, depth: Infinity
, description : true
, dev : false
, editor : osenv.editor()
, email: ""
, "engine-strict": false
, force : false
, "fetch-retries": 2
, "fetch-retry-factor": 10
, "fetch-retry-mintimeout": 10000
, "fetch-retry-maxtimeout": 60000
, git: "git"
, "git-tag-version": true
, global : false
, globalconfig : path.resolve(globalPrefix, "etc", "npmrc")
, group : process.platform === "win32" ? 0
: process.env.SUDO_GID || (process.getgid && process.getgid())
, heading: "npm"
, "ignore-scripts": false
, "init-module": path.resolve(home, ".npm-init.js")
, "init.author.name" : ""
, "init.author.email" : ""
, "init.author.url" : ""
, "init.license": "ISC"
, json: false
, key: null
, link: false
, "local-address" : undefined
, loglevel : "warn"
, logstream : process.stderr
, long : false
, message : "%s"
, "node-version" : process.version
, npat : false
, "onload-script" : false
, optional: true
, parseable : false
, prefix : globalPrefix
, production: process.env.NODE_ENV === "production"
, "proprietary-attribs": true
, proxy : process.env.HTTP_PROXY || process.env.http_proxy || null
, "https-proxy" : process.env.HTTPS_PROXY || process.env.https_proxy ||
process.env.HTTP_PROXY || process.env.http_proxy || null
, "user-agent" : "npm/{npm-version} "
+ "node/{node-version} "
+ "{platform} "
+ "{arch}"
, "rebuild-bundle" : true
, registry : "https://registry.npmjs.org/"
, rollback : true
, save : false
, "save-bundle": false
, "save-dev" : false
, "save-exact" : false
, "save-optional" : false
, "save-prefix": "^"
, scope : ""
, searchopts: ""
, searchexclude: null
, searchsort: "name"
, shell : osenv.shell()
, shrinkwrap: true
, "sign-git-tag": false
, spin: true
, "strict-ssl": true
, tag : "latest"
, tmp : temp
, unicode : true
, "unsafe-perm" : process.platform === "win32"
|| process.platform === "cygwin"
|| !( process.getuid && process.setuid
&& process.getgid && process.setgid )
|| process.getuid() !== 0
, usage : false
, user : process.platform === "win32" ? 0 : "nobody"
, username : ""
, userconfig : path.resolve(home, ".npmrc")
, umask: process.umask ? process.umask() : parseInt("022", 8)
, version : false
, versions : false
, viewer: process.platform === "win32" ? "browser" : "man"
, _exit : true
}
}})
exports.types =
{ "always-auth" : Boolean
, "bin-links": Boolean
, browser : [null, String]
, ca: [null, String, Array]
, cafile : path
, cache : path
, "cache-lock-stale": Number
, "cache-lock-retries": Number
, "cache-lock-wait": Number
, "cache-max": Number
, "cache-min": Number
, cert: [null, String]
, color : ["always", Boolean]
, depth : Number
, description : Boolean
, dev : Boolean
, editor : String
, email: [null, String]
, "engine-strict": Boolean
, force : Boolean
, "fetch-retries": Number
, "fetch-retry-factor": Number
, "fetch-retry-mintimeout": Number
, "fetch-retry-maxtimeout": Number
, git: String
, "git-tag-version": Boolean
, global : Boolean
, globalconfig : path
, group : [Number, String]
, "https-proxy" : [null, url]
, "user-agent" : String
, "heading": String
, "ignore-scripts": Boolean
, "init-module": path
, "init.author.name" : String
, "init.author.email" : String
, "init.author.url" : ["", url]
, "init.license": String
, json: Boolean
, key: [null, String]
, link: Boolean
// local-address must be listed as an IP for a local network interface
// must be IPv4 due to node bug
, "local-address" : getLocalAddresses()
, loglevel : ["silent","win","error","warn","http","info","verbose","silly"]
, logstream : Stream
, long : Boolean
, message: String
, "node-version" : [null, semver]
, npat : Boolean
, "onload-script" : [null, String]
, optional: Boolean
, parseable : Boolean
, prefix: path
, production: Boolean
, "proprietary-attribs": Boolean
, proxy : [null, url]
, "rebuild-bundle" : Boolean
, registry : [null, url]
, rollback : Boolean
, save : Boolean
, "save-bundle": Boolean
, "save-dev" : Boolean
, "save-exact" : Boolean
, "save-optional" : Boolean
, "save-prefix": String
, scope : String
, searchopts : String
, searchexclude: [null, String]
, searchsort: [ "name", "-name"
, "description", "-description"
, "author", "-author"
, "date", "-date"
, "keywords", "-keywords" ]
, shell : String
, shrinkwrap: Boolean
, "sign-git-tag": Boolean
, spin: ["always", Boolean]
, "strict-ssl": Boolean
, tag : String
, tmp : path
, unicode : Boolean
, "unsafe-perm" : Boolean
, usage : Boolean
, user : [Number, String]
, username : String
, userconfig : path
, umask: Octal
, version : Boolean
, versions : Boolean
, viewer: String
, _exit : Boolean
, _password: String
}
function getLocalAddresses() {
Object.keys(os.networkInterfaces()).map(function (nic) {
return os.networkInterfaces()[nic].filter(function (addr) {
return addr.family === "IPv4"
})
.map(function (addr) {
return addr.address
})
}).reduce(function (curr, next) {
return curr.concat(next)
}, []).concat(undefined)
}
exports.shorthands =
{ s : ["--loglevel", "silent"]
, d : ["--loglevel", "info"]
, dd : ["--loglevel", "verbose"]
, ddd : ["--loglevel", "silly"]
, noreg : ["--no-registry"]
, N : ["--no-registry"]
, reg : ["--registry"]
, "no-reg" : ["--no-registry"]
, silent : ["--loglevel", "silent"]
, verbose : ["--loglevel", "verbose"]
, quiet: ["--loglevel", "warn"]
, q: ["--loglevel", "warn"]
, h : ["--usage"]
, H : ["--usage"]
, "?" : ["--usage"]
, help : ["--usage"]
, v : ["--version"]
, f : ["--force"]
, gangster : ["--force"]
, gangsta : ["--force"]
, desc : ["--description"]
, "no-desc" : ["--no-description"]
, "local" : ["--no-global"]
, l : ["--long"]
, m : ["--message"]
, p : ["--parseable"]
, porcelain : ["--parseable"]
, g : ["--global"]
, S : ["--save"]
, D : ["--save-dev"]
, E : ["--save-exact"]
, O : ["--save-optional"]
, y : ["--yes"]
, n : ["--no-yes"]
, B : ["--save-bundle"]
}

56
node_modules/lockdown/node_modules/npmconf/lib/find-prefix.js сгенерированный поставляемый
Просмотреть файл

@ -1,56 +0,0 @@
// try to find the most reasonable prefix to use
module.exports = findPrefix
var fs = require("fs")
var path = require("path")
function findPrefix (p, cb_) {
function cb (er, p) {
process.nextTick(function () {
cb_(er, p)
})
}
p = path.resolve(p)
// if there's no node_modules folder, then
// walk up until we hopefully find one.
// if none anywhere, then use cwd.
var walkedUp = false
while (path.basename(p) === "node_modules") {
p = path.dirname(p)
walkedUp = true
}
if (walkedUp) return cb(null, p)
findPrefix_(p, p, cb)
}
function findPrefix_ (p, original, cb) {
if (p === "/"
|| (process.platform === "win32" && p.match(/^[a-zA-Z]:(\\|\/)?$/))) {
return cb(null, original)
}
fs.readdir(p, function (er, files) {
// an error right away is a bad sign.
// unless the prefix was simply a non
// existent directory.
if (er && p === original) {
if (er.code === "ENOENT") return cb(null, original);
return cb(er)
}
// walked up too high or something.
if (er) return cb(null, original)
if (files.indexOf("node_modules") !== -1
|| files.indexOf("package.json") !== -1) {
return cb(null, p)
}
var d = path.dirname(p)
if (d === p) return cb(null, original)
return findPrefix_(d, original, cb)
})
}

31
node_modules/lockdown/node_modules/npmconf/lib/load-cafile.js сгенерированный поставляемый
Просмотреть файл

@ -1,31 +0,0 @@
module.exports = loadCAFile
var fs = require('fs')
function loadCAFile(cafilePath, cb) {
if (!cafilePath)
return process.nextTick(cb)
fs.readFile(cafilePath, 'utf8', afterCARead.bind(this))
function afterCARead(er, cadata) {
if (er)
return cb(er)
var delim = '-----END CERTIFICATE-----'
var output
output = cadata
.split(delim)
.filter(function(xs) {
return !!xs.trim()
})
.map(function(xs) {
return xs.trimLeft() + delim
})
this.set('ca', output)
cb(null)
}
}

49
node_modules/lockdown/node_modules/npmconf/lib/load-prefix.js сгенерированный поставляемый
Просмотреть файл

@ -1,49 +0,0 @@
module.exports = loadPrefix
var findPrefix = require("./find-prefix.js")
var path = require('path')
function loadPrefix (cb) {
var cli = this.list[0]
Object.defineProperty(this, "prefix",
{ set : function (prefix) {
var g = this.get("global")
this[g ? 'globalPrefix' : 'localPrefix'] = prefix
}.bind(this)
, get : function () {
var g = this.get("global")
return g ? this.globalPrefix : this.localPrefix
}.bind(this)
, enumerable : true
})
Object.defineProperty(this, "globalPrefix",
{ set : function (prefix) {
this.set('prefix', prefix)
}.bind(this)
, get : function () {
return path.resolve(this.get("prefix"))
}.bind(this)
, enumerable : true
})
var p
Object.defineProperty(this, "localPrefix",
{ set : function (prefix) { p = prefix },
get : function () { return p }
, enumerable: true })
// try to guess at a good node_modules location.
// If we are *explicitly* given a prefix on the cli, then
// always use that. otherwise, infer local prefix from cwd.
if (Object.prototype.hasOwnProperty.call(cli, "prefix")) {
p = path.resolve(cli.prefix)
process.nextTick(cb)
} else {
findPrefix(process.cwd(), function (er, found) {
p = found
cb(er)
}.bind(this))
}
}

15
node_modules/lockdown/node_modules/npmconf/lib/load-uid.js сгенерированный поставляемый
Просмотреть файл

@ -1,15 +0,0 @@
module.exports = loadUid
var getUid = require("uid-number")
// Call in the context of a npmconf object
function loadUid (cb) {
// if we're not in unsafe-perm mode, then figure out who
// to run stuff as. Do this first, to support `npm update npm -g`
if (!this.get("unsafe-perm")) {
getUid(this.get("user"), this.get("group"), cb)
} else {
process.nextTick(cb)
}
}

26
node_modules/lockdown/node_modules/npmconf/lib/set-user.js сгенерированный поставляемый
Просмотреть файл

@ -1,26 +0,0 @@
module.exports = setUser
var Conf = require('../npmconf.js').Conf
var assert = require('assert')
var path = require('path')
var fs = require('fs')
function setUser (cb) {
var defaultConf = this.root
assert(defaultConf !== Object.prototype)
// If global, leave it as-is.
// If not global, then set the user to the owner of the prefix folder.
// Just set the default, so it can be overridden.
if (this.get("global")) return cb()
if (process.env.SUDO_UID) {
defaultConf.user = +(process.env.SUDO_UID)
return cb()
}
var prefix = path.resolve(this.get("prefix"))
fs.stat(prefix, function (er, st) {
defaultConf.user = st && st.uid
return cb(er)
})
}

1
node_modules/lockdown/node_modules/npmconf/node_modules/.bin/mkdirp сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
../mkdirp/bin/cmd.js

1
node_modules/lockdown/node_modules/npmconf/node_modules/.bin/nopt сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
../nopt/bin/nopt.js

1
node_modules/lockdown/node_modules/npmconf/node_modules/.bin/semver сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
../semver/bin/semver

3
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/.npmignore сгенерированный поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
node_modules
node_modules/*
npm_debug.log

22
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/LICENCE сгенерированный поставляемый
Просмотреть файл

@ -1,22 +0,0 @@
Copyright (c) 2011 Dominic Tarr
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

282
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/index.js сгенерированный поставляемый
Просмотреть файл

@ -1,282 +0,0 @@
var ProtoList = require('proto-list')
, path = require('path')
, fs = require('fs')
, ini = require('ini')
, EE = require('events').EventEmitter
, url = require('url')
, http = require('http')
var exports = module.exports = function () {
var args = [].slice.call(arguments)
, conf = new ConfigChain()
while(args.length) {
var a = args.shift()
if(a) conf.push
( 'string' === typeof a
? json(a)
: a )
}
return conf
}
//recursively find a file...
var find = exports.find = function () {
var rel = path.join.apply(null, [].slice.call(arguments))
function find(start, rel) {
var file = path.join(start, rel)
try {
fs.statSync(file)
return file
} catch (err) {
if(path.dirname(start) !== start) // root
return find(path.dirname(start), rel)
}
}
return find(__dirname, rel)
}
var parse = exports.parse = function (content, file, type) {
content = '' + content
// if we don't know what it is, try json and fall back to ini
// if we know what it is, then it must be that.
if (!type) {
try { return JSON.parse(content) }
catch (er) { return ini.parse(content) }
} else if (type === 'json') {
if (this.emit) {
try { return JSON.parse(content) }
catch (er) { this.emit('error', er) }
} else {
return JSON.parse(content)
}
} else {
return ini.parse(content)
}
}
var json = exports.json = function () {
var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
var file = path.join.apply(null, args)
var content
try {
content = fs.readFileSync(file,'utf-8')
} catch (err) {
return
}
return parse(content, file, 'json')
}
var env = exports.env = function (prefix, env) {
env = env || process.env
var obj = {}
var l = prefix.length
for(var k in env) {
if(k.indexOf(prefix) === 0)
obj[k.substring(l)] = env[k]
}
return obj
}
exports.ConfigChain = ConfigChain
function ConfigChain () {
EE.apply(this)
ProtoList.apply(this, arguments)
this._awaiting = 0
this._saving = 0
this.sources = {}
}
// multi-inheritance-ish
var extras = {
constructor: { value: ConfigChain }
}
Object.keys(EE.prototype).forEach(function (k) {
extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k)
})
ConfigChain.prototype = Object.create(ProtoList.prototype, extras)
ConfigChain.prototype.del = function (key, where) {
// if not specified where, then delete from the whole chain, scorched
// earth style
if (where) {
var target = this.sources[where]
target = target && target.data
if (!target) {
return this.emit('error', new Error('not found '+where))
}
delete target[key]
} else {
for (var i = 0, l = this.list.length; i < l; i ++) {
delete this.list[i][key]
}
}
return this
}
ConfigChain.prototype.set = function (key, value, where) {
var target
if (where) {
target = this.sources[where]
target = target && target.data
if (!target) {
return this.emit('error', new Error('not found '+where))
}
} else {
target = this.list[0]
if (!target) {
return this.emit('error', new Error('cannot set, no confs!'))
}
}
target[key] = value
return this
}
ConfigChain.prototype.get = function (key, where) {
if (where) {
where = this.sources[where]
if (where) where = where.data
if (where && Object.hasOwnProperty.call(where, key)) return where[key]
return undefined
}
return this.list[0][key]
}
ConfigChain.prototype.save = function (where, type, cb) {
if (typeof type === 'function') cb = type, type = null
var target = this.sources[where]
if (!target || !(target.path || target.source) || !target.data) {
// TODO: maybe save() to a url target could be a PUT or something?
// would be easy to swap out with a reddis type thing, too
return this.emit('error', new Error('bad save target: '+where))
}
if (target.source) {
var pref = target.prefix || ''
Object.keys(target.data).forEach(function (k) {
target.source[pref + k] = target.data[k]
})
return this
}
var type = type || target.type
var data = target.data
if (target.type === 'json') {
data = JSON.stringify(data)
} else {
data = ini.stringify(data)
}
this._saving ++
fs.writeFile(target.path, data, 'utf8', function (er) {
this._saving --
if (er) {
if (cb) return cb(er)
else return this.emit('error', er)
}
if (this._saving === 0) {
if (cb) cb()
this.emit('save')
}
}.bind(this))
return this
}
ConfigChain.prototype.addFile = function (file, type, name) {
name = name || file
var marker = {__source__:name}
this.sources[name] = { path: file, type: type }
this.push(marker)
this._await()
fs.readFile(file, 'utf8', function (er, data) {
if (er) this.emit('error', er)
this.addString(data, file, type, marker)
}.bind(this))
return this
}
ConfigChain.prototype.addEnv = function (prefix, env, name) {
name = name || 'env'
var data = exports.env(prefix, env)
this.sources[name] = { data: data, source: env, prefix: prefix }
return this.add(data, name)
}
ConfigChain.prototype.addUrl = function (req, type, name) {
this._await()
var href = url.format(req)
name = name || href
var marker = {__source__:name}
this.sources[name] = { href: href, type: type }
this.push(marker)
http.request(req, function (res) {
var c = []
var ct = res.headers['content-type']
if (!type) {
type = ct.indexOf('json') !== -1 ? 'json'
: ct.indexOf('ini') !== -1 ? 'ini'
: href.match(/\.json$/) ? 'json'
: href.match(/\.ini$/) ? 'ini'
: null
marker.type = type
}
res.on('data', c.push.bind(c))
.on('end', function () {
this.addString(Buffer.concat(c), href, type, marker)
}.bind(this))
.on('error', this.emit.bind(this, 'error'))
}.bind(this))
.on('error', this.emit.bind(this, 'error'))
.end()
return this
}
ConfigChain.prototype.addString = function (data, file, type, marker) {
data = this.parse(data, file, type)
this.add(data, marker)
return this
}
ConfigChain.prototype.add = function (data, marker) {
if (marker && typeof marker === 'object') {
var i = this.list.indexOf(marker)
if (i === -1) {
return this.emit('error', new Error('bad marker'))
}
this.splice(i, 1, data)
marker = marker.__source__
this.sources[marker] = this.sources[marker] || {}
this.sources[marker].data = data
// we were waiting for this. maybe emit 'load'
this._resolve()
} else {
if (typeof marker === 'string') {
this.sources[marker] = this.sources[marker] || {}
this.sources[marker].data = data
}
// trigger the load event if nothing was already going to do so.
this._await()
this.push(data)
process.nextTick(this._resolve.bind(this))
}
return this
}
ConfigChain.prototype.parse = exports.parse
ConfigChain.prototype._await = function () {
this._awaiting++
}
ConfigChain.prototype._resolve = function () {
this._awaiting--
if (this._awaiting === 0) this.emit('load', this)
}

Просмотреть файл

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Просмотреть файл

@ -1,3 +0,0 @@
A list of objects, bound by their prototype chain.
Used in npm's config stuff.

Просмотреть файл

@ -1,49 +0,0 @@
{
"name": "proto-list",
"version": "1.2.4",
"description": "A utility for managing a prototype chain",
"main": "./proto-list.js",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/proto-list.git"
},
"license": "ISC",
"devDependencies": {
"tap": "0"
},
"gitHead": "9e4af12d4dddee2fd531f0fe0c21c9cfacb78ac0",
"bugs": {
"url": "https://github.com/isaacs/proto-list/issues"
},
"homepage": "https://github.com/isaacs/proto-list#readme",
"_id": "proto-list@1.2.4",
"_shasum": "212d5bfe1318306a420f6402b8e26ff39647a849",
"_from": "proto-list@>=1.2.1 <1.3.0",
"_npmVersion": "2.10.0",
"_nodeVersion": "2.0.1",
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
},
"dist": {
"shasum": "212d5bfe1318306a420f6402b8e26ff39647a849",
"tarball": "http://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
"readme": "ERROR: No README data found!"
}

Просмотреть файл

@ -1,88 +0,0 @@
module.exports = ProtoList
function setProto(obj, proto) {
if (typeof Object.setPrototypeOf === "function")
return Object.setPrototypeOf(obj, proto)
else
obj.__proto__ = proto
}
function ProtoList () {
this.list = []
var root = null
Object.defineProperty(this, 'root', {
get: function () { return root },
set: function (r) {
root = r
if (this.list.length) {
setProto(this.list[this.list.length - 1], r)
}
},
enumerable: true,
configurable: true
})
}
ProtoList.prototype =
{ get length () { return this.list.length }
, get keys () {
var k = []
for (var i in this.list[0]) k.push(i)
return k
}
, get snapshot () {
var o = {}
this.keys.forEach(function (k) { o[k] = this.get(k) }, this)
return o
}
, get store () {
return this.list[0]
}
, push : function (obj) {
if (typeof obj !== "object") obj = {valueOf:obj}
if (this.list.length >= 1) {
setProto(this.list[this.list.length - 1], obj)
}
setProto(obj, this.root)
return this.list.push(obj)
}
, pop : function () {
if (this.list.length >= 2) {
setProto(this.list[this.list.length - 2], this.root)
}
return this.list.pop()
}
, unshift : function (obj) {
setProto(obj, this.list[0] || this.root)
return this.list.unshift(obj)
}
, shift : function () {
if (this.list.length === 1) {
setProto(this.list[0], this.root)
}
return this.list.shift()
}
, get : function (key) {
return this.list[0][key]
}
, set : function (key, val, save) {
if (!this.length) this.push({})
if (save && this.list[0].hasOwnProperty(key)) this.push({})
return this.list[0][key] = val
}
, forEach : function (fn, thisp) {
for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key])
}
, slice : function () {
return this.list.slice.apply(this.list, arguments)
}
, splice : function () {
// handle injections
var ret = this.list.splice.apply(this.list, arguments)
for (var i = 0, l = this.list.length; i < l; i++) {
setProto(this.list[i], this.list[i + 1] || this.root)
}
return ret
}
}

Просмотреть файл

@ -1,61 +0,0 @@
var tap = require("tap")
, test = tap.test
, ProtoList = require("../proto-list.js")
tap.plan(1)
tap.test("protoList tests", function (t) {
var p = new ProtoList
p.push({foo:"bar"})
p.push({})
p.set("foo", "baz")
t.equal(p.get("foo"), "baz")
var p = new ProtoList
p.push({foo:"bar"})
p.set("foo", "baz")
t.equal(p.get("foo"), "baz")
t.equal(p.length, 1)
p.pop()
t.equal(p.length, 0)
p.set("foo", "asdf")
t.equal(p.length, 1)
t.equal(p.get("foo"), "asdf")
p.push({bar:"baz"})
t.equal(p.length, 2)
t.equal(p.get("foo"), "asdf")
p.shift()
t.equal(p.length, 1)
t.equal(p.get("foo"), undefined)
p.unshift({foo:"blo", bar:"rab"})
p.unshift({foo:"boo"})
t.equal(p.length, 3)
t.equal(p.get("foo"), "boo")
t.equal(p.get("bar"), "rab")
var ret = p.splice(1, 1, {bar:"bar"})
t.same(ret, [{foo:"blo", bar:"rab"}])
t.equal(p.get("bar"), "bar")
// should not inherit default object properties
t.equal(p.get('hasOwnProperty'), undefined)
// unless we give it those.
p.root = {}
t.equal(p.get('hasOwnProperty'), {}.hasOwnProperty)
p.root = {default:'monkey'}
t.equal(p.get('default'), 'monkey')
p.push({red:'blue'})
p.push({red:'blue'})
p.push({red:'blue'})
while (p.length) {
t.equal(p.get('default'), 'monkey')
p.shift()
}
t.end()
})

61
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,61 +0,0 @@
{
"name": "config-chain",
"version": "1.1.9",
"licenses": [
{
"type": "MIT",
"url": "https://raw.githubusercontent.com/dominictarr/config-chain/master/LICENCE"
}
],
"description": "HANDLE CONFIGURATION ONCE AND FOR ALL",
"homepage": "http://github.com/dominictarr/config-chain",
"repository": {
"type": "git",
"url": "git+https://github.com/dominictarr/config-chain.git"
},
"dependencies": {
"proto-list": "~1.2.1",
"ini": "1"
},
"devDependencies": {
"tap": "0.3.0"
},
"author": {
"name": "Dominic Tarr",
"email": "dominic.tarr@gmail.com",
"url": "http://dominictarr.com"
},
"scripts": {
"test": "tap test/"
},
"gitHead": "832609897082a0a887c59dadb105f4db6de1ab4c",
"bugs": {
"url": "https://github.com/dominictarr/config-chain/issues"
},
"_id": "config-chain@1.1.9",
"_shasum": "39ac7d4dca84faad926124c54cff25a53aa8bf6e",
"_from": "config-chain@>=1.1.8 <1.2.0",
"_npmVersion": "2.11.0",
"_nodeVersion": "0.12.4",
"_npmUser": {
"name": "dominictarr",
"email": "dominic.tarr@gmail.com"
},
"maintainers": [
{
"name": "dominictarr",
"email": "dominic.tarr@gmail.com"
},
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"dist": {
"shasum": "39ac7d4dca84faad926124c54cff25a53aa8bf6e",
"tarball": "http://registry.npmjs.org/config-chain/-/config-chain-1.1.9.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.9.tgz",
"readme": "ERROR: No README data found!"
}

228
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/readme.markdown сгенерированный поставляемый
Просмотреть файл

@ -1,228 +0,0 @@
#config-chain
USE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS
``` js
//npm install config-chain
var cc = require('config-chain')
, opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS.
, env = opts.env || process.env.YOUR_APP_ENV || 'dev' //SET YOUR ENV LIKE THIS.
// EACH ARG TO CONFIGURATOR IS LOADED INTO CONFIGURATION CHAIN
// EARLIER ITEMS OVERIDE LATER ITEMS
// PUTS COMMAND LINE OPTS FIRST, AND DEFAULTS LAST!
//strings are interpereted as filenames.
//will be loaded synchronously
var conf =
cc(
//OVERRIDE SETTINGS WITH COMMAND LINE OPTS
opts,
//ENV VARS IF PREFIXED WITH 'myApp_'
cc.env('myApp_'), //myApp_foo = 'like this'
//FILE NAMED BY ENV
path.join(__dirname, 'config.' + env + '.json'),
//IF `env` is PRODUCTION
env === 'prod'
? path.join(__dirname, 'special.json') //load a special file
: null //NULL IS IGNORED!
//SUBDIR FOR ENV CONFIG
path.join(__dirname, 'config', env, 'config.json'),
//SEARCH PARENT DIRECTORIES FROM CURRENT DIR FOR FILE
cc.find('config.json'),
//PUT DEFAULTS LAST
{
host: 'localhost'
port: 8000
})
var host = conf.get('host')
// or
var host = conf.store.host
```
FINALLY, EASY FLEXIBLE CONFIGURATIONS!
##see also: [proto-list](https://github.com/isaacs/proto-list/)
WHATS THAT YOU SAY?
YOU WANT A "CLASS" SO THAT YOU CAN DO CRAYCRAY JQUERY CRAPS?
EXTEND WITH YOUR OWN FUNCTIONALTY!?
## CONFIGCHAIN LIVES TO SERVE ONLY YOU!
```javascript
var cc = require('config-chain')
// all the stuff you did before
var config = cc({
some: 'object'
},
cc.find('config.json'),
cc.env('myApp_')
)
// CONFIGS AS A SERVICE, aka "CaaS", aka EVERY DEVOPS DREAM OMG!
.addUrl('http://configurator:1234/my-configs')
// ASYNC FTW!
.addFile('/path/to/file.json')
// OBJECTS ARE OK TOO, they're SYNC but they still ORDER RIGHT
// BECAUSE PROMISES ARE USED BUT NO, NOT *THOSE* PROMISES, JUST
// ACTUAL PROMISES LIKE YOU MAKE TO YOUR MOM, KEPT OUT OF LOVE
.add({ another: 'object' })
// DIE A THOUSAND DEATHS IF THIS EVER HAPPENS!!
.on('error', function (er) {
// IF ONLY THERE WAS SOMETHIGN HARDER THAN THROW
// MY SORROW COULD BE ADEQUATELY EXPRESSED. /o\
throw er
})
// THROW A PARTY IN YOUR FACE WHEN ITS ALL LOADED!!
.on('load', function (config) {
console.awesome('HOLY SHIT!')
})
```
# BORING API DOCS
## cc(...args)
MAKE A CHAIN AND ADD ALL THE ARGS.
If the arg is a STRING, then it shall be a JSON FILENAME.
SYNC I/O!
RETURN THE CHAIN!
## cc.json(...args)
Join the args INTO A JSON FILENAME!
SYNC I/O!
## cc.find(relativePath)
SEEK the RELATIVE PATH by climbing the TREE OF DIRECTORIES.
RETURN THE FOUND PATH!
SYNC I/O!
## cc.parse(content, file, type)
Parse the content string, and guess the type from either the
specified type or the filename.
RETURN THE RESULTING OBJECT!
NO I/O!
## cc.env(prefix, env=process.env)
Get all the keys on the provided env object (or process.env) which are
prefixed by the specified prefix, and put the values on a new object.
RETURN THE RESULTING OBJECT!
NO I/O!
## cc.ConfigChain()
The ConfigChain class for CRAY CRAY JQUERY STYLE METHOD CHAINING!
One of these is returned by the main exported function, as well.
It inherits (prototypically) from
[ProtoList](https://github.com/isaacs/proto-list/), and also inherits
(parasitically) from
[EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)
It has all the methods from both, and except where noted, they are
unchanged.
### LET IT BE KNOWN THAT chain IS AN INSTANCE OF ConfigChain.
## chain.sources
A list of all the places where it got stuff. The keys are the names
passed to addFile or addUrl etc, and the value is an object with some
info about the data source.
## chain.addFile(filename, type, [name=filename])
Filename is the name of the file. Name is an arbitrary string to be
used later if you desire. Type is either 'ini' or 'json', and will
try to guess intelligently if omitted.
Loaded files can be saved later.
## chain.addUrl(url, type, [name=url])
Same as the filename thing, but with a url.
Can't be saved later.
## chain.addEnv(prefix, env, [name='env'])
Add all the keys from the env object that start with the prefix.
## chain.addString(data, file, type, [name])
Parse the string and add it to the set. (Mainly used internally.)
## chain.add(object, [name])
Add the object to the set.
## chain.root {Object}
The root from which all the other config objects in the set descend
prototypically.
Put your defaults here.
## chain.set(key, value, name)
Set the key to the value on the named config object. If name is
unset, then set it on the first config object in the set. (That is,
the one with the highest priority, which was added first.)
## chain.get(key, [name])
Get the key from the named config object explicitly, or from the
resolved configs if not specified.
## chain.save(name, type)
Write the named config object back to its origin.
Currently only supported for env and file config types.
For files, encode the data according to the type.
## chain.on('save', function () {})
When one or more files are saved, emits `save` event when they're all
saved.
## chain.on('load', function (chain) {})
When the config chain has loaded all the specified files and urls and
such, the 'load' event fires.

10
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/broken.js сгенерированный поставляемый
Просмотреть файл

@ -1,10 +0,0 @@
var cc = require('..')
var assert = require('assert')
//throw on invalid json
assert.throws(function () {
cc(__dirname + '/broken.json')
})

21
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/broken.json сгенерированный поставляемый
Просмотреть файл

@ -1,21 +0,0 @@
{
"name": "config-chain",
"version": "0.3.0",
"description": "HANDLE CONFIGURATION ONCE AND FOR ALL",
"homepage": "http://github.com/dominictarr/config-chain",
"repository": {
"type": "git",
"url": "https://github.com/dominictarr/config-chain.git"
}
//missing , and then this comment. this json is intensionally invalid
"dependencies": {
"proto-list": "1",
"ini": "~1.0.2"
},
"bundleDependencies": ["ini"],
"REM": "REMEMBER TO REMOVE BUNDLING WHEN/IF ISAACS MERGES ini#7",
"author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)",
"scripts": {
"test": "node test/find-file.js && node test/ini.js && node test/env.js"
}
}

100
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/chain-class.js сгенерированный поставляемый
Просмотреть файл

@ -1,100 +0,0 @@
var test = require('tap').test
var CC = require('../index.js').ConfigChain
var env = { foo_blaz : 'blzaa', foo_env : 'myenv' }
var jsonObj = { blaz: 'json', json: true }
var iniObj = { 'x.y.z': 'xyz', blaz: 'ini' }
var fs = require('fs')
var ini = require('ini')
fs.writeFileSync('/tmp/config-chain-class.json', JSON.stringify(jsonObj))
fs.writeFileSync('/tmp/config-chain-class.ini', ini.stringify(iniObj))
var http = require('http')
var reqs = 0
http.createServer(function (q, s) {
if (++reqs === 2) this.close()
if (q.url === '/json') {
// make sure that the requests come back from the server
// out of order. they should still be ordered properly
// in the resulting config object set.
setTimeout(function () {
s.setHeader('content-type', 'application/json')
s.end(JSON.stringify({
blaz: 'http',
http: true,
json: true
}))
}, 200)
} else {
s.setHeader('content-type', 'application/ini')
s.end(ini.stringify({
blaz: 'http',
http: true,
ini: true,
json: false
}))
}
}).listen(1337)
test('basic class test', function (t) {
var cc = new CC()
var expectlist =
[ { blaz: 'json', json: true },
{ 'x.y.z': 'xyz', blaz: 'ini' },
{ blaz: 'blzaa', env: 'myenv' },
{ blaz: 'http', http: true, json: true },
{ blaz: 'http', http: true, ini: true, json: false } ]
cc.addFile('/tmp/config-chain-class.json')
.addFile('/tmp/config-chain-class.ini')
.addEnv('foo_', env)
.addUrl('http://localhost:1337/json')
.addUrl('http://localhost:1337/ini')
.on('load', function () {
t.same(cc.list, expectlist)
t.same(cc.snapshot, { blaz: 'json',
json: true,
'x.y.z': 'xyz',
env: 'myenv',
http: true,
ini: true })
cc.del('blaz', '/tmp/config-chain-class.json')
t.same(cc.snapshot, { blaz: 'ini',
json: true,
'x.y.z': 'xyz',
env: 'myenv',
http: true,
ini: true })
cc.del('blaz')
t.same(cc.snapshot, { json: true,
'x.y.z': 'xyz',
env: 'myenv',
http: true,
ini: true })
cc.shift()
t.same(cc.snapshot, { 'x.y.z': 'xyz',
env: 'myenv',
http: true,
json: true,
ini: true })
cc.shift()
t.same(cc.snapshot, { env: 'myenv',
http: true,
json: true,
ini: true })
cc.shift()
t.same(cc.snapshot, { http: true,
json: true,
ini: true })
cc.shift()
t.same(cc.snapshot, { http: true,
ini: true,
json: false })
cc.shift()
t.same(cc.snapshot, {})
t.end()
})
})

10
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/env.js сгенерированный поставляемый
Просмотреть файл

@ -1,10 +0,0 @@
var cc = require('..')
var assert = require('assert')
assert.deepEqual({
hello: true
}, cc.env('test_', {
'test_hello': true,
'ignore_this': 4,
'ignore_test_this_too': []
}))

13
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/find-file.js сгенерированный поставляемый
Просмотреть файл

@ -1,13 +0,0 @@
var fs = require('fs')
, assert = require('assert')
, objx = {
rand: Math.random()
}
fs.writeFileSync('/tmp/random-test-config.json', JSON.stringify(objx))
var cc = require('../')
var path = cc.find('tmp/random-test-config.json')
assert.equal(path, '/tmp/random-test-config.json')

15
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/get.js сгенерированный поставляемый
Просмотреть файл

@ -1,15 +0,0 @@
var cc = require("../");
var chain = cc()
, name = "forFun";
chain
.add({
__sample:"for fun only"
}, name)
.on("load", function() {
//It throw exception here
console.log(chain.get("__sample", name));
//But if I drop the name param, it run normally and return as expected: "for fun only"
//console.log(chain.get("__sample"));
});

Просмотреть файл

@ -1,5 +0,0 @@
var cc = require('..')
//should not throw
cc(__dirname, 'non_existing_file')

18
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/ini.js сгенерированный поставляемый
Просмотреть файл

@ -1,18 +0,0 @@
var cc =require('..')
var INI = require('ini')
var assert = require('assert')
function test(obj) {
var _json, _ini
var json = cc.parse (_json = JSON.stringify(obj))
var ini = cc.parse (_ini = INI.stringify(obj))
console.log(_ini, _json)
assert.deepEqual(json, ini)
}
test({hello: true})

59
node_modules/lockdown/node_modules/npmconf/node_modules/config-chain/test/save.js сгенерированный поставляемый
Просмотреть файл

@ -1,59 +0,0 @@
var CC = require('../index.js').ConfigChain
var test = require('tap').test
var f1 = '/tmp/f1.ini'
var f2 = '/tmp/f2.json'
var ini = require('ini')
var f1data = {foo: {bar: 'baz'}, bloo: 'jaus'}
var f2data = {oof: {rab: 'zab'}, oolb: 'suaj'}
var fs = require('fs')
fs.writeFileSync(f1, ini.stringify(f1data), 'utf8')
fs.writeFileSync(f2, JSON.stringify(f2data), 'utf8')
test('test saving and loading ini files', function (t) {
new CC()
.add({grelb:'blerg'}, 'opt')
.addFile(f1, 'ini', 'inifile')
.addFile(f2, 'json', 'jsonfile')
.on('load', function (cc) {
t.same(cc.snapshot, { grelb: 'blerg',
bloo: 'jaus',
foo: { bar: 'baz' },
oof: { rab: 'zab' },
oolb: 'suaj' })
t.same(cc.list, [ { grelb: 'blerg' },
{ bloo: 'jaus', foo: { bar: 'baz' } },
{ oof: { rab: 'zab' }, oolb: 'suaj' } ])
cc.set('grelb', 'brelg', 'opt')
.set('foo', 'zoo', 'inifile')
.set('oof', 'ooz', 'jsonfile')
.save('inifile')
.save('jsonfile')
.on('save', function () {
t.equal(fs.readFileSync(f1, 'utf8'),
"bloo = jaus\nfoo = zoo\n")
t.equal(fs.readFileSync(f2, 'utf8'),
"{\"oof\":\"ooz\",\"oolb\":\"suaj\"}")
t.same(cc.snapshot, { grelb: 'brelg',
bloo: 'jaus',
foo: 'zoo',
oof: 'ooz',
oolb: 'suaj' })
t.same(cc.list, [ { grelb: 'brelg' },
{ bloo: 'jaus', foo: 'zoo' },
{ oof: 'ooz', oolb: 'suaj' } ])
t.pass('ok')
t.end()
})
})
})

16
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,16 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

42
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,42 +0,0 @@
Browser-friendly inheritance fully compatible with standard node.js
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
This package exports standard `inherits` from node.js `util` module in
node environment, but also provides alternative browser-friendly
implementation through [browser
field](https://gist.github.com/shtylman/4339901). Alternative
implementation is a literal copy of standard one located in standalone
module to avoid requiring of `util`. It also has a shim for old
browsers with no `Object.create` support.
While keeping you sure you are using standard `inherits`
implementation in node.js environment, it allows bundlers such as
[browserify](https://github.com/substack/node-browserify) to not
include full `util` package to your client code if all you need is
just `inherits` function. It worth, because browser shim for `util`
package is large and `inherits` is often the single function you need
from it.
It's recommended to use this package instead of
`require('util').inherits` for any code that has chances to be used
not only in node.js but in browser too.
## usage
```js
var inherits = require('inherits');
// then use exactly as the standard one
```
## note on version ~1.0
Version ~1.0 had completely different motivation and is not compatible
neither with 2.0 nor with standard node.js `inherits`.
If you are using version ~1.0 and planning to switch to ~2.0, be
careful:
* new version uses `super_` instead of `super` for referencing
superclass
* new version overwrites current prototype while old one preserves any
existing fields on it

1
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/inherits.js сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
module.exports = require('util').inherits

23
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/inherits_browser.js сгенерированный поставляемый
Просмотреть файл

@ -1,23 +0,0 @@
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}

51
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,51 +0,0 @@
{
"name": "inherits",
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
"version": "2.0.1",
"keywords": [
"inheritance",
"class",
"klass",
"oop",
"object-oriented",
"inherits",
"browser",
"browserify"
],
"main": "./inherits.js",
"browser": "./inherits_browser.js",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/inherits.git"
},
"license": "ISC",
"scripts": {
"test": "node test"
},
"bugs": {
"url": "https://github.com/isaacs/inherits/issues"
},
"_id": "inherits@2.0.1",
"dist": {
"shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
"tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"_from": "inherits@>=2.0.0 <2.1.0",
"_npmVersion": "1.3.8",
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"directories": {},
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n",
"readmeFilename": "README.md",
"homepage": "https://github.com/isaacs/inherits#readme"
}

25
node_modules/lockdown/node_modules/npmconf/node_modules/inherits/test.js сгенерированный поставляемый
Просмотреть файл

@ -1,25 +0,0 @@
var inherits = require('./inherits.js')
var assert = require('assert')
function test(c) {
assert(c.constructor === Child)
assert(c.constructor.super_ === Parent)
assert(Object.getPrototypeOf(c) === Child.prototype)
assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
assert(c instanceof Child)
assert(c instanceof Parent)
}
function Child() {
Parent.call(this)
test(this)
}
function Parent() {}
inherits(Child, Parent)
var c = new Child
test(c)
console.log('ok')

15
node_modules/lockdown/node_modules/npmconf/node_modules/ini/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

102
node_modules/lockdown/node_modules/npmconf/node_modules/ini/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,102 +0,0 @@
An ini format parser and serializer for node.
Sections are treated as nested objects. Items before the first
heading are saved on the object directly.
## Usage
Consider an ini-file `config.ini` that looks like this:
; this comment is being ignored
scope = global
[database]
user = dbuser
password = dbpassword
database = use_this_database
[paths.default]
datadir = /var/lib/data
array[] = first value
array[] = second value
array[] = third value
You can read, manipulate and write the ini-file like so:
var fs = require('fs')
, ini = require('ini')
var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))
config.scope = 'local'
config.database.database = 'use_another_database'
config.paths.default.tmpdir = '/tmp'
delete config.paths.default.datadir
config.paths.default.array.push('fourth value')
fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))
This will result in a file called `config_modified.ini` being written
to the filesystem with the following content:
[section]
scope=local
[section.database]
user=dbuser
password=dbpassword
database=use_another_database
[section.paths.default]
tmpdir=/tmp
array[]=first value
array[]=second value
array[]=third value
array[]=fourth value
## API
### decode(inistring)
Decode the ini-style formatted `inistring` into a nested object.
### parse(inistring)
Alias for `decode(inistring)`
### encode(object, [options])
Encode the object `object` into an ini-style formatted string. If the
optional parameter `section` is given, then all top-level properties
of the object are put into this section and the `section`-string is
prepended to all sub-sections, see the usage example above.
The `options` object may contain the following:
* `section` A string which will be the first `section` in the encoded
ini data. Defaults to none.
* `whitespace` Boolean to specify whether to put whitespace around the
`=` character. By default, whitespace is omitted, to be friendly to
some persnickety old parsers that don't tolerate it well. But some
find that it's more human-readable and pretty with the whitespace.
For backwards compatibility reasons, if a `string` options is passed
in, then it is assumed to be the `section` value.
### stringify(object, [options])
Alias for `encode(object, [options])`
### safe(val)
Escapes the string `val` such that it is safe to be used as a key or
value in an ini-file. Basically escapes quotes. For example
ini.safe('"unsafe string"')
would result in
"\"unsafe string\""
### unsafe(val)
Unescapes the string `val`

190
node_modules/lockdown/node_modules/npmconf/node_modules/ini/ini.js сгенерированный поставляемый
Просмотреть файл

@ -1,190 +0,0 @@
exports.parse = exports.decode = decode
exports.stringify = exports.encode = encode
exports.safe = safe
exports.unsafe = unsafe
var eol = process.platform === "win32" ? "\r\n" : "\n"
function encode (obj, opt) {
var children = []
, out = ""
if (typeof opt === "string") {
opt = {
section: opt,
whitespace: false
}
} else {
opt = opt || {}
opt.whitespace = opt.whitespace === true
}
var separator = opt.whitespace ? " = " : "="
Object.keys(obj).forEach(function (k, _, __) {
var val = obj[k]
if (val && Array.isArray(val)) {
val.forEach(function(item) {
out += safe(k + "[]") + separator + safe(item) + "\n"
})
}
else if (val && typeof val === "object") {
children.push(k)
} else {
out += safe(k) + separator + safe(val) + eol
}
})
if (opt.section && out.length) {
out = "[" + safe(opt.section) + "]" + eol + out
}
children.forEach(function (k, _, __) {
var nk = dotSplit(k).join('\\.')
var section = (opt.section ? opt.section + "." : "") + nk
var child = encode(obj[k], {
section: section,
whitespace: opt.whitespace
})
if (out.length && child.length) {
out += eol
}
out += child
})
return out
}
function dotSplit (str) {
return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
.replace(/\\\./g, '\u0001')
.split(/\./).map(function (part) {
return part.replace(/\1/g, '\\.')
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
})
}
function decode (str) {
var out = {}
, p = out
, section = null
, state = "START"
// section |key = value
, re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
, lines = str.split(/[\r\n]+/g)
, section = null
lines.forEach(function (line, _, __) {
if (!line || line.match(/^\s*[;#]/)) return
var match = line.match(re)
if (!match) return
if (match[1] !== undefined) {
section = unsafe(match[1])
p = out[section] = out[section] || {}
return
}
var key = unsafe(match[2])
, value = match[3] ? unsafe((match[4] || "")) : true
switch (value) {
case 'true':
case 'false':
case 'null': value = JSON.parse(value)
}
// Convert keys with '[]' suffix to an array
if (key.length > 2 && key.slice(-2) === "[]") {
key = key.substring(0, key.length - 2)
if (!p[key]) {
p[key] = []
}
else if (!Array.isArray(p[key])) {
p[key] = [p[key]]
}
}
// safeguard against resetting a previously defined
// array by accidentally forgetting the brackets
if (Array.isArray(p[key])) {
p[key].push(value)
}
else {
p[key] = value
}
})
// {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
// use a filter to return the keys that have to be deleted.
Object.keys(out).filter(function (k, _, __) {
if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k])) return false
// see if the parent section is also an object.
// if so, add it to that, and mark this one for deletion
var parts = dotSplit(k)
, p = out
, l = parts.pop()
, nl = l.replace(/\\\./g, '.')
parts.forEach(function (part, _, __) {
if (!p[part] || typeof p[part] !== "object") p[part] = {}
p = p[part]
})
if (p === out && nl === l) return false
p[nl] = out[k]
return true
}).forEach(function (del, _, __) {
delete out[del]
})
return out
}
function isQuoted (val) {
return (val.charAt(0) === "\"" && val.slice(-1) === "\"")
|| (val.charAt(0) === "'" && val.slice(-1) === "'")
}
function safe (val) {
return ( typeof val !== "string"
|| val.match(/[=\r\n]/)
|| val.match(/^\[/)
|| (val.length > 1
&& isQuoted(val))
|| val !== val.trim() )
? JSON.stringify(val)
: val.replace(/;/g, '\\;').replace(/#/g, "\\#")
}
function unsafe (val, doUnesc) {
val = (val || "").trim()
if (isQuoted(val)) {
// remove the single quotes before calling JSON.parse
if (val.charAt(0) === "'") {
val = val.substr(1, val.length - 2);
}
try { val = JSON.parse(val) } catch (_) {}
} else {
// walk the val to find the first not-escaped ; character
var esc = false
var unesc = "";
for (var i = 0, l = val.length; i < l; i++) {
var c = val.charAt(i)
if (esc) {
if ("\\;#".indexOf(c) !== -1)
unesc += c
else
unesc += "\\" + c
esc = false
} else if (";#".indexOf(c) !== -1) {
break
} else if (c === "\\") {
esc = true
} else {
unesc += c
}
}
if (esc)
unesc += "\\"
return unesc
}
return val
}

56
node_modules/lockdown/node_modules/npmconf/node_modules/ini/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,56 +0,0 @@
{
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"name": "ini",
"description": "An ini encoder/decoder for node",
"version": "1.3.4",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/ini.git"
},
"main": "ini.js",
"scripts": {
"test": "tap test/*.js"
},
"engines": {
"node": "*"
},
"dependencies": {},
"devDependencies": {
"tap": "^1.2.0"
},
"license": "ISC",
"files": [
"ini.js"
],
"gitHead": "4a3001abc4c608e51add9f1d2b2cadf02b8e6dea",
"bugs": {
"url": "https://github.com/isaacs/ini/issues"
},
"homepage": "https://github.com/isaacs/ini#readme",
"_id": "ini@1.3.4",
"_shasum": "0537cb79daf59b59a1a517dff706c86ec039162e",
"_from": "ini@>=1.2.0 <2.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "2.0.1",
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
},
"dist": {
"shasum": "0537cb79daf59b59a1a517dff706c86ec039162e",
"tarball": "http://registry.npmjs.org/ini/-/ini-1.3.4.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz",
"readme": "ERROR: No README data found!"
}

8
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/.travis.yml сгенерированный поставляемый
Просмотреть файл

@ -1,8 +0,0 @@
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.12"
- "iojs"
before_install:
- npm install -g npm@~1.4.6

21
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,21 +0,0 @@
Copyright 2010 James Halliday (mail@substack.net)
This project is free software released under the MIT/X11 license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

33
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/bin/cmd.js сгенерированный поставляемый
Просмотреть файл

@ -1,33 +0,0 @@
#!/usr/bin/env node
var mkdirp = require('../');
var minimist = require('minimist');
var fs = require('fs');
var argv = minimist(process.argv.slice(2), {
alias: { m: 'mode', h: 'help' },
string: [ 'mode' ]
});
if (argv.help) {
fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout);
return;
}
var paths = argv._.slice();
var mode = argv.mode ? parseInt(argv.mode, 8) : undefined;
(function next () {
if (paths.length === 0) return;
var p = paths.shift();
if (mode === undefined) mkdirp(p, cb)
else mkdirp(p, mode, cb)
function cb (err) {
if (err) {
console.error(err.message);
process.exit(1);
}
else next();
}
})();

12
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/bin/usage.txt сгенерированный поставляемый
Просмотреть файл

@ -1,12 +0,0 @@
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Create each supplied directory including any necessary parent directories that
don't yet exist.
If the directory already exists, do nothing.
OPTIONS are:
-m, --mode If a directory needs to be created, set the mode as an octal
permission string.

6
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/examples/pow.js сгенерированный поставляемый
Просмотреть файл

@ -1,6 +0,0 @@
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});

98
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/index.js сгенерированный поставляемый
Просмотреть файл

@ -1,98 +0,0 @@
var path = require('path');
var fs = require('fs');
var _0777 = parseInt('0777', 8);
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
function mkdirP (p, opts, f, made) {
if (typeof opts === 'function') {
f = opts;
opts = {};
}
else if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}
var mode = opts.mode;
var xfs = opts.fs || fs;
if (mode === undefined) {
mode = _0777 & (~process.umask());
}
if (!made) made = null;
var cb = f || function () {};
p = path.resolve(p);
xfs.mkdir(p, mode, function (er) {
if (!er) {
made = made || p;
return cb(null, made);
}
switch (er.code) {
case 'ENOENT':
mkdirP(path.dirname(p), opts, function (er, made) {
if (er) cb(er, made);
else mkdirP(p, opts, cb, made);
});
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
xfs.stat(p, function (er2, stat) {
// if the stat fails, then that's super weird.
// let the original error be the failure reason.
if (er2 || !stat.isDirectory()) cb(er, made)
else cb(null, made);
});
break;
}
});
}
mkdirP.sync = function sync (p, opts, made) {
if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}
var mode = opts.mode;
var xfs = opts.fs || fs;
if (mode === undefined) {
mode = _0777 & (~process.umask());
}
if (!made) made = null;
p = path.resolve(p);
try {
xfs.mkdirSync(p, mode);
made = made || p;
}
catch (err0) {
switch (err0.code) {
case 'ENOENT' :
made = sync(path.dirname(p), opts, made);
sync(p, opts, made);
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
var stat;
try {
stat = xfs.statSync(p);
}
catch (err1) {
throw err0;
}
if (!stat.isDirectory()) throw err0;
break;
}
}
return made;
};

Просмотреть файл

@ -1,4 +0,0 @@
language: node_js
node_js:
- "0.8"
- "0.10"

Просмотреть файл

@ -1,18 +0,0 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Просмотреть файл

@ -1,2 +0,0 @@
var argv = require('../')(process.argv.slice(2));
console.dir(argv);

187
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/node_modules/minimist/index.js сгенерированный поставляемый
Просмотреть файл

@ -1,187 +0,0 @@
module.exports = function (args, opts) {
if (!opts) opts = {};
var flags = { bools : {}, strings : {} };
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
});
var aliases = {};
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
var defaults = opts['default'] || {};
var argv = { _ : [] };
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--')+1);
args = args.slice(0, args.indexOf('--'));
}
function setArg (key, val) {
var value = !flags.strings[key] && isNumber(val)
? Number(val) : val
;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (/^--.+=/.test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
setArg(m[1], m[2]);
}
else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
setArg(key, false);
}
else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !/^-/.test(next)
&& !flags.bools[key]
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, next);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next === 'true');
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true);
}
}
else if (/^-[^-]+/.test(arg)) {
var letters = arg.slice(1,-1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
var next = arg.slice(j+2);
if (next === '-') {
setArg(letters[j], next)
continue;
}
if (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next);
broken = true;
break;
}
if (letters[j+1] && letters[j+1].match(/\W/)) {
setArg(letters[j], arg.slice(j+2));
broken = true;
break;
}
else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true);
}
}
var key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, args[i+1]);
i++;
}
else if (args[i+1] && /true|false/.test(args[i+1])) {
setArg(key, args[i+1] === 'true');
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true);
}
}
}
else {
argv._.push(
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
);
}
}
Object.keys(defaults).forEach(function (key) {
if (!hasKey(argv, key.split('.'))) {
setKey(argv, key.split('.'), defaults[key]);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[key]);
});
}
});
notFlags.forEach(function(key) {
argv._.push(key);
});
return argv;
};
function hasKey (obj, keys) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
o = (o[key] || {});
});
var key = keys[keys.length - 1];
return key in o;
}
function setKey (obj, keys, value) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
if (o[key] === undefined) o[key] = {};
o = o[key];
});
var key = keys[keys.length - 1];
if (o[key] === undefined || typeof o[key] === 'boolean') {
o[key] = value;
}
else if (Array.isArray(o[key])) {
o[key].push(value);
}
else {
o[key] = [ o[key], value ];
}
}
function isNumber (x) {
if (typeof x === 'number') return true;
if (/^0x[0-9a-f]+$/i.test(x)) return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
function longest (xs) {
return Math.max.apply(null, xs.map(function (x) { return x.length }));
}

Просмотреть файл

@ -1,68 +0,0 @@
{
"name": "minimist",
"version": "0.0.8",
"description": "parse argument options",
"main": "index.js",
"devDependencies": {
"tape": "~1.0.4",
"tap": "~0.4.0"
},
"scripts": {
"test": "tap test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/6..latest",
"ff/5",
"firefox/latest",
"chrome/10",
"chrome/latest",
"safari/5.1",
"safari/latest",
"opera/12"
]
},
"repository": {
"type": "git",
"url": "git://github.com/substack/minimist.git"
},
"homepage": "https://github.com/substack/minimist",
"keywords": [
"argv",
"getopt",
"parser",
"optimist"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/substack/minimist/issues"
},
"_id": "minimist@0.0.8",
"dist": {
"shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
"tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
},
"_from": "minimist@0.0.8",
"_npmVersion": "1.4.3",
"_npmUser": {
"name": "substack",
"email": "mail@substack.net"
},
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"directories": {},
"_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n x: 3,\n y: 4,\n n: 5,\n a: true,\n b: true,\n c: true,\n beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a string or array of strings to always treat as booleans\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown"
}

Просмотреть файл

@ -1,73 +0,0 @@
# minimist
parse argument options
This module is the guts of optimist's argument parser without all the
fanciful decoration.
[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)
[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)
# example
``` js
var argv = require('minimist')(process.argv.slice(2));
console.dir(argv);
```
```
$ node example/parse.js -a beep -b boop
{ _: [], a: 'beep', b: 'boop' }
```
```
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{ _: [ 'foo', 'bar', 'baz' ],
x: 3,
y: 4,
n: 5,
a: true,
b: true,
c: true,
beep: 'boop' }
```
# methods
``` js
var parseArgs = require('minimist')
```
## var argv = parseArgs(args, opts={})
Return an argument object `argv` populated with the array arguments from `args`.
`argv._` contains all the arguments that didn't have an option associated with
them.
Numeric-looking arguments will be returned as numbers unless `opts.string` or
`opts.boolean` is set for that argument name.
Any arguments after `'--'` will not be parsed and will end up in `argv._`.
options can be:
* `opts.string` - a string or array of strings argument names to always treat as
strings
* `opts.boolean` - a string or array of strings to always treat as booleans
* `opts.alias` - an object mapping string names to strings or arrays of string
argument names to use as aliases
* `opts.default` - an object mapping string argument names to default values
# install
With [npm](https://npmjs.org) do:
```
npm install minimist
```
# license
MIT

Просмотреть файл

@ -1,24 +0,0 @@
var parse = require('../');
var test = require('tape');
test('-', function (t) {
t.plan(5);
t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
t.deepEqual(
parse([ '-b', '-' ], { boolean: 'b' }),
{ b: true, _: [ '-' ] }
);
t.deepEqual(
parse([ '-s', '-' ], { string: 's' }),
{ s: '-', _: [] }
);
});
test('-a -- b', function (t) {
t.plan(3);
t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
});

Просмотреть файл

@ -1,20 +0,0 @@
var test = require('tape');
var parse = require('../');
test('boolean default true', function (t) {
var argv = parse([], {
boolean: 'sometrue',
default: { sometrue: true }
});
t.equal(argv.sometrue, true);
t.end();
});
test('boolean default false', function (t) {
var argv = parse([], {
boolean: 'somefalse',
default: { somefalse: false }
});
t.equal(argv.somefalse, false);
t.end();
});

Просмотреть файл

@ -1,16 +0,0 @@
var parse = require('../');
var test = require('tape');
test('dotted alias', function (t) {
var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
t.equal(argv.a.b, 22);
t.equal(argv.aa.bb, 22);
t.end();
});
test('dotted default', function (t) {
var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
t.equal(argv.a.b, 11);
t.equal(argv.aa.bb, 11);
t.end();
});

Просмотреть файл

@ -1,31 +0,0 @@
var test = require('tape');
var parse = require('../');
test('long opts', function (t) {
t.deepEqual(
parse([ '--bool' ]),
{ bool : true, _ : [] },
'long boolean'
);
t.deepEqual(
parse([ '--pow', 'xixxle' ]),
{ pow : 'xixxle', _ : [] },
'long capture sp'
);
t.deepEqual(
parse([ '--pow=xixxle' ]),
{ pow : 'xixxle', _ : [] },
'long capture eq'
);
t.deepEqual(
parse([ '--host', 'localhost', '--port', '555' ]),
{ host : 'localhost', port : 555, _ : [] },
'long captures sp'
);
t.deepEqual(
parse([ '--host=localhost', '--port=555' ]),
{ host : 'localhost', port : 555, _ : [] },
'long captures eq'
);
t.end();
});

Просмотреть файл

@ -1,318 +0,0 @@
var parse = require('../');
var test = require('tape');
test('parse args', function (t) {
t.deepEqual(
parse([ '--no-moo' ]),
{ moo : false, _ : [] },
'no'
);
t.deepEqual(
parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
{ v : ['a','b','c'], _ : [] },
'multi'
);
t.end();
});
test('comprehensive', function (t) {
t.deepEqual(
parse([
'--name=meowmers', 'bare', '-cats', 'woo',
'-h', 'awesome', '--multi=quux',
'--key', 'value',
'-b', '--bool', '--no-meep', '--multi=baz',
'--', '--not-a-flag', 'eek'
]),
{
c : true,
a : true,
t : true,
s : 'woo',
h : 'awesome',
b : true,
bool : true,
key : 'value',
multi : [ 'quux', 'baz' ],
meep : false,
name : 'meowmers',
_ : [ 'bare', '--not-a-flag', 'eek' ]
}
);
t.end();
});
test('nums', function (t) {
var argv = parse([
'-x', '1234',
'-y', '5.67',
'-z', '1e7',
'-w', '10f',
'--hex', '0xdeadbeef',
'789'
]);
t.deepEqual(argv, {
x : 1234,
y : 5.67,
z : 1e7,
w : '10f',
hex : 0xdeadbeef,
_ : [ 789 ]
});
t.deepEqual(typeof argv.x, 'number');
t.deepEqual(typeof argv.y, 'number');
t.deepEqual(typeof argv.z, 'number');
t.deepEqual(typeof argv.w, 'string');
t.deepEqual(typeof argv.hex, 'number');
t.deepEqual(typeof argv._[0], 'number');
t.end();
});
test('flag boolean', function (t) {
var argv = parse([ '-t', 'moo' ], { boolean: 't' });
t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('flag boolean value', function (t) {
var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
boolean: [ 't', 'verbose' ],
default: { verbose: true }
});
t.deepEqual(argv, {
verbose: false,
t: true,
_: ['moo']
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('flag boolean default false', function (t) {
var argv = parse(['moo'], {
boolean: ['t', 'verbose'],
default: { verbose: false, t: false }
});
t.deepEqual(argv, {
verbose: false,
t: false,
_: ['moo']
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('boolean groups', function (t) {
var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
boolean: ['x','y','z']
});
t.deepEqual(argv, {
x : true,
y : false,
z : true,
_ : [ 'one', 'two', 'three' ]
});
t.deepEqual(typeof argv.x, 'boolean');
t.deepEqual(typeof argv.y, 'boolean');
t.deepEqual(typeof argv.z, 'boolean');
t.end();
});
test('newlines in params' , function (t) {
var args = parse([ '-s', "X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
// reproduce in bash:
// VALUE="new
// line"
// node program.js --s="$VALUE"
args = parse([ "--s=X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
t.end();
});
test('strings' , function (t) {
var s = parse([ '-s', '0001234' ], { string: 's' }).s;
t.equal(s, '0001234');
t.equal(typeof s, 'string');
var x = parse([ '-x', '56' ], { string: 'x' }).x;
t.equal(x, '56');
t.equal(typeof x, 'string');
t.end();
});
test('stringArgs', function (t) {
var s = parse([ ' ', ' ' ], { string: '_' })._;
t.same(s.length, 2);
t.same(typeof s[0], 'string');
t.same(s[0], ' ');
t.same(typeof s[1], 'string');
t.same(s[1], ' ');
t.end();
});
test('empty strings', function(t) {
var s = parse([ '-s' ], { string: 's' }).s;
t.equal(s, '');
t.equal(typeof s, 'string');
var str = parse([ '--str' ], { string: 'str' }).str;
t.equal(str, '');
t.equal(typeof str, 'string');
var letters = parse([ '-art' ], {
string: [ 'a', 't' ]
});
t.equal(letters.a, '');
t.equal(letters.r, true);
t.equal(letters.t, '');
t.end();
});
test('slashBreak', function (t) {
t.same(
parse([ '-I/foo/bar/baz' ]),
{ I : '/foo/bar/baz', _ : [] }
);
t.same(
parse([ '-xyz/foo/bar/baz' ]),
{ x : true, y : true, z : '/foo/bar/baz', _ : [] }
);
t.end();
});
test('alias', function (t) {
var argv = parse([ '-f', '11', '--zoom', '55' ], {
alias: { z: 'zoom' }
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.f, 11);
t.end();
});
test('multiAlias', function (t) {
var argv = parse([ '-f', '11', '--zoom', '55' ], {
alias: { z: [ 'zm', 'zoom' ] }
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.z, argv.zm);
t.equal(argv.f, 11);
t.end();
});
test('nested dotted objects', function (t) {
var argv = parse([
'--foo.bar', '3', '--foo.baz', '4',
'--foo.quux.quibble', '5', '--foo.quux.o_O',
'--beep.boop'
]);
t.same(argv.foo, {
bar : 3,
baz : 4,
quux : {
quibble : 5,
o_O : true
}
});
t.same(argv.beep, { boop : true });
t.end();
});
test('boolean and alias with chainable api', function (t) {
var aliased = [ '-h', 'derp' ];
var regular = [ '--herp', 'derp' ];
var opts = {
herp: { alias: 'h', boolean: true }
};
var aliasedArgv = parse(aliased, {
boolean: 'herp',
alias: { h: 'herp' }
});
var propertyArgv = parse(regular, {
boolean: 'herp',
alias: { h: 'herp' }
});
var expected = {
herp: true,
h: true,
'_': [ 'derp' ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias with options hash', function (t) {
var aliased = [ '-h', 'derp' ];
var regular = [ '--herp', 'derp' ];
var opts = {
alias: { 'h': 'herp' },
boolean: 'herp'
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
'_': [ 'derp' ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias using explicit true', function (t) {
var aliased = [ '-h', 'true' ];
var regular = [ '--herp', 'true' ];
var opts = {
alias: { h: 'herp' },
boolean: 'h'
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
'_': [ ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
// regression, see https://github.com/substack/node-optimist/issues/71
test('boolean and --x=true', function(t) {
var parsed = parse(['--boool', '--other=true'], {
boolean: 'boool'
});
t.same(parsed.boool, true);
t.same(parsed.other, 'true');
parsed = parse(['--boool', '--other=false'], {
boolean: 'boool'
});
t.same(parsed.boool, true);
t.same(parsed.other, 'false');
t.end();
});

Просмотреть файл

@ -1,9 +0,0 @@
var parse = require('../');
var test = require('tape');
test('parse with modifier functions' , function (t) {
t.plan(1);
var argv = parse([ '-b', '123' ], { boolean: 'b' });
t.deepEqual(argv, { b: true, _: ['123'] });
});

Просмотреть файл

@ -1,67 +0,0 @@
var parse = require('../');
var test = require('tape');
test('numeric short args', function (t) {
t.plan(2);
t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
t.deepEqual(
parse([ '-123', '456' ]),
{ 1: true, 2: true, 3: 456, _: [] }
);
});
test('short', function (t) {
t.deepEqual(
parse([ '-b' ]),
{ b : true, _ : [] },
'short boolean'
);
t.deepEqual(
parse([ 'foo', 'bar', 'baz' ]),
{ _ : [ 'foo', 'bar', 'baz' ] },
'bare'
);
t.deepEqual(
parse([ '-cats' ]),
{ c : true, a : true, t : true, s : true, _ : [] },
'group'
);
t.deepEqual(
parse([ '-cats', 'meow' ]),
{ c : true, a : true, t : true, s : 'meow', _ : [] },
'short group next'
);
t.deepEqual(
parse([ '-h', 'localhost' ]),
{ h : 'localhost', _ : [] },
'short capture'
);
t.deepEqual(
parse([ '-h', 'localhost', '-p', '555' ]),
{ h : 'localhost', p : 555, _ : [] },
'short captures'
);
t.end();
});
test('mixed short bool and capture', function (t) {
t.same(
parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
{
f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ]
}
);
t.end();
});
test('short and long', function (t) {
t.deepEqual(
parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
{
f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ]
}
);
t.end();
});

Просмотреть файл

@ -1,8 +0,0 @@
var parse = require('../');
var test = require('tape');
test('whitespace should be whitespace' , function (t) {
t.plan(1);
var x = parse([ '-x', '\t' ]).x;
t.equal(x, '\t');
});

60
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,60 +0,0 @@
{
"name": "mkdirp",
"description": "Recursively mkdir, like `mkdir -p`",
"version": "0.5.1",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"main": "index.js",
"keywords": [
"mkdir",
"directory"
],
"repository": {
"type": "git",
"url": "git+https://github.com/substack/node-mkdirp.git"
},
"scripts": {
"test": "tap test/*.js"
},
"dependencies": {
"minimist": "0.0.8"
},
"devDependencies": {
"tap": "1",
"mock-fs": "2 >=2.7.0"
},
"bin": {
"mkdirp": "bin/cmd.js"
},
"license": "MIT",
"gitHead": "d4eff0f06093aed4f387e88e9fc301cb76beedc7",
"bugs": {
"url": "https://github.com/substack/node-mkdirp/issues"
},
"homepage": "https://github.com/substack/node-mkdirp#readme",
"_id": "mkdirp@0.5.1",
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
"_from": "mkdirp@>=0.5.0 <0.6.0",
"_npmVersion": "2.9.0",
"_nodeVersion": "2.0.0",
"_npmUser": {
"name": "substack",
"email": "substack@gmail.com"
},
"dist": {
"shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
"tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz"
},
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"readme": "ERROR: No README data found!"
}

100
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/readme.markdown сгенерированный поставляемый
Просмотреть файл

@ -1,100 +0,0 @@
# mkdirp
Like `mkdir -p`, but in node.js!
[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
# example
## pow.js
```js
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});
```
Output
```
pow!
```
And now /tmp/foo/bar/baz exists, huzzah!
# methods
```js
var mkdirp = require('mkdirp');
```
## mkdirp(dir, opts, cb)
Create a new directory and any necessary subdirectories at `dir` with octal
permission string `opts.mode`. If `opts` is a non-object, it will be treated as
the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
`cb(err, made)` fires with the error or the first directory `made`
that had to be created, if any.
You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
`opts.fs.stat(path, cb)`.
## mkdirp.sync(dir, opts)
Synchronously create a new directory and any necessary subdirectories at `dir`
with octal permission string `opts.mode`. If `opts` is a non-object, it will be
treated as the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
Returns the first directory that had to be created, if any.
You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and
`opts.fs.statSync(path)`.
# usage
This package also ships with a `mkdirp` command.
```
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Create each supplied directory including any necessary parent directories that
don't yet exist.
If the directory already exists, do nothing.
OPTIONS are:
-m, --mode If a directory needs to be created, set the mode as an octal
permission string.
```
# install
With [npm](http://npmjs.org) do:
```
npm install mkdirp
```
to get the library, or
```
npm install -g mkdirp
```
to get the command.
# license
MIT

41
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/chmod.js сгенерированный поставляемый
Просмотреть файл

@ -1,41 +0,0 @@
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
var _0744 = parseInt('0744', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
test('chmod-pre', function (t) {
var mode = _0744
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
t.end();
});
});
});
test('chmod', function (t) {
var mode = _0755
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.end();
});
});
});

38
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/clobber.js сгенерированный поставляемый
Просмотреть файл

@ -1,38 +0,0 @@
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
// a file in the way
var itw = ps.slice(0, 3).join('/');
test('clobber-pre', function (t) {
console.error("about to write to "+itw)
fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
fs.stat(itw, function (er, stat) {
t.ifError(er)
t.ok(stat && stat.isFile(), 'should be file')
t.end()
})
})
test('clobber', function (t) {
t.plan(2);
mkdirp(file, _0755, function (err) {
t.ok(err);
t.equal(err.code, 'ENOTDIR');
t.end();
});
});

28
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/mkdirp.js сгенерированный поставляемый
Просмотреть файл

@ -1,28 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('woo', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});

29
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/opts_fs.js сгенерированный поставляемый
Просмотреть файл

@ -1,29 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
t.ifError(err);
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
});

27
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/opts_fs_sync.js сгенерированный поставляемый
Просмотреть файл

@ -1,27 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp.sync(file, { fs: xfs, mode: _0755 });
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});

32
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/perm.js сгенерированный поставляемый
Просмотреть файл

@ -1,32 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('async perm', function (t) {
t.plan(5);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
test('async root perm', function (t) {
mkdirp('/tmp', _0755, function (err) {
if (err) t.fail(err);
t.end();
});
t.end();
});

36
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/perm_sync.js сгенерированный поставляемый
Просмотреть файл

@ -1,36 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync perm', function (t) {
t.plan(4);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
test('sync root perm', function (t) {
t.plan(3);
var file = '/tmp';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.ok(stat.isDirectory(), 'target not a directory');
})
});
});

37
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/race.js сгенерированный поставляемый
Просмотреть файл

@ -1,37 +0,0 @@
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('race', function (t) {
t.plan(10);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
var res = 2;
mk(file);
mk(file);
function mk (file, cb) {
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
}
});

32
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/rel.js сгенерированный поставляемый
Просмотреть файл

@ -1,32 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('rel', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var cwd = process.cwd();
process.chdir('/tmp');
var file = [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
process.chdir(cwd);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});

25
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/return.js сгенерированный поставляемый
Просмотреть файл

@ -1,25 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, '/tmp/' + x);
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, null);
});
});
});

24
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/return_sync.js сгенерированный поставляемый
Просмотреть файл

@ -1,24 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(2);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
// Note that this will throw on failure, which will fail the test.
var made = mkdirp.sync(file);
t.equal(made, '/tmp/' + x);
// making the same file again should have no effect.
made = mkdirp.sync(file);
t.equal(made, null);
});

19
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/root.js сгенерированный поставляемый
Просмотреть файл

@ -1,19 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
test('root', function (t) {
// '/' on unix, 'c:/' on windows.
var file = path.resolve('/');
mkdirp(file, _0755, function (err) {
if (err) throw err
fs.stat(file, function (er, stat) {
if (er) throw er
t.ok(stat.isDirectory(), 'target is a directory');
t.end();
})
});
});

32
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/sync.js сгенерированный поставляемый
Просмотреть файл

@ -1,32 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file, _0755);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});

28
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/umask.js сгенерированный поставляемый
Просмотреть файл

@ -1,28 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('implicit mode from umask', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
});

32
node_modules/lockdown/node_modules/npmconf/node_modules/mkdirp/test/umask_sync.js сгенерированный поставляемый
Просмотреть файл

@ -1,32 +0,0 @@
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('umask sync modes', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, (_0777 & (~process.umask())));
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});

1
node_modules/lockdown/node_modules/npmconf/node_modules/nopt/.npmignore сгенерированный поставляемый
Просмотреть файл

@ -1 +0,0 @@
node_modules

9
node_modules/lockdown/node_modules/npmconf/node_modules/nopt/.travis.yml сгенерированный поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
language: node_js
language: node_js
node_js:
- '0.8'
- '0.10'
- '0.12'
- 'iojs'
before_install:
- npm install -g npm@latest

15
node_modules/lockdown/node_modules/npmconf/node_modules/nopt/LICENSE сгенерированный поставляемый
Просмотреть файл

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

211
node_modules/lockdown/node_modules/npmconf/node_modules/nopt/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,211 +0,0 @@
If you want to write an option parser, and have it be good, there are
two ways to do it. The Right Way, and the Wrong Way.
The Wrong Way is to sit down and write an option parser. We've all done
that.
The Right Way is to write some complex configurable program with so many
options that you hit the limit of your frustration just trying to
manage them all, and defer it with duct-tape solutions until you see
exactly to the core of the problem, and finally snap and write an
awesome option parser.
If you want to write an option parser, don't write an option parser.
Write a package manager, or a source control system, or a service
restarter, or an operating system. You probably won't end up with a
good one of those, but if you don't give up, and you are relentless and
diligent enough in your procrastination, you may just end up with a very
nice option parser.
## USAGE
// my-program.js
var nopt = require("nopt")
, Stream = require("stream").Stream
, path = require("path")
, knownOpts = { "foo" : [String, null]
, "bar" : [Stream, Number]
, "baz" : path
, "bloo" : [ "big", "medium", "small" ]
, "flag" : Boolean
, "pick" : Boolean
, "many1" : [String, Array]
, "many2" : [path]
}
, shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
, "b7" : ["--bar", "7"]
, "m" : ["--bloo", "medium"]
, "p" : ["--pick"]
, "f" : ["--flag"]
}
// everything is optional.
// knownOpts and shorthands default to {}
// arg list defaults to process.argv
// slice defaults to 2
, parsed = nopt(knownOpts, shortHands, process.argv, 2)
console.log(parsed)
This would give you support for any of the following:
```bash
$ node my-program.js --foo "blerp" --no-flag
{ "foo" : "blerp", "flag" : false }
$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
{ bar: 7, foo: "Mr. Hand", flag: true }
$ node my-program.js --foo "blerp" -f -----p
{ foo: "blerp", flag: true, pick: true }
$ node my-program.js -fp --foofoo
{ foo: "Mr. Foo", flag: true, pick: true }
$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.
{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
$ node my-program.js --blatzk -fp # unknown opts are ok.
{ blatzk: true, flag: true, pick: true }
$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
{ blatzk: 1000, flag: true, pick: true }
$ node my-program.js --no-blatzk -fp # unless they start with "no-"
{ blatzk: false, flag: true, pick: true }
$ node my-program.js --baz b/a/z # known paths are resolved.
{ baz: "/Users/isaacs/b/a/z" }
# if Array is one of the types, then it can take many
# values, and will always be an array. The other types provided
# specify what types are allowed in the list.
$ node my-program.js --many1 5 --many1 null --many1 foo
{ many1: ["5", "null", "foo"] }
$ node my-program.js --many2 foo --many2 bar
{ many2: ["/path/to/foo", "path/to/bar"] }
```
Read the tests at the bottom of `lib/nopt.js` for more examples of
what this puppy can do.
## Types
The following types are supported, and defined on `nopt.typeDefs`
* String: A normal string. No parsing is done.
* path: A file system path. Gets resolved against cwd if not absolute.
* url: A url. If it doesn't parse, it isn't accepted.
* Number: Must be numeric.
* Date: Must parse as a date. If it does, and `Date` is one of the options,
then it will return a Date object, not a string.
* Boolean: Must be either `true` or `false`. If an option is a boolean,
then it does not need a value, and its presence will imply `true` as
the value. To negate boolean flags, do `--no-whatever` or `--whatever
false`
* NaN: Means that the option is strictly not allowed. Any value will
fail.
* Stream: An object matching the "Stream" class in node. Valuable
for use when validating programmatically. (npm uses this to let you
supply any WriteStream on the `outfd` and `logfd` config options.)
* Array: If `Array` is specified as one of the types, then the value
will be parsed as a list of options. This means that multiple values
can be specified, and that the value will always be an array.
If a type is an array of values not on this list, then those are
considered valid values. For instance, in the example above, the
`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
and any other value will be rejected.
When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
interpreted as their JavaScript equivalents.
You can also mix types and values, or multiple types, in a list. For
instance `{ blah: [Number, null] }` would allow a value to be set to
either a Number or null. When types are ordered, this implies a
preference, and the first type that can be used to properly interpret
the value will be used.
To define a new type, add it to `nopt.typeDefs`. Each item in that
hash is an object with a `type` member and a `validate` method. The
`type` member is an object that matches what goes in the type list. The
`validate` method is a function that gets called with `validate(data,
key, val)`. Validate methods should assign `data[key]` to the valid
value of `val` if it can be handled properly, or return boolean
`false` if it cannot.
You can also call `nopt.clean(data, types, typeDefs)` to clean up a
config object and remove its invalid properties.
## Error Handling
By default, nopt outputs a warning to standard error when invalid values for
known options are found. You can change this behavior by assigning a method
to `nopt.invalidHandler`. This method will be called with
the offending `nopt.invalidHandler(key, val, types)`.
If no `nopt.invalidHandler` is assigned, then it will console.error
its whining. If it is assigned to boolean `false` then the warning is
suppressed.
## Abbreviations
Yes, they are supported. If you define options like this:
```javascript
{ "foolhardyelephants" : Boolean
, "pileofmonkeys" : Boolean }
```
Then this will work:
```bash
node program.js --foolhar --pil
node program.js --no-f --pileofmon
# etc.
```
## Shorthands
Shorthands are a hash of shorter option names to a snippet of args that
they expand to.
If multiple one-character shorthands are all combined, and the
combination does not unambiguously match any other option or shorthand,
then they will be broken up into their constituent parts. For example:
```json
{ "s" : ["--loglevel", "silent"]
, "g" : "--global"
, "f" : "--force"
, "p" : "--parseable"
, "l" : "--long"
}
```
```bash
npm ls -sgflp
# just like doing this:
npm ls --loglevel silent --global --force --long --parseable
```
## The Rest of the args
The config object returned by nopt is given a special member called
`argv`, which is an object with the following fields:
* `remain`: The remaining args after all the parsing has occurred.
* `original`: The args as they originally appeared.
* `cooked`: The args after flags and shorthands are expanded.
## Slicing
Node programs are called with more or less the exact argv as it appears
in C land, after the v8 and node-specific options have been plucked off.
As such, `argv[0]` is always `node` and `argv[1]` is always the
JavaScript program being run.
That's usually not very useful to you. So they're sliced off by
default. If you want them, then you can pass in `0` as the last
argument, or any other number that you'd like to slice off the start of
the list.

54
node_modules/lockdown/node_modules/npmconf/node_modules/nopt/bin/nopt.js сгенерированный поставляемый
Просмотреть файл

@ -1,54 +0,0 @@
#!/usr/bin/env node
var nopt = require("../lib/nopt")
, path = require("path")
, types = { num: Number
, bool: Boolean
, help: Boolean
, list: Array
, "num-list": [Number, Array]
, "str-list": [String, Array]
, "bool-list": [Boolean, Array]
, str: String
, clear: Boolean
, config: Boolean
, length: Number
, file: path
}
, shorthands = { s: [ "--str", "astring" ]
, b: [ "--bool" ]
, nb: [ "--no-bool" ]
, tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
, "?": ["--help"]
, h: ["--help"]
, H: ["--help"]
, n: [ "--num", "125" ]
, c: ["--config"]
, l: ["--length"]
, f: ["--file"]
}
, parsed = nopt( types
, shorthands
, process.argv
, 2 )
console.log("parsed", parsed)
if (parsed.help) {
console.log("")
console.log("nopt cli tester")
console.log("")
console.log("types")
console.log(Object.keys(types).map(function M (t) {
var type = types[t]
if (Array.isArray(type)) {
return [t, type.map(function (type) { return type.name })]
}
return [t, type && type.name]
}).reduce(function (s, i) {
s[i[0]] = i[1]
return s
}, {}))
console.log("")
console.log("shorthands")
console.log(shorthands)
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше