From 93444c58db259bb1e5073d4e815a5aab65440e33 Mon Sep 17 00:00:00 2001 From: Matt Hinchliffe Date: Tue, 24 Sep 2019 14:02:55 +0100 Subject: [PATCH 01/29] Ensure allowCallsToHelperMissing runtime option is optional in typings --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index bf8d1756..a1b1693e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -29,7 +29,7 @@ declare namespace Handlebars { decorators?: { [name: string]: Function }; data?: any; blockParams?: any[]; - allowCallsToHelperMissing: boolean; + allowCallsToHelperMissing?: boolean; } export interface HelperOptions { From 64ecb9ea84f691bac1427879c5088d01b46b4c7a Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 24 Sep 2019 22:28:52 +0200 Subject: [PATCH 02/29] add test for #1560 --- types/test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/test.ts b/types/test.ts index 9ecc2d16..72d6ff70 100644 --- a/types/test.ts +++ b/types/test.ts @@ -109,3 +109,5 @@ Handlebars.compile('test', { }); Handlebars.compile('test')({},{allowCallsToHelperMissing: true}); + +Handlebars.compile('test')({},{}); \ No newline at end of file From 12668388294ee8bb1c07c0d9d5c6ee083910f3a5 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 24 Sep 2019 23:45:09 +0200 Subject: [PATCH 03/29] do not break on precompiled templates from Handlebars >=4.0.0 <4.3.0 - The version-range above have compiler version 7 and precompiled templates expecte the (block) HelperMissing-functions in "helpers" and not in "container.hooks". - Handlebars now accepts precompiled templates of version 7. - If a precompiled template with version 7 is loaded, the (block)HelperMissing-functions are kept in "helpers" --- lib/handlebars/base.js | 1 + lib/handlebars/runtime.js | 36 +++++++++++++++++++++--------------- spec/regressions.js | 32 ++++++++++++++++++++++++++++++++ spec/runtime.js | 2 +- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 2703dafd..a327fc6c 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -6,6 +6,7 @@ import logger from './logger'; export const VERSION = '4.3.0'; export const COMPILER_REVISION = 8; +export const LAST_COMPATIBLE_COMPILER_REVISION = 7; export const REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index ce463046..763016de 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -1,23 +1,25 @@ import * as Utils from './utils'; import Exception from './exception'; -import {COMPILER_REVISION, createFrame, REVISION_CHANGES} from './base'; +import {COMPILER_REVISION, createFrame, LAST_COMPATIBLE_COMPILER_REVISION, REVISION_CHANGES} from './base'; import {moveHelperToHooks} from './helpers'; export function checkRevision(compilerInfo) { const compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = COMPILER_REVISION; - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - const runtimeVersions = REVISION_CHANGES[currentRevision], - compilerVersions = REVISION_CHANGES[compilerRevision]; - throw new Exception('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 Exception('Template was precompiled with a newer version of Handlebars than the current runtime. ' + - 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } + if (compilerRevision >= LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= COMPILER_REVISION) { + return; + } + + if (compilerRevision < LAST_COMPATIBLE_COMPILER_REVISION) { + const runtimeVersions = REVISION_CHANGES[currentRevision], + compilerVersions = REVISION_CHANGES[compilerRevision]; + throw new Exception('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 Exception('Template was precompiled with a newer version of Handlebars than the current runtime. ' + + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } } @@ -37,6 +39,9 @@ export function template(templateSpec, env) { // for external users to override these as pseudo-supported APIs. env.VM.checkRevision(templateSpec.compiler); + // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) + const templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; + function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); @@ -163,9 +168,10 @@ export function template(templateSpec, env) { } container.hooks = {}; - let keepHelper = options.allowCallsToHelperMissing; - moveHelperToHooks(container, 'helperMissing', keepHelper); - moveHelperToHooks(container, 'blockHelperMissing', keepHelper); + + let keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; + moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); + moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { container.helpers = options.helpers; diff --git a/spec/regressions.js b/spec/regressions.js index 1678d80c..a06360c2 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -291,4 +291,36 @@ describe('Regressions', function() { }; shouldCompileToWithPartials(string, [{}, {}, partials], true, 'template block partial block template'); }); + + describe('GH-1561: 4.3.x should still work with precompiled templates from 4.0.0 <= x < 4.3.0', function() { + + it('should compile and execute templates', function() { + var newHandlebarsInstance = Handlebars.create(); + + registerTemplate(newHandlebarsInstance); + newHandlebarsInstance.registerHelper('loud', function(value) { + return value.toUpperCase(); + }); + let result = newHandlebarsInstance.templates['test.hbs']({name: 'yehuda'}); + equals(result.trim(), 'YEHUDA'); + }); + + it('should call "helperMissing" if a helper is missing', function() { + var newHandlebarsInstance = Handlebars.create(); + + shouldThrow(() => { + registerTemplate(newHandlebarsInstance); + newHandlebarsInstance.templates['test.hbs']({}); + }, Handlebars.Exception, 'Missing helper: "loud"'); + }); + + // This is a only slightly modified precompiled templated from compiled with 4.2.1 + function registerTemplate(Handlebars) { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; + templates['test.hbs'] = template({'compiler': [7, '>= 4.0.0'], 'main': function(container, depth0, helpers, partials, data) { + return container.escapeExpression((helpers.loud || (depth0 && depth0.loud) || helpers.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}), (depth0 != null ? depth0.name : depth0), {'name': 'loud', 'hash': {}, 'data': data})) + + '\n\n'; + }, 'useData': true}); + } + }); }); diff --git a/spec/runtime.js b/spec/runtime.js index a4830ad0..3549640b 100644 --- a/spec/runtime.js +++ b/spec/runtime.js @@ -21,7 +21,7 @@ describe('runtime', function() { shouldThrow(function() { Handlebars.template({ main: {}, - compiler: [Handlebars.COMPILER_REVISION - 1] + compiler: [Handlebars.LAST_COMPATIBLE_COMPILER_REVISION - 1] }); }, Error, /Template was precompiled with an older version of Handlebars than the current runtime/); shouldThrow(function() { From c2a17c7b30009059743e3cb3c677d0adc2002775 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 25 Sep 2019 00:00:51 +0200 Subject: [PATCH 04/29] fix saucelabs tests (internet explorer) --- spec/regressions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/regressions.js b/spec/regressions.js index a06360c2..99042b5a 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -308,7 +308,7 @@ describe('Regressions', function() { it('should call "helperMissing" if a helper is missing', function() { var newHandlebarsInstance = Handlebars.create(); - shouldThrow(() => { + shouldThrow(function() { registerTemplate(newHandlebarsInstance); newHandlebarsInstance.templates['test.hbs']({}); }, Handlebars.Exception, 'Missing helper: "loud"'); From e3639e240755ef713e128e7c67d30443ea01b732 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 25 Sep 2019 00:18:02 +0200 Subject: [PATCH 05/29] fix saucelabs tests (internet explorer) --- spec/regressions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/regressions.js b/spec/regressions.js index 99042b5a..58db65bc 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -301,7 +301,7 @@ describe('Regressions', function() { newHandlebarsInstance.registerHelper('loud', function(value) { return value.toUpperCase(); }); - let result = newHandlebarsInstance.templates['test.hbs']({name: 'yehuda'}); + var result = newHandlebarsInstance.templates['test.hbs']({name: 'yehuda'}); equals(result.trim(), 'YEHUDA'); }); From 2d5579078b36734b7db7f65b24a1ce5340164f78 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 25 Sep 2019 00:31:48 +0200 Subject: [PATCH 06/29] Update release notes --- release-notes.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 8d11f07b..45c90a16 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,17 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.0...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.1...master) + +## v4.3.1 - September 25th, 2019 +Fixes: + +- do not break on precompiled templates from Handlebars >=4.0.0 <4.3.0 - 1266838, #1561 +- Ensure allowCallsToHelperMissing runtime option is optional in typings - 93444c5, 64ecb9e, #1560 + + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.0...v4.3.1) ## v4.3.0 - September 24th, 2019 Fixes: From 050cca0866b3496852d9b198141807c32e4dae81 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 25 Sep 2019 00:32:32 +0200 Subject: [PATCH 07/29] v4.3.1 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index 60e09e4d..f26015d4 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.0", + "version": "4.3.1", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index ff656b2e..7f708a58 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.3.0 + 4.3.1 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 a8cfd290..09278636 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.0", + "version": "4.3.1", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index a327fc6c..631f5b0f 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.3.0'; +export const VERSION = '4.3.1'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 6b56332c..f616e487 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.3.0", + "version": "4.3.1", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From 213c0bbe3c4bd83a534d67384e5afa0000347ff6 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Thu, 26 Sep 2019 23:55:14 +0200 Subject: [PATCH 08/29] Use Object.prototype.propertyIsEnumerable to check for constructors - context.propertyIsEnumerable can be replaced via __definedGetter__ - This is a fix specific to counter a known RCE exploit. Other fixes will follow. closes #1563 --- .../compiler/javascript-compiler.js | 36 +++++++++++-------- spec/security.js | 12 ++++++- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 1b9b2318..3491aad8 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -14,12 +14,20 @@ JavaScriptCompiler.prototype = { // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name/* , type*/) { if (name === 'constructor') { - return ['(', parent, '.propertyIsEnumerable(\'constructor\') ? ', parent, '.constructor : undefined', ')']; + return ['(', _isEnumerable(), '?', _actualLookup(), ' : undefined)']; } - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[', JSON.stringify(name), ']']; + return _actualLookup(); + + function _isEnumerable() { + return `Object.prototype.propertyIsEnumerable.call(${parent},'constructor')`; + } + + function _actualLookup() { + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return [parent, '.', name]; + } else { + return [parent, '[', JSON.stringify(name), ']']; + } } }, depthedLookup: function(name) { @@ -339,9 +347,9 @@ JavaScriptCompiler.prototype = { params.splice(1, 0, current); this.pushSource([ - 'if (!', this.lastHelper, ') { ', - current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), - '}']); + 'if (!', this.lastHelper, ') { ', + current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), + '}']); }, // [appendContent] @@ -686,16 +694,16 @@ JavaScriptCompiler.prototype = { if (!this.options.strict) { lookup[0] = '(helper = '; lookup.push( - ' != null ? helper : ', - this.aliasable('container.hooks.helperMissing') + ' != null ? helper : ', + this.aliasable('container.hooks.helperMissing') ); } this.push([ - '(', lookup, - (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),', - '(typeof helper === ', this.aliasable('"function"'), ' ? ', - this.source.functionCall('helper', 'call', helper.callParams), ' : helper))' + '(', lookup, + (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),', + '(typeof helper === ', this.aliasable('"function"'), ' ? ', + this.source.functionCall('helper', 'call', helper.callParams), ' : helper))' ]); }, diff --git a/spec/security.js b/spec/security.js index 4c092b1c..418541f6 100644 --- a/spec/security.js +++ b/spec/security.js @@ -33,7 +33,7 @@ describe('security issues', function() { }); }); - describe('GH-xxxx: Prevent explicit call of helperMissing-helpers', function() { + describe('GH-1558: Prevent explicit call of helperMissing-helpers', function() { if (!Handlebars.compile) { return; } @@ -88,4 +88,14 @@ describe('security issues', function() { }); }); }); + + describe('GH-1563', function() { + it('should not allow to access constructor after overriding via __defineGetter__', function() { + shouldCompileTo('{{__defineGetter__ "undefined" valueOf }}' + + '{{#with __lookupGetter__ }}' + + '{{__defineGetter__ "propertyIsEnumerable" (this.bind (this.bind 1)) }}' + + '{{constructor.name}}' + + '{{/with}}', {}, ''); + }); + }); }); From c5cbeac039de4a05113dbe1f5e14f29175228c78 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Thu, 26 Sep 2019 23:58:13 +0200 Subject: [PATCH 09/29] Update release notes --- release-notes.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 45c90a16..9c21c53b 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,15 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.1...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.2...master) + +## v4.3.2 - September 26th, 2019 +- Use Object.prototype.propertyIsEnumerable to check for constructors - 213c0bb, #1563 + +Compatibility notes: +- There are no breaking changes + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.1...v4.3.2) ## v4.3.1 - September 25th, 2019 Fixes: From 2357140c68d17cb4f8ab74431e8737de6b4b39b5 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Thu, 26 Sep 2019 23:58:48 +0200 Subject: [PATCH 10/29] v4.3.2 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index f26015d4..3a6ce534 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.1", + "version": "4.3.2", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 7f708a58..346e1174 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.3.1 + 4.3.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 09278636..1842c279 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.1", + "version": "4.3.2", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 631f5b0f..205978f4 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.3.1'; +export const VERSION = '4.3.2'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index f616e487..1ae2c833 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.3.1", + "version": "4.3.2", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From 8742bde70159559b0898d3c2c72eb4a2a1c6dd04 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Fri, 27 Sep 2019 00:09:04 +0200 Subject: [PATCH 11/29] fix test case for browsers that do not support __defineGetter__ --- spec/security.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/security.js b/spec/security.js index 418541f6..c50bda6d 100644 --- a/spec/security.js +++ b/spec/security.js @@ -91,6 +91,9 @@ describe('security issues', function() { describe('GH-1563', function() { it('should not allow to access constructor after overriding via __defineGetter__', function() { + if (({}).__defineGetter__ == null || ({}).__lookupGetter__ == null) { + return; // Browser does not support this exploit anyway + } shouldCompileTo('{{__defineGetter__ "undefined" valueOf }}' + '{{#with __lookupGetter__ }}' + '{{__defineGetter__ "propertyIsEnumerable" (this.bind (this.bind 1)) }}' + From 54f7e11b28d81852cfc2cdf9d75c013af989495b Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Fri, 27 Sep 2019 07:46:12 +0200 Subject: [PATCH 12/29] Update release notes --- release-notes.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 9c21c53b..1f8da4a7 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,13 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.2...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.3...master) + +## v4.3.3 - September 27th, 2019 + - fix test case for browsers that do not support __defineGetter__ - 8742bde + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.2...v4.3.3) ## v4.3.2 - September 26th, 2019 - Use Object.prototype.propertyIsEnumerable to check for constructors - 213c0bb, #1563 From e4738491b3e8db97aa9b4f9967f04093ceba1a1f Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Fri, 27 Sep 2019 07:46:55 +0200 Subject: [PATCH 13/29] v4.3.3 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index 3a6ce534..77ea1a51 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.2", + "version": "4.3.3", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 346e1174..0da82831 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.3.2 + 4.3.3 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 1842c279..3b544d7a 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.2", + "version": "4.3.3", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 205978f4..c047af8d 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.3.2'; +export const VERSION = '4.3.3'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 1ae2c833..5c115c30 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.3.2", + "version": "4.3.3", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From ff4d827c0974003fedadaef1073d7d873954514c Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sat, 28 Sep 2019 10:36:49 +0200 Subject: [PATCH 14/29] fix: harden "propertyIsEnumerable"-check - "container" is an internal object that is most likely not accessible through templateing (unlike the proto of "Object", which might be.) In order to prevent overriding this method, we use "propertyIsEnumerable" from the constructor. --- lib/handlebars/compiler/javascript-compiler.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 3491aad8..dec107e8 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -13,15 +13,13 @@ JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name/* , type*/) { + const isEnumerable = [ this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',"constructor")']; + if (name === 'constructor') { - return ['(', _isEnumerable(), '?', _actualLookup(), ' : undefined)']; + return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; } return _actualLookup(); - function _isEnumerable() { - return `Object.prototype.propertyIsEnumerable.call(${parent},'constructor')`; - } - function _actualLookup() { if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { return [parent, '.', name]; @@ -222,7 +220,6 @@ JavaScriptCompiler.prototype = { let aliasCount = 0; for (let alias in this.aliases) { // eslint-disable-line guard-for-in let node = this.aliases[alias]; - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { varDeclarations += ', alias' + (++aliasCount) + '=' + alias; node.children[0] = 'alias' + aliasCount; From b250b2d53af0c5e984eaaa912e5a6b93477d32dc Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sat, 28 Sep 2019 13:24:18 +0200 Subject: [PATCH 15/29] Update release notes --- release-notes.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 1f8da4a7..dec4f986 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,15 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.3...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.4...master) + +## v4.3.4 - September 28th, 2019 +- fix: harden "propertyIsEnumerable"-check - ff4d827 + +Compatibility notes: +- No incompatibilities are known. + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.3...v4.3.4) ## v4.3.3 - September 27th, 2019 - fix test case for browsers that do not support __defineGetter__ - 8742bde From c958cc89550ca411a78fefa426b0acee80c702eb Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sat, 28 Sep 2019 13:25:05 +0200 Subject: [PATCH 16/29] v4.3.4 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index 77ea1a51..9f8f5ec0 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.3", + "version": "4.3.4", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 0da82831..eb693b3c 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.3.3 + 4.3.4 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 3b544d7a..11d5e3b7 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.3", + "version": "4.3.4", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index c047af8d..31209034 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.3.3'; +export const VERSION = '4.3.4'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 5c115c30..788600ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.3.3", + "version": "4.3.4", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From cf7545ef5a5da07e4583c4c41a0191868e31c5ae Mon Sep 17 00:00:00 2001 From: antelle Date: Sun, 29 Sep 2019 14:57:47 +0200 Subject: [PATCH 17/29] Added support for iterable objects in {{#each}} helper (#1557) * Added support for iterable object in {{#each}} helper Currently {{#each}} helper supports either arrays, or objects, however nowadays you can define custom iterable objects by overriding a special method called Symbol.iterator, which results in empty result being rendered. * improved a test for iterables in {{#each}} returning empty result * #each helper: using ES5 instead of generator functions in tests * #each helper: using ES5 in the helper itself --- lib/handlebars/helpers/each.js | 10 ++++++++++ spec/builtins.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/lib/handlebars/helpers/each.js b/lib/handlebars/helpers/each.js index fb11903c..ce549b5c 100644 --- a/lib/handlebars/helpers/each.js +++ b/lib/handlebars/helpers/each.js @@ -49,6 +49,16 @@ export default function(instance) { execIteration(i, i, i === context.length - 1); } } + } else if (global.Symbol && context[global.Symbol.iterator]) { + const newContext = []; + const iterator = context[global.Symbol.iterator](); + for (let it = iterator.next(); !it.done; it = iterator.next()) { + newContext.push(it.value); + } + context = newContext; + for (let j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } } else { let priorKey; diff --git a/spec/builtins.js b/spec/builtins.js index ce6d8f4e..b29927f0 100644 --- a/spec/builtins.js +++ b/spec/builtins.js @@ -254,6 +254,37 @@ describe('builtin helpers', function() { template({}); }, handlebarsEnv.Exception, 'Must pass iterator to #each'); }); + + if (global.Symbol && global.Symbol.iterator) { + it('each on iterable', function() { + function Iterator(arr) { + this.arr = arr; + this.index = 0; + } + Iterator.prototype.next = function() { + var value = this.arr[this.index]; + var done = this.index === this.arr.length; + if (!done) { + this.index++; + } + return { value: value, done: done }; + }; + function Iterable(arr) { + this.arr = arr; + } + Iterable.prototype[global.Symbol.iterator] = function() { + return new Iterator(this.arr); + }; + var string = '{{#each goodbyes}}{{text}}! {{/each}}cruel {{world}}!'; + var goodbyes = new Iterable([{text: 'goodbye'}, {text: 'Goodbye'}, {text: 'GOODBYE'}]); + var goodbyesEmpty = new Iterable([]); + var hash = {goodbyes: goodbyes, world: 'world'}; + shouldCompileTo(string, hash, 'goodbye! Goodbye! GOODBYE! cruel world!', + 'each with array argument iterates over the contents when not empty'); + shouldCompileTo(string, {goodbyes: goodbyesEmpty, world: 'world'}, 'cruel world!', + 'each with array argument ignores the contents when empty'); + }); + } }); describe('#log', function() { From 8f6047cdfd045e8f65874b7178c36401c1d0f75f Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sun, 29 Sep 2019 15:28:36 +0200 Subject: [PATCH 18/29] Update release notes --- release-notes.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index dec4f986..c8d7c6d5 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,13 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.4...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.0...master) + +## v4.4.0 - September 29th, 2019 +- Added support for iterable objects in {{#each}} helper (#1557) - cf7545e + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.3.4...v4.4.0) ## v4.3.4 - September 28th, 2019 - fix: harden "propertyIsEnumerable"-check - ff4d827 From 059b33057925ebda96536421cfc7c4c75e5c61e3 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sun, 29 Sep 2019 15:29:13 +0200 Subject: [PATCH 19/29] v4.4.0 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index 9f8f5ec0..5d706f56 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.4", + "version": "4.4.0", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index eb693b3c..349fe4e8 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.3.4 + 4.4.0 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 11d5e3b7..326734da 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.3.4", + "version": "4.4.0", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 31209034..cf0df522 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.3.4'; +export const VERSION = '4.4.0'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 788600ce..78e414b2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.3.4", + "version": "4.4.0", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From c53f3403746f6a53fad919b27d0ebc9df995e6ee Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 21:46:16 +0200 Subject: [PATCH 20/29] chore: use @knappi/grunt-saucelabs instead of github-dependency - mostly because installing dependencies from github takes really long in this case. --- package-lock.json | 140 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 72 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e846200..d99846f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,79 @@ { "name": "handlebars", - "version": "4.1.2-0", + "version": "4.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { + "@knappi/grunt-saucelabs": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@knappi/grunt-saucelabs/-/grunt-saucelabs-9.0.1.tgz", + "integrity": "sha512-KmFjxwr5LuhS9ifFTMhcpXMpZ+2oNL5OZ5LlY6cXz4s3Mji8VSHGFucbpT/WjIGMt5YjEuqI69XfRK9bK42aRA==", + "dev": true, + "requires": { + "@knappi/sauce-tunnel": "^2.5.0", + "colors": "~1.1.2", + "lodash": "^4.17.11", + "q": "~1.4.1", + "requestretry": "~1.9.0", + "saucelabs": "^1.5.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + } + } + }, + "@knappi/sauce-tunnel": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@knappi/sauce-tunnel/-/sauce-tunnel-2.5.0.tgz", + "integrity": "sha512-8f60HrHH4SRHOspcVLbN0gpDiBYLQjmZCXwmqibhzJDHGaD/fflPpdUD2kJJyeioydcf1T0xfpbMcJW0dLjpnw==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "request": "^2.88.0", + "split": "^1.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "@types/parsimmon": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.0.tgz", @@ -3703,33 +3773,6 @@ } } }, - "grunt-saucelabs": { - "version": "github:nknapp/grunt-saucelabs#5b9b7150e66051dbf68e9212fbb89561e447e855", - "from": "github:nknapp/grunt-saucelabs", - "dev": true, - "requires": { - "colors": "~1.1.2", - "lodash": "^4.17.11", - "q": "~1.4.1", - "requestretry": "~1.9.0", - "sauce-tunnel": "github:nknapp/sauce-tunnel", - "saucelabs": "^1.5.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, - "q": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", - "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", - "dev": true - } - } - }, "grunt-webpack": { "version": "1.0.18", "resolved": "https://registry.npmjs.org/grunt-webpack/-/grunt-webpack-1.0.18.tgz", @@ -7020,47 +7063,6 @@ "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=", "dev": true }, - "sauce-tunnel": { - "version": "github:nknapp/sauce-tunnel#746744c71b9bec69ca612e751e7121f61a37d489", - "from": "github:nknapp/sauce-tunnel", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "request": "^2.88.0", - "split": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "saucelabs": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-1.5.0.tgz", diff --git a/package.json b/package.json index 78e414b2..357c4d5c 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "uglify-js": "^3.1.4" }, "devDependencies": { + "@knappi/grunt-saucelabs": "^9.0.1", "aws-sdk": "^2.1.49", "babel-loader": "^5.0.0", "babel-runtime": "^5.1.10", @@ -48,7 +49,6 @@ "grunt-contrib-uglify": "^1", "grunt-contrib-watch": "^1.1.0", "grunt-eslint": "^20.1.0", - "grunt-saucelabs": "github:nknapp/grunt-saucelabs", "grunt-webpack": "^1.0.8", "istanbul": "^0.3.0", "jison": "~0.3.0", From 9cb31653a464be9cdc759ee2bdc51e745155690d Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 21:51:56 +0200 Subject: [PATCH 21/29] Update release notes --- release-notes.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index c8d7c6d5..8c358c4a 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,14 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.0...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.1...master) + +## v4.4.1 - October 2nd, 2019 +- [#1562](https://github.com/wycats/handlebars.js/issues/1562) - Error message for syntax error missing location in 4.2.1+ + + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.0...v4.4.1) ## v4.4.0 - September 29th, 2019 - Added support for iterable objects in {{#each}} helper (#1557) - cf7545e From b8e769fcb624664a6bc7114c8739c2438d46dbe9 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 21:52:34 +0200 Subject: [PATCH 22/29] v4.4.1 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index 5d706f56..d26ccee8 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.0", + "version": "4.4.1", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 349fe4e8..35e53582 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.4.0 + 4.4.1 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 326734da..0c8b73ed 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.0", + "version": "4.4.1", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index cf0df522..16d9331e 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.4.0'; +export const VERSION = '4.4.1'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 357c4d5c..01fd8a95 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.4.0", + "version": "4.4.1", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From b7eada01496da2c507143a83fc7f189d2d70b232 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 22:42:52 +0200 Subject: [PATCH 23/29] chore: fix grunt-saucelabs dependency --- Gruntfile.js | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7e028a05..430a0c60 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -239,7 +239,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-bg-shell'); grunt.loadNpmTasks('grunt-eslint'); - grunt.loadNpmTasks('grunt-saucelabs'); + grunt.loadNpmTasks('@knappi/grunt-saucelabs'); grunt.loadNpmTasks('grunt-webpack'); grunt.task.loadTasks('tasks'); diff --git a/package-lock.json b/package-lock.json index d99846f4..c884c05e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "handlebars", - "version": "4.4.0", + "version": "4.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { "@knappi/grunt-saucelabs": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@knappi/grunt-saucelabs/-/grunt-saucelabs-9.0.1.tgz", - "integrity": "sha512-KmFjxwr5LuhS9ifFTMhcpXMpZ+2oNL5OZ5LlY6cXz4s3Mji8VSHGFucbpT/WjIGMt5YjEuqI69XfRK9bK42aRA==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@knappi/grunt-saucelabs/-/grunt-saucelabs-9.0.2.tgz", + "integrity": "sha512-PHnusXA+begWFgZS084ZAC8kT7FNRvvJIWg5FOqusRjr4LSe++RIk2HRULAQ8Dx+6HiKJiQXzrAsDagKh3k1pw==", "dev": true, "requires": { "@knappi/sauce-tunnel": "^2.5.0", diff --git a/package.json b/package.json index 01fd8a95..47598f27 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "uglify-js": "^3.1.4" }, "devDependencies": { - "@knappi/grunt-saucelabs": "^9.0.1", + "@knappi/grunt-saucelabs": "^9.0.2", "aws-sdk": "^2.1.49", "babel-loader": "^5.0.0", "babel-runtime": "^5.1.10", From 26d0f7a80d92c4b6d98197188accf52c7b07152c Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 22:44:03 +0200 Subject: [PATCH 24/29] Update release notes --- release-notes.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 8c358c4a..713990a4 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,13 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.1...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.2...master) + +## v4.4.2 - October 2nd, 2019 +- chore: fix grunt-saucelabs dependency - b7eada0 + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.1...v4.4.2) ## v4.4.1 - October 2nd, 2019 - [#1562](https://github.com/wycats/handlebars.js/issues/1562) - Error message for syntax error missing location in 4.2.1+ From b793350fec0bb652c0bb2658089d7002af27a76b Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 2 Oct 2019 22:44:36 +0200 Subject: [PATCH 25/29] v4.4.2 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index d26ccee8..cdc45070 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.1", + "version": "4.4.2", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 35e53582..41400dbd 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.4.1 + 4.4.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 0c8b73ed..23058be4 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.1", + "version": "4.4.2", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 16d9331e..14575756 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.4.1'; +export const VERSION = '4.4.2'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 47598f27..9d54050c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.4.1", + "version": "4.4.2", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From 0440af214738a611b51c15abdd84254aca200a85 Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Mon, 7 Oct 2019 23:09:08 +0200 Subject: [PATCH 26/29] added missing type fields in typings and tests for them --- types/index.d.ts | 21 ++++++++++-- types/test.ts | 84 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index a1b1693e..6fdaf0f9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -270,6 +270,7 @@ declare namespace hbs { interface Statement extends Node {} interface MustacheStatement extends Statement { + type: 'MustacheStatement'; path: PathExpression | Literal; params: Expression[]; hash: Hash; @@ -280,6 +281,7 @@ declare namespace hbs { interface Decorator extends MustacheStatement { } interface BlockStatement extends Statement { + type: 'BlockStatement'; path: PathExpression; params: Expression[]; hash: Hash; @@ -293,6 +295,7 @@ declare namespace hbs { interface DecoratorBlock extends BlockStatement { } interface PartialStatement extends Statement { + type: 'PartialStatement'; name: PathExpression | SubExpression; params: Expression[]; hash: Hash; @@ -301,6 +304,7 @@ declare namespace hbs { } interface PartialBlockStatement extends Statement { + type: 'PartialBlockStatement'; name: PathExpression | SubExpression; params: Expression[]; hash: Hash; @@ -310,11 +314,13 @@ declare namespace hbs { } interface ContentStatement extends Statement { + type: 'ContentStatement'; value: string; original: StripFlags; } interface CommentStatement extends Statement { + type: 'CommentStatement'; value: string; strip: StripFlags; } @@ -322,12 +328,14 @@ declare namespace hbs { interface Expression extends Node {} interface SubExpression extends Expression { + type: 'SubExpression'; path: PathExpression; params: Expression[]; hash: Hash; } interface PathExpression extends Expression { + type: 'PathExpression'; data: boolean; depth: number; parts: string[]; @@ -336,29 +344,38 @@ declare namespace hbs { interface Literal extends Expression {} interface StringLiteral extends Literal { + type: 'StringLiteral'; value: string; original: string; } interface BooleanLiteral extends Literal { + type: 'BooleanLiteral'; value: boolean; original: boolean; } interface NumberLiteral extends Literal { + type: 'NumberLiteral'; value: number; original: number; } - interface UndefinedLiteral extends Literal {} + interface UndefinedLiteral extends Literal { + type: 'UndefinedLiteral'; + } - interface NullLiteral extends Literal {} + interface NullLiteral extends Literal { + type: 'NullLiteral'; + } interface Hash extends Node { + type: 'Hash'; pairs: HashPair[]; } interface HashPair extends Node { + type: 'HashPair'; key: string; value: Expression; } diff --git a/types/test.ts b/types/test.ts index 72d6ff70..ff435916 100644 --- a/types/test.ts +++ b/types/test.ts @@ -110,4 +110,86 @@ Handlebars.compile('test', { Handlebars.compile('test')({},{allowCallsToHelperMissing: true}); -Handlebars.compile('test')({},{}); \ No newline at end of file +Handlebars.compile('test')({},{}); + + +const allthings = {} as hbs.AST.MustacheStatement | + hbs.AST.BlockStatement | + hbs.AST.PartialStatement | + hbs.AST.PartialBlockStatement | + hbs.AST.ContentStatement | + hbs.AST.CommentStatement | + hbs.AST.SubExpression | + hbs.AST.PathExpression | + hbs.AST.StringLiteral | + hbs.AST.BooleanLiteral | + hbs.AST.NumberLiteral | + hbs.AST.UndefinedLiteral | + hbs.AST.NullLiteral | + hbs.AST.Hash | + hbs.AST.HashPair; + +switch(allthings.type) { + case "MustacheStatement": + let mustacheStatement: hbs.AST.MustacheStatement; + mustacheStatement = allthings; + break; + case "BlockStatement": + let blockStatement: hbs.AST.BlockStatement; + blockStatement = allthings; + break; + case "PartialStatement": + let partialStatement: hbs.AST.PartialStatement; + partialStatement = allthings; + break; + case "PartialBlockStatement": + let partialBlockStatement: hbs.AST.PartialBlockStatement; + partialBlockStatement = allthings; + break; + case "ContentStatement": + let ContentStatement: hbs.AST.ContentStatement; + ContentStatement = allthings; + break; + case "CommentStatement": + let CommentStatement: hbs.AST.CommentStatement; + CommentStatement = allthings; + break; + case "SubExpression": + let SubExpression: hbs.AST.SubExpression; + SubExpression = allthings; + break; + case "PathExpression": + let PathExpression: hbs.AST.PathExpression; + PathExpression = allthings; + break; + case "StringLiteral": + let StringLiteral: hbs.AST.StringLiteral; + StringLiteral = allthings; + break; + case "BooleanLiteral": + let BooleanLiteral: hbs.AST.BooleanLiteral; + BooleanLiteral = allthings; + break; + case "NumberLiteral": + let NumberLiteral: hbs.AST.NumberLiteral; + NumberLiteral = allthings; + break; + case "UndefinedLiteral": + let UndefinedLiteral: hbs.AST.UndefinedLiteral; + UndefinedLiteral = allthings; + break; + case "NullLiteral": + let NullLiteral: hbs.AST.NullLiteral; + NullLiteral = allthings; + break; + case "Hash": + let Hash: hbs.AST.Hash; + Hash = allthings; + break; + case "HashPair": + let HashPair: hbs.AST.HashPair; + HashPair = allthings; + break; + default: + break; +} \ No newline at end of file From ba570c42cf505073dfd59b95614e000962b77a89 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 8 Oct 2019 22:04:57 +0200 Subject: [PATCH 27/29] Update release notes --- release-notes.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 713990a4..c20a86cb 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,17 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.2...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.3...master) + +## v4.4.3 - October 8th, 2019 +Bugfixes + +Typings: +- add missing type fields to AST typings and add tests for them - 0440af2 + + + +[Commits](https://github.com/wycats/handlebars.js/compare/v4.4.2...v4.4.3) ## v4.4.2 - October 2nd, 2019 - chore: fix grunt-saucelabs dependency - b7eada0 From 2e53fba68f8c51f9aca97615944fdbdeba94ff62 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 8 Oct 2019 22:05:35 +0200 Subject: [PATCH 28/29] v4.4.3 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- components/package.json | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bower.json b/components/bower.json index cdc45070..ea6ba5fb 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.2", + "version": "4.4.3", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 41400dbd..1c69e0ab 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.4.2 + 4.4.3 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 23058be4..0b116e79 100644 --- a/components/package.json +++ b/components/package.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.4.2", + "version": "4.4.3", "license": "MIT", "jspm": { "main": "handlebars", diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 14575756..7d649de0 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.4.2'; +export const VERSION = '4.4.3'; export const COMPILER_REVISION = 8; export const LAST_COMPATIBLE_COMPILER_REVISION = 7; diff --git a/package.json b/package.json index 9d54050c..54daa5c9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.4.2", + "version": "4.4.3", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From 0b593bfe5d123d7a29d1ad40093162027460f0db Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 8 Oct 2019 22:19:01 +0200 Subject: [PATCH 29/29] chore: link to s3 bucket with https, add "npm ci" to build instructions --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a73a6b34..5dc1c9fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,6 +90,7 @@ Handlebars utilizes the [release yeoman generator][generator-release] to perform A full release may be completed with the following: ``` +npm ci yo release npm publish yo release:publish components handlebars.js dist/components/ @@ -104,7 +105,7 @@ in those places still point to the latest version * [The npm-package](https://www.npmjs.com/package/handlebars) (check latest-tag) * [The bower package](https://github.com/components/handlebars.js) (check the package.json) -* [The AWS S3 Bucket](http://builds.handlebarsjs.com.s3.amazonaws.com/) (check latest-tag) +* [The AWS S3 Bucket](https://s3.amazonaws.com/builds.handlebarsjs.com) (check latest-tag) * [RubyGems](https://rubygems.org/gems/handlebars-source) When everything is OK, the handlebars site needs to be updated to point to the new version numbers. The jsfiddle link should be updated to point to the most recent distribution for all instances in our documentation.