ember-source 2.1.2 → 2.2.0.beta.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.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

@@ -1,3 +1,4 @@
1
+ ;(function() {
1
2
  /*!
2
3
  * @overview Ember - JavaScript Application Framework
3
4
  * @copyright Copyright 2011-2015 Tilde Inc. and contributors
@@ -5,11 +6,10 @@
5
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
7
  * @license Licensed under MIT license
7
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 2.1.2
9
+ * @version 2.2.0-beta.1
9
10
  */
10
11
 
11
- (function() {
12
- var enifed, requireModule, eriuqer, requirejs, Ember;
12
+ var enifed, requireModule, require, requirejs, Ember;
13
13
  var mainContext = this;
14
14
 
15
15
  (function() {
@@ -40,7 +40,7 @@ var mainContext = this;
40
40
  registry[name] = value;
41
41
  };
42
42
 
43
- requirejs = eriuqer = requireModule = function(name) {
43
+ requirejs = require = requireModule = function(name) {
44
44
  return internalRequire(name, null);
45
45
  }
46
46
 
@@ -71,7 +71,7 @@ var mainContext = this;
71
71
  if (deps[i] === 'exports') {
72
72
  reified.push(exports);
73
73
  } else {
74
- reified.push(internalRequire(resolve(deps[i], name), name));
74
+ reified.push(internalRequire(deps[i], name));
75
75
  }
76
76
  }
77
77
 
@@ -80,324 +80,19 @@ var mainContext = this;
80
80
  return exports;
81
81
  };
82
82
 
83
- function resolve(child, name) {
84
- if (child.charAt(0) !== '.') {
85
- return child;
86
- }
87
- var parts = child.split('/');
88
- var parentBase = name.split('/').slice(0, -1);
89
-
90
- for (var i = 0, l = parts.length; i < l; i++) {
91
- var part = parts[i];
92
-
93
- if (part === '..') {
94
- parentBase.pop();
95
- } else if (part === '.') {
96
- continue;
97
- } else {
98
- parentBase.push(part);
99
- }
100
- }
101
-
102
- return parentBase.join('/');
103
- }
104
-
105
83
  requirejs._eak_seen = registry;
106
84
 
107
85
  Ember.__loader = {
108
86
  define: enifed,
109
- require: eriuqer,
87
+ require: require,
110
88
  registry: registry
111
89
  };
112
90
  } else {
113
91
  enifed = Ember.__loader.define;
114
- requirejs = eriuqer = requireModule = Ember.__loader.require;
92
+ requirejs = require = requireModule = Ember.__loader.require;
115
93
  }
116
94
  })();
117
95
 
118
- enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/assert', 'ember-metal/features', 'ember-metal/error', 'ember-metal/logger', 'ember-metal/environment', 'ember-debug/deprecate', 'ember-debug/warn', 'ember-debug/is-plain-function'], function (exports, _emberMetalCore, _emberMetalAssert, _emberMetalFeatures, _emberMetalError, _emberMetalLogger, _emberMetalEnvironment, _emberDebugDeprecate, _emberDebugWarn, _emberDebugIsPlainFunction) {
119
- 'use strict';
120
-
121
- exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
122
-
123
- _emberMetalCore.default.deprecate = _emberDebugDeprecate.default;
124
-
125
- /**
126
- @module ember
127
- @submodule ember-debug
128
- */
129
-
130
- /**
131
- @class Ember
132
- @public
133
- */
134
-
135
- /**
136
- Define an assertion that will throw an exception if the condition is not
137
- met. Ember build tools will remove any calls to `Ember.assert()` when
138
- doing a production build. Example:
139
-
140
- ```javascript
141
- // Test for truthiness
142
- Ember.assert('Must pass a valid object', obj);
143
-
144
- // Fail unconditionally
145
- Ember.assert('This code path should never be run');
146
- ```
147
-
148
- @method assert
149
- @param {String} desc A description of the assertion. This will become
150
- the text of the Error thrown if the assertion fails.
151
- @param {Boolean|Function} test Must be truthy for the assertion to pass. If
152
- falsy, an exception will be thrown. If this is a function, it will be executed and
153
- its return value will be used as condition.
154
- @public
155
- */
156
- function assert(desc, test) {
157
- var throwAssertion;
158
-
159
- if (_emberDebugIsPlainFunction.default(test)) {
160
- throwAssertion = !test();
161
- } else {
162
- throwAssertion = !test;
163
- }
164
-
165
- if (throwAssertion) {
166
- throw new _emberMetalError.default('Assertion Failed: ' + desc);
167
- }
168
- }
169
-
170
- /**
171
- Display a debug notice. Ember build tools will remove any calls to
172
- `Ember.debug()` when doing a production build.
173
-
174
- ```javascript
175
- Ember.debug('I\'m a debug notice!');
176
- ```
177
-
178
- @method debug
179
- @param {String} message A debug message to display.
180
- @public
181
- */
182
- function debug(message) {
183
- _emberMetalLogger.default.debug('DEBUG: ' + message);
184
- }
185
-
186
- /**
187
- Alias an old, deprecated method with its new counterpart.
188
-
189
- Display a deprecation warning with the provided message and a stack trace
190
- (Chrome and Firefox only) when the assigned method is called.
191
-
192
- Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
193
- no warnings will be shown in production.
194
-
195
- ```javascript
196
- Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);
197
- ```
198
-
199
- @method deprecateFunc
200
- @param {String} message A description of the deprecation.
201
- @param {Object} [options] The options object for Ember.deprecate.
202
- @param {Function} func The new function called to replace its deprecated counterpart.
203
- @return {Function} a new function that wrapped the original function with a deprecation warning
204
- @private
205
- */
206
- function deprecateFunc() {
207
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
208
- args[_key] = arguments[_key];
209
- }
210
-
211
- if (args.length === 3) {
212
- var _ret = (function () {
213
- var message = args[0];
214
- var options = args[1];
215
- var func = args[2];
216
-
217
- return {
218
- v: function () {
219
- _emberMetalCore.default.deprecate(message, false, options);
220
- return func.apply(this, arguments);
221
- }
222
- };
223
- })();
224
-
225
- if (typeof _ret === 'object') return _ret.v;
226
- } else {
227
- var _ret2 = (function () {
228
- var message = args[0];
229
- var func = args[1];
230
-
231
- return {
232
- v: function () {
233
- _emberMetalCore.default.deprecate(message);
234
- return func.apply(this, arguments);
235
- }
236
- };
237
- })();
238
-
239
- if (typeof _ret2 === 'object') return _ret2.v;
240
- }
241
- }
242
-
243
- /**
244
- Run a function meant for debugging. Ember build tools will remove any calls to
245
- `Ember.runInDebug()` when doing a production build.
246
-
247
- ```javascript
248
- Ember.runInDebug(() => {
249
- Ember.Component.reopen({
250
- didInsertElement() {
251
- console.log("I'm happy");
252
- }
253
- });
254
- });
255
- ```
256
-
257
- @method runInDebug
258
- @param {Function} func The function to be executed.
259
- @since 1.5.0
260
- @public
261
- */
262
- function runInDebug(func) {
263
- func();
264
- }
265
-
266
- _emberMetalAssert.registerDebugFunction('assert', assert);
267
- _emberMetalAssert.registerDebugFunction('warn', _emberDebugWarn.default);
268
- _emberMetalAssert.registerDebugFunction('debug', debug);
269
- _emberMetalAssert.registerDebugFunction('deprecate', _emberDebugDeprecate.default);
270
- _emberMetalAssert.registerDebugFunction('deprecateFunc', deprecateFunc);
271
- _emberMetalAssert.registerDebugFunction('runInDebug', runInDebug);
272
-
273
- /**
274
- Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
275
- any specific FEATURES flag is truthy.
276
-
277
- This method is called automatically in debug canary builds.
278
-
279
- @private
280
- @method _warnIfUsingStrippedFeatureFlags
281
- @return {void}
282
- */
283
-
284
- function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
285
- if (featuresWereStripped) {
286
- _emberMetalCore.default.warn('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_ALL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
287
- _emberMetalCore.default.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
288
-
289
- for (var key in FEATURES) {
290
- if (FEATURES.hasOwnProperty(key) && key !== 'isEnabled') {
291
- _emberMetalCore.default.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' });
292
- }
293
- }
294
- }
295
- }
296
-
297
- if (!_emberMetalCore.default.testing) {
298
- // Complain if they're using FEATURE flags in builds other than canary
299
- _emberMetalFeatures.FEATURES['features-stripped-test'] = true;
300
- var featuresWereStripped = true;
301
-
302
- delete _emberMetalFeatures.FEATURES['features-stripped-test'];
303
- _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, featuresWereStripped);
304
-
305
- // Inform the developer about the Ember Inspector if not installed.
306
- var isFirefox = _emberMetalEnvironment.default.isFirefox;
307
- var isChrome = _emberMetalEnvironment.default.isChrome;
308
-
309
- if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
310
- window.addEventListener('load', function () {
311
- if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {
312
- var downloadURL;
313
-
314
- if (isChrome) {
315
- downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
316
- } else if (isFirefox) {
317
- downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
318
- }
319
-
320
- _emberMetalCore.default.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
321
- }
322
- }, false);
323
- }
324
- }
325
- /**
326
- @public
327
- @class Ember.Debug
328
- */
329
- _emberMetalCore.default.Debug = {};
330
-
331
- /**
332
- Allows for runtime registration of handler functions that override the default deprecation behavior.
333
- Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
334
- The following example demonstrates its usage by registering a handler that throws an error if the
335
- message contains the word "should", otherwise defers to the default handler.
336
- ```javascript
337
- Ember.Debug.registerDeprecationHandler((message, options, next) => {
338
- if (message.indexOf('should') !== -1) {
339
- throw new Error(`Deprecation message with should: ${message}`);
340
- } else {
341
- // defer to whatever handler was registered before this one
342
- next(message, options);
343
- }
344
- }
345
- ```
346
- The handler function takes the following arguments:
347
- <ul>
348
- <li> <code>message</code> - The message received from the deprecation call. </li>
349
- <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
350
- <ul>
351
- <li> <code>id</code> - an id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
352
- <li> <code>until</code> - is the version number Ember the feature and deprecation will be removed in.</li>
353
- </ul>
354
- <li> <code>next</code> - a function that calls into the previously registered handler.</li>
355
- </ul>
356
- @public
357
- @static
358
- @method registerDeprecationHandler
359
- @param handler {Function} a function to handle deprecation calls
360
- */
361
- _emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
362
- /**
363
- Allows for runtime registration of handler functions that override the default warning behavior.
364
- Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
365
- The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
366
- default warning behavior.
367
- ```javascript
368
- // next is not called, so no warnings get the default behavior
369
- Ember.Debug.registerWarnHandler(() => {});
370
- ```
371
- The handler function takes the following arguments:
372
- <ul>
373
- <li> <code>message</code> - The message received from the warn call. </li>
374
- <li> <code>options</code> - An object passed in with the warn call containing additional information including:</li>
375
- <ul>
376
- <li> <code>id</code> - an id of the warning in the form of <code>package-name.specific-warning</code>.</li>
377
- </ul>
378
- <li> <code>next</code> - a function that calls into the previously registered handler.</li>
379
- </ul>
380
- @public
381
- @static
382
- @method registerWarnHandler
383
- @param handler {Function} a function to handle warnings
384
- */
385
- _emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
386
-
387
- /*
388
- We are transitioning away from `ember.js` to `ember.debug.js` to make
389
- it much clearer that it is only for local development purposes.
390
-
391
- This flag value is changed by the tooling (by a simple string replacement)
392
- so that if `ember.js` (which must be output for backwards compat reasons) is
393
- used a nice helpful warning message will be printed out.
394
- */
395
- var runningNonEmberDebugJS = false;
396
- exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
397
- if (runningNonEmberDebugJS) {
398
- _emberMetalCore.default.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
399
- }
400
- });
401
96
  enifed('ember-debug/deprecate', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/logger', 'ember-debug/handlers'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalLogger, _emberDebugHandlers) {
402
97
  /*global __fail__*/
403
98
 
@@ -482,11 +177,6 @@ enifed('ember-debug/deprecate', ['exports', 'ember-metal/core', 'ember-metal/err
482
177
  var missingOptionsUntilDeprecation = 'When calling `Ember.deprecate` you must provide `until` in options.';
483
178
 
484
179
  exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation;
485
- /**
486
- @module ember
487
- @submodule ember-debug
488
- */
489
-
490
180
  /**
491
181
  Display a deprecation warning with the provided message and a stack trace
492
182
  (Chrome and Firefox only). Ember build tools will remove any calls to
@@ -494,15 +184,13 @@ enifed('ember-debug/deprecate', ['exports', 'ember-metal/core', 'ember-metal/err
494
184
 
495
185
  @method deprecate
496
186
  @param {String} message A description of the deprecation.
497
- @param {Boolean|Function} test A boolean. If falsy, the deprecation
498
- will be displayed. If this is a function, it will be executed and its return
499
- value will be used as condition.
187
+ @param {Boolean} test A boolean. If falsy, the deprecation
188
+ will be displayed.
500
189
  @param {Object} options An object that can be used to pass
501
190
  in a `url` to the transition guide on the emberjs.com website, and a unique
502
191
  `id` for this deprecation. The `id` can be used by Ember debugging tools
503
192
  to change the behavior (raise, log or silence) for that specific deprecation.
504
193
  The `id` should be namespaced by dots, e.g. "view.helper.select".
505
- @for Ember
506
194
  @public
507
195
  */
508
196
 
@@ -534,132 +222,408 @@ enifed('ember-debug/deprecate', ['exports', 'ember-metal/core', 'ember-metal/err
534
222
  _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
535
223
  }
536
224
  });
537
- enifed('ember-debug/handlers', ['exports', 'ember-debug/is-plain-function'], function (exports, _emberDebugIsPlainFunction) {
225
+ enifed('ember-debug/handlers', ['exports', 'ember-debug/is-plain-function', 'ember-debug/deprecate'], function (exports, _emberDebugIsPlainFunction, _emberDebugDeprecate) {
226
+ 'use strict';
227
+
228
+ exports.generateTestAsFunctionDeprecation = generateTestAsFunctionDeprecation;
229
+ exports.registerHandler = registerHandler;
230
+ exports.invoke = invoke;
231
+ var HANDLERS = {};
232
+
233
+ exports.HANDLERS = HANDLERS;
234
+
235
+ function generateTestAsFunctionDeprecation(source) {
236
+ return 'Calling `' + source + '` with a function argument is deprecated. Please ' + 'use `!!Constructor` for constructors, or an `IIFE` to compute the test for deprecation. ' + 'In a future version functions will be treated as truthy values instead of being executed.';
237
+ }
238
+
239
+ function normalizeTest(test, source) {
240
+ if (_emberDebugIsPlainFunction.default(test)) {
241
+ _emberDebugDeprecate.default(generateTestAsFunctionDeprecation(source), false, { id: 'ember-debug.deprecate-test-as-function', until: '2.5.0' });
242
+
243
+ return test();
244
+ }
245
+
246
+ return test;
247
+ }
248
+
249
+ function registerHandler(type, callback) {
250
+ var nextHandler = HANDLERS[type] || function () {};
251
+
252
+ HANDLERS[type] = function (message, options) {
253
+ callback(message, options, nextHandler);
254
+ };
255
+ }
256
+
257
+ function invoke(type, message, test, options) {
258
+ if (normalizeTest(test, 'Ember.' + type)) {
259
+ return;
260
+ }
261
+
262
+ var handlerForType = HANDLERS[type];
263
+
264
+ if (!handlerForType) {
265
+ return;
266
+ }
267
+
268
+ if (handlerForType) {
269
+ handlerForType(message, options);
270
+ }
271
+ }
272
+ });
273
+ enifed('ember-debug/is-plain-function', ['exports'], function (exports) {
274
+ 'use strict';
275
+
276
+ exports.default = isPlainFunction;
277
+
278
+ function isPlainFunction(test) {
279
+ return typeof test === 'function' && test.PrototypeMixin === undefined;
280
+ }
281
+ });
282
+ enifed('ember-debug/warn', ['exports', 'ember-metal/logger', 'ember-metal/debug', 'ember-debug/handlers'], function (exports, _emberMetalLogger, _emberMetalDebug, _emberDebugHandlers) {
283
+ 'use strict';
284
+
285
+ var _slice = Array.prototype.slice;
286
+ exports.registerHandler = registerHandler;
287
+ exports.default = warn;
288
+
289
+ function registerHandler(handler) {
290
+ _emberDebugHandlers.registerHandler('warn', handler);
291
+ }
292
+
293
+ registerHandler(function logWarning(message, options) {
294
+ _emberMetalLogger.default.warn('WARNING: ' + message);
295
+ if ('trace' in _emberMetalLogger.default) {
296
+ _emberMetalLogger.default.trace();
297
+ }
298
+ });
299
+
300
+ var missingOptionsDeprecation = 'When calling `Ember.warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
301
+ exports.missingOptionsDeprecation = missingOptionsDeprecation;
302
+ var missingOptionsIdDeprecation = 'When calling `Ember.warn` you must provide `id` in options.';
303
+
304
+ exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
305
+ /**
306
+ Display a warning with the provided message. Ember build tools will
307
+ remove any calls to `Ember.warn()` when doing a production build.
308
+
309
+ @method warn
310
+ @param {String} message A warning to display.
311
+ @param {Boolean} test An optional boolean. If falsy, the warning
312
+ will be displayed.
313
+ @public
314
+ */
315
+
316
+ function warn(message, test, options) {
317
+ if (!options) {
318
+ _emberMetalDebug.deprecate(missingOptionsDeprecation, false, {
319
+ id: 'ember-debug.warn-options-missing',
320
+ until: '3.0.0',
321
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
322
+ });
323
+ }
324
+
325
+ if (options && !options.id) {
326
+ _emberMetalDebug.deprecate(missingOptionsIdDeprecation, false, {
327
+ id: 'ember-debug.warn-id-missing',
328
+ until: '3.0.0',
329
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
330
+ });
331
+ }
332
+
333
+ _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
334
+ }
335
+ });
336
+ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/error', 'ember-metal/logger', 'ember-metal/environment', 'ember-debug/deprecate', 'ember-debug/warn', 'ember-debug/is-plain-function', 'ember-debug/handlers'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalFeatures, _emberMetalError, _emberMetalLogger, _emberMetalEnvironment, _emberDebugDeprecate, _emberDebugWarn, _emberDebugIsPlainFunction, _emberDebugHandlers) {
538
337
  'use strict';
539
338
 
540
- exports.registerHandler = registerHandler;
541
- exports.invoke = invoke;
542
- var HANDLERS = {};
339
+ exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
340
+
341
+ /**
342
+ @module ember
343
+ @submodule ember-debug
344
+ */
345
+
346
+ /**
347
+ @class Ember
348
+ @public
349
+ */
350
+
351
+ /**
352
+ Define an assertion that will throw an exception if the condition is not
353
+ met. Ember build tools will remove any calls to `Ember.assert()` when
354
+ doing a production build. Example:
355
+
356
+ ```javascript
357
+ // Test for truthiness
358
+ Ember.assert('Must pass a valid object', obj);
359
+
360
+ // Fail unconditionally
361
+ Ember.assert('This code path should never be run');
362
+ ```
363
+
364
+ @method assert
365
+ @param {String} desc A description of the assertion. This will become
366
+ the text of the Error thrown if the assertion fails.
367
+ @param {Boolean} test Must be truthy for the assertion to pass. If
368
+ falsy, an exception will be thrown.
369
+ @public
370
+ */
371
+ _emberMetalDebug.setDebugFunction('assert', function assert(desc, test) {
372
+ var throwAssertion = undefined;
373
+
374
+ if (_emberDebugIsPlainFunction.default(test)) {
375
+ _emberMetalDebug.deprecate(_emberDebugHandlers.generateTestAsFunctionDeprecation('Ember.assert'), false, { id: 'ember-debug.deprecate-test-as-function', until: '2.5.0' });
376
+
377
+ throwAssertion = !test();
378
+ } else {
379
+ throwAssertion = !test;
380
+ }
381
+
382
+ if (throwAssertion) {
383
+ throw new _emberMetalError.default('Assertion Failed: ' + desc);
384
+ }
385
+ });
386
+
387
+ /**
388
+ Display a debug notice. Ember build tools will remove any calls to
389
+ `Ember.debug()` when doing a production build.
390
+
391
+ ```javascript
392
+ Ember.debug('I\'m a debug notice!');
393
+ ```
394
+
395
+ @method debug
396
+ @param {String} message A debug message to display.
397
+ @public
398
+ */
399
+ _emberMetalDebug.setDebugFunction('debug', function debug(message) {
400
+ _emberMetalLogger.default.debug('DEBUG: ' + message);
401
+ });
402
+
403
+ /**
404
+ Display an info notice.
405
+
406
+ @method info
407
+ @private
408
+ */
409
+ _emberMetalDebug.setDebugFunction('info', function info() {
410
+ _emberMetalLogger.default.info.apply(undefined, arguments);
411
+ });
412
+
413
+ /**
414
+ Alias an old, deprecated method with its new counterpart.
415
+
416
+ Display a deprecation warning with the provided message and a stack trace
417
+ (Chrome and Firefox only) when the assigned method is called.
418
+
419
+ Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
420
+ no warnings will be shown in production.
421
+
422
+ ```javascript
423
+ Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);
424
+ ```
425
+
426
+ @method deprecateFunc
427
+ @param {String} message A description of the deprecation.
428
+ @param {Object} [options] The options object for Ember.deprecate.
429
+ @param {Function} func The new function called to replace its deprecated counterpart.
430
+ @return {Function} a new function that wrapped the original function with a deprecation warning
431
+ @private
432
+ */
433
+ _emberMetalDebug.setDebugFunction('deprecateFunc', function deprecateFunc() {
434
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
435
+ args[_key] = arguments[_key];
436
+ }
437
+
438
+ if (args.length === 3) {
439
+ var _ret = (function () {
440
+ var message = args[0];
441
+ var options = args[1];
442
+ var func = args[2];
543
443
 
544
- exports.HANDLERS = HANDLERS;
545
- function normalizeTest(test) {
546
- return _emberDebugIsPlainFunction.default(test) ? test() : test;
547
- }
444
+ return {
445
+ v: function () {
446
+ _emberMetalDebug.deprecate(message, false, options);
447
+ return func.apply(this, arguments);
448
+ }
449
+ };
450
+ })();
548
451
 
549
- function registerHandler(type, callback) {
550
- var nextHandler = HANDLERS[type] || function () {};
452
+ if (typeof _ret === 'object') return _ret.v;
453
+ } else {
454
+ var _ret2 = (function () {
455
+ var message = args[0];
456
+ var func = args[1];
551
457
 
552
- HANDLERS[type] = function (message, options) {
553
- callback(message, options, nextHandler);
554
- };
555
- }
458
+ return {
459
+ v: function () {
460
+ _emberMetalDebug.deprecate(message);
461
+ return func.apply(this, arguments);
462
+ }
463
+ };
464
+ })();
556
465
 
557
- function invoke(type, message, test, options) {
558
- if (normalizeTest(test)) {
559
- return;
466
+ if (typeof _ret2 === 'object') return _ret2.v;
560
467
  }
468
+ });
561
469
 
562
- var handlerForType = HANDLERS[type];
470
+ /**
471
+ Run a function meant for debugging. Ember build tools will remove any calls to
472
+ `Ember.runInDebug()` when doing a production build.
473
+
474
+ ```javascript
475
+ Ember.runInDebug(() => {
476
+ Ember.Component.reopen({
477
+ didInsertElement() {
478
+ console.log("I'm happy");
479
+ }
480
+ });
481
+ });
482
+ ```
483
+
484
+ @method runInDebug
485
+ @param {Function} func The function to be executed.
486
+ @since 1.5.0
487
+ @public
488
+ */
489
+ _emberMetalDebug.setDebugFunction('runInDebug', function runInDebug(func) {
490
+ func();
491
+ });
563
492
 
564
- if (!handlerForType) {
565
- return;
566
- }
493
+ _emberMetalDebug.setDebugFunction('debugSeal', function debugSeal(obj) {
494
+ Object.seal(obj);
495
+ });
567
496
 
568
- if (handlerForType) {
569
- handlerForType(message, options);
570
- }
571
- }
572
- });
573
- enifed('ember-debug/is-plain-function', ['exports'], function (exports) {
574
- 'use strict';
497
+ _emberMetalDebug.setDebugFunction('deprecate', _emberDebugDeprecate.default);
498
+ _emberMetalDebug.setDebugFunction('warn', _emberDebugWarn.default);
499
+ /**
500
+ Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
501
+ any specific FEATURES flag is truthy.
502
+
503
+ This method is called automatically in debug canary builds.
504
+
505
+ @private
506
+ @method _warnIfUsingStrippedFeatureFlags
507
+ @return {void}
508
+ */
575
509
 
576
- exports.default = isPlainFunction;
510
+ function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
511
+ if (featuresWereStripped) {
512
+ _emberMetalDebug.warn('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_ALL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
513
+ _emberMetalDebug.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
577
514
 
578
- function isPlainFunction(test) {
579
- return typeof test === 'function' && test.PrototypeMixin === undefined;
515
+ for (var key in FEATURES) {
516
+ if (FEATURES.hasOwnProperty(key) && key !== 'isEnabled') {
517
+ _emberMetalDebug.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' });
518
+ }
519
+ }
520
+ }
580
521
  }
581
- });
582
- enifed('ember-debug/warn', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-debug/handlers'], function (exports, _emberMetalCore, _emberMetalLogger, _emberDebugHandlers) {
583
- 'use strict';
584
522
 
585
- var _slice = Array.prototype.slice;
586
- exports.registerHandler = registerHandler;
587
- exports.default = warn;
523
+ if (!_emberMetalCore.default.testing) {
524
+ // Complain if they're using FEATURE flags in builds other than canary
525
+ _emberMetalFeatures.FEATURES['features-stripped-test'] = true;
526
+ var featuresWereStripped = true;
588
527
 
589
- function registerHandler(handler) {
590
- _emberDebugHandlers.registerHandler('warn', handler);
591
- }
528
+ delete _emberMetalFeatures.FEATURES['features-stripped-test'];
529
+ _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, featuresWereStripped);
592
530
 
593
- registerHandler(function logWarning(message, options) {
594
- _emberMetalLogger.default.warn('WARNING: ' + message);
595
- if ('trace' in _emberMetalLogger.default) {
596
- _emberMetalLogger.default.trace();
597
- }
598
- });
531
+ // Inform the developer about the Ember Inspector if not installed.
532
+ var isFirefox = _emberMetalEnvironment.default.isFirefox;
533
+ var isChrome = _emberMetalEnvironment.default.isChrome;
599
534
 
600
- var missingOptionsDeprecation = 'When calling `Ember.warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
601
- exports.missingOptionsDeprecation = missingOptionsDeprecation;
602
- var missingOptionsIdDeprecation = 'When calling `Ember.warn` you must provide `id` in options.';
535
+ if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
536
+ window.addEventListener('load', function () {
537
+ if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {
538
+ var downloadURL;
603
539
 
604
- exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
605
- /**
606
- @module ember
607
- @submodule ember-debug
608
- */
540
+ if (isChrome) {
541
+ downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
542
+ } else if (isFirefox) {
543
+ downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
544
+ }
609
545
 
546
+ _emberMetalDebug.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
547
+ }
548
+ }, false);
549
+ }
550
+ }
610
551
  /**
611
- Display a warning with the provided message. Ember build tools will
612
- remove any calls to `Ember.warn()` when doing a production build.
613
-
614
- @method warn
615
- @param {String} message A warning to display.
616
- @param {Boolean} test An optional boolean. If falsy, the warning
617
- will be displayed.
618
- @param {Object} options An ojbect that can be used to pass a unique
619
- `id` for this warning. The `id` can be used by Ember debugging tools
620
- to change the behavior (raise, log, or silence) for that specific warning.
621
- The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"
622
- @for Ember
623
552
  @public
553
+ @class Ember.Debug
624
554
  */
555
+ _emberMetalCore.default.Debug = {};
625
556
 
626
- function warn(message, test, options) {
627
- if (!options) {
628
- _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, {
629
- id: 'ember-debug.warn-options-missing',
630
- until: '3.0.0',
631
- url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
632
- });
633
- }
634
-
635
- if (options && !options.id) {
636
- _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, {
637
- id: 'ember-debug.warn-id-missing',
638
- until: '3.0.0',
639
- url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
640
- });
557
+ /**
558
+ Allows for runtime registration of handler functions that override the default deprecation behavior.
559
+ Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
560
+ The following example demonstrates its usage by registering a handler that throws an error if the
561
+ message contains the word "should", otherwise defers to the default handler.
562
+ ```javascript
563
+ Ember.Debug.registerDeprecationHandler((message, options, next) => {
564
+ if (message.indexOf('should') !== -1) {
565
+ throw new Error(`Deprecation message with should: ${message}`);
566
+ } else {
567
+ // defer to whatever handler was registered before this one
568
+ next(message, options);
569
+ }
641
570
  }
642
-
643
- _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
644
- }
645
- });
646
- enifed('ember-testing', ['exports', 'ember-metal/core', 'ember-testing/initializers', 'ember-testing/support', 'ember-testing/setup_for_testing', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit', 'ember-testing/helpers'], function (exports, _emberMetalCore, _emberTestingInitializers, _emberTestingSupport, _emberTestingSetup_for_testing, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit, _emberTestingHelpers) {
647
- 'use strict';
648
-
649
- // adds helpers to helpers object in Test
650
-
571
+ ```
572
+ The handler function takes the following arguments:
573
+ <ul>
574
+ <li> <code>message</code> - The message received from the deprecation call. </li>
575
+ <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
576
+ <ul>
577
+ <li> <code>id</code> - an id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
578
+ <li> <code>until</code> - is the version number Ember the feature and deprecation will be removed in.</li>
579
+ </ul>
580
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
581
+ </ul>
582
+ @public
583
+ @static
584
+ @method registerDeprecationHandler
585
+ @param handler {Function} a function to handle deprecation calls
586
+ */
587
+ _emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
651
588
  /**
652
- @module ember
653
- @submodule ember-testing
589
+ Allows for runtime registration of handler functions that override the default warning behavior.
590
+ Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
591
+ The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
592
+ default warning behavior.
593
+ ```javascript
594
+ // next is not called, so no warnings get the default behavior
595
+ Ember.Debug.registerWarnHandler(() => {});
596
+ ```
597
+ The handler function takes the following arguments:
598
+ <ul>
599
+ <li> <code>message</code> - The message received from the warn call. </li>
600
+ <li> <code>options</code> - An object passed in with the warn call containing additional information including:</li>
601
+ <ul>
602
+ <li> <code>id</code> - an id of the warning in the form of <code>package-name.specific-warning</code>.</li>
603
+ </ul>
604
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
605
+ </ul>
606
+ @public
607
+ @static
608
+ @method registerWarnHandler
609
+ @param handler {Function} a function to handle warnings
654
610
  */
611
+ _emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
655
612
 
656
- _emberMetalCore.default.Test = _emberTestingTest.default;
657
- _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default;
658
- _emberMetalCore.default.Test.QUnitAdapter = _emberTestingAdaptersQunit.default;
659
- _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default;
613
+ /*
614
+ We are transitioning away from `ember.js` to `ember.debug.js` to make
615
+ it much clearer that it is only for local development purposes.
616
+
617
+ This flag value is changed by the tooling (by a simple string replacement)
618
+ so that if `ember.js` (which must be output for backwards compat reasons) is
619
+ used a nice helpful warning message will be printed out.
620
+ */
621
+ var runningNonEmberDebugJS = false;
622
+ exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
623
+ if (runningNonEmberDebugJS) {
624
+ _emberMetalDebug.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
625
+ }
660
626
  });
661
- // to setup initializer
662
- // to handle various edge cases
663
627
  enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) {
664
628
  'use strict';
665
629
 
@@ -742,7 +706,7 @@ enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapt
742
706
  }
743
707
  });
744
708
  });
745
- enifed('ember-testing/helpers', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/run_loop', 'ember-views/system/jquery', 'ember-testing/test', 'ember-runtime/ext/rsvp'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalError, _emberMetalRun_loop, _emberViewsSystemJquery, _emberTestingTest, _emberRuntimeExtRsvp) {
709
+ enifed('ember-testing/helpers', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/run_loop', 'ember-views/system/jquery', 'ember-testing/test', 'ember-runtime/ext/rsvp'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalError, _emberMetalRun_loop, _emberViewsSystemJquery, _emberTestingTest, _emberRuntimeExtRsvp) {
746
710
  'use strict';
747
711
 
748
712
  /**
@@ -773,7 +737,7 @@ enifed('ember-testing/helpers', ['exports', 'ember-metal/core', 'ember-metal/fea
773
737
 
774
738
  function pauseTest() {
775
739
  _emberTestingTest.default.adapter.asyncStart();
776
- return new _emberMetalCore.default.RSVP.Promise(function () {}, 'TestAdapter paused promise');
740
+ return new _emberRuntimeExtRsvp.default.Promise(function () {}, 'TestAdapter paused promise');
777
741
  }
778
742
 
779
743
  function focus(el) {
@@ -833,7 +797,7 @@ enifed('ember-testing/helpers', ['exports', 'ember-metal/core', 'ember-metal/fea
833
797
  var $el = app.testHelpers.findWithAssert(selector, context);
834
798
  var type = $el.prop('type');
835
799
 
836
- _emberMetalCore.default.assert('To check \'' + selector + '\', the input must be a checkbox', type === 'checkbox');
800
+ _emberMetalDebug.assert('To check \'' + selector + '\', the input must be a checkbox', type === 'checkbox');
837
801
 
838
802
  if (!$el.prop('checked')) {
839
803
  app.testHelpers.click(selector, context);
@@ -846,7 +810,7 @@ enifed('ember-testing/helpers', ['exports', 'ember-metal/core', 'ember-metal/fea
846
810
  var $el = app.testHelpers.findWithAssert(selector, context);
847
811
  var type = $el.prop('type');
848
812
 
849
- _emberMetalCore.default.assert('To uncheck \'' + selector + '\', the input must be a checkbox', type === 'checkbox');
813
+ _emberMetalDebug.assert('To uncheck \'' + selector + '\', the input must be a checkbox', type === 'checkbox');
850
814
 
851
815
  if ($el.prop('checked')) {
852
816
  app.testHelpers.click(selector, context);
@@ -1339,7 +1303,7 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember
1339
1303
  });
1340
1304
 
1341
1305
  // import Test from "ember-testing/test"; // ES6TODO: fix when cycles are supported
1342
- enifed('ember-testing/support', ['exports', 'ember-metal/core', 'ember-views/system/jquery', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberViewsSystemJquery, _emberMetalEnvironment) {
1306
+ enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/system/jquery', 'ember-metal/environment'], function (exports, _emberMetalDebug, _emberViewsSystemJquery, _emberMetalEnvironment) {
1343
1307
  'use strict';
1344
1308
 
1345
1309
  /**
@@ -1386,12 +1350,12 @@ enifed('ember-testing/support', ['exports', 'ember-metal/core', 'ember-views/sys
1386
1350
 
1387
1351
  // Try again to verify that the patch took effect or blow up.
1388
1352
  testCheckboxClick(function () {
1389
- _emberMetalCore.default.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
1353
+ _emberMetalDebug.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
1390
1354
  });
1391
1355
  });
1392
1356
  }
1393
1357
  });
1394
- enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-runtime/ext/rsvp', 'ember-testing/setup_for_testing', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberRuntimeExtRsvp, _emberTestingSetup_for_testing, _emberApplicationSystemApplication) {
1358
+ enifed('ember-testing/test', ['exports', 'ember-metal/run_loop', 'ember-runtime/ext/rsvp', 'ember-testing/setup_for_testing', 'ember-application/system/application', 'ember-runtime/system/native_array'], function (exports, _emberMetalRun_loop, _emberRuntimeExtRsvp, _emberTestingSetup_for_testing, _emberApplicationSystemApplication, _emberRuntimeSystemNative_array) {
1395
1359
  'use strict';
1396
1360
 
1397
1361
  /**
@@ -1603,7 +1567,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1603
1567
  context = null;
1604
1568
  }
1605
1569
  if (!this.waiters) {
1606
- this.waiters = _emberMetalCore.default.A();
1570
+ this.waiters = _emberRuntimeSystemNative_array.A();
1607
1571
  }
1608
1572
  this.waiters.push([context, callback]);
1609
1573
  },
@@ -1624,7 +1588,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1624
1588
  callback = context;
1625
1589
  context = null;
1626
1590
  }
1627
- this.waiters = _emberMetalCore.default.A(this.waiters.filter(function (elt) {
1591
+ this.waiters = _emberRuntimeSystemNative_array.A(this.waiters.filter(function (elt) {
1628
1592
  return !(elt[0] === context && elt[1] === callback);
1629
1593
  }));
1630
1594
  }
@@ -1882,6 +1846,23 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1882
1846
 
1883
1847
  exports.default = Test;
1884
1848
  });
1849
+ enifed('ember-testing', ['exports', 'ember-metal/core', 'ember-testing/initializers', 'ember-testing/support', 'ember-testing/setup_for_testing', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit', 'ember-testing/helpers'], function (exports, _emberMetalCore, _emberTestingInitializers, _emberTestingSupport, _emberTestingSetup_for_testing, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit, _emberTestingHelpers) {
1850
+ 'use strict';
1851
+
1852
+ // adds helpers to helpers object in Test
1853
+
1854
+ /**
1855
+ @module ember
1856
+ @submodule ember-testing
1857
+ */
1858
+
1859
+ _emberMetalCore.default.Test = _emberTestingTest.default;
1860
+ _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default;
1861
+ _emberMetalCore.default.Test.QUnitAdapter = _emberTestingAdaptersQunit.default;
1862
+ _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default;
1863
+ });
1864
+ // to setup initializer
1865
+ // to handle various edge cases
1885
1866
  requireModule("ember-testing");
1886
1867
 
1887
- })();
1868
+ }());