[Pkg-javascript-commits] [libjs-handlebars] 03/06: New upstream version 4.0.10

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon Sep 25 12:03:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository libjs-handlebars.

commit e83e7da20247d3e67a2e83d331b3b661eb32a0f7
Author: Pirate Praveen <praveen at debian.org>
Date:   Mon Sep 25 17:29:30 2017 +0530

    New upstream version 4.0.10
---
 .gitattributes                                 |   6 ++
 .istanbul.yml                                  |   2 +-
 .travis.yml                                    |   4 +-
 CONTRIBUTING.md                                |  23 ++++-
 Gruntfile.js                                   |   9 +-
 LICENSE                                        |   2 +-
 README.markdown                                |   2 +
 bench/util/benchwarmer.js                      |   2 +-
 components/bower.json                          |   2 +-
 components/handlebars.js.nuspec                |   2 +-
 docs/decorators-api.md                         |   4 +-
 lib/handlebars/base.js                         |   2 +-
 lib/handlebars/compiler/compiler.js            |   5 +-
 lib/handlebars/compiler/javascript-compiler.js |  20 +++--
 lib/handlebars/exception.js                    |  20 ++++-
 lib/handlebars/runtime.js                      |  24 +++--
 lib/precompiler.js                             |   3 -
 package.json                                   |   2 +-
 release-notes.md                               |  67 +++++++++++++-
 spec/compiler.js                               |  37 ++++++++
 spec/partials.js                               | 118 +++++++++++++++++++++++++
 spec/precompiler.js                            |   4 +-
 spec/regressions.js                            |  44 +++++++++
 src/parser-prefix.js                           |   2 +-
 src/parser-suffix.js                           |   3 +-
 tasks/publish.js                               |  18 ++--
 tasks/test.js                                  |  16 ++--
 27 files changed, 385 insertions(+), 58 deletions(-)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..eeda54e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+# Handlebars-template fixtures in test cases need deterministic eol
+*.handlebars text eol=lf
+*.hbs text eol=lf
+
+# Lexer files as well
+*.l text eol=lf
diff --git a/.istanbul.yml b/.istanbul.yml
index e6911f1..960643e 100644
--- a/.istanbul.yml
+++ b/.istanbul.yml
@@ -1,2 +1,2 @@
 instrumentation:
-    excludes: ['**/spec/**']
+    excludes: ['**/spec/**', '**/handlebars/compiler/parser.js']
diff --git a/.travis.yml b/.travis.yml
index c6e2c84..00c8b00 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,12 +13,12 @@ env:
   - secure: Nm4AgSfsgNB21kgKrF9Tl7qVZU8YYREhouQunFracTcZZh2NZ2XH5aHuSiXCj88B13Cr/jGbJKsZ4T3QS3wWYtz6lkyVOx3H3iI+TMtqhD9RM3a7A4O+4vVN8IioB2YjhEu0OKjwgX5gp+0uF+pLEi7Hpj6fupD3AbbL5uYcKg8=
 matrix:
   include:
-  - node_js: '0.12'
+  - node_js: '5'
     env:
     - PUBLISH=true
     - secure: pLTzghtVll9yGKJI0AaB0uI8GypfWxLTaIB0ZL8//yN3nAEIKMhf/RRilYTsn/rKj2NUa7vt2edYILi3lttOUlCBOwTc9amiRms1W8Lwr/3IdWPeBLvLuH1zNJRm2lBAwU4LBSqaOwhGaxOQr6KHTnWudhNhgOucxpZfvfI/dFw=
     - secure: yERYCf7AwL11D9uMtacly/THGV8BlzsMmrt+iQVvGA3GaY6QMmfYqf6P6cCH98sH5etd1Y+1e6YrPeMjqI6lyRllT7FptoyOdHulazQe86VQN4sc0EpqMlH088kB7gGjTut9Z+X9ViooT5XEh9WA5jXEI9pXhQJNoIHkWPuwGuY=
-  - node_js: '4.0.0'
+  - node_js: '4'
 cache:
   directories:
   - node_modules
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 79db3ba..1ea2466 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,7 @@ Please see our [FAQ](https://github.com/wycats/handlebars.js/blob/master/FAQ.md)
 
 Should you run into other issues with the project, please don't hesitate to let us know by filing an [issue][issue]! In general we are going to ask for an example of the problem failing, which can be as simple as a jsfiddle/jsbin/etc. We've put together a jsfiddle [template][jsfiddle] to ease this. (We will keep this link up to date as new releases occur, so feel free to check back here)
 
-Pull requests containing only failing thats demonstrating the issue are welcomed and this also helps ensure that your issue won't regress in the future once it's fixed.
+Pull requests containing only failing tests demonstrating the issue are welcomed and this also helps ensure that your issue won't regress in the future once it's fixed.
 
 Documentation issues on the handlebarsjs.com site should be reported on [handlebars-site](https://github.com/wycats/handlebars-site).
 
@@ -42,6 +42,25 @@ The `grunt dev` implements watching for tests and allows for in browser testing
 If you notice any problems, please report them to the GitHub issue tracker at
 [http://github.com/wycats/handlebars.js/issues](http://github.com/wycats/handlebars.js/issues).
 
+##Running Tests
+
+To run tests locally, first install all dependencies.
+```sh
+npm install
+```
+
+Clone the mustache specs into the spec/mustache folder.
+```sh
+cd spec
+rm -r mustache
+git clone https://github.com/mustache/spec.git mustache
+```
+
+From the root directory, run the tests.
+```sh
+npm test
+```
+
 ## Ember testing
 
 The current ember distribution should be tested as part of the handlebars release process. This requires building the `handlebars-source` gem locally and then executing the ember test script.
@@ -77,4 +96,4 @@ After this point the handlebars site needs to be updated to point to the new ver
 [generator-release]: https://github.com/walmartlabs/generator-release
 [pull-request]: https://github.com/wycats/handlebars.js/pull/new/master
 [issue]: https://github.com/wycats/handlebars.js/issues/new
-[jsfiddle]: http://jsfiddle.net/9D88g/46/
+[jsfiddle]: https://jsfiddle.net/9D88g/47/
diff --git a/Gruntfile.js b/Gruntfile.js
index fd76518..ce85e9a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -22,7 +22,7 @@ module.exports = function(grunt) {
       dist: {
         options: {
           processContent: function(content) {
-            return grunt.template.process('/*!\n\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n at license\n*/\n')
+            return grunt.template.process('/**!\n\n @license\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n')
                 + content;
           }
         },
@@ -166,11 +166,10 @@ module.exports = function(grunt) {
           browsers: [
             {browserName: 'chrome'},
             {browserName: 'firefox', platform: 'Linux'},
-            {browserName: 'safari', version: 7, platform: 'OS X 10.9'},
-            {browserName: 'safari', version: 6, platform: 'OS X 10.8'},
+            {browserName: 'safari', version: 9, platform: 'OS X 10.11'},
+            {browserName: 'safari', version: 8, platform: 'OS X 10.10'},
             {browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'},
-            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'},
-            {browserName: 'internet explorer', version: 9, platform: 'Windows 7'}
+            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'}
           ]
         }
       },
diff --git a/LICENSE b/LICENSE
index 4effa39..307ebc1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (C) 2011-2015 by Yehuda Katz
+Copyright (C) 2011-2016 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
diff --git a/README.markdown b/README.markdown
index 904b9e0..89e3fc5 100644
--- a/README.markdown
+++ b/README.markdown
@@ -121,6 +121,7 @@ Handlebars in the Wild
 * [Assemble](http://assemble.io), by [@jonschlinkert](https://github.com/jonschlinkert)
   and [@doowb](https://github.com/doowb), is a static site generator that uses Handlebars.js
   as its template engine.
+* [Cory](https://github.com/leo/cory), by [@leo](https://github.com/leo), is another tiny static site generator
 * [CoSchedule](http://coschedule.com) An editorial calendar for WordPress that uses Handlebars.js
 * [dashbars](https://github.com/pismute/dashbars) A modern helper library for Handlebars.js.
 * [Ember.js](http://www.emberjs.com) makes Handlebars.js the primary way to
@@ -150,6 +151,7 @@ Handlebars in the Wild
 * [Swag](https://github.com/elving/swag) by [@elving](https://github.com/elving) is a growing collection of helpers for handlebars.js. Give your handlebars.js templates some swag son!
 * [DOMBars](https://github.com/blakeembrey/dombars) is a DOM-based templating engine built on the Handlebars parser and runtime **DEPRECATED**
 * [promised-handlebars](https://github.com/nknapp/promised-handlebars) is a wrapper for Handlebars that allows helpers to return Promises.
+* [just-handlebars-helpers](https://github.com/leapfrogtechnology/just-handlebars-helpers) A fully tested lightweight package with common Handlebars helpers.
 
 External Resources
 ------------------
diff --git a/bench/util/benchwarmer.js b/bench/util/benchwarmer.js
index 78b1a34..49f66f7 100644
--- a/bench/util/benchwarmer.js
+++ b/bench/util/benchwarmer.js
@@ -11,7 +11,7 @@ function BenchWarmer() {
   this.errors = {};
 }
 
-var print = require('sys').print;
+var print = require('util').print;
 
 BenchWarmer.prototype = {
   winners: function(benches) {
diff --git a/components/bower.json b/components/bower.json
index 840c772..0bf954a 100644
--- a/components/bower.json
+++ b/components/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "handlebars",
-  "version": "4.0.5",
+  "version": "4.0.10",
   "main": "handlebars.js",
   "license": "MIT",
   "dependencies": {}
diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec
index 9ede3d6..9b735a9 100644
--- a/components/handlebars.js.nuspec
+++ b/components/handlebars.js.nuspec
@@ -2,7 +2,7 @@
 <package>
 	<metadata>
 		<id>handlebars.js</id>
-		<version>4.0.5</version>
+		<version>4.0.10</version>
 		<authors>handlebars.js Authors</authors>
 		<licenseUrl>https://github.com/wycats/handlebars.js/blob/master/LICENSE</licenseUrl>
 		<projectUrl>https://github.com/wycats/handlebars.js/</projectUrl>
diff --git a/docs/decorators-api.md b/docs/decorators-api.md
index e14a33f..566c7eb 100644
--- a/docs/decorators-api.md
+++ b/docs/decorators-api.md
@@ -2,9 +2,9 @@
 
 Decorators allow for blocks to be annotated with metadata or wrapped in functionality prior to execution of the block. This may be used to communicate with the containing helper or to setup a particular state in the system prior to running the block.
 
-Decorators are registered through similar methods as helpers, `registerDecorators` and `unregisterDecorators`. These can then be referenced via the friendly name in the template using the `{{* decorator}}` and `{{#* decorator}}{/decorator}}` syntaxes. These syntaxs are derivitives of the normal mustache syntax and as such have all of the same argument and whitespace behaviors.
+Decorators are registered through similar methods as helpers, `registerDecorators` and `unregisterDecorators`. These can then be referenced via the friendly name in the template using the `{{* decorator}}` and `{{#* decorator}}{/decorator}}` syntaxes. These syntaxes are derivatives of the normal mustache syntax and as such have all of the same argument and whitespace behaviors.
 
-Decorators are executed when the block program is instantiated and are passed `(program, props, container, context, data, blockParams, depths)`
+Decorators are executed when the block program is instantiated and are passed `(program, props, container, context, data, blockParams, depths)`.
 
 - `program`: The block to wrap
 - `props`: Object used to set metadata on the final function. Any values set on this object will be set on the function, regardless of if the original function is replaced or not. Metadata should be applied using this object as values applied to `program` may be masked by subsequent decorators that may wrap `program`.
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index 836422d..d0ad133 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.0.5';
+export const VERSION = '4.0.10';
 export const COMPILER_REVISION = 7;
 
 export const REVISION_CHANGES = {
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 987d0d4..47107cc 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/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/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index 97939df..bf4be8a 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -778,11 +778,11 @@ JavaScriptCompiler.prototype = {
       child = children[i];
       compiler = new this.compiler();    // eslint-disable-line new-cap
 
-      let index = this.matchExistingProgram(child);
+      let existing = this.matchExistingProgram(child);
 
-      if (index == null) {
+      if (existing == null) {
         this.context.programs.push('');     // Placeholder to prevent name conflicts for nested children
-        index = this.context.programs.length;
+        let index = this.context.programs.length;
         child.index = index;
         child.name = 'program' + index;
         this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
@@ -791,12 +791,14 @@ JavaScriptCompiler.prototype = {
 
         this.useDepths = this.useDepths || compiler.useDepths;
         this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
+        child.useDepths = this.useDepths;
+        child.useBlockParams = this.useBlockParams;
       } else {
-        child.index = index;
-        child.name = 'program' + index;
+        child.index = existing.index;
+        child.name = 'program' + existing.index;
 
-        this.useDepths = this.useDepths || child.useDepths;
-        this.useBlockParams = this.useBlockParams || child.useBlockParams;
+        this.useDepths = this.useDepths || existing.useDepths;
+        this.useBlockParams = this.useBlockParams || existing.useBlockParams;
       }
     }
   },
@@ -804,7 +806,7 @@ JavaScriptCompiler.prototype = {
     for (let i = 0, len = this.context.environments.length; i < len; i++) {
       let environment = this.context.environments[i];
       if (environment && environment.equals(child)) {
-        return i;
+        return environment;
       }
     }
   },
@@ -985,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/lib/handlebars/exception.js b/lib/handlebars/exception.js
index 52499c0..b9a5557 100644
--- a/lib/handlebars/exception.js
+++ b/lib/handlebars/exception.js
@@ -24,9 +24,23 @@ function Exception(message, node) {
     Error.captureStackTrace(this, Exception);
   }
 
-  if (loc) {
-    this.lineNumber = line;
-    this.column = column;
+  try {
+    if (loc) {
+      this.lineNumber = line;
+
+      // 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,
+          enumerable: true
+        });
+      } else {
+        this.column = column;
+      }
+    }
+  } catch (nop) {
+    /* Ignore if the browser is very particular */
   }
 }
 
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index b47d961..3884e88 100644
--- a/lib/handlebars/runtime.js
+++ b/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
@@ -140,7 +142,7 @@ export function template(templateSpec, env) {
         blockParams = templateSpec.useBlockParams ? [] : undefined;
     if (templateSpec.useDepths) {
       if (options.depths) {
-        depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths;
+        depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths;
       } else {
         depths = [context];
       }
@@ -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);
     }
 
@@ -223,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;
@@ -231,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/lib/precompiler.js b/lib/precompiler.js
index a20d141..6ba3800 100644
--- a/lib/precompiler.js
+++ b/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) {
diff --git a/package.json b/package.json
index a5b7887..fcbabc2 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "handlebars",
   "barename": "handlebars",
-  "version": "4.0.5",
+  "version": "4.0.10",
   "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 497f5e8..4db2223 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -2,7 +2,72 @@
 
 ## Development
 
-[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.5...master)
+[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.10...master)
+
+## v4.0.10 - May 21st, 2017
+- Fix regression in 4.0.9: Replace "Object.assign" (not support in IE) by "util/extend" - 0e953d1
+
+
+
+[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.9...v4.0.10)
+
+## v4.0.9 - May 21st, 2017
+
+- [#1327](https://github.com/wycats/handlebars.js/issues/1327) Handlebars.compile() does not modify "options" anymore
+- pending [#1331](https://github.com/wycats/handlebars.js/issues/1331) Attempts to build Handlebars in a Windows environment
+  - Fix build in windows - cc554a5
+  - Ensure LF line-edings in handlebars-template fixtures (*.hbs) - ed879a6
+  - Run integration test with `node handlebars -a ...` on Windows - 2e21e2b
+  - Ensure LF line-edings in lexer-files (*.l) - bdfdbea
+  - Force LF line-endings for spec/artifacts - b50ef03
+  - Use istanbul/lib/cli.js instead of node_modules/.bin/istanbul - 6e6269f
+- TravisCI: Publish valid semver tags independently of the branch - 7378f85
+
+Compatibility notes:
+- No compatibility issues are expected.
+
+[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.8...v4.0.9)
+
+## v4.0.8 - May 2nd, 2017
+- [#1341](https://github.com/wycats/handlebars.js/issues/1341) [#1342](https://github.com/wycats/handlebars.js/issues/1342) Allow partial-blocks to be executed without "options" ([@nknapp](https://github.com/nknapp)) - a00c598
+
+Compatibility notes:
+- No breaking changes
+
+[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.7...v4.0.8)
+
+## v4.0.7 - April 29th, 2017
+- [#1319](https://github.com/wycats/handlebars.js/issues/1319): Fix context-stack when calling block-helpers on null values ([@nknapp](https://github.com/nknapp)) - c8f4b57
+- [#1315](https://github.com/wycats/handlebars.js/pull/1315) Parser: Change suffix to use ES6 default module export ([@Turbo87](https://github.com/Turbo87))- b617375
+- [#1290](https://github.com/wycats/handlebars.js/pull/1290) [#1252](https://github.com/wycats/handlebars.js/issue/1290) Add more tests for partial-blocks and inline partials ([@nknapp](https://github.com/nknapp)) -  63a8e0c
+- [#1252](https://github.com/wycats/handlebars.js/issue/1290) Using @partial-block twice in a template not possible ([@nknapp](https://github.com/nknapp)) - 5a164d0
+- [#1310](https://github.com/wycats/handlebars.js/pull/1310) Avoid duplicate "sourceMappingURL=" lines. ([@joonas-lahtinen](https://github.com/joonas-lahtinen)) - 01b0f65
+- [#1275](https://github.com/wycats/handlebars.js/pull/1275) require('sys') is deprecated, using 'util' instead ([@travnels](https://github.com/travnels)) - 406f2ee
+- [#1285](https://github.com/wycats/handlebars.js/pull/1285) [#1284](https://github.com/wycats/handlebars.js/issues/1284) Make "column"-property of Errors enumerable ([@nknapp](https://github.com/nknapp)) - a023cb4
+- [#1285](https://github.com/wycats/handlebars.js/pull/1285) Testcase to verify that compile-errors have a column-property ([@nknapp](https://github.com/nknapp)) - c7dc353
+
+[Commits](https://github.com/lawnsea/handlebars.js/compare/v4.0.6...v4.0.7)
+
+## v4.0.6 - November 12th, 2016
+- [#1243](https://github.com/wycats/handlebars.js/pull/1243) - Walk up data frames for nested @partial-block ([@lawnsea](https://github.com/lawnsea))
+- [#1210](https://github.com/wycats/handlebars.js/pull/1210) - Add a new lightweight package based on handlebars in the README ([@kabirbaidhya](https://github.com/kabirbaidhya))
+- [#1187](https://github.com/wycats/handlebars.js/pull/1187) - Ensure that existing blockParams and depths are respected on dupe programs ([@charleso](https://github.com/charleso))
+- [#1191](https://github.com/wycats/handlebars.js/pull/1191) - Added cory ([@leo](https://github.com/leo))
+- [#1177](https://github.com/wycats/handlebars.js/pull/1177) - Preserve License info in Closure Compiler ([@gennadiylitvinyuk](https://github.com/gennadiylitvinyuk))
+- [#1171](https://github.com/wycats/handlebars.js/pull/1171) - Contributing doc fix: failing thats -> failing tests ([@paulfalgout](https://github.com/paulfalgout))
+- [#1166](https://github.com/wycats/handlebars.js/pull/1166) - Update license date ([@timwangdev](https://github.com/timwangdev))
+-  Update jsfiddle to point to latest - 959ee55 (originally dfc7554 by [@kpdecker](https://github.com/kpdecker))
+- [#1163](https://github.com/wycats/handlebars.js/pull/1163) - Fix typos on decorators-api.md. ([@adjohnson916](https://github.com/adjohnson916))
+- Drop extra Error params - 8c19874 (originally 63fdb92 by [@kpdecker](https://github.com/kpdecker))
+- [#1153](https://github.com/wycats/handlebars.js/pull/1153) - Add documentation for running tests to contributing.md ([@ryanmurakami](https://github.com/ryanmurakami))
+- Avoid error in older browsers in test - 400916c (originally a6121ca by [@kpdecker](https://github.com/kpdecker))
+- Update target browser test versions - fee2334 (originally 871c32a by [@kpdecker](https://github.com/kpdecker))
+- Exclude coverage check in exception conditional - 32d6363 (originally 326734b by [@kpdecker](https://github.com/kpdecker))
+- Fix throw when creating exception object in Safari - 20c965c (originally 2ea6119 by [@kpdecker](https://github.com/kpdecker))
+- Update build for modern node versions - 6c9f98c (originally 8289c0b by [@kpdecker](https://github.com/kpdecker))
+- [#1135](https://github.com/wycats/handlebars.js/issues/1135) - Relax depth check for context push - c393c81 (originally 25458fd by [@kpdecker](https://github.com/kpdecker))
+
+[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.5...v4.0.6)
 
 ## v4.0.5 - November 19th, 2015
 - [#1132](https://github.com/wycats/handlebars.js/pull/1132) - Update uglify-js to avoid vulnerability ([@plynchnlm](https://api.github.com/users/plynchnlm))
diff --git a/spec/compiler.js b/spec/compiler.js
index be1fb00..02dad67 100644
--- a/spec/compiler.js
+++ b/spec/compiler.js
@@ -38,6 +38,31 @@ describe('compiler', function() {
       }, Error, 'You must pass a string or Handlebars AST to Handlebars.compile. You passed [object Object]');
     });
 
+    it('should include the location in the error (row and column)', function() {
+      try {
+        Handlebars.compile(' \n  {{#if}}\n{{/def}}')();
+        equal(true, false, 'Statement must throw exception. This line should not be executed.');
+      } catch (err) {
+        equal(err.message, 'if doesn\'t match def - 2:5', 'Checking error message');
+        if (Object.getOwnPropertyDescriptor(err, 'column').writable) {
+          // In Safari 8, the column-property is read-only. This means that even if it is set with defineProperty,
+          // its value won't change (https://github.com/jquery/esprima/issues/1290#issuecomment-132455482)
+          // Since this was neither working in Handlebars 3 nor in 4.0.5, we only check the column for other browsers.
+          equal(err.column, 5, 'Checking error column');
+        }
+        equal(err.lineNumber, 2, 'Checking error row');
+      }
+    });
+
+    it('should include the location as enumerable property', function() {
+      try {
+        Handlebars.compile(' \n  {{#if}}\n{{/def}}')();
+        equal(true, false, 'Statement must throw exception. This line should not be executed.');
+      } catch (err) {
+        equal(err.propertyIsEnumerable('column'), true, 'Checking error column');
+      }
+    });
+
     it('can utilize AST instance', function() {
       equal(Handlebars.compile({
         type: 'Program',
@@ -48,6 +73,18 @@ describe('compiler', function() {
     it('can pass through an empty string', function() {
       equal(Handlebars.compile('')(), '');
     });
+
+    it('should not modify the options.data property(GH-1327)', function() {
+      var options = {data: [{a: 'foo'}, {a: 'bar'}]};
+      Handlebars.compile('{{#each data}}{{@index}}:{{a}} {{/each}}', options)();
+      equal(JSON.stringify(options, 0, 2), JSON.stringify({data: [{a: 'foo'}, {a: 'bar'}]}, 0, 2));
+    });
+
+    it('should not modify the options.knownHelpers property(GH-1327)', function() {
+      var options = {knownHelpers: {}};
+      Handlebars.compile('{{#each data}}{{@index}}:{{a}} {{/each}}', options)();
+      equal(JSON.stringify(options, 0, 2), JSON.stringify({knownHelpers: {}}, 0, 2));
+    });
   });
 
   describe('#precompile', function() {
diff --git a/spec/partials.js b/spec/partials.js
index d3ead74..266837d 100644
--- a/spec/partials.js
+++ b/spec/partials.js
@@ -249,6 +249,13 @@ describe('partials', function() {
         true,
         'success');
     });
+    it('should be able to render the partial-block twice', function() {
+      shouldCompileToWithPartials(
+          '{{#> dude}}success{{/dude}}',
+          [{}, {}, {dude: '{{> @partial-block }} {{> @partial-block }}'}],
+          true,
+          'success success');
+    });
     it('should render block from partial with context', function() {
       shouldCompileToWithPartials(
         '{{#> dude}}{{value}}{{/dude}}',
@@ -256,6 +263,32 @@ describe('partials', function() {
         true,
         'success');
     });
+    it('should allow the #each-helper to be used along with partial-blocks', function() {
+      shouldCompileToWithPartials(
+        '<template>{{#> list value}}value = {{.}}{{/list}}</template>',
+        [
+          {value: ['a', 'b', 'c']},
+          {},
+          {
+            list: '<list>{{#each .}}<item>{{> @partial-block}}</item>{{/each}}</list>'
+          }
+        ],
+        true,
+        '<template><list><item>value = a</item><item>value = b</item><item>value = c</item></list></template>');
+    });
+    it('should render block from partial with context (twice)', function() {
+      shouldCompileToWithPartials(
+          '{{#> dude}}{{value}}{{/dude}}',
+          [
+            {context: {value: 'success'}},
+            {},
+            {
+              dude: '{{#with context}}{{> @partial-block }} {{> @partial-block }}{{/with}}'
+            }
+          ],
+          true,
+          'success success');
+    });
     it('should render block from partial with context', function() {
       shouldCompileToWithPartials(
         '{{#> dude}}{{../context/value}}{{/dude}}',
@@ -270,6 +303,64 @@ describe('partials', function() {
         true,
         'success');
     });
+    it('should render nested partial blocks', function() {
+      shouldCompileToWithPartials(
+        '<template>{{#> outer}}{{value}}{{/outer}}</template>',
+        [
+          {value: 'success'},
+          {},
+          {
+            outer: '<outer>{{#> nested}}<outer-block>{{> @partial-block}}</outer-block>{{/nested}}</outer>',
+            nested: '<nested>{{> @partial-block}}</nested>'
+          }
+        ],
+        true,
+        '<template><outer><nested><outer-block>success</outer-block></nested></outer></template>');
+    });
+    it('should render nested partial blocks at different nesting levels', function() {
+      shouldCompileToWithPartials(
+        '<template>{{#> outer}}{{value}}{{/outer}}</template>',
+        [
+          {value: 'success'},
+          {},
+          {
+            outer: '<outer>{{#> nested}}<outer-block>{{> @partial-block}}</outer-block>{{/nested}}{{> @partial-block}}</outer>',
+            nested: '<nested>{{> @partial-block}}</nested>'
+          }
+        ],
+        true,
+        '<template><outer><nested><outer-block>success</outer-block></nested>success</outer></template>');
+    });
+    it('should render nested partial blocks at different nesting levels (twice)', function() {
+      shouldCompileToWithPartials(
+        '<template>{{#> outer}}{{value}}{{/outer}}</template>',
+        [
+          {value: 'success'},
+          {},
+          {
+            outer: '<outer>{{#> nested}}<outer-block>{{> @partial-block}} {{> @partial-block}}</outer-block>{{/nested}}{{> @partial-block}}+{{> @partial-block}}</outer>',
+            nested: '<nested>{{> @partial-block}}</nested>'
+          }
+        ],
+        true,
+        '<template><outer><nested><outer-block>success success</outer-block></nested>success+success</outer></template>');
+    });
+    it('should render nested partial blocks (twice at each level)', function() {
+      shouldCompileToWithPartials(
+        '<template>{{#> outer}}{{value}}{{/outer}}</template>',
+        [
+          {value: 'success'},
+          {},
+          {
+            outer: '<outer>{{#> nested}}<outer-block>{{> @partial-block}} {{> @partial-block}}</outer-block>{{/nested}}</outer>',
+            nested: '<nested>{{> @partial-block}}{{> @partial-block}}</nested>'
+          }
+        ],
+        true,
+        '<template><outer>' +
+        '<nested><outer-block>success success</outer-block><outer-block>success success</outer-block></nested>' +
+        '</outer></template>');
+    });
   });
 
   describe('inline partials', function() {
@@ -309,6 +400,33 @@ describe('partials', function() {
         true,
         'success');
     });
+    it('should render nested inline partials', function() {
+      shouldCompileToWithPartials(
+        '{{#*inline "outer"}}{{#>inner}}<outer-block>{{>@partial-block}}</outer-block>{{/inner}}{{/inline}}' +
+        '{{#*inline "inner"}}<inner>{{>@partial-block}}</inner>{{/inline}}' +
+        '{{#>outer}}{{value}}{{/outer}}',
+        [{value: 'success'}, {}, {}],
+        true,
+        '<inner><outer-block>success</outer-block></inner>');
+    });
+    it('should render nested inline partials with partial-blocks on different nesting levels', function() {
+      shouldCompileToWithPartials(
+        '{{#*inline "outer"}}{{#>inner}}<outer-block>{{>@partial-block}}</outer-block>{{/inner}}{{>@partial-block}}{{/inline}}' +
+        '{{#*inline "inner"}}<inner>{{>@partial-block}}</inner>{{/inline}}' +
+        '{{#>outer}}{{value}}{{/outer}}',
+        [{value: 'success'}, {}, {}],
+        true,
+        '<inner><outer-block>success</outer-block></inner>success');
+    });
+    it('should render nested inline partials (twice at each level)', function() {
+      shouldCompileToWithPartials(
+        '{{#*inline "outer"}}{{#>inner}}<outer-block>{{>@partial-block}} {{>@partial-block}}</outer-block>{{/inner}}{{/inline}}' +
+        '{{#*inline "inner"}}<inner>{{>@partial-block}}{{>@partial-block}}</inner>{{/inline}}' +
+        '{{#>outer}}{{value}}{{/outer}}',
+        [{value: 'success'}, {}, {}],
+        true,
+        '<inner><outer-block>success success</outer-block><outer-block>success success</outer-block></inner>');
+    });
   });
 
   it('should pass compiler flags', function() {
diff --git a/spec/precompiler.js b/spec/precompiler.js
index f9759a9..006a37e 100644
--- a/spec/precompiler.js
+++ b/spec/precompiler.js
@@ -152,14 +152,14 @@ describe('precompiler', function() {
     Precompiler.cli({templates: [emptyTemplate], map: 'foo.js.map'});
 
     equal(file, 'foo.js.map');
-    equal(/sourceMappingURL=/.test(log), true);
+    equal(log.match(/sourceMappingURL=/g).length, 1);
   });
 
   it('should output map', function() {
     Precompiler.cli({templates: [emptyTemplate], min: true, map: 'foo.js.map'});
 
     equal(file, 'foo.js.map');
-    equal(/sourceMappingURL=/.test(log), true);
+    equal(log.match(/sourceMappingURL=/g).length, 1);
   });
 
   describe('#loadTemplates', function() {
diff --git a/spec/regressions.js b/spec/regressions.js
index 83765a2..1678d80 100644
--- a/spec/regressions.js
+++ b/spec/regressions.js
@@ -247,4 +247,48 @@ describe('Regressions', function() {
     };
     shouldCompileToWithPartials(string, [{}, {}, partials], true, 'Outer');
   });
+
+  it('GH-1135 : Context handling within each iteration', function() {
+    var obj = {array: [1], name: 'John'};
+    var helpers = {
+      myif: function(conditional, options) {
+        if (conditional) {
+            return options.fn(this);
+        } else {
+            return options.inverse(this);
+        }
+      }
+    };
+
+    shouldCompileTo(
+      '{{#each array}}\n'
+      + ' 1. IF: {{#if true}}{{../name}}-{{../../name}}-{{../../../name}}{{/if}}\n'
+      + ' 2. MYIF: {{#myif true}}{{../name}}={{../../name}}={{../../../name}}{{/myif}}\n'
+      + '{{/each}}', [obj, helpers],
+      ' 1. IF: John--\n'
+      + ' 2. MYIF: John==\n');
+  });
+
+  it('GH-1186: Support block params for existing programs', function() {
+    var string =
+        '{{#*inline "test"}}{{> @partial-block }}{{/inline}}'
+      + '{{#>test }}{{#each listOne as |item|}}{{ item }}{{/each}}{{/test}}'
+      + '{{#>test }}{{#each listTwo as |item|}}{{ item }}{{/each}}{{/test}}';
+
+    shouldCompileTo(string, { listOne: ['a'], listTwo: ['b']}, 'ab', '');
+  });
+
+  it('GH-1319: "unless" breaks when "each" value equals "null"', function() {
+    var string = '{{#each list}}{{#unless ./prop}}parent={{../value}} {{/unless}}{{/each}}';
+    shouldCompileTo(string, { value: 'parent', list: [ null, 'a'] }, 'parent=parent parent=parent ', '');
+  });
+
+  it('GH-1341: 4.0.7 release breaks {{#if @partial-block}} usage', function() {
+    var string = 'template {{>partial}} template';
+    var partials = {
+      partialWithBlock: '{{#if @partial-block}} block {{> @partial-block}} block {{/if}}',
+      partial: '{{#> partialWithBlock}} partial {{/partialWithBlock}}'
+    };
+    shouldCompileToWithPartials(string, [{}, {}, partials], true, 'template  block  partial  block  template');
+  });
 });
diff --git a/src/parser-prefix.js b/src/parser-prefix.js
index e26b993..d9ed041 100644
--- a/src/parser-prefix.js
+++ b/src/parser-prefix.js
@@ -1 +1 @@
-/* istanbul ignore next */
+// File ignored in coverage tests via setting in .istanbul.yml
diff --git a/src/parser-suffix.js b/src/parser-suffix.js
index 1f69f7a..6e4aa20 100644
--- a/src/parser-suffix.js
+++ b/src/parser-suffix.js
@@ -1,2 +1 @@
-exports.__esModule = true;
-exports['default'] = handlebars;
+export default handlebars;
diff --git a/tasks/publish.js b/tasks/publish.js
index 55ea20a..38039c6 100644
--- a/tasks/publish.js
+++ b/tasks/publish.js
@@ -15,14 +15,22 @@ module.exports = function(grunt) {
       git.commitInfo(function(err, info) {
         grunt.log.writeln('tag: ' + info.tagName);
 
+        var files = [];
+
+        // Publish the master as "latest" and with the commit-id
         if (info.isMaster) {
-          initSDK();
+          files.push('-latest');
+          files.push('-' + info.head);
+        }
 
-          var files = ['-latest', '-' + info.head];
-          if (info.tagName && semver.valid(info.tagName)) {
-            files.push('-' + info.tagName);
-          }
+        // Publish tags by their tag-name
+        if (info.tagName && semver.valid(info.tagName)) {
+          files.push('-' + info.tagName);
+        }
 
+        if (files.length > 0) {
+          initSDK();
+          grunt.log.writeln('publishing files: ' + JSON.stringify(files));
           publish(fileMap(files), done);
         } else {
           // Silently ignore for branches
diff --git a/tasks/test.js b/tasks/test.js
index 18a6c26..342a283 100644
--- a/tasks/test.js
+++ b/tasks/test.js
@@ -1,17 +1,21 @@
 var childProcess = require('child_process'),
-    fs = require('fs');
+    fs = require('fs'),
+    os = require('os');
 
 module.exports = function(grunt) {
   grunt.registerTask('test:bin', function() {
     var done = this.async();
 
-    childProcess.exec('./bin/handlebars -a spec/artifacts/empty.handlebars', function(err, stdout) {
+    // On Windows, the executable handlebars.js file cannot be run directly
+    var prefix = os.type().match(/^Windows/) ? process.argv[0] : '';
+    childProcess.exec(prefix + ' ./bin/handlebars -a spec/artifacts/empty.handlebars', function(err, stdout) {
       if (err) {
         throw err;
       }
 
-      var expected = fs.readFileSync('./spec/expected/empty.amd.js');
-      if (stdout.toString() !== expected.toString()) {
+      var expected = fs.readFileSync('./spec/expected/empty.amd.js').toString().replace(/\r\n/g, '\n');
+
+      if (stdout.toString() !== expected) {
         throw new Error('Expected binary output differed:\n\n"' + stdout + '"\n\n"' + expected + '"');
       }
 
@@ -32,7 +36,7 @@ module.exports = function(grunt) {
   grunt.registerTask('test:cov', function() {
     var done = this.async();
 
-    var runner = childProcess.fork('node_modules/.bin/istanbul', ['cover', '--source-map', '--', './spec/env/runner.js'], {stdio: 'inherit'});
+    var runner = childProcess.fork('node_modules/istanbul/lib/cli.js', ['cover', '--source-map', '--', './spec/env/runner.js'], {stdio: 'inherit'});
     runner.on('close', function(code) {
       if (code != 0) {
         grunt.fatal(code + ' tests failed');
@@ -55,7 +59,7 @@ module.exports = function(grunt) {
   grunt.registerTask('test:check-cov', function() {
     var done = this.async();
 
-    var runner = childProcess.fork('node_modules/.bin/istanbul', ['check-coverage', '--statements', '100', '--functions', '100', '--branches', '100', '--lines 100'], {stdio: 'inherit'});
+    var runner = childProcess.fork('node_modules/istanbul/lib/cli.js', ['check-coverage', '--statements', '100', '--functions', '100', '--branches', '100', '--lines 100'], {stdio: 'inherit'});
     runner.on('close', function(code) {
       if (code != 0) {
         grunt.fatal('Coverage check failed: ' + code);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/libjs-handlebars.git



More information about the Pkg-javascript-commits mailing list