ember-source 4.5.0-alpha.5 → 4.6.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 (87) hide show
  1. package/CHANGELOG.md +8 -3
  2. package/blueprints-js/-addon-import.js +48 -0
  3. package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
  4. package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  5. package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
  6. package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  7. package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
  8. package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
  9. package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
  10. package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
  11. package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
  12. package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
  13. package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
  14. package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
  15. package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
  16. package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
  17. package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
  18. package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  19. package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  20. package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  21. package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  22. package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  23. package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
  24. package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
  25. package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
  26. package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
  27. package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
  28. package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
  29. package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
  30. package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
  31. package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
  32. package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
  33. package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
  34. package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
  35. package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
  36. package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
  37. package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
  38. package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
  39. package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
  40. package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
  41. package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
  42. package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
  43. package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
  44. package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
  45. package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
  46. package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
  47. package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
  48. package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
  49. package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
  50. package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
  51. package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
  52. package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
  53. package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
  54. package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  55. package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
  56. package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
  57. package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
  58. package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  59. package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  60. package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  61. package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  62. package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  63. package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
  64. package/blueprints-js/test-framework-detector.js +60 -0
  65. package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
  66. package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
  67. package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
  68. package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
  69. package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
  70. package/build-metadata.json +3 -3
  71. package/dist/ember-template-compiler.js +2 -2
  72. package/dist/ember-template-compiler.map +1 -1
  73. package/dist/ember-testing.js +3 -8
  74. package/dist/ember-testing.map +1 -1
  75. package/dist/ember.debug.js +119 -419
  76. package/dist/ember.debug.map +1 -1
  77. package/dist/header/license.js +1 -1
  78. package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
  79. package/dist/packages/@ember/-internals/metal/index.js +0 -3
  80. package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
  81. package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
  82. package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
  83. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +73 -364
  84. package/dist/packages/ember/version.js +1 -1
  85. package/dist/packages/ember-testing/lib/adapters/adapter.js +2 -7
  86. package/docs/data.json +534 -528
  87. package/package.json +5 -4
@@ -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-alpha.5
8
+ * @version 4.6.0-alpha.2
9
9
  */
@@ -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
@@ -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
 
@@ -2,31 +2,20 @@ import { Mixin, computed } from '@ember/-internals/metal';
2
2
  import { ActionHandler } from '@ember/-internals/runtime';
3
3
  import { symbol } from '@ember/-internals/utils';
4
4
  const MODEL = symbol('MODEL');
5
- /**
6
- @module ember
7
- */
8
-
9
- /**
10
- @class ControllerMixin
11
- @namespace Ember
12
- @uses Ember.ActionHandler
13
- @private
14
- */
15
-
16
- export default Mixin.create(ActionHandler, {
5
+ const ControllerMixin = Mixin.create(ActionHandler, {
17
6
  /* ducktype as a controller */
18
7
  isController: true,
19
8
 
20
9
  /**
21
10
  The object to which actions from the view should be sent.
22
- For example, when a Handlebars template uses the `{{action}}` helper,
11
+ For example, when a Handlebars template uses the `{{action}}` helper,
23
12
  it will attempt to send the action to the view's controller's `target`.
24
- By default, the value of the target property is set to the router, and
13
+ By default, the value of the target property is set to the router, and
25
14
  is injected when a controller is instantiated. This injection is applied
26
15
  as part of the application's initialization process. In most cases the
27
16
  `target` property will automatically be set to the logical consumer of
28
17
  actions for the controller.
29
- @property target
18
+ @property target
30
19
  @default null
31
20
  @public
32
21
  */
@@ -36,7 +25,7 @@ export default Mixin.create(ActionHandler, {
36
25
  /**
37
26
  The controller's current model. When retrieving or modifying a controller's
38
27
  model, this property should be used instead of the `content` property.
39
- @property model
28
+ @property model
40
29
  @public
41
30
  */
42
31
  model: computed({
@@ -44,9 +33,10 @@ export default Mixin.create(ActionHandler, {
44
33
  return this[MODEL];
45
34
  },
46
35
 
47
- set(key, value) {
36
+ set(_key, value) {
48
37
  return this[MODEL] = value;
49
38
  }
50
39
 
51
40
  })
52
- });
41
+ });
42
+ export default ControllerMixin;
@@ -11,8 +11,7 @@ function expandPropertiesToArray(predicateName, properties) {
11
11
  expandedProperties.push(entry);
12
12
  }
13
13
 
14
- for (let i = 0; i < properties.length; i++) {
15
- let property = properties[i];
14
+ for (let property of properties) {
16
15
  assert(`Dependent keys passed to \`${predicateName}\` computed macro can't have spaces.`, property.indexOf(' ') < 0);
17
16
  expandProperties(property, extractProperty);
18
17
  }
@@ -21,19 +20,22 @@ function expandPropertiesToArray(predicateName, properties) {
21
20
  }
22
21
 
23
22
  function generateComputedWithPredicate(name, predicate) {
24
- return (...properties) => {
23
+ return (dependentKey, ...additionalDependentKeys) => {
24
+ let properties = [dependentKey, ...additionalDependentKeys];
25
25
  assert(`You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`, !isElementDescriptor(properties));
26
26
  let dependentKeys = expandPropertiesToArray(name, properties);
27
27
  let computedFunc = computed(...dependentKeys, function () {
28
28
  let lastIdx = dependentKeys.length - 1;
29
29
 
30
30
  for (let i = 0; i < lastIdx; i++) {
31
+ // SAFETY: `i` is derived from the length of `dependentKeys`
31
32
  let value = get(this, dependentKeys[i]);
32
33
 
33
34
  if (!predicate(value)) {
34
35
  return value;
35
36
  }
36
- }
37
+ } // SAFETY: `lastIdx` is derived from the length of `dependentKeys`
38
+
37
39
 
38
40
  return get(this, dependentKeys[lastIdx]);
39
41
  });