diff --git a/Gruntfile.js b/Gruntfile.js index 65e0b8f33..528c0af82 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -267,7 +267,7 @@ module.exports = function(grunt) { grunt.registerTask('bench', ['metrics']); - if (process.env.SAUCE_USERNAME) { + if (process.env.SAUCE_ACCESS_KEY) { grunt.registerTask('sauce', ['concat:tests', 'connect', 'saucelabs-mocha']); } else { grunt.registerTask('sauce', []); diff --git a/components/bower.json b/components/bower.json index ccebdef1b..f62ac8caf 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.7.1", + "version": "4.7.2", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 44747f7f4..078ea8693 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.7.1 + 4.7.2 handlebars.js Authors https://github.com/wycats/handlebars.js/blob/master/LICENSE https://github.com/wycats/handlebars.js/ diff --git a/components/package.json b/components/package.json index c296a32c2..0963613b1 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.7.1", + "version": "4.7.2", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 2aa3a62f5..40f2fc561 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -5,7 +5,7 @@ import { registerDefaultDecorators } from './decorators'; import logger from './logger'; import { resetLoggedProperties } from './internal/proto-access'; -export const VERSION = '4.7.1'; +export const VERSION = '4.7.2'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/lib/handlebars/internal/wrapHelper.js b/lib/handlebars/internal/wrapHelper.js index 0010eb8c2..29d65b033 100644 --- a/lib/handlebars/internal/wrapHelper.js +++ b/lib/handlebars/internal/wrapHelper.js @@ -1,4 +1,9 @@ export function wrapHelper(helper, transformOptionsFn) { + if (typeof helper !== 'function') { + // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 + // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. + return helper; + } let wrapper = function(/* dynamic arguments */) { const options = arguments[arguments.length - 1]; arguments[arguments.length - 1] = transformOptionsFn(options); diff --git a/package.json b/package.json index 5c289a2c2..8b6658e83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.7.1", + "version": "4.7.2", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ diff --git a/release-notes.md b/release-notes.md index 8e391a775..09ecc2a03 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,23 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.1...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.2...master) + +## v4.7.2 - January 13th, 2020 + +Bugfixes: + +- fix: don't wrap helpers that are not functions - 9d5aa36, #1639 + +Chore/Build: + +- chore: execute saucelabs-task only if access-key exists - a4fd391 + +Compatibility notes: + +- No breaking changes are to be expected + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.1...v4.7.2) ## v4.7.1 - January 12th, 2020 diff --git a/spec/regressions.js b/spec/regressions.js index 3a84dd7da..f6147ad6e 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -518,4 +518,13 @@ describe('Regressions', function() { sinon.restore(); }); }); + + describe("GH-1639: TypeError: Cannot read property 'apply' of undefined\" when handlebars version > 4.6.0 (undocumented, deprecated usage)", function() { + it('should treat undefined helpers like non-existing helpers', function() { + expectTemplate('{{foo}}') + .withHelper('foo', undefined) + .withInput({ foo: 'bar' }) + .toCompileTo('bar'); + }); + }); });