Skip to content
Browse files

Update vendors and add Lo-Dash dependency.

  • Loading branch information...
1 parent bb3d770 commit a421927f4075716355e5eb45b4bd905bb8011b80 @jdalton jdalton committed Mar 9, 2013
View
22 vendor/lodash/LICENSE.txt
@@ -0,0 +1,22 @@
+Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+Based on Underscore.js 1.4.3, copyright 2009-2013 Jeremy Ashkenas,
+DocumentCloud Inc. <http://underscorejs.org/>
+
+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.
View
278 vendor/lodash/README.md
@@ -0,0 +1,278 @@
+# Lo-Dash <sup>v1.1.0</sup>
+[![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
+
+A low-level utility library delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features).
+
+## Download
+
+* Lo-Dash builds (for modern environments):<br>
+[Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.min.js)
+
+* Lo-Dash compatibility builds (for legacy and modern environments):<br>
+[Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.compat.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.compat.min.js)
+
+* Underscore compatibility builds:<br>
+[Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.underscore.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.underscore.min.js)
+
+* CDN copies of ≤ v1.1.0’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
+[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.js),
+[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.min.js),<br>
+[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.compat.js),
+[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.compat.min.js),<br>
+[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.underscore.js), and
+[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.underscore.min.js)
+
+* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
+
+## Dive in
+
+We’ve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/benchmarks), and [unit tests](http://lodash.com/tests).
+
+For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
+
+## Resources
+
+For more information check out these articles, screencasts, and other videos over Lo-Dash:
+
+ * Posts
+ - [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
+
+ * Videos
+ - [Introducing Lo-Dash](https://vimeo.com/44154599)
+ - [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
+ - [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
+ - [Unit testing in Lo-Dash](https://vimeo.com/45865290)
+ - [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
+ - [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
+
+## Features
+
+ * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
+ * [_(…)](http://lodash.com/docs#_) supports intuitive chaining
+ * [_.at](http://lodash.com/docs#at) for cherry-picking collection values
+ * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
+ * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays and objects
+ * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
+ * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
+ * [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
+ * [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
+ * [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
+ * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
+ * [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding
+ * [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
+ * [_.where](http://lodash.com/docs#where) supports deep object comparisons
+ * [_.clone](http://lodash.com/docs#clone), [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick),
+ [and more…](http://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
+ * [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
+ [and more…](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
+ * [_.filter](http://lodash.com/docs#filter), [_.find](http://lodash.com/docs#find), [_.map](http://lodash.com/docs#map),
+ [and more…](http://lodash.com/docs "_.countBy, _.every, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* and *“_.where”* `callback` shorthands
+
+## Support
+
+Lo-Dash has been tested in at least Chrome 5~25, Firefox 1~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.22, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
+
+## Custom builds
+
+Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
+To top it off, we handle all method dependency and alias mapping for you.
+
+ * Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument.
+```bash
+lodash backbone
+```
+
+ * CSP builds, supporting default [Content Security Policy](https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html) restrictions, may be created using the `csp` modifier argument.
+ The `csp` modifier is an alias of the `mobile` modifier. Lo-Dash may be used in Chrome extensions by using either the `csp`, `mobile`, or `underscore` build and using precompiled templates, or loading Lo-Dash in a [sandbox](http://developer.chrome.com/stable/extensions/sandboxingEval.html).
+```bash
+lodash csp
+```
+
+ * Legacy builds, tailored for older environments without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
+```bash
+lodash legacy
+```
+
+ * Modern builds, tailored for newer environments with ES5 support, may be created using the `modern` modifier argument.
+```bash
+lodash modern
+```
+
+ * Mobile builds, without method compilation and most bug fixes for old browsers, may be created using the `mobile` modifier argument.
+```bash
+lodash mobile
+```
+
+ * Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
+```bash
+lodash strict
+```
+
+ * Underscore builds, tailored for projects already using Underscore, may be created using the `underscore` modifier argument.
+```bash
+lodash underscore
+```
+
+Custom builds may be created using the following commands:
+
+ * Use the `category` argument to pass comma separated categories of methods to include in the build.<br>
+ Valid categories (case-insensitive) are *“arrays”*, *“chaining”*, *“collections”*, *“functions”*, *“objects”*, and *“utilities”*.
+```bash
+lodash category=collections,functions
+lodash category="collections, functions"
+```
+
+ * Use the `exports` argument to pass comma separated names of ways to export the `LoDash` function.<br>
+ Valid exports are *“amd”*, *“commonjs”*, *“global”*, *“node”*, and *“none”*.
+```bash
+lodash exports=amd,commonjs,node
+lodash exports="amd, commonjs, node"
+```
+
+ * Use the `iife` argument to specify code to replace the immediately-invoked function expression that wraps Lo-Dash.
+```bash
+lodash iife="!function(window,undefined){%output%}(this)"
+```
+
+ * Use the `include` argument to pass comma separated method/category names to include in the build.
+```bash
+lodash include=each,filter,map
+lodash include="each, filter, map"
+```
+
+ * Use the `minus` argument to pass comma separated method/category names to remove from those included in the build.
+```bash
+lodash underscore minus=result,shuffle
+lodash underscore minus="result, shuffle"
+```
+
+ * Use the `plus` argument to pass comma separated method/category names to add to those included in the build.
+```bash
+lodash backbone plus=random,template
+lodash backbone plus="random, template"
+```
+
+ * Use the `template` argument to pass the file path pattern used to match template files to precompile.
+```bash
+lodash template="./*.jst"
+```
+
+ * Use the `settings` argument to pass the template settings used when precompiling templates.
+```bash
+lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
+```
+
+ * Use the `moduleId` argument to specify the AMD module ID of Lo-Dash, which defaults to “lodash”, used by precompiled templates.
+```bash
+lodash moduleId="underscore"
+```
+
+All arguments, except `legacy` with `csp`, `mobile`, `modern`, or `underscore`, may be combined.<br>
+Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
+
+The following options are also supported:
+
+ * `-c`, `--stdout` ......... Write output to standard output
+ * `-d`, `--debug` ........... Write only the non-minified development output
+ * `-h`, `--help` ............. Display help information
+ * `-m`, `--minify` ......... Write only the minified production output
+ * `-o`, `--output` ......... Write output to a given path/filename
+ * `-p`, `--source-map` .. Generate a source map for the minified output, using an optional source map URL
+ * `-s`, `--silent` ......... Skip status updates normally logged to the console
+ * `-V`, `--version` ....... Output current version of Lo-Dash
+
+The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
+
+## Installation and usage
+
+In browsers:
+
+```html
+<script src="lodash.js"></script>
+```
+
+Using [`npm`](http://npmjs.org/):
+
+```bash
+npm install lodash
+
+npm install -g lodash
+npm link lodash
+```
+
+To avoid potential issues, update `npm` before installing Lo-Dash:
+
+```bash
+npm install npm -g
+```
+
+In [Node.js](http://nodejs.org/) and [RingoJS ≥ v0.8.0](http://ringojs.org/):
+
+```js
+var _ = require('lodash');
+
+// or as a drop-in replacement for Underscore
+var _ = require('lodash/dist/lodash.underscore');
+```
+
+**Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it.
+
+In [RingoJS ≤ v0.7.0](http://ringojs.org/):
+
+```js
+var _ = require('lodash')._;
+```
+
+In [Rhino](http://www.mozilla.org/rhino/):
+
+```js
+load('lodash.js');
+```
+
+In an AMD loader like [RequireJS](http://requirejs.org/):
+
+```js
+require({
+ 'paths': {
+ 'underscore': 'path/to/lodash'
+ }
+},
+['underscore'], function(_) {
+ console.log(_.VERSION);
+});
+```
+
+## Release Notes
+
+### <sup>v1.1.0</sup>
+
+ * Added `rhino -require` support
+ * Added `_.createCallback`, `_.parseInt`, `_.runInContext`, and `_.support`
+ * Added support for `callback` and `thisArg` arguments to `_.flatten`
+ * Added CommonJS/Node support to precompiled templates
+ * Ensured the `exports` object is not a DOM element
+ * Made `_.cloneDeep`’s `callback` support more closely follow its documentation
+ * Made the template precompiler create nonexistent directories of `--output` paths
+ * Made `_.object` an alias of `_.zipObject`
+ * Optimized method chaining
+
+The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
+
+## BestieJS
+
+Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
+
+## Author
+
+* [John-David Dalton](http://allyoucanleet.com/)
+ [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")
+
+## Contributors
+
+* [Kit Cambridge](http://kitcambridge.github.com/)
+ [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter")
+* [Mathias Bynens](http://mathiasbynens.be/)
+ [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter")
View
5,381 vendor/lodash/lodash.js
5,381 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 vendor/platform.js/README.md
@@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support
-Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
+Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5~25, Firefox 1~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.22, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Installation and usage
View
43 vendor/platform.js/platform.js
@@ -25,6 +25,9 @@
/** Detect Java environment */
var java = /Java/.test(getClassOf(window.java)) && window.java;
+ /** Detect Rhino */
+ var rhino = java && getClassOf(window.environment) == 'Environment';
+
/** A character to represent alpha */
var alpha = java ? 'a' : '\u03b1';
@@ -581,10 +584,11 @@
// detect stubborn layout engines
if (layout == 'iCab' && parseFloat(version) > 3) {
layout = ['WebKit'];
- } else if (data =
- /Opera/.test(name) && 'Presto' ||
- /\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' ||
- !layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident')) {
+ } else if ((data =
+ /Opera/.test(name) && 'Presto' ||
+ /\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' ||
+ !layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident')
+ )) {
layout = [data];
}
// leverage environment features
@@ -597,7 +601,7 @@
arch = data.getProperty('os.arch');
os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
}
- if (typeof exports == 'object' && exports) {
+ if (freeExports) {
// if `thisBinding` is the [ModuleScope]
if (thisBinding == oldWin && typeof system == 'object' && (data = [system])[0]) {
os || (os = data[0].os || null);
@@ -610,23 +614,28 @@
name = 'Narwhal';
}
}
- } else if (typeof process == 'object' && (data = process)) {
+ }
+ else if (typeof process == 'object' && (data = process)) {
name = 'Node.js';
arch = data.arch;
os = data.platform;
version = /[\d.]+/.exec(data.version)[0];
}
- } else if (getClassOf(window.environment) == 'Environment') {
+ else if (rhino) {
+ name = 'Rhino';
+ }
+ }
+ else if (rhino) {
name = 'Rhino';
}
}
// detect Adobe AIR
- else if (getClassOf(data = window.runtime) == 'ScriptBridgingProxyObject') {
+ else if (getClassOf((data = window.runtime)) == 'ScriptBridgingProxyObject') {
name = 'Adobe AIR';
os = data.flash.system.Capabilities.os;
}
// detect PhantomJS
- else if (getClassOf(data = window.phantom) == 'RuntimeObject') {
+ else if (getClassOf((data = window.phantom)) == 'RuntimeObject') {
name = 'PhantomJS';
version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
}
@@ -646,9 +655,10 @@
}
// detect prerelease phases
if (version && (data =
- /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
- /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
- /\bMinefield\b/i.test(ua) && 'a')) {
+ /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
+ /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
+ /\bMinefield\b/i.test(ua) && 'a'
+ )) {
prerelease = /b/i.test(data) ? 'beta' : 'alpha';
version = version.replace(RegExp(data + '\\+?$'), '') +
(prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
@@ -689,8 +699,9 @@
// detect BlackBerry OS version
// http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
else if (/BlackBerry/.test(product) && (data =
- (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
- version)) {
+ (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
+ version
+ )) {
os = 'Device Software ' + data;
version = null;
}
@@ -705,7 +716,7 @@
/Windows XP/.test(os) && version > 8 ||
version == 8 && !/Trident/.test(ua)
))
- ) && !reOpera.test(data = parse.call(forOwn, ua.replace(reOpera, '') + ';')) && data.name) {
+ ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
// when "indentifying", the UA contains both Opera and the other browser's name
data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
@@ -793,7 +804,7 @@
}
}
// strip incorrect OS versions
- if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 &&
+ if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
ua.indexOf('/' + data + '-') > -1) {
os = trim(os.replace(data, ''));
}
View
29 vendor/qunit-clib/README.md
@@ -1,4 +1,4 @@
-# QUnit CLIB <sup>v1.2.0</sup>
+# QUnit CLIB <sup>v1.3.0</sup>
## command-line interface boilerplate
QUnit CLIB helps extend QUnit's CLI support to many common CLI environments.
@@ -9,26 +9,29 @@ QUnit CLIB helps extend QUnit's CLI support to many common CLI environments.
## Support
-QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, PhantomJS 1.8.1, RingoJS v0.9, and Rhino v1.7RC5.
+QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.22, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Usage
```js
-(function(window) {
+;(function(window) {
+ 'use strict';
// use a single "load" function
var load = typeof require == 'function' ? require : window.load;
// load QUnit and CLIB if needed
- var QUnit =
- window.QUnit || (
- window.addEventListener || (window.addEventListener = Function.prototype),
- window.setTimeout || (window.setTimeout = Function.prototype),
- window.QUnit = load('path/to/qunit.js') || window.QUnit,
- load('path/to/qunit-clib.js'),
- window.addEventListener === Function.prototype && delete window.addEventListener,
+ var QUnit = (function() {
+ var noop = Function.prototype;
+ return window.QUnit || (
+ window.addEventListener || (window.addEventListener = noop),
+ window.setTimeout || (window.setTimeout = noop),
+ window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
+ (load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(window),
+ addEventListener === noop && delete window.addEventListener,
window.QUnit
);
+ }());
// explicitly call `QUnit.module()` instead of `module()`
// in case we are in a CLI environment
@@ -38,9 +41,8 @@ QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, Pha
// ...
});
- // must call `QUnit.start()` if using QUnit < 1.3.0 with Node.js or any
- // version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS
- if (!window.document) {
+ // call `QUnit.start()` for Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
+ if (!window.document || window.phantom) {
QUnit.start();
}
}(typeof global == 'object' && global || this));
@@ -49,7 +51,6 @@ QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, Pha
## Footnotes
1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0
-
2. Rhino v1.7RC4 does not support timeout fallbacks `clearTimeout` and `setTimeout`
## Author
View
107 vendor/qunit-clib/qunit-clib.js
@@ -7,12 +7,28 @@
;(function(window) {
'use strict';
+ /** Detect free variable `exports` */
+ var freeExports = typeof exports == 'object' && exports;
+
+ /** Detect free variable `global` and use it as `window` */
+ var freeGlobal = typeof global == 'object' && global;
+ if (freeGlobal.global === freeGlobal) {
+ window = freeGlobal;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
/**
- * Timeout fallbacks based on the work of Andrea Giammarchi and Weston C.
- * https://github.com/WebReflection/wru/blob/master/src/rhinoTimers.js
- * http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout
+ * Installs the CLI boilerplate additions on the given `context` object.
+ *
+ * @memberOf exports
+ * @param {Object} context The context object.
*/
- (function() {
+ function runInContext(context) {
+ // exit early if no `context` is provided or if `QUnit` does not exist
+ if (!context || !context.QUnit) {
+ return;
+ }
/**
* Schedules timer-based callbacks.
@@ -29,7 +45,7 @@
// https://bugzilla.mozilla.org/show_bug.cgi?id=775566
var task = ids[++counter] = new JavaAdapter(java.util.TimerTask, {
'run': function() {
- fn.apply(window, args);
+ fn.apply(context, args);
}
});
// support non-functions
@@ -53,7 +69,7 @@
/**
* Clears the delay set by `setInterval` or `setTimeout`.
*
- * @memberOf window
+ * @memberOf context
* @param {Number} id The ID of the timeout to be cleared.
*/
function clearTimer(id) {
@@ -67,7 +83,7 @@
/**
* Executes a code snippet or function repeatedly, with a delay between each call.
*
- * @memberOf window
+ * @memberOf context
* @param {Function|String} fn The function to call or string to evaluate.
* @oaram {Number} delay The number of milliseconds to delay each `fn` call.
* @param [arg1, arg2, ...] Arguments to invoke `fn` with.
@@ -80,7 +96,7 @@
/**
* Executes a code snippet or a function after specified delay.
*
- * @memberOf window
+ * @memberOf context
* @param {Function|String} fn The function to call or string to evaluate.
* @oaram {Number} delay The number of milliseconds to delay the `fn` call.
* @param [arg1, arg2, ...] Arguments to invoke `fn` with.
@@ -90,29 +106,17 @@
return schedule(fn, delay, slice.call(arguments, 2));
}
- try {
- var counter = 0,
- ids = {},
- slice = Array.prototype.slice,
- timer = new java.util.Timer;
-
- window.clearInterval =
- window.clearTimeout = clearTimer;
- window.setInterval = setInterval;
- window.setTimeout = setTimeout;
- } catch(e) { }
- }());
+ /*------------------------------------------------------------------------*/
- /*--------------------------------------------------------------------------*/
+ /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
+ var console = context.console || (context.console = { 'log': context.print });
- (function() {
+ /** Shorten `context.QUnit.QUnit` to `context.QUnit` */
+ var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
/** Used as a horizontal rule in console output */
var hr = '----------------------------------------';
- /** Shorten `window.QUnit.QUnit` to `window.QUnit` */
- window.QUnit && (QUnit = QUnit.QUnit || QUnit);
-
/**
* A logging callback triggered when all testing is completed.
*
@@ -134,14 +138,14 @@
console.log(' Finished in ' + details.runtime + ' milliseconds.');
console.log(hr);
- // exit out of Rhino
+ // exit out of Narhwal, Rhino, or Ringo
try {
quit();
} catch(e) { }
// exit out of Node.js or PhantomJS
try {
- var process = window.process || window.phantom;
+ var process = context.process || context.phantom;
if (details.failed) {
console.error('Error: ' + details.failed + ' of ' + details.total + ' tests failed.');
process.exit(1);
@@ -247,23 +251,42 @@
*/
'assertions': []
};
- }());
- /*--------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+
+ // Timeout fallbacks based on the work of Andrea Giammarchi and Weston C.
+ // https://github.com/WebReflection/wru/blob/master/src/rhinoTimers.js
+ // http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout
+ try {
+ var counter = 0,
+ ids = {},
+ slice = Array.prototype.slice,
+ timer = new java.util.Timer;
+
+ context.clearInterval =
+ context.clearTimeout = clearTimer;
+ context.setInterval = setInterval;
+ context.setTimeout = setTimeout;
+ } catch(e) { }
- // expose shortcuts
- // exclude `module` because some environments have it as a built-in object
- ('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' +
- 'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) {
- window[methodName] = QUnit[methodName];
- });
+ // expose shortcuts
+ // exclude `module` because some environments have it as a built-in object
+ ('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' +
+ 'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) {
+ context[methodName] = QUnit[methodName];
+ });
- // add `console.log()` support for Narwhal, Rhino, and RingoJS
- if (!window.console && window.print) {
- window.console = { 'log': window.print };
+ // must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with
+ // Node.js or any version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS
+ QUnit.init();
}
- // must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with
- // Node.js or any version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS
- QUnit.init();
-}(typeof global == 'object' && global || this));
+ /*--------------------------------------------------------------------------*/
+
+ // expose QUnit CLIB
+ if (freeExports) {
+ freeExports.runInContext = runInContext;
+ } else {
+ runInContext(window);
+ }
+}(this));
View
69 vendor/requirejs/require.js
@@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.1.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
@@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
- version = '2.1.4',
+ version = '2.1.5',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
@@ -191,15 +191,21 @@ var requirejs, require, define;
var inCheckLoaded, Module, context, handlers,
checkLoadedTimeoutId,
config = {
+ //Defaults. Do not set a default for map
+ //config to speed up normalize(), which
+ //will run faster if there is no default.
waitSeconds: 7,
baseUrl: './',
paths: {},
pkgs: {},
shim: {},
- map: {},
config: {}
},
registry = {},
+ //registry of just enabled modules, to speed
+ //cycle breaking code when lots of modules
+ //are registered, but not activated.
+ enabledRegistry = {},
undefEvents = {},
defQueue = [],
defined = {},
@@ -295,7 +301,7 @@ var requirejs, require, define;
}
//Apply map config if available.
- if (applyMap && (baseParts || starMap) && map) {
+ if (applyMap && map && (baseParts || starMap)) {
nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) {
@@ -576,6 +582,7 @@ var requirejs, require, define;
function cleanRegistry(id) {
//Clean up machinery used for waiting modules.
delete registry[id];
+ delete enabledRegistry[id];
}
function breakCycle(mod, traced, processed) {
@@ -624,7 +631,7 @@ var requirejs, require, define;
inCheckLoaded = true;
//Figure out the state of all the modules.
- eachProp(registry, function (mod) {
+ eachProp(enabledRegistry, function (mod) {
map = mod.map;
modId = map.id;
@@ -805,7 +812,7 @@ var requirejs, require, define;
},
/**
- * Checks is the module is ready to define itself, and if so,
+ * Checks if the module is ready to define itself, and if so,
* define it.
*/
check: function () {
@@ -883,7 +890,7 @@ var requirejs, require, define;
}
//Clean up
- delete registry[id];
+ cleanRegistry(id);
this.defined = true;
}
@@ -1049,6 +1056,7 @@ var requirejs, require, define;
},
enable: function () {
+ enabledRegistry[this.map.id] = this;
this.enabled = true;
//Set flag mentioning that the module is enabling,
@@ -1208,6 +1216,7 @@ var requirejs, require, define;
Module: Module,
makeModuleMap: makeModuleMap,
nextTick: req.nextTick,
+ onError: onError,
/**
* Set a configuration for the context.
@@ -1234,6 +1243,9 @@ var requirejs, require, define;
eachProp(cfg, function (value, prop) {
if (objs[prop]) {
if (prop === 'map') {
+ if (!config.map) {
+ config.map = {};
+ }
mixin(config[prop], value, true, true);
} else {
mixin(config[prop], value, true);
@@ -1345,7 +1357,7 @@ var requirejs, require, define;
//Synchronous access to one module. If require.get is
//available (as in the Node adapter), prefer that.
if (req.get) {
- return req.get(context, deps, relMap);
+ return req.get(context, deps, relMap, localRequire);
}
//Normalize module name, if it contains . or ..
@@ -1396,7 +1408,7 @@ var requirejs, require, define;
* plain URLs like nameToUrl.
*/
toUrl: function (moduleNamePlusExt) {
- var ext, url,
+ var ext,
index = moduleNamePlusExt.lastIndexOf('.'),
segment = moduleNamePlusExt.split('/')[0],
isRelative = segment === '.' || segment === '..';
@@ -1408,9 +1420,8 @@ var requirejs, require, define;
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
}
- url = context.nameToUrl(normalize(moduleNamePlusExt,
- relMap && relMap.id, true), ext || '.fake');
- return ext ? url : url.substring(0, url.length - 5);
+ return context.nameToUrl(normalize(moduleNamePlusExt,
+ relMap && relMap.id, true), ext, true);
},
defined: function (id) {
@@ -1529,7 +1540,7 @@ var requirejs, require, define;
* it is assumed to have already been normalized. This is an
* internal API, not a public one. Use toUrl for the public API.
*/
- nameToUrl: function (moduleName, ext) {
+ nameToUrl: function (moduleName, ext, skipExt) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
parentPath;
@@ -1578,7 +1589,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/');
- url += (ext || (/\?/.test(url) ? '' : '.js'));
+ url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
}
@@ -1817,7 +1828,7 @@ var requirejs, require, define;
node.attachEvent('onreadystatechange', context.onScriptLoad);
//It would be great to add an error handler here to catch
//404s in IE9+. However, onreadystatechange will fire before
- //the error handler, so that does not help. If addEvenListener
+ //the error handler, so that does not help. If addEventListener
//is used, then IE will fire error before load, but we cannot
//use that pathway given the connect.microsoft.com issue
//mentioned above about not doing the 'script execute,
@@ -1846,16 +1857,24 @@ var requirejs, require, define;
return node;
} else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
+ try {
+ //In a web worker, use importScripts. This is not a very
+ //efficient use of importScripts, importScripts will block until
+ //its script is downloaded and evaluated. However, if web workers
+ //are in play, the expectation that a build has been done so that
+ //only one script needs to be loaded anyway. This may need to be
+ //reevaluated if other use cases become common.
+ importScripts(url);
+
+ //Account for anonymous modules
+ context.completeLoad(moduleName);
+ } catch (e) {
+ context.onError(makeError('importscripts',
+ 'importScripts failed for ' +
+ moduleName + ' at ' + url,
+ e,
+ [moduleName]));
+ }
}
};

0 comments on commit a421927

Please sign in to comment.
Something went wrong with that request. Please try again.