mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
importing all bundled deps to git
This commit is contained in:
parent
a5cd498f92
commit
34c12de81c
219 changed files with 21256 additions and 7 deletions
17
.gitignore
vendored
17
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
package.json
|
||||
/package.json
|
||||
npm-debug.log
|
||||
sinopia-*.tgz
|
||||
.DS_Store
|
||||
|
@ -8,3 +7,17 @@ sinopia-*.tgz
|
|||
bin/**
|
||||
!bin/sinopia
|
||||
test-storage*
|
||||
|
||||
# ignoring everything except bundled deps
|
||||
/node_modules/*
|
||||
!/node_modules/mkdirp
|
||||
!/node_modules/unopinionate
|
||||
!/node_modules/onclick
|
||||
!/node_modules/onscroll
|
||||
!/node_modules/transition-complete
|
||||
!/node_modules/helpers.less
|
||||
!/node_modules/tar.gz
|
||||
!/node_modules/sinopia-htpasswd
|
||||
!/node_modules/crypt3
|
||||
!/node_modules/http-errors
|
||||
|
||||
|
|
16
node_modules/crypt3/.gitignore
generated
vendored
Normal file
16
node_modules/crypt3/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
||||
build/
|
20
node_modules/crypt3/LICENSE
generated
vendored
Normal file
20
node_modules/crypt3/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Sendanor
|
||||
|
||||
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.
|
43
node_modules/crypt3/README.md
generated
vendored
Normal file
43
node_modules/crypt3/README.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
node-crypt3
|
||||
===========
|
||||
|
||||
[crypt3link]: https://en.wikipedia.org/wiki/Crypt_(C) "crypt() in C"
|
||||
|
||||
[crypt(3)][crypt3link] for Node.js
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install using `npm install crypt3` and use:
|
||||
|
||||
```javascript
|
||||
var crypt = require('crypt3');
|
||||
```
|
||||
|
||||
Example password check
|
||||
----------------------
|
||||
|
||||
```javascript
|
||||
if( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/') !== '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/' ) {
|
||||
console.error('Access denied!');
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
Example password encoding
|
||||
-------------------------
|
||||
|
||||
Use `crypt(key[, salt])`:
|
||||
|
||||
```javascript
|
||||
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh') ); // Salt generated automatically using default SHA512
|
||||
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('md5') ) ); // MD5 salt
|
||||
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('blowfish') ) ); // Blowfish salt (only some Linux distros)
|
||||
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha256') ) ); // SHA-256
|
||||
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha512') ) ); // SHA-512
|
||||
```
|
||||
|
||||
Create hashes
|
||||
-------------
|
||||
|
||||
Use `crypt.createSalt([type=sha512])` where type is one of `md5`, `blowfish`, `sha256` or `sha512` (default).
|
14
node_modules/crypt3/binding.gyp
generated
vendored
Normal file
14
node_modules/crypt3/binding.gyp
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "crypt3",
|
||||
"sources": [ "crypt3.cc" ],
|
||||
"include_dirs" : [ "<!(node -e \"require('nan')\")" ],
|
||||
"conditions": [
|
||||
['OS!="mac"', {
|
||||
'link_settings': { "libraries": [ "-lcrypt" ] }
|
||||
}]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
39
node_modules/crypt3/crypt3.cc
generated
vendored
Normal file
39
node_modules/crypt3/crypt3.cc
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* Node.js Crypt(3) implementation */
|
||||
|
||||
#include <node.h>
|
||||
#include <v8.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h> // for crypt if _XOPEN_SOURCE exists
|
||||
#include <nan.h>
|
||||
|
||||
using namespace v8;
|
||||
|
||||
NAN_METHOD(Method) {
|
||||
NanScope();
|
||||
|
||||
if (args.Length() < 2) {
|
||||
return NanThrowTypeError("Wrong number of arguments");
|
||||
}
|
||||
|
||||
if (!args[0]->IsString() || !args[1]->IsString()) {
|
||||
return NanThrowTypeError("Wrong arguments");
|
||||
}
|
||||
|
||||
v8::String::Utf8Value key(args[0]->ToString());
|
||||
v8::String::Utf8Value salt(args[1]->ToString());
|
||||
|
||||
char* res = crypt(*key, *salt);
|
||||
if (res != NULL) {
|
||||
NanReturnValue(NanNew<String>(res));
|
||||
} else {
|
||||
return NanThrowError(node::ErrnoException(errno, "crypt"));
|
||||
}
|
||||
}
|
||||
|
||||
void init(Handle<Object> exports) {
|
||||
exports->Set(NanNew<String>("crypt"), NanNew<FunctionTemplate>(Method)->GetFunction());
|
||||
}
|
||||
|
||||
NODE_MODULE(crypt3, init)
|
||||
|
||||
/* EOF */
|
33
node_modules/crypt3/index.js
generated
vendored
Normal file
33
node_modules/crypt3/index.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/** Node.js Crypt(3) Library */
|
||||
|
||||
var salters = {
|
||||
'md5': function() { return '$1$'+require('crypto').randomBytes(10).toString('base64'); },
|
||||
'blowfish': function() { return '$2a$'+require('crypto').randomBytes(10).toString('base64'); },
|
||||
'sha256': function() { return '$5$'+require('crypto').randomBytes(10).toString('base64'); },
|
||||
'sha512': function() { return '$6$'+require('crypto').randomBytes(10).toString('base64'); }
|
||||
};
|
||||
|
||||
function createSalt(type) {
|
||||
type = type || 'sha512';
|
||||
if(!salters[type]) throw new TypeError('Unknown salt type at crypt3.createSalt: ' + type);
|
||||
return salters[type]();
|
||||
};
|
||||
|
||||
/** Crypt(3) password and data encryption.
|
||||
* @param {string} key user's typed password
|
||||
* @param {string} salt Optional salt, for example SHA-512 use "$6$salt$".
|
||||
* @returns {string} A generated hash in format $id$salt$encrypted
|
||||
* @see https://en.wikipedia.org/wiki/Crypt_(C)
|
||||
*/
|
||||
var crypt3 = module.exports = function(key, salt) {
|
||||
salt = salt || createSalt();
|
||||
return require('./build/Release/crypt3').crypt(key, salt);
|
||||
};
|
||||
|
||||
/** Create salt
|
||||
* @param {string} type The type of salt: md5, blowfish (only some linux distros), sha256 or sha512. Default is sha512.
|
||||
* @returns {string} Generated salt string
|
||||
*/
|
||||
crypt3.createSalt = createSalt;
|
||||
|
||||
/* EOF */
|
40
node_modules/crypt3/package.json
generated
vendored
Normal file
40
node_modules/crypt3/package.json
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "crypt3",
|
||||
"version": "0.1.5",
|
||||
"description": "Node.js crypt(3) bindings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test/test.js",
|
||||
"install": "node-gyp rebuild"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sendanor/node-crypt3.git"
|
||||
},
|
||||
"keywords": [
|
||||
"crypt",
|
||||
"password",
|
||||
"md5",
|
||||
"sha256",
|
||||
"sha512",
|
||||
"blowfish",
|
||||
"hash"
|
||||
],
|
||||
"dependencies": { "nan": "~1.3.0" },
|
||||
"author": {
|
||||
"name": "Jaakko-Heikki Heusala",
|
||||
"email": "jheusala@iki.fi"
|
||||
},
|
||||
"license": "MIT",
|
||||
"gypfile": true,
|
||||
"readme": "node-crypt3\n===========\n\n[crypt3link]: https://en.wikipedia.org/wiki/Crypt_(C) \"crypt() in C\"\n\n[crypt(3)][crypt3link] for Node.js\n\nInstallation\n------------\n\nInstall using `npm install crypt3` and use:\n\n```javascript\nvar crypt = require('crypt3');\n```\n\nExample password check\n----------------------\n\n```javascript\nif( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/') !== '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/' ) {\n\tconsole.error('Access denied!');\n\treturn;\n}\n```\n\nExample password encoding\n-------------------------\n\nUse `crypt(key[, salt])`:\n\n```javascript\nconsole.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh') ); // Salt generated automatically using default SHA512\nconsole.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('md5') ) ); // MD5 salt\nconsole.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('blowfish') ) ); // Blowfish salt (only some Linux distros)\nconsole.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha256') ) ); // SHA-256\nconsole.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha512') ) ); // SHA-512\n```\n\nCreate hashes\n-------------\n\nUse `crypt.createSalt([type=sha512])` where type is one of `md5`, `blowfish`, `sha256` or `sha512` (default). \n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sendanor/node-crypt3/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sendanor/node-crypt3",
|
||||
"_id": "crypt3@0.1.5",
|
||||
"_shasum": "f21e9ba7a57736f47e0654ad27f8668966de02db",
|
||||
"_resolved": "git://github.com/sendanor/node-crypt3.git#9b893c95ed956adc3da681b125c371112b1ad31d",
|
||||
"_from": "crypt3@git://github.com/sendanor/node-crypt3.git"
|
||||
}
|
14
node_modules/crypt3/test/test.js
generated
vendored
Normal file
14
node_modules/crypt3/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
var assert = require('assert')
|
||||
var crypt3 = require('../')
|
||||
|
||||
assert.throws(function() {
|
||||
crypt3()
|
||||
}, /Wrong arguments/)
|
||||
|
||||
assert.equal(crypt3('pass', 'salt'), 'sa5JEXtYx/rm6')
|
||||
assert.equal(crypt3('pass', 'sa5JEXtYx/rm6'), 'sa5JEXtYx/rm6')
|
||||
|
||||
var hash = crypt3('password')
|
||||
assert.equal(crypt3('password', hash), hash)
|
||||
assert.notEqual(crypt3('bad-pass', hash), hash)
|
||||
|
43
node_modules/helpers.less/.gitignore
generated
vendored
Executable file
43
node_modules/helpers.less/.gitignore
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Node Stuff #
|
||||
##############
|
||||
node_modules/
|
||||
|
||||
|
17
node_modules/helpers.less/Gruntfile.js
generated
vendored
Normal file
17
node_modules/helpers.less/Gruntfile.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
browserify: {
|
||||
'dist/subview.js': ['src/main.js'],
|
||||
'examples/build.js': ['examples/example.js']
|
||||
},
|
||||
watch: {
|
||||
files: [ "src/*.js", "examples/example.js"],
|
||||
tasks: [ 'browserify' ]
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
};
|
||||
|
11
node_modules/helpers.less/README.md
generated
vendored
Normal file
11
node_modules/helpers.less/README.md
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
To Build:
|
||||
|
||||
```bash
|
||||
grunt browserify
|
||||
```
|
||||
|
||||
To Develop:
|
||||
|
||||
```bash
|
||||
grunt watch
|
||||
```
|
123
node_modules/helpers.less/helpers.less
generated
vendored
Normal file
123
node_modules/helpers.less/helpers.less
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
.backface-visibility(@style) {
|
||||
-webkit-backface-visibility: @style;
|
||||
-moz-backface-visibility: @style;
|
||||
-ms-backface-visibility: @style;
|
||||
-o-backface-visibility: @style;
|
||||
backface-visibility: @style;
|
||||
}
|
||||
|
||||
.perspective(@style) {
|
||||
-webkit-perspective: @style;
|
||||
-moz-perspective: @style;
|
||||
-ms-perspective: @style;
|
||||
-o-perspective: @style;
|
||||
perspective: @style;
|
||||
}
|
||||
|
||||
.border-radius(@radius) {
|
||||
-webkit-border-radius: @radius;
|
||||
-moz-border-radius: @radius;
|
||||
border-radius: @radius;
|
||||
}
|
||||
|
||||
.border-radius-topleft(@radius) {
|
||||
-moz-border-radius-topleft: @radius;
|
||||
border-top-left-radius: @radius;
|
||||
}
|
||||
|
||||
.border-radius-topright(@radius) {
|
||||
-moz-border-radius-topright: @radius;
|
||||
border-top-right-radius: @radius;
|
||||
}
|
||||
|
||||
.border-radius-bottomleft(@radius) {
|
||||
-moz-border-radius-bottomleft: @radius;
|
||||
border-bottom-left-radius: @radius;
|
||||
}
|
||||
|
||||
.border-radius-bottomright(@radius) {
|
||||
-moz-border-radius-bottomright: @radius;
|
||||
border-bottom-right-radius: @radius;
|
||||
}
|
||||
|
||||
.no-select() {
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.do-select() {
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
-khtml-user-select: text;
|
||||
-webkit-user-select: text;
|
||||
-o-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.border-box() {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.box-shadow(@value1, @value2:X, ...) {
|
||||
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
|
||||
-moz-box-shadow: @value;
|
||||
-webkit-box-shadow: @value;
|
||||
box-shadow: @value;
|
||||
}
|
||||
|
||||
.transition(@value1, @value2:X, ...) {
|
||||
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
|
||||
|
||||
-webkit-transition: @value;
|
||||
-moz-transition: @value;
|
||||
-ms-transition: @value;
|
||||
-o-transition: @value;
|
||||
transition: @value;
|
||||
}
|
||||
|
||||
.transformTransition(@value1, @value2:X, ...) {
|
||||
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
|
||||
|
||||
-webkit-transition: -webkit-transform @value;
|
||||
-moz-transition: -moz-transform @value;
|
||||
-ms-transition: -ms-transform @value;
|
||||
-o-transition: -o-transform @value;
|
||||
transition: transform @value;
|
||||
}
|
||||
|
||||
.animation(@value1, @value2:X, ...) {
|
||||
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
|
||||
|
||||
-webkit-animation: @value;
|
||||
-moz-animation: @value;
|
||||
-o-animation: @value;
|
||||
animation: @value;
|
||||
}
|
||||
|
||||
.transform(@value1, @value2:X, ...) {
|
||||
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
|
||||
|
||||
-webkit-transform: @value;
|
||||
-moz-transform: @value;
|
||||
-o-transform: @value;
|
||||
-ms-transform: @value;
|
||||
transform: @value;
|
||||
}
|
||||
|
||||
.rotate(@deg) {
|
||||
.transform(rotate(@deg));
|
||||
}
|
||||
|
||||
.scale(@ratio) {
|
||||
.transform(scale(@ratio, @ratio));
|
||||
}
|
||||
|
||||
.translate(@x, @y) {
|
||||
.transform(translate(@x, @y));
|
||||
}
|
27
node_modules/helpers.less/package.json
generated
vendored
Normal file
27
node_modules/helpers.less/package.json
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "helpers.less",
|
||||
"description": "A set of very convenient less helpers.",
|
||||
"version": "0.1.0",
|
||||
"author": {
|
||||
"name": "Brian Peacock"
|
||||
},
|
||||
"main": "helpers.less",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bpeacock/helpers.less"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"license": "MIT",
|
||||
"keywords": [],
|
||||
"readme": "To Build:\n\n```bash\ngrunt browserify\n```\n\nTo Develop:\n\n```bash\ngrunt watch\n```",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bpeacock/helpers.less/issues"
|
||||
},
|
||||
"homepage": "https://github.com/bpeacock/helpers.less",
|
||||
"_id": "helpers.less@0.1.0",
|
||||
"_shasum": "d77d92fb3f710e0807f00bd2de920a9e4374799a",
|
||||
"_resolved": "git://github.com/bpeacock/helpers.less.git#4184c4abac632b4b14129ec9ef6e1173370adc22",
|
||||
"_from": "helpers.less@git://github.com/bpeacock/helpers.less.git"
|
||||
}
|
22
node_modules/http-errors/LICENSE
generated
vendored
Normal file
22
node_modules/http-errors/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
63
node_modules/http-errors/README.md
generated
vendored
Normal file
63
node_modules/http-errors/README.md
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
|
||||
# http-errors
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![Build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![Dependency Status][david-image]][david-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
Create HTTP errors for Express, Koa, Connect, etc. with ease.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var createError = require('http-errors');
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.user) return next(createError(401, 'Please login to view this page.'));
|
||||
next();
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This is the current API, currently extracted from Koa and subject to change.
|
||||
|
||||
### Error Properties
|
||||
|
||||
- `message`
|
||||
- `status` and `statusCode` - the status code of the error, defaulting to `500`
|
||||
|
||||
### createError([status], [message], [properties])
|
||||
|
||||
```js
|
||||
var err = createError(404, 'This video does not exist!');
|
||||
```
|
||||
|
||||
- `status: 500` - the status code as a number
|
||||
- `message` - the message of the error, defaulting to node's text for that status code.
|
||||
- `properties` - custom properties to attach to the object
|
||||
|
||||
### new createError\[code || name\](\[msg]\))
|
||||
|
||||
```js
|
||||
var err = new createError.NotFound();
|
||||
```
|
||||
|
||||
- `code` - the status code as a number
|
||||
- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/http-errors
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/jshttp/http-errors
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master
|
||||
[david-image]: http://img.shields.io/david/jshttp/http-errors.svg?style=flat-square
|
||||
[david-url]: https://david-dm.org/jshttp/http-errors
|
||||
[license-image]: http://img.shields.io/npm/l/http-errors.svg?style=flat-square
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/http-errors.svg?style=flat-square
|
||||
[downloads-url]: https://npmjs.org/package/http-errors
|
75
node_modules/http-errors/index.js
generated
vendored
Normal file
75
node_modules/http-errors/index.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
var statuses = require('statuses');
|
||||
var inherits = require('util').inherits;
|
||||
|
||||
exports = module.exports = function () {
|
||||
// so much arity going on ~_~
|
||||
var err;
|
||||
var msg;
|
||||
var status = 500;
|
||||
var props = {};
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var arg = arguments[i];
|
||||
if (arg instanceof Error) {
|
||||
err = arg;
|
||||
status = err.status || err.statusCode || status;
|
||||
continue;
|
||||
}
|
||||
switch (typeof arg) {
|
||||
case 'string':
|
||||
msg = arg;
|
||||
break;
|
||||
case 'number':
|
||||
status = arg;
|
||||
break;
|
||||
case 'object':
|
||||
props = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof status !== 'number' || !statuses[status]) status = 500;
|
||||
err = err || new Error(msg || statuses[status]);
|
||||
err = err || new Error(msg || statuses[status]);
|
||||
err.expose = status < 500;
|
||||
for (var key in props) err[key] = props[key];
|
||||
err.status = err.statusCode = status;
|
||||
return err;
|
||||
};
|
||||
|
||||
// create generic error objects
|
||||
var codes = statuses.codes.filter(function (num) {
|
||||
return num >= 400;
|
||||
});
|
||||
|
||||
codes.forEach(function (code) {
|
||||
if (code >= 500) {
|
||||
var ServerError = function ServerError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, arguments.callee)
|
||||
self.__proto__ = ServerError.prototype
|
||||
return self
|
||||
}
|
||||
inherits(ServerError, Error);
|
||||
ServerError.prototype.status =
|
||||
ServerError.prototype.statusCode = code;
|
||||
ServerError.prototype.expose = false;
|
||||
exports[code] =
|
||||
exports[statuses[code].replace(/\s+/g, '')] = ServerError;
|
||||
return;
|
||||
}
|
||||
|
||||
var ClientError = function ClientError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, arguments.callee)
|
||||
self.__proto__ = ClientError.prototype
|
||||
return self
|
||||
}
|
||||
inherits(ClientError, Error);
|
||||
ClientError.prototype.status =
|
||||
ClientError.prototype.statusCode = code;
|
||||
ClientError.prototype.expose = false;
|
||||
exports[code] =
|
||||
exports[statuses[code].replace(/\s+/g, '')] = ClientError;
|
||||
return;
|
||||
});
|
92
node_modules/http-errors/node_modules/statuses/README.md
generated
vendored
Normal file
92
node_modules/http-errors/node_modules/statuses/README.md
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Statuses
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![Dependency Status][david-image]][david-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
HTTP status utility for node.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var status = require('statuses');
|
||||
```
|
||||
|
||||
### var code = status(Integer || String)
|
||||
|
||||
If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.
|
||||
|
||||
```js
|
||||
status(403) // => 403
|
||||
status('403') // => 403
|
||||
status('forbidden') // => 403
|
||||
status('Forbidden') // => 403
|
||||
status(306) // throws, as it's not supported by node.js
|
||||
```
|
||||
|
||||
### status.codes
|
||||
|
||||
Returns an array of all the status codes as `Integer`s.
|
||||
|
||||
### var msg = status[code]
|
||||
|
||||
Map of `code` to `status message`. `undefined` for invalid `code`s.
|
||||
|
||||
```js
|
||||
status[404] // => 'Not Found'
|
||||
```
|
||||
|
||||
### var code = status[msg]
|
||||
|
||||
Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.
|
||||
|
||||
```js
|
||||
status['not found'] // => 404
|
||||
status['Not Found'] // => 404
|
||||
```
|
||||
|
||||
### status.redirect[code]
|
||||
|
||||
Returns `true` if a status code is a valid redirect status.
|
||||
|
||||
```js
|
||||
status.redirect[200] // => undefined
|
||||
status.redirect[301] // => true
|
||||
```
|
||||
|
||||
### status.empty[code]
|
||||
|
||||
Returns `true` if a status code expects an empty body.
|
||||
|
||||
```js
|
||||
status.empty[200] // => undefined
|
||||
status.empty[204] // => true
|
||||
status.empty[304] // => true
|
||||
```
|
||||
|
||||
### status.retry[code]
|
||||
|
||||
Returns `true` if you should retry the rest.
|
||||
|
||||
```js
|
||||
status.retry[501] // => undefined
|
||||
status.retry[503] // => true
|
||||
```
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/statuses
|
||||
[github-tag]: http://img.shields.io/github/tag/jshttp/statuses.svg?style=flat-square
|
||||
[github-url]: https://github.com/jshttp/statuses/tags
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/jshttp/statuses
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
|
||||
[david-image]: http://img.shields.io/david/jshttp/statuses.svg?style=flat-square
|
||||
[david-url]: https://david-dm.org/jshttp/statuses
|
||||
[license-image]: http://img.shields.io/npm/l/statuses.svg?style=flat-square
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat-square
|
||||
[downloads-url]: https://npmjs.org/package/statuses
|
||||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
||||
[gittip-url]: https://www.gittip.com/jonathanong/
|
60
node_modules/http-errors/node_modules/statuses/index.js
generated
vendored
Normal file
60
node_modules/http-errors/node_modules/statuses/index.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
var http = require('http');
|
||||
var codes = http.STATUS_CODES;
|
||||
|
||||
module.exports = status;
|
||||
|
||||
// [Integer...]
|
||||
status.codes = Object.keys(codes).map(function (code) {
|
||||
code = ~~code;
|
||||
var msg = codes[code];
|
||||
status[code] = msg;
|
||||
status[msg] = status[msg.toLowerCase()] = code;
|
||||
return code;
|
||||
});
|
||||
|
||||
// status codes for redirects
|
||||
status.redirect = {
|
||||
300: true,
|
||||
301: true,
|
||||
302: true,
|
||||
303: true,
|
||||
305: true,
|
||||
307: true,
|
||||
308: true,
|
||||
};
|
||||
|
||||
// status codes for empty bodies
|
||||
status.empty = {
|
||||
204: true,
|
||||
205: true,
|
||||
304: true,
|
||||
};
|
||||
|
||||
// status codes for when you should retry the request
|
||||
status.retry = {
|
||||
502: true,
|
||||
503: true,
|
||||
504: true,
|
||||
};
|
||||
|
||||
function status(code) {
|
||||
if (typeof code === 'number') {
|
||||
if (!status[code]) throw new Error('invalid status code: ' + code);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (typeof code !== 'string') {
|
||||
throw new TypeError('code must be a number or string');
|
||||
}
|
||||
|
||||
// '403'
|
||||
var n = parseInt(code, 10)
|
||||
if (!isNaN(n)) {
|
||||
if (!status[n]) return new Error('invalid status code: ' + n);
|
||||
return n;
|
||||
}
|
||||
|
||||
n = status[code.toLowerCase()];
|
||||
if (!n) throw new Error('invalid status message: "' + code + '"');
|
||||
return n;
|
||||
}
|
33
node_modules/http-errors/node_modules/statuses/package.json
generated
vendored
Normal file
33
node_modules/http-errors/node_modules/statuses/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "statuses",
|
||||
"description": "HTTP status utility",
|
||||
"version": "1.0.4",
|
||||
"author": {
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jshttp/statuses"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"http",
|
||||
"status",
|
||||
"code"
|
||||
],
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"readme": "# Statuses\n\n[![NPM version][npm-image]][npm-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nHTTP status utility for node.\n\n## API\n\n```js\nvar status = require('statuses');\n```\n\n### var code = status(Integer || String)\n\nIf `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.\n\n```js\nstatus(403) // => 403\nstatus('403') // => 403\nstatus('forbidden') // => 403\nstatus('Forbidden') // => 403\nstatus(306) // throws, as it's not supported by node.js\n```\n\n### status.codes\n\nReturns an array of all the status codes as `Integer`s.\n\n### var msg = status[code]\n\nMap of `code` to `status message`. `undefined` for invalid `code`s.\n\n```js\nstatus[404] // => 'Not Found'\n```\n\n### var code = status[msg]\n\nMap of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.\n\n```js\nstatus['not found'] // => 404\nstatus['Not Found'] // => 404\n```\n\n### status.redirect[code]\n\nReturns `true` if a status code is a valid redirect status.\n\n```js\nstatus.redirect[200] // => undefined\nstatus.redirect[301] // => true\n```\n\n### status.empty[code]\n\nReturns `true` if a status code expects an empty body.\n\n```js\nstatus.empty[200] // => undefined\nstatus.empty[204] // => true\nstatus.empty[304] // => true\n```\n\n### status.retry[code]\n\nReturns `true` if you should retry the rest.\n\n```js\nstatus.retry[501] // => undefined\nstatus.retry[503] // => true\n```\n\n[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/statuses\n[github-tag]: http://img.shields.io/github/tag/jshttp/statuses.svg?style=flat-square\n[github-url]: https://github.com/jshttp/statuses/tags\n[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat-square\n[travis-url]: https://travis-ci.org/jshttp/statuses\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master\n[david-image]: http://img.shields.io/david/jshttp/statuses.svg?style=flat-square\n[david-url]: https://david-dm.org/jshttp/statuses\n[license-image]: http://img.shields.io/npm/l/statuses.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/statuses\n[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square\n[gittip-url]: https://www.gittip.com/jonathanong/\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/statuses/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jshttp/statuses",
|
||||
"_id": "statuses@1.0.4",
|
||||
"_shasum": "a8b203f645cf475a66426f6be690205c85f3ebdd",
|
||||
"_from": "statuses@~1.0.4",
|
||||
"_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.0.4.tgz"
|
||||
}
|
45
node_modules/http-errors/package.json
generated
vendored
Normal file
45
node_modules/http-errors/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "http-errors",
|
||||
"description": "Create HTTP error objects",
|
||||
"version": "1.2.0",
|
||||
"author": {
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jshttp/http-errors"
|
||||
},
|
||||
"dependencies": {
|
||||
"statuses": "~1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0",
|
||||
"mocha": "1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
||||
},
|
||||
"keywords": [
|
||||
"http",
|
||||
"error"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"readme": "\n# http-errors\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nCreate HTTP errors for Express, Koa, Connect, etc. with ease.\n\n## Example\n\n```js\nvar createError = require('http-errors');\n\napp.use(function (req, res, next) {\n if (!req.user) return next(createError(401, 'Please login to view this page.'));\n next();\n})\n```\n\n## API\n\nThis is the current API, currently extracted from Koa and subject to change.\n\n### Error Properties\n\n- `message`\n- `status` and `statusCode` - the status code of the error, defaulting to `500`\n\n### createError([status], [message], [properties])\n\n```js\nvar err = createError(404, 'This video does not exist!');\n```\n\n- `status: 500` - the status code as a number\n- `message` - the message of the error, defaulting to node's text for that status code.\n- `properties` - custom properties to attach to the object\n\n### new createError\\[code || name\\](\\[msg]\\))\n\n```js\nvar err = new createError.NotFound();\n```\n\n- `code` - the status code as a number\n- `name` - the name of the error as a \"bumpy case\", i.e. `NotFound` or `InternalServerError`.\n\n[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/http-errors\n[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat-square\n[travis-url]: https://travis-ci.org/jshttp/http-errors\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master\n[david-image]: http://img.shields.io/david/jshttp/http-errors.svg?style=flat-square\n[david-url]: https://david-dm.org/jshttp/http-errors\n[license-image]: http://img.shields.io/npm/l/http-errors.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/http-errors.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/http-errors\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/http-errors/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jshttp/http-errors",
|
||||
"_id": "http-errors@1.2.0",
|
||||
"_shasum": "936739e42c3e9b778d84b30bce32802fd5eb9c75",
|
||||
"_from": "http-errors@~1.2.0",
|
||||
"_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.2.0.tgz"
|
||||
}
|
2
node_modules/mkdirp/.npmignore
generated
vendored
Normal file
2
node_modules/mkdirp/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
npm-debug.log
|
5
node_modules/mkdirp/.travis.yml
generated
vendored
Normal file
5
node_modules/mkdirp/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
- "0.10"
|
21
node_modules/mkdirp/LICENSE
generated
vendored
Normal file
21
node_modules/mkdirp/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
Copyright 2010 James Halliday (mail@substack.net)
|
||||
|
||||
This project is free software released under the MIT/X11 license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
33
node_modules/mkdirp/bin/cmd.js
generated
vendored
Executable file
33
node_modules/mkdirp/bin/cmd.js
generated
vendored
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/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/mkdirp/bin/usage.txt
generated
vendored
Normal file
12
node_modules/mkdirp/bin/usage.txt
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
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/mkdirp/examples/pow.js
generated
vendored
Normal file
6
node_modules/mkdirp/examples/pow.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
var mkdirp = require('mkdirp');
|
||||
|
||||
mkdirp('/tmp/foo/bar/baz', function (err) {
|
||||
if (err) console.error(err)
|
||||
else console.log('pow!')
|
||||
});
|
97
node_modules/mkdirp/index.js
generated
vendored
Normal file
97
node_modules/mkdirp/index.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
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;
|
||||
};
|
4
node_modules/mkdirp/node_modules/minimist/.travis.yml
generated
vendored
Normal file
4
node_modules/mkdirp/node_modules/minimist/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
node_modules/mkdirp/node_modules/minimist/LICENSE
generated
vendored
Normal file
18
node_modules/mkdirp/node_modules/minimist/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
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.
|
2
node_modules/mkdirp/node_modules/minimist/example/parse.js
generated
vendored
Normal file
2
node_modules/mkdirp/node_modules/minimist/example/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
var argv = require('../')(process.argv.slice(2));
|
||||
console.dir(argv);
|
187
node_modules/mkdirp/node_modules/minimist/index.js
generated
vendored
Normal file
187
node_modules/mkdirp/node_modules/minimist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,187 @@
|
|||
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 }));
|
||||
}
|
49
node_modules/mkdirp/node_modules/minimist/package.json
generated
vendored
Normal file
49
node_modules/mkdirp/node_modules/minimist/package.json
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"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",
|
||||
"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",
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/minimist/issues"
|
||||
},
|
||||
"_id": "minimist@0.0.8",
|
||||
"_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
|
||||
"_from": "minimist@0.0.8",
|
||||
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
|
||||
}
|
73
node_modules/mkdirp/node_modules/minimist/readme.markdown
generated
vendored
Normal file
73
node_modules/mkdirp/node_modules/minimist/readme.markdown
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
# 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
|
24
node_modules/mkdirp/node_modules/minimist/test/dash.js
generated
vendored
Normal file
24
node_modules/mkdirp/node_modules/minimist/test/dash.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
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' ] });
|
||||
});
|
20
node_modules/mkdirp/node_modules/minimist/test/default_bool.js
generated
vendored
Normal file
20
node_modules/mkdirp/node_modules/minimist/test/default_bool.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
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();
|
||||
});
|
16
node_modules/mkdirp/node_modules/minimist/test/dotted.js
generated
vendored
Normal file
16
node_modules/mkdirp/node_modules/minimist/test/dotted.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
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();
|
||||
});
|
31
node_modules/mkdirp/node_modules/minimist/test/long.js
generated
vendored
Normal file
31
node_modules/mkdirp/node_modules/minimist/test/long.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
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();
|
||||
});
|
318
node_modules/mkdirp/node_modules/minimist/test/parse.js
generated
vendored
Normal file
318
node_modules/mkdirp/node_modules/minimist/test/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,318 @@
|
|||
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();
|
||||
});
|
9
node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
generated
vendored
Normal file
9
node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
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'] });
|
||||
});
|
67
node_modules/mkdirp/node_modules/minimist/test/short.js
generated
vendored
Normal file
67
node_modules/mkdirp/node_modules/minimist/test/short.js
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
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();
|
||||
});
|
8
node_modules/mkdirp/node_modules/minimist/test/whitespace.js
generated
vendored
Normal file
8
node_modules/mkdirp/node_modules/minimist/test/whitespace.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
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');
|
||||
});
|
43
node_modules/mkdirp/package.json
generated
vendored
Normal file
43
node_modules/mkdirp/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "mkdirp",
|
||||
"description": "Recursively mkdir, like `mkdir -p`",
|
||||
"version": "0.5.0",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"main": "./index",
|
||||
"keywords": [
|
||||
"mkdir",
|
||||
"directory"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/substack/node-mkdirp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "~0.4.0",
|
||||
"mock-fs": "~2.2.0"
|
||||
},
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, opts, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `opts.mode`. If `opts` is a non-object, it will be treated as\nthe `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and\n`opts.fs.stat(path, cb)`.\n\n## mkdirp.sync(dir, opts)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `opts.mode`. If `opts` is a non-object, it will be\ntreated as the `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and\n`opts.fs.statSync(path)`.\n\n# usage\n\nThis package also ships with a `mkdirp` command.\n\n```\nusage: mkdirp [DIR1,DIR2..] {OPTIONS}\n\n Create each supplied directory including any necessary parent directories that\n don't yet exist.\n \n If the directory already exists, do nothing.\n\nOPTIONS are:\n\n -m, --mode If a directory needs to be created, set the mode as an octal\n permission string.\n\n```\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\nto get the library, or\n\n```\nnpm install -g mkdirp\n```\n\nto get the command.\n\n# license\n\nMIT\n",
|
||||
"readmeFilename": "readme.markdown",
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-mkdirp/issues"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-mkdirp",
|
||||
"_id": "mkdirp@0.5.0",
|
||||
"_shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12",
|
||||
"_from": "mkdirp@>=0.3.5 <1.0.0-0",
|
||||
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz"
|
||||
}
|
100
node_modules/mkdirp/readme.markdown
generated
vendored
Normal file
100
node_modules/mkdirp/readme.markdown
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
# 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
|
38
node_modules/mkdirp/test/chmod.js
generated
vendored
Normal file
38
node_modules/mkdirp/test/chmod.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
|
||||
var file = ps.join('/');
|
||||
|
||||
test('chmod-pre', function (t) {
|
||||
var mode = 0744
|
||||
mkdirp(file, mode, function (er) {
|
||||
t.ifError(er, 'should not error');
|
||||
fs.stat(file, function (er, stat) {
|
||||
t.ifError(er, 'should exist');
|
||||
t.ok(stat && stat.isDirectory(), 'should be directory');
|
||||
t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('chmod', function (t) {
|
||||
var mode = 0755
|
||||
mkdirp(file, mode, function (er) {
|
||||
t.ifError(er, 'should not error');
|
||||
fs.stat(file, function (er, stat) {
|
||||
t.ifError(er, 'should exist');
|
||||
t.ok(stat && stat.isDirectory(), 'should be directory');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
37
node_modules/mkdirp/test/clobber.js
generated
vendored
Normal file
37
node_modules/mkdirp/test/clobber.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
|
||||
var file = ps.join('/');
|
||||
|
||||
// a file in the way
|
||||
var itw = ps.slice(0, 3).join('/');
|
||||
|
||||
|
||||
test('clobber-pre', function (t) {
|
||||
console.error("about to write to "+itw)
|
||||
fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
|
||||
|
||||
fs.stat(itw, function (er, stat) {
|
||||
t.ifError(er)
|
||||
t.ok(stat && stat.isFile(), 'should be file')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('clobber', function (t) {
|
||||
t.plan(2);
|
||||
mkdirp(file, 0755, function (err) {
|
||||
t.ok(err);
|
||||
t.equal(err.code, 'ENOTDIR');
|
||||
t.end();
|
||||
});
|
||||
});
|
26
node_modules/mkdirp/test/mkdirp.js
generated
vendored
Normal file
26
node_modules/mkdirp/test/mkdirp.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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');
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
27
node_modules/mkdirp/test/opts_fs.js
generated
vendored
Normal file
27
node_modules/mkdirp/test/opts_fs.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var test = require('tap').test;
|
||||
var mockfs = require('mock-fs');
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
25
node_modules/mkdirp/test/opts_fs_sync.js
generated
vendored
Normal file
25
node_modules/mkdirp/test/opts_fs_sync.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var test = require('tap').test;
|
||||
var mockfs = require('mock-fs');
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
30
node_modules/mkdirp/test/perm.js
generated
vendored
Normal file
30
node_modules/mkdirp/test/perm.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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();
|
||||
});
|
34
node_modules/mkdirp/test/perm_sync.js
generated
vendored
Normal file
34
node_modules/mkdirp/test/perm_sync.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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');
|
||||
})
|
||||
});
|
||||
});
|
40
node_modules/mkdirp/test/race.js
generated
vendored
Normal file
40
node_modules/mkdirp/test/race.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
test('race', function (t) {
|
||||
t.plan(6);
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
var file = ps.join('/');
|
||||
|
||||
var res = 2;
|
||||
mk(file, function () {
|
||||
if (--res === 0) t.end();
|
||||
});
|
||||
|
||||
mk(file, function () {
|
||||
if (--res === 0) t.end();
|
||||
});
|
||||
|
||||
function mk (file, cb) {
|
||||
mkdirp(file, 0755, function (err) {
|
||||
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');
|
||||
if (cb) cb();
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
30
node_modules/mkdirp/test/rel.js
generated
vendored
Normal file
30
node_modules/mkdirp/test/rel.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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/mkdirp/test/return.js
generated
vendored
Normal file
25
node_modules/mkdirp/test/return.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('return value', function (t) {
|
||||
t.plan(4);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
|
||||
var file = '/tmp/' + [x,y,z].join('/');
|
||||
|
||||
// should return the first dir created.
|
||||
// By this point, it would be profoundly surprising if /tmp didn't
|
||||
// already exist, since every other test makes things in there.
|
||||
mkdirp(file, function (err, made) {
|
||||
t.ifError(err);
|
||||
t.equal(made, '/tmp/' + x);
|
||||
mkdirp(file, function (err, made) {
|
||||
t.ifError(err);
|
||||
t.equal(made, null);
|
||||
});
|
||||
});
|
||||
});
|
24
node_modules/mkdirp/test/return_sync.js
generated
vendored
Normal file
24
node_modules/mkdirp/test/return_sync.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('return value', function (t) {
|
||||
t.plan(2);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
|
||||
var file = '/tmp/' + [x,y,z].join('/');
|
||||
|
||||
// should return the first dir created.
|
||||
// By this point, it would be profoundly surprising if /tmp didn't
|
||||
// already exist, since every other test makes things in there.
|
||||
// Note that this will throw on failure, which will fail the test.
|
||||
var made = mkdirp.sync(file);
|
||||
t.equal(made, '/tmp/' + x);
|
||||
|
||||
// making the same file again should have no effect.
|
||||
made = mkdirp.sync(file);
|
||||
t.equal(made, null);
|
||||
});
|
18
node_modules/mkdirp/test/root.js
generated
vendored
Normal file
18
node_modules/mkdirp/test/root.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('root', function (t) {
|
||||
// '/' on unix, 'c:/' on windows.
|
||||
var file = path.resolve('/');
|
||||
|
||||
mkdirp(file, 0755, function (err) {
|
||||
if (err) throw err
|
||||
fs.stat(file, function (er, stat) {
|
||||
if (er) throw er
|
||||
t.ok(stat.isDirectory(), 'target is a directory');
|
||||
t.end();
|
||||
})
|
||||
});
|
||||
});
|
30
node_modules/mkdirp/test/sync.js
generated
vendored
Normal file
30
node_modules/mkdirp/test/sync.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
26
node_modules/mkdirp/test/umask.js
generated
vendored
Normal file
26
node_modules/mkdirp/test/umask.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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');
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
30
node_modules/mkdirp/test/umask_sync.js
generated
vendored
Normal file
30
node_modules/mkdirp/test/umask_sync.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
43
node_modules/onclick/.npmignore
generated
vendored
Executable file
43
node_modules/onclick/.npmignore
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Node Stuff #
|
||||
##############
|
||||
node_modules/
|
||||
|
||||
|
6
node_modules/onclick/.travis.yml
generated
vendored
Normal file
6
node_modules/onclick/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
before_script:
|
||||
- npm install grunt-cli -g
|
61
node_modules/onclick/Gruntfile.js
generated
vendored
Normal file
61
node_modules/onclick/Gruntfile.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
browserify: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/onClick.js': ['src/onClick.js'],
|
||||
'examples/build.js': ['examples/example.js']
|
||||
},
|
||||
options: {
|
||||
standalone: 'onClick'
|
||||
}
|
||||
},
|
||||
test: {
|
||||
files: {
|
||||
'test/build.js': ['test/test.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/onClick.min.js': ['dist/onClick.js']
|
||||
},
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: [ "src/*.js", "examples/example.js", "test/test.js"],
|
||||
tasks: [ 'browserify:dist' ]
|
||||
},
|
||||
qunit: {
|
||||
files: ['test/index.html']
|
||||
},
|
||||
jshint: {
|
||||
dist: {
|
||||
src: ['src/**/*.js']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
|
||||
grunt.registerTask('test', [
|
||||
'browserify:test',
|
||||
'qunit',
|
||||
'jshint'
|
||||
]);
|
||||
|
||||
grunt.registerTask('build', [
|
||||
'test',
|
||||
'browserify:dist',
|
||||
'uglify'
|
||||
]);
|
||||
};
|
47
node_modules/onclick/README.md
generated
vendored
Normal file
47
node_modules/onclick/README.md
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
onClick.js [![Build Status](https://travis-ci.org/bpeacock/onClick.png?branch=master)](https://travis-ci.org/bpeacock/onClick)
|
||||
===============
|
||||
|
||||
A click controller for mouse & touch.
|
||||
|
||||
- Prevents 300ms delay on touch
|
||||
- Touch interactions like scrolling work as expected
|
||||
- Handles devices that have both touch and mouse
|
||||
- Delegates events for efficiency
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
```bash
|
||||
npm install onclick
|
||||
```
|
||||
|
||||
A jQuery-like selector library is required:
|
||||
- jQuery 1.4.3+
|
||||
- Zepto
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```javascript
|
||||
onClick({
|
||||
'#element': function(e) {
|
||||
alert("I was clicked!");
|
||||
}
|
||||
});
|
||||
|
||||
onClick('.myclass', function() {
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
Check out a live [example](http://htmlpreview.github.io/?https://github.com/bpeacock/onClick/blob/master/examples/index.html).
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
To Build: `grunt build`
|
||||
|
||||
To Develop: `grunt watch`
|
||||
|
||||
To Test: `npm test`
|
||||
|
195
node_modules/onclick/dist/onClick.js
generated
vendored
Normal file
195
node_modules/onclick/dist/onClick.js
generated
vendored
Normal file
|
@ -0,0 +1,195 @@
|
|||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.onClick=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
(function(root) {
|
||||
var unopinionate = {
|
||||
selector: root.jQuery || root.Zepto || root.ender || root.$,
|
||||
template: root.Handlebars || root.Mustache
|
||||
};
|
||||
|
||||
/*** Export ***/
|
||||
|
||||
//AMD
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
define([], function() {
|
||||
return unopinionate;
|
||||
});
|
||||
}
|
||||
//CommonJS
|
||||
else if(typeof module.exports !== 'undefined') {
|
||||
module.exports = unopinionate;
|
||||
}
|
||||
//Global
|
||||
else {
|
||||
root.unopinionate = unopinionate;
|
||||
}
|
||||
})(typeof window != 'undefined' ? window : global);
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],2:[function(_dereq_,module,exports){
|
||||
var $ = _dereq_('unopinionate').selector;
|
||||
|
||||
var $document = $(document),
|
||||
bindings = {};
|
||||
|
||||
var click = function(events) {
|
||||
click.bind.apply(click, arguments);
|
||||
return click;
|
||||
};
|
||||
|
||||
/*** Configuration Options ***/
|
||||
click.distanceLimit = 10;
|
||||
click.timeLimit = 140;
|
||||
|
||||
/*** Useful Properties ***/
|
||||
click.isTouch = ('ontouchstart' in window) ||
|
||||
window.DocumentTouch &&
|
||||
document instanceof DocumentTouch;
|
||||
|
||||
/*** Cached Functions ***/
|
||||
var onTouchstart = function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
|
||||
click._doAnywheres(e);
|
||||
|
||||
var $this = $(this),
|
||||
startTime = new Date().getTime(),
|
||||
startPos = click._getPos(e);
|
||||
|
||||
$this.one('touchend', function(e) {
|
||||
e.preventDefault(); //Prevents click event from firing
|
||||
|
||||
var time = new Date().getTime() - startTime,
|
||||
endPos = click._getPos(e),
|
||||
distance = Math.sqrt(
|
||||
Math.pow(endPos.x - startPos.x, 2) +
|
||||
Math.pow(endPos.y - startPos.y, 2)
|
||||
);
|
||||
|
||||
if(time < click.timeLimit && distance < click.distanceLimit) {
|
||||
//Find the correct callback
|
||||
$.each(bindings, function(selector, callback) {
|
||||
if($this.is(selector)) {
|
||||
callback.apply(e.target, [e]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*** API ***/
|
||||
click.bind = function(events) {
|
||||
|
||||
//Argument Surgery
|
||||
if(!$.isPlainObject(events)) {
|
||||
newEvents = {};
|
||||
newEvents[arguments[0]] = arguments[1];
|
||||
events = newEvents;
|
||||
}
|
||||
|
||||
$.each(events, function(selector, callback) {
|
||||
|
||||
/*** Register Binding ***/
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
click.unbind(selector); //Ensure no duplicates
|
||||
}
|
||||
|
||||
bindings[selector] = callback;
|
||||
|
||||
/*** Touch Support ***/
|
||||
if(click.isTouch) {
|
||||
$document.delegate(selector, 'touchstart', onTouchstart);
|
||||
}
|
||||
|
||||
/*** Mouse Support ***/
|
||||
$document.delegate(selector, 'click', function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
//click._doAnywheres(e); //Do anywheres first to be consistent with touch order
|
||||
callback.apply(this, [e]);
|
||||
});
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbind = function(selector) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
|
||||
delete bindings[selector];
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbindAll = function() {
|
||||
$.each(bindings, function(selector, callback) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
});
|
||||
|
||||
bindings = {};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.trigger = function(selector, e) {
|
||||
e = e || $.Event('click');
|
||||
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
bindings[selector](e);
|
||||
}
|
||||
else {
|
||||
console.error("No click events bound for selector '"+selector+"'.");
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.anywhere = function(callback) {
|
||||
click._anywheres.push(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
/*** Internal (but useful) Methods ***/
|
||||
click._getPos = function(e) {
|
||||
e = e.originalEvent;
|
||||
|
||||
if(e.pageX || e.pageY) {
|
||||
return {
|
||||
x: e.pageX,
|
||||
y: e.pageY
|
||||
};
|
||||
}
|
||||
else if(e.changedTouches) {
|
||||
return {
|
||||
x: e.changedTouches[0].clientX,
|
||||
y: e.changedTouches[0].clientY
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
|
||||
y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
click._anywheres = [];
|
||||
|
||||
click._doAnywheres = function(e) {
|
||||
var i = click._anywheres.length;
|
||||
while(i--) {
|
||||
click._anywheres[i](e);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).bind('mousedown', click._doAnywheres);
|
||||
|
||||
module.exports = click;
|
||||
|
||||
|
||||
},{"unopinionate":1}]},{},[2])
|
||||
(2)
|
||||
});
|
2
node_modules/onclick/dist/onClick.min.js
generated
vendored
Normal file
2
node_modules/onclick/dist/onClick.min.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.onClick=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c){(function(b){!function(b){var d={selector:b.jQuery||b.Zepto||b.ender||b.$,template:b.Handlebars||b.Mustache};"function"==typeof a&&a.amd?a([],function(){return d}):"undefined"!=typeof c.exports?c.exports=d:b.unopinionate=d}("undefined"!=typeof window?window:b)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(a,b){var c=a("unopinionate").selector,d=c(document),e={},f=function(a){return f.bind(a),f};f.distanceLimit=10,f.timeLimit=140,f.isTouch="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;var g=function(a){var b=c(this),d=(new Date).getTime(),g=f._getPos(a);b.one("touchend",function(a){a.preventDefault();var h=(new Date).getTime()-d,i=f._getPos(a),j=Math.sqrt(Math.pow(i.x-g.x,2)+Math.pow(i.y-g.y,2));h<f.timeLimit&&j<f.distanceLimit&&c.each(e,function(c,d){return b.is(c)?(d.apply(a.target,[a]),!1):void 0})})};f.bind=function(a){return c.isPlainObject(a)||(newEvents={},newEvents[arguments[0]]=arguments[1],a=newEvents),c.each(a,function(a,b){"undefined"!=typeof e[a]&&f.unbind(a),e[a]=b,f.isTouch&&d.delegate(a,"touchstart",g),d.delegate(a,"click",b)}),this},f.unbind=function(a){return d.undelegate(a,"touchstart").undelegate(a,"click"),delete e[a],this},f.unbindAll=function(){return c.each(e,function(a){d.undelegate(a,"touchstart").undelegate(a,"click")}),e={},this},f.trigger=function(a,b){return b=b||c.Event("click"),"undefined"!=typeof e[a]?e[a](b):console.error("No click events bound for selector '"+a+"'."),this},f._getPos=function(a){return a=a.originalEvent,a.pageX||a.pageY?{x:a.pageX,y:a.pageY}:a.changedTouches?{x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY}:{x:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,y:a.clientY+document.body.scrollTop+document.documentElement.scrollTop}},b.exports=f},{unopinionate:1}]},{},[2])(2)});
|
||||
//# sourceMappingURL=onClick.min.map
|
1
node_modules/onclick/dist/onClick.min.map
generated
vendored
Normal file
1
node_modules/onclick/dist/onClick.min.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"onClick.min.js","sources":["onClick.js"],"names":["e","exports","module","define","amd","f","window","global","self","onClick","t","n","r","s","o","u","a","require","i","Error","call","length",1,"_dereq_","root","unopinionate","selector","jQuery","Zepto","ender","$","template","Handlebars","Mustache","this",2,"$document","document","bindings","click","events","bind","distanceLimit","timeLimit","isTouch","DocumentTouch","onTouchstart","$this","startTime","Date","getTime","startPos","_getPos","one","preventDefault","time","endPos","distance","Math","sqrt","pow","x","y","each","callback","is","apply","target","isPlainObject","newEvents","arguments","unbind","delegate","undelegate","unbindAll","trigger","Event","console","error","originalEvent","pageX","pageY","changedTouches","clientX","clientY","body","scrollLeft","documentElement","scrollTop"],"mappings":"CAAC,SAASA,GAAG,GAAG,gBAAiBC,SAAQC,OAAOD,QAAQD,QAAS,IAAG,kBAAmBG,SAAQA,OAAOC,IAAID,OAAOH,OAAO,CAAC,GAAIK,EAAE,oBAAoBC,QAAOD,EAAEC,OAAO,mBAAoBC,QAAOF,EAAEE,OAAO,mBAAoBC,QAAOH,EAAEG,MAAMH,EAAEI,QAAQT,MAAM,WAAW,GAAIG,EAAsB,OAAO,SAAUH,GAAEU,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATC,UAAqBA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGI,EAAE,MAAOA,GAAEJ,GAAE,EAAI,MAAM,IAAIK,OAAM,uBAAuBL,EAAE,KAAK,GAAIT,GAAEM,EAAEG,IAAIb,WAAYS,GAAEI,GAAG,GAAGM,KAAKf,EAAEJ,QAAQ,SAASD,GAAG,GAAIW,GAAED,EAAEI,GAAG,GAAGd,EAAG,OAAOa,GAAEF,EAAEA,EAAEX,IAAIK,EAAEA,EAAEJ,QAAQD,EAAEU,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGb,QAAkD,IAAI,GAA1CiB,GAAkB,kBAATD,UAAqBA,QAAgBH,EAAE,EAAEA,EAAEF,EAAES,OAAOP,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKS,GAAG,SAASC,EAAQrB,IACptB,SAAWK,IACX,SAAUiB,GACN,GAAIC,IACAC,SAAUF,EAAKG,QAAUH,EAAKI,OAASJ,EAAKK,OAASL,EAAKM,EAC1DC,SAAUP,EAAKQ,YAAcR,EAAKS,SAMjB,mBAAX9B,IAAyBA,EAAOC,IACtCD,KAAW,WACP,MAAOsB,KAImB,mBAAnBvB,GAAOD,QAClBC,EAAOD,QAAUwB,EAIjBD,EAAKC,aAAeA,GAER,mBAAVnB,QAAwBA,OAASC,KAExCa,KAAKc,KAAqB,mBAAT1B,MAAuBA,KAAyB,mBAAXF,QAAyBA,gBAC5E6B,GAAG,SAASZ,EAAQrB,GAC1B,GAAI4B,GAAIP,EAAQ,gBAAgBG,SAE5BU,EAAcN,EAAEO,UAChBC,KAEAC,EAAQ,SAASC,GAEjB,MADAD,GAAME,KAAKD,GACJD,EAIXA,GAAMG,cAAgB,GACtBH,EAAMI,UAAgB,IAGtBJ,EAAMK,QAAW,gBAAkBtC,SACnBA,OAAOuC,eACPR,mBAAoBQ,cAGpC,IAAIC,GAAe,SAAS9C,GACxB,GAAI+C,GAAcjB,EAAEI,MAChBc,GAAc,GAAIC,OAAOC,UACzBC,EAAcZ,EAAMa,QAAQpD,EAEhC+C,GAAMM,IAAI,WAAY,SAASrD,GAC3BA,EAAEsD,gBAEF,IAAIC,IAAc,GAAIN,OAAOC,UAAYF,EACrCQ,EAAcjB,EAAMa,QAAQpD,GAC5ByD,EAAcC,KAAKC,KACfD,KAAKE,IAAIJ,EAAOK,EAAIV,EAASU,EAAG,GAChCH,KAAKE,IAAIJ,EAAOM,EAAIX,EAASW,EAAG,GAGrCP,GAAOhB,EAAMI,WAAac,EAAWlB,EAAMG,eAE1CZ,EAAEiC,KAAKzB,EAAU,SAASZ,EAAUsC,GAChC,MAAGjB,GAAMkB,GAAGvC,IACRsC,EAASE,MAAMlE,EAAEmE,QAASnE,KACnB,GAFX,WAUhBuC,GAAME,KAAO,SAASD,GA2BlB,MAxBIV,GAAEsC,cAAc5B,KAChB6B,aACAA,UAAUC,UAAU,IAAMA,UAAU,GACpC9B,EAAS6B,WAGbvC,EAAEiC,KAAKvB,EAAQ,SAASd,EAAUsC,GAGE,mBAAtB1B,GAASZ,IACfa,EAAMgC,OAAO7C,GAGjBY,EAASZ,GAAYsC,EAGlBzB,EAAMK,SACLR,EAAUoC,SAAS9C,EAAU,aAAcoB,GAI/CV,EAAUoC,SAAS9C,EAAU,QAASsC,KAGnC9B,MAGXK,EAAMgC,OAAS,SAAS7C,GAOpB,MANAU,GACKqC,WAAW/C,EAAU,cACrB+C,WAAW/C,EAAU,eAEnBY,GAASZ,GAETQ,MAGXK,EAAMmC,UAAY,WASd,MARA5C,GAAEiC,KAAKzB,EAAU,SAASZ,GACtBU,EACKqC,WAAW/C,EAAU,cACrB+C,WAAW/C,EAAU,WAG9BY,KAEOJ,MAGXK,EAAMoC,QAAU,SAASjD,EAAU1B,GAU/B,MATAA,GAAIA,GAAK8B,EAAE8C,MAAM,SAEe,mBAAtBtC,GAASZ,GACfY,EAASZ,GAAU1B,GAGnB6E,QAAQC,MAAM,uCAAuCpD,EAAS,MAG3DQ,MAIXK,EAAMa,QAAU,SAASpD,GAGrB,MAFAA,GAAIA,EAAE+E,cAEH/E,EAAEgF,OAAShF,EAAEiF,OAERpB,EAAG7D,EAAEgF,MACLlB,EAAG9D,EAAEiF,OAGLjF,EAAEkF,gBAEFrB,EAAG7D,EAAEkF,eAAe,GAAGC,QACvBrB,EAAG9D,EAAEkF,eAAe,GAAGE,UAKvBvB,EAAG7D,EAAEmF,QAAU9C,SAASgD,KAAKC,WAAajD,SAASkD,gBAAgBD,WACnExB,EAAG9D,EAAEoF,QAAU/C,SAASgD,KAAKG,UAAanD,SAASkD,gBAAgBC,YAK/EtF,EAAOD,QAAUsC,IAGdd,aAAe,SAAS,IAC1B"}
|
208
node_modules/onclick/examples/build.js
generated
vendored
Normal file
208
node_modules/onclick/examples/build.js
generated
vendored
Normal file
|
@ -0,0 +1,208 @@
|
|||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.onClick=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
var click = _dereq_("../src/onClick.js");
|
||||
|
||||
click({
|
||||
'#element': function(e) {
|
||||
alert("You clicked!");
|
||||
}
|
||||
});
|
||||
|
||||
click('.elementSet', function(e) {
|
||||
alert("You clicked the set");
|
||||
});
|
||||
|
||||
},{"../src/onClick.js":3}],2:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
(function(root) {
|
||||
var unopinionate = {
|
||||
selector: root.jQuery || root.Zepto || root.ender || root.$,
|
||||
template: root.Handlebars || root.Mustache
|
||||
};
|
||||
|
||||
/*** Export ***/
|
||||
|
||||
//AMD
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
define([], function() {
|
||||
return unopinionate;
|
||||
});
|
||||
}
|
||||
//CommonJS
|
||||
else if(typeof module.exports !== 'undefined') {
|
||||
module.exports = unopinionate;
|
||||
}
|
||||
//Global
|
||||
else {
|
||||
root.unopinionate = unopinionate;
|
||||
}
|
||||
})(typeof window != 'undefined' ? window : global);
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],3:[function(_dereq_,module,exports){
|
||||
var $ = _dereq_('unopinionate').selector;
|
||||
|
||||
var $document = $(document),
|
||||
bindings = {};
|
||||
|
||||
var click = function(events) {
|
||||
click.bind.apply(click, arguments);
|
||||
return click;
|
||||
};
|
||||
|
||||
/*** Configuration Options ***/
|
||||
click.distanceLimit = 10;
|
||||
click.timeLimit = 140;
|
||||
|
||||
/*** Useful Properties ***/
|
||||
click.isTouch = ('ontouchstart' in window) ||
|
||||
window.DocumentTouch &&
|
||||
document instanceof DocumentTouch;
|
||||
|
||||
/*** Cached Functions ***/
|
||||
var onTouchstart = function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
|
||||
click._doAnywheres(e);
|
||||
|
||||
var $this = $(this),
|
||||
startTime = new Date().getTime(),
|
||||
startPos = click._getPos(e);
|
||||
|
||||
$this.one('touchend', function(e) {
|
||||
e.preventDefault(); //Prevents click event from firing
|
||||
|
||||
var time = new Date().getTime() - startTime,
|
||||
endPos = click._getPos(e),
|
||||
distance = Math.sqrt(
|
||||
Math.pow(endPos.x - startPos.x, 2) +
|
||||
Math.pow(endPos.y - startPos.y, 2)
|
||||
);
|
||||
|
||||
if(time < click.timeLimit && distance < click.distanceLimit) {
|
||||
//Find the correct callback
|
||||
$.each(bindings, function(selector, callback) {
|
||||
if($this.is(selector)) {
|
||||
callback.apply(e.target, [e]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*** API ***/
|
||||
click.bind = function(events) {
|
||||
|
||||
//Argument Surgery
|
||||
if(!$.isPlainObject(events)) {
|
||||
newEvents = {};
|
||||
newEvents[arguments[0]] = arguments[1];
|
||||
events = newEvents;
|
||||
}
|
||||
|
||||
$.each(events, function(selector, callback) {
|
||||
|
||||
/*** Register Binding ***/
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
click.unbind(selector); //Ensure no duplicates
|
||||
}
|
||||
|
||||
bindings[selector] = callback;
|
||||
|
||||
/*** Touch Support ***/
|
||||
if(click.isTouch) {
|
||||
$document.delegate(selector, 'touchstart', onTouchstart);
|
||||
}
|
||||
|
||||
/*** Mouse Support ***/
|
||||
$document.delegate(selector, 'click', function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
//click._doAnywheres(e); //Do anywheres first to be consistent with touch order
|
||||
callback.apply(this, [e]);
|
||||
});
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbind = function(selector) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
|
||||
delete bindings[selector];
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbindAll = function() {
|
||||
$.each(bindings, function(selector, callback) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
});
|
||||
|
||||
bindings = {};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.trigger = function(selector, e) {
|
||||
e = e || $.Event('click');
|
||||
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
bindings[selector](e);
|
||||
}
|
||||
else {
|
||||
console.error("No click events bound for selector '"+selector+"'.");
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.anywhere = function(callback) {
|
||||
click._anywheres.push(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
/*** Internal (but useful) Methods ***/
|
||||
click._getPos = function(e) {
|
||||
e = e.originalEvent;
|
||||
|
||||
if(e.pageX || e.pageY) {
|
||||
return {
|
||||
x: e.pageX,
|
||||
y: e.pageY
|
||||
};
|
||||
}
|
||||
else if(e.changedTouches) {
|
||||
return {
|
||||
x: e.changedTouches[0].clientX,
|
||||
y: e.changedTouches[0].clientY
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
|
||||
y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
click._anywheres = [];
|
||||
|
||||
click._doAnywheres = function(e) {
|
||||
var i = click._anywheres.length;
|
||||
while(i--) {
|
||||
click._anywheres[i](e);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).bind('mousedown', click._doAnywheres);
|
||||
|
||||
module.exports = click;
|
||||
|
||||
|
||||
},{"unopinionate":2}]},{},[1])
|
||||
(1)
|
||||
});
|
23
node_modules/onclick/examples/example.css
generated
vendored
Normal file
23
node_modules/onclick/examples/example.css
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
body {
|
||||
font-family: Avenir, "Helvetica Neue", Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#element {
|
||||
background: #0079E9;
|
||||
width: 100px;
|
||||
line-height: 40px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.elementSet {
|
||||
background: #EB6161;
|
||||
width: 50px;
|
||||
height: 25px;
|
||||
display: inline-block;
|
||||
margin: 5px 0;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
11
node_modules/onclick/examples/example.js
generated
vendored
Normal file
11
node_modules/onclick/examples/example.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
var click = require("../src/onClick.js");
|
||||
|
||||
click({
|
||||
'#element': function(e) {
|
||||
alert("You clicked!");
|
||||
}
|
||||
});
|
||||
|
||||
click('.elementSet', function(e) {
|
||||
alert("You clicked the set");
|
||||
});
|
27
node_modules/onclick/examples/index.html
generated
vendored
Normal file
27
node_modules/onclick/examples/index.html
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Click Example</title>
|
||||
|
||||
<!-- Prevent Mobile Zooming -->
|
||||
<meta content='True' name='HandheldFriendly' />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Prevent Tap Highlight on Windows 8 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="msapplication-tap-highlight" content="no"/>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="example.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='element'>Click Me</div>
|
||||
|
||||
<div class='elementSet'></div>
|
||||
<div class='elementSet'></div>
|
||||
<div class='elementSet'></div>
|
||||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script id='main' src="build.js"></script>
|
||||
</body>
|
||||
</html>
|
43
node_modules/onclick/package.json
generated
vendored
Normal file
43
node_modules/onclick/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "onclick",
|
||||
"description": "A click controller for mouse & touch.",
|
||||
"version": "0.1.0",
|
||||
"author": {
|
||||
"name": "Brian Peacock"
|
||||
},
|
||||
"main": "src/onClick.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bpeacock/onClick"
|
||||
},
|
||||
"dependencies": {
|
||||
"unopinionate": "0.0.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "3.24.x",
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-contrib-watch": "0.5.x",
|
||||
"grunt-browserify": "1.3.x",
|
||||
"sinon": "~1.8.2",
|
||||
"jQuery": "~1.7.4",
|
||||
"grunt-contrib-qunit": "~0.4.0",
|
||||
"qunitjs": "~1.14.0",
|
||||
"grunt-contrib-uglify": "~0.3.2",
|
||||
"grunt-contrib-jshint": "~0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [],
|
||||
"readme": "onClick.js [![Build Status](https://travis-ci.org/bpeacock/onClick.png?branch=master)](https://travis-ci.org/bpeacock/onClick)\n===============\n\nA click controller for mouse & touch.\n\n- Prevents 300ms delay on touch\n- Touch interactions like scrolling work as expected\n- Handles devices that have both touch and mouse\n- Delegates events for efficiency\n\nInstallation\n------------\n\n```bash\nnpm install onclick\n```\n\nA jQuery-like selector library is required:\n- jQuery 1.4.3+\n- Zepto\n\nUsage\n-----\n\n```javascript\nonClick({\n '#element': function(e) {\n alert(\"I was clicked!\");\n }\n});\n\nonClick('.myclass', function() {\n\n});\n```\n\nCheck out a live [example](http://htmlpreview.github.io/?https://github.com/bpeacock/onClick/blob/master/examples/index.html).\n\nDevelopment\n-----------\n\nTo Build: `grunt build`\n\nTo Develop: `grunt watch`\n\nTo Test: `npm test`\n \n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bpeacock/onClick/issues"
|
||||
},
|
||||
"homepage": "https://github.com/bpeacock/onClick",
|
||||
"_id": "onclick@0.1.0",
|
||||
"_shasum": "00db9cf7be6a38ef1261550434e967329cfbe16c",
|
||||
"_from": "onclick@>=0.1.0 <1.0.0-0",
|
||||
"_resolved": "https://registry.npmjs.org/onclick/-/onclick-0.1.0.tgz"
|
||||
}
|
163
node_modules/onclick/src/onClick.js
generated
vendored
Normal file
163
node_modules/onclick/src/onClick.js
generated
vendored
Normal file
|
@ -0,0 +1,163 @@
|
|||
var $ = require('unopinionate').selector;
|
||||
|
||||
var $document = $(document),
|
||||
bindings = {};
|
||||
|
||||
var click = function(events) {
|
||||
click.bind.apply(click, arguments);
|
||||
return click;
|
||||
};
|
||||
|
||||
/*** Configuration Options ***/
|
||||
click.distanceLimit = 10;
|
||||
click.timeLimit = 140;
|
||||
|
||||
/*** Useful Properties ***/
|
||||
click.isTouch = ('ontouchstart' in window) ||
|
||||
window.DocumentTouch &&
|
||||
document instanceof DocumentTouch;
|
||||
|
||||
/*** Cached Functions ***/
|
||||
var onTouchstart = function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
|
||||
click._doAnywheres(e);
|
||||
|
||||
var $this = $(this),
|
||||
startTime = new Date().getTime(),
|
||||
startPos = click._getPos(e);
|
||||
|
||||
$this.one('touchend', function(e) {
|
||||
e.preventDefault(); //Prevents click event from firing
|
||||
|
||||
var time = new Date().getTime() - startTime,
|
||||
endPos = click._getPos(e),
|
||||
distance = Math.sqrt(
|
||||
Math.pow(endPos.x - startPos.x, 2) +
|
||||
Math.pow(endPos.y - startPos.y, 2)
|
||||
);
|
||||
|
||||
if(time < click.timeLimit && distance < click.distanceLimit) {
|
||||
//Find the correct callback
|
||||
$.each(bindings, function(selector, callback) {
|
||||
if($this.is(selector)) {
|
||||
callback.apply(e.target, [e]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*** API ***/
|
||||
click.bind = function(events) {
|
||||
|
||||
//Argument Surgery
|
||||
if(!$.isPlainObject(events)) {
|
||||
newEvents = {};
|
||||
newEvents[arguments[0]] = arguments[1];
|
||||
events = newEvents;
|
||||
}
|
||||
|
||||
$.each(events, function(selector, callback) {
|
||||
|
||||
/*** Register Binding ***/
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
click.unbind(selector); //Ensure no duplicates
|
||||
}
|
||||
|
||||
bindings[selector] = callback;
|
||||
|
||||
/*** Touch Support ***/
|
||||
if(click.isTouch) {
|
||||
$document.delegate(selector, 'touchstart', onTouchstart);
|
||||
}
|
||||
|
||||
/*** Mouse Support ***/
|
||||
$document.delegate(selector, 'click', function(e) {
|
||||
e.stopPropagation(); //Prevents multiple click events from happening
|
||||
//click._doAnywheres(e); //Do anywheres first to be consistent with touch order
|
||||
callback.apply(this, [e]);
|
||||
});
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbind = function(selector) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
|
||||
delete bindings[selector];
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.unbindAll = function() {
|
||||
$.each(bindings, function(selector, callback) {
|
||||
$document
|
||||
.undelegate(selector, 'touchstart')
|
||||
.undelegate(selector, 'click');
|
||||
});
|
||||
|
||||
bindings = {};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.trigger = function(selector, e) {
|
||||
e = e || $.Event('click');
|
||||
|
||||
if(typeof bindings[selector] != 'undefined') {
|
||||
bindings[selector](e);
|
||||
}
|
||||
else {
|
||||
console.error("No click events bound for selector '"+selector+"'.");
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
click.anywhere = function(callback) {
|
||||
click._anywheres.push(callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
/*** Internal (but useful) Methods ***/
|
||||
click._getPos = function(e) {
|
||||
e = e.originalEvent;
|
||||
|
||||
if(e.pageX || e.pageY) {
|
||||
return {
|
||||
x: e.pageX,
|
||||
y: e.pageY
|
||||
};
|
||||
}
|
||||
else if(e.changedTouches) {
|
||||
return {
|
||||
x: e.changedTouches[0].clientX,
|
||||
y: e.changedTouches[0].clientY
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
|
||||
y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
click._anywheres = [];
|
||||
|
||||
click._doAnywheres = function(e) {
|
||||
var i = click._anywheres.length;
|
||||
while(i--) {
|
||||
click._anywheres[i](e);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).bind('mousedown', click._doAnywheres);
|
||||
|
||||
module.exports = click;
|
||||
|
4835
node_modules/onclick/test/build.js
generated
vendored
Normal file
4835
node_modules/onclick/test/build.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
20
node_modules/onclick/test/index.html
generated
vendored
Executable file
20
node_modules/onclick/test/index.html
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>QUnit Example</title>
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="sandbox">
|
||||
<button id='button'>Click Me</button>
|
||||
</div>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script src="build.js"></script>
|
||||
</body>
|
||||
</html>
|
198
node_modules/onclick/test/test.js
generated
vendored
Executable file
198
node_modules/onclick/test/test.js
generated
vendored
Executable file
|
@ -0,0 +1,198 @@
|
|||
var sinon = require('sinon'),
|
||||
click = require('../src/onClick'),
|
||||
module = window.module,
|
||||
sandbox,
|
||||
testCallback;
|
||||
|
||||
module("onClick", {
|
||||
setup: function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
testCallback = sinon.spy();
|
||||
},
|
||||
teardown: function() {
|
||||
click.unbindAll();
|
||||
}
|
||||
});
|
||||
|
||||
test("#trigger", function() {
|
||||
click({
|
||||
'#button': testCallback
|
||||
});
|
||||
|
||||
click.trigger('#button');
|
||||
ok(testCallback.called);
|
||||
});
|
||||
|
||||
test("#unbindAll", function() {
|
||||
click({
|
||||
'#button': testCallback
|
||||
})
|
||||
.unbindAll()
|
||||
.trigger('#button');
|
||||
|
||||
ok(!testCallback.called);
|
||||
});
|
||||
|
||||
test("#bind object syntax", function() {
|
||||
click
|
||||
.bind({
|
||||
'#button': testCallback
|
||||
})
|
||||
.trigger('#button');
|
||||
|
||||
ok(testCallback.called);
|
||||
});
|
||||
|
||||
test("#bind argument syntax", function() {
|
||||
click
|
||||
.bind('#button', testCallback)
|
||||
.trigger('#button');
|
||||
|
||||
ok(testCallback.called);
|
||||
});
|
||||
|
||||
test("#unbind", function() {
|
||||
click
|
||||
.bind('#button', testCallback)
|
||||
.unbind('#button')
|
||||
.trigger('#button');
|
||||
|
||||
ok(!testCallback.called);
|
||||
});
|
||||
|
||||
test("#_getPos", function() {
|
||||
//pageX/pageY
|
||||
var pos = click._getPos({
|
||||
originalEvent: {
|
||||
pageX: 100,
|
||||
pageY: 200
|
||||
}
|
||||
});
|
||||
|
||||
deepEqual(pos.x, 100, "x Position (pageX/pageY case)");
|
||||
deepEqual(pos.y, 200, "y Position (pageX/pageY case)");
|
||||
|
||||
//changedTouches
|
||||
pos = click._getPos({
|
||||
originalEvent: {
|
||||
changedTouches: [
|
||||
{
|
||||
clientX: 100,
|
||||
clientY: 200
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
deepEqual(pos.x, 100, "x Position (changedTouches)");
|
||||
deepEqual(pos.y, 200, "y Position (changedTouches)");
|
||||
|
||||
//clientX
|
||||
pos = click._getPos({
|
||||
originalEvent: {
|
||||
clientX: 100,
|
||||
clientY: 200
|
||||
}
|
||||
});
|
||||
|
||||
deepEqual(pos.x, 100, "x Position (changedTouches)");
|
||||
deepEqual(pos.y, 200, "y Position (changedTouches)");
|
||||
});
|
||||
|
||||
test("Standard Click Event (Browser w/ Mouse)", function() {
|
||||
click({
|
||||
'#button': testCallback
|
||||
});
|
||||
|
||||
$('#button').click();
|
||||
ok(testCallback.called);
|
||||
});
|
||||
|
||||
test("Two arguments (not object configuration)", function() {
|
||||
click('#button', testCallback);
|
||||
|
||||
$('#button').click();
|
||||
ok(testCallback.called);
|
||||
});
|
||||
|
||||
/*** Touch Tests ***/
|
||||
var $button,
|
||||
eStart,
|
||||
eEnd;
|
||||
|
||||
module("Touch Click", {
|
||||
setup: function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
testCallback = sinon.spy();
|
||||
|
||||
click.isTouch = true; //Fake touch
|
||||
|
||||
$button = $('#button');
|
||||
|
||||
click({
|
||||
'#button': testCallback
|
||||
});
|
||||
|
||||
eStart = $.Event('touchstart');
|
||||
eStart.originalEvent = {
|
||||
pageX: 1,
|
||||
pageY: 1
|
||||
};
|
||||
|
||||
eEnd = $.Event('touchend');
|
||||
eEnd.originalEvent = {
|
||||
pageX: 1,
|
||||
pageY: 1
|
||||
};
|
||||
},
|
||||
teardown: function() {
|
||||
click.unbindAll();
|
||||
click.isTouch = false;
|
||||
}
|
||||
});
|
||||
|
||||
asyncTest("Successful Touch Click", function() {
|
||||
$button.trigger(eStart);
|
||||
|
||||
setTimeout(function() {
|
||||
$button.trigger(eEnd);
|
||||
ok(testCallback.called);
|
||||
start();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
asyncTest("Distance Fail", function() {
|
||||
eEnd.originalEvent = {
|
||||
pageX: click.distanceLimit,
|
||||
pageY: click.distanceLimit
|
||||
};
|
||||
|
||||
$button.trigger(eStart);
|
||||
|
||||
setTimeout(function() {
|
||||
$button.trigger(eEnd);
|
||||
ok(!testCallback.called, "Distance Fail");
|
||||
start();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
asyncTest("Timeout Fail", function() {
|
||||
$button.trigger(eStart);
|
||||
|
||||
setTimeout(function() {
|
||||
$button.trigger(eEnd);
|
||||
ok(!testCallback.called, "Distance Fail");
|
||||
start();
|
||||
}, click.timeLimit + 1);
|
||||
});
|
||||
|
||||
asyncTest("Different Element Fail", function() {
|
||||
$button.trigger(eStart);
|
||||
|
||||
setTimeout(function() {
|
||||
$('body').trigger(eEnd);
|
||||
ok(!testCallback.called, "Distance Fail");
|
||||
start();
|
||||
}, 10);
|
||||
});
|
||||
|
43
node_modules/onscroll/.npmignore
generated
vendored
Executable file
43
node_modules/onscroll/.npmignore
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Node Stuff #
|
||||
##############
|
||||
node_modules/
|
||||
|
||||
|
6
node_modules/onscroll/.travis.yml
generated
vendored
Normal file
6
node_modules/onscroll/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
before_script:
|
||||
- npm install grunt-cli -g
|
71
node_modules/onscroll/Gruntfile.js
generated
vendored
Executable file
71
node_modules/onscroll/Gruntfile.js
generated
vendored
Executable file
|
@ -0,0 +1,71 @@
|
|||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
browserify: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/lib.js': ['onScroll.js'],
|
||||
'examples/build.js': ['examples/example.js']
|
||||
},
|
||||
options: {
|
||||
//standalone: '',
|
||||
transform: ['grunt-less-browserify']
|
||||
}
|
||||
},
|
||||
test: {
|
||||
files: {
|
||||
'test/build.js': ['test/test.js']
|
||||
},
|
||||
options: {
|
||||
transform: ['grunt-less-browserify'],
|
||||
debug: true
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: [ "onScroll.js", "examples/example.js"],
|
||||
tasks: [ 'browserify:dist' ]
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
eqnull: true,
|
||||
browser: true
|
||||
},
|
||||
uses_defaults: ['src/**/*.js']
|
||||
},
|
||||
uglify: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/lib.min.js': ['dist/lib.js']
|
||||
},
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
}
|
||||
},
|
||||
qunit: {
|
||||
files: ['test/index.html']
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
|
||||
grunt.registerTask('test', [
|
||||
'browserify:test',
|
||||
'qunit',
|
||||
'jshint'
|
||||
]);
|
||||
|
||||
grunt.registerTask('build', [
|
||||
'test',
|
||||
'browserify:dist',
|
||||
'uglify'
|
||||
]);
|
||||
};
|
||||
|
18
node_modules/onscroll/README.md
generated
vendored
Executable file
18
node_modules/onscroll/README.md
generated
vendored
Executable file
|
@ -0,0 +1,18 @@
|
|||
onScroll
|
||||
========
|
||||
|
||||
A scroll binding library with mobile support.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Installation `npm install onscroll`
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
To Build: `grunt build`
|
||||
|
||||
To Develop: `grunt watch`
|
||||
|
||||
To Test: `npm test`
|
51
node_modules/onscroll/dist/lib.js
generated
vendored
Normal file
51
node_modules/onscroll/dist/lib.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(root) {
|
||||
var unopinionate = {
|
||||
selector: root.jQuery || root.Zepto || root.ender || root.$,
|
||||
template: root.Handlebars || root.Mustache
|
||||
};
|
||||
|
||||
/*** Export ***/
|
||||
|
||||
//AMD
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
define([], function() {
|
||||
return unopinionate;
|
||||
});
|
||||
}
|
||||
//CommonJS
|
||||
else if(typeof module.exports !== 'undefined') {
|
||||
module.exports = unopinionate;
|
||||
}
|
||||
//Global
|
||||
else {
|
||||
root.unopinionate = unopinionate;
|
||||
}
|
||||
})(typeof window != 'undefined' ? window : global);
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],2:[function(require,module,exports){
|
||||
var $ = require('unopinionate').selector;
|
||||
|
||||
var bodyScrollers = [];
|
||||
|
||||
$(function() {
|
||||
var $html = $('html'),
|
||||
$body = $('body');
|
||||
|
||||
$(window, document, 'body').bind('scroll touchmove', function() {
|
||||
var top = $html[0].scrollTop || $body[0].scrollTop;
|
||||
|
||||
for(var i=0; i<bodyScrollers.length; i++) {
|
||||
bodyScrollers[i](top);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var onScroll = function(callback) {
|
||||
bodyScrollers.push(callback);
|
||||
};
|
||||
|
||||
module.exports = onScroll;
|
||||
},{"unopinionate":1}]},{},[2])
|
57
node_modules/onscroll/examples/build.js
generated
vendored
Normal file
57
node_modules/onscroll/examples/build.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var onScroll = require("../onScroll.js");
|
||||
|
||||
onScroll(function(top) {
|
||||
console.log('Body Scroll: ' + top);
|
||||
});
|
||||
},{"../onScroll.js":3}],2:[function(require,module,exports){
|
||||
(function (global){
|
||||
(function(root) {
|
||||
var unopinionate = {
|
||||
selector: root.jQuery || root.Zepto || root.ender || root.$,
|
||||
template: root.Handlebars || root.Mustache
|
||||
};
|
||||
|
||||
/*** Export ***/
|
||||
|
||||
//AMD
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
define([], function() {
|
||||
return unopinionate;
|
||||
});
|
||||
}
|
||||
//CommonJS
|
||||
else if(typeof module.exports !== 'undefined') {
|
||||
module.exports = unopinionate;
|
||||
}
|
||||
//Global
|
||||
else {
|
||||
root.unopinionate = unopinionate;
|
||||
}
|
||||
})(typeof window != 'undefined' ? window : global);
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],3:[function(require,module,exports){
|
||||
var $ = require('unopinionate').selector;
|
||||
|
||||
var bodyScrollers = [];
|
||||
|
||||
$(function() {
|
||||
var $html = $('html'),
|
||||
$body = $('body');
|
||||
|
||||
$(window, document, 'body').bind('scroll touchmove', function() {
|
||||
var top = $html[0].scrollTop || $body[0].scrollTop;
|
||||
|
||||
for(var i=0; i<bodyScrollers.length; i++) {
|
||||
bodyScrollers[i](top);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var onScroll = function(callback) {
|
||||
bodyScrollers.push(callback);
|
||||
};
|
||||
|
||||
module.exports = onScroll;
|
||||
},{"unopinionate":2}]},{},[1])
|
4
node_modules/onscroll/examples/example.css
generated
vendored
Executable file
4
node_modules/onscroll/examples/example.css
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
body {
|
||||
font-family: Avenir, "Helvetica Neue", Helvetica, sans-serif;
|
||||
height: 2000px;
|
||||
}
|
5
node_modules/onscroll/examples/example.js
generated
vendored
Executable file
5
node_modules/onscroll/examples/example.js
generated
vendored
Executable file
|
@ -0,0 +1,5 @@
|
|||
var onScroll = require("../onScroll.js");
|
||||
|
||||
onScroll(function(top) {
|
||||
console.log('Body Scroll: ' + top);
|
||||
});
|
22
node_modules/onscroll/examples/index.html
generated
vendored
Executable file
22
node_modules/onscroll/examples/index.html
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Example</title>
|
||||
|
||||
<!-- Prevent Mobile Zooming -->
|
||||
<meta content='True' name='HandheldFriendly' />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Prevent Tap Highlight on Windows 8 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="msapplication-tap-highlight" content="no"/>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="example.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Scroll Me and Watch Your Console</h1>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script src="build.js"></script>
|
||||
</body>
|
||||
</html>
|
22
node_modules/onscroll/onScroll.js
generated
vendored
Executable file
22
node_modules/onscroll/onScroll.js
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
var $ = require('unopinionate').selector;
|
||||
|
||||
var bodyScrollers = [];
|
||||
|
||||
$(function() {
|
||||
var $html = $('html'),
|
||||
$body = $('body');
|
||||
|
||||
$(window, document, 'body').bind('scroll touchmove', function() {
|
||||
var top = $html[0].scrollTop || $body[0].scrollTop;
|
||||
|
||||
for(var i=0; i<bodyScrollers.length; i++) {
|
||||
bodyScrollers[i](top);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var onScroll = function(callback) {
|
||||
bodyScrollers.push(callback);
|
||||
};
|
||||
|
||||
module.exports = onScroll;
|
45
node_modules/onscroll/package.json
generated
vendored
Executable file
45
node_modules/onscroll/package.json
generated
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "onscroll",
|
||||
"description": "A scroll event binding with mobile support.",
|
||||
"version": "0.0.3",
|
||||
"author": {
|
||||
"name": "Brian Peacock"
|
||||
},
|
||||
"main": "onScroll.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bpeacock/onScroll"
|
||||
},
|
||||
"dependencies": {
|
||||
"unopinionate": "0.0.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-contrib-watch": "0.5.x",
|
||||
"grunt-browserify": "1.3.x",
|
||||
"grunt-less-browserify": "0.0.x",
|
||||
"grunt-contrib-jshint": "0.8.x",
|
||||
"grunt-contrib-uglify": "0.3.x",
|
||||
"grunt-contrib-qunit": "~0.4.0",
|
||||
"qunitjs": "~1.14.0",
|
||||
"sinon": "~1.8.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"scroll",
|
||||
"on3"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"readme": "onScroll\n========\n\nA scroll binding library with mobile support.\n\nUsage\n-----\n\nInstallation `npm install onscroll`\n\nDevelopment\n-----------\n\nTo Build: `grunt build`\n\nTo Develop: `grunt watch`\n\nTo Test: `npm test`\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bpeacock/onScroll/issues"
|
||||
},
|
||||
"homepage": "https://github.com/bpeacock/onScroll",
|
||||
"_id": "onscroll@0.0.3",
|
||||
"_shasum": "7d01d9fa0ccca34ac3599c5011942289807bfec3",
|
||||
"_from": "onscroll@>=0.0.3 <1.0.0-0",
|
||||
"_resolved": "https://registry.npmjs.org/onscroll/-/onscroll-0.0.3.tgz"
|
||||
}
|
15
node_modules/onscroll/test/index.html
generated
vendored
Executable file
15
node_modules/onscroll/test/index.html
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>QUnit Example</title>
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="build.js"></script>
|
||||
</body>
|
||||
</html>
|
17
node_modules/onscroll/test/test.js
generated
vendored
Normal file
17
node_modules/onscroll/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
var sinon = require('sinon'),
|
||||
module = window.module,
|
||||
sandbox;
|
||||
|
||||
module("onClick", {
|
||||
setup: function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
|
||||
},
|
||||
teardown: function() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
test('sample', function() {
|
||||
ok(true);
|
||||
});
|
13
node_modules/sinopia-htpasswd/.editorconfig
generated
vendored
Normal file
13
node_modules/sinopia-htpasswd/.editorconfig
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
2
node_modules/sinopia-htpasswd/.npmignore
generated
vendored
Normal file
2
node_modules/sinopia-htpasswd/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
/tests/test-htpasswd
|
9
node_modules/sinopia-htpasswd/.travis.yml
generated
vendored
Normal file
9
node_modules/sinopia-htpasswd/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.11'
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: "0.11"
|
||||
fast_finish: true
|
||||
script: npm install . && npm run test
|
61
node_modules/sinopia-htpasswd/README.md
generated
vendored
Normal file
61
node_modules/sinopia-htpasswd/README.md
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
**work in progress**
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install sinopia
|
||||
$ npm install sinopia-htpasswd
|
||||
```
|
||||
|
||||
PS: Actually, this module is bundled with sinopia, so you don't have to install it like this. But with other auth plugins you have to.
|
||||
|
||||
## Config
|
||||
|
||||
Add to your `config.yaml`:
|
||||
|
||||
```yaml
|
||||
auth:
|
||||
htpasswd:
|
||||
users_file: ./htpasswd
|
||||
|
||||
# Maximum amount of users allowed to register, defaults to "+inf".
|
||||
# You can set this to 0 to disable registration.
|
||||
#max_users: 1000
|
||||
```
|
||||
|
||||
## For plugin writers
|
||||
|
||||
It's called as:
|
||||
|
||||
```js
|
||||
require('sinopia-htpasswd')(config, stuff)
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- config - module's own config
|
||||
- stuff - collection of different internal sinopia objects
|
||||
- stuff.config - main config
|
||||
- stuff.logger - logger
|
||||
|
||||
This should export two functions:
|
||||
|
||||
- `adduser(user, password, cb)`
|
||||
|
||||
It should respond with:
|
||||
- `cb(err)` in case of an error (error will be returned to user)
|
||||
- `cb(null, false)` in case registration is disabled (next auth plugin will be executed)
|
||||
- `cb(null, true)` in case user registered successfully
|
||||
|
||||
It's useful to set `err.status` property to set http status code (e.g. `err.status = 403`).
|
||||
|
||||
- `authenticate(user, password, cb)`
|
||||
|
||||
It should respond with:
|
||||
- `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)
|
||||
- `cb(null, false)` in case user not authenticated (next auth plugin will be executed)
|
||||
- `cb(null, [groups])` in case user is authenticated
|
||||
|
||||
Groups is an array of all users/usergroups this user has access to. You should probably include username itself here.
|
||||
|
123
node_modules/sinopia-htpasswd/index.js
generated
vendored
Normal file
123
node_modules/sinopia-htpasswd/index.js
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
var fs = require('fs')
|
||||
var Path = require('path')
|
||||
var utils = require('./utils')
|
||||
|
||||
module.exports = HTPasswd
|
||||
|
||||
function HTPasswd(config, stuff) {
|
||||
var self = Object.create(HTPasswd.prototype)
|
||||
self._users = {}
|
||||
|
||||
// config for this module
|
||||
self._config = config
|
||||
|
||||
// sinopia logger
|
||||
self._logger = stuff.logger
|
||||
|
||||
// sinopia main config object
|
||||
self._sinopia_config = stuff.config
|
||||
|
||||
// all this "sinopia_config" stuff is for b/w compatibility only
|
||||
self._maxusers = self._config.max_users || self._sinopia_config.max_users
|
||||
|
||||
self._last_time = null
|
||||
var file = self._config.file || self._sinopia_config.users_file
|
||||
if (!file) throw new Error('should specify "file" in config')
|
||||
self._path = Path.resolve(Path.dirname(self._sinopia_config.self_path), file)
|
||||
return self
|
||||
}
|
||||
|
||||
HTPasswd.prototype.authenticate = function(user, password, cb) {
|
||||
var self = this
|
||||
self._reload(function(err) {
|
||||
if (err) return cb(err.code === 'ENOENT' ? null : err)
|
||||
if (!self._users[user]) return cb(null, false)
|
||||
if (!utils.verify_password(user, password, self._users[user])) return cb(null, false)
|
||||
|
||||
// authentication succeeded!
|
||||
// return all usergroups this user has access to;
|
||||
// (this particular package has no concept of usergroups, so just return user herself)
|
||||
return cb(null, [user])
|
||||
})
|
||||
}
|
||||
|
||||
// hopefully race-condition-free way to add users:
|
||||
// 1. lock file for writing (other processes can still read)
|
||||
// 2. reload .htpasswd
|
||||
// 3. write new data into .htpasswd.tmp
|
||||
// 4. move .htpasswd.tmp to .htpasswd
|
||||
// 5. reload .htpasswd
|
||||
// 6. unlock file
|
||||
HTPasswd.prototype.adduser = function(user, password, real_cb) {
|
||||
var self = this
|
||||
|
||||
function sanity_check() {
|
||||
var err = null
|
||||
if (self._users[user]) {
|
||||
err = Error('this user already exists')
|
||||
} else if (Object.keys(self._users).length >= self._maxusers) {
|
||||
err = Error('maximum amount of users reached')
|
||||
}
|
||||
if (err) err.status = 403
|
||||
return err
|
||||
}
|
||||
|
||||
// preliminary checks, just to ensure that file won't be reloaded if it's not needed
|
||||
var s_err = sanity_check()
|
||||
if (s_err) return real_cb(s_err, false)
|
||||
|
||||
utils.lock_and_read(self._path, function(err, fd, res) {
|
||||
// callback that cleanups fd first
|
||||
function cb(err) {
|
||||
if (!fd) return real_cb(err, !err)
|
||||
fs.close(fd, function() {
|
||||
real_cb(err, !err)
|
||||
})
|
||||
}
|
||||
|
||||
// ignore ENOENT errors, we'll just create .htpasswd in that case
|
||||
if (err && err.code != 'ENOENT') return cb(err)
|
||||
|
||||
var body = (res || '').toString('utf8')
|
||||
self._users = utils.parse_htpasswd(body)
|
||||
|
||||
// real checks, to prevent race conditions
|
||||
var s_err = sanity_check()
|
||||
if (s_err) return cb(s_err)
|
||||
|
||||
try {
|
||||
body = utils.add_user_to_htpasswd(body, user, password)
|
||||
} catch(err) {
|
||||
return cb(err)
|
||||
}
|
||||
fs.writeFile(self._path, body, function(err) {
|
||||
if (err) return cb(err)
|
||||
self._reload(function() {
|
||||
cb(null, true)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
HTPasswd.prototype._reload = function(callback) {
|
||||
var self = this
|
||||
|
||||
fs.open(self._path, 'r', function(err, fd) {
|
||||
if (err) return callback(err)
|
||||
|
||||
fs.fstat(fd, function(err, st) {
|
||||
if (err) return callback(err)
|
||||
if (self._last_time === st.mtime) return callback()
|
||||
self._last_time = st.mtime
|
||||
|
||||
var buffer = new Buffer(st.size)
|
||||
fs.read(fd, buffer, 0, st.size, null, function(err, bytesRead, buffer) {
|
||||
if (err) return callback(err)
|
||||
if (bytesRead != st.size) return callback(new Error('st.size != bytesRead'))
|
||||
self._users = utils.parse_htpasswd(buffer.toString('utf8'))
|
||||
callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
39
node_modules/sinopia-htpasswd/package.json
generated
vendored
Normal file
39
node_modules/sinopia-htpasswd/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name" : "sinopia-htpasswd",
|
||||
"version" : "0.4.1",
|
||||
"description" : "auth plugin for sinopia supporting htpasswd format",
|
||||
|
||||
"author" : { "name": "Alex Kocharin"
|
||||
, "email": "alex@kocharin.ru" },
|
||||
|
||||
"repository" : { "type": "git"
|
||||
, "url": "git://github.com/rlidwka/sinopia-htpasswd" },
|
||||
|
||||
"optionalDependencies": { "crypt3": ">=0.1.5 <1.0.0-0"
|
||||
, "fs-ext": "*" },
|
||||
|
||||
"devDependencies" : { "mocha": ">=1.17.0 <2.0.0-0" },
|
||||
|
||||
"scripts" : { "test": "mocha ./tests" },
|
||||
|
||||
"keywords" : [ "sinopia", "auth", "plugin", "htpasswd" ],
|
||||
|
||||
"publishConfig" : { "registry": "https://registry.npmjs.org/" },
|
||||
|
||||
"license" : { "type": "WTFPL"
|
||||
, "url": "http://www.wtfpl.net/txt/copying/" },
|
||||
"readme" : "\n**work in progress**\n\n## Installation\n\n```sh\n$ npm install sinopia\n$ npm install sinopia-htpasswd\n```\n\nPS: Actually, this module is bundled with sinopia, so you don't have to install it like this. But with other auth plugins you have to.\n\n## Config\n\nAdd to your `config.yaml`:\n\n```yaml\nauth:\n htpasswd:\n users_file: ./htpasswd\n\n # Maximum amount of users allowed to register, defaults to \"+inf\".\n # You can set this to 0 to disable registration.\n #max_users: 1000\n```\n\n## For plugin writers\n\nIt's called as:\n\n```js\nrequire('sinopia-htpasswd')(config, stuff)\n```\n\nWhere:\n\n - config - module's own config\n - stuff - collection of different internal sinopia objects\n - stuff.config - main config\n - stuff.logger - logger\n\nThis should export two functions:\n\n - `adduser(user, password, cb)`\n \n It should respond with:\n - `cb(err)` in case of an error (error will be returned to user)\n - `cb(null, false)` in case registration is disabled (next auth plugin will be executed)\n - `cb(null, true)` in case user registered successfully\n \n It's useful to set `err.status` property to set http status code (e.g. `err.status = 403`).\n\n - `authenticate(user, password, cb)`\n \n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not authenticated (next auth plugin will be executed)\n - `cb(null, [groups])` in case user is authenticated\n \n Groups is an array of all users/usergroups this user has access to. You should probably include username itself here.\n \n",
|
||||
"readmeFilename" : "README.md",
|
||||
"bugs" : {
|
||||
"url": "https://github.com/rlidwka/sinopia-htpasswd/issues"
|
||||
},
|
||||
"homepage" : "https://github.com/rlidwka/sinopia-htpasswd",
|
||||
"dependencies" : {
|
||||
"crypt3": ">=0.1.5 <1.0.0-0",
|
||||
"fs-ext": "*"
|
||||
},
|
||||
"_id" : "sinopia-htpasswd@0.4.1",
|
||||
"_shasum" : "f76c2acf42f6153faae736f50181c819a0c6b8b0",
|
||||
"_from" : "sinopia-htpasswd@>= 0.2.0",
|
||||
"_resolved" : "https://registry.npmjs.org/sinopia-htpasswd/-/sinopia-htpasswd-0.4.1.tgz"
|
||||
}
|
94
node_modules/sinopia-htpasswd/tests/acceptance.js
generated
vendored
Normal file
94
node_modules/sinopia-htpasswd/tests/acceptance.js
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
var plugin = require('../')
|
||||
var assert = require('assert')
|
||||
var stuff = {config:{self_path:__dirname+'/config'},logger:{}}
|
||||
|
||||
describe('acc', function() {
|
||||
before(function(cb) {
|
||||
require('fs').unlink(__dirname + '/test-htpasswd', function() {
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should have plugin interface', function() {
|
||||
assert.equal(typeof plugin, 'function')
|
||||
var p = plugin({file: './test-htpasswd'}, stuff)
|
||||
assert.equal(typeof p.authenticate, 'function')
|
||||
})
|
||||
|
||||
it('should not authenticate random user', function(cb) {
|
||||
var p = plugin({file: './test-htpasswd'}, stuff)
|
||||
p.authenticate('blah', 'blah', function(err, groups) {
|
||||
assert(!err)
|
||||
assert(!groups)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should add user', function(cb) {
|
||||
var p = plugin({file: './test-htpasswd'}, stuff)
|
||||
p.adduser('foo1', 'bar1', function(err, ok) {
|
||||
assert(!err)
|
||||
assert(ok)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
describe('user', function() {
|
||||
var p = plugin({file: './test-htpasswd'}, stuff)
|
||||
before(function(cb) {
|
||||
p.adduser('foo', 'bar', function(err, ok) {
|
||||
assert(!err)
|
||||
assert(ok)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should authenticate user', function(cb) {
|
||||
p.authenticate('foo', 'bar', function(err, groups) {
|
||||
assert(!err)
|
||||
assert.deepEqual(groups, ['foo'])
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should fail different pass', function(cb) {
|
||||
p.authenticate('foo', 'bar111', function(err, groups) {
|
||||
assert(!err)
|
||||
assert(!groups)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should fail adding it again', function(cb) {
|
||||
p.adduser('foo', 'bar111', function(err, ok) {
|
||||
assert(err)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('still should not authenticate random user', function(cb) {
|
||||
p.authenticate('blah', 'wow', function(err, groups) {
|
||||
assert(!err)
|
||||
assert(!groups)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('max_users', function() {
|
||||
var p = plugin({file: './test-htpasswd', max_users: 1}, stuff)
|
||||
before(function(cb) {
|
||||
p.adduser('foo', 'bar', function(err, ok) {
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('should not add more users', function(cb) {
|
||||
p.adduser('foozzz', 'bar', function(err) {
|
||||
assert(err)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
56
node_modules/sinopia-htpasswd/tests/htpasswd.js
generated
vendored
Normal file
56
node_modules/sinopia-htpasswd/tests/htpasswd.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
var assert = require('assert')
|
||||
, parse_htpasswd = require('../utils').parse_htpasswd
|
||||
, verify_password = require('../utils').verify_password
|
||||
, add_user_to_htpasswd = require('../utils').add_user_to_htpasswd
|
||||
|
||||
describe('parse_htpasswd', function() {
|
||||
// TODO
|
||||
})
|
||||
|
||||
describe('verify_password', function() {
|
||||
it('should verify plain', function() {
|
||||
assert(verify_password('user', 'pass', '{PLAIN}pass'))
|
||||
assert(!verify_password('user', 'p', '{PLAIN}pass'))
|
||||
})
|
||||
it('should verify sha', function() {
|
||||
assert(verify_password('user', 'pass', '{SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ='))
|
||||
assert(!verify_password('user', 'p', '{SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ='))
|
||||
})
|
||||
it('should verify crypt', function() {
|
||||
assert(verify_password('user', 'pass', 'ulINxGnqObi36'))
|
||||
assert(!verify_password('user', 'p', 'ulINxGnqObi36'))
|
||||
})
|
||||
it('should verify crypt-sha', function() {
|
||||
assert(verify_password('user', 'pass', '$6$Qx0eNSKPbxocgA==$ugjO0.z9yOFiaJXJK4ulvGYIxF/KZBV4lGqasArYPqPPT4orZ6NlnIE5KhtiOVs.5EoWxLg1sjp318G8RpI2x1'))
|
||||
assert(!verify_password('user', 'p', '$6$Qx0eNSKPbxocgA==$ugjO0.z9yOFiaJXJK4ulvGYIxF/KZBV4lGqasArYPqPPT4orZ6NlnIE5KhtiOVs.5EoWxLg1sjp318G8RpI2x1'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('add_user_to_htpasswd', function() {
|
||||
it('should add user to empty file', function() {
|
||||
var res = add_user_to_htpasswd('', 'user', 'passwd')
|
||||
assert(res.match(/^user:[^:\n]+:autocreated [^\n]+\n$/))
|
||||
})
|
||||
|
||||
it('should append user / newline checks', function() {
|
||||
var res = add_user_to_htpasswd('testtest', 'user', 'passwd')
|
||||
assert(res.match(/^testtest\nuser:[^:\n]+:autocreated [^\n]+\n$/))
|
||||
var res = add_user_to_htpasswd('testtest\n', 'user', 'passwd')
|
||||
assert(res.match(/^testtest\nuser:[^:\n]+:autocreated [^\n]+\n$/))
|
||||
var res = add_user_to_htpasswd('testtest\n\n', 'user', 'passwd')
|
||||
assert(res.match(/^testtest\n\nuser:[^:\n]+:autocreated [^\n]+\n$/))
|
||||
})
|
||||
|
||||
it('should not append invalid users', function() {
|
||||
assert.throws(function() {
|
||||
add_user_to_htpasswd('', 'us:er', 'passwd')
|
||||
}, /non-uri-safe/)
|
||||
assert.throws(function() {
|
||||
add_user_to_htpasswd('', 'us\ner', 'passwd')
|
||||
}, /non-uri-safe/)
|
||||
assert.throws(function() {
|
||||
add_user_to_htpasswd('', 'us#er', 'passwd')
|
||||
}, /non-uri-safe/)
|
||||
})
|
||||
})
|
||||
|
108
node_modules/sinopia-htpasswd/utils.js
generated
vendored
Normal file
108
node_modules/sinopia-htpasswd/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
var crypto = require('crypto')
|
||||
var fs = require('fs')
|
||||
|
||||
try {
|
||||
// optional, won't be available on windows
|
||||
var crypt3 = require('crypt3')
|
||||
} catch(err) {
|
||||
crypt3 = function() {
|
||||
return NaN
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var fsExt = require('fs-ext')
|
||||
} catch(e) {
|
||||
fsExt = {
|
||||
flock: function() {
|
||||
arguments[arguments.length-1]()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// open and flock with exponential backoff
|
||||
function open_flock(name, opmod, flmod, tries, backoff, cb) {
|
||||
fs.open(name, opmod, function(err, fd) {
|
||||
if (err) return cb(err, fd)
|
||||
|
||||
fsExt.flock(fd, flmod, function(err) {
|
||||
if (err) {
|
||||
if (!tries) {
|
||||
fs.close(fd, function() {
|
||||
cb(err)
|
||||
})
|
||||
} else {
|
||||
fs.close(fd, function() {
|
||||
setTimeout(function() {
|
||||
open_flock(name, opmod, flmod, tries-1, backoff*2, cb)
|
||||
}, backoff)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
cb(null, fd)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// this function neither unlocks file nor closes it
|
||||
// it'll have to be done manually later
|
||||
function lock_and_read(name, callback) {
|
||||
open_flock(name, 'r', 'exnb', 4, 10, function(err, fd) {
|
||||
if (err) return callback(err, fd)
|
||||
|
||||
fs.fstat(fd, function(err, st) {
|
||||
if (err) return callback(err, fd)
|
||||
|
||||
var buffer = new Buffer(st.size)
|
||||
fs.read(fd, buffer, 0, st.size, null, function(err, bytesRead, buffer) {
|
||||
if (err) return callback(err)
|
||||
if (bytesRead != st.size) return callback(new Error('st.size != bytesRead'), fd)
|
||||
|
||||
callback(null, fd, buffer)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function parse_htpasswd(input) {
|
||||
var result = {}
|
||||
input.split('\n').forEach(function(line) {
|
||||
var args = line.split(':', 3)
|
||||
if (args.length > 1) result[args[0]] = args[1]
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
function verify_password(user, passwd, hash) {
|
||||
if (hash.indexOf('{PLAIN}') === 0) {
|
||||
return passwd === hash.substr(7)
|
||||
} else if (hash.indexOf('{SHA}') === 0) {
|
||||
return crypto.createHash('sha1').update(passwd, 'binary').digest('base64') === hash.substr(5)
|
||||
} else {
|
||||
return crypt3(passwd, hash) === hash
|
||||
}
|
||||
}
|
||||
|
||||
function add_user_to_htpasswd(body, user, passwd) {
|
||||
if (user != encodeURIComponent(user)) {
|
||||
var err = Error("username shouldn't contain non-uri-safe characters")
|
||||
err.status = 409
|
||||
throw err
|
||||
}
|
||||
|
||||
passwd = crypt3(passwd)
|
||||
if (!passwd) {
|
||||
passwd = '{SHA}' + crypto.createHash('sha1').update(passwd, 'binary').digest('base64')
|
||||
}
|
||||
var comment = 'autocreated ' + (new Date()).toJSON()
|
||||
|
||||
var newline = user + ':' + passwd + ':' + comment + '\n'
|
||||
if (body.length && body[body.length-1] != '\n') newline = '\n' + newline
|
||||
return body + newline
|
||||
}
|
||||
|
||||
module.exports.parse_htpasswd = parse_htpasswd
|
||||
module.exports.verify_password = verify_password
|
||||
module.exports.add_user_to_htpasswd = add_user_to_htpasswd
|
||||
module.exports.lock_and_read = lock_and_read
|
3
node_modules/tar.gz/.npmignore
generated
vendored
Normal file
3
node_modules/tar.gz/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*.sublime-workspace
|
||||
/*.sublime-project
|
||||
/node_modules
|
75
node_modules/tar.gz/Cakefile
generated
vendored
Normal file
75
node_modules/tar.gz/Cakefile
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Basic Cakefile for project automation
|
||||
#
|
||||
# @author Alan Hoffmeister <alan@cranic.com.br>
|
||||
# @version 0.0.1
|
||||
# @date 2012-12-06 128:41 GMT -3:00
|
||||
# @license MIT <http://en.wikipedia.org/wiki/MIT_License#License_terms>
|
||||
|
||||
util = require 'util'
|
||||
walker = require 'walk'
|
||||
wrench = require 'wrench'
|
||||
exec = require('child_process').exec
|
||||
fs = require 'fs'
|
||||
|
||||
options =
|
||||
source : __dirname + '/src'
|
||||
target : __dirname + '/lib'
|
||||
convert :
|
||||
'coffee' : 'coffee -b --compile --output "{targetDir}" "{sourceFile}"'
|
||||
blacklist : ['log']
|
||||
watch :
|
||||
'coffee' : 'coffee -b --compile --output "{targetDir}" "{sourceFile}"'
|
||||
|
||||
totals =
|
||||
converted : 0
|
||||
deleted : 0
|
||||
total : 0
|
||||
watched : 0
|
||||
|
||||
replace = (str, root, name) ->
|
||||
str.replace('{sourceFile}', "#{root}/#{name}").replace('{targetDir}', root);
|
||||
|
||||
task 'build', 'Main build task', ->
|
||||
util.log "Build started at #{options.source}"
|
||||
util.log "Cleaning up the target directory #{options.target}"
|
||||
wrench.rmdirSyncRecursive options.target, true
|
||||
util.log 'Creating empty target folder.'
|
||||
wrench.mkdirSyncRecursive options.target, '0777'
|
||||
util.log 'Coping files from source to target.'
|
||||
wrench.copyDirSyncRecursive options.source, options.target
|
||||
util.log 'Starting to convert files.'
|
||||
walk = walker.walk options.target, followLinks: false
|
||||
walk.on 'file', (root, stat, next) ->
|
||||
totals.total++
|
||||
extension = stat.name.split('.').pop()
|
||||
if options.blacklist.indexOf(extension) != -1
|
||||
fs.unlinkSync "#{root}/#{stat.name}"
|
||||
util.log "Removing by blacklist: #{root}/#{stat.name}"
|
||||
totals.deleted++
|
||||
next()
|
||||
else if options.convert[extension]
|
||||
util.log "Converting #{root}/#{stat.name}"
|
||||
exec replace(options.convert[extension], root, stat.name), (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
fs.unlinkSync "#{root}/#{stat.name}"
|
||||
totals.converted++
|
||||
next()
|
||||
|
||||
walk.on 'end', ->
|
||||
util.log "Build script ended. #{totals.total} files copyed, #{totals.deleted} deleted and #{totals.converted} converted."
|
||||
|
||||
task 'watch', 'Watch for filechanges.', ->
|
||||
util.log "Watching files in #{options.source}"
|
||||
walk = walker.walk options.source, followLinks: false
|
||||
walk.on 'file', (root, stat, next) ->
|
||||
extension = stat.name.split('.').pop()
|
||||
if options.watch[extension]
|
||||
totals.watched++
|
||||
util.log "Watching #{root}/#{stat.name}"
|
||||
fs.watchFile "#{root}/#{stat.name}", (curt, pret) ->
|
||||
util.log "File changed: #{root}/#{stat.name}"
|
||||
exec 'cake build', (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
next()
|
||||
walk.on 'end', ->
|
||||
util.log "Watching #{totals.watched} files."
|
20
node_modules/tar.gz/LICENSE
generated
vendored
Normal file
20
node_modules/tar.gz/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright (C) 2012 Cranic Tecnologia e Informática LTDA
|
||||
|
||||
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.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue