dist/globals/ember-data.prod.js in ember-data-source-2.14.0.beta.3 vs dist/globals/ember-data.prod.js in ember-data-source-2.14.0
- old
+ new
@@ -4,11 +4,11 @@
/*!
* @overview Ember Data
* @copyright Copyright 2011-2017 Tilde Inc. and contributors.
* Portions Copyright 2011 LivingSocial Inc.
* @license Licensed under MIT license (see license.js)
- * @version 2.14.0-beta.3
+ * @version 2.14.0
*/
var loader, define, requireModule, require, requirejs;
(function (global) {
@@ -30,13 +30,13 @@
requireModule: requireModule,
require: require,
requirejs: requirejs
};
- requirejs = require = requireModule = function (name) {
+ requirejs = require = requireModule = function (id) {
var pending = [];
- var mod = findModule(name, '(require)', pending);
+ var mod = findModule(id, '(require)', pending);
for (var i = pending.length - 1; i >= 0; i--) {
pending[i].exports();
}
@@ -64,18 +64,18 @@
var seen = dict();
var uuid = 0;
function unsupportedModule(length) {
- throw new Error('an unsupported module was defined, expected `define(name, deps, module)` instead got: `' + length + '` arguments to define`');
+ throw new Error('an unsupported module was defined, expected `define(id, deps, module)` instead got: `' + length + '` arguments to define`');
}
var defaultDeps = ['require', 'exports', 'module'];
- function Module(name, deps, callback, alias) {
- this.id = uuid++;
- this.name = name;
+ function Module(id, deps, callback, alias) {
+ this.uuid = uuid++;
+ this.id = id;
this.deps = !deps.length && callback.length ? defaultDeps : deps;
this.module = { exports: {} };
this.callback = callback;
this.hasExportsAsDep = false;
this.isAlias = alias;
@@ -106,11 +106,11 @@
if (this.state === 'finalized' || this.state === 'reifying') {
return this.module.exports;
}
if (loader.wrapModules) {
- this.callback = loader.wrapModules(this.name, this.callback);
+ this.callback = loader.wrapModules(this.id, this.callback);
}
this.reify();
var result = this.callback.apply(this, this.reified);
@@ -171,31 +171,32 @@
} else if (dep === 'require') {
entry.exports = this.makeRequire();
} else if (dep === 'module') {
entry.exports = this.module;
} else {
- entry.module = findModule(resolve(dep, this.name), this.name, pending);
+ entry.module = findModule(resolve(dep, this.id), this.id, pending);
}
}
};
Module.prototype.makeRequire = function () {
- var name = this.name;
+ var id = this.id;
var r = function (dep) {
- return require(resolve(dep, name));
+ return require(resolve(dep, id));
};
r['default'] = r;
+ r.moduleId = id;
r.has = function (dep) {
- return has(resolve(dep, name));
+ return has(resolve(dep, id));
};
return r;
};
- define = function (name, deps, callback) {
- var module = registry[name];
+ define = function (id, deps, callback) {
+ var module = registry[id];
- // If a module for this name has already been defined and is in any state
+ // If a module for this id has already been defined and is in any state
// other than `new` (meaning it has been or is currently being required),
// then we return early to avoid redefinition.
if (module && module.state !== 'new') {
return;
}
@@ -208,60 +209,79 @@
callback = deps;
deps = [];
}
if (callback instanceof Alias) {
- registry[name] = new Module(callback.name, deps, callback, true);
+ registry[id] = new Module(callback.id, deps, callback, true);
} else {
- registry[name] = new Module(name, deps, callback, false);
+ registry[id] = new Module(id, deps, callback, false);
}
};
+ define.exports = function (name, defaultExport) {
+ var module = registry[name];
+
+ // If a module for this name has already been defined and is in any state
+ // other than `new` (meaning it has been or is currently being required),
+ // then we return early to avoid redefinition.
+ if (module && module.state !== 'new') {
+ return;
+ }
+
+ module = new Module(name, [], noop, null);
+ module.module.exports = defaultExport;
+ module.state = 'finalized';
+ registry[name] = module;
+
+ return module;
+ };
+
+ function noop() {}
// we don't support all of AMD
// define.amd = {};
- function Alias(path) {
- this.name = path;
+ function Alias(id) {
+ this.id = id;
}
- define.alias = function (path, target) {
+ define.alias = function (id, target) {
if (arguments.length === 2) {
- return define(target, new Alias(path));
+ return define(target, new Alias(id));
}
- return new Alias(path);
+ return new Alias(id);
};
- function missingModule(name, referrer) {
- throw new Error('Could not find module `' + name + '` imported from `' + referrer + '`');
+ function missingModule(id, referrer) {
+ throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');
}
- function findModule(name, referrer, pending) {
- var mod = registry[name] || registry[name + '/index'];
+ function findModule(id, referrer, pending) {
+ var mod = registry[id] || registry[id + '/index'];
while (mod && mod.isAlias) {
- mod = registry[mod.name];
+ mod = registry[mod.id];
}
if (!mod) {
- missingModule(name, referrer);
+ missingModule(id, referrer);
}
if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {
mod.findDeps(pending);
pending.push(mod);
}
return mod;
}
- function resolve(child, name) {
+ function resolve(child, id) {
if (child.charAt(0) !== '.') {
return child;
}
var parts = child.split('/');
- var nameParts = name.split('/');
+ var nameParts = id.split('/');
var parentBase = nameParts.slice(0, -1);
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i];
@@ -278,18 +298,18 @@
}
return parentBase.join('/');
}
- function has(name) {
- return !!(registry[name] || registry[name + '/index']);
+ function has(id) {
+ return !!(registry[id] || registry[id + '/index']);
}
requirejs.entries = requirejs._eak_seen = registry;
requirejs.has = has;
- requirejs.unsee = function (moduleName) {
- findModule(moduleName, '(unsee)', false).unsee();
+ requirejs.unsee = function (id) {
+ findModule(id, '(unsee)', false).unsee();
};
requirejs.clear = function () {
requirejs.entries = requirejs._eak_seen = registry = dict();
seen = dict();
@@ -307,11 +327,13 @@
define('foo/baz', [], define.alias('foo'));
define('foo/quz', define.alias('foo'));
define.alias('foo', 'foo/qux');
define('foo/bar', ['foo', './quz', './baz', './asdf', './bar', '../foo'], function () {});
define('foo/main', ['foo/bar'], function () {});
+ define.exports('foo/exports', {});
+ require('foo/exports');
require('foo/main');
require.unsee('foo/bar');
requirejs.clear();
@@ -2739,10 +2761,11 @@
EmberError = _ember.default.Error,
inspect = _ember.default.inspect,
isEmpty = _ember.default.isEmpty,
isEqual = _ember.default.isEqual,
setOwner = _ember.default.setOwner,
+ run = _ember.default.run,
RSVP = _ember.default.RSVP,
Promise = _ember.default.RSVP.Promise;
var assign = _ember.default.assign || _ember.default.merge;
@@ -2823,10 +2846,11 @@
// reason this might happen is that dematerialization removes records from
// record arrays, and Ember arrays will always `objectAt(0)` and
// `objectAt(len - 1)` to test whether or not `firstObject` or `lastObject`
// have changed.
this._isDematerializing = false;
+ this._scheduledDestroy = null;
this.resetRecord();
if (data) {
this.__data = data;
@@ -3031,15 +3055,25 @@
};
InternalModel.prototype.unloadRecord = function unloadRecord() {
this.send('unloadRecord');
this.dematerializeRecord();
- _ember.default.run.schedule('destroy', this, '_checkForOrphanedInternalModels');
+ if (this._scheduledDestroy === null) {
+ this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
+ }
};
+ InternalModel.prototype.cancelDestroy = function cancelDestroy() {
+
+ this._isDematerializing = false;
+ run.cancel(this._scheduledDestroy);
+ this._scheduledDestroy = null;
+ };
+
InternalModel.prototype._checkForOrphanedInternalModels = function _checkForOrphanedInternalModels() {
this._isDematerializing = false;
+ this._scheduledDestroy = null;
if (this.isDestroyed) {
return;
}
this._cleanupOrphanedInternalModels();
@@ -10670,10 +10704,14 @@
var trueId = (0, _coerceId.default)(id);
var internalModel = this._internalModelsFor(modelName).get(trueId);
if (!internalModel) {
internalModel = this._buildInternalModel(modelName, trueId);
+ } else {
+ // if we already have an internalModel, we need to ensure any async teardown is cancelled
+ // since we want it again.
+ internalModel.cancelDestroy();
}
return internalModel;
},
_internalModelDidReceiveRelationshipData: function (modelName, id, relationshipData) {
@@ -17596,10 +17634,10 @@
});
define("ember-data/version", ["exports"], function (exports) {
"use strict";
exports.__esModule = true;
- exports.default = "2.14.0-beta.3";
+ exports.default = "2.14.0";
});
define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
"use strict";
exports.__esModule = true;