First release
This commit is contained in:
commit
fa6c85266e
2339 changed files with 761050 additions and 0 deletions
21
node_modules/process/.eslintrc
generated
vendored
Normal file
21
node_modules/process/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
extends: "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"es6" : true,
|
||||
"mocha": true
|
||||
},
|
||||
"rules": {
|
||||
"indent": [2, 4],
|
||||
"brace-style": [2, "1tbs"],
|
||||
"quotes": [2, "single"],
|
||||
"no-console": 0,
|
||||
"no-shadow": 0,
|
||||
"no-use-before-define": [2, "nofunc"],
|
||||
"no-underscore-dangle": 0,
|
||||
"no-constant-condition": 0,
|
||||
"space-after-function-name": 0,
|
||||
"consistent-return": 0
|
||||
}
|
||||
}
|
22
node_modules/process/LICENSE
generated
vendored
Normal file
22
node_modules/process/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Roman Shtylman <shtylman@gmail.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.
|
26
node_modules/process/README.md
generated
vendored
Normal file
26
node_modules/process/README.md
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
# process
|
||||
|
||||
```require('process');``` just like any other module.
|
||||
|
||||
Works in node.js and browsers via the browser.js shim provided with the module.
|
||||
|
||||
## browser implementation
|
||||
|
||||
The goal of this module is not to be a full-fledged alternative to the builtin process module. This module mostly exists to provide the nextTick functionality and little more. We keep this module lean because it will often be included by default by tools like browserify when it detects a module has used the `process` global.
|
||||
|
||||
It also exposes a "browser" member (i.e. `process.browser`) which is `true` in this implementation but `undefined` in node. This can be used in isomorphic code that adjusts it's behavior depending on which environment it's running in.
|
||||
|
||||
If you are looking to provide other process methods, I suggest you monkey patch them onto the process global in your app. A list of user created patches is below.
|
||||
|
||||
* [hrtime](https://github.com/kumavis/browser-process-hrtime)
|
||||
* [stdout](https://github.com/kumavis/browser-stdout)
|
||||
|
||||
## package manager notes
|
||||
|
||||
If you are writing a bundler to package modules for client side use, make sure you use the ```browser``` field hint in package.json.
|
||||
|
||||
See https://gist.github.com/4339901 for details.
|
||||
|
||||
The [browserify](https://github.com/substack/node-browserify) module will properly handle this field when bundling your files.
|
||||
|
||||
|
184
node_modules/process/browser.js
generated
vendored
Normal file
184
node_modules/process/browser.js
generated
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
// shim for using process in browser
|
||||
var process = module.exports = {};
|
||||
|
||||
// cached from whatever global is present so that test runners that stub it
|
||||
// don't break things. But we need to wrap it in a try catch in case it is
|
||||
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
||||
// function because try/catches deoptimize in certain engines.
|
||||
|
||||
var cachedSetTimeout;
|
||||
var cachedClearTimeout;
|
||||
|
||||
function defaultSetTimout() {
|
||||
throw new Error('setTimeout has not been defined');
|
||||
}
|
||||
function defaultClearTimeout () {
|
||||
throw new Error('clearTimeout has not been defined');
|
||||
}
|
||||
(function () {
|
||||
try {
|
||||
if (typeof setTimeout === 'function') {
|
||||
cachedSetTimeout = setTimeout;
|
||||
} else {
|
||||
cachedSetTimeout = defaultSetTimout;
|
||||
}
|
||||
} catch (e) {
|
||||
cachedSetTimeout = defaultSetTimout;
|
||||
}
|
||||
try {
|
||||
if (typeof clearTimeout === 'function') {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
} else {
|
||||
cachedClearTimeout = defaultClearTimeout;
|
||||
}
|
||||
} catch (e) {
|
||||
cachedClearTimeout = defaultClearTimeout;
|
||||
}
|
||||
} ())
|
||||
function runTimeout(fun) {
|
||||
if (cachedSetTimeout === setTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
// if setTimeout wasn't available but was latter defined
|
||||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||||
cachedSetTimeout = setTimeout;
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedSetTimeout(fun, 0);
|
||||
} catch(e){
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedSetTimeout.call(null, fun, 0);
|
||||
} catch(e){
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||||
return cachedSetTimeout.call(this, fun, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function runClearTimeout(marker) {
|
||||
if (cachedClearTimeout === clearTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
// if clearTimeout wasn't available but was latter defined
|
||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedClearTimeout(marker);
|
||||
} catch (e){
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedClearTimeout.call(null, marker);
|
||||
} catch (e){
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||||
return cachedClearTimeout.call(this, marker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
var queue = [];
|
||||
var draining = false;
|
||||
var currentQueue;
|
||||
var queueIndex = -1;
|
||||
|
||||
function cleanUpNextTick() {
|
||||
if (!draining || !currentQueue) {
|
||||
return;
|
||||
}
|
||||
draining = false;
|
||||
if (currentQueue.length) {
|
||||
queue = currentQueue.concat(queue);
|
||||
} else {
|
||||
queueIndex = -1;
|
||||
}
|
||||
if (queue.length) {
|
||||
drainQueue();
|
||||
}
|
||||
}
|
||||
|
||||
function drainQueue() {
|
||||
if (draining) {
|
||||
return;
|
||||
}
|
||||
var timeout = runTimeout(cleanUpNextTick);
|
||||
draining = true;
|
||||
|
||||
var len = queue.length;
|
||||
while(len) {
|
||||
currentQueue = queue;
|
||||
queue = [];
|
||||
while (++queueIndex < len) {
|
||||
if (currentQueue) {
|
||||
currentQueue[queueIndex].run();
|
||||
}
|
||||
}
|
||||
queueIndex = -1;
|
||||
len = queue.length;
|
||||
}
|
||||
currentQueue = null;
|
||||
draining = false;
|
||||
runClearTimeout(timeout);
|
||||
}
|
||||
|
||||
process.nextTick = function (fun) {
|
||||
var args = new Array(arguments.length - 1);
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
}
|
||||
queue.push(new Item(fun, args));
|
||||
if (queue.length === 1 && !draining) {
|
||||
runTimeout(drainQueue);
|
||||
}
|
||||
};
|
||||
|
||||
// v8 likes predictible objects
|
||||
function Item(fun, array) {
|
||||
this.fun = fun;
|
||||
this.array = array;
|
||||
}
|
||||
Item.prototype.run = function () {
|
||||
this.fun.apply(null, this.array);
|
||||
};
|
||||
process.title = 'browser';
|
||||
process.browser = true;
|
||||
process.env = {};
|
||||
process.argv = [];
|
||||
process.version = ''; // empty string to avoid regexp issues
|
||||
process.versions = {};
|
||||
|
||||
function noop() {}
|
||||
|
||||
process.on = noop;
|
||||
process.addListener = noop;
|
||||
process.once = noop;
|
||||
process.off = noop;
|
||||
process.removeListener = noop;
|
||||
process.removeAllListeners = noop;
|
||||
process.emit = noop;
|
||||
process.prependListener = noop;
|
||||
process.prependOnceListener = noop;
|
||||
|
||||
process.listeners = function (name) { return [] }
|
||||
|
||||
process.binding = function (name) {
|
||||
throw new Error('process.binding is not supported');
|
||||
};
|
||||
|
||||
process.cwd = function () { return '/' };
|
||||
process.chdir = function (dir) {
|
||||
throw new Error('process.chdir is not supported');
|
||||
};
|
||||
process.umask = function() { return 0; };
|
2
node_modules/process/index.js
generated
vendored
Normal file
2
node_modules/process/index.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// for now just expose the builtin process global from node.js
|
||||
module.exports = global.process;
|
59
node_modules/process/package.json
generated
vendored
Normal file
59
node_modules/process/package.json
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"_from": "process@^0.11.10",
|
||||
"_id": "process@0.11.10",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
|
||||
"_location": "/process",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "process@^0.11.10",
|
||||
"name": "process",
|
||||
"escapedName": "process",
|
||||
"rawSpec": "^0.11.10",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.11.10"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/global"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"_shasum": "7332300e840161bda3e69a1d1d91a7d4bc16f182",
|
||||
"_spec": "process@^0.11.10",
|
||||
"_where": "F:\\Documents\\websites\\BMM\\node_modules\\global",
|
||||
"author": {
|
||||
"name": "Roman Shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
},
|
||||
"browser": "./browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/shtylman/node-process/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "process information for node.js and browsers",
|
||||
"devDependencies": {
|
||||
"mocha": "2.2.1",
|
||||
"zuul": "^3.10.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/shtylman/node-process#readme",
|
||||
"keywords": [
|
||||
"process"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"name": "process",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/shtylman/node-process.git"
|
||||
},
|
||||
"scripts": {
|
||||
"browser": "zuul --no-coverage --ui mocha-bdd --local 8080 -- test.js",
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"version": "0.11.10"
|
||||
}
|
199
node_modules/process/test.js
generated
vendored
Normal file
199
node_modules/process/test.js
generated
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
var assert = require('assert');
|
||||
var ourProcess = require('./browser');
|
||||
describe('test against our process', function () {
|
||||
test(ourProcess);
|
||||
});
|
||||
if (!process.browser) {
|
||||
describe('test against node', function () {
|
||||
test(process);
|
||||
});
|
||||
vmtest();
|
||||
}
|
||||
function test (ourProcess) {
|
||||
describe('test arguments', function () {
|
||||
it ('works', function (done) {
|
||||
var order = 0;
|
||||
|
||||
|
||||
ourProcess.nextTick(function (num) {
|
||||
assert.equal(num, order++, 'first one works');
|
||||
ourProcess.nextTick(function (num) {
|
||||
assert.equal(num, order++, 'recursive one is 4th');
|
||||
}, 3);
|
||||
}, 0);
|
||||
ourProcess.nextTick(function (num) {
|
||||
assert.equal(num, order++, 'second one starts');
|
||||
ourProcess.nextTick(function (num) {
|
||||
assert.equal(num, order++, 'this is third');
|
||||
ourProcess.nextTick(function (num) {
|
||||
assert.equal(num, order++, 'this is last');
|
||||
done();
|
||||
}, 5);
|
||||
}, 4);
|
||||
}, 1);
|
||||
ourProcess.nextTick(function (num) {
|
||||
|
||||
assert.equal(num, order++, '3rd schedualed happens after the error');
|
||||
}, 2);
|
||||
});
|
||||
});
|
||||
if (!process.browser) {
|
||||
describe('test errors', function (t) {
|
||||
it ('works', function (done) {
|
||||
var order = 0;
|
||||
process.removeAllListeners('uncaughtException');
|
||||
process.once('uncaughtException', function(err) {
|
||||
assert.equal(2, order++, 'error is third');
|
||||
ourProcess.nextTick(function () {
|
||||
assert.equal(5, order++, 'schedualed in error is last');
|
||||
done();
|
||||
});
|
||||
});
|
||||
ourProcess.nextTick(function () {
|
||||
assert.equal(0, order++, 'first one works');
|
||||
ourProcess.nextTick(function () {
|
||||
assert.equal(4, order++, 'recursive one is 4th');
|
||||
});
|
||||
});
|
||||
ourProcess.nextTick(function () {
|
||||
assert.equal(1, order++, 'second one starts');
|
||||
throw(new Error('an error is thrown'));
|
||||
});
|
||||
ourProcess.nextTick(function () {
|
||||
assert.equal(3, order++, '3rd schedualed happens after the error');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
describe('rename globals', function (t) {
|
||||
var oldTimeout = setTimeout;
|
||||
var oldClear = clearTimeout;
|
||||
|
||||
it('clearTimeout', function (done){
|
||||
|
||||
var ok = true;
|
||||
clearTimeout = function () {
|
||||
ok = false;
|
||||
}
|
||||
var ran = false;
|
||||
function cleanup() {
|
||||
clearTimeout = oldClear;
|
||||
var err;
|
||||
try {
|
||||
assert.ok(ok, 'fake clearTimeout ran');
|
||||
assert.ok(ran, 'should have run');
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
done(err);
|
||||
}
|
||||
setTimeout(cleanup, 1000);
|
||||
ourProcess.nextTick(function () {
|
||||
ran = true;
|
||||
});
|
||||
});
|
||||
it('just setTimeout', function (done){
|
||||
|
||||
|
||||
setTimeout = function () {
|
||||
setTimeout = oldTimeout;
|
||||
try {
|
||||
assert.ok(false, 'fake setTimeout called')
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ourProcess.nextTick(function () {
|
||||
setTimeout = oldTimeout;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
function vmtest() {
|
||||
var vm = require('vm');
|
||||
var fs = require('fs');
|
||||
var process = fs.readFileSync('./browser.js', {encoding: 'utf8'});
|
||||
|
||||
|
||||
describe('should work in vm in strict mode with no globals', function () {
|
||||
it('should parse', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'this.works = process.browser;';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
works: false
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
assert.ok(context.works);
|
||||
done();
|
||||
});
|
||||
it('setTimeout throws error', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'try {process.nextTick(function () {})} catch (e){this.works = e;}';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
works: false
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
assert.ok(context.works);
|
||||
done();
|
||||
});
|
||||
it('should generally work', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'process.nextTick(function () {assert.ok(true);done();})';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
clearTimeout: clearTimeout,
|
||||
setTimeout: setTimeout,
|
||||
done: done,
|
||||
assert: assert
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
});
|
||||
it('late defs setTimeout', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {assert.ok(true);done();})';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
clearTimeout: clearTimeout,
|
||||
hiddenSetTimeout: setTimeout,
|
||||
done: done,
|
||||
assert: assert
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
});
|
||||
it('late defs clearTimeout', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'var clearTimeout = hiddenClearTimeout;process.nextTick(function () {assert.ok(true);done();})';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
hiddenClearTimeout: clearTimeout,
|
||||
setTimeout: setTimeout,
|
||||
done: done,
|
||||
assert: assert
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
});
|
||||
it('late defs setTimeout and then redefine', function (done) {
|
||||
var str = '"use strict";var module = {exports:{}};';
|
||||
str += process;
|
||||
str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {setTimeout = function (){throw new Error("foo")};hiddenSetTimeout(function(){process.nextTick(function (){assert.ok(true);done();});});});';
|
||||
var script = new vm.Script(str);
|
||||
var context = {
|
||||
clearTimeout: clearTimeout,
|
||||
hiddenSetTimeout: setTimeout,
|
||||
done: done,
|
||||
assert: assert
|
||||
};
|
||||
script.runInNewContext(context);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue