dist/globals/ember-data.prod.js in ember-data-source-2.11.0.beta.1 vs dist/globals/ember-data.prod.js in ember-data-source-2.11.0

- old
+ new

@@ -4,11 +4,11 @@ /*! * @overview Ember Data * @copyright Copyright 2011-2016 Tilde Inc. and contributors. * Portions Copyright 2011 LivingSocial Inc. * @license Licensed under MIT license (see license.js) - * @version 2.11.0-beta.1 + * @version 2.11.0 */ var loader, define, requireModule, require, requirejs; (function(global) { @@ -99,73 +99,93 @@ this.id = uuid++; this.name = name; this.deps = !deps.length && callback.length ? defaultDeps : deps; this.module = { exports: {} }; this.callback = callback; - this.finalized = false; this.hasExportsAsDep = false; this.isAlias = alias; this.reified = new Array(deps.length); - this._foundDeps = false; - this.isPending = false; + + /* + Each module normally passes through these states, in order: + new : initial state + pending : this module is scheduled to be executed + reifying : this module's dependencies are being executed + reified : this module's dependencies finished executing successfully + errored : this module's dependencies failed to execute + finalized : this module executed successfully + */ + this.state = 'new'; + } Module.prototype.makeDefaultExport = function() { var exports = this.module.exports; if (exports !== null && (typeof exports === 'object' || typeof exports === 'function') && - exports['default'] === undefined) { + exports['default'] === undefined && !Object.isFrozen(exports)) { exports['default'] = exports; } }; Module.prototype.exports = function() { - if (this.finalized) { return this.module.exports; } + // if finalized, there is no work to do. If reifying, there is a + // circular dependency so we must return our (partial) exports. + if (this.state === 'finalized' || this.state === 'reifying') { return this.module.exports; } stats.exports++; - this.finalized = true; - this.isPending = false; - if (loader.wrapModules) { this.callback = loader.wrapModules(this.name, this.callback); } this.reify(); var result = this.callback.apply(this, this.reified); + this.state = 'finalized'; if (!(this.hasExportsAsDep && result === undefined)) { this.module.exports = result; } this.makeDefaultExport(); return this.module.exports; }; Module.prototype.unsee = function() { - this.finalized = false; - this._foundDeps = false; - this.isPending = false; + this.state = 'new'; this.module = { exports: {} }; }; Module.prototype.reify = function() { + if (this.state === 'reified') { return; } + this.state = 'reifying'; + try { + this.reified = this._reify(); + this.state = 'reified'; + } finally { + if (this.state === 'reifying') { + this.state = 'errored'; + } + } + }; + + Module.prototype._reify = function() { stats.reify++; - var reified = this.reified; + var reified = this.reified.slice(); for (var i = 0; i < reified.length; i++) { var mod = reified[i]; reified[i] = mod.exports ? mod.exports : mod.module.exports(); } + return reified; }; Module.prototype.findDeps = function(pending) { - if (this._foundDeps) { + if (this.state !== 'new') { return; } stats.findDeps++; - this._foundDeps = true; - this.isPending = true; + this.state = 'pending'; var deps = this.deps; for (var i = 0; i < deps.length; i++) { var dep = deps[i]; @@ -238,11 +258,11 @@ mod = registry[mod.name]; } if (!mod) { missingModule(name, referrer); } - if (pending && !mod.finalized && !mod.isPending) { + if (pending && mod.state !== 'pending' && mod.state !== 'finalized') { mod.findDeps(pending); pending.push(mod); stats.pendingQueueLength++; } return mod; @@ -18664,11 +18684,11 @@ */ deserialize: null }); }); define("ember-data/version", ["exports"], function (exports) { - exports.default = "2.11.0-beta.1"; + exports.default = "2.11.0"; }); define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) { _emberInflectorLibSystem.Inflector.defaultRules = _emberInflectorLibSystem.defaultRules; _ember.default.Inflector = _emberInflectorLibSystem.Inflector; @@ -18682,13 +18702,18 @@ exports.defaultRules = _emberInflectorLibSystem.defaultRules; if (typeof define !== 'undefined' && define.amd) { define('ember-inflector', ['exports'], function (__exports__) { __exports__['default'] = _emberInflectorLibSystem.Inflector; - return _emberInflectorLibSystem.Inflector; + __exports__.pluralize = _emberInflectorLibSystem.pluralize; + __exports__.singularize = _emberInflectorLibSystem.singularize; + + return __exports__; }); } else if (typeof module !== 'undefined' && module['exports']) { module['exports'] = _emberInflectorLibSystem.Inflector; + _emberInflectorLibSystem.Inflector.singularize = _emberInflectorLibSystem.singularize; + _emberInflectorLibSystem.Inflector.pluralize = _emberInflectorLibSystem.pluralize; } }); /* global define, module */ define('ember-inflector/lib/ext/string', ['exports', 'ember', 'ember-inflector/lib/system/string'], function (exports, _ember, _emberInflectorLibSystemString) {