diff options
Diffstat (limited to 'node_modules/handlebars/lib')
7 files changed, 29 insertions, 22 deletions
diff --git a/node_modules/handlebars/lib/handlebars/base.js b/node_modules/handlebars/lib/handlebars/base.js index 155e7ca04..d0ad13310 100644 --- a/node_modules/handlebars/lib/handlebars/base.js +++ b/node_modules/handlebars/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.0.6'; +export const VERSION = '4.0.10'; export const COMPILER_REVISION = 7; export const REVISION_CHANGES = { diff --git a/node_modules/handlebars/lib/handlebars/compiler/compiler.js b/node_modules/handlebars/lib/handlebars/compiler/compiler.js index 987d0d459..47107cc5c 100644 --- a/node_modules/handlebars/lib/handlebars/compiler/compiler.js +++ b/node_modules/handlebars/lib/handlebars/compiler/compiler.js @@ -1,7 +1,7 @@ /* eslint-disable new-cap */ import Exception from '../exception'; -import {isArray, indexOf} from '../utils'; +import {isArray, indexOf, extend} from '../utils'; import AST from './ast'; const slice = [].slice; @@ -70,7 +70,7 @@ Compiler.prototype = { for (let name in knownHelpers) { /* istanbul ignore else */ if (name in knownHelpers) { - options.knownHelpers[name] = knownHelpers[name]; + this.options.knownHelpers[name] = knownHelpers[name]; } } } @@ -488,6 +488,7 @@ export function compile(input, options = {}, env) { throw new Exception('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); } + options = extend({}, options); if (!('data' in options)) { options.data = true; } diff --git a/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js b/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js index ec8911761..bf4be8af9 100644 --- a/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js +++ b/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js @@ -987,7 +987,7 @@ JavaScriptCompiler.prototype = { let params = [], paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); let foundHelper = this.nameLookup('helpers', name, 'helper'), - callContext = this.aliasable(`${this.contextName(0)} != null ? ${this.contextName(0)} : {}`); + callContext = this.aliasable(`${this.contextName(0)} != null ? ${this.contextName(0)} : (container.nullContext || {})`); return { params: params, diff --git a/node_modules/handlebars/lib/handlebars/compiler/parser.js b/node_modules/handlebars/lib/handlebars/compiler/parser.js index 04fe6ae3a..5b5ae2b20 100644 --- a/node_modules/handlebars/lib/handlebars/compiler/parser.js +++ b/node_modules/handlebars/lib/handlebars/compiler/parser.js @@ -1,4 +1,4 @@ -/* istanbul ignore next */ +// File ignored in coverage tests via setting in .istanbul.yml /* Jison generated parser */ var handlebars = (function(){ var parser = {trace: function trace() { }, @@ -619,5 +619,4 @@ return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser; -})();exports.__esModule = true; -exports['default'] = handlebars; +})();export default handlebars; diff --git a/node_modules/handlebars/lib/handlebars/exception.js b/node_modules/handlebars/lib/handlebars/exception.js index 08ae531aa..b9a5557b6 100644 --- a/node_modules/handlebars/lib/handlebars/exception.js +++ b/node_modules/handlebars/lib/handlebars/exception.js @@ -31,7 +31,10 @@ function Exception(message, node) { // Work around issue under safari where we can't directly set the column value /* istanbul ignore next */ if (Object.defineProperty) { - Object.defineProperty(this, 'column', {value: column}); + Object.defineProperty(this, 'column', { + value: column, + enumerable: true + }); } else { this.column = column; } diff --git a/node_modules/handlebars/lib/handlebars/runtime.js b/node_modules/handlebars/lib/handlebars/runtime.js index 103b5afab..3884e88c8 100644 --- a/node_modules/handlebars/lib/handlebars/runtime.js +++ b/node_modules/handlebars/lib/handlebars/runtime.js @@ -124,6 +124,8 @@ export function template(templateSpec, env) { return obj; }, + // An empty object to use as replacement for null-contexts + nullContext: Object.seal({}), noop: env.VM.noop, compilerInfo: templateSpec.compiler @@ -187,7 +189,7 @@ export function template(templateSpec, env) { export function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { function prog(context, options = {}) { let currentDepths = depths; - if (depths && context != depths[0]) { + if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { currentDepths = [context].concat(depths); } @@ -210,12 +212,7 @@ export function wrapProgram(container, i, fn, data, declaredBlockParams, blockPa export function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { - let data = options.data; - while (data['partial-block'] === noop) { - data = data._parent; - } - partial = data['partial-block']; - data['partial-block'] = noop; + partial = options.data['partial-block']; } else { partial = options.partials[options.name]; } @@ -228,6 +225,8 @@ export function resolvePartial(partial, context, options) { } export function invokePartial(partial, context, options) { + // Use the current closure context to save the partial-block if this partial + const currentPartialBlock = options.data && options.data['partial-block']; options.partial = true; if (options.ids) { options.data.contextPath = options.ids[0] || options.data.contextPath; @@ -236,10 +235,18 @@ export function invokePartial(partial, context, options) { let partialBlock; if (options.fn && options.fn !== noop) { options.data = createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); + // Wrapper function to get access to currentPartialBlock from the closure + let fn = options.fn; + partialBlock = options.data['partial-block'] = function partialBlockWrapper(context, options = {}) { + + // Restore the partial-block from the closure for the execution of the block + // i.e. the part inside the block of the partial call. + options.data = createFrame(options.data); + options.data['partial-block'] = currentPartialBlock; + return fn(context, options); + }; + if (fn.partials) { + options.partials = Utils.extend({}, options.partials, fn.partials); } } diff --git a/node_modules/handlebars/lib/precompiler.js b/node_modules/handlebars/lib/precompiler.js index a20d1419d..6ba3800cb 100644 --- a/node_modules/handlebars/lib/precompiler.js +++ b/node_modules/handlebars/lib/precompiler.js @@ -250,9 +250,6 @@ module.exports.cli = function(opts) { outSourceMap: opts.map, inSourceMap: JSON.parse(output.map) }); - if (opts.map) { - output.code += '\n//# sourceMappingURL=' + opts.map + '\n'; - } } if (opts.map) { |