From d9450895658f5e909218877bdafeabee93f44d75 Mon Sep 17 00:00:00 2001 From: Shannon Moeller Date: Fri, 24 Apr 2015 22:29:40 -0400 Subject: [PATCH 1/6] Added handlebars-layouts to the in-the-wild list I've written a set of helpers which implement layout blocks similar to Jade, Jinja, Swig, Twig, and others. It seems to be gaining some popularity (around 10k npm downloads per month at present) and I would be honored to have it included in the in-the-wild list in case it may prove useful to others. --- README.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/README.markdown b/README.markdown index 15f7e2079..d6aa6bd5c 100644 --- a/README.markdown +++ b/README.markdown @@ -403,6 +403,7 @@ Handlebars in the Wild from Les Hill (@leshill). * [handlebars-helpers](https://github.com/assemble/handlebars-helpers) is an extensive library with 100+ handlebars helpers. +* [handlebars-layouts](https://github.com/shannonmoeller/handlebars-layouts) is a set of helpers which implement extendible and embeddable layout blocks as seen in other popular templating languages. * [hbs](http://github.com/donpark/hbs): An Express.js view engine adapter for Handlebars.js, from Don Park. * [koa-hbs](https://github.com/jwilm/koa-hbs): [koa](https://github.com/koajs/koa) generator based From fc13400b6fd33ab9c27bc457696d632a1d3007e4 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 27 Apr 2015 10:07:05 -0500 Subject: [PATCH 2/6] Remove jshint completely --- .jshintrc | 52 ------------------- .npmignore | 2 +- lib/handlebars.js | 1 - lib/handlebars.runtime.js | 1 - lib/handlebars/compiler/helpers.js | 4 -- .../compiler/javascript-compiler.js | 2 - lib/handlebars/utils.js | 1 - package.json | 1 - src/parser-prefix.js | 1 - src/parser-suffix.js | 1 - 10 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 313015ee7..000000000 --- a/.jshintrc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "predef": [ - "console", - "require", - "suite", - "equal", - "equals", - "test", - "testBoth", - "raises", - "deepEqual", - "start", - "stop", - "ok", - "strictEqual", - "module", - "define", - - "describe", - "it", - "afterEach", - "beforeEach" - ], - - "node" : true, - "browser" : true, - "esnext": true, - - "boss" : true, - "curly": false, - "debug": false, - "devel": false, - "eqeqeq": false, - "eqnull": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": true, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "unused": true, - "sub": true, - "strict": false, - "white": false -} diff --git a/.npmignore b/.npmignore index 6b8c8bfce..41cf1f221 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,7 @@ .DS_Store .gitignore .rvmrc -.jshintrc +.eslintrc .travis.yml .rspec Gemfile diff --git a/lib/handlebars.js b/lib/handlebars.js index 3e566a798..3f3ba4801 100644 --- a/lib/handlebars.js +++ b/lib/handlebars.js @@ -32,7 +32,6 @@ inst.create = create; inst.Visitor = Visitor; -/*jshint -W040 */ /* istanbul ignore next */ let $Handlebars = global.Handlebars; /* istanbul ignore next */ diff --git a/lib/handlebars.runtime.js b/lib/handlebars.runtime.js index e7b149b73..75a6a7a82 100644 --- a/lib/handlebars.runtime.js +++ b/lib/handlebars.runtime.js @@ -29,7 +29,6 @@ function create() { let Handlebars = create(); Handlebars.create = create; -/*jshint -W040 */ /* istanbul ignore next */ let root = typeof global !== 'undefined' ? global : window, $Handlebars = root.Handlebars; diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js index 31daf6df9..fc0120c4f 100644 --- a/lib/handlebars/compiler/helpers.js +++ b/lib/handlebars/compiler/helpers.js @@ -33,7 +33,6 @@ export function stripComment(comment) { } export function preparePath(data, parts, locInfo) { - /*jshint -W040 */ locInfo = this.locInfo(locInfo); let original = data ? '@' : '', @@ -64,7 +63,6 @@ export function preparePath(data, parts, locInfo) { } export function prepareMustache(path, params, hash, open, strip, locInfo) { - /*jshint -W040 */ // Must use charAt to support IE pre-10 let escapeFlag = open.charAt(3) || open.charAt(2), escaped = escapeFlag !== '{' && escapeFlag !== '&'; @@ -73,7 +71,6 @@ export function prepareMustache(path, params, hash, open, strip, locInfo) { } export function prepareRawBlock(openRawBlock, content, close, locInfo) { - /*jshint -W040 */ if (openRawBlock.path.original !== close) { let errorNode = {loc: openRawBlock.path.loc}; @@ -91,7 +88,6 @@ export function prepareRawBlock(openRawBlock, content, close, locInfo) { } export function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { - /*jshint -W040 */ // When we are chaining inverse calls, we will not have a close path if (close && close.path && openBlock.path.original !== close.path.original) { let errorNode = {loc: openBlock.path.loc}; diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 75e50d2fe..883066165 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -425,7 +425,6 @@ JavaScriptCompiler.prototype = { // // Push the data lookup operator lookupData: function(depth, parts) { - /*jshint -W083 */ if (!depth) { this.pushStackLiteral('data'); } else { @@ -436,7 +435,6 @@ JavaScriptCompiler.prototype = { }, resolvePath: function(type, parts, i, falsy) { - /*jshint -W083 */ if (this.options.strict || this.options.assumeObjects) { this.push(strictLookup(this.options.strict, this, parts, type)); return; diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js index f474f2918..c5223947d 100644 --- a/lib/handlebars/utils.js +++ b/lib/handlebars/utils.js @@ -1,4 +1,3 @@ -/*jshint -W004 */ const escape = { '&': '&', '<': '<', diff --git a/package.json b/package.json index bc4be6894..7cff48f28 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "grunt-contrib-concat": "0.x", "grunt-contrib-connect": "0.x", "grunt-contrib-copy": "0.x", - "grunt-contrib-jshint": "0.x", "grunt-contrib-requirejs": "0.x", "grunt-contrib-uglify": "0.x", "grunt-contrib-watch": "0.x", diff --git a/src/parser-prefix.js b/src/parser-prefix.js index a4ba487c6..e26b99340 100644 --- a/src/parser-prefix.js +++ b/src/parser-prefix.js @@ -1,2 +1 @@ -/* jshint ignore:start */ /* istanbul ignore next */ diff --git a/src/parser-suffix.js b/src/parser-suffix.js index 67e3348c4..6e4aa20d6 100644 --- a/src/parser-suffix.js +++ b/src/parser-suffix.js @@ -1,2 +1 @@ export default handlebars; -/* jshint ignore:end */ From 4a40fc8e2f2d69b94188183a8324561b6e03ab6f Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 27 Apr 2015 10:18:40 -0500 Subject: [PATCH 3/6] NPM ignore log files --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index 41cf1f221..f10592c0f 100644 --- a/.npmignore +++ b/.npmignore @@ -10,6 +10,7 @@ Rakefile Gruntfile.js *.gemspec *.nuspec +*.log bench/* configurations/* components/* From 972f52171878ce88af455d7e8fac401a27ba0168 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 27 Apr 2015 10:19:39 -0500 Subject: [PATCH 4/6] Move noConflict implementation to module DRYs the code to avoid escapes like #1004 Fixes #1004 --- lib/handlebars.js | 17 ++++++----------- lib/handlebars.runtime.js | 21 +++++++-------------- lib/handlebars/no-conflict.js | 12 ++++++++++++ 3 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 lib/handlebars/no-conflict.js diff --git a/lib/handlebars.js b/lib/handlebars.js index 3f3ba4801..f11495905 100644 --- a/lib/handlebars.js +++ b/lib/handlebars.js @@ -1,4 +1,4 @@ -import Handlebars from './handlebars.runtime'; +import runtime from './handlebars.runtime'; // Compiler imports import AST from './handlebars/compiler/ast'; @@ -7,7 +7,9 @@ import { Compiler, compile, precompile } from './handlebars/compiler/compiler'; import JavaScriptCompiler from './handlebars/compiler/javascript-compiler'; import Visitor from './handlebars/compiler/visitor'; -let _create = Handlebars.create; +import noConflict from './handlebars/no-conflict'; + +let _create = runtime.create; function create() { let hb = _create(); @@ -30,16 +32,9 @@ function create() { let inst = create(); inst.create = create; -inst.Visitor = Visitor; +noConflict(inst); -/* istanbul ignore next */ -let $Handlebars = global.Handlebars; -/* istanbul ignore next */ -inst.noConflict = function() { - if (global.Handlebars === inst) { - global.Handlebars = $Handlebars; - } -}; +inst.Visitor = Visitor; inst['default'] = inst; diff --git a/lib/handlebars.runtime.js b/lib/handlebars.runtime.js index 75a6a7a82..3d05b5448 100644 --- a/lib/handlebars.runtime.js +++ b/lib/handlebars.runtime.js @@ -1,4 +1,3 @@ -/*global window */ import * as base from './handlebars/base'; // Each of these augment the Handlebars object. No need to setup here. @@ -8,6 +7,8 @@ import Exception from './handlebars/exception'; import * as Utils from './handlebars/utils'; import * as runtime from './handlebars/runtime'; +import noConflict from './handlebars/no-conflict'; + // For compatibility and usage outside of module systems, make the Handlebars object a namespace function create() { let hb = new base.HandlebarsEnvironment(); @@ -26,19 +27,11 @@ function create() { return hb; } -let Handlebars = create(); -Handlebars.create = create; +let inst = create(); +inst.create = create; -/* istanbul ignore next */ -let root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; -/* istanbul ignore next */ -Handlebars.noConflict = function() { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } -}; +noConflict(inst); -Handlebars['default'] = Handlebars; +inst['default'] = inst; -export default Handlebars; +export default inst; diff --git a/lib/handlebars/no-conflict.js b/lib/handlebars/no-conflict.js new file mode 100644 index 000000000..a421f57e5 --- /dev/null +++ b/lib/handlebars/no-conflict.js @@ -0,0 +1,12 @@ +/*global window */ +export default function(Handlebars) { + /* istanbul ignore next */ + let root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function() { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; +} From 0bf79ea5c088c3803690a2d7307a47e22e3e72e9 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 28 Apr 2015 14:51:32 -0500 Subject: [PATCH 5/6] Update release notes --- release-notes.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index b41226161..21a5346e9 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,12 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.2...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.3...master) + +## v3.0.3 - April 28th, 2015 +- [#1004](https://github.com/wycats/handlebars.js/issues/1004) - Latest version breaks with RequireJS (global is undefined) ([@boskee](https://api.github.com/users/boskee)) + +[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.2...v3.0.3) ## v3.0.2 - April 20th, 2015 - [#998](https://github.com/wycats/handlebars.js/pull/998) - Add full support for es6 ([@kpdecker](https://api.github.com/users/kpdecker)) From 891f48b7e9c321dd9cbe7a898533eb6b2434b8a0 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 28 Apr 2015 14:52:04 -0500 Subject: [PATCH 6/6] v3.0.3 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/bower.json b/components/bower.json index 7163ae75b..fe064c285 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "3.0.2", + "version": "3.0.3", "main": "handlebars.js", "dependencies": {} } diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 20e3840b7..ae298147a 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 3.0.2 + 3.0.3 handlebars.js Authors https://github.com/wycats/handlebars.js/blob/master/LICENSE https://github.com/wycats/handlebars.js/ diff --git a/package.json b/package.json index 7cff48f28..83f428d0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "3.0.2", + "version": "3.0.3", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [