Merge branch '4.x'
# Conflicts: # .eslintrc.js # lib/precompiler.js # package.json # release-notes.md
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ module.exports = {
|
||||
"templateStrings": true
|
||||
},
|
||||
"rules": {
|
||||
// overrides eslint:recommended defaults
|
||||
// overrides eslint:recommended defaults
|
||||
"no-sparse-arrays": "off",
|
||||
"no-func-assign": "off",
|
||||
"no-console": "warn",
|
||||
|
||||
+1
-1
@@ -96,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]: https://jsfiddle.net/9D88g/113/
|
||||
[jsfiddle]: https://jsfiddle.net/9D88g/180/
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = {
|
||||
header: function() {
|
||||
return 'Colors';
|
||||
},
|
||||
hasItems: true, // To make things fairer in mustache land due to no `{{if}}` construct on arrays
|
||||
hasItems: true, // To make things fairer in mustache land due to no `{{if}}` construct on arrays
|
||||
items: [
|
||||
{name: 'red', current: true, url: '#Red'},
|
||||
{name: 'green', current: false, url: '#Green'},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "handlebars",
|
||||
"version": "4.0.10",
|
||||
"version": "4.0.11",
|
||||
"main": "handlebars.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package>
|
||||
<metadata>
|
||||
<id>handlebars.js</id>
|
||||
<version>4.0.10</version>
|
||||
<version>4.0.11</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>
|
||||
|
||||
@@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers';
|
||||
import {registerDefaultDecorators} from './decorators';
|
||||
import logger from './logger';
|
||||
|
||||
export const VERSION = '4.0.10';
|
||||
export const VERSION = '4.0.11';
|
||||
export const COMPILER_REVISION = 7;
|
||||
|
||||
export const REVISION_CHANGES = {
|
||||
|
||||
@@ -118,7 +118,7 @@ CodeGen.prototype = {
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
|
||||
.replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
|
||||
.replace(/\u2029/g, '\\u2029') + '"';
|
||||
},
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export function stripFlags(open, close) {
|
||||
}
|
||||
|
||||
export function stripComment(comment) {
|
||||
return comment.replace(/^\{\{~?\!-?-?/, '')
|
||||
return comment.replace(/^\{\{~?!-?-?/, '')
|
||||
.replace(/-?-?~?\}\}$/, '');
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ JavaScriptCompiler.prototype = {
|
||||
};
|
||||
|
||||
if (this.decorators) {
|
||||
ret.main_d = this.decorators; // eslint-disable-line camelcase
|
||||
ret.main_d = this.decorators; // eslint-disable-line camelcase
|
||||
ret.useDecorators = true;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ JavaScriptCompiler.prototype = {
|
||||
// aliases will not be used, but this case is already being run on the client and
|
||||
// we aren't concern about minimizing the template size.
|
||||
let aliasCount = 0;
|
||||
for (let alias in this.aliases) { // eslint-disable-line guard-for-in
|
||||
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) {
|
||||
@@ -699,12 +699,12 @@ JavaScriptCompiler.prototype = {
|
||||
|
||||
for (let i = 0, l = children.length; i < l; i++) {
|
||||
child = children[i];
|
||||
compiler = new this.compiler(); // eslint-disable-line new-cap
|
||||
compiler = new this.compiler(); // eslint-disable-line new-cap
|
||||
|
||||
let existing = this.matchExistingProgram(child);
|
||||
|
||||
if (existing == null) {
|
||||
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
|
||||
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
|
||||
let index = this.context.programs.length;
|
||||
child.index = index;
|
||||
child.name = 'program' + index;
|
||||
|
||||
@@ -24,10 +24,10 @@ let logger = {
|
||||
|
||||
if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
|
||||
let method = logger.methodMap[level];
|
||||
if (!console[method]) { // eslint-disable-line no-console
|
||||
if (!console[method]) { // eslint-disable-line no-console
|
||||
method = 'log';
|
||||
}
|
||||
console[method](...message); // eslint-disable-line no-console
|
||||
console[method](...message); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+5
-4
@@ -60,7 +60,7 @@ function loadStrings(opts, callback) {
|
||||
|
||||
function loadFiles(opts, callback) {
|
||||
// Build file extension pattern
|
||||
let extension = (opts.extension || 'handlebars').replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
|
||||
let extension = (opts.extension || 'handlebars').replace(/[\\^$*+?.():=!|{}\-[\]]/g, function(arg) { return '\\' + arg; });
|
||||
extension = new RegExp('\\.' + extension + '$');
|
||||
|
||||
let ret = [],
|
||||
@@ -290,8 +290,9 @@ function minify(output, sourceMapFile) {
|
||||
return output;
|
||||
}
|
||||
return require('uglify-js').minify(output.code, {
|
||||
fromString: true,
|
||||
outSourceMap: sourceMapFile,
|
||||
inSourceMap: JSON.parse(output.map)
|
||||
sourceMap: {
|
||||
content: output.map,
|
||||
url: sourceMapFile
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+4
-4
@@ -21,12 +21,12 @@
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^1.4.0",
|
||||
"source-map": "^0.4.4",
|
||||
"async": "^2.5.0",
|
||||
"source-map": "^0.6.1",
|
||||
"yargs": "^3.32.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "^2.6"
|
||||
"uglify-js": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.1.49",
|
||||
@@ -44,7 +44,7 @@
|
||||
"grunt-contrib-copy": "0.x",
|
||||
"grunt-contrib-uglify": "0.x",
|
||||
"grunt-contrib-watch": "0.x",
|
||||
"grunt-eslint": "19.0.x",
|
||||
"grunt-eslint": "^20.1.0",
|
||||
"grunt-saucelabs": "8.x",
|
||||
"grunt-webpack": "^1.0.8",
|
||||
"istanbul": "kpdecker/istanbul",
|
||||
|
||||
+11
-1
@@ -2,7 +2,17 @@
|
||||
|
||||
## Development
|
||||
|
||||
[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.10...master)
|
||||
[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.11...master)
|
||||
|
||||
## v4.0.11 - October 17th, 2017
|
||||
- [#1391](https://github.com/wycats/handlebars.js/issues/1391) - `uglify-js` is unconditionally imported, but only listed as optional dependency ([@Turbo87](https://api.github.com/users/Turbo87))
|
||||
- [#1233](https://github.com/wycats/handlebars.js/issues/1233) - Unable to build under windows - error at test:bin task ([@blikblum](https://api.github.com/users/blikblum))
|
||||
- Update (C) year in the LICENSE file - 21386b6
|
||||
|
||||
Compatibility notes:
|
||||
- This is a bugfix release. There are no breaking change and no new features.
|
||||
|
||||
[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.10...v4.0.11)
|
||||
|
||||
## v4.0.10 - May 21st, 2017
|
||||
- Fix regression in 4.0.9: Replace "Object.assign" (not support in IE) by "util/extend" - 0e953d1
|
||||
|
||||
@@ -59,6 +59,7 @@ describe('ast', function() {
|
||||
equals(node.loc.end.column, lastColumn);
|
||||
}
|
||||
|
||||
/* eslint-disable no-multi-spaces */
|
||||
ast = Handlebars.parse(
|
||||
'line 1 {{line1Token}}\n' // 1
|
||||
+ ' line 2 {{line2token}}\n' // 2
|
||||
@@ -71,6 +72,7 @@ describe('ast', function() {
|
||||
+ '{{else inverse}}\n' // 9
|
||||
+ '{{else}}\n' // 10
|
||||
+ '{{/open}}'); // 11
|
||||
/* eslint-enable no-multi-spaces */
|
||||
body = ast.body;
|
||||
|
||||
it('gets ContentNode line numbers', function() {
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ describe('helpers', function() {
|
||||
{ 'name': 'Yehuda', 'id': 2 }
|
||||
]};
|
||||
|
||||
shouldCompileTo(source, [data, {link: link}], '<ul><li><a href=\"/people/1\">Alan</a></li><li><a href=\"/people/2\">Yehuda</a></li></ul>');
|
||||
shouldCompileTo(source, [data, {link: link}], '<ul><li><a href="/people/1">Alan</a></li><li><a href="/people/2">Yehuda</a></li></ul>');
|
||||
});
|
||||
|
||||
it('block helper for undefined value', function() {
|
||||
|
||||
+6
-6
@@ -51,7 +51,7 @@ describe('parser', function() {
|
||||
});
|
||||
|
||||
it('parses mustaches with string parameters', function() {
|
||||
equals(astFor('{{foo bar \"baz\" }}'), '{{ PATH:foo [PATH:bar, "baz"] }}\n');
|
||||
equals(astFor('{{foo bar "baz" }}'), '{{ PATH:foo [PATH:bar, "baz"] }}\n');
|
||||
});
|
||||
|
||||
it('parses mustaches with NUMBER parameters', function() {
|
||||
@@ -87,10 +87,10 @@ describe('parser', function() {
|
||||
|
||||
equals(astFor("{{foo bat='bam'}}"), '{{ PATH:foo [] HASH{bat="bam"} }}\n');
|
||||
|
||||
equals(astFor('{{foo omg bar=baz bat=\"bam\"}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam"} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat=\"bam\" baz=1}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=NUMBER{1}} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat=\"bam\" baz=true}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=BOOLEAN{true}} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat=\"bam\" baz=false}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=BOOLEAN{false}} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat="bam"}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam"} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat="bam" baz=1}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=NUMBER{1}} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat="bam" baz=true}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=BOOLEAN{true}} }}\n');
|
||||
equals(astFor('{{foo omg bar=baz bat="bam" baz=false}}'), '{{ PATH:foo [PATH:omg] HASH{bar=PATH:baz, bat="bam", baz=BOOLEAN{false}} }}\n');
|
||||
});
|
||||
|
||||
it('parses contents followed by a mustache', function() {
|
||||
@@ -136,7 +136,7 @@ describe('parser', function() {
|
||||
});
|
||||
|
||||
it('parses a multi-line comment', function() {
|
||||
equals(astFor('{{!\nthis is a multi-line comment\n}}'), "{{! \'\nthis is a multi-line comment\n\' }}\n");
|
||||
equals(astFor('{{!\nthis is a multi-line comment\n}}'), "{{! '\nthis is a multi-line comment\n' }}\n");
|
||||
});
|
||||
|
||||
it('parses an inverse section', function() {
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ describe('spec', function() {
|
||||
// We nest the entire response from partials, not just the literals
|
||||
|| (name === 'partials.json' && test.name === 'Standalone Indentation')
|
||||
|
||||
|| (/\{\{\=/).test(test.template)
|
||||
|| _.any(test.partials, function(partial) { return (/\{\{\=/).test(partial); })) {
|
||||
|| (/\{\{=/).test(test.template)
|
||||
|| _.any(test.partials, function(partial) { return (/\{\{=/).test(partial); })) {
|
||||
it.skip(name + ' - ' + test.name);
|
||||
return;
|
||||
}
|
||||
|
||||
+5
-5
@@ -282,13 +282,13 @@ describe('Tokenizer', function() {
|
||||
});
|
||||
|
||||
it('tokenizes mustaches with String params as "OPEN ID ID STRING CLOSE"', function() {
|
||||
var result = tokenize('{{ foo bar \"baz\" }}');
|
||||
var result = tokenize('{{ foo bar "baz" }}');
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'STRING', 'CLOSE']);
|
||||
shouldBeToken(result[3], 'STRING', 'baz');
|
||||
});
|
||||
|
||||
it('tokenizes mustaches with String params using single quotes as "OPEN ID ID STRING CLOSE"', function() {
|
||||
var result = tokenize("{{ foo bar \'baz\' }}");
|
||||
var result = tokenize("{{ foo bar 'baz' }}");
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'STRING', 'CLOSE']);
|
||||
shouldBeToken(result[3], 'STRING', 'baz');
|
||||
});
|
||||
@@ -365,13 +365,13 @@ describe('Tokenizer', function() {
|
||||
result = tokenize('{{ foo bar\n baz=bat }}');
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'ID', 'EQUALS', 'ID', 'CLOSE']);
|
||||
|
||||
result = tokenize('{{ foo bar baz=\"bat\" }}');
|
||||
result = tokenize('{{ foo bar baz="bat" }}');
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'ID', 'EQUALS', 'STRING', 'CLOSE']);
|
||||
|
||||
result = tokenize('{{ foo bar baz=\"bat\" bam=wot }}');
|
||||
result = tokenize('{{ foo bar baz="bat" bam=wot }}');
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'ID', 'EQUALS', 'STRING', 'ID', 'EQUALS', 'ID', 'CLOSE']);
|
||||
|
||||
result = tokenize('{{foo omg bar=baz bat=\"bam\"}}');
|
||||
result = tokenize('{{foo omg bar=baz bat="bam"}}');
|
||||
shouldMatchTokens(result, ['OPEN', 'ID', 'ID', 'ID', 'EQUALS', 'ID', 'ID', 'EQUALS', 'STRING', 'CLOSE']);
|
||||
shouldBeToken(result[2], 'ID', 'omg');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user