ember-source 4.3.0-alpha.3 → 4.4.0-alpha.2

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 (91) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/blueprints/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +4 -4
  3. package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
  4. package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +2 -2
  5. package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
  6. package/blueprints/component/index.js +2 -2
  7. package/blueprints/component-class/index.js +2 -2
  8. package/blueprints/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +4 -4
  9. package/blueprints/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +7 -5
  10. package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
  11. package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +4 -4
  12. package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
  13. package/blueprints/controller/files/__root__/__path__/__name__.js +1 -2
  14. package/blueprints/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  15. package/blueprints/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  16. package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  17. package/blueprints/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  18. package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  19. package/blueprints/helper/files/__root__/__collection__/__name__.js +1 -1
  20. package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +1 -1
  21. package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
  22. package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +6 -4
  23. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
  24. package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
  25. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
  26. package/blueprints/initializer/files/__root__/initializers/__name__.js +2 -3
  27. package/blueprints/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +6 -7
  28. package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  29. package/blueprints/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +3 -4
  30. package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +2 -3
  31. package/blueprints/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  32. package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  33. package/blueprints/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +2 -2
  34. package/blueprints/mixin/files/__root__/mixins/__name__.js +1 -2
  35. package/blueprints/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
  36. package/blueprints/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
  37. package/blueprints/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
  38. package/blueprints/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +1 -1
  39. package/blueprints/route/files/__root__/__path__/__name__.js +2 -2
  40. package/blueprints/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  41. package/blueprints/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  42. package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  43. package/blueprints/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  44. package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  45. package/blueprints/service/files/__root__/__path__/__name__.js +1 -2
  46. package/blueprints/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  47. package/blueprints/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  48. package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  49. package/blueprints/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  50. package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  51. package/blueprints/util-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
  52. package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
  53. package/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
  54. package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +2 -3
  55. package/build-metadata.json +3 -3
  56. package/dist/dependencies/router_js.js +67 -32
  57. package/dist/ember-template-compiler.js +1168 -908
  58. package/dist/ember-template-compiler.map +1 -1
  59. package/dist/ember-testing.js +76 -43
  60. package/dist/ember-testing.map +1 -1
  61. package/dist/ember.debug.js +3206 -2734
  62. package/dist/ember.debug.map +1 -1
  63. package/dist/header/license.js +1 -1
  64. package/dist/packages/@ember/-internals/container/index.js +18 -13
  65. package/dist/packages/@ember/-internals/glimmer/index.js +128 -67
  66. package/dist/packages/@ember/-internals/meta/lib/meta.js +8 -9
  67. package/dist/packages/@ember/-internals/metal/index.js +58 -61
  68. package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +10 -8
  69. package/dist/packages/@ember/-internals/routing/lib/services/router.js +155 -191
  70. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -0
  71. package/dist/packages/@ember/-internals/routing/lib/system/generate_controller.js +3 -1
  72. package/dist/packages/@ember/-internals/routing/lib/system/route-info.js +2 -2
  73. package/dist/packages/@ember/-internals/routing/lib/system/route.js +108 -380
  74. package/dist/packages/@ember/-internals/routing/lib/system/router.js +65 -46
  75. package/dist/packages/@ember/-internals/routing/lib/utils.js +33 -21
  76. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -32
  77. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
  78. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +51 -50
  79. package/dist/packages/@ember/-internals/utils/index.js +3 -1
  80. package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -0
  81. package/dist/packages/@ember/application/instance.js +3 -3
  82. package/dist/packages/@ember/canary-features/index.js +0 -10
  83. package/dist/packages/@ember/controller/index.js +3 -54
  84. package/dist/packages/@ember/debug/lib/capture-render-tree.js +2 -0
  85. package/dist/packages/@ember/instrumentation/index.js +9 -13
  86. package/dist/packages/@ember/routing/router-service.js +1 -0
  87. package/dist/packages/@ember/service/index.js +6 -73
  88. package/dist/packages/ember/index.js +3 -14
  89. package/dist/packages/ember/version.js +1 -1
  90. package/docs/data.json +556 -504
  91. package/package.json +13 -13
@@ -1,3 +1,11 @@
1
+ var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
2
+ var c = arguments.length,
3
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
4
+ d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+
1
9
  import { getOwner } from '@ember/-internals/owner';
2
10
  import { Evented } from '@ember/-internals/runtime';
3
11
  import { symbol } from '@ember/-internals/utils';
@@ -5,6 +13,7 @@ import { assert } from '@ember/debug';
5
13
  import { readOnly } from '@ember/object/computed';
6
14
  import Service from '@ember/service';
7
15
  import { consumeTag, tagFor } from '@glimmer/validator';
16
+ import EmberRouter from '../system/router';
8
17
  import { extractRouteArgs, resemblesURL, shallowEqual } from '../utils';
9
18
  const ROUTER = symbol('ROUTER');
10
19
 
@@ -15,40 +24,106 @@ function cleanURL(url, rootURL) {
15
24
 
16
25
  return url.substr(rootURL.length, url.length);
17
26
  }
18
- /**
19
- The Router service is the public API that provides access to the router.
20
-
21
- The immediate benefit of the Router service is that you can inject it into components,
22
- giving them a friendly way to initiate transitions and ask questions about the current
23
- global router state.
24
-
25
- In this example, the Router service is injected into a component to initiate a transition
26
- to a dedicated route:
27
-
28
- ```app/components/example.js
29
- import Component from '@glimmer/component';
30
- import { action } from '@ember/object';
31
- import { service } from '@ember/service';
32
27
 
33
- export default class ExampleComponent extends Component {
34
- @service router;
28
+ class RouterService extends Service.extend(Evented) {
29
+ constructor() {
30
+ super(...arguments);
31
+ /**
32
+ The `routeWillChange` event is fired at the beginning of any
33
+ attempted transition with a `Transition` object as the sole
34
+ argument. This action can be used for aborting, redirecting,
35
+ or decorating the transition from the currently active routes.
36
+ A good example is preventing navigation when a form is
37
+ half-filled out:
38
+ ```app/routes/contact-form.js
39
+ import Route from '@ember/routing';
40
+ import { service } from '@ember/service';
41
+ export default class extends Route {
42
+ @service router;
43
+ constructor() {
44
+ super(...arguments);
45
+ this.router.on('routeWillChange', (transition) => {
46
+ if (!transition.to.find(route => route.name === this.routeName)) {
47
+ alert("Please save or cancel your changes.");
48
+ transition.abort();
49
+ }
50
+ })
51
+ }
52
+ }
53
+ ```
54
+ The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.
55
+ @event routeWillChange
56
+ @param {Transition} transition
57
+ @public
58
+ */
35
59
 
36
- @action
37
- next() {
38
- this.router.transitionTo('other.route');
39
- }
40
- }
41
- ```
60
+ /**
61
+ The `routeDidChange` event only fires once a transition has settled.
62
+ This includes aborts and error substates. Like the `routeWillChange` event
63
+ it receives a Transition as the sole argument.
64
+ A good example is sending some analytics when the route has transitioned:
65
+ ```app/routes/contact-form.js
66
+ import Route from '@ember/routing';
67
+ import { service } from '@ember/service';
68
+ export default class extends Route {
69
+ @service router;
70
+ constructor() {
71
+ super(...arguments);
72
+ this.router.on('routeDidChange', (transition) => {
73
+ ga.send('pageView', {
74
+ current: transition.to.name,
75
+ from: transition.from.name
76
+ });
77
+ })
78
+ }
79
+ }
80
+ ```
81
+ `routeDidChange` will be called after any `Route`'s
82
+ [didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)
83
+ action has been fired.
84
+ The updates of properties
85
+ [currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),
86
+ [currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)
87
+ and
88
+ [currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)
89
+ are completed at the time `routeDidChange` is called.
90
+ @event routeDidChange
91
+ @param {Transition} transition
92
+ @public
93
+ */
94
+ // Canary features
42
95
 
43
- Like any service, it can also be injected into helpers, routes, etc.
96
+ /**
97
+ * Refreshes all currently active routes, doing a full transition.
98
+ * If a route name is provided and refers to a currently active route,
99
+ * it will refresh only that route and its descendents.
100
+ * Returns a promise that will be resolved once the refresh is complete.
101
+ * All resetController, beforeModel, model, afterModel, redirect, and setupController
102
+ * hooks will be called again. You will get new data from the model hook.
103
+ *
104
+ * @method refresh
105
+ * @param {String} [routeName] the route to refresh (along with all child routes)
106
+ * @return Transition
107
+ * @category EMBER_ROUTING_ROUTER_SERVICE_REFRESH
108
+ * @public
109
+ */
44
110
 
45
- @public
46
- @extends Service
47
- @class RouterService
48
- */
111
+ this.refresh = true
112
+ /* EMBER_ROUTING_ROUTER_SERVICE_REFRESH */
113
+ ? function (pivotRouteName) {
114
+ if (!pivotRouteName) {
115
+ return this._router._routerMicrolib.refresh();
116
+ }
49
117
 
118
+ assert(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName));
119
+ assert(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName));
120
+ let owner = getOwner(this);
121
+ assert('RouterService is unexpectedly missing an owner', owner);
122
+ let pivotRoute = owner.lookup(`route:${pivotRouteName}`);
123
+ return this._router._routerMicrolib.refresh(pivotRoute);
124
+ } : undefined;
125
+ }
50
126
 
51
- export default class RouterService extends Service {
52
127
  get _router() {
53
128
  let router = this[ROUTER];
54
129
 
@@ -59,13 +134,53 @@ export default class RouterService extends Service {
59
134
  let owner = getOwner(this);
60
135
  assert('RouterService is unexpectedly missing an owner', owner);
61
136
  router = owner.lookup('router:main');
137
+ assert('ROUTER SERVICE BUG: Expected router to be an instance of EmberRouter', router instanceof EmberRouter);
62
138
  return this[ROUTER] = router;
63
139
  }
64
140
 
65
141
  willDestroy() {
66
- super.willDestroy(...arguments);
142
+ super.willDestroy();
67
143
  this[ROUTER] = null;
68
144
  }
145
+ /**
146
+ Transition the application into another route. The route may
147
+ be either a single route or route path:
148
+ Calling `transitionTo` from the Router service will cause default query parameter values to be included in the URL.
149
+ This behavior is different from calling `transitionTo` on a route or `transitionToRoute` on a controller.
150
+ See the [Router Service RFC](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#query-parameter-semantics) for more info.
151
+ In the following example we use the Router service to navigate to a route with a
152
+ specific model from a Component in the first action, and in the second we trigger
153
+ a query-params only transition.
154
+ ```app/components/example.js
155
+ import Component from '@glimmer/component';
156
+ import { action } from '@ember/object';
157
+ import { service } from '@ember/service';
158
+ export default class extends Component {
159
+ @service router;
160
+ @action
161
+ goToComments(post) {
162
+ this.router.transitionTo('comments', post);
163
+ }
164
+ @action
165
+ fetchMoreComments(latestComment) {
166
+ this.router.transitionTo({
167
+ queryParams: { commentsAfter: latestComment }
168
+ });
169
+ }
170
+ }
171
+ ```
172
+ @method transitionTo
173
+ @param {String} [routeNameOrUrl] the name of the route or a URL
174
+ @param {...Object} [models] the model(s) or identifier(s) to be used while
175
+ transitioning to the route.
176
+ @param {Object} [options] optional hash with a queryParams property
177
+ containing a mapping of query parameters. May be supplied as the only
178
+ parameter to trigger a query-parameter-only transition.
179
+ @return {Transition} the transition object associated with this
180
+ attempted transition
181
+ @public
182
+ */
183
+
69
184
 
70
185
  transitionTo(...args) {
71
186
  if (resemblesURL(args[0])) {
@@ -91,7 +206,6 @@ export default class RouterService extends Service {
91
206
  When the user clicks the "back" button in the browser, there will be fewer steps.
92
207
  This is most commonly used to manage redirects in a way that does not cause confusing additions
93
208
  to the user's browsing history.
94
- See [replaceWith](/ember/release/classes/Route/methods/replaceWith?anchor=replaceWith) for more info.
95
209
  Calling `replaceWith` from the Router service will cause default query parameter values to be included in the URL.
96
210
  This behavior is different from calling `replaceWith` on a route.
97
211
  See the [Router Service RFC](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#query-parameter-semantics) for more info.
@@ -118,8 +232,8 @@ export default class RouterService extends Service {
118
232
  */
119
233
 
120
234
 
121
- replaceWith() {
122
- return this.transitionTo(...arguments).method('replace');
235
+ replaceWith(...args) {
236
+ return this.transitionTo(...args).method('replace');
123
237
  }
124
238
  /**
125
239
  Generate a URL based on the supplied route name and optionally a model. The
@@ -172,8 +286,7 @@ export default class RouterService extends Service {
172
286
  ```
173
287
  @method urlFor
174
288
  @param {String} routeName the name of the route
175
- @param {...Object} models the model(s) or identifier(s) to be used while
176
- transitioning to the route.
289
+ @param {...Object} models the model(s) for the route.
177
290
  @param {Object} [options] optional hash with a queryParams property
178
291
  containing a mapping of query parameters
179
292
  @return {String} the string representing the generated URL
@@ -294,6 +407,7 @@ export default class RouterService extends Service {
294
407
  ```
295
408
  @method recognize
296
409
  @param {String} url
410
+ @return {RouteInfo | null}
297
411
  @public
298
412
  */
299
413
 
@@ -314,6 +428,7 @@ export default class RouterService extends Service {
314
428
  the browser including the app's `rootURL`.
315
429
  @method recognizeAndLoad
316
430
  @param {String} url
431
+ @return {RouteInfo}
317
432
  @public
318
433
  */
319
434
 
@@ -329,165 +444,14 @@ export default class RouterService extends Service {
329
444
 
330
445
  }
331
446
 
332
- if (true
333
- /* EMBER_ROUTING_ROUTER_SERVICE_REFRESH */
334
- ) {
335
- RouterService.reopen({
336
- /**
337
- * Refreshes all currently active routes, doing a full transition.
338
- * If a route name is provided and refers to a currently active route,
339
- * it will refresh only that route and its descendents.
340
- * Returns a promise that will be resolved once the refresh is complete.
341
- * All resetController, beforeModel, model, afterModel, redirect, and setupController
342
- * hooks will be called again. You will get new data from the model hook.
343
- *
344
- * @method refresh
345
- * @param {String} [routeName] the route to refresh (along with all child routes)
346
- * @return Transition
347
- * @category EMBER_ROUTING_ROUTER_SERVICE_REFRESH
348
- * @public
349
- */
350
- refresh(pivotRouteName) {
351
- if (!pivotRouteName) {
352
- return this._router._routerMicrolib.refresh();
353
- }
354
-
355
- assert(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName));
356
- assert(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName));
357
- let owner = getOwner(this);
358
- assert('RouterService is unexpectedly missing an owner', owner);
359
- let pivotRoute = owner.lookup(`route:${pivotRouteName}`);
360
- return this._router._routerMicrolib.refresh(pivotRoute);
361
- }
362
-
363
- });
364
- }
447
+ __decorate([readOnly('_router.currentRouteName')], RouterService.prototype, "currentRouteName", void 0);
365
448
 
366
- RouterService.reopen(Evented, {
367
- /**
368
- Name of the current route.
369
- This property represents the logical name of the route,
370
- which is comma separated.
371
- For the following router:
372
- ```app/router.js
373
- Router.map(function() {
374
- this.route('about');
375
- this.route('blog', function () {
376
- this.route('post', { path: ':post_id' });
377
- });
378
- });
379
- ```
380
- It will return:
381
- * `index` when you visit `/`
382
- * `about` when you visit `/about`
383
- * `blog.index` when you visit `/blog`
384
- * `blog.post` when you visit `/blog/some-post-id`
385
- @property currentRouteName
386
- @type String
387
- @public
388
- */
389
- currentRouteName: readOnly('_router.currentRouteName'),
449
+ __decorate([readOnly('_router.currentURL')], RouterService.prototype, "currentURL", void 0);
390
450
 
391
- /**
392
- Current URL for the application.
393
- This property represents the URL path for this route.
394
- For the following router:
395
- ```app/router.js
396
- Router.map(function() {
397
- this.route('about');
398
- this.route('blog', function () {
399
- this.route('post', { path: ':post_id' });
400
- });
401
- });
402
- ```
403
- It will return:
404
- * `/` when you visit `/`
405
- * `/about` when you visit `/about`
406
- * `/blog` when you visit `/blog`
407
- * `/blog/some-post-id` when you visit `/blog/some-post-id`
408
- @property currentURL
409
- @type String
410
- @public
411
- */
412
- currentURL: readOnly('_router.currentURL'),
451
+ __decorate([readOnly('_router.location')], RouterService.prototype, "location", void 0);
413
452
 
414
- /**
415
- The `location` property returns what implementation of the `location` API
416
- your application is using, which determines what type of URL is being used.
417
- See [Location](/ember/release/classes/Location) for more information.
418
- To force a particular `location` API implementation to be used in your
419
- application you can set a location type on your `config/environment`.
420
- For example, to set the `history` type:
421
- ```config/environment.js
422
- 'use strict';
423
- module.exports = function(environment) {
424
- let ENV = {
425
- modulePrefix: 'router-service',
426
- environment,
427
- rootURL: '/',
428
- locationType: 'history',
429
- ...
430
- }
431
- }
432
- ```
433
- The following location types are available by default:
434
- `auto`, `hash`, `history`, `none`.
435
- See [HashLocation](/ember/release/classes/HashLocation).
436
- See [HistoryLocation](/ember/release/classes/HistoryLocation).
437
- See [NoneLocation](/ember/release/classes/NoneLocation).
438
- See [AutoLocation](/ember/release/classes/AutoLocation).
439
- @property location
440
- @default 'hash'
441
- @see {Location}
442
- @public
443
- */
444
- location: readOnly('_router.location'),
453
+ __decorate([readOnly('_router.rootURL')], RouterService.prototype, "rootURL", void 0);
445
454
 
446
- /**
447
- The `rootURL` property represents the URL of the root of
448
- the application, '/' by default.
449
- This prefix is assumed on all routes defined on this app.
450
- If you change the `rootURL` in your environment configuration
451
- like so:
452
- ```config/environment.js
453
- 'use strict';
454
- module.exports = function(environment) {
455
- let ENV = {
456
- modulePrefix: 'router-service',
457
- environment,
458
- rootURL: '/my-root',
459
-
460
- }
461
- ]
462
- ```
463
- This property will return `/my-root`.
464
- @property rootURL
465
- @default '/'
466
- @public
467
- */
468
- rootURL: readOnly('_router.rootURL'),
455
+ __decorate([readOnly('_router.currentRoute')], RouterService.prototype, "currentRoute", void 0);
469
456
 
470
- /**
471
- The `currentRoute` property contains metadata about the current leaf route.
472
- It returns a `RouteInfo` object that has information like the route name,
473
- params, query params and more.
474
- See [RouteInfo](/ember/release/classes/RouteInfo) for more info.
475
- This property is guaranteed to change whenever a route transition
476
- happens (even when that transition only changes parameters
477
- and doesn't change the active route).
478
- Usage example:
479
- ```app/components/header.js
480
- import Component from '@glimmer/component';
481
- import { service } from '@ember/service';
482
- import { notEmpty } from '@ember/object/computed';
483
- export default class extends Component {
484
- @service router;
485
- @notEmpty('router.currentRoute.child') isChildRoute;
486
- });
487
- ```
488
- @property currentRoute
489
- @type RouteInfo
490
- @public
491
- */
492
- currentRoute: readOnly('_router.currentRoute')
493
- });
457
+ export { RouterService as default };
@@ -6,6 +6,7 @@ import { symbol } from '@ember/-internals/utils';
6
6
  import { assert } from '@ember/debug';
7
7
  import { readOnly } from '@ember/object/computed';
8
8
  import Service from '@ember/service';
9
+ import EmberRouter from '../system/router';
9
10
  const ROUTER = symbol('ROUTER');
10
11
  /**
11
12
  The Routing service is used by LinkTo, and provides facilities for
@@ -29,6 +30,7 @@ export default class RoutingService extends Service {
29
30
  let owner = getOwner(this);
30
31
  assert('RoutingService is unexpectedly missing an owner', owner);
31
32
  router = owner.lookup('router:main');
33
+ assert('ROUTING SERVICE BUG: Expected router to be an instance of EmberRouter', router instanceof EmberRouter);
32
34
  router.setupRouter();
33
35
  return this[ROUTER] = router;
34
36
  }
@@ -1,5 +1,6 @@
1
1
  import { get } from '@ember/-internals/metal';
2
- import { info } from '@ember/debug';
2
+ import Controller from '@ember/controller';
3
+ import { assert, info } from '@ember/debug';
3
4
  import { DEBUG } from '@glimmer/env';
4
5
  /**
5
6
  @module ember
@@ -39,6 +40,7 @@ export default function generateController(owner, controllerName) {
39
40
  generateControllerFactory(owner, controllerName);
40
41
  let fullName = `controller:${controllerName}`;
41
42
  let instance = owner.lookup(fullName);
43
+ assert('Expected an instance of controller', instance instanceof Controller);
42
44
 
43
45
  if (DEBUG) {
44
46
  if (get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ export {};
2
2
  /**
3
3
  A `RouteInfoWithAttributes` is an object that contains
4
4
  metadata, including the resolved value from the routes
@@ -55,7 +55,7 @@
55
55
  /**
56
56
  This is the resolved return value from the
57
57
  route's model hook.
58
- @property {Object|Array|String} attributes
58
+ @property {Object|Array|String|undefined} attributes
59
59
  @public
60
60
  */
61
61