handlebars.runtime.js in handlebars-source-3.0.3 vs handlebars.runtime.js in handlebars-source-3.0.4
- old
+ new
@@ -1,8 +1,8 @@
/*!
- handlebars v3.0.3
+ handlebars v3.0.4
Copyright (C) 2011-2014 by Yehuda Katz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,11 +26,11 @@
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
- define(factory);
+ define([], factory);
else if(typeof exports === 'object')
exports["Handlebars"] = factory();
else
root["Handlebars"] = factory();
})(this, function() {
@@ -76,52 +76,54 @@
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
- var _interopRequireWildcard = __webpack_require__(7)['default'];
+ var _interopRequireWildcard = __webpack_require__(1)['default'];
+ var _interopRequireDefault = __webpack_require__(2)['default'];
+
exports.__esModule = true;
- var _import = __webpack_require__(1);
+ var _handlebarsBase = __webpack_require__(3);
- var base = _interopRequireWildcard(_import);
+ var base = _interopRequireWildcard(_handlebarsBase);
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
- var _SafeString = __webpack_require__(2);
+ var _handlebarsSafeString = __webpack_require__(6);
- var _SafeString2 = _interopRequireWildcard(_SafeString);
+ var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
- var _Exception = __webpack_require__(3);
+ var _handlebarsException = __webpack_require__(5);
- var _Exception2 = _interopRequireWildcard(_Exception);
+ var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
- var _import2 = __webpack_require__(4);
+ var _handlebarsUtils = __webpack_require__(4);
- var Utils = _interopRequireWildcard(_import2);
+ var Utils = _interopRequireWildcard(_handlebarsUtils);
- var _import3 = __webpack_require__(5);
+ var _handlebarsRuntime = __webpack_require__(7);
- var runtime = _interopRequireWildcard(_import3);
+ var runtime = _interopRequireWildcard(_handlebarsRuntime);
- var _noConflict = __webpack_require__(6);
+ var _handlebarsNoConflict = __webpack_require__(8);
- var _noConflict2 = _interopRequireWildcard(_noConflict);
+ var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
function create() {
var hb = new base.HandlebarsEnvironment();
Utils.extend(hb, base);
- hb.SafeString = _SafeString2['default'];
- hb.Exception = _Exception2['default'];
+ hb.SafeString = _handlebarsSafeString2['default'];
+ hb.Exception = _handlebarsException2['default'];
hb.Utils = Utils;
hb.escapeExpression = Utils.escapeExpression;
hb.VM = runtime;
hb.template = function (spec) {
@@ -132,36 +134,77 @@
}
var inst = create();
inst.create = create;
- _noConflict2['default'](inst);
+ _handlebarsNoConflict2['default'](inst);
inst['default'] = inst;
exports['default'] = inst;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 1 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports) {
+ "use strict";
+
+ exports["default"] = function (obj) {
+ if (obj && obj.__esModule) {
+ return obj;
+ } else {
+ var newObj = {};
+
+ if (obj != null) {
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
+ }
+ }
+
+ newObj["default"] = obj;
+ return newObj;
+ }
+ };
+
+ exports.__esModule = true;
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports) {
+
+ "use strict";
+
+ exports["default"] = function (obj) {
+ return obj && obj.__esModule ? obj : {
+ "default": obj
+ };
+ };
+
+ exports.__esModule = true;
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __webpack_require__) {
+
'use strict';
- var _interopRequireWildcard = __webpack_require__(7)['default'];
+ var _interopRequireWildcard = __webpack_require__(1)['default'];
+ var _interopRequireDefault = __webpack_require__(2)['default'];
+
exports.__esModule = true;
exports.HandlebarsEnvironment = HandlebarsEnvironment;
exports.createFrame = createFrame;
- var _import = __webpack_require__(4);
+ var _utils = __webpack_require__(4);
- var Utils = _interopRequireWildcard(_import);
+ var Utils = _interopRequireWildcard(_utils);
- var _Exception = __webpack_require__(3);
+ var _exception = __webpack_require__(5);
- var _Exception2 = _interopRequireWildcard(_Exception);
+ var _exception2 = _interopRequireDefault(_exception);
var VERSION = '3.0.1';
exports.VERSION = VERSION;
var COMPILER_REVISION = 6;
@@ -195,11 +238,11 @@
log: log,
registerHelper: function registerHelper(name, fn) {
if (toString.call(name) === objectType) {
if (fn) {
- throw new _Exception2['default']('Arg not supported with multiple helpers');
+ throw new _exception2['default']('Arg not supported with multiple helpers');
}
Utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
@@ -211,28 +254,28 @@
registerPartial: function registerPartial(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
- throw new _Exception2['default']('Attempting to register a partial as undefined');
+ throw new _exception2['default']('Attempting to register a partial as undefined');
}
this.partials[name] = partial;
}
},
unregisterPartial: function unregisterPartial(name) {
delete this.partials[name];
}
};
function registerDefaultHelpers(instance) {
- instance.registerHelper('helperMissing', function () {
+ instance.registerHelper('helperMissing', function () /* [args, ]options */{
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
- throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
+ throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}
});
instance.registerHelper('blockHelperMissing', function (context, options) {
var inverse = options.inverse,
@@ -263,11 +306,11 @@
}
});
instance.registerHelper('each', function (context, options) {
if (!options) {
- throw new _Exception2['default']('Must pass iterator to #each');
+ throw new _exception2['default']('Must pass iterator to #each');
}
var fn = options.fn,
inverse = options.inverse,
i = 0,
@@ -415,100 +458,35 @@
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
}
- /* [args, ]options */
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
- // Build out our basic SafeString type
- function SafeString(string) {
- this.string = string;
- }
-
- SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
- return '' + this.string;
- };
-
- exports['default'] = SafeString;
- module.exports = exports['default'];
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
-
- function Exception(message, node) {
- var loc = node && node.loc,
- line = undefined,
- column = undefined;
- if (loc) {
- line = loc.start.line;
- column = loc.start.column;
-
- message += ' - ' + line + ':' + column;
- }
-
- var tmp = Error.prototype.constructor.call(this, message);
-
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
- for (var idx = 0; idx < errorProps.length; idx++) {
- this[errorProps[idx]] = tmp[errorProps[idx]];
- }
-
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, Exception);
- }
-
- if (loc) {
- this.lineNumber = line;
- this.column = column;
- }
- }
-
- Exception.prototype = new Error();
-
- exports['default'] = Exception;
- module.exports = exports['default'];
-
-/***/ },
+/***/ }),
/* 4 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports) {
'use strict';
exports.__esModule = true;
exports.extend = extend;
-
- // Older IE versions do not directly support indexOf so we must implement our own, sadly.
exports.indexOf = indexOf;
exports.escapeExpression = escapeExpression;
exports.isEmpty = isEmpty;
exports.blockParams = blockParams;
exports.appendContextPath = appendContextPath;
var escape = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
- '\'': ''',
- '`': '`'
+ "'": ''',
+ '`': '`',
+ '=': '='
};
- var badChars = /[&<>"'`]/g,
- possible = /[&<>"'`]/;
+ var badChars = /[&<>"'`=]/g,
+ possible = /[&<>"'`=]/;
function escapeChar(chr) {
return escape[chr];
}
@@ -545,12 +523,15 @@
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
var isArray = Array.isArray || function (value) {
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
- };exports.isArray = isArray;
+ };
+ exports.isArray = isArray;
+ // Older IE versions do not directly support indexOf so we must implement our own, sadly.
+
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
@@ -598,62 +579,123 @@
function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
-/***/ },
+/***/ }),
/* 5 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports) {
'use strict';
- var _interopRequireWildcard = __webpack_require__(7)['default'];
+ exports.__esModule = true;
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
+
+ function Exception(message, node) {
+ var loc = node && node.loc,
+ line = undefined,
+ column = undefined;
+ if (loc) {
+ line = loc.start.line;
+ column = loc.start.column;
+
+ message += ' - ' + line + ':' + column;
+ }
+
+ var tmp = Error.prototype.constructor.call(this, message);
+
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
+ for (var idx = 0; idx < errorProps.length; idx++) {
+ this[errorProps[idx]] = tmp[errorProps[idx]];
+ }
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, Exception);
+ }
+
+ if (loc) {
+ this.lineNumber = line;
+ this.column = column;
+ }
+ }
+
+ Exception.prototype = new Error();
+
+ exports['default'] = Exception;
+ module.exports = exports['default'];
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports) {
+
+ // Build out our basic SafeString type
+ 'use strict';
+
exports.__esModule = true;
- exports.checkRevision = checkRevision;
+ function SafeString(string) {
+ this.string = string;
+ }
- // TODO: Remove this line and break up compilePartial
+ SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
+ return '' + this.string;
+ };
+ exports['default'] = SafeString;
+ module.exports = exports['default'];
+
+/***/ }),
+/* 7 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = __webpack_require__(1)['default'];
+
+ var _interopRequireDefault = __webpack_require__(2)['default'];
+
+ exports.__esModule = true;
+ exports.checkRevision = checkRevision;
exports.template = template;
exports.wrapProgram = wrapProgram;
exports.resolvePartial = resolvePartial;
exports.invokePartial = invokePartial;
exports.noop = noop;
- var _import = __webpack_require__(4);
+ var _utils = __webpack_require__(4);
- var Utils = _interopRequireWildcard(_import);
+ var Utils = _interopRequireWildcard(_utils);
- var _Exception = __webpack_require__(3);
+ var _exception = __webpack_require__(5);
- var _Exception2 = _interopRequireWildcard(_Exception);
+ var _exception2 = _interopRequireDefault(_exception);
- var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(1);
+ var _base = __webpack_require__(3);
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
- currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;
+ currentRevision = _base.COMPILER_REVISION;
if (compilerRevision !== currentRevision) {
if (compilerRevision < currentRevision) {
- var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
- compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
- throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
+ var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
+ compilerVersions = _base.REVISION_CHANGES[compilerRevision];
+ throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
} else {
// Use the embedded version info since the runtime doesn't know about this revision yet
- throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
+ throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
}
}
}
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
- throw new _Exception2['default']('No environment passed to template');
+ throw new _exception2['default']('No environment passed to template');
}
if (!templateSpec || !templateSpec.main) {
- throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
+ throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
}
// Note: Using env.VM references rather than local var references throughout this section to allow
// for external users to override these as psuedo-supported APIs.
env.VM.checkRevision(templateSpec.compiler);
@@ -682,19 +724,19 @@
}
result = lines.join('\n');
}
return result;
} else {
- throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
+ throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
}
// Just add water
var container = {
strict: function strict(obj, name) {
if (!(name in obj)) {
- throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
+ throw new _exception2['default']('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function lookup(depths, name) {
var len = depths.length;
@@ -746,11 +788,11 @@
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
function ret(context) {
- var options = arguments[1] === undefined ? {} : arguments[1];
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var data = options.data;
ret._setup(options);
if (!options.partial && templateSpec.useData) {
@@ -779,24 +821,24 @@
}
};
ret._child = function (i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
- throw new _Exception2['default']('must pass block params');
+ throw new _exception2['default']('must pass block params');
}
if (templateSpec.useDepths && !depths) {
- throw new _Exception2['default']('must pass parent depths');
+ throw new _exception2['default']('must pass parent depths');
}
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context) {
- var options = arguments[1] === undefined ? {} : arguments[1];
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
}
prog.program = i;
prog.depth = depths ? depths.length : 0;
@@ -817,11 +859,11 @@
function invokePartial(partial, context, options) {
options.partial = true;
if (partial === undefined) {
- throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
+ throw new _exception2['default']('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);
}
}
@@ -829,24 +871,24 @@
return '';
}
function initData(context, data) {
if (!data || !('root' in data)) {
- data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
+ data = data ? _base.createFrame(data) : {};
data.root = context;
}
return data;
}
-/***/ },
-/* 6 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ }),
+/* 8 */
+/***/ (function(module, exports) {
- /* WEBPACK VAR INJECTION */(function(global) {'use strict';
+ /* WEBPACK VAR INJECTION */(function(global) {/*global window */
+ 'use strict';
exports.__esModule = true;
- /*global window */
exports['default'] = function (Handlebars) {
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
@@ -859,23 +901,9 @@
};
module.exports = exports['default'];
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- "use strict";
-
- exports["default"] = function (obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- };
-
- exports.__esModule = true;
-
-/***/ }
+/***/ })
/******/ ])
});
;
\ No newline at end of file