ember-source 5.11.0-beta.2 → 5.11.1

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 (147) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +48 -42
  3. package/dist/ember-testing.js +1 -1
  4. package/dist/ember.debug.js +23102 -23100
  5. package/dist/ember.prod.js +31562 -31563
  6. package/dist/packages/@ember/-internals/container/index.js +1 -1
  7. package/dist/packages/@ember/-internals/deprecations/index.js +2 -1
  8. package/dist/packages/@ember/-internals/glimmer/index.js +2 -1
  9. package/dist/packages/@ember/-internals/meta/lib/meta.js +4 -3
  10. package/dist/packages/@ember/-internals/metal/index.js +9 -8
  11. package/dist/packages/@ember/-internals/routing/index.js +6 -5
  12. package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +3 -2
  13. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +6 -5
  14. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -3
  15. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +1 -1
  16. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +2 -1
  17. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +4 -3
  18. package/dist/packages/@ember/-internals/string/index.js +1 -1
  19. package/dist/packages/@ember/-internals/utils/index.js +4 -4
  20. package/dist/packages/@ember/-internals/views/index.js +1 -1
  21. package/dist/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +1 -1
  22. package/dist/packages/@ember/-internals/views/lib/component_lookup.js +1 -1
  23. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +5 -3
  24. package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +3 -3
  25. package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +4 -3
  26. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -3
  27. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +6 -12
  28. package/dist/packages/@ember/-internals/views/lib/system/utils.js +3 -2
  29. package/dist/packages/@ember/-internals/views/lib/views/core_view.js +76 -8
  30. package/dist/packages/@ember/-internals/views/lib/views/states.js +4 -3
  31. package/dist/packages/@ember/application/index.js +16 -7
  32. package/dist/packages/@ember/application/instance.js +13 -9
  33. package/dist/packages/@ember/application/namespace.js +7 -6
  34. package/dist/packages/@ember/array/index.js +617 -11
  35. package/dist/packages/@ember/array/make.js +1 -0
  36. package/dist/packages/@ember/array/mutable.js +1 -1
  37. package/dist/packages/@ember/array/proxy.js +8 -5
  38. package/dist/packages/@ember/component/helper.js +4 -4
  39. package/dist/packages/@ember/component/index.js +4 -4
  40. package/dist/packages/@ember/controller/index.js +6 -6
  41. package/dist/packages/@ember/debug/container-debug-adapter.js +5 -4
  42. package/dist/packages/@ember/debug/data-adapter.js +7 -4
  43. package/dist/packages/@ember/debug/index.js +213 -4
  44. package/dist/packages/@ember/debug/lib/assert.js +47 -0
  45. package/dist/packages/@ember/debug/lib/deprecate.js +194 -4
  46. package/dist/packages/@ember/debug/lib/inspect.js +120 -2
  47. package/dist/packages/@ember/debug/lib/warn.js +94 -3
  48. package/dist/packages/@ember/engine/index.js +440 -17
  49. package/dist/packages/@ember/engine/instance.js +175 -11
  50. package/dist/packages/@ember/engine/parent.js +1 -0
  51. package/dist/packages/@ember/helper/index.js +4 -4
  52. package/dist/packages/@ember/instrumentation/index.js +2 -1
  53. package/dist/packages/@ember/modifier/index.js +13 -5
  54. package/dist/packages/@ember/modifier/on.js +15 -0
  55. package/dist/packages/@ember/object/-internals.js +6 -5
  56. package/dist/packages/@ember/object/compat.js +4 -3
  57. package/dist/packages/@ember/object/computed.js +4 -4
  58. package/dist/packages/@ember/object/core.js +861 -14
  59. package/dist/packages/@ember/object/evented.js +4 -4
  60. package/dist/packages/@ember/object/events.js +3 -3
  61. package/dist/packages/@ember/object/index.js +260 -9
  62. package/dist/packages/@ember/object/internals.js +1 -1
  63. package/dist/packages/@ember/object/lib/computed/computed_macros.js +8 -6
  64. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +8 -4
  65. package/dist/packages/@ember/object/mixin.js +6 -5
  66. package/dist/packages/@ember/object/observable.js +103 -9
  67. package/dist/packages/@ember/object/observers.js +3 -3
  68. package/dist/packages/@ember/object/promise-proxy-mixin.js +5 -5
  69. package/dist/packages/@ember/renderer/index.js +4 -4
  70. package/dist/packages/@ember/routing/-internals.js +3 -1
  71. package/dist/packages/@ember/routing/hash-location.js +2 -2
  72. package/dist/packages/@ember/routing/history-location.js +3 -2
  73. package/dist/packages/@ember/routing/index.js +4 -4
  74. package/dist/packages/@ember/routing/lib/dsl.js +2 -1
  75. package/dist/packages/@ember/routing/lib/generate_controller.js +4 -3
  76. package/dist/packages/@ember/routing/lib/router_state.js +26 -1
  77. package/dist/packages/@ember/routing/lib/routing-service.js +107 -9
  78. package/dist/packages/@ember/routing/lib/utils.js +238 -7
  79. package/dist/packages/@ember/routing/none-location.js +3 -2
  80. package/dist/packages/@ember/routing/route.js +1618 -22
  81. package/dist/packages/@ember/routing/router-service.js +638 -12
  82. package/dist/packages/@ember/routing/router.js +1449 -14
  83. package/dist/packages/@ember/runloop/index.js +760 -6
  84. package/dist/packages/@ember/service/index.js +3 -3
  85. package/dist/packages/@ember/template/index.js +4 -4
  86. package/dist/packages/@ember/utils/index.js +2 -1
  87. package/dist/packages/@ember/utils/lib/compare.js +159 -4
  88. package/dist/packages/@ember/utils/lib/is_empty.js +4 -4
  89. package/dist/packages/@ember/utils/lib/type-of.js +110 -1
  90. package/dist/packages/@glimmer/tracking/index.js +3 -3
  91. package/dist/packages/@glimmer/tracking/primitives/cache.js +3 -3
  92. package/dist/packages/ember/barrel.js +28 -13
  93. package/dist/packages/ember/version.js +1 -1
  94. package/dist/packages/ember-testing/lib/adapters/adapter.js +1 -1
  95. package/dist/packages/ember-testing/lib/adapters/qunit.js +2 -1
  96. package/dist/packages/ember-testing/lib/ext/application.js +2 -1
  97. package/dist/packages/ember-testing/lib/ext/rsvp.js +1 -1
  98. package/dist/packages/ember-testing/lib/helpers/and_then.js +2 -1
  99. package/dist/packages/ember-testing/lib/helpers/current_path.js +8 -6
  100. package/dist/packages/ember-testing/lib/helpers/current_route_name.js +8 -6
  101. package/dist/packages/ember-testing/lib/helpers/current_url.js +6 -5
  102. package/dist/packages/ember-testing/lib/helpers/pause_test.js +2 -1
  103. package/dist/packages/ember-testing/lib/helpers/visit.js +4 -3
  104. package/dist/packages/ember-testing/lib/helpers/wait.js +4 -3
  105. package/dist/packages/ember-testing/lib/initializers.js +15 -8
  106. package/dist/packages/ember-testing/lib/setup_for_testing.js +1 -1
  107. package/dist/packages/ember-testing/lib/test/run.js +1 -1
  108. package/dist/packages/router_js/index.js +2 -1
  109. package/dist/packages/shared-chunks/{alias-By_2yu5c.js → alias-Dri0koi2.js} +5 -3
  110. package/dist/packages/shared-chunks/array-3xbmc_4J.js +119 -0
  111. package/dist/packages/shared-chunks/{cache-gDE3bkXq.js → cache-BESCGvbE.js} +667 -1529
  112. package/dist/packages/shared-chunks/{core_view-Cxne2_wu.js → chunk-3SQBS3Y5-Cj4eryg1.js} +1 -88
  113. package/dist/packages/shared-chunks/{index-BXPoca1S.js → index-Llq6dmgX.js} +40 -4660
  114. package/dist/packages/shared-chunks/{is_proxy-Dmis-70B.js → is_proxy-DjvCKvd5.js} +1 -1
  115. package/dist/packages/shared-chunks/{mandatory-setter-1UQhiJOb.js → mandatory-setter-BiXq-dpN.js} +2 -1
  116. package/dist/packages/shared-chunks/{name-z9D9Yibn.js → name-Dx2bGFVv.js} +1 -1
  117. package/dist/packages/shared-chunks/{namespace_search-CBgHTkDh.js → namespace_search-btMaPM-_.js} +2 -2
  118. package/dist/packages/shared-chunks/{property_set-CW4q-uo4.js → property_set-BapAkp3X.js} +5 -4
  119. package/dist/packages/shared-chunks/{registry-DzfcDwii.js → registry-B8WARvkP.js} +3 -2
  120. package/dist/packages/shared-chunks/{router-B-Q1aYBn.js → router-DrLZsJeE.js} +2 -482
  121. package/dist/packages/shared-chunks/{set_properties-DvalyQdu.js → set_properties-BScfxzvI.js} +2 -2
  122. package/dist/packages/shared-chunks/setup-registry-du4pSGZi.js +48 -0
  123. package/dist/packages/shared-chunks/{to-string-D8i3mjEU.js → to-string-B1BmwUkt.js} +1 -1
  124. package/dist/packages/shared-chunks/unrecognized-url-error-zpz-JEoG.js +484 -0
  125. package/docs/data.json +152 -142
  126. package/package.json +4 -7
  127. package/types/stable/@ember/-internals/metal/lib/array.d.ts +1 -2
  128. package/types/stable/@ember/-internals/metal/lib/object-at.d.ts +4 -0
  129. package/types/stable/@ember/-internals/metal/lib/observer.d.ts +2 -1
  130. package/types/stable/@ember/array/index.d.ts +1 -1
  131. package/types/stable/@ember/array/make.d.ts +3 -0
  132. package/types/stable/@ember/debug/index.d.ts +3 -7
  133. package/types/stable/@ember/debug/lib/assert.d.ts +8 -0
  134. package/types/stable/@ember/engine/index.d.ts +1 -1
  135. package/types/stable/@ember/engine/instance.d.ts +2 -2
  136. package/types/stable/@ember/engine/parent.d.ts +3 -0
  137. package/types/stable/@ember/modifier/index.d.ts +1 -3
  138. package/types/stable/@ember/modifier/on.d.ts +5 -0
  139. package/types/stable/@ember/routing/lib/routing-service.d.ts +1 -1
  140. package/types/stable/@ember/routing/route.d.ts +2 -3
  141. package/types/stable/@ember/routing/router-service.d.ts +1 -1
  142. package/types/stable/@ember/routing/router.d.ts +4 -4
  143. package/types/stable/ember/barrel.d.ts +1 -1
  144. package/types/stable/ember/index.d.ts +1 -1
  145. package/types/stable/index.d.ts +5 -0
  146. package/dist/packages/shared-chunks/index-DTxy4Zgx.js +0 -641
  147. package/dist/packages/shared-chunks/index-PYiGj1jp.js +0 -2071
@@ -1,9 +1,9 @@
1
1
  import '../../@glimmer/opcode-compiler/index.js';
2
- export { H as default, h as helper } from '../../shared-chunks/index-BXPoca1S.js';
3
- import '../../shared-chunks/registry-DzfcDwii.js';
4
- import '../../shared-chunks/index-DTxy4Zgx.js';
2
+ export { H as default, h as helper } from '../../shared-chunks/index-Llq6dmgX.js';
3
+ import '../../shared-chunks/registry-B8WARvkP.js';
4
+ import '../debug/index.js';
5
5
  import '../../@glimmer/runtime/index.js';
6
- import '../../shared-chunks/cache-gDE3bkXq.js';
6
+ import '../runloop/index.js';
7
7
  import '../../@glimmer/reference/index.js';
8
8
  import '../../@glimmer/validator/index.js';
9
9
  import '@embroider/macros';
@@ -1,10 +1,10 @@
1
1
  export { componentCapabilities as capabilities, getComponentTemplate, setComponentTemplate } from '../../@glimmer/manager/index.js';
2
2
  import '../../@glimmer/opcode-compiler/index.js';
3
- export { I as Input, T as Textarea, C as default } from '../../shared-chunks/index-BXPoca1S.js';
4
- import '../../shared-chunks/registry-DzfcDwii.js';
5
- import '../../shared-chunks/index-DTxy4Zgx.js';
3
+ export { I as Input, T as Textarea, C as default } from '../../shared-chunks/index-Llq6dmgX.js';
4
+ import '../../shared-chunks/registry-B8WARvkP.js';
5
+ import '../debug/index.js';
6
6
  import '../../@glimmer/runtime/index.js';
7
- import '../../shared-chunks/cache-gDE3bkXq.js';
7
+ import '../runloop/index.js';
8
8
  import '../../@glimmer/reference/index.js';
9
9
  import '../../@glimmer/validator/index.js';
10
10
  import '@embroider/macros';
@@ -1,15 +1,15 @@
1
1
  import { getOwner } from '../-internals/owner/index.js';
2
- import '../../shared-chunks/index-PYiGj1jp.js';
2
+ import '../object/index.js';
3
3
  import { FrameworkObject } from '../object/-internals.js';
4
- import { c as computed, g as get, f as inject$1 } from '../../shared-chunks/cache-gDE3bkXq.js';
4
+ import { c as computed, g as get, p as inject$1 } from '../../shared-chunks/cache-BESCGvbE.js';
5
5
  import '../-internals/meta/lib/meta.js';
6
- import '../../shared-chunks/index-DTxy4Zgx.js';
6
+ import '../debug/index.js';
7
7
  import '../../@glimmer/validator/index.js';
8
- import { s as symbol } from '../../shared-chunks/to-string-D8i3mjEU.js';
9
- import '../../shared-chunks/mandatory-setter-1UQhiJOb.js';
10
- import '@embroider/macros';
8
+ import { s as symbol } from '../../shared-chunks/to-string-B1BmwUkt.js';
9
+ import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
11
10
  import '../../@glimmer/destroyable/index.js';
12
11
  import '../../@glimmer/manager/index.js';
12
+ import '@embroider/macros';
13
13
  import '../../shared-chunks/env-BJLX2Arx.js';
14
14
  import Mixin from '../object/mixin.js';
15
15
  import '../-internals/runtime/lib/mixins/registry_proxy.js';
@@ -1,14 +1,15 @@
1
1
  import { classify, dasherize } from '../-internals/string/index.js';
2
- import { E as EmberObject, t as typeOf } from '../../shared-chunks/index-PYiGj1jp.js';
2
+ import EmberObject from '../object/index.js';
3
3
  import '../-internals/meta/lib/meta.js';
4
- import '../../shared-chunks/mandatory-setter-1UQhiJOb.js';
4
+ import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
5
5
  import '@embroider/macros';
6
- import '../../shared-chunks/index-DTxy4Zgx.js';
6
+ import './index.js';
7
7
  import '../../@glimmer/destroyable/index.js';
8
8
  import '../../@glimmer/validator/index.js';
9
- import '../../shared-chunks/cache-gDE3bkXq.js';
10
9
  import '../../@glimmer/manager/index.js';
10
+ import '../../shared-chunks/cache-BESCGvbE.js';
11
11
  import '../../shared-chunks/env-BJLX2Arx.js';
12
+ import typeOf from '../utils/lib/type-of.js';
12
13
  import '../-internals/runtime/lib/mixins/registry_proxy.js';
13
14
  import '../-internals/runtime/lib/mixins/container_proxy.js';
14
15
  import '../-internals/runtime/lib/mixins/comparable.js';
@@ -1,16 +1,19 @@
1
1
  import { getOwner } from '../-internals/owner/index.js';
2
- import { _ as _backburner, g as get, X as next } from '../../shared-chunks/cache-gDE3bkXq.js';
3
- import { E as EmberObject, A } from '../../shared-chunks/index-PYiGj1jp.js';
2
+ import { _backburner, next } from '../runloop/index.js';
3
+ import EmberObject from '../object/index.js';
4
4
  import { dasherize } from '../-internals/string/index.js';
5
5
  import Namespace from '../application/namespace.js';
6
+ import { A } from '../array/index.js';
6
7
  import { createCache, consumeTag, tagFor, untrack, getValue } from '../../@glimmer/validator/index.js';
7
- import { a as assert } from '../../shared-chunks/index-DTxy4Zgx.js';
8
+ import './index.js';
9
+ import { g as get } from '../../shared-chunks/cache-BESCGvbE.js';
8
10
  import '../-internals/meta/lib/meta.js';
9
- import '../../shared-chunks/mandatory-setter-1UQhiJOb.js';
11
+ import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
10
12
  import '@embroider/macros';
11
13
  import '../../@glimmer/destroyable/index.js';
12
14
  import '../../@glimmer/manager/index.js';
13
15
  import '../../shared-chunks/env-BJLX2Arx.js';
16
+ import { assert } from './lib/assert.js';
14
17
 
15
18
  /**
16
19
  @module @ember/debug/data-adapter
@@ -1,5 +1,214 @@
1
- import '../../shared-chunks/index-BGP1rw3B.js';
2
- export { t as _warnIfUsingStrippedFeatureFlags, a as assert, c as debug, h as debugFreeze, p as debugSeal, d as deprecate, e as deprecateFunc, q as getDebugFunction, i as info, b as inspect, f as registerDeprecationHandler, g as registerWarnHandler, r as runInDebug, s as setDebugFunction, w as warn } from '../../shared-chunks/index-DTxy4Zgx.js';
3
- export { isTesting, setTesting } from './lib/testing.js';
4
- import '@embroider/macros';
1
+ import { i as isFirefox, a as isChrome } from '../../shared-chunks/index-BGP1rw3B.js';
2
+ import _deprecate from './lib/deprecate.js';
3
+ export { registerHandler as registerDeprecationHandler } from './lib/deprecate.js';
4
+ import { isTesting } from './lib/testing.js';
5
+ export { setTesting } from './lib/testing.js';
6
+ import _warn from './lib/warn.js';
7
+ export { registerHandler as registerWarnHandler } from './lib/warn.js';
8
+ import { setAssert, assert } from './lib/assert.js';
9
+ import { isDevelopingApp } from '@embroider/macros';
10
+ export { default as inspect } from './lib/inspect.js';
5
11
  export { default as captureRenderTree } from './lib/capture-render-tree.js';
12
+
13
+ // These are the default production build versions:
14
+ const noop = () => {};
15
+
16
+ // SAFETY: these casts are just straight-up lies, but the point is that they do
17
+ // not do anything in production builds.
18
+ let info = noop;
19
+ let warn = noop;
20
+ let debug = noop;
21
+ let deprecate = noop;
22
+ let debugSeal = noop;
23
+ let debugFreeze = noop;
24
+ let runInDebug = noop;
25
+ let setDebugFunction = noop;
26
+ let getDebugFunction = noop;
27
+ let deprecateFunc = function () {
28
+ return arguments[arguments.length - 1];
29
+ };
30
+ if (isDevelopingApp()) {
31
+ setDebugFunction = function (type, callback) {
32
+ switch (type) {
33
+ case 'assert':
34
+ return setAssert(callback);
35
+ case 'info':
36
+ return info = callback;
37
+ case 'warn':
38
+ return warn = callback;
39
+ case 'debug':
40
+ return debug = callback;
41
+ case 'deprecate':
42
+ return deprecate = callback;
43
+ case 'debugSeal':
44
+ return debugSeal = callback;
45
+ case 'debugFreeze':
46
+ return debugFreeze = callback;
47
+ case 'runInDebug':
48
+ return runInDebug = callback;
49
+ case 'deprecateFunc':
50
+ return deprecateFunc = callback;
51
+ }
52
+ };
53
+ getDebugFunction = function (type) {
54
+ switch (type) {
55
+ case 'assert':
56
+ return assert;
57
+ case 'info':
58
+ return info;
59
+ case 'warn':
60
+ return warn;
61
+ case 'debug':
62
+ return debug;
63
+ case 'deprecate':
64
+ return deprecate;
65
+ case 'debugSeal':
66
+ return debugSeal;
67
+ case 'debugFreeze':
68
+ return debugFreeze;
69
+ case 'runInDebug':
70
+ return runInDebug;
71
+ case 'deprecateFunc':
72
+ return deprecateFunc;
73
+ }
74
+ };
75
+ }
76
+
77
+ /**
78
+ @module @ember/debug
79
+ */
80
+
81
+ if (isDevelopingApp()) {
82
+ /**
83
+ Display a debug notice.
84
+ Calls to this function are not invoked in production builds.
85
+ ```javascript
86
+ import { debug } from '@ember/debug';
87
+ debug('I\'m a debug notice!');
88
+ ```
89
+ @method debug
90
+ @for @ember/debug
91
+ @static
92
+ @param {String} message A debug message to display.
93
+ @public
94
+ */
95
+ setDebugFunction('debug', function debug(message) {
96
+ console.debug(`DEBUG: ${message}`); /* eslint-disable-line no-console */
97
+ });
98
+
99
+ /**
100
+ Display an info notice.
101
+ Calls to this function are removed from production builds, so they can be
102
+ freely added for documentation and debugging purposes without worries of
103
+ incuring any performance penalty.
104
+ @method info
105
+ @private
106
+ */
107
+ setDebugFunction('info', function info() {
108
+ console.info(...arguments); /* eslint-disable-line no-console */
109
+ });
110
+
111
+ /**
112
+ @module @ember/debug
113
+ @public
114
+ */
115
+
116
+ /**
117
+ Alias an old, deprecated method with its new counterpart.
118
+ Display a deprecation warning with the provided message and a stack trace
119
+ (Chrome and Firefox only) when the assigned method is called.
120
+ Calls to this function are removed from production builds, so they can be
121
+ freely added for documentation and debugging purposes without worries of
122
+ incuring any performance penalty.
123
+ ```javascript
124
+ import { deprecateFunc } from '@ember/debug';
125
+ Ember.oldMethod = deprecateFunc('Please use the new, updated method', options, Ember.newMethod);
126
+ ```
127
+ @method deprecateFunc
128
+ @static
129
+ @for @ember/debug
130
+ @param {String} message A description of the deprecation.
131
+ @param {Object} [options] The options object for `deprecate`.
132
+ @param {Function} func The new function called to replace its deprecated counterpart.
133
+ @return {Function} A new function that wraps the original function with a deprecation warning
134
+ @private
135
+ */
136
+ setDebugFunction('deprecateFunc', function deprecateFunc(...args) {
137
+ if (args.length === 3) {
138
+ let [message, options, func] = args;
139
+ return function (...args) {
140
+ deprecate(message, false, options);
141
+ return func.apply(this, args);
142
+ };
143
+ } else {
144
+ let [message, func] = args;
145
+ return function () {
146
+ deprecate(message);
147
+ return func.apply(this, arguments);
148
+ };
149
+ }
150
+ });
151
+
152
+ /**
153
+ @module @ember/debug
154
+ @public
155
+ */
156
+ /**
157
+ Run a function meant for debugging.
158
+ Calls to this function are removed from production builds, so they can be
159
+ freely added for documentation and debugging purposes without worries of
160
+ incuring any performance penalty.
161
+ ```javascript
162
+ import Component from '@ember/component';
163
+ import { runInDebug } from '@ember/debug';
164
+ runInDebug(() => {
165
+ Component.reopen({
166
+ didInsertElement() {
167
+ console.log("I'm happy");
168
+ }
169
+ });
170
+ });
171
+ ```
172
+ @method runInDebug
173
+ @for @ember/debug
174
+ @static
175
+ @param {Function} func The function to be executed.
176
+ @since 1.5.0
177
+ @public
178
+ */
179
+ setDebugFunction('runInDebug', function runInDebug(func) {
180
+ func();
181
+ });
182
+ setDebugFunction('debugSeal', function debugSeal(obj) {
183
+ Object.seal(obj);
184
+ });
185
+ setDebugFunction('debugFreeze', function debugFreeze(obj) {
186
+ // re-freezing an already frozen object introduces a significant
187
+ // performance penalty on Chrome (tested through 59).
188
+ //
189
+ // See: https://bugs.chromium.org/p/v8/issues/detail?id=6450
190
+ if (!Object.isFrozen(obj)) {
191
+ Object.freeze(obj);
192
+ }
193
+ });
194
+ setDebugFunction('deprecate', _deprecate);
195
+ setDebugFunction('warn', _warn);
196
+ }
197
+ let _warnIfUsingStrippedFeatureFlags;
198
+ if (isDevelopingApp() && !isTesting()) {
199
+ if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
200
+ window.addEventListener('load', () => {
201
+ if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset['emberExtension']) {
202
+ let downloadURL;
203
+ if (isChrome) {
204
+ downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
205
+ } else if (isFirefox) {
206
+ downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
207
+ }
208
+ debug(`For more advanced debugging, install the Ember Inspector from ${downloadURL}`);
209
+ }
210
+ }, false);
211
+ }
212
+ }
213
+
214
+ export { _warnIfUsingStrippedFeatureFlags, assert, debug, debugFreeze, debugSeal, deprecate, deprecateFunc, getDebugFunction, info, isTesting, runInDebug, setDebugFunction, warn };
@@ -0,0 +1,47 @@
1
+ import { isDevelopingApp } from '@embroider/macros';
2
+
3
+ let assert = () => {};
4
+ function setAssert(implementation) {
5
+ assert = implementation;
6
+ return implementation;
7
+ }
8
+ if (isDevelopingApp()) {
9
+ /**
10
+ Verify that a certain expectation is met, or throw a exception otherwise.
11
+ This is useful for communicating assumptions in the code to other human
12
+ readers as well as catching bugs that accidentally violates these
13
+ expectations.
14
+ Assertions are removed from production builds, so they can be freely added
15
+ for documentation and debugging purposes without worries of incuring any
16
+ performance penalty. However, because of that, they should not be used for
17
+ checks that could reasonably fail during normal usage. Furthermore, care
18
+ should be taken to avoid accidentally relying on side-effects produced from
19
+ evaluating the condition itself, since the code will not run in production.
20
+ ```javascript
21
+ import { assert } from '@ember/debug';
22
+ // Test for truthiness
23
+ assert('Must pass a string', typeof str === 'string');
24
+ // Fail unconditionally
25
+ assert('This code path should never be run');
26
+ ```
27
+ @method assert
28
+ @static
29
+ @for @ember/debug
30
+ @param {String} description Describes the expectation. This will become the
31
+ text of the Error thrown if the assertion fails.
32
+ @param {any} condition Must be truthy for the assertion to pass. If
33
+ falsy, an exception will be thrown.
34
+ @public
35
+ @since 1.0.0
36
+ */
37
+
38
+ // eslint-disable-next-line no-inner-declarations
39
+ function assert(desc, test) {
40
+ if (!test) {
41
+ throw new Error(`Assertion Failed: ${desc}`);
42
+ }
43
+ }
44
+ setAssert(assert);
45
+ }
46
+
47
+ export { assert, setAssert };
@@ -1,4 +1,194 @@
1
- import '../../../shared-chunks/env-BJLX2Arx.js';
2
- export { _ as default, k as missingOptionDeprecation, m as missingOptionsDeprecation, j as missingOptionsIdDeprecation, f as registerHandler } from '../../../shared-chunks/index-DTxy4Zgx.js';
3
- import './handlers.js';
4
- import '@embroider/macros';
1
+ import { E as ENV } from '../../../shared-chunks/env-BJLX2Arx.js';
2
+ import { assert } from './assert.js';
3
+ import { registerHandler as registerHandler$1, invoke } from './handlers.js';
4
+ import { isDevelopingApp } from '@embroider/macros';
5
+
6
+ /**
7
+ @module @ember/debug
8
+ @public
9
+ */
10
+ /**
11
+ Allows for runtime registration of handler functions that override the default deprecation behavior.
12
+ Deprecations are invoked by calls to [@ember/debug/deprecate](/ember/release/classes/@ember%2Fdebug/methods/deprecate?anchor=deprecate).
13
+ The following example demonstrates its usage by registering a handler that throws an error if the
14
+ message contains the word "should", otherwise defers to the default handler.
15
+
16
+ ```javascript
17
+ import { registerDeprecationHandler } from '@ember/debug';
18
+
19
+ registerDeprecationHandler((message, options, next) => {
20
+ if (message.indexOf('should') !== -1) {
21
+ throw new Error(`Deprecation message with should: ${message}`);
22
+ } else {
23
+ // defer to whatever handler was registered before this one
24
+ next(message, options);
25
+ }
26
+ });
27
+ ```
28
+
29
+ The handler function takes the following arguments:
30
+
31
+ <ul>
32
+ <li> <code>message</code> - The message received from the deprecation call.</li>
33
+ <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
34
+ <ul>
35
+ <li> <code>id</code> - An id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
36
+ <li> <code>until</code> - The Ember version number the feature and deprecation will be removed in.</li>
37
+ </ul>
38
+ <li> <code>next</code> - A function that calls into the previously registered handler.</li>
39
+ </ul>
40
+
41
+ @public
42
+ @static
43
+ @method registerDeprecationHandler
44
+ @for @ember/debug
45
+ @param handler {Function} A function to handle deprecation calls.
46
+ @since 2.1.0
47
+ */
48
+ let registerHandler = () => {};
49
+ let missingOptionsDeprecation;
50
+ let missingOptionsIdDeprecation;
51
+ let missingOptionDeprecation = () => '';
52
+ let deprecate = () => {};
53
+ if (isDevelopingApp()) {
54
+ registerHandler = function registerHandler(handler) {
55
+ registerHandler$1('deprecate', handler);
56
+ };
57
+ let formatMessage = function formatMessage(_message, options) {
58
+ let message = _message;
59
+ if (options?.id) {
60
+ message = message + ` [deprecation id: ${options.id}]`;
61
+ }
62
+ if (options?.until) {
63
+ message = message + ` This will be removed in ${options.for} ${options.until}.`;
64
+ }
65
+ if (options?.url) {
66
+ message += ` See ${options.url} for more details.`;
67
+ }
68
+ return message;
69
+ };
70
+ registerHandler(function logDeprecationToConsole(message, options) {
71
+ let updatedMessage = formatMessage(message, options);
72
+ console.warn(`DEPRECATION: ${updatedMessage}`); // eslint-disable-line no-console
73
+ });
74
+ let captureErrorForStack;
75
+ if (new Error().stack) {
76
+ captureErrorForStack = () => new Error();
77
+ } else {
78
+ captureErrorForStack = () => {
79
+ try {
80
+ __fail__.fail();
81
+ return;
82
+ } catch (e) {
83
+ return e;
84
+ }
85
+ };
86
+ }
87
+ registerHandler(function logDeprecationStackTrace(message, options, next) {
88
+ if (ENV.LOG_STACKTRACE_ON_DEPRECATION) {
89
+ let stackStr = '';
90
+ let error = captureErrorForStack();
91
+ let stack;
92
+ if (error instanceof Error) {
93
+ if (error.stack) {
94
+ if (error['arguments']) {
95
+ // Chrome
96
+ stack = error.stack.replace(/^\s+at\s+/gm, '').replace(/^([^(]+?)([\n$])/gm, '{anonymous}($1)$2').replace(/^Object.<anonymous>\s*\(([^)]+)\)/gm, '{anonymous}($1)').split('\n');
97
+ stack.shift();
98
+ } else {
99
+ // Firefox
100
+ stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
101
+ }
102
+ stackStr = `\n ${stack.slice(2).join('\n ')}`;
103
+ }
104
+ }
105
+ let updatedMessage = formatMessage(message, options);
106
+ console.warn(`DEPRECATION: ${updatedMessage}${stackStr}`); // eslint-disable-line no-console
107
+ } else {
108
+ next(message, options);
109
+ }
110
+ });
111
+ registerHandler(function raiseOnDeprecation(message, options, next) {
112
+ if (ENV.RAISE_ON_DEPRECATION) {
113
+ let updatedMessage = formatMessage(message);
114
+ throw new Error(updatedMessage);
115
+ } else {
116
+ next(message, options);
117
+ }
118
+ });
119
+ missingOptionsDeprecation = 'When calling `deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
120
+ missingOptionsIdDeprecation = 'When calling `deprecate` you must provide `id` in options.';
121
+ missingOptionDeprecation = (id, missingOption) => {
122
+ return `When calling \`deprecate\` you must provide \`${missingOption}\` in options. Missing options.${missingOption} in "${id}" deprecation`;
123
+ };
124
+ /**
125
+ @module @ember/debug
126
+ @public
127
+ */
128
+ /**
129
+ Display a deprecation warning with the provided message and a stack trace
130
+ (Chrome and Firefox only).
131
+ Ember itself leverages [Semantic Versioning](https://semver.org) to aid
132
+ projects in keeping up with changes to the framework. Before any
133
+ functionality or API is removed, it first flows linearly through a
134
+ deprecation staging process. The staging process currently contains two
135
+ stages: available and enabled.
136
+ Deprecations are initially released into the 'available' stage.
137
+ Deprecations will stay in this stage until the replacement API has been
138
+ marked as a recommended practice via the RFC process and the addon
139
+ ecosystem has generally adopted the change.
140
+ Once a deprecation meets the above criteria, it will move into the
141
+ 'enabled' stage where it will remain until the functionality or API is
142
+ eventually removed.
143
+ For application and addon developers, "available" deprecations are not
144
+ urgent and "enabled" deprecations require action.
145
+ * In a production build, this method is defined as an empty function (NOP).
146
+ Uses of this method in Ember itself are stripped from the ember.prod.js build.
147
+ ```javascript
148
+ import { deprecate } from '@ember/debug';
149
+ deprecate(
150
+ 'Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead.',
151
+ false,
152
+ {
153
+ id: 'ember-polyfills.deprecate-assign',
154
+ until: '5.0.0',
155
+ url: 'https://deprecations.emberjs.com/v4.x/#toc_ember-polyfills-deprecate-assign',
156
+ for: 'ember-source',
157
+ since: {
158
+ available: '4.0.0',
159
+ enabled: '4.0.0',
160
+ },
161
+ }
162
+ );
163
+ ```
164
+ @method deprecate
165
+ @for @ember/debug
166
+ @param {String} message A description of the deprecation.
167
+ @param {Boolean} test A boolean. If falsy, the deprecation will be displayed.
168
+ @param {Object} options
169
+ @param {String} options.id A unique id for this deprecation. The id can be
170
+ used by Ember debugging tools to change the behavior (raise, log or silence)
171
+ for that specific deprecation. The id should be namespaced by dots, e.g.
172
+ "view.helper.select".
173
+ @param {string} options.until The version of Ember when this deprecation
174
+ warning will be removed.
175
+ @param {String} options.for A namespace for the deprecation, usually the package name
176
+ @param {Object} options.since Describes when the deprecation became available and enabled.
177
+ @param {String} [options.url] An optional url to the transition guide on the
178
+ emberjs.com website.
179
+ @static
180
+ @public
181
+ @since 1.0.0
182
+ */
183
+ deprecate = function deprecate(message, test, options) {
184
+ assert(missingOptionsDeprecation, Boolean(options && (options.id || options.until)));
185
+ assert(missingOptionsIdDeprecation, Boolean(options.id));
186
+ assert(missingOptionDeprecation(options.id, 'until'), Boolean(options.until));
187
+ assert(missingOptionDeprecation(options.id, 'for'), Boolean(options.for));
188
+ assert(missingOptionDeprecation(options.id, 'since'), Boolean(options.since));
189
+ invoke('deprecate', message, test, options);
190
+ };
191
+ }
192
+ const _deprecate = deprecate;
193
+
194
+ export { _deprecate as default, missingOptionDeprecation, missingOptionsDeprecation, missingOptionsIdDeprecation, registerHandler };