ember-source 3.28.3 → 3.28.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,5 +5,5 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 3.28.3
8
+ * @version 3.28.7
9
9
  */
@@ -37,6 +37,13 @@ if (DEBUG) {
37
37
  } catch (e) {// ignore
38
38
  }
39
39
  }
40
+
41
+ class DeprecatedStoreInjection {
42
+ constructor(store) {
43
+ this.store = store;
44
+ }
45
+
46
+ }
40
47
  /**
41
48
  A container used to instantiate and cache objects.
42
49
 
@@ -51,7 +58,6 @@ if (DEBUG) {
51
58
  @class Container
52
59
  */
53
60
 
54
-
55
61
  class Container {
56
62
  constructor(registry, options = {}) {
57
63
  this.registry = registry;
@@ -396,7 +402,13 @@ function injectionsFor(container, fullName) {
396
402
  let [type] = fullName.split(':');
397
403
  let typeInjections = registry.getTypeInjections(type);
398
404
  let injections = registry.getInjections(fullName);
399
- return buildInjections(container, typeInjections, injections);
405
+ let result = buildInjections(container, typeInjections, injections);
406
+
407
+ if (DEBUG && type === 'route' && result.injections.store) {
408
+ result.injections.store = new DeprecatedStoreInjection(result.injections.store);
409
+ }
410
+
411
+ return result;
400
412
  }
401
413
 
402
414
  function destroyDestroyables(container) {
@@ -450,7 +462,7 @@ class FactoryManager {
450
462
  this.injections = undefined;
451
463
  setFactoryFor(this, this);
452
464
 
453
- if (factory && (HAS_NATIVE_SYMBOL || INIT_FACTORY in factory)) {
465
+ if (isInstantiatable(container, fullName) && (HAS_NATIVE_SYMBOL || INIT_FACTORY in factory)) {
454
466
  setFactoryFor(factory, this);
455
467
  }
456
468
  }
@@ -1116,4 +1128,4 @@ The public API, specified on the application namespace should be considered the
1116
1128
  @private
1117
1129
  */
1118
1130
 
1119
- export { Registry, privatize, Container, getFactoryFor, setFactoryFor, INIT_FACTORY };
1131
+ export { Registry, privatize, Container, getFactoryFor, setFactoryFor, INIT_FACTORY, DeprecatedStoreInjection };
@@ -1,4 +1,4 @@
1
- import { privatize as P } from '@ember/-internals/container';
1
+ import { DeprecatedStoreInjection, privatize as P } from '@ember/-internals/container';
2
2
  import { addObserver, computed, defineProperty, descriptorForProperty, flushAsyncObservers, get, getProperties, isEmpty, set, setProperties } from '@ember/-internals/metal';
3
3
  import { getOwner } from '@ember/-internals/owner';
4
4
  import { A as emberA, ActionHandler, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
@@ -8,7 +8,6 @@ import { ROUTER_EVENTS } from '@ember/deprecated-features';
8
8
  import { dependentKeyCompat } from '@ember/object/compat';
9
9
  import { assign } from '@ember/polyfills';
10
10
  import { once } from '@ember/runloop';
11
- import { classify } from '@ember/string';
12
11
  import { DEBUG } from '@glimmer/env';
13
12
  import { PARAMS_SYMBOL, STATE_SYMBOL } from 'router_js';
14
13
  import { calculateCacheKey, deprecateTransitionMethods, normalizeControllerQueryParams, prefixRouteNameArg, stashParamNames } from '../utils';
@@ -1999,18 +1998,17 @@ Route.reopen(ActionHandler, Evented, {
1999
1998
  get() {
2000
1999
  let owner = getOwner(this);
2001
2000
  let routeName = this.routeName;
2002
- let namespace = get(this, '_router.namespace');
2003
2001
  return {
2004
2002
  find(name, value) {
2005
2003
  let modelClass = owner.factoryFor(`model:${name}`);
2006
- assert(`You used the dynamic segment ${name}_id in your route ${routeName}, but ${namespace}.${classify(name)} did not exist and you did not override your route's \`model\` hook.`, Boolean(modelClass));
2004
+ assert(`You used the dynamic segment \`${name}_id\` in your route ` + `\`${routeName}\` for which Ember requires you provide a ` + `data-loading implementation. Commonly, that is done by ` + `adding a model hook implementation on the route ` + `(\`model({${name}_id}) {\`) or by injecting an implemention of ` + `a data store: \`@service store;\`.`, Boolean(modelClass));
2007
2005
 
2008
2006
  if (!modelClass) {
2009
2007
  return;
2010
2008
  }
2011
2009
 
2012
2010
  modelClass = modelClass.class;
2013
- assert(`${classify(name)} has no method \`find\`.`, typeof modelClass.find === 'function');
2011
+ assert(`You used the dynamic segment \`${name}_id\` in your route ` + `\`${routeName}\` for which Ember requires you provide a ` + `data-loading implementation. Commonly, that is done by ` + `adding a model hook implementation on the route ` + `(\`model({${name}_id}) {\`) or by injecting an implemention of ` + `a data store: \`@service store;\`.\n\n` + `Rarely, applications may attempt to use a legacy behavior where ` + `the model class (in this case \`${name}\`) is resolved and the ` + `\`find\` method on that class is invoked to load data. In this ` + `application, a model of \`${name}\` was found but it did not ` + `provide a \`find\` method. You should not add a \`find\` ` + `method to your model. Instead, please implement an appropriate ` + `\`model\` hook on the \`${routeName}\` route.`, typeof modelClass.find === 'function');
2014
2012
  return modelClass.find(value);
2015
2013
  }
2016
2014
 
@@ -2018,7 +2016,28 @@ Route.reopen(ActionHandler, Evented, {
2018
2016
  },
2019
2017
 
2020
2018
  set(key, value) {
2021
- defineProperty(this, key, null, value);
2019
+ if (DEBUG && value instanceof DeprecatedStoreInjection) {
2020
+ Object.defineProperty(this, key, {
2021
+ configurable: true,
2022
+ enumerable: false,
2023
+
2024
+ get() {
2025
+ deprecate(`A value for the \`store\` property was injected onto a route via the owner API. Implicit injection via the owner API is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`, false, {
2026
+ id: 'implicit-injections',
2027
+ until: '4.0.0',
2028
+ url: 'https://deprecations.emberjs.com/v3.x/#toc_implicit-injections',
2029
+ for: 'ember-source',
2030
+ since: {
2031
+ enabled: '3.28.7'
2032
+ }
2033
+ });
2034
+ return value.store;
2035
+ }
2036
+
2037
+ });
2038
+ } else {
2039
+ defineProperty(this, key, null, value);
2040
+ }
2022
2041
  }
2023
2042
 
2024
2043
  }),
@@ -603,8 +603,7 @@ class EmberRouter extends EmberObject {
603
603
  this._toplevelView = null;
604
604
  }
605
605
 
606
- this._super(...arguments);
607
-
606
+ super.willDestroy();
608
607
  this.reset();
609
608
  let instances = this._engineInstances;
610
609
 
@@ -1 +1 @@
1
- export default "3.28.3";
1
+ export default "3.28.7";