Socket
Socket
Sign inDemoInstall

dojo

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dojo - npm Package Compare versions

Comparing version 2.0.0-alpha2 to 2.0.0-alpha3

44

aspect.js
var nextId = 0;
function advise(dispatcher, type, advice, receiveArguments) {

@@ -10,3 +9,2 @@ var previous = dispatcher[type];

};
if (previous) {

@@ -18,3 +16,4 @@ if (type === 'after') {

advised.previous = previous;
} else {
}
else {
// add to the beginning

@@ -25,24 +24,22 @@ dispatcher.before = advised;

}
} else {
}
else {
dispatcher[type] = advised;
}
advice = previous = null;
return {
remove: function () {
this.remove = noop;
var previous = advised.previous;
var next = advised.next;
if (!previous && !next) {
dispatcher[type] = null;
} else {
}
else {
if (previous) {
previous.next = next;
} else {
}
else {
dispatcher[type] = next;
}
if (next) {

@@ -52,3 +49,2 @@ next.previous = previous;

}
dispatcher = advised = null;

@@ -58,7 +54,5 @@ }

}
function getDispatcher(target, methodName) {
var existing = target[methodName];
var dispatcher;
if (!existing || existing.target !== target) {

@@ -71,3 +65,2 @@ // no dispatcher

var before = dispatcher.before;
while (before) {

@@ -77,7 +70,5 @@ args = before.advice.apply(this, args) || args;

}
if (dispatcher.around) {
results = dispatcher.around.advice(this, args);
}
var after = dispatcher.after;

@@ -88,3 +79,4 @@ while (after && after.id < executionId) {

results = newResults === undefined ? results : newResults;
} else {
}
else {
results = after.advice.call(this, results, args);

@@ -94,6 +86,4 @@ }

}
return results;
};
if (existing) {

@@ -106,16 +96,12 @@ dispatcher.around = {

}
dispatcher.target = target;
} else {
}
else {
dispatcher = existing;
}
target = null;
return dispatcher;
}
function noop() {
}
function after(target, methodName, advice) {

@@ -125,3 +111,2 @@ return advise(getDispatcher(target, methodName), 'after', advice);

exports.after = after;
function around(target, methodName, advice) {

@@ -133,3 +118,2 @@ var dispatcher = getDispatcher(target, methodName);

});
dispatcher.around = {

@@ -140,5 +124,3 @@ advice: function (target, args) {

};
advice = null;
return {

@@ -152,3 +134,2 @@ remove: function () {

exports.around = around;
function before(target, methodName, advice) {

@@ -158,3 +139,2 @@ return advise(getDispatcher(target, methodName), 'before', advice);

exports.before = before;
function on(target, methodName, advice) {

@@ -161,0 +141,0 @@ return advise(getDispatcher(target, methodName), 'after', advice, true);

@@ -10,6 +10,4 @@ var CallbackQueue = (function () {

};
this._callbacks.push(_callback);
callback = null;
return {

@@ -24,14 +22,11 @@ remove: function () {

};
CallbackQueue.prototype.drain = function () {
var args = [];
for (var _i = 0; _i < (arguments.length - 0); _i++) {
args[_i] = arguments[_i + 0];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var callbacks = this._callbacks, item, callback;
// Any callbacks added after drain is called will be processed
// the next time drain is called
this._callbacks = [];
for (var i = 0; i < callbacks.length; i++) {

@@ -46,3 +41,2 @@ item = callbacks[i];

})();
module.exports = CallbackQueue;
var string = require('./string');
if (!navigator.cookieEnabled) {
return null;
}
var longAgo = new Date(1970, 0, 1).toUTCString();
function createCookieOptions(options) {
var optionsString = '';
for (var key in options) {
var value = options[key];
if (key === 'maxAge') {
key = 'max-age';
} else if (key === 'secure' && !value) {
}
else if (key === 'secure' && !value) {
continue;
}
optionsString += '; ' + encodeURIComponent(key);
if (key === 'secure') {
// secure is a boolean flag, so provide no value
} else if (key === 'expires') {
}
else if (key === 'expires') {
// Expires will not work if its value is URI-encoded
optionsString += '=' + (value.toUTCString ? value.toUTCString() : value);
} else {
}
else {
optionsString += '=' + encodeURIComponent(value);
}
}
return optionsString;
}
Object.defineProperty(exports, 'length', {

@@ -43,3 +33,2 @@ get: function () {

});
function key(index) {

@@ -50,3 +39,2 @@ var keyValuePair = document.cookie.split('; ', index + 1)[index];

exports.key = key;
function getItem(key) {

@@ -57,9 +45,7 @@ var match = new RegExp('(?:^|; )' + string.escapeRegExpString(encodeURIComponent(key)) + '=([^;]*)').exec(document.cookie);

exports.getItem = getItem;
function setItem(key, data, options) {
if (typeof options === "undefined") { options = {}; }
if (options === void 0) { options = {}; }
document.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(data) + createCookieOptions(options);
}
exports.setItem = setItem;
function removeItem(key, options) {

@@ -66,0 +52,0 @@ options = options ? Object.create(options) : {};

@@ -1,5 +0,2 @@

var days = [null, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], operationOrder = [
'year', 'month', 'dayOfMonth', 'hours', 'minutes',
'seconds', 'milliseconds'];
var days = [null, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], operationOrder = ['year', 'month', 'dayOfMonth', 'hours', 'minutes', 'seconds', 'milliseconds'];
function isLeapYear(year) {

@@ -9,3 +6,2 @@ var date = new Date(year, 1, 29);

}
var DateObject = (function () {

@@ -16,10 +12,12 @@ function DateObject(value) {

_date = new Date();
} else if (value instanceof Date) {
}
else if (value instanceof Date) {
_date = new Date(+value);
} else if (typeof value === 'number' || typeof value === 'string') {
}
else if (typeof value === 'number' || typeof value === 'string') {
_date = new Date(value);
} else {
}
else {
_date = new Date(value.year, value.month - 1, value.dayOfMonth || 1, value.hours || 0, value.minutes || 0, value.seconds || 0, value.milliseconds || 0);
}
Object.defineProperty(this, '_date', {

@@ -31,3 +29,2 @@ configurable: true,

});
var self = this;

@@ -41,3 +38,2 @@ Object.defineProperty(this, 'utc', {

var month = this.month;
if (month === 2 && this.isLeapYear) {

@@ -106,3 +102,2 @@ return 29;

};
Object.defineProperty(DateObject.prototype, "isLeapYear", {

@@ -115,7 +110,5 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "daysInMonth", {
get: function () {
var month = this.month;
if (month === 2 && this.isLeapYear) {

@@ -129,3 +122,2 @@ return 29;

});
Object.defineProperty(DateObject.prototype, "year", {

@@ -137,5 +129,3 @@ get: function () {

var dayOfMonth = this.dayOfMonth;
this._date.setFullYear(year);
if (this.dayOfMonth < dayOfMonth) {

@@ -148,3 +138,2 @@ this.dayOfMonth = 0;

});
Object.defineProperty(DateObject.prototype, "month", {

@@ -156,5 +145,3 @@ get: function () {

var dayOfMonth = this.dayOfMonth;
this._date.setMonth(month - 1);
if (this.dayOfMonth < dayOfMonth) {

@@ -167,3 +154,2 @@ this.dayOfMonth = 0;

});
Object.defineProperty(DateObject.prototype, "dayOfMonth", {

@@ -179,3 +165,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "hours", {

@@ -191,3 +176,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "minutes", {

@@ -203,3 +187,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "seconds", {

@@ -215,3 +198,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "milliseconds", {

@@ -227,3 +209,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "time", {

@@ -239,3 +220,2 @@ get: function () {

});
Object.defineProperty(DateObject.prototype, "dayOfWeek", {

@@ -255,6 +235,4 @@ get: function () {

});
DateObject.prototype.add = function (value) {
var result = new DateObject(this);
// perform from year -> milliseconds in case the year

@@ -266,3 +244,2 @@ // and month operations cause an overshoot

}
result[property] += value[property];

@@ -272,3 +249,2 @@ });

};
DateObject.prototype.toString = function () {

@@ -303,3 +279,2 @@ return this._date.toString();

})();
module.exports = DateObject;
var has = require('./has');
if (!has('host-browser')) {
throw new Error('dojo/domReady makes no sense to load in a non-browser environment');
}
var readyStates = Object.create(null);
readyStates.loaded = readyStates.complete = true;
var ready = readyStates[document.readyState], readyQueue = [], processing = false;
function processQueue() {

@@ -17,10 +13,7 @@ if (processing) {

processing = true;
for (var i = 0; i < readyQueue.length; i++) {
readyQueue[i](document);
}
processing = false;
}
if (!ready) {

@@ -31,3 +24,2 @@ document.addEventListener('DOMContentLoaded', function () {

}
ready = true;

@@ -37,4 +29,2 @@ processQueue();

}
var domReady = function (callback) {

@@ -46,7 +36,5 @@ readyQueue.push(callback);

};
domReady.load = function (resourceId, require, load) {
domReady(load);
};
module.exports = domReady;
var on = require('./on');
var aspect = require('./aspect');
var Evented = (function () {

@@ -21,7 +20,6 @@ function Evented() {

};
Evented.prototype.emit = function (type) {
var args = [];
for (var _i = 0; _i < (arguments.length - 1); _i++) {
args[_i] = arguments[_i + 1];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}

@@ -35,3 +33,2 @@ type = '__on' + type;

})();
module.exports = Evented;

@@ -1,5 +0,3 @@

/* tslint:enable:class-name */
var has = require.has;
if (!has) {

@@ -11,7 +9,5 @@ has = (function () {

var element = document && document.createElement('div');
var has = function (name) {
return typeof hasCache[name] === 'function' ? (hasCache[name] = hasCache[name](global, document, element)) : hasCache[name];
};
has.add = function (name, test, now, force) {

@@ -21,6 +17,4 @@ (!(name in hasCache) || force) && (hasCache[name] = test);

};
return has;
})();
has.add('host-browser', typeof document !== 'undefined' && typeof location !== 'undefined');

@@ -30,6 +24,4 @@ has.add('host-node', typeof process === 'object' && process.versions && process.versions.node);

}
has.normalize = function (resourceId, normalize) {
var tokens = resourceId.match(/[\?:]|[^:\?]*/g);
var i = 0;

@@ -41,3 +33,4 @@ function get(skip) {

return null;
} else {
}
else {
// postfixed with a ? means it is a feature to branch on, the term is the name of the feature

@@ -48,3 +41,4 @@ if (tokens[i++] === '?') {

return get();
} else {
}
else {
// did not match, get the second value, passing over the first

@@ -55,3 +49,2 @@ get(true);

}
// a module

@@ -61,15 +54,13 @@ return term;

}
resourceId = get();
return resourceId && normalize(resourceId);
};
has.load = function (resourceId, require, load) {
if (resourceId) {
require([resourceId], load);
} else {
}
else {
load();
}
};
module.exports = has;
/**
* @module dojo/io-query
*
* This module defines query string processing functions.
*/
* @module dojo/io-query
*
* This module defines query string processing functions.
*/
/**
* Takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
* example:
* this object:
*
* | {
* | blah: "blah",
* | multi: [
* | "thud",
* | "thonk"
* | ]
* | };
*
* yields the following query string:
*
* | "blah=blah&multi=thud&multi=thonk"
*/
* Takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
* example:
* this object:
*
* | {
* | blah: "blah",
* | multi: [
* | "thud",
* | "thonk"
* | ]
* | };
*
* yields the following query string:
*
* | "blah=blah&multi=thud&multi=thonk"
*/
function objectToQuery(map) {
var query = [];
var value;
for (var key in map) {
value = map[key];
key = encodeURIComponent(key);
if (typeof value === 'boolean') {

@@ -36,13 +33,14 @@ // Boolean properties are identified as true by their existence and do not have a corresponding

value && query.push(key);
} else if (Array.isArray(value)) {
}
else if (Array.isArray(value)) {
for (var i = 0, j = value.length; i < j; ++i) {
query.push(key + '=' + encodeURIComponent(value[i]));
}
} else {
}
else {
query.push(key + '=' + encodeURIComponent(value));
}
}
return query.join('&');
}
exports.objectToQuery = objectToQuery;
exports.version = {
/**
* Major version. If total version is "1.2.0-beta1", will be 1.
*/
* Major version. If total version is "1.2.0-beta1", will be 1.
*/
major: 2,
/**
* Minor version. If total version is "1.2.0-beta1", will be 2.
*/
* Minor version. If total version is "1.2.0-beta1", will be 2.
*/
minor: 0,
/**
* Patch version. If total version is "1.2.0-beta1", will be 0.
*/
* Patch version. If total version is "1.2.0-beta1", will be 0.
*/
patch: 0,
/**
* Descriptor flag. If total version is "1.2.0-beta1", will be "beta1".
*/
* Descriptor flag. If total version is "1.2.0-beta1", will be "beta1".
*/
flag: 'dev',
/**
* The ID of the Git commit used to build this version of Dojo.
* @type ?string
*/
* The ID of the Git commit used to build this version of Dojo.
* @type ?string
*/
revision: ('$Rev$'.match(/[0-9a-f]{7,}/) || [])[0],

@@ -23,0 +23,0 @@ toString: function () {

var has = require('./has');
has.add('es6-getpropertydescriptor', typeof Object.getPropertyDescriptor === 'function');
var slice = Array.prototype.slice;
function getDottedProperty(object, parts, create) {
var key;
var i = 0;
while (object && (key = parts[i++])) {

@@ -17,6 +13,4 @@ if (typeof object !== 'object') {

}
return object;
}
function setProperty(object, propertyName, value) {

@@ -26,3 +20,2 @@ var parts = propertyName.split('.');

var property = getDottedProperty(object, parts, true);
if (property && part) {

@@ -34,13 +27,10 @@ property[part] = value;

exports.setProperty = setProperty;
function getProperty(object, propertyName, create) {
if (typeof create === "undefined") { create = false; }
if (create === void 0) { create = false; }
return getDottedProperty(object, propertyName.split('.'), create);
}
exports.getProperty = getProperty;
function _mixin(target, source) {
for (var name in source) {
var sourceValue = source[name];
// TODO: If it is already the same, what are we saving by doing this?

@@ -52,10 +42,8 @@ if (name in target && target[name] === sourceValue) {

}
return target;
}
function mixin(target) {
var sources = [];
for (var _i = 0; _i < (arguments.length - 1); _i++) {
sources[_i] = arguments[_i + 1];
for (var _i = 1; _i < arguments.length; _i++) {
sources[_i - 1] = arguments[_i];
}

@@ -71,3 +59,2 @@ if (!target) {

exports.mixin = mixin;
function delegate(object, properties) {

@@ -79,9 +66,7 @@ object = Object.create(object);

exports.delegate = delegate;
var _bind = Function.prototype.bind;
function bind(context, fn) {
var extra = [];
for (var _i = 0; _i < (arguments.length - 2); _i++) {
extra[_i] = arguments[_i + 2];
for (var _i = 2; _i < arguments.length; _i++) {
extra[_i - 2] = arguments[_i];
}

@@ -96,7 +81,6 @@ if (typeof fn === 'function') {

exports.bind = bind;
function partial(fn) {
var extra = [];
for (var _i = 0; _i < (arguments.length - 1); _i++) {
extra[_i] = arguments[_i + 1];
for (var _i = 1; _i < arguments.length; _i++) {
extra[_i - 1] = arguments[_i];
}

@@ -108,3 +92,2 @@ return function () {

exports.partial = partial;
function deepMixin(target, source) {

@@ -118,3 +101,2 @@ if (source && typeof source === 'object') {

var sourceValue = source[name];
if (targetValue !== sourceValue) {

@@ -125,4 +107,5 @@ if (sourceValue && typeof sourceValue === 'object') {

}
exports.deepMixin(targetValue, sourceValue);
} else {
deepMixin(targetValue, sourceValue);
}
else {
target[name] = sourceValue;

@@ -136,18 +119,13 @@ }

exports.deepMixin = deepMixin;
function deepDelegate(source, properties) {
var target = exports.delegate(source);
var target = delegate(source);
for (var name in source) {
var value = source[name];
if (value && typeof value === 'object') {
target[name] = exports.deepDelegate(value);
target[name] = deepDelegate(value);
}
}
return exports.deepMixin(target, properties);
return deepMixin(target, properties);
}
exports.deepDelegate = deepDelegate;
function isEqual(a, b) {

@@ -157,35 +135,27 @@ return a === b || (a !== a && b !== b);

exports.isEqual = isEqual;
exports.getPropertyDescriptor;
if (has('es6-getpropertydescriptor')) {
exports.getPropertyDescriptor = Object.getPropertyDescriptor;
} else {
}
else {
exports.getPropertyDescriptor = function (object, property) {
var descriptor;
while (object) {
descriptor = Object.getOwnPropertyDescriptor(object, property);
if (descriptor) {
return descriptor;
}
object = Object.getPrototypeOf(object);
}
return null;
};
}
function pullFromArray(haystack, needle) {
var removed = [];
var i = 0;
while ((i = haystack.indexOf(needle, i)) > -1) {
removed.push(haystack.splice(i, 1)[0]);
}
return removed;
}
exports.pullFromArray = pullFromArray;

@@ -8,10 +8,7 @@ (function () {

}
if (has('loader-configurable')) {
configure(config);
}
contextRequire(dependencies, callback);
};
var has = req.has = (function () {

@@ -22,7 +19,5 @@ var hasCache = Object.create(null);

var element = document && document.createElement('div');
var has = function (name) {
return typeof hasCache[name] === 'function' ? (hasCache[name] = hasCache[name](global, document, element)) : hasCache[name];
};
has.add = function (name, test, now, force) {

@@ -32,10 +27,7 @@ (!(name in hasCache) || force) && (hasCache[name] = test);

};
return has;
})();
has.add('host-browser', typeof document !== 'undefined' && typeof location !== 'undefined');
has.add('host-node', typeof process === 'object' && process.versions && process.versions.node);
has.add('debug', true);
// IE9 will process multiple scripts at once before firing their respective onload events, so some extra work

@@ -45,11 +37,10 @@ // needs to be done to associate the content of the define call with the correct node. This is known to be fixed

has.add('loader-ie9-compat', has('host-browser') && navigator.userAgent.indexOf('MSIE 9.0') > -1);
has.add('loader-configurable', true);
if (has('loader-configurable')) {
/**
* Configures the loader.
*
* @param {{ ?baseUrl: string, ?map: Object, ?packages: Array.<({ name, ?location, ?main }|string)> }} config
* The configuration data.
*/
* Configures the loader.
*
* @param {{ ?baseUrl: string, ?map: Object, ?packages: Array.<({ name, ?location, ?main }|string)> }} config
* The configuration data.
*/
var configure = req.config = function (config) {

@@ -59,3 +50,2 @@ // TODO: Expose all properties on req as getter/setters? Plugin modules like dojo/node being able to

baseUrl = (config.baseUrl || baseUrl).replace(/\/*$/, '/');
forEach(config.packages, function (p) {

@@ -66,10 +56,7 @@ // Allow shorthand package definition, where name and location are the same

}
if (p.location != null) {
p.location = p.location.replace(/\/*$/, '/');
}
packs[p.name] = p;
});
function computeMapProg(map) {

@@ -107,7 +94,5 @@ // This method takes a map as represented by a JavaScript object and initializes an array of

var result = [];
for (var moduleId in map) {
var value = map[moduleId];
var valueIsMapReplacement = typeof value === 'object';
result.push({

@@ -119,3 +104,2 @@ 0: moduleId,

});
if (valueIsMapReplacement && moduleId === '*') {

@@ -125,14 +109,9 @@ result['star'] = item[1];

}
result.sort(function (lhs, rhs) {
return rhs[3] - lhs[3];
});
return result;
}
mix(map, config.map);
mapProgs = computeMapProg(map);
// Note that old paths will get destroyed if reconfigured

@@ -142,3 +121,2 @@ config.paths && (pathsMapProg = computeMapProg(config.paths));

}
//

@@ -149,16 +127,11 @@ // loader state data

var baseUrl = './';
// a map from pid to package configuration object
var packs = {};
// list of (from-path, to-path, regex, length) derived from paths;
// a "program" to apply paths; see computeMapProg
var pathsMapProg = [];
// AMD map config variable
var map = {};
// array of quads as described by computeMapProg; map-key is AMD map key, map-value is AMD map value
var mapProgs = [];
// A hash:(mid) --> (module-object) the module namespace

@@ -190,3 +163,2 @@ //

var modules = {};
// hash:(mid | url)-->(function | string)

@@ -200,3 +172,2 @@ //

var cache = {};
// hash:(mid | url)-->(function | string)

@@ -209,7 +180,5 @@ //

var pendingCacheInsert = {};
function forEach(array, callback) {
array && array.forEach(callback);
}
function mix(target, source) {

@@ -221,21 +190,14 @@ for (var key in source) {

}
function signal(type, event) {
req.signal.apply(req, arguments);
}
function consumePendingCacheInsert(referenceModule) {
var item;
for (var key in pendingCacheInsert) {
item = pendingCacheInsert[key];
cache[typeof item === 'string' ? toUrl(key, referenceModule) : getModuleInfo(key, referenceModule).mid] = item;
}
pendingCacheInsert = {};
}
var uidGenerator = 0;
function contextRequire(a1, a2, referenceModule) {

@@ -248,3 +210,2 @@ var module;

}
// Assign the result of the module to `module`

@@ -254,3 +215,4 @@ // otherwise require('moduleId') returns the internal

module = module.result;
} else if (Array.isArray(a1)) {
}
else if (Array.isArray(a1)) {
// signature is (requestList [,callback])

@@ -262,3 +224,3 @@ // construct a synthetic module to control execution of the requestList, and, optionally, callback

def: a2 || {},
gc: true
gc: true // garbage collect
});

@@ -273,3 +235,2 @@ guardCheckComplete(function () {

}
function createRequire(module) {

@@ -292,12 +253,8 @@ var result = (!module && req) || module.require;

}
// The list of modules that need to be evaluated.
var execQ = [];
// The arguments sent to loader via AMD define().
var defArgs = null;
// the number of modules the loader has injected but has not seen defined
var waitingCount = 0;
function runMapProg(targetMid, map) {

@@ -312,6 +269,4 @@ // search for targetMid in map; return the map item if found; falsy otherwise

}
return null;
}
function compactPath(path) {

@@ -322,3 +277,2 @@ var result = [];

var splitPath = path.replace(/\\/g, '/').split('/');
while (splitPath.length) {

@@ -329,10 +283,9 @@ segment = splitPath.shift();

lastSegment = result[result.length - 1];
} else if (segment !== '.') {
}
else if (segment !== '.') {
result.push((lastSegment = segment));
}
} // else ignore "."
}
return result.join('/');
}
function getModuleInfo(mid, referenceModule) {

@@ -346,6 +299,4 @@ var match;

var result;
// relative module ids are relative to the referenceModule; get rid of any dots
mid = compactPath(/^\./.test(mid) && referenceModule ? (referenceModule.mid + '/../' + mid) : mid);
// at this point, mid is an absolute mid

@@ -356,17 +307,14 @@ // if there is a reference module, then use its module map, if one exists; otherwise, use the global map.

moduleMap = moduleMap ? moduleMap[1] : mapProgs.star;
if ((mapItem = runMapProg(mid, moduleMap))) {
mid = mapItem[1] + mid.slice(mapItem[3]);
}
match = mid.match(/^([^\/]+)(\/(.+))?$/);
pid = match ? match[1] : '';
pack = packs[pid];
if (pack) {
mid = pid + '/' + (midInPackage = (match[3] || pack.main || 'main'));
} else {
}
else {
pid = '';
}
if (!(result = modules[mid])) {

@@ -382,10 +330,7 @@ mapItem = runMapProg(mid, pathsMapProg);

}
return result;
}
function resolvePluginResourceId(plugin, prid, contextRequire) {
return plugin.normalize ? plugin.normalize(prid, contextRequire.toAbsMid) : contextRequire.toAbsMid(prid);
}
function getModule(mid, referenceModule) {

@@ -399,3 +344,2 @@ // compute and construct (if necessary) the module implied by the mid with respect to referenceModule

var loaded;
match = mid.match(/^(.+?)\!(.*)$/);

@@ -406,9 +350,8 @@ if (match) {

loaded = Boolean(plugin.load);
contextRequire = createRequire(referenceModule);
if (loaded) {
prid = resolvePluginResourceId(plugin, match[2], contextRequire);
mid = (plugin.mid + '!' + (plugin.dynamic ? ++uidGenerator + '!' : '') + prid);
} else {
}
else {
// if the plugin has not been loaded, then can't resolve the prid and must assume this plugin is dynamic until we find out otherwise

@@ -425,3 +368,4 @@ prid = match[2];

};
} else {
}
else {
result = getModuleInfo(mid, referenceModule);

@@ -431,15 +375,11 @@ }

}
function toAbsMid(mid, referenceModule) {
return getModuleInfo(mid, referenceModule).mid;
}
function toUrl(name, referenceModule) {
var moduleInfo = getModuleInfo(name + '/x', referenceModule);
var url = moduleInfo.url;
// "/x.js" since getModuleInfo automatically appends ".js" and we appended "/x" to make name look like a module id
return url.slice(0, url.length - 5);
}
function makeCjs(mid) {

@@ -452,14 +392,10 @@ // TODO: Intentional incomplete coercion to IModule might be a bad idea

};
return module;
}
var cjsRequireModule = makeCjs('require');
var cjsExportsModule = makeCjs('exports');
var cjsModuleModule = makeCjs('module');
var EXECUTING = 'executing';
var abortExec = {};
var executedSomething = false;
has.add('loader-debug-circular-dependencies', true);

@@ -469,3 +405,2 @@ if (has('loader-debug-circular-dependencies')) {

}
function execModule(module) {

@@ -483,6 +418,4 @@ // run the dependency array, then run the factory for module

}
return module.cjs.exports;
}
if (!module.executed) {

@@ -494,3 +427,2 @@ // TODO: This seems like an incorrect condition inference. Originally it was simply !module.def

}
var deps = module.deps;

@@ -500,5 +432,3 @@ var factory = module.def;

var args;
has('loader-debug-circular-dependencies') && circularTrace.push(module.mid);
module.executed = EXECUTING;

@@ -511,3 +441,2 @@ args = deps.map(function (dep) {

});
if (result === abortExec) {

@@ -518,5 +447,3 @@ module.executed = false;

}
result = typeof factory === 'function' ? factory.apply(null, args) : factory;
// TODO: But of course, module.cjs always exists.

@@ -528,3 +455,2 @@ // Assign the new module.result to result so plugins can use exports

executedSomething = true;
// delete references to synthetic modules

@@ -534,3 +460,2 @@ if (module.gc) {

}
// if result defines load, just assume it's a plugin; harmless if the assumption is wrong

@@ -540,3 +465,2 @@ result && result.load && ['dynamic', 'normalize', 'load'].forEach(function (key) {

});
// for plugins, resolve the loadQ

@@ -548,8 +472,6 @@ forEach(module.loadQ, function (pseudoPluginResource) {

var pluginResource = mix(mix({}, pseudoPluginResource), { mid: mid, prid: prid });
if (!modules[mid]) {
// create a new (the real) plugin resource and inject it normally now that the plugin is on board
injectPlugin((modules[mid] = pluginResource));
}
} // else this was a duplicate request for the same (plugin, rid) for a nondynamic plugin
// pluginResource is really just a placeholder with the wrong mid (because we couldn't calculate it until the plugin was on board)

@@ -563,12 +485,8 @@ // fix() replaces the pseudo module in a resolved deps array with the real module

module.loadQ = undefined;
has('loader-debug-circular-dependencies') && circularTrace.pop();
}
// at this point the module is guaranteed fully executed
return module.result;
}
var checkCompleteGuard = 0;
// TODO: Figure out what proc actually is

@@ -581,3 +499,2 @@ function guardCheckComplete(proc) {

}
function checkComplete() {

@@ -591,3 +508,4 @@ // keep going through the execQ as long as at least one factory is executed

execQ.splice(i, 1);
} else {
}
else {
executedSomething = false;

@@ -599,3 +517,4 @@ execModule(module);

i = 0;
} else {
}
else {
// nothing happened; check the next module in the exec queue

@@ -608,3 +527,2 @@ i++;

}
function injectPlugin(module) {

@@ -619,8 +537,9 @@ // injects the plugin module given by module; may have to inject the plugin itself

};
if (plugin.load) {
plugin.load(module.prid, module.req, onLoad);
} else if (plugin.loadQ) {
}
else if (plugin.loadQ) {
plugin.loadQ.push(module);
} else {
}
else {
// the unshift instead of push is important: we don't want plugins to execute as

@@ -635,3 +554,2 @@ // dependencies of some other module because this may cause circles when the plugin

}
function injectModule(parent, module) {

@@ -643,6 +561,6 @@ // TODO: This is for debugging, we should bracket it

}
if (module.plugin) {
injectPlugin(module);
} else if (!module.injected) {
}
else if (!module.injected) {
var cached;

@@ -652,7 +570,5 @@ var onLoadCallback = function (node) {

consumePendingCacheInsert(module);
if (has('loader-ie9-compat') && node) {
defArgs = node['defArgs'];
}
// non-amd module

@@ -662,6 +578,4 @@ if (!defArgs) {

}
defineModule(module, defArgs[0], defArgs[1]);
defArgs = null;
// checkComplete!==false holds the idle signal; we're not idle if we're injecting dependencies

@@ -673,11 +587,11 @@ guardCheckComplete(function () {

};
++waitingCount;
module.injected = true;
if ((cached = cache[module.mid])) {
try {
try {
cached();
onLoadCallback();
return;
} catch (error) {
}
catch (error) {
// If a cache load fails, notify and then retrieve using injectUrl

@@ -690,3 +604,2 @@ signal('cachedThrew', [error, module]);

}
function resolveDeps(deps, module, referenceModule) {

@@ -704,3 +617,2 @@ // resolve deps with respect to this module

}
function defineModule(module, deps, def) {

@@ -721,3 +633,2 @@ --waitingCount;

}
// PhantomJS

@@ -729,3 +640,2 @@ has.add('function-bind', Boolean(Function.prototype.bind));

var args = slice.call(arguments, 1);
return function () {

@@ -736,3 +646,2 @@ return injectModule.apply(thisArg, args.concat(slice.call(arguments, 0)));

}
var setGlobals;

@@ -747,13 +656,11 @@ var injectUrl;

document.head.removeChild(node);
if (event.type === 'load') {
has('loader-ie9-compat') ? callback(node) : callback();
} else {
}
else {
throw new Error('Failed to load module ' + module.mid + ' from ' + url + (parent ? ' (parent: ' + parent.mid + ')' : ''));
}
};
node.addEventListener('load', handler, false);
node.addEventListener('error', handler, false);
node.charset = 'utf-8';

@@ -763,3 +670,2 @@ node.src = url;

};
setGlobals = function (require, define) {

@@ -769,6 +675,6 @@ this.require = require;

};
} else if (has('host-node')) {
}
else if (has('host-node')) {
var vm = require('vm');
var fs = require('fs');
// retain the ability to get node's require

@@ -782,3 +688,2 @@ req.nodeRequire = require;

}
vm.runInThisContext(data, url);

@@ -788,3 +693,2 @@ callback();

};
setGlobals = function (require, define) {

@@ -794,6 +698,6 @@ module.exports = this.require = require;

};
} else {
}
else {
throw new Error('Unsupported platform');
}
has.add('loader-debug-internals', true);

@@ -808,3 +712,2 @@ if (has('loader-debug-internals')) {

}
has.add('loader-undef', true);

@@ -818,3 +721,2 @@ if (has('loader-undef')) {

}
mix(req, {

@@ -830,3 +732,2 @@ signal: function () {

});
Object.defineProperty(req, 'baseUrl', {

@@ -838,3 +739,2 @@ get: function () {

});
has.add('loader-cjs-wrapping', true);

@@ -845,9 +745,7 @@ if (has('loader-cjs-wrapping')) {

}
has.add('loader-explicit-mid', true);
/**
* @param deps //(array of commonjs.moduleId, optional)
* @param factory //(any)
*/
* @param deps //(array of commonjs.moduleId, optional)
* @param factory //(any)
*/
var define = mix(function (deps, factory) {

@@ -858,3 +756,2 @@ if (has('loader-explicit-mid') && arguments.length === 3) {

factory = arguments[2];
var module = getModule(id);

@@ -864,3 +761,2 @@ module.injected = true;

}
if (arguments.length === 1) {

@@ -870,3 +766,2 @@ if (has('loader-cjs-wrapping') && typeof deps === 'function') {

deps = ['require', 'exports', 'module'];
// Scan factory for require() calls and add them to the

@@ -878,3 +773,4 @@ // list of dependencies

});
} else if (!Array.isArray(deps)) {
}
else if (!Array.isArray(deps)) {
var value = deps;

@@ -887,3 +783,2 @@ deps = [];

}
if (has('loader-ie9-compat')) {

@@ -896,3 +791,4 @@ for (var i = document.scripts.length - 1, script; (script = document.scripts[i]); --i) {

}
} else {
}
else {
defArgs = [deps, factory];

@@ -903,4 +799,3 @@ }

});
setGlobals(req, define);
})();
var CallbackQueue = require('./CallbackQueue');
var has = require('./has');
has.add('dom-mutationobserver', function (global) {
return has('host-browser') && Boolean(global.MutationObserver || global.WebKitMutationObserver);
});
function noop() {
}
var nextTick;
// Node.JS 0.10 added `setImmediate` and then started throwing warnings when people called `nextTick` recursively;

@@ -26,3 +21,4 @@ // Node.JS 0.11 supposedly removes this behaviour, so only target 0.10

};
} else if (has('host-node')) {
}
else if (has('host-node')) {
nextTick = function (callback) {

@@ -35,6 +31,4 @@ var removed = false;

}
callback();
});
return {

@@ -47,5 +41,5 @@ remove: function () {

};
} else {
}
else {
var queue = new CallbackQueue();
if (has('dom-mutationobserver')) {

@@ -58,5 +52,3 @@ nextTick = (function () {

});
observer.observe(element, { attributes: true });
return function (callback) {

@@ -68,8 +60,10 @@ var handle = queue.add(callback);

})();
} else {
}
else {
nextTick = (function () {
// Node.js returns a Timer object from setTimeout,
// HTML5 specifies a number
var timer;
return function (callback) {
var handle = queue.add(callback);
if (!timer) {

@@ -82,3 +76,2 @@ timer = setTimeout(function () {

}
return handle;

@@ -89,3 +82,2 @@ };

}
module.exports = nextTick;
var lang = require('./lang');
var Scheduler = require('./Scheduler');
// TODO: `informImmediately` is a strange beast, but something that is useful.

@@ -12,3 +11,2 @@ // I need to experiment with a different mechanism for calling the observer

}
Object.defineProperties(this, {

@@ -38,3 +36,2 @@ _callbacks: {

}
// Grab the current notifications and immediately create a new hash

@@ -44,10 +41,7 @@ // to start storing any notifications that might be generated this turn

this._notifications = Object.create(null);
for (var property in notifications) {
var notification = notifications[property];
if (this._isEqual(notification.oldValue, notification.newValue)) {
continue;
}
var callback;

@@ -63,7 +57,5 @@ for (var i = 0; (callback = notification.callbacks[i]); i++) {

};
Observable.prototype._isEqual = function (a, b) {
return lang.isEqual(a, b);
};
Observable.prototype._notify = function (property, newValue, oldValue) {

@@ -74,8 +66,7 @@ var callbacks = this._callbacks[property];

}
var notification = this._notifications[property];
if (notification) {
notification.newValue = newValue;
} else {
}
else {
// Create a notification and give it a copy of the callbacks

@@ -89,6 +80,4 @@ // that are currently registered

}
this._schedule();
};
Observable.prototype.observe = function (property, callback) {

@@ -99,3 +88,2 @@ var _this = this;

};
if (!this._callbacks[property]) {

@@ -106,6 +94,4 @@ var oldDescriptor = lang.getPropertyDescriptor(this, property), currentValue = this[property], descriptor = {

};
if (oldDescriptor && !('value' in oldDescriptor)) {
descriptor.get = oldDescriptor.get;
if (oldDescriptor.set) {

@@ -115,3 +101,2 @@ descriptor.set = function (value) {

var newValue = descriptor.get.call(_this);
_this._notify(property, newValue, currentValue);

@@ -121,3 +106,4 @@ currentValue = newValue;

}
} else {
}
else {
// property

@@ -135,8 +121,7 @@ descriptor.get = function () {

Object.defineProperty(this, property, descriptor);
this._callbacks[property] = [callbackObject];
} else {
}
else {
this._callbacks[property].push(callbackObject);
}
var self = this;

@@ -147,6 +132,4 @@ return {

};
// remove from in-flight notifications
callbackObject.removed = true;
// remove from future notifications

@@ -157,3 +140,2 @@ lang.pullFromArray(self._callbacks[property], callbackObject);

};
Observable.prototype._schedule = function () {

@@ -166,3 +148,2 @@ if (!this._timer) {

})();
module.exports = Observable;
var ObservableArray = (function () {
function ObservableArray(length) {
if (typeof length === "undefined") { length = 0; }
if (length === void 0) { length = 0; }
Object.defineProperty(this, 'length', {

@@ -13,3 +13,2 @@ configurable: false,

var observable = new ObservableArray(items.length);
for (var i = 0; i < items.length; i++) {

@@ -20,11 +19,9 @@ if (items.hasOwnProperty(i)) {

}
return observable;
};
ObservableArray.prototype.concat = function () {
var _this = this;
var items = [];
for (var _i = 0; _i < (arguments.length - 0); _i++) {
items[_i] = arguments[_i + 0];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i - 0] = arguments[_i];
}

@@ -35,7 +32,5 @@ // Array#concat claims to be generic in the spec, but only actual arrays

var array = [];
this.forEach(function (item, index) {
array[index] = item;
});
items = items.map(function (item) {

@@ -47,34 +42,25 @@ if (item instanceof _this.constructor) {

});
return ObservableArray.from(Array.prototype.concat.apply(array, items));
};
ObservableArray.prototype.every = function (callback, thisObject) {
return Array.prototype.every.apply(this, arguments);
};
ObservableArray.prototype.filter = function (callback, thisObject) {
return ObservableArray.from(Array.prototype.filter.apply(this, arguments));
};
ObservableArray.prototype.forEach = function (callback, thisObject) {
Array.prototype.forEach.apply(this, arguments);
};
ObservableArray.prototype.indexOf = function (searchElement, fromIndex) {
return Array.prototype.indexOf.apply(this, arguments);
};
ObservableArray.prototype.join = function (separator) {
return Array.prototype.join.apply(this, arguments);
};
ObservableArray.prototype.lastIndexOf = function (searchElement, fromIndex) {
return Array.prototype.lastIndexOf.apply(this, arguments);
};
ObservableArray.prototype.map = function (callback, thisObject) {
return ObservableArray.from(Array.prototype.map.apply(this, arguments));
};
ObservableArray.prototype.observe = function (observer) {

@@ -86,11 +72,9 @@ return {

};
ObservableArray.prototype.pop = function () {
return this.splice(this.length - 1, 1)[0];
};
ObservableArray.prototype.push = function () {
var items = [];
for (var _i = 0; _i < (arguments.length - 0); _i++) {
items[_i] = arguments[_i + 0];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i - 0] = arguments[_i];
}

@@ -100,11 +84,8 @@ this.splice.apply(this, [this.length, 0].concat(items));

};
ObservableArray.prototype.reduce = function (callback, initialValue) {
return Array.prototype.reduce.apply(this, arguments);
};
ObservableArray.prototype.reduceRight = function (callback, initialValue) {
return Array.prototype.reduceRight.apply(this, arguments);
};
ObservableArray.prototype.reverse = function () {

@@ -115,3 +96,2 @@ // TODO: notification

};
ObservableArray.prototype.set = function (index, value) {

@@ -122,15 +102,11 @@ var oldValue = this[index];

};
ObservableArray.prototype.shift = function () {
return this.splice(0, 1)[0];
};
ObservableArray.prototype.slice = function (start, end) {
return ObservableArray.from(Array.prototype.slice.apply(this, arguments));
};
ObservableArray.prototype.some = function (callback, thisObject) {
return Array.prototype.some.apply(this, arguments);
};
ObservableArray.prototype.sort = function (compare) {

@@ -141,19 +117,16 @@ // TODO: notification

};
ObservableArray.prototype.splice = function (start, deleteCount) {
if (typeof deleteCount === "undefined") { deleteCount = 1; }
if (deleteCount === void 0) { deleteCount = 1; }
var items = [];
for (var _i = 0; _i < (arguments.length - 2); _i++) {
items[_i] = arguments[_i + 2];
for (var _i = 2; _i < arguments.length; _i++) {
items[_i - 2] = arguments[_i];
}
var removals = Array.prototype.splice.apply(this, arguments);
// TODO: notify
return ObservableArray.from(removals);
};
ObservableArray.prototype.unshift = function () {
var items = [];
for (var _i = 0; _i < (arguments.length - 0); _i++) {
items[_i] = arguments[_i + 0];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i - 0] = arguments[_i];
}

@@ -165,5 +138,3 @@ this.splice.apply(this, [0, 0].concat(items));

})();
var oldPrototype = ObservableArray.prototype, newPrototype = ObservableArray.prototype = Object.create(Array.prototype);
// Configure properties of new prototype using descriptor properties from Array.prototype

@@ -173,10 +144,7 @@ // along with functions from the old prototype

var descriptor = Object.getOwnPropertyDescriptor(Array.prototype, name);
if (name in oldPrototype) {
descriptor.value = oldPrototype[name];
}
Object.defineProperty(newPrototype, name, descriptor);
});
module.exports = ObservableArray;

@@ -8,3 +8,2 @@ var __extends = this.__extends || function (d, b) {

var Observable = require('./Observable');
var ObservableProperty = (function (_super) {

@@ -16,9 +15,6 @@ __extends(ObservableProperty, _super);

this._propertyName = property;
this._handle = observable.observe(property, function (newValue, oldValue) {
_this._notify('value', newValue, oldValue);
});
_super.call(this);
// The following line keeps notifications getting set up for 'value'

@@ -37,3 +33,2 @@ this._callbacks['value'] = [];

});
ObservableProperty.prototype.destroy = function () {

@@ -43,3 +38,2 @@ this._handle.remove();

};
ObservableProperty.prototype._schedule = function () {

@@ -50,3 +44,2 @@ this._dispatch();

})(Observable);
module.exports = ObservableProperty;

@@ -1,9 +0,6 @@

function noop() {
}
function addListener(target, type, listener, capture) {
if (target.addEventListener) {
target.addEventListener(type, listener, capture);
return {

@@ -17,6 +14,4 @@ remove: function () {

}
throw new Error('Target must be an event emitter');
}
var on = function (target, type, listener, capture) {

@@ -26,6 +21,4 @@ if (typeof target.on === 'function' && typeof type !== 'function' && !target.nodeType) {

}
return on.parse(target, type, listener, this, addListener, capture);
};
on.parse = function (target, type, listener, context, addListener, capture) {

@@ -36,3 +29,2 @@ // `type` is ExtensionEvent

}
if (type.indexOf(',') > -1) {

@@ -43,3 +35,2 @@ var events = type.split(/\s*,\s*/);

});
return {

@@ -55,6 +46,4 @@ remove: function () {

}
return addListener(target, type, listener, capture);
};
on.emit = function (target, type, event) {

@@ -65,7 +54,5 @@ // `target` is not a DOM node

}
if (target.dispatchEvent && target.ownerDocument && target.ownerDocument.createEvent) {
var nativeEvent = target.ownerDocument.createEvent('HTMLEvents');
nativeEvent.initEvent(type, Boolean(event.bubbles), Boolean(event.cancelable));
for (var key in event) {

@@ -76,9 +63,6 @@ if (!(key in nativeEvent)) {

}
return target.dispatchEvent(nativeEvent);
}
throw new Error('Target must be an event emitter');
};
module.exports = on;
var on = require('../on');
function once(type) {

@@ -13,3 +12,2 @@ return function (target, listener, capture) {

;
module.exports = once;
var on = require('../on');
function pausable(type) {

@@ -11,3 +10,2 @@ return function (target, listener, capture) {

}, capture);
handle.pause = function () {

@@ -22,3 +20,2 @@ paused = true;

}
module.exports = pausable;
{
"name": "dojo",
"version": "2.0.0-alpha2",
"version": "2.0.0-alpha3",
"scripts": {

@@ -5,0 +5,0 @@ "prepublish": "support/prepublish.sh"

var nextTick = require('./nextTick');
function isPromise(value) {
return value && typeof value.then === 'function';
}
function runCallbacks(callbacks) {
var args = [];
for (var _i = 0; _i < (arguments.length - 1); _i++) {
args[_i] = arguments[_i + 1];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}

@@ -16,6 +14,5 @@ for (var i = 0, callback; callback = callbacks[i]; ++i) {

}
/**
* The Deferred class unwraps a promise in order to expose its internal state management functions.
*/
* The Deferred class unwraps a promise in order to expose its internal state management functions.
*/
var Deferred = (function () {

@@ -33,48 +30,47 @@ function Deferred(canceler) {

})();
/**
* A Promise represents the result of an asynchronous operation. When writing a function that performs an asynchronous
* operation, instead of writing the function to accept a callback function, you should instead write it to return a
* Promise that is fulfilled once the asynchronous operation is completed. Returning a promise instead of accepting
* a callback provides a standard mechanism for handling asynchronous operations that offers the following benefits
* over a normal callback function:
*
* 1. Multiple callbacks can be added for a single function invocation;
* 2. Other asynchronous operations can be easily chained to the response, avoiding callback pyramids;
* 3. Asynchronous operations can be canceled in flight in a standard way if their results are no longer needed by the
* rest of the application.
*
* The Promise class is a modified, extended version of standard EcmaScript 6 promises. This implementation
* intentionally deviates from the ES6 2014-05-22 draft in the following ways:
*
* 1. `Promise.race` is a worthless API with one use case, so is not implemented.
* 2. `Promise.all` accepts an object in addition to an array.
* 3. Asynchronous operations can transmit partial progress information through a third `progress` method passed to the
* initializer. Progress listeners can be added by passing a third `onProgress` callback to `then`, or through the
* extra `progress` method exposed on promises.
* 4. Promises can be canceled by calling the `cancel` method of a promise.
*/
* A Promise represents the result of an asynchronous operation. When writing a function that performs an asynchronous
* operation, instead of writing the function to accept a callback function, you should instead write it to return a
* Promise that is fulfilled once the asynchronous operation is completed. Returning a promise instead of accepting
* a callback provides a standard mechanism for handling asynchronous operations that offers the following benefits
* over a normal callback function:
*
* 1. Multiple callbacks can be added for a single function invocation;
* 2. Other asynchronous operations can be easily chained to the response, avoiding callback pyramids;
* 3. Asynchronous operations can be canceled in flight in a standard way if their results are no longer needed by the
* rest of the application.
*
* The Promise class is a modified, extended version of standard EcmaScript 6 promises. This implementation
* intentionally deviates from the ES6 2014-05-22 draft in the following ways:
*
* 1. `Promise.race` is a worthless API with one use case, so is not implemented.
* 2. `Promise.all` accepts an object in addition to an array.
* 3. Asynchronous operations can transmit partial progress information through a third `progress` method passed to the
* initializer. Progress listeners can be added by passing a third `onProgress` callback to `then`, or through the
* extra `progress` method exposed on promises.
* 4. Promises can be canceled by calling the `cancel` method of a promise.
*/
var Promise = (function () {
/**
* Creates a new Promise.
*
* @constructor
*
* @param initializer
* The initializer function is called immediately when the Promise is instantiated. It is responsible for starting
* the asynchronous operation when it is invoked.
*
* The initializer must call either the passed `resolve` function when the asynchronous operation has completed
* successfully, or the `reject` function when the operation fails, unless the the `canceler` is called first.
*
* The `progress` function can also be called zero or more times to provide information about the process of the
* operation to any interested consumers.
*
* Finally, the initializer can register an canceler function that cancels the asynchronous operation by passing
* the canceler function to the `setCanceler` function.
*/
* Creates a new Promise.
*
* @constructor
*
* @param initializer
* The initializer function is called immediately when the Promise is instantiated. It is responsible for starting
* the asynchronous operation when it is invoked.
*
* The initializer must call either the passed `resolve` function when the asynchronous operation has completed
* successfully, or the `reject` function when the operation fails, unless the the `canceler` is called first.
*
* The `progress` function can also be called zero or more times to provide information about the process of the
* operation to any interested consumers.
*
* Finally, the initializer can register an canceler function that cancels the asynchronous operation by passing
* the canceler function to the `setCanceler` function.
*/
function Promise(initializer) {
/**
* The current state of this promise.
*/
* The current state of this promise.
*/
var state = 0 /* PENDING */;

@@ -86,25 +82,21 @@ Object.defineProperty(this, 'state', {

});
/**
* Whether or not this promise is in a resolved state.
*/
* Whether or not this promise is in a resolved state.
*/
function isResolved() {
return state !== 0 /* PENDING */ || isChained;
}
/**
* If true, the resolution of this promise is chained to another promise.
*/
* If true, the resolution of this promise is chained to another promise.
*/
var isChained = false;
/**
* The resolved value for this promise.
*
* @type {T|Error}
*/
* The resolved value for this promise.
*
* @type {T|Error}
*/
var resolvedValue;
/**
* Callbacks that should be invoked once the asynchronous operation has completed.
*/
* Callbacks that should be invoked once the asynchronous operation has completed.
*/
var callbacks = [];

@@ -114,6 +106,5 @@ var whenFinished = function (callback) {

};
/**
* Callbacks that should be invoked when the asynchronous operation has progressed.
*/
* Callbacks that should be invoked when the asynchronous operation has progressed.
*/
var progressCallbacks = [];

@@ -123,17 +114,15 @@ var whenProgress = function (callback) {

};
/**
* A canceler function that will be used to cancel resolution of this promise.
*/
* A canceler function that will be used to cancel resolution of this promise.
*/
var canceler;
/**
* Queues a callback for execution during the next round through the event loop, in a way such that if a
* new execution is queued for this promise during queue processing, it will execute immediately instead of
* being forced to wait through another turn through the event loop.
* TODO: Ensure this is actually necessary for optimal execution and does not break next-turn spec compliance.
*
* @method
* @param callback The callback to execute on the next turn through the event loop.
*/
* Queues a callback for execution during the next round through the event loop, in a way such that if a
* new execution is queued for this promise during queue processing, it will execute immediately instead of
* being forced to wait through another turn through the event loop.
* TODO: Ensure this is actually necessary for optimal execution and does not break next-turn spec compliance.
*
* @method
* @param callback The callback to execute on the next turn through the event loop.
*/
var enqueue = (function () {

@@ -143,5 +132,4 @@ function originalSchedule() {

};
nextTick(function run() {
try {
try {
var callback;

@@ -151,3 +139,4 @@ while ((callback = queue.shift())) {

}
} finally {
}
finally {
// If someone threw an error, allow it to bubble, then continue queue execution for the

@@ -157,3 +146,4 @@ // remaining items

run();
} else {
}
else {
schedule = originalSchedule;

@@ -164,6 +154,4 @@ }

}
var queue = [];
var schedule = originalSchedule;
return function (callback) {

@@ -174,9 +162,8 @@ queue.push(callback);

})();
/**
* Resolves this promise.
*
* @param newState The resolved state for this promise.
* @param {T|Error} value The resolved value for this promise.
*/
* Resolves this promise.
*
* @param newState The resolved state for this promise.
* @param {T|Error} value The resolved value for this promise.
*/
var resolve = function (newState, value) {

@@ -186,3 +173,2 @@ if (isResolved()) {

}
if (isPromise(value)) {

@@ -192,18 +178,16 @@ if (value === this) {

}
isChained = true;
value.then(settle.bind(null, 1 /* FULFILLED */), settle.bind(null, 2 /* REJECTED */));
this.cancel = value.cancel;
} else {
}
else {
settle(newState, value);
}
}.bind(this);
/**
* Settles this promise.
*
* @param newState The resolved state for this promise.
* @param {T|Error} value The resolved value for this promise.
*/
* Settles this promise.
*
* @param newState The resolved state for this promise.
* @param {T|Error} value The resolved value for this promise.
*/
function settle(newState, value) {

@@ -220,3 +204,2 @@ state = newState;

}
this.cancel = function (reason) {

@@ -226,3 +209,2 @@ if (isResolved() || !canceler) {

}
if (!reason) {

@@ -232,10 +214,9 @@ reason = new Error();

}
try {
try {
resolve(1 /* FULFILLED */, canceler(reason));
} catch (error) {
}
catch (error) {
settle(2 /* REJECTED */, error);
}
};
this.then = function (onFulfilled, onRejected, onProgress) {

@@ -248,14 +229,14 @@ return new Promise(function (resolve, reject, progress, setCanceler) {

}
throw reason;
});
whenProgress(function (data) {
try {
try {
if (typeof onProgress === 'function') {
progress(onProgress(data));
} else {
}
else {
progress(data);
}
} catch (error) {
}
catch (error) {
if (error.name !== 'StopProgressPropagation') {

@@ -266,15 +247,16 @@ throw error;

});
whenFinished(function () {
var callback = state === 2 /* REJECTED */ ? onRejected : onFulfilled;
if (typeof callback === 'function') {
try {
try {
resolve(callback(resolvedValue));
} catch (error) {
}
catch (error) {
reject(error);
}
} else if (state === 2 /* REJECTED */) {
}
else if (state === 2 /* REJECTED */) {
reject(resolvedValue);
} else {
}
else {
resolve(resolvedValue);

@@ -285,10 +267,12 @@ }

};
try {
try {
initializer(resolve.bind(null, 1 /* FULFILLED */), resolve.bind(null, 2 /* REJECTED */), function (data) {
enqueue(runCallbacks.bind(null, progressCallbacks, data));
if (state === 0 /* PENDING */) {
enqueue(runCallbacks.bind(null, progressCallbacks, data));
}
}, function (value) {
canceler = value;
});
} catch (error) {
}
catch (error) {
settle(2 /* REJECTED */, error);

@@ -306,6 +290,4 @@ }

});
return values;
});
function fulfill(key, value) {

@@ -317,3 +299,2 @@ values[key] = value;

}
function finish() {

@@ -323,6 +304,4 @@ if (populating || complete < total) {

}
resolve(values);
}
function processItem(key, value) {

@@ -332,7 +311,7 @@ ++total;

value.then(fulfill.bind(null, key), fulfill.bind(null, key));
} else {
}
else {
fulfill(key, value);
}
}
function walkIterable(callback) {

@@ -345,3 +324,4 @@ if (Array.isArray(iterable)) {

}
} else {
}
else {
for (var key in iterable) {

@@ -352,7 +332,5 @@ callback(key, iterable[key]);

}
var values = Array.isArray(iterable) ? [] : {};
var complete = 0;
var total = 0;
var populating = true;

@@ -364,6 +342,5 @@ walkIterable(processItem);

};
/**
* Creates a new promise that is pre-rejected with the given error.
*/
* Creates a new promise that is pre-rejected with the given error.
*/
Promise.reject = function (error) {

@@ -374,3 +351,2 @@ return new this(function (resolve, reject) {

};
Promise.resolve = function (value) {

@@ -380,3 +356,2 @@ if (value instanceof Promise) {

}
return new this(function (resolve) {

@@ -386,29 +361,23 @@ resolve(value);

};
Promise.prototype.catch = function (onRejected) {
return this.then(null, onRejected);
};
Promise.prototype.finally = function (onFulfilledOrRejected) {
return this.then(onFulfilledOrRejected, onFulfilledOrRejected);
};
/**
* Adds a callback to the promise to be invoked when progress occurs within the asynchronous operation.
*/
* Adds a callback to the promise to be invoked when progress occurs within the asynchronous operation.
*/
Promise.prototype.progress = function (onProgress) {
return this.then(null, null, onProgress);
};
// workaround for TS#2557
Promise.Deferred = Deferred;
return Promise;
})();
var Promise;
(function (Promise) {
/**
* The State enum represents the possible states of a promise.
*/
* The State enum represents the possible states of a promise.
*/
(function (State) {

@@ -421,3 +390,2 @@ State[State["PENDING"] = 0] = "PENDING";

})(Promise || (Promise = {}));
module.exports = Promise;
var lang = require('./lang');
var Registry = (function () {

@@ -10,8 +9,7 @@ function Registry(defaultValue) {

var args = [];
for (var _i = 0; _i < (arguments.length - 0); _i++) {
args[_i] = arguments[_i + 0];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var entries = this._entries.slice(0);
var entry;
for (var i = 0; (entry = entries[i]); ++i) {

@@ -22,10 +20,7 @@ if (entry.test.apply(null, args)) {

}
if (this._defaultValue !== undefined) {
return this._defaultValue;
}
throw new Error('No match found');
};
Registry.prototype.register = function (test, value, first) {

@@ -37,5 +32,3 @@ var entries = this._entries;

};
entries[first ? 'unshift' : 'push'](entry);
return {

@@ -52,3 +45,2 @@ remove: function () {

})();
module.exports = Registry;

@@ -1,19 +0,14 @@

var has = require('./has');
var Promise = require('./Promise');
var Registry = require('./Registry');
var defaultProvider;
if (has('host-node')) {
defaultProvider = require('./request/node');
} else if (has('host-browser')) {
}
else if (has('host-browser')) {
defaultProvider = require('./request/xhr');
}
var request = function (url, options) {
if (typeof options === "undefined") { options = {}; }
if (options === void 0) { options = {}; }
var args = Array.prototype.slice.call(arguments, 0);
var promise = request.providerRegistry.match(arguments).apply(null, arguments).then(function (response) {

@@ -26,10 +21,7 @@ args.unshift(response);

});
promise.data = promise.then(function (response) {
return response.data;
});
return promise;
};
request.providerRegistry = new Registry(defaultProvider);

@@ -39,3 +31,2 @@ request.filterRegistry = new Registry(function (response) {

});
// TODO: Put somewhere permanent

@@ -47,3 +38,2 @@ request.filterRegistry.register(function (response, url, options) {

});
['delete', 'get', 'post', 'put'].forEach(function (method) {

@@ -56,3 +46,2 @@ request[method] = function (url, options) {

});
module.exports = request;

@@ -5,5 +5,3 @@ var http = require('http');

var Promise = require('../Promise');
var urlUtil = require('url');
function normalizeHeaders(headers) {

@@ -14,8 +12,6 @@ var normalizedHeaders = {};

}
return normalizedHeaders;
}
function node(url, options) {
if (typeof options === "undefined") { options = {}; }
if (options === void 0) { options = {}; }
var deferred = new Promise.Deferred(function (reason) {

@@ -27,3 +23,2 @@ request && request.abort();

var parsedUrl = urlUtil.parse(options.proxy || url);
var requestOptions = {

@@ -49,7 +44,5 @@ agent: options.agent,

};
if (!('user-agent' in requestOptions.headers)) {
requestOptions.headers['user-agent'] = 'dojo/' + kernel.version + ' Node.js/' + process.version.replace(/^v/, '');
}
if (options.proxy) {

@@ -60,3 +53,2 @@ requestOptions.path = url;

}
(function () {

@@ -68,7 +60,5 @@ var parsedUrl = urlUtil.parse(url);

}
if (!options.auth && (options.user || options.password)) {
requestOptions.auth = encodeURIComponent(options.user || '') + ':' + encodeURIComponent(options.password || '');
}
// TODO: Cast to `any` prevents TS2226 error

@@ -85,3 +75,2 @@ var request = (parsedUrl.protocol === 'https:' ? https : http).request(requestOptions);

};
if (options.socketOptions) {

@@ -91,7 +80,5 @@ if ('timeout' in options.socketOptions) {

}
if ('noDelay' in options.socketOptions) {
request.setNoDelay(options.socketOptions.noDelay);
}
if ('keepAlive' in options.socketOptions) {

@@ -102,3 +89,2 @@ var initialDelay = options.socketOptions.keepAlive;

}
request.once('response', function (nativeResponse) {

@@ -108,6 +94,4 @@ var data;

var total = +nativeResponse.headers['content-length'];
response.nativeResponse = nativeResponse;
response.statusCode = nativeResponse.statusCode;
// Redirection handling defaults to true in order to harmonise with the XHR provider, which will always

@@ -123,11 +107,8 @@ // follow redirects

});
deferred.resolve(node(nativeResponse.headers.location, options));
return;
}
if (!options.streamData) {
data = [];
}
options.streamEncoding && nativeResponse.setEncoding(options.streamEncoding);

@@ -146,3 +127,2 @@ if (options.streamTarget) {

}
nativeResponse.on('data', function (chunk) {

@@ -153,10 +133,7 @@ options.streamData || data.push(chunk);

});
nativeResponse.once('end', function () {
timeout && timeout.remove();
if (!options.streamData) {
response.data = options.streamEncoding ? data.join('') : Buffer.concat(data, loaded);
}
// If using a streamTarget, wait for it to finish in case it throws an error

@@ -167,18 +144,16 @@ if (!options.streamTarget) {

});
deferred.progress({ type: 'nativeResponse', response: nativeResponse });
});
request.once('error', deferred.reject);
if (options.data) {
if (options.data.pipe) {
options.data.pipe(request);
} else {
}
else {
request.end(options.data, options.dataEncoding);
}
} else {
}
else {
request.end();
}
if (options.timeout > 0 && options.timeout !== Infinity) {

@@ -191,3 +166,2 @@ var timeout = (function () {

}, options.timeout);
return {

@@ -202,18 +176,12 @@ remove: function () {

}
return promise.catch(function (error) {
var parsedUrl = urlUtil.parse(url);
if (parsedUrl.auth) {
parsedUrl.auth = '(redacted)';
}
var sanitizedUrl = urlUtil.format(parsedUrl);
error.message = '[' + requestOptions.method + ' ' + sanitizedUrl + '] ' + error.message;
throw error;
});
}
module.exports = node;
var Promise = require('../Promise');
function xhr(url, options) {
if (typeof options === "undefined") { options = {}; }
if (options === void 0) { options = {}; }
var deferred = new Promise.Deferred(function (reason) {

@@ -9,3 +8,2 @@ request && request.abort();

});
var request = new XMLHttpRequest();

@@ -23,3 +21,2 @@ var response = {

};
if ((!options.user || !options.password) && options.auth) {

@@ -32,39 +29,29 @@ (function () {

}
request.open(options.method, url, !options.blockMainThread, options.user, options.password);
request.onerror = function (event) {
deferred.reject(event.error);
};
request.onload = function () {
if (options.responseType === 'xml') {
response.data = request.responseXML;
} else {
}
else {
response.data = request.response;
}
response.statusCode = request.status;
response.statusText = request.statusText;
deferred.resolve(response);
};
request.onprogress = function (event) {
deferred.progress(event);
};
if (options.timeout > 0 && options.timeout !== Infinity) {
request.timeout = options.timeout;
}
for (var header in options.headers) {
request.setRequestHeader(header, options.headers[header]);
}
request.send(options.data);
return deferred.promise;
}
module.exports = xhr;
var CallbackQueue = require('./CallbackQueue');
var nextTick = require('./nextTick');
var Scheduler = (function () {

@@ -12,7 +10,5 @@ function Scheduler() {

};
Scheduler.prototype.schedule = function (callback) {
var _this = this;
var handle = this._callbacks.add(callback);
// Scheduled callbacks can schedule more callbacks, but the added callbacks

@@ -23,3 +19,2 @@ // will be run in a subsequent turn

});
return handle;

@@ -29,5 +24,3 @@ };

})();
var scheduler = new Scheduler();
module.exports = Scheduler;
var lang = require('./lang');
function repeat(string, times) {

@@ -7,3 +6,2 @@ if (!string || times <= 0) {

}
var buffer = [];

@@ -23,3 +21,2 @@ while (true) {

exports.repeat = repeat;
var Padding;

@@ -32,12 +29,12 @@ (function (Padding) {

;
function _pad(text, size, character, position) {
if (typeof position === "undefined") { position = 1 /* Right */; }
if (position === void 0) { position = 1 /* Right */; }
var length = size - text.length, pad = exports.repeat(character, Math.ceil(length / character.length));
if (position === 0 /* Left */) {
return pad + text;
} else if (position === 1 /* Right */) {
}
else if (position === 1 /* Right */) {
return text + pad;
} else {
}
else {
var left = Math.ceil(length / 2);

@@ -47,11 +44,9 @@ return pad.substr(0, left) + text + pad.substr(0, length - left);

}
function pad(text, size, character) {
if (typeof character === "undefined") { character = ' '; }
if (character === void 0) { character = ' '; }
return _pad(text, size, character, 2 /* Both */);
}
exports.pad = pad;
function padr(text, size, character) {
if (typeof character === "undefined") { character = ' '; }
if (character === void 0) { character = ' '; }
return _pad(text, size, character, 1 /* Right */);

@@ -61,7 +56,6 @@ }

function padl(text, size, character) {
if (typeof character === "undefined") { character = ' '; }
if (character === void 0) { character = ' '; }
return _pad(text, size, character, 0 /* Left */);
}
exports.padl = padl;
var substitutePattern = /\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g;

@@ -72,7 +66,5 @@ function defaultTransform(value) {

;
function substitute(template, map, transform, context) {
context = context || undefined;
transform = transform ? transform.bind(context) : defaultTransform;
// TODO: remove <any> after https://typescript.codeplex.com/workitem/1812 is fixed

@@ -88,6 +80,4 @@ return template.replace(substitutePattern, function (match, key, format) {

exports.substitute = substitute;
function count(haystack, needle) {
var hits = 0, lastIndex = haystack.indexOf(needle);
while (lastIndex > -1) {

@@ -97,7 +87,5 @@ ++hits;

}
return hits;
}
exports.count = count;
var regExpPattern = /[-\[\]{}()*+?.,\\\^$|#\s]/g;

@@ -104,0 +92,0 @@ function escapeRegExpString(string) {

/// <reference path="./nodejs" />
var has = require('./has');
var getText;
if (has('host-browser')) {
getText = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
callback(xhr.responseText);
};
xhr.open('GET', url, true);
xhr.send(null);
};
} else if (has('host-node')) {
}
else if (has('host-node')) {
var fs = require('fs');

@@ -24,7 +21,7 @@ getText = function (url, callback) {

}
callback(data);
});
};
} else {
}
else {
getText = function () {

@@ -34,3 +31,2 @@ throw new Error('dojo/text not supported on this platform');

}
function load(resourceId, require, load) {

@@ -37,0 +33,0 @@ getText(resourceId, load);

var Evented = require('./Evented');
var hub = new Evented();
function subscribe(topic, listener) {

@@ -9,7 +7,6 @@ return hub.on.apply(hub, arguments);

exports.subscribe = subscribe;
function publish(topic) {
var args = [];
for (var _i = 0; _i < (arguments.length - 1); _i++) {
args[_i] = arguments[_i + 1];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}

@@ -16,0 +13,0 @@ hub.emit.apply(hub, arguments);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc