dist/ember-template-compiler.js in ember-source-2.18.0 vs dist/ember-template-compiler.js in ember-source-2.18.1
- old
+ new
@@ -4,11 +4,11 @@
* @copyright Copyright 2011-2017 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.18.0
+ * @version 2.18.1
*/
/*global process */
var enifed, requireModule, Ember;
var mainContext = this; // Used in ember-environment/lib/global.js
@@ -5228,33 +5228,50 @@
};
}
return this._setTimeout(fn, executeAt);
};
- Backburner.prototype.throttle = function (target, method) /*, ...args, wait, [immediate] */{
+ Backburner.prototype.throttle = function (targetOrThisArgOrMethod) {
var _this2 = this,
_len4,
args,
_key4;
- for (_len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
- args[_key4 - 2] = arguments[_key4];
- }
-
- var immediate = args.pop();
+ var target = void 0;
+ var method = void 0;
+ var immediate = void 0;
var isImmediate = void 0;
var wait = void 0;
- if (isCoercableNumber(immediate)) {
- wait = immediate;
+
+ for (_len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
+ args[_key4 - 1] = arguments[_key4];
+ }
+
+ if (args.length === 1) {
+ method = targetOrThisArgOrMethod;
+ wait = args.pop();
+ target = null;
isImmediate = true;
} else {
- wait = args.pop();
- isImmediate = immediate === true;
+ target = targetOrThisArgOrMethod;
+ method = args.shift();
+ immediate = args.pop();
+ if (isString(method)) {
+ method = target[method];
+ } else if (!isFunction(method)) {
+ args.unshift(method);
+ method = target;
+ target = null;
+ }
+ if (isCoercableNumber(immediate)) {
+ wait = immediate;
+ isImmediate = true;
+ } else {
+ wait = args.pop();
+ isImmediate = immediate === true;
+ }
}
- if (isString(method)) {
- method = target[method];
- }
var index = findItem(target, method, this._throttlers);
if (index > -1) {
this._throttlers[index + 2] = args;
return this._throttlers[index + 3];
} // throttled
@@ -5276,34 +5293,51 @@
}
this._throttlers.push(target, method, args, timer);
return timer;
};
- Backburner.prototype.debounce = function (target, method) /* , wait, [immediate] */{
+ Backburner.prototype.debounce = function (targetOrThisArgOrMethod) {
var _this3 = this,
_len5,
args,
_key5,
timerId;
- for (_len5 = arguments.length, args = Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
- args[_key5 - 2] = arguments[_key5];
- }
-
- var immediate = args.pop();
+ var target = void 0;
+ var method = void 0;
+ var immediate = void 0;
var isImmediate = void 0;
var wait = void 0;
- if (isCoercableNumber(immediate)) {
- wait = immediate;
+
+ for (_len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
+ args[_key5 - 1] = arguments[_key5];
+ }
+
+ if (args.length === 1) {
+ method = targetOrThisArgOrMethod;
+ wait = args.pop();
+ target = null;
isImmediate = false;
} else {
- wait = args.pop();
- isImmediate = immediate === true;
+ target = targetOrThisArgOrMethod;
+ method = args.shift();
+ immediate = args.pop();
+ if (isString(method)) {
+ method = target[method];
+ } else if (!isFunction(method)) {
+ args.unshift(method);
+ method = target;
+ target = null;
+ }
+ if (isCoercableNumber(immediate)) {
+ wait = immediate;
+ isImmediate = false;
+ } else {
+ wait = args.pop();
+ isImmediate = immediate === true;
+ }
}
- if (isString(method)) {
- method = target[method];
- }
wait = parseInt(wait, 10);
// Remove debouncee
var index = findItem(target, method, this._debouncees);
if (index > -1) {
timerId = this._debouncees[index + 3];
@@ -16474,10 +16508,11 @@
exports.default = function (_options) {
var options = (0, _emberUtils.assign)({ meta: {} }, _options),
meta,
potententialPugins,
+ providedPlugins,
pluginsToAdd;
// move `moduleName` into `meta` property
if (options.moduleName) {
meta = options.meta;
@@ -16487,58 +16522,86 @@
if (!options.plugins) {
options.plugins = { ast: [].concat(USER_PLUGINS, _plugins.default) };
} else {
potententialPugins = [].concat(USER_PLUGINS, _plugins.default);
+ providedPlugins = options.plugins.ast.map(function (plugin) {
+ return wrapLegacyPluginIfNeeded(plugin);
+ });
pluginsToAdd = potententialPugins.filter(function (plugin) {
return options.plugins.ast.indexOf(plugin) === -1;
});
- options.plugins.ast = options.plugins.ast.slice().concat(pluginsToAdd);
+ options.plugins.ast = providedPlugins.concat(pluginsToAdd);
}
return options;
};
exports.registerPlugin = function (type, _plugin) {
if (type !== 'ast') {
throw new Error('Attempting to register ' + _plugin + ' as "' + type + '" which is not a valid Glimmer plugin type.');
}
- var plugin = void 0;
+ for (i = 0; i < USER_PLUGINS.length; i++) {
+ PLUGIN = USER_PLUGINS[i];
+
+ if (PLUGIN === _plugin || PLUGIN.__raw === _plugin) {
+ return;
+ }
+ }
+
+ var plugin = wrapLegacyPluginIfNeeded(_plugin),
+ i,
+ PLUGIN;
+
+ USER_PLUGINS = [plugin].concat(USER_PLUGINS);
+ };
+ exports.unregisterPlugin = function (type, PluginClass) {
+ if (type !== 'ast') {
+ throw new Error('Attempting to unregister ' + PluginClass + ' as "' + type + '" which is not a valid Glimmer plugin type.');
+ }
+
+ USER_PLUGINS = USER_PLUGINS.filter(function (plugin) {
+ return plugin !== PluginClass && plugin.__raw !== PluginClass;
+ });
+ };
+
+ var USER_PLUGINS = [];
+
+ function wrapLegacyPluginIfNeeded(_plugin) {
+ var plugin = _plugin;
if (_plugin.prototype && _plugin.prototype.transform) {
plugin = function (env) {
+ var pluginInstantiated = false;
+
return {
name: _plugin.constructor && _plugin.constructor.name,
visitors: {
Program: function (node) {
- var plugin = new _plugin(env);
+ var _plugin2;
- plugin.syntax = env.syntax;
+ if (!pluginInstantiated) {
- return plugin.transform(node);
+ pluginInstantiated = true;
+ _plugin2 = new _plugin(env);
+
+
+ _plugin2.syntax = env.syntax;
+
+ return _plugin2.transform(node);
+ }
}
}
};
};
- } else {
- plugin = _plugin;
- }
- USER_PLUGINS = [plugin].concat(USER_PLUGINS);
- };
- exports.removePlugin = function (type, PluginClass) {
- if (type !== 'ast') {
- throw new Error('Attempting to unregister ' + PluginClass + ' as "' + type + '" which is not a valid Glimmer plugin type.');
+ plugin.__raw = _plugin;
}
- USER_PLUGINS = USER_PLUGINS.filter(function (plugin) {
- return plugin !== PluginClass;
- });
- };
-
- var USER_PLUGINS = [];
+ return plugin;
+ }
});
enifed('ember-template-compiler/system/compile', ['exports', 'require', 'ember-template-compiler/system/precompile'], function (exports, _require2, _precompile) {
'use strict';
exports.default =
@@ -17342,10 +17405,10 @@
exports.EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER = FEATURES["ember-glimmer-detect-backtracking-rerender"];
});
enifed("ember/version", ["exports"], function (exports) {
"use strict";
- exports.default = "2.18.0";
+ exports.default = "2.18.1";
});
enifed("handlebars", ["exports"], function (exports) {
"use strict";
// File ignored in coverage tests via setting in .istanbul.yml