ember-source 4.2.0-alpha.7 → 4.3.0-alpha.3

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/blueprints/component-addon/index.js +2 -3
  3. package/blueprints/component-class-addon/index.js +2 -3
  4. package/blueprints/controller/files/__root__/__path__/__name__.js +2 -2
  5. package/blueprints/controller/index.js +2 -4
  6. package/blueprints/route/files/__root__/__path__/__name__.js +3 -3
  7. package/blueprints/route/index.js +2 -3
  8. package/blueprints/service/files/__root__/__path__/__name__.js +2 -2
  9. package/blueprints/service/index.js +2 -4
  10. package/build-metadata.json +3 -3
  11. package/dist/ember-template-compiler.js +89 -90
  12. package/dist/ember-template-compiler.map +1 -1
  13. package/dist/ember-testing.js +15 -14
  14. package/dist/ember-testing.map +1 -1
  15. package/dist/ember.debug.js +795 -752
  16. package/dist/ember.debug.map +1 -1
  17. package/dist/header/license.js +1 -1
  18. package/dist/header/loader.js +0 -1
  19. package/dist/packages/@ember/-internals/bootstrap/index.js +0 -2
  20. package/dist/packages/@ember/-internals/container/index.js +1 -1
  21. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +3 -3
  22. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +52 -52
  23. package/dist/packages/@ember/-internals/glimmer/index.js +49 -81
  24. package/dist/packages/@ember/-internals/meta/lib/meta.js +59 -2
  25. package/dist/packages/@ember/-internals/metal/index.js +51 -76
  26. package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +14 -4
  27. package/dist/packages/@ember/-internals/routing/lib/location/api.js +1 -0
  28. package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +3 -1
  29. package/dist/packages/@ember/-internals/routing/lib/services/router.js +7 -49
  30. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +3 -1
  31. package/dist/packages/@ember/-internals/routing/lib/system/route.js +57 -33
  32. package/dist/packages/@ember/-internals/routing/lib/system/router.js +22 -7
  33. package/dist/packages/@ember/-internals/routing/lib/utils.js +23 -11
  34. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
  35. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -32
  36. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -0
  37. package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
  38. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
  39. package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
  40. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +48 -48
  41. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
  42. package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +1 -2
  43. package/dist/packages/@ember/-internals/runtime/lib/type-of.js +1 -1
  44. package/dist/packages/@ember/-internals/utils/index.js +9 -9
  45. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +2 -4
  46. package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -0
  47. package/dist/packages/@ember/application/lib/application.js +0 -2
  48. package/dist/packages/@ember/array/index.js +1 -1
  49. package/dist/packages/@ember/debug/index.js +1 -1
  50. package/dist/packages/@ember/debug/lib/deprecate.js +12 -10
  51. package/dist/packages/@ember/object/compat.js +16 -7
  52. package/dist/packages/@ember/polyfills/lib/assign.js +1 -0
  53. package/dist/packages/@ember/runloop/index.js +9 -9
  54. package/dist/packages/@ember/string/index.js +1 -0
  55. package/dist/packages/ember/index.js +1 -2
  56. package/dist/packages/ember/version.js +1 -1
  57. package/docs/data.json +2375 -1676
  58. package/package.json +21 -21
  59. package/blueprints/component-addon/native-files/__root__/__path__/__name__.js +0 -1
  60. package/blueprints/component-class-addon/native-files/__root__/__path__/__name__.js +0 -1
  61. package/blueprints/controller/native-files/__root__/__path__/__name__.js +0 -4
  62. package/blueprints/edition-detector.js +0 -13
  63. package/blueprints/route/native-files/__root__/__path__/__name__.js +0 -11
  64. package/blueprints/route/native-files/__root__/__templatepath__/__templatename__.hbs +0 -2
  65. package/blueprints/service/native-files/__root__/__path__/__name__.js +0 -4
@@ -36,9 +36,16 @@ export const UNDEFINED = symbol('undefined');
36
36
  let currentListenerVersion = 1;
37
37
  export class Meta {
38
38
  // DEBUG
39
+
40
+ /** @internal */
39
41
  constructor(obj) {
42
+ /** @internal */
40
43
  this._listenersVersion = 1;
44
+ /** @internal */
45
+
41
46
  this._inheritedEnd = -1;
47
+ /** @internal */
48
+
42
49
  this._flattenedVersion = 0;
43
50
 
44
51
  if (DEBUG) {
@@ -59,6 +66,8 @@ export class Meta {
59
66
  this.proto = obj.constructor === undefined ? undefined : obj.constructor.prototype;
60
67
  this._listeners = undefined;
61
68
  }
69
+ /** @internal */
70
+
62
71
 
63
72
  get parent() {
64
73
  let parent = this._parent;
@@ -74,26 +83,38 @@ export class Meta {
74
83
  setInitializing() {
75
84
  this._isInit = true;
76
85
  }
86
+ /** @internal */
87
+
77
88
 
78
89
  unsetInitializing() {
79
90
  this._isInit = false;
80
91
  }
92
+ /** @internal */
93
+
81
94
 
82
95
  isInitializing() {
83
96
  return this._isInit;
84
97
  }
98
+ /** @internal */
99
+
85
100
 
86
101
  isPrototypeMeta(obj) {
87
102
  return this.proto === this.source && this.source === obj;
88
103
  }
104
+ /** @internal */
105
+
89
106
 
90
107
  _getOrCreateOwnMap(key) {
91
108
  return this[key] || (this[key] = Object.create(null));
92
109
  }
110
+ /** @internal */
111
+
93
112
 
94
113
  _getOrCreateOwnSet(key) {
95
114
  return this[key] || (this[key] = new Set());
96
115
  }
116
+ /** @internal */
117
+
97
118
 
98
119
  _findInheritedMap(key, subkey) {
99
120
  let pointer = this;
@@ -112,6 +133,8 @@ export class Meta {
112
133
  pointer = pointer.parent;
113
134
  }
114
135
  }
136
+ /** @internal */
137
+
115
138
 
116
139
  _hasInInheritedSet(key, value) {
117
140
  let pointer = this;
@@ -128,28 +151,38 @@ export class Meta {
128
151
 
129
152
  return false;
130
153
  }
154
+ /** @internal */
155
+
131
156
 
132
157
  valueFor(key) {
133
158
  let values = this._values;
134
159
  return values !== undefined ? values[key] : undefined;
135
160
  }
161
+ /** @internal */
162
+
136
163
 
137
164
  setValueFor(key, value) {
138
165
  let values = this._getOrCreateOwnMap('_values');
139
166
 
140
167
  values[key] = value;
141
168
  }
169
+ /** @internal */
170
+
142
171
 
143
172
  revisionFor(key) {
144
173
  let revisions = this._revisions;
145
174
  return revisions !== undefined ? revisions[key] : undefined;
146
175
  }
176
+ /** @internal */
177
+
147
178
 
148
179
  setRevisionFor(key, revision) {
149
180
  let revisions = this._getOrCreateOwnMap('_revisions');
150
181
 
151
182
  revisions[key] = revision;
152
183
  }
184
+ /** @internal */
185
+
153
186
 
154
187
  writableLazyChainsFor(key) {
155
188
  if (DEBUG) {
@@ -166,6 +199,8 @@ export class Meta {
166
199
 
167
200
  return chains;
168
201
  }
202
+ /** @internal */
203
+
169
204
 
170
205
  readableLazyChainsFor(key) {
171
206
  if (DEBUG) {
@@ -180,6 +215,8 @@ export class Meta {
180
215
 
181
216
  return undefined;
182
217
  }
218
+ /** @internal */
219
+
183
220
 
184
221
  addMixin(mixin) {
185
222
  assert(isDestroyed(this.source) ? `Cannot add mixins of \`${toString(mixin)}\` on \`${toString(this.source)}\` call addMixin after it has been destroyed.` : '', !isDestroyed(this.source));
@@ -188,10 +225,14 @@ export class Meta {
188
225
 
189
226
  set.add(mixin);
190
227
  }
228
+ /** @internal */
229
+
191
230
 
192
231
  hasMixin(mixin) {
193
232
  return this._hasInInheritedSet('_mixins', mixin);
194
233
  }
234
+ /** @internal */
235
+
195
236
 
196
237
  forEachMixins(fn) {
197
238
  let pointer = this;
@@ -214,22 +255,30 @@ export class Meta {
214
255
  pointer = pointer.parent;
215
256
  }
216
257
  }
258
+ /** @internal */
259
+
217
260
 
218
261
  writeDescriptors(subkey, value) {
219
262
  assert(isDestroyed(this.source) ? `Cannot update descriptors for \`${subkey}\` on \`${toString(this.source)}\` after it has been destroyed.` : '', !isDestroyed(this.source));
220
263
  let map = this._descriptors || (this._descriptors = new Map());
221
264
  map.set(subkey, value);
222
265
  }
266
+ /** @internal */
267
+
223
268
 
224
269
  peekDescriptors(subkey) {
225
270
  let possibleDesc = this._findInheritedMap('_descriptors', subkey);
226
271
 
227
272
  return possibleDesc === UNDEFINED ? undefined : possibleDesc;
228
273
  }
274
+ /** @internal */
275
+
229
276
 
230
277
  removeDescriptors(subkey) {
231
278
  this.writeDescriptors(subkey, UNDEFINED);
232
279
  }
280
+ /** @internal */
281
+
233
282
 
234
283
  forEachDescriptors(fn) {
235
284
  let pointer = this;
@@ -254,6 +303,8 @@ export class Meta {
254
303
  pointer = pointer.parent;
255
304
  }
256
305
  }
306
+ /** @internal */
307
+
257
308
 
258
309
  addToListeners(eventName, target, method, once, sync) {
259
310
  if (DEBUG) {
@@ -266,6 +317,8 @@ export class Meta {
266
317
  /* ADD */
267
318
  , sync);
268
319
  }
320
+ /** @internal */
321
+
269
322
 
270
323
  removeFromListeners(eventName, target, method) {
271
324
  if (DEBUG) {
@@ -311,8 +364,8 @@ export class Meta {
311
364
  && listener.kind !== 2
312
365
  /* REMOVE */
313
366
  ) {
314
- listeners.splice(i, 1);
315
- } else {
367
+ listeners.splice(i, 1);
368
+ } else {
316
369
  assert(`You attempted to add an observer for the same method on '${event.split(':')[0]}' twice to ${target} as both sync and async. Observers must be either sync or async, they cannot be both. This is likely a mistake, you should either remove the code that added the observer a second time, or update it to always be sync or async. The method was ${method}.`, !(listener.kind === 0
317
370
  /* ADD */
318
371
  && kind === 0
@@ -416,6 +469,8 @@ export class Meta {
416
469
 
417
470
  return this._listeners;
418
471
  }
472
+ /** @internal */
473
+
419
474
 
420
475
  matchingListeners(eventName) {
421
476
  let listeners = this.flattenedListeners();
@@ -450,6 +505,8 @@ export class Meta {
450
505
 
451
506
  return result;
452
507
  }
508
+ /** @internal */
509
+
453
510
 
454
511
  observerEvents() {
455
512
  let listeners = this.flattenedListeners();
@@ -759,7 +759,6 @@ function getChainTags(chainTags, obj, path, tagMeta, meta$$1) {
759
759
  descriptor = currentMeta !== null ? currentMeta.peekDescriptors(segment) : undefined; // If the key is an alias, we need to bootstrap it
760
760
 
761
761
  if (descriptor !== undefined && typeof descriptor.altKey === 'string') {
762
- // tslint:disable-next-line: no-unused-expression
763
762
  item[segment];
764
763
  }
765
764
  }
@@ -781,7 +780,6 @@ function getChainTags(chainTags, obj, path, tagMeta, meta$$1) {
781
780
  // bootstrap the alias. This is because aliases, unlike other CPs, should
782
781
  // always be in sync with the aliased value.
783
782
  if (CHAIN_PASS_THROUGH.has(descriptor)) {
784
- // tslint:disable-next-line: no-unused-expression
785
783
  current[segment];
786
784
  }
787
785
 
@@ -1585,11 +1583,15 @@ class ComputedDecoratorImpl extends Function {
1585
1583
  } // TODO: Remove this when we can provide alternatives in the ecosystem to
1586
1584
  // addons such as ember-macro-helpers that use it.
1587
1585
 
1586
+ /** @internal */
1587
+
1588
1588
 
1589
1589
  get _getter() {
1590
1590
  return descriptorForDecorator(this)._getter;
1591
1591
  } // TODO: Refactor this, this is an internal API only
1592
1592
 
1593
+ /** @internal */
1594
+
1593
1595
 
1594
1596
  set enumerable(value) {
1595
1597
  descriptorForDecorator(this).enumerable = value;
@@ -1633,6 +1635,8 @@ function getCachedValueFor(obj, key) {
1633
1635
 
1634
1636
  if (meta$$1) {
1635
1637
  return meta$$1.valueFor(key);
1638
+ } else {
1639
+ return undefined;
1636
1640
  }
1637
1641
  }
1638
1642
 
@@ -1766,45 +1770,7 @@ if (DEBUG) {
1766
1770
  return Reflect.get(content, keyName, obj);
1767
1771
  }
1768
1772
  };
1769
- } // ..........................................................
1770
- // GET AND SET
1771
- //
1772
- // If we are on a platform that supports accessors we can use those.
1773
- // Otherwise simulate accessors by looking up the property directly on the
1774
- // object.
1775
-
1776
- /**
1777
- Gets the value of a property on an object. If the property is computed,
1778
- the function will be invoked. If the property is not defined but the
1779
- object implements the `unknownProperty` method then that will be invoked.
1780
-
1781
- ```javascript
1782
- import { get } from '@ember/object';
1783
- get(obj, "name");
1784
- ```
1785
-
1786
- If you plan to run on IE8 and older browsers then you should use this
1787
- method anytime you want to retrieve a property on an object that you don't
1788
- know for sure is private. (Properties beginning with an underscore '_'
1789
- are considered private.)
1790
-
1791
- On all newer browsers, you only need to use this method to retrieve
1792
- properties if the property might not be defined on the object and you want
1793
- to respect the `unknownProperty` handler. Otherwise you can ignore this
1794
- method.
1795
-
1796
- Note that if the object itself is `undefined`, this method will throw
1797
- an error.
1798
-
1799
- @method get
1800
- @for @ember/object
1801
- @static
1802
- @param {Object} obj The object to retrieve from.
1803
- @param {String} keyName The property key to retrieve
1804
- @return {Object} the property value or `null`.
1805
- @public
1806
- */
1807
-
1773
+ }
1808
1774
 
1809
1775
  function get(obj, keyName) {
1810
1776
  assert(`Get must be called with two arguments; an object and a property key`, arguments.length === 2);
@@ -2083,7 +2049,6 @@ class AliasedProperty extends ComputedDescriptor {
2083
2049
  }
2084
2050
 
2085
2051
  function AliasedProperty_readOnlySet(obj, keyName) {
2086
- // eslint-disable-line no-unused-vars
2087
2052
  throw new EmberError(`Cannot set read-only property '${keyName}' on object: ${inspect(obj)}`);
2088
2053
  }
2089
2054
 
@@ -2399,6 +2364,7 @@ if (DEBUG) {
2399
2364
  Libraries.prototype.logVersions = function () {
2400
2365
  let libs = this._registry;
2401
2366
  let nameLengths = libs.map(item => get(item, 'name.length'));
2367
+ assert('nameLengths is number array', nameLengths instanceof Array && nameLengths.every(n => typeof n === 'number'));
2402
2368
  let maxNameLength = Math.max.apply(null, nameLengths);
2403
2369
  debug('-------------------------------');
2404
2370
 
@@ -2415,39 +2381,6 @@ if (DEBUG) {
2415
2381
  const LIBRARIES = new Libraries();
2416
2382
  LIBRARIES.registerCoreLibrary('Ember', VERSION);
2417
2383
 
2418
- /**
2419
- @module @ember/object
2420
- */
2421
-
2422
- /**
2423
- To get multiple properties at once, call `getProperties`
2424
- with an object followed by a list of strings or an array:
2425
-
2426
- ```javascript
2427
- import { getProperties } from '@ember/object';
2428
-
2429
- getProperties(record, 'firstName', 'lastName', 'zipCode');
2430
- // { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
2431
- ```
2432
-
2433
- is equivalent to:
2434
-
2435
- ```javascript
2436
- import { getProperties } from '@ember/object';
2437
-
2438
- getProperties(record, ['firstName', 'lastName', 'zipCode']);
2439
- // { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
2440
- ```
2441
-
2442
- @method getProperties
2443
- @static
2444
- @for @ember/object
2445
- @param {Object} obj
2446
- @param {String...|Array} list of keys to get
2447
- @return {Object}
2448
- @public
2449
- */
2450
-
2451
2384
  function getProperties(obj, keys) {
2452
2385
  let ret = {};
2453
2386
  let propertyNames = arguments;
@@ -3076,6 +3009,7 @@ const MIXINS = new _WeakSet();
3076
3009
  */
3077
3010
 
3078
3011
  class Mixin {
3012
+ /** @internal */
3079
3013
  constructor(mixins, properties) {
3080
3014
  MIXINS.add(this);
3081
3015
  this.properties = extractAccessors(properties);
@@ -3116,6 +3050,8 @@ class Mixin {
3116
3050
  } // returns the mixins currently applied to the specified object
3117
3051
  // TODO: Make `mixin`
3118
3052
 
3053
+ /** @internal */
3054
+
3119
3055
 
3120
3056
  static mixins(obj) {
3121
3057
  let meta$$1 = peekMeta(obj);
@@ -3137,6 +3073,7 @@ class Mixin {
3137
3073
  @method reopen
3138
3074
  @param arguments*
3139
3075
  @private
3076
+ @internal
3140
3077
  */
3141
3078
 
3142
3079
 
@@ -3161,6 +3098,7 @@ class Mixin {
3161
3098
  @param obj
3162
3099
  @return applied object
3163
3100
  @private
3101
+ @internal
3164
3102
  */
3165
3103
 
3166
3104
 
@@ -3172,6 +3110,8 @@ class Mixin {
3172
3110
  // _hideKeys disables enumerablity when applying the mixin. This is a hack, and we should stop mutating the array prototype by default 😫
3173
3111
  return applyMixin(obj, [this], _hideKeys);
3174
3112
  }
3113
+ /** @internal */
3114
+
3175
3115
 
3176
3116
  applyPartial(obj) {
3177
3117
  return applyMixin(obj, [this]);
@@ -3181,6 +3121,7 @@ class Mixin {
3181
3121
  @param obj
3182
3122
  @return {Boolean}
3183
3123
  @private
3124
+ @internal
3184
3125
  */
3185
3126
 
3186
3127
 
@@ -3201,16 +3142,22 @@ class Mixin {
3201
3142
 
3202
3143
  return meta$$1.hasMixin(this);
3203
3144
  }
3145
+ /** @internal */
3146
+
3204
3147
 
3205
3148
  without(...args) {
3206
3149
  let ret = new Mixin([this]);
3207
3150
  ret._without = args;
3208
3151
  return ret;
3209
3152
  }
3153
+ /** @internal */
3154
+
3210
3155
 
3211
3156
  keys() {
3212
3157
  return _keys(this);
3213
3158
  }
3159
+ /** @internal */
3160
+
3214
3161
 
3215
3162
  toString() {
3216
3163
  return '(unknown mixin)';
@@ -3292,11 +3239,39 @@ function _keys(mixin, ret = new Set(), seen = new Set()) {
3292
3239
 
3293
3240
  return ret;
3294
3241
  }
3242
+ /**
3243
+ Specify a method that observes property changes.
3244
+
3245
+ ```javascript
3246
+ import EmberObject from '@ember/object';
3247
+ import { observer } from '@ember/object';
3248
+
3249
+ export default EmberObject.extend({
3250
+ valueObserver: observer('value', function() {
3251
+ // Executes whenever the "value" property changes
3252
+ })
3253
+ });
3254
+ ```
3255
+
3256
+ Also available as `Function.prototype.observes` if prototype extensions are
3257
+ enabled.
3258
+
3259
+ @method observer
3260
+ @for @ember/object
3261
+ @param {String} propertyNames*
3262
+ @param {Function} func
3263
+ @return func
3264
+ @public
3265
+ @static
3266
+ */
3267
+
3295
3268
 
3296
3269
  function observer(...args) {
3297
3270
  let funcOrDef = args.pop();
3298
3271
  assert('observer must be provided a function or an observer definition', typeof funcOrDef === 'function' || typeof funcOrDef === 'object' && funcOrDef !== null);
3299
- let func, dependentKeys, sync;
3272
+ let func;
3273
+ let dependentKeys;
3274
+ let sync;
3300
3275
 
3301
3276
  if (typeof funcOrDef === 'function') {
3302
3277
  func = funcOrDef;
@@ -144,10 +144,15 @@ ControllerMixin.reopen({
144
144
  @public
145
145
  */
146
146
  transitionToRoute(...args) {
147
+ var _a;
148
+
147
149
  deprecateTransitionMethods('controller', 'transitionToRoute'); // target may be either another controller or a router
148
150
 
149
- let target = get(this, 'target');
150
- let method = target.transitionToRoute || target.transitionTo;
151
+ let target = get(this, 'target'); // SAFETY: We can't actually assert that this is a full Controller or Router since some tests
152
+ // mock out an object that only has the single method. Since this is deprecated, I think it's
153
+ // ok to be a little less than proper here.
154
+
155
+ let method = (_a = target.transitionToRoute) !== null && _a !== void 0 ? _a : target.transitionTo;
151
156
  return method.apply(target, prefixRouteNameArg(this, args));
152
157
  },
153
158
 
@@ -201,10 +206,15 @@ ControllerMixin.reopen({
201
206
  @public
202
207
  */
203
208
  replaceRoute(...args) {
209
+ var _a;
210
+
204
211
  deprecateTransitionMethods('controller', 'replaceRoute'); // target may be either another controller or a router
205
212
 
206
- let target = get(this, 'target');
207
- let method = target.replaceRoute || target.replaceWith;
213
+ let target = get(this, 'target'); // SAFETY: We can't actually assert that this is a full Controller or Router since some tests
214
+ // mock out an object that only has the single method. Since this is deprecated, I think it's
215
+ // ok to be a little less than proper here.
216
+
217
+ let method = (_a = target.replaceRoute) !== null && _a !== void 0 ? _a : target.replaceWith;
208
218
  return method.apply(target, prefixRouteNameArg(this, args));
209
219
  }
210
220
 
@@ -93,6 +93,7 @@ export default {
93
93
  url: 'https://emberjs.com/deprecations/v4.x#toc_deprecate-auto-location',
94
94
  for: 'ember-source',
95
95
  since: {
96
+ available: '4.1.0',
96
97
  enabled: '4.1.0'
97
98
  }
98
99
  });
@@ -82,7 +82,9 @@ export default class AutoLocation extends EmberObject {
82
82
  implementation = 'none';
83
83
  }
84
84
 
85
- let concrete = getOwner(this).lookup(`location:${implementation}`);
85
+ let owner = getOwner(this);
86
+ assert('AutoLocation is unexpectedly missing an owner', owner);
87
+ let concrete = owner.lookup(`location:${implementation}`);
86
88
  assert(`Could not find location '${implementation}'.`, concrete !== undefined);
87
89
  set(concrete, 'rootURL', rootURL);
88
90
  set(this, 'concreteImplementation', concrete);
@@ -56,7 +56,8 @@ export default class RouterService extends Service {
56
56
  return router;
57
57
  }
58
58
 
59
- const owner = getOwner(this);
59
+ let owner = getOwner(this);
60
+ assert('RouterService is unexpectedly missing an owner', owner);
60
61
  router = owner.lookup('router:main');
61
62
  return this[ROUTER] = router;
62
63
  }
@@ -65,46 +66,6 @@ export default class RouterService extends Service {
65
66
  super.willDestroy(...arguments);
66
67
  this[ROUTER] = null;
67
68
  }
68
- /**
69
- Transition the application into another route. The route may
70
- be either a single route or route path:
71
- See [transitionTo](/ember/release/classes/Route/methods/transitionTo?anchor=transitionTo) for more info.
72
- Calling `transitionTo` from the Router service will cause default query parameter values to be included in the URL.
73
- This behavior is different from calling `transitionTo` on a route or `transitionToRoute` on a controller.
74
- See the [Router Service RFC](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#query-parameter-semantics) for more info.
75
- In the following example we use the Router service to navigate to a route with a
76
- specific model from a Component in the first action, and in the second we trigger
77
- a query-params only transition.
78
- ```app/components/example.js
79
- import Component from '@glimmer/component';
80
- import { action } from '@ember/object';
81
- import { service } from '@ember/service';
82
- export default class extends Component {
83
- @service router;
84
- @action
85
- goToComments(post) {
86
- this.router.transitionTo('comments', post);
87
- }
88
- @action
89
- fetchMoreComments(latestComment) {
90
- this.router.transitionTo({
91
- queryParams: { commentsAfter: latestComment }
92
- });
93
- }
94
- }
95
- ```
96
- @method transitionTo
97
- @param {String} [routeNameOrUrl] the name of the route or a URL
98
- @param {...Object} [models] the model(s) or identifier(s) to be used while
99
- transitioning to the route.
100
- @param {Object} [options] optional hash with a queryParams property
101
- containing a mapping of query parameters. May be supplied as the only
102
- parameter to trigger a query-parameter-only transition.
103
- @return {Transition} the transition object associated with this
104
- attempted transition
105
- @public
106
- */
107
-
108
69
 
109
70
  transitionTo(...args) {
110
71
  if (resemblesURL(args[0])) {
@@ -157,9 +118,7 @@ export default class RouterService extends Service {
157
118
  */
158
119
 
159
120
 
160
- replaceWith()
161
- /* routeNameOrUrl, ...models, options */
162
- {
121
+ replaceWith() {
163
122
  return this.transitionTo(...arguments).method('replace');
164
123
  }
165
124
  /**
@@ -304,10 +263,7 @@ export default class RouterService extends Service {
304
263
  // does not correctly account for `undefined` values for `routeName`.
305
264
  // Spoilers: under the hood this currently uses router.js APIs which
306
265
  // *do not* account for this being `undefined`.
307
- routeName, models, // UNSAFE: downstream consumers treat this as `QueryParam`, which the
308
- // type system here *correctly* reports as incorrect, because it may be
309
- // just an empty object.
310
- queryParams, true
266
+ routeName, models, queryParams, true
311
267
  /* fromRouterService */
312
268
  );
313
269
 
@@ -398,7 +354,9 @@ if (true
398
354
 
399
355
  assert(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName));
400
356
  assert(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName));
401
- let pivotRoute = getOwner(this).lookup(`route:${pivotRouteName}`);
357
+ let owner = getOwner(this);
358
+ assert('RouterService is unexpectedly missing an owner', owner);
359
+ let pivotRoute = owner.lookup(`route:${pivotRouteName}`);
402
360
  return this._router._routerMicrolib.refresh(pivotRoute);
403
361
  }
404
362
 
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { getOwner } from '@ember/-internals/owner';
5
5
  import { symbol } from '@ember/-internals/utils';
6
+ import { assert } from '@ember/debug';
6
7
  import { readOnly } from '@ember/object/computed';
7
8
  import Service from '@ember/service';
8
9
  const ROUTER = symbol('ROUTER');
@@ -25,7 +26,8 @@ export default class RoutingService extends Service {
25
26
  return router;
26
27
  }
27
28
 
28
- const owner = getOwner(this);
29
+ let owner = getOwner(this);
30
+ assert('RoutingService is unexpectedly missing an owner', owner);
29
31
  router = owner.lookup('router:main');
30
32
  router.setupRouter();
31
33
  return this[ROUTER] = router;