mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Update vendors.
Former-commit-id: b239f365c9d8e012bf20525167e6d1a412ce828e
This commit is contained in:
4
vendor/backbone/backbone.js
vendored
4
vendor/backbone/backbone.js
vendored
@@ -1290,8 +1290,8 @@
|
||||
_ensureElement: function() {
|
||||
if (!this.el) {
|
||||
var attrs = _.extend({}, getValue(this, 'attributes'));
|
||||
if (this.id) attrs.id = this.id;
|
||||
if (this.className) attrs['class'] = this.className;
|
||||
if (this.id) attrs.id = getValue(this, 'id');
|
||||
if (this.className) attrs['class'] = getValue(this, 'className');
|
||||
this.setElement(this.make(getValue(this, 'tagName'), attrs), false);
|
||||
} else {
|
||||
this.setElement(this.el, false);
|
||||
|
||||
14
vendor/backbone/test/view.js
vendored
14
vendor/backbone/test/view.js
vendored
@@ -135,6 +135,20 @@ $(document).ready(function() {
|
||||
ok(!view.el);
|
||||
});
|
||||
|
||||
test("View: with className and id functions", 2, function() {
|
||||
var View = Backbone.View.extend({
|
||||
className: function() {
|
||||
return 'className';
|
||||
},
|
||||
id: function() {
|
||||
return 'id';
|
||||
}
|
||||
});
|
||||
var view = new View();
|
||||
strictEqual(view.el.className, 'className');
|
||||
strictEqual(view.el.id, 'id');
|
||||
});
|
||||
|
||||
test("View: with attributes", 2, function() {
|
||||
var view = new Backbone.View({attributes : {'class': 'one', id: 'two'}});
|
||||
equal(view.el.className, 'one');
|
||||
|
||||
11
vendor/benchmark.js/README.md
vendored
11
vendor/benchmark.js/README.md
vendored
@@ -1,4 +1,4 @@
|
||||
# Benchmark.js <sup>v1.0.0-pre</sup>
|
||||
# Benchmark.js <sup>v1.0.0</sup>
|
||||
|
||||
A [robust](http://calendar.perfplanet.com/2010/bulletproof-javascript-benchmarks/ "Bulletproof JavaScript benchmarks") benchmarking library that works on nearly all JavaScript platforms<sup><a name="fnref1" href="#fn1">1</a></sup>, supports high-resolution timers, and returns statistically significant results. As seen on [jsPerf](http://jsperf.com/).
|
||||
|
||||
@@ -12,6 +12,10 @@ The documentation for Benchmark.js can be viewed here: <http://benchmarkjs.com/d
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/benchmark.js/wiki/Roadmap).
|
||||
|
||||
## Support
|
||||
|
||||
Benchmark.js has been tested in at least Adobe AIR 2.6, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.4.8-0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC3.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
In a browser or Adobe AIR:
|
||||
@@ -114,11 +118,6 @@ suite.add('RegExp#test', function() {
|
||||
// > Fastest is String#indexOf
|
||||
~~~
|
||||
|
||||
## Footnotes
|
||||
|
||||
1. Benchmark.js has been tested in at least Adobe AIR 2.6, Chrome 5-15, Firefox 1.5-8, IE 6-10, Opera 9.25-11.52, Safari 2-5.1.1, Node.js 0.4.8-0.6.1, Narwhal 0.3.2, RingoJS 0.7-0.8, and Rhino 1.7RC3.
|
||||
<a name="fn1" title="Jump back to footnote 1 in the text." href="#fnref1">↩</a>
|
||||
|
||||
## Authors
|
||||
|
||||
* [Mathias Bynens](http://mathiasbynens.be/)
|
||||
|
||||
4
vendor/benchmark.js/benchmark.js
vendored
4
vendor/benchmark.js/benchmark.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Benchmark.js v1.0.0-pre <http://benchmarkjs.com/>
|
||||
* Benchmark.js v1.0.0 <http://benchmarkjs.com/>
|
||||
* Copyright 2010-2012 Mathias Bynens <http://mths.be/>
|
||||
* Based on JSLitmus.js, copyright Robert Kieffer <http://broofa.com/>
|
||||
* Modified by John-David Dalton <http://allyoucanleet.com/>
|
||||
@@ -3218,7 +3218,7 @@
|
||||
* @memberOf Benchmark
|
||||
* @type String
|
||||
*/
|
||||
'version': '1.0.0-pre',
|
||||
'version': '1.0.0',
|
||||
|
||||
// an object of environment/feature detection flags
|
||||
'support': support,
|
||||
|
||||
2
vendor/docdown/src/DocDown/Entry.php
vendored
2
vendor/docdown/src/DocDown/Entry.php
vendored
@@ -196,7 +196,7 @@ class Entry {
|
||||
* @returns {Array} The entry `param` data.
|
||||
*/
|
||||
public function getParams( $index = null ) {
|
||||
preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[[^]]+\]|[$\w]+)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
|
||||
preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w]+)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
|
||||
if (count($result = array_filter(array_slice($result, 1)))) {
|
||||
// repurpose array
|
||||
foreach ($result as $param) {
|
||||
|
||||
10
vendor/docdown/src/DocDown/Generator.php
vendored
10
vendor/docdown/src/DocDown/Generator.php
vendored
@@ -208,6 +208,7 @@ class Generator {
|
||||
$openTag = "\n<!-- div -->\n";
|
||||
$closeTag = "\n<!-- /div -->\n";
|
||||
$result = array('# ' . $this->options['title']);
|
||||
$toc = 'toc';
|
||||
|
||||
// initialize $api array
|
||||
foreach ($this->entries as $entry) {
|
||||
@@ -304,10 +305,15 @@ class Generator {
|
||||
|
||||
$compiling = $compiling ? ($result[] = $closeTag) : true;
|
||||
|
||||
// assign TOC hash
|
||||
if (count($result) == 2) {
|
||||
$toc = $member;
|
||||
}
|
||||
|
||||
// add root entry
|
||||
array_push(
|
||||
$result,
|
||||
$openTag, '## ' . (count($result) == 2 ? '<a id="toc"></a>' : '') . '`' . $member . '`',
|
||||
$openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`',
|
||||
Generator::interpolate('* [`' . $member . '`](##{hash})', $entry)
|
||||
);
|
||||
|
||||
@@ -401,7 +407,7 @@ class Generator {
|
||||
}
|
||||
|
||||
// close tags add TOC link reference
|
||||
array_push($result, $closeTag, $closeTag, '', ' [1]: #toc "Jump back to the TOC."');
|
||||
array_push($result, $closeTag, $closeTag, '', ' [1]: #' . $toc . ' "Jump back to the TOC."');
|
||||
|
||||
// cleanup whitespace
|
||||
return trim(preg_replace('/ +\n/', "\n", join($result, "\n")));
|
||||
|
||||
11
vendor/platform.js/README.md
vendored
11
vendor/platform.js/README.md
vendored
@@ -1,4 +1,4 @@
|
||||
# Platform.js <sup>v1.0.0-pre</sup>
|
||||
# Platform.js <sup>v1.0.0</sup>
|
||||
|
||||
A platform detection library that works on nearly all JavaScript platforms<sup><a name="fnref1" href="#fn1">1</a></sup>.
|
||||
|
||||
@@ -16,6 +16,10 @@ The documentation for Platform.js can be viewed here: [/doc/README.md](https://g
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap).
|
||||
|
||||
## Support
|
||||
|
||||
Platform.js has been tested in at least Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.4.8-0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC3.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
In a browser or Adobe AIR:
|
||||
@@ -83,11 +87,6 @@ info.os; // 'Mac OS X 10.7.2'
|
||||
info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'
|
||||
~~~
|
||||
|
||||
## Footnotes
|
||||
|
||||
1. Platform.js has been tested in at least Adobe AIR 2.6, Chrome 5-15, Firefox 1.5-8, IE 6-10, Opera 9.25-11.52, Safari 2-5.1.1, Node.js 0.4.8-0.6.1, Narwhal 0.3.2, RingoJS 0.7-0.8, and Rhino 1.7RC3.
|
||||
<a name="fn1" title="Jump back to footnote 1 in the text." href="#fnref1">↩</a>
|
||||
|
||||
## Author
|
||||
|
||||
* [John-David Dalton](http://allyoucanleet.com/)
|
||||
|
||||
104
vendor/platform.js/platform.js
vendored
104
vendor/platform.js/platform.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Platform.js v1.0.0-pre <http://mths.be/platform>
|
||||
* Platform.js v1.0.0 <http://mths.be/platform>
|
||||
* Copyright 2010-2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Available under MIT license <http://mths.be/mit>
|
||||
*/
|
||||
@@ -297,7 +297,7 @@
|
||||
'Opera Mini',
|
||||
'Opera',
|
||||
'Chrome',
|
||||
{ 'label': 'Chrome Mobile', 'pattern': 'CrMo' },
|
||||
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
|
||||
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
|
||||
{ 'label': 'IE', 'pattern': 'MSIE' },
|
||||
'Safari'
|
||||
@@ -512,12 +512,11 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Return platform description when the platform object is coerced to a string.
|
||||
* Returns `platform.description` when the platform object is coerced to a string.
|
||||
*
|
||||
* @name toString
|
||||
* @memberOf platform
|
||||
* @type Function
|
||||
* @returns {String} The platform description.
|
||||
* @returns {String} Returns `platform.description` if available, else an empty string.
|
||||
*/
|
||||
function toStringPlatform() {
|
||||
return this.description || '';
|
||||
@@ -573,7 +572,7 @@
|
||||
// detect non-Opera versions (order is important)
|
||||
if (!version) {
|
||||
version = getVersion([
|
||||
'(?:Cloud9|CrMo|Opera ?Mini|Raven|Silk(?!/[\\d.]+$))',
|
||||
'(?:Cloud9|CriOS|CrMo|Opera ?Mini|Raven|Silk(?!/[\\d.]+$))',
|
||||
'Version',
|
||||
qualify(name),
|
||||
'(?:Firefox|Minefield|NetFront)'
|
||||
@@ -708,7 +707,7 @@
|
||||
))
|
||||
) && !reOpera.test(data = parse.call(forOwn, ua.replace(reOpera, '') + ';')) && data.name) {
|
||||
|
||||
// when "indentifying" the UA contains both Opera and the other browser's name
|
||||
// when "indentifying", the UA contains both Opera and the other browser's name
|
||||
data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
|
||||
if (reOpera.test(name)) {
|
||||
if (/IE/.test(data) && os == 'Mac OS') {
|
||||
@@ -716,7 +715,7 @@
|
||||
}
|
||||
data = 'identify' + data;
|
||||
}
|
||||
// when "masking" the UA contains only the other browser's name
|
||||
// when "masking", the UA contains only the other browser's name
|
||||
else {
|
||||
data = 'mask' + data;
|
||||
if (operaClass) {
|
||||
@@ -760,7 +759,7 @@
|
||||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : '5');
|
||||
} else {
|
||||
layout[1] = 'like Chrome';
|
||||
data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 535.21 ? 18 : '19');
|
||||
data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : '21');
|
||||
}
|
||||
// add the postfix of ".x" or "+" for approximate versions
|
||||
layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+');
|
||||
@@ -769,6 +768,30 @@
|
||||
version = data;
|
||||
}
|
||||
}
|
||||
// detect Opera desktop modes
|
||||
if (name == 'Opera' && (data = /(?:zbov|zvav)$/.exec(os))) {
|
||||
name += ' ';
|
||||
description.unshift('desktop mode');
|
||||
if (data == 'zvav') {
|
||||
name += 'Mini';
|
||||
version = null;
|
||||
} else {
|
||||
name += 'Mobile';
|
||||
}
|
||||
}
|
||||
// detect Chrome desktop mode
|
||||
else if (name == 'Safari' && /Chrome/.exec(layout[1])) {
|
||||
description.unshift('desktop mode');
|
||||
name = 'Chrome Mobile';
|
||||
version = null;
|
||||
|
||||
if (/Mac OS X/.test(os)) {
|
||||
manufacturer = 'Apple';
|
||||
os = 'iOS 4.3+';
|
||||
} else {
|
||||
os = null;
|
||||
}
|
||||
}
|
||||
// strip incorrect OS versions
|
||||
if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 &&
|
||||
ua.indexOf('/' + data + '-') > -1) {
|
||||
@@ -793,9 +816,25 @@
|
||||
if (product) {
|
||||
description.push((/^on /.test(description[description.length -1]) ? '' : 'on ') + product);
|
||||
}
|
||||
// parse OS into an object
|
||||
if (os) {
|
||||
data = / ([\d.+]+)$/.exec(os);
|
||||
os = {
|
||||
'architecture': 32,
|
||||
'family': data ? os.replace(data[0], '') : os,
|
||||
'version': data ? data[1] : null,
|
||||
'toString': function() {
|
||||
var version = this.version;
|
||||
return this.family + (version ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
|
||||
}
|
||||
};
|
||||
}
|
||||
// add browser/OS architecture
|
||||
if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i).test(arch) && !/\bi686\b/i.test(arch)) {
|
||||
os = os && os + (data.test(os) ? '' : ' 64-bit');
|
||||
if ((data = / (?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
|
||||
if (os) {
|
||||
os.architecture = 64;
|
||||
os.family = os.family.replace(data, '');
|
||||
}
|
||||
if (name && (/WOW64/i.test(ua) ||
|
||||
(useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform)))) {
|
||||
description.unshift('32-bit');
|
||||
@@ -834,11 +873,46 @@
|
||||
* The name of the operating system.
|
||||
*
|
||||
* @memberOf platform
|
||||
* @type String|Null
|
||||
* @type Object
|
||||
*/
|
||||
'os': os && (name &&
|
||||
!(os == os.split(' ')[0] && (os == name.split(' ')[0] || product)) &&
|
||||
description.push(product ? '(' + os + ')' : 'on ' + os), os),
|
||||
'os': os
|
||||
? (name &&
|
||||
!(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product)) &&
|
||||
description.push(product ? '(' + os + ')' : 'on ' + os), os)
|
||||
: {
|
||||
|
||||
/**
|
||||
* The CPU architecture the OS is built for.
|
||||
*
|
||||
* @memberOf platform.os
|
||||
* @type String|Null
|
||||
*/
|
||||
'architecture': null,
|
||||
|
||||
/**
|
||||
* The family of the OS.
|
||||
*
|
||||
* @memberOf platform.os
|
||||
* @type String|Null
|
||||
*/
|
||||
'family': null,
|
||||
|
||||
/**
|
||||
* The version of the OS.
|
||||
*
|
||||
* @memberOf platform.os
|
||||
* @type String|Null
|
||||
*/
|
||||
'version': null,
|
||||
|
||||
/**
|
||||
* Returns the OS string.
|
||||
*
|
||||
* @memberOf platform.os
|
||||
* @returns {String} The OS string.
|
||||
*/
|
||||
'toString': function() { return 'null'; }
|
||||
},
|
||||
|
||||
/**
|
||||
* The platform description.
|
||||
|
||||
201
vendor/requirejs/require.js
vendored
201
vendor/requirejs/require.js
vendored
@@ -1,21 +1,25 @@
|
||||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* @license RequireJS 2.0.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
|
||||
*/
|
||||
/*jslint regexp: true, nomen: true */
|
||||
//Not using strict: uneven strict support in browsers, #392, and causes
|
||||
//problems with requirejs.exec()/transpiler plugins that may not be strict.
|
||||
/*jslint regexp: true, nomen: true, sloppy: true */
|
||||
/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
|
||||
|
||||
var requirejs, require, define;
|
||||
(function (global) {
|
||||
'use strict';
|
||||
|
||||
var version = '2.0.4',
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.0.5',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
currDirRegExp = /^\.\//,
|
||||
ostring = Object.prototype.toString,
|
||||
op = Object.prototype,
|
||||
ostring = op.toString,
|
||||
hasOwn = op.hasOwnProperty,
|
||||
ap = Array.prototype,
|
||||
aps = ap.slice,
|
||||
apsp = ap.splice,
|
||||
@@ -33,9 +37,7 @@ var requirejs, require, define;
|
||||
contexts = {},
|
||||
cfg = {},
|
||||
globalDefQueue = [],
|
||||
useInteractive = false,
|
||||
req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath;
|
||||
useInteractive = false;
|
||||
|
||||
function isFunction(it) {
|
||||
return ostring.call(it) === '[object Function]';
|
||||
@@ -76,7 +78,7 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
function hasProp(obj, prop) {
|
||||
return obj.hasOwnProperty(prop);
|
||||
return hasOwn.call(obj, prop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +154,7 @@ var requirejs, require, define;
|
||||
//look up paths relative to the moduleName
|
||||
var args = aps.call(arguments, 0), lastArg;
|
||||
if (enableBuildCallback &&
|
||||
isFunction((lastArg = args[args.length - 1]))) {
|
||||
isFunction((lastArg = args[args.length - 1]))) {
|
||||
lastArg.__requireJsBuild = true;
|
||||
}
|
||||
args.push(relMap);
|
||||
@@ -169,14 +171,14 @@ var requirejs, require, define;
|
||||
], function (item) {
|
||||
var prop = item[1] || item[0];
|
||||
req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
|
||||
//If no context, then use default context. Reference from
|
||||
//contexts instead of early binding to default context, so
|
||||
//that during builds, the latest instance of the default
|
||||
//context with its config gets used.
|
||||
function () {
|
||||
var ctx = contexts[defContextName];
|
||||
return ctx[prop].apply(ctx, arguments);
|
||||
};
|
||||
//If no context, then use default context. Reference from
|
||||
//contexts instead of early binding to default context, so
|
||||
//that during builds, the latest instance of the default
|
||||
//context with its config gets used.
|
||||
function () {
|
||||
var ctx = contexts[defContextName];
|
||||
return ctx[prop].apply(ctx, arguments);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -221,7 +223,9 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
function newContext(contextName) {
|
||||
var config = {
|
||||
var inCheckLoaded, Module, context, handlers,
|
||||
checkLoadedTimeoutId,
|
||||
config = {
|
||||
waitSeconds: 7,
|
||||
baseUrl: './',
|
||||
paths: {},
|
||||
@@ -239,9 +243,7 @@ var requirejs, require, define;
|
||||
//should be executed, by the order they
|
||||
//load. Important for consistent cycle resolution
|
||||
//behavior.
|
||||
waitAry = [],
|
||||
inCheckLoaded, Module, context, handlers,
|
||||
checkLoadedTimeoutId;
|
||||
waitAry = [];
|
||||
|
||||
/**
|
||||
* Trims the . and .. from an array of path segments.
|
||||
@@ -254,7 +256,7 @@ var requirejs, require, define;
|
||||
*/
|
||||
function trimDots(ary) {
|
||||
var i, part;
|
||||
for (i = 0; ary[i]; i+= 1) {
|
||||
for (i = 0; ary[i]; i += 1) {
|
||||
part = ary[i];
|
||||
if (part === '.') {
|
||||
ary.splice(i, 1);
|
||||
@@ -287,12 +289,12 @@ var requirejs, require, define;
|
||||
* @returns {String} normalized name
|
||||
*/
|
||||
function normalize(name, baseName, applyMap) {
|
||||
var baseParts = baseName && baseName.split('/'),
|
||||
var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
|
||||
foundMap, foundI, foundStarMap, starI,
|
||||
baseParts = baseName && baseName.split('/'),
|
||||
normalizedBaseParts = baseParts,
|
||||
map = config.map,
|
||||
starMap = map && map['*'],
|
||||
pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
|
||||
foundMap;
|
||||
starMap = map && map['*'];
|
||||
|
||||
//Adjust any relative paths.
|
||||
if (name && name.charAt(0) === '.') {
|
||||
@@ -343,28 +345,41 @@ var requirejs, require, define;
|
||||
for (j = baseParts.length; j > 0; j -= 1) {
|
||||
mapValue = map[baseParts.slice(0, j).join('/')];
|
||||
|
||||
//baseName segment has config, find if it has one for
|
||||
//baseName segment has config, find if it has one for
|
||||
//this name.
|
||||
if (mapValue) {
|
||||
mapValue = mapValue[nameSegment];
|
||||
if (mapValue) {
|
||||
//Match, update name to the new value.
|
||||
foundMap = mapValue;
|
||||
foundI = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMap && starMap && starMap[nameSegment]) {
|
||||
foundMap = starMap[nameSegment];
|
||||
}
|
||||
|
||||
if (foundMap) {
|
||||
nameParts.splice(0, i, foundMap);
|
||||
name = nameParts.join('/');
|
||||
break;
|
||||
}
|
||||
|
||||
//Check for a star map match, but just hold on to it,
|
||||
//if there is a shorter segment match later in a matching
|
||||
//config, then favor over this star map.
|
||||
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
||||
foundStarMap = starMap[nameSegment];
|
||||
starI = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMap && foundStarMap) {
|
||||
foundMap = foundStarMap;
|
||||
foundI = starI;
|
||||
}
|
||||
|
||||
if (foundMap) {
|
||||
nameParts.splice(0, foundI, foundMap);
|
||||
name = nameParts.join('/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +390,7 @@ var requirejs, require, define;
|
||||
if (isBrowser) {
|
||||
each(scripts(), function (scriptNode) {
|
||||
if (scriptNode.getAttribute('data-requiremodule') === name &&
|
||||
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
||||
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
||||
scriptNode.parentNode.removeChild(scriptNode);
|
||||
return true;
|
||||
}
|
||||
@@ -412,13 +427,13 @@ var requirejs, require, define;
|
||||
* @returns {Object}
|
||||
*/
|
||||
function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
|
||||
var index = name ? name.indexOf('!') : -1,
|
||||
var url, pluginModule, suffix,
|
||||
index = name ? name.indexOf('!') : -1,
|
||||
prefix = null,
|
||||
parentName = parentModuleMap ? parentModuleMap.name : null,
|
||||
originalName = name,
|
||||
isDefine = true,
|
||||
normalizedName = '',
|
||||
url, pluginModule, suffix;
|
||||
normalizedName = '';
|
||||
|
||||
//If no name, then it means it is a require call, generate an
|
||||
//internal name.
|
||||
@@ -471,8 +486,8 @@ var requirejs, require, define;
|
||||
originalName: originalName,
|
||||
isDefine: isDefine,
|
||||
id: (prefix ?
|
||||
prefix + '!' + normalizedName :
|
||||
normalizedName) + suffix
|
||||
prefix + '!' + normalizedName :
|
||||
normalizedName) + suffix
|
||||
};
|
||||
}
|
||||
|
||||
@@ -492,7 +507,7 @@ var requirejs, require, define;
|
||||
mod = registry[id];
|
||||
|
||||
if (hasProp(defined, id) &&
|
||||
(!mod || mod.defineEmitComplete)) {
|
||||
(!mod || mod.defineEmitComplete)) {
|
||||
if (name === 'defined') {
|
||||
fn(defined[id]);
|
||||
}
|
||||
@@ -659,7 +674,7 @@ var requirejs, require, define;
|
||||
|
||||
traced[id] = mod;
|
||||
|
||||
each(depArray, function(depMap) {
|
||||
each(depArray, function (depMap) {
|
||||
var depId = depMap.id,
|
||||
depMod = registry[depId],
|
||||
value;
|
||||
@@ -699,13 +714,13 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
function checkLoaded() {
|
||||
var waitInterval = config.waitSeconds * 1000,
|
||||
var map, modId, err, usingPathFallback,
|
||||
waitInterval = config.waitSeconds * 1000,
|
||||
//It is possible to disable the wait interval by using waitSeconds of 0.
|
||||
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
||||
noLoads = [],
|
||||
stillLoading = false,
|
||||
needCycleCheck = true,
|
||||
map, modId, err, usingPathFallback;
|
||||
needCycleCheck = true;
|
||||
|
||||
//Do not bother if this call was a result of a cycle break.
|
||||
if (inCheckLoaded) {
|
||||
@@ -819,7 +834,7 @@ var requirejs, require, define;
|
||||
};
|
||||
|
||||
Module.prototype = {
|
||||
init: function(depMaps, factory, errback, options) {
|
||||
init: function (depMaps, factory, errback, options) {
|
||||
options = options || {};
|
||||
|
||||
//Do not do more inits if already done. Can happen if there
|
||||
@@ -916,7 +931,7 @@ var requirejs, require, define;
|
||||
}
|
||||
},
|
||||
|
||||
load: function() {
|
||||
load: function () {
|
||||
var url = this.map.url;
|
||||
|
||||
//Regular dependency.
|
||||
@@ -937,11 +952,11 @@ var requirejs, require, define;
|
||||
return;
|
||||
}
|
||||
|
||||
var id = this.map.id,
|
||||
var err, cjsModule,
|
||||
id = this.map.id,
|
||||
depExports = this.depExports,
|
||||
exports = this.exports,
|
||||
factory = this.factory,
|
||||
err, cjsModule;
|
||||
factory = this.factory;
|
||||
|
||||
if (!this.inited) {
|
||||
this.fetch();
|
||||
@@ -974,9 +989,9 @@ var requirejs, require, define;
|
||||
//favor a non-undefined return value over exports use.
|
||||
cjsModule = this.module;
|
||||
if (cjsModule &&
|
||||
cjsModule.exports !== undefined &&
|
||||
//Make sure it is not already the exports value
|
||||
cjsModule.exports !== this.exports) {
|
||||
cjsModule.exports !== undefined &&
|
||||
//Make sure it is not already the exports value
|
||||
cjsModule.exports !== this.exports) {
|
||||
exports = cjsModule.exports;
|
||||
} else if (exports === undefined && this.usingExports) {
|
||||
//exports already set the defined value.
|
||||
@@ -1032,15 +1047,15 @@ var requirejs, require, define;
|
||||
}
|
||||
},
|
||||
|
||||
callPlugin: function() {
|
||||
callPlugin: function () {
|
||||
var map = this.map,
|
||||
id = map.id,
|
||||
pluginMap = makeModuleMap(map.prefix, null, false, true);
|
||||
|
||||
on(pluginMap, 'defined', bind(this, function (plugin) {
|
||||
var name = this.map.name,
|
||||
parentName = this.map.parentMap ? this.map.parentMap.name : null,
|
||||
load, normalizedMap, normalizedMod;
|
||||
var load, normalizedMap, normalizedMod,
|
||||
name = this.map.name,
|
||||
parentName = this.map.parentMap ? this.map.parentMap.name : null;
|
||||
|
||||
//If current map is not normalized, wait for that
|
||||
//normalized name to load instead of continuing.
|
||||
@@ -1057,12 +1072,12 @@ var requirejs, require, define;
|
||||
false,
|
||||
true);
|
||||
on(normalizedMap,
|
||||
'defined', bind(this, function (value) {
|
||||
this.init([], function () { return value; }, null, {
|
||||
enabled: true,
|
||||
ignore: true
|
||||
});
|
||||
}));
|
||||
'defined', bind(this, function (value) {
|
||||
this.init([], function () { return value; }, null, {
|
||||
enabled: true,
|
||||
ignore: true
|
||||
});
|
||||
}));
|
||||
normalizedMod = registry[normalizedMap.id];
|
||||
if (normalizedMod) {
|
||||
if (this.events.error) {
|
||||
@@ -1127,9 +1142,9 @@ var requirejs, require, define;
|
||||
//Use parentName here since the plugin's name is not reliable,
|
||||
//could be some weird string with no path that actually wants to
|
||||
//reference the parentName's path.
|
||||
plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb) {
|
||||
plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb, er) {
|
||||
deps.rjsSkipMap = true;
|
||||
return context.require(deps, cb);
|
||||
return context.require(deps, cb, er);
|
||||
}), load, config);
|
||||
}));
|
||||
|
||||
@@ -1209,7 +1224,7 @@ var requirejs, require, define;
|
||||
this.check();
|
||||
},
|
||||
|
||||
on: function(name, cb) {
|
||||
on: function (name, cb) {
|
||||
var cbs = this.events[name];
|
||||
if (!cbs) {
|
||||
cbs = this.events[name] = [];
|
||||
@@ -1362,7 +1377,12 @@ var requirejs, require, define;
|
||||
//update the maps for them, since their info, like URLs to load,
|
||||
//may have changed.
|
||||
eachProp(registry, function (mod, id) {
|
||||
mod.map = makeModuleMap(id);
|
||||
//If module already has init called, since it is too
|
||||
//late to modify them, and ignore unnormalized ones
|
||||
//since they are transient.
|
||||
if (!mod.inited && !mod.map.unnormalized) {
|
||||
mod.map = makeModuleMap(id);
|
||||
}
|
||||
});
|
||||
|
||||
//If a deps array or a config callback is specified, then call
|
||||
@@ -1471,6 +1491,10 @@ var requirejs, require, define;
|
||||
},
|
||||
|
||||
undef: function (id) {
|
||||
//Bind any waiting define() calls to this context,
|
||||
//fix for #408
|
||||
takeGlobalQueue();
|
||||
|
||||
var map = makeModuleMap(id, null, true),
|
||||
mod = registry[id];
|
||||
|
||||
@@ -1509,9 +1533,9 @@ var requirejs, require, define;
|
||||
* @param {String} moduleName the name of the module to potentially complete.
|
||||
*/
|
||||
completeLoad: function (moduleName) {
|
||||
var shim = config.shim[moduleName] || {},
|
||||
shExports = shim.exports && shim.exports.exports,
|
||||
found, args, mod;
|
||||
var found, args, mod,
|
||||
shim = config.shim[moduleName] || {},
|
||||
shExports = shim.exports && shim.exports.exports;
|
||||
|
||||
takeGlobalQueue();
|
||||
|
||||
@@ -1538,9 +1562,7 @@ var requirejs, require, define;
|
||||
//of those calls/init calls changes the registry.
|
||||
mod = registry[moduleName];
|
||||
|
||||
if (!found &&
|
||||
!defined[moduleName] &&
|
||||
mod && !mod.inited) {
|
||||
if (!found && !defined[moduleName] && mod && !mod.inited) {
|
||||
if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
|
||||
if (hasPathFallback(moduleName)) {
|
||||
return;
|
||||
@@ -1633,7 +1655,8 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
//Join the path parts together, then figure out if baseUrl is needed.
|
||||
url = syms.join('/') + (ext || '.js');
|
||||
url = syms.join('/');
|
||||
url += (ext || (/\?/.test(url) ? '' : '.js'));
|
||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||
}
|
||||
|
||||
@@ -1670,7 +1693,7 @@ var requirejs, require, define;
|
||||
//all old browsers will be supported, but this one was easy enough
|
||||
//to support and still makes sense.
|
||||
if (evt.type === 'load' ||
|
||||
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
||||
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
||||
//Reset interactive script so a script node is not held onto for
|
||||
//to long.
|
||||
interactiveScript = null;
|
||||
@@ -1710,8 +1733,8 @@ var requirejs, require, define;
|
||||
req = requirejs = function (deps, callback, errback, optional) {
|
||||
|
||||
//Find the right context, use default
|
||||
var contextName = defContextName,
|
||||
context, config;
|
||||
var context, config,
|
||||
contextName = defContextName;
|
||||
|
||||
// Determine if have config object in the call.
|
||||
if (!isArray(deps) && typeof deps !== 'string') {
|
||||
@@ -1810,8 +1833,8 @@ var requirejs, require, define;
|
||||
if (isBrowser) {
|
||||
//In the browser so use a script tag
|
||||
node = config.xhtml ?
|
||||
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
||||
document.createElement('script');
|
||||
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
||||
document.createElement('script');
|
||||
node.type = config.scriptType || 'text/javascript';
|
||||
node.charset = 'utf-8';
|
||||
node.async = true;
|
||||
@@ -1828,15 +1851,15 @@ var requirejs, require, define;
|
||||
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
|
||||
//script execution mode.
|
||||
if (node.attachEvent &&
|
||||
//Check if node.attachEvent is artificially added by custom script or
|
||||
//natively supported by browser
|
||||
//read https://github.com/jrburke/requirejs/issues/187
|
||||
//if we can NOT find [native code] then it must NOT natively supported.
|
||||
//in IE8, node.attachEvent does not have toString()
|
||||
//Note the test for "[native code" with no closing brace, see:
|
||||
//https://github.com/jrburke/requirejs/issues/273
|
||||
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
||||
!isOpera) {
|
||||
//Check if node.attachEvent is artificially added by custom script or
|
||||
//natively supported by browser
|
||||
//read https://github.com/jrburke/requirejs/issues/187
|
||||
//if we can NOT find [native code] then it must NOT natively supported.
|
||||
//in IE8, node.attachEvent does not have toString()
|
||||
//Note the test for "[native code" with no closing brace, see:
|
||||
//https://github.com/jrburke/requirejs/issues/273
|
||||
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
||||
!isOpera) {
|
||||
//Probably IE. IE (at least 6-8) do not fire
|
||||
//script onload right after executing the script, so
|
||||
//we cannot tie the anonymous define call to a name.
|
||||
|
||||
Reference in New Issue
Block a user