dist/ember-runtime.js in ember-source-2.13.0 vs dist/ember-runtime.js in ember-source-2.13.1

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.13.0 + * @version 2.13.1 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -171,37 +171,40 @@ createClass: createClass, interopExportWildcard: interopExportWildcard, defaults: defaults }; -enifed('@glimmer/di', ['exports', '@glimmer/util'], function (exports, _glimmerUtil) { +enifed('@glimmer/di', ['exports'], function (exports) { 'use strict'; var Container = (function () { function Container(registry) { var resolver = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; this._registry = registry; this._resolver = resolver; - this._lookups = _glimmerUtil.dict(); - this._factoryLookups = _glimmerUtil.dict(); + this._lookups = {}; + this._factoryDefinitionLookups = {}; } Container.prototype.factoryFor = function factoryFor(specifier) { - var factory = this._factoryLookups[specifier]; - if (!factory) { + var factoryDefinition = this._factoryDefinitionLookups[specifier]; + if (!factoryDefinition) { if (this._resolver) { - factory = this._resolver.retrieve(specifier); + factoryDefinition = this._resolver.retrieve(specifier); } - if (!factory) { - factory = this._registry.registration(specifier); + if (!factoryDefinition) { + factoryDefinition = this._registry.registration(specifier); } - if (factory) { - this._factoryLookups[specifier] = factory; + if (factoryDefinition) { + this._factoryDefinitionLookups[specifier] = factoryDefinition; } } - return factory; + if (!factoryDefinition) { + return; + } + return this.buildFactory(specifier, factoryDefinition); }; Container.prototype.lookup = function lookup(specifier) { var singleton = this._registry.registeredOption(specifier, 'singleton') !== false; if (singleton && this._lookups[specifier]) { @@ -210,14 +213,13 @@ var factory = this.factoryFor(specifier); if (!factory) { return; } if (this._registry.registeredOption(specifier, 'instantiate') === false) { - return factory; + return factory.class; } - var injections = this.buildInjections(specifier); - var object = factory.create(injections); + var object = factory.create(); if (singleton && object) { this._lookups[specifier] = object; } return object; }; @@ -235,31 +237,49 @@ hash[injection.property] = this.lookup(injection.source); } return hash; }; + Container.prototype.buildFactory = function buildFactory(specifier, factoryDefinition) { + var injections = this.buildInjections(specifier); + return { + class: factoryDefinition, + create: function (options) { + var mergedOptions = Object.assign({}, injections, options); + return factoryDefinition.create(mergedOptions); + } + }; + }; + return Container; })(); var Registry = (function () { - function Registry() { - this._registrations = _glimmerUtil.dict(); - this._registeredOptions = _glimmerUtil.dict(); - this._registeredInjections = _glimmerUtil.dict(); + function Registry(options) { + this._registrations = {}; + this._registeredOptions = {}; + this._registeredInjections = {}; + if (options && options.fallback) { + this._fallback = options.fallback; + } } // TODO - use symbol - Registry.prototype.register = function register(specifier, factory, options) { - this._registrations[specifier] = factory; + Registry.prototype.register = function register(specifier, factoryDefinition, options) { + this._registrations[specifier] = factoryDefinition; if (options) { this._registeredOptions[specifier] = options; } }; Registry.prototype.registration = function registration(specifier) { - return this._registrations[specifier]; + var registration = this._registrations[specifier]; + if (registration === undefined && this._fallback) { + registration = this._fallback.registration(specifier); + } + return registration; }; Registry.prototype.unregister = function unregister(specifier) { delete this._registrations[specifier]; delete this._registeredOptions[specifier]; @@ -274,14 +294,19 @@ } options[option] = value; }; Registry.prototype.registeredOption = function registeredOption(specifier, option) { + var result = undefined; var options = this.registeredOptions(specifier); if (options) { - return options[option]; + result = options[option]; } + if (result === undefined && this._fallback !== undefined) { + result = this._fallback.registeredOption(specifier, option); + } + return result; }; Registry.prototype.registeredOptions = function registeredOptions(specifier) { var options = this._registeredOptions[specifier]; if (options === undefined) { @@ -315,11 +340,11 @@ Registry.prototype.registeredInjections = function registeredInjections(specifier) { var _specifier$split2 = specifier.split(':'); var type = _specifier$split2[0]; - var injections = []; + var injections = this._fallback ? this._fallback.registeredInjections(specifier) : []; Array.prototype.push.apply(injections, this._registeredInjections[type]); Array.prototype.push.apply(injections, this._registeredInjections[specifier]); return injections; }; @@ -1427,10 +1452,11 @@ exports['default'] = Backburner; Object.defineProperty(exports, '__esModule', { value: true }); }); + enifed('container/container', ['exports', 'ember-debug', 'ember-utils', 'ember-environment'], function (exports, _emberDebug, _emberUtils, _emberEnvironment) { 'use strict'; var _Container$prototype; @@ -3227,13 +3253,10 @@ @for EmberENV @public */ ENV.LOG_VERSION = _emberEnvironmentUtils.defaultTrue(ENV.LOG_VERSION); - // default false - ENV.MODEL_FACTORY_INJECTIONS = _emberEnvironmentUtils.defaultFalse(ENV.MODEL_FACTORY_INJECTIONS); - /** Debug parameter you can turn on. This will log all bindings that fire to the console. This should be disabled in production code. Note that you can also enable this from the console or temporarily. @@ -17248,14 +17271,10 @@ ``` It is important to note that injections can only be performed on classes that are instantiated by Ember itself. Instantiating a class directly (via `create` or `new`) bypasses the dependency injection system. - **Note:** Ember-Data instantiates its models in a unique manner, and consequently - injections onto models (or all models) will not work as expected. Injections - on models can be enabled by setting `EmberENV.MODEL_FACTORY_INJECTIONS` - to `true`. @public @method inject @param factoryNameOrType {String} @param property {String} @param injectionName {String} @@ -19948,11 +19967,11 @@ exports.default = { "features-stripped-test": false, "ember-libraries-isregistered": false, "ember-improved-instrumentation": false, "ember-metal-weakmap": false, "ember-glimmer-allow-backtracking-rerender": false, "ember-testing-resume-test": true, "ember-factory-for": true, "ember-no-double-extend": true, "ember-routing-router-service": false, "ember-unique-location-history-state": true, "mandatory-setter": true, "ember-glimmer-detect-backtracking-rerender": true }; }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.13.0"; + exports.default = "2.13.1"; }); enifed('rsvp', ['exports'], function (exports) { 'use strict'; var _rsvp; @@ -20310,22 +20329,22 @@ GET_THEN_ERROR.error = error; return GET_THEN_ERROR; } } - function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { try { - then.call(value, fulfillmentHandler, rejectionHandler); + then$$1.call(value, fulfillmentHandler, rejectionHandler); } catch (e) { return e; } } - function handleForeignThenable(promise, thenable, then) { + function handleForeignThenable(promise, thenable, then$$1) { config.async(function (promise) { var sealed = false; - var error = tryThen(then, thenable, function (value) { + var error = tryThen(then$$1, thenable, function (value) { if (sealed) { return; } sealed = true; if (thenable !== value) { @@ -20366,21 +20385,21 @@ return reject(promise, reason); }); } } - function handleMaybeThenable(promise, maybeThenable, then$$) { - if (maybeThenable.constructor === promise.constructor && then$$ === then && promise.constructor.resolve === resolve$1) { + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$1) { handleOwnThenable(promise, maybeThenable); } else { - if (then$$ === GET_THEN_ERROR) { + if (then$$1 === GET_THEN_ERROR) { reject(promise, GET_THEN_ERROR.error); GET_THEN_ERROR.error = null; - } else if (then$$ === undefined) { + } else if (then$$1 === undefined) { fulfill(promise, maybeThenable); - } else if (isFunction(then$$)) { - handleForeignThenable(promise, maybeThenable, then$$); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); } else { fulfill(promise, maybeThenable); } } } @@ -20644,32 +20663,32 @@ } }; Enumerator.prototype._settleMaybeThenable = function (entry, i) { var c = this._instanceConstructor; - var resolve = c.resolve; + var resolve$$1 = c.resolve; - if (resolve === resolve$1) { - var then$$ = getThen(entry); + if (resolve$$1 === resolve$1) { + var then$$1 = getThen(entry); - if (then$$ === then && entry._state !== PENDING) { + if (then$$1 === then && entry._state !== PENDING) { entry._onError = null; this._settledAt(entry._state, i, entry._result); - } else if (typeof then$$ !== 'function') { + } else if (typeof then$$1 !== 'function') { this._remaining--; this._result[i] = this._makeResult(FULFILLED, i, entry); } else if (c === Promise) { var promise = new c(noop); - handleMaybeThenable(promise, entry, then$$); + handleMaybeThenable(promise, entry, then$$1); this._willSettleAt(promise, i); } else { - this._willSettleAt(new c(function (resolve) { - return resolve(entry); + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); }), i); } } else { - this._willSettleAt(resolve(entry), i); + this._willSettleAt(resolve$$1(entry), i); } }; Enumerator.prototype._eachEntry = function (entry, i) { if (isMaybeThenable(entry)) { @@ -22438,10 +22457,11 @@ } // the default export here is for backwards compat: // https://github.com/tildeio/rsvp.js/issues/434 var rsvp = (_rsvp = { + asap: asap, cast: cast, Promise: Promise, EventTarget: EventTarget, all: all$1, allSettled: allSettled, @@ -22458,9 +22478,10 @@ reject: reject$2, map: map }, _rsvp['async'] = async, _rsvp.filter = // babel seems to error if async isn't a computed prop here... filter, _rsvp); + exports.asap = asap; exports.cast = cast; exports.Promise = Promise; exports.EventTarget = EventTarget; exports.all = all$1; exports.allSettled = allSettled;