Compare commits
1 Commits
fix-1838-2
...
fix-1838
| Author | SHA1 | Date | |
|---|---|---|---|
| ca0d385a6c |
@@ -5,6 +5,9 @@ indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[spec/expected/*.js]
|
||||
insert_final_newline = false
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
|
||||
@@ -308,7 +308,7 @@ JavaScriptCompiler.prototype = {
|
||||
|
||||
if (appendOnly) {
|
||||
if (bufferStart) {
|
||||
bufferStart.prepend('return ');
|
||||
bufferStart.prepend('return ""+');
|
||||
bufferEnd.add(';');
|
||||
} else if (!sourceSeen) {
|
||||
this.source.push('return "";');
|
||||
|
||||
Generated
+2
-39
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "handlebars",
|
||||
"version": "4.7.7",
|
||||
"version": "4.7.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "handlebars",
|
||||
"version": "4.7.7",
|
||||
"version": "4.7.8",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5",
|
||||
@@ -24,7 +24,6 @@
|
||||
"babel-runtime": "^5.1.10",
|
||||
"benchmark": "~1.0",
|
||||
"chai": "^4.2.0",
|
||||
"chai-diff": "^1.0.1",
|
||||
"concurrently": "^5.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"dtslint": "^0.5.5",
|
||||
@@ -2700,18 +2699,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/chai-diff": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-diff/-/chai-diff-1.0.1.tgz",
|
||||
"integrity": "sha1-bGaJRwDYDNkDUKtORANiXU9TocE=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"diff": "^2.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"chai": ">= 3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
@@ -4127,15 +4114,6 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz",
|
||||
"integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/diff-sequences": {
|
||||
"version": "27.4.0",
|
||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz",
|
||||
@@ -17452,15 +17430,6 @@
|
||||
"type-detect": "^4.0.5"
|
||||
}
|
||||
},
|
||||
"chai-diff": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-diff/-/chai-diff-1.0.1.tgz",
|
||||
"integrity": "sha1-bGaJRwDYDNkDUKtORANiXU9TocE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"diff": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
@@ -18606,12 +18575,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"diff": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz",
|
||||
"integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=",
|
||||
"dev": true
|
||||
},
|
||||
"diff-sequences": {
|
||||
"version": "27.4.0",
|
||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz",
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
"babel-runtime": "^5.1.10",
|
||||
"benchmark": "~1.0",
|
||||
"chai": "^4.2.0",
|
||||
"chai-diff": "^1.0.1",
|
||||
"concurrently": "^5.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"dtslint": "^0.5.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "a";
|
||||
},"useData":true});
|
||||
});
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "a";
|
||||
},"useData":true});
|
||||
});
|
||||
@@ -1,3 +1,3 @@
|
||||
{"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true}
|
||||
return "";
|
||||
},"useData":true}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(['some-path/handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
});
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
Precompile handlebar templates.
|
||||
Usage: handlebars [template|directory]...
|
||||
|
||||
Options:
|
||||
-f, --output Output File [string]
|
||||
--map Source Map File [string]
|
||||
@@ -22,4 +21,4 @@ Options:
|
||||
-e, --extension Template extension. [string] [default: "handlebars"]
|
||||
-b, --bom Removes the BOM (Byte Order Mark) from the beginning of the templates. [boolean]
|
||||
-v, --version Prints the current compiler version [boolean]
|
||||
--help Outputs this message [boolean]
|
||||
--help Outputs this message [boolean]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
|
||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
return templates;
|
||||
});
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
|
||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"useData":true});
|
||||
return templates;
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "<div>This is a test</div>";
|
||||
},"useData":true});
|
||||
});
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "<div>This is a test</div>";
|
||||
},"useData":true});
|
||||
});
|
||||
@@ -1,24 +1,25 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['known.helpers'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||
return parent[propertyName];
|
||||
}
|
||||
return undefined
|
||||
};
|
||||
return " <div>Some known helper</div>\n"
|
||||
+ ((stack1 = lookupProperty(helpers,"anotherHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"anotherHelper","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":22}}})) != null ? stack1 : "");
|
||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||
return parent[propertyName];
|
||||
}
|
||||
return undefined
|
||||
};
|
||||
|
||||
return ""+" <div>Some known helper</div>\n"
|
||||
+ ((stack1 = lookupProperty(helpers,"anotherHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"anotherHelper","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":22}}})) != null ? stack1 : "");
|
||||
},"2":function(container,depth0,helpers,partials,data) {
|
||||
return " <div>Another known helper</div>\n";
|
||||
return " <div>Another known helper</div>\n";
|
||||
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||
return parent[propertyName];
|
||||
}
|
||||
return undefined
|
||||
};
|
||||
return ((stack1 = lookupProperty(helpers,"someHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"someHelper","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":15}}})) != null ? stack1 : "");
|
||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||
return parent[propertyName];
|
||||
}
|
||||
return undefined
|
||||
};
|
||||
|
||||
return ""+((stack1 = lookupProperty(helpers,"someHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"someHelper","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":15}}})) != null ? stack1 : "");
|
||||
},"useData":true});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return Handlebars.partials['partial.template'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "<div>Test Partial</div>";
|
||||
},"useData":true});
|
||||
});
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return Handlebars.partials['partial.template'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "<div>Test Partial</div>";
|
||||
},"useData":true});
|
||||
});
|
||||
@@ -34,6 +34,7 @@ describe('javascript-compiler api', function() {
|
||||
.toCompileTo('food');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#compilerInfo', function() {
|
||||
var $superCheck, $superInfo;
|
||||
beforeEach(function() {
|
||||
@@ -58,6 +59,7 @@ describe('javascript-compiler api', function() {
|
||||
.toCompileTo('food ');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buffer', function() {
|
||||
var $superAppend, $superCreate;
|
||||
beforeEach(function() {
|
||||
@@ -116,4 +118,13 @@ describe('javascript-compiler api', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('options', function() {
|
||||
it('should append `noEscape` statements as string', function() {
|
||||
expectTemplate('{{a}}{{b}}')
|
||||
.withCompileOptions({ noEscape: true })
|
||||
.withInput({ a: 1, b: 1 })
|
||||
.toCompileTo('11');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-6
@@ -4,7 +4,6 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-diff'));
|
||||
const expect = chai.expect;
|
||||
|
||||
const testCases = [
|
||||
@@ -192,11 +191,9 @@ module.exports = function(grunt) {
|
||||
fs.unlinkSync(outputLocation);
|
||||
}
|
||||
|
||||
expect(normalizedOutput).not.to.be.differentFrom(
|
||||
expect(normalizedOutput).to.be.equal(
|
||||
normalizedExpectedOutput,
|
||||
{
|
||||
relaxedSpace: true
|
||||
}
|
||||
`Failed on ${expectedOutputSpec}`
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -226,7 +223,7 @@ function addPathToNodeJs(pathEnvironment) {
|
||||
|
||||
function normalizeCrlf(string) {
|
||||
if (typeof string === 'string') {
|
||||
return string.replace(/\r\n/g, '\n');
|
||||
return string.replace(/\r\n/g, '\n').trim();
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user