ember-source 4.5.0-beta.1 → 4.6.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 (110) hide show
  1. package/blueprints-js/-addon-import.js +48 -0
  2. package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
  3. package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  4. package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
  5. package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  6. package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
  7. package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
  8. package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
  9. package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
  10. package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
  11. package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
  12. package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
  13. package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
  14. package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
  15. package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
  16. package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
  17. package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  18. package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  19. package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  20. package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  21. package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  22. package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
  23. package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
  24. package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
  25. package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
  26. package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
  27. package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
  28. package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
  29. package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
  30. package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
  31. package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
  32. package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
  33. package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
  34. package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
  35. package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
  36. package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
  37. package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
  38. package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
  39. package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
  40. package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
  41. package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
  42. package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
  43. package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
  44. package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
  45. package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
  46. package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
  47. package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
  48. package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
  49. package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
  50. package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
  51. package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
  52. package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
  53. package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  54. package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
  55. package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
  56. package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
  57. package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  58. package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  59. package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  60. package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  61. package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  62. package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
  63. package/blueprints-js/test-framework-detector.js +60 -0
  64. package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
  65. package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
  66. package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
  67. package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
  68. package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
  69. package/build-metadata.json +3 -3
  70. package/dist/ember-template-compiler.js +4 -4
  71. package/dist/ember-template-compiler.map +1 -1
  72. package/dist/ember-testing.js +112 -136
  73. package/dist/ember-testing.map +1 -1
  74. package/dist/ember.debug.js +584 -944
  75. package/dist/ember.debug.map +1 -1
  76. package/dist/header/license.js +1 -1
  77. package/dist/packages/@ember/-internals/error-handling/index.js +1 -1
  78. package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
  79. package/dist/packages/@ember/-internals/metal/index.js +16 -9
  80. package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
  81. package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -3
  82. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +281 -368
  83. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -5
  84. package/dist/packages/@ember/application/lib/application.js +4 -1
  85. package/dist/packages/@ember/canary-features/index.js +2 -2
  86. package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
  87. package/dist/packages/@ember/engine/index.js +3 -1
  88. package/dist/packages/@ember/object/index.js +16 -8
  89. package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
  90. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +74 -365
  91. package/dist/packages/@ember/test/adapter.js +2 -2
  92. package/dist/packages/ember/version.js +1 -1
  93. package/dist/packages/ember-testing/lib/adapters/adapter.js +11 -27
  94. package/dist/packages/ember-testing/lib/adapters/qunit.js +8 -16
  95. package/dist/packages/ember-testing/lib/ext/application.js +28 -19
  96. package/dist/packages/ember-testing/lib/helpers/and_then.js +4 -1
  97. package/dist/packages/ember-testing/lib/helpers/current_path.js +5 -0
  98. package/dist/packages/ember-testing/lib/helpers/current_route_name.js +5 -0
  99. package/dist/packages/ember-testing/lib/helpers/current_url.js +8 -1
  100. package/dist/packages/ember-testing/lib/helpers/visit.js +12 -2
  101. package/dist/packages/ember-testing/lib/helpers/wait.js +6 -1
  102. package/dist/packages/ember-testing/lib/initializers.js +3 -3
  103. package/dist/packages/ember-testing/lib/test/adapter.js +2 -1
  104. package/dist/packages/ember-testing/lib/test/helpers.js +3 -1
  105. package/dist/packages/ember-testing/lib/test/on_inject_helpers.js +2 -2
  106. package/dist/packages/ember-testing/lib/test/promise.js +8 -8
  107. package/dist/packages/ember-testing/lib/test/waiters.js +14 -45
  108. package/dist/packages/ember-testing/lib/test.js +1 -1
  109. package/docs/data.json +745 -729
  110. package/package.json +7 -6
@@ -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 4.5.0-beta.1
8
+ * @version 4.6.0-alpha.3
9
9
  */
@@ -13,7 +13,7 @@ export function getOnerror() {
13
13
  export function setOnerror(handler) {
14
14
  onerror = handler;
15
15
  }
16
- let dispatchOverride; // allows testing adapter to override dispatch
16
+ let dispatchOverride = null; // allows testing adapter to override dispatch
17
17
 
18
18
  export function getDispatchOverride() {
19
19
  return dispatchOverride;
@@ -2957,14 +2957,25 @@ function escapeExpression(string) {
2957
2957
  return string.replace(badChars, escapeChar);
2958
2958
  }
2959
2959
  /**
2960
- Mark a string as safe for unescaped output with Ember templates. If you
2961
- return HTML from a helper, use this function to
2962
- ensure Ember's rendering layer does not escape the HTML.
2960
+ Use this method to indicate that a string should be rendered as HTML
2961
+ when the string is used in a template. To say this another way,
2962
+ strings marked with `htmlSafe` will not be HTML escaped.
2963
+
2964
+ A word of warning - The `htmlSafe` method does not make the string safe;
2965
+ it only tells the framework to treat the string as if it is safe to render
2966
+ as HTML. If a string contains user inputs or other untrusted
2967
+ data, you must sanitize the string before using the `htmlSafe` method.
2968
+ Otherwise your code is vulnerable to
2969
+ [Cross-Site Scripting](https://owasp.org/www-community/attacks/DOM_Based_XSS).
2970
+ There are many open source sanitization libraries to choose from,
2971
+ both for front end and server-side sanitization.
2963
2972
 
2964
2973
  ```javascript
2965
2974
  import { htmlSafe } from '@ember/template';
2966
2975
 
2967
- htmlSafe('<div>someString</div>')
2976
+ const someTrustedOrSanitizedString = "<div>Hello!</div>"
2977
+
2978
+ htmlSafe(someTrustedorSanitizedString)
2968
2979
  ```
2969
2980
 
2970
2981
  @method htmlSafe
@@ -5166,10 +5177,13 @@ class DynamicScope {
5166
5177
  return value;
5167
5178
  }
5168
5179
 
5169
- } // This wrapper logic prevents us from rerendering in case of a hard failure
5180
+ }
5181
+
5182
+ const NO_OP = () => {}; // This wrapper logic prevents us from rerendering in case of a hard failure
5170
5183
  // during render. This prevents infinite revalidation type loops from occuring,
5171
5184
  // and ensures that errors are not swallowed by subsequent follow on failures.
5172
5185
 
5186
+
5173
5187
  function errorLoopTransaction(fn$$1) {
5174
5188
  if (DEBUG) {
5175
5189
  return () => {
@@ -5270,10 +5284,6 @@ function loopBegin() {
5270
5284
  }
5271
5285
  }
5272
5286
 
5273
- function K() {
5274
- /* noop */
5275
- }
5276
-
5277
5287
  let renderSettledDeferred = null;
5278
5288
  /*
5279
5289
  Returns a promise which will resolve when rendering has settled. Settled in
@@ -5292,7 +5302,7 @@ function renderSettled() {
5292
5302
 
5293
5303
  if (!_getCurrentRunLoop()) {
5294
5304
  // ensure a runloop has been kicked off
5295
- _backburner.schedule('actions', null, K);
5305
+ _backburner.schedule('actions', null, NO_OP);
5296
5306
  }
5297
5307
  }
5298
5308
 
@@ -5321,7 +5331,7 @@ function loopEnd() {
5321
5331
  }
5322
5332
 
5323
5333
  loops++;
5324
- return _backburner.join(null, K);
5334
+ return _backburner.join(null, NO_OP);
5325
5335
  }
5326
5336
  }
5327
5337
 
@@ -14,9 +14,6 @@ import VERSION from 'ember/version';
14
14
  import { INIT_FACTORY } from '@ember/-internals/container';
15
15
  import { getOwner } from '@ember/-internals/owner';
16
16
 
17
- /**
18
- @module @ember/object
19
- */
20
17
  /*
21
18
  The event system uses a series of nested hashes to store listeners on an
22
19
  object. When a listener is registered, or when an event arrives, these
@@ -628,12 +625,19 @@ function objectAt(array, index) {
628
625
  } else {
629
626
  return array.objectAt(index);
630
627
  }
628
+ } // Ideally, we'd use MutableArray.detect but for unknown reasons this causes
629
+ // the node tests to fail strangely.
630
+
631
+ function isMutableArray(obj) {
632
+ return obj != null && typeof obj.replace === 'function';
631
633
  }
634
+
632
635
  function replace(array, start, deleteCount, items = EMPTY_ARRAY) {
633
- if (Array.isArray(array)) {
634
- replaceInNativeArray(array, start, deleteCount, items);
635
- } else {
636
+ if (isMutableArray(array)) {
636
637
  array.replace(start, deleteCount, items);
638
+ } else {
639
+ assert('Can only replace content of a native array or MutableArray', Array.isArray(array));
640
+ replaceInNativeArray(array, start, deleteCount, items);
637
641
  }
638
642
  }
639
643
  const CHUNK_SIZE = 60000; // To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.
@@ -3149,7 +3153,10 @@ class Mixin {
3149
3153
 
3150
3154
 
3151
3155
  keys() {
3152
- return _keys(this);
3156
+ let keys = _keys(this);
3157
+
3158
+ assert('[BUG] Missing keys for mixin!', keys);
3159
+ return keys;
3153
3160
  }
3154
3161
  /** @internal */
3155
3162
 
@@ -3225,8 +3232,8 @@ function _keys(mixin, ret = new Set(), seen = new Set()) {
3225
3232
  if (mixin.properties) {
3226
3233
  let props = Object.keys(mixin.properties);
3227
3234
 
3228
- for (let i = 0; i < props.length; i++) {
3229
- ret.add(props[i]);
3235
+ for (let prop of props) {
3236
+ ret.add(prop);
3230
3237
  }
3231
3238
  } else if (mixin.mixins) {
3232
3239
  mixin.mixins.forEach(x => _keys(x, ret, seen));
@@ -12,10 +12,6 @@ import { calculateCacheKey, extractRouteArgs, getActiveTargetName, resemblesURL
12
12
  import DSL from './dsl';
13
13
  import { defaultSerialize, getFullQueryParams, hasDefaultSerialize, ROUTE_CONNECTIONS } from './route';
14
14
  import RouterState from './router_state';
15
- /**
16
- @module @ember/routing
17
- */
18
-
19
15
  import Router, { logAbort, STATE_SYMBOL } from 'router_js';
20
16
  import EngineInstance from '@ember/engine/instance';
21
17
 
@@ -35,9 +35,10 @@ const TYPE_ORDER = {
35
35
  // SSt `------'`
36
36
 
37
37
  function spaceship(a, b) {
38
- let diff = a - b; // SAFETY: Number casts true into 1 and false into 0. Therefore, this must end up as one of the Compare values.
39
-
40
- return Number(diff > 0) - Number(diff < 0);
38
+ // SAFETY: `Math.sign` always returns `-1` for negative, `0` for zero, and `1`
39
+ // for positive numbers. (The extra precision is useful for the way we use
40
+ // this in the context of `compare`.)
41
+ return Math.sign(a - b);
41
42
  }
42
43
  /**
43
44
  @module @ember/utils