New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

diff2html

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff2html - npm Package Compare versions

Comparing version 3.4.19 to 3.4.20-usewontache.1.60e7a2e

8

lib-esm/diff2html-templates.d.ts

@@ -1,7 +0,5 @@

import * as Hogan from "hogan.js";
declare type CompiledTemplates = {
[name: string]: Hogan.Template;
import { CompiledTemplate } from 'wontache';
export declare const defaultTemplates: {
[_: string]: CompiledTemplate;
};
export declare const defaultTemplates: CompiledTemplates;
export {};
//# sourceMappingURL=diff2html-templates.d.ts.map

@@ -1,34 +0,68 @@

import * as Hogan from "hogan.js";
import mustache from 'wontache';
export var defaultTemplates = {};
defaultTemplates["file-summary-line"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<li class=\"d2h-file-list-line\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-name-wrapper\">"); t.b("\n" + i); t.b(t.rp("<fileIcon0", c, p, " ")); t.b(" <a href=\"#"); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-name\">"); t.b(t.v(t.f("fileName", c, p, 0))); t.b("</a>"); t.b("\n" + i); t.b(" <span class=\"d2h-file-stats\">"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-added\">"); t.b(t.v(t.f("addedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-deleted\">"); t.b(t.v(t.f("deletedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b("</li>"); return t.fl(); }, partials: { "<fileIcon0": { name: "fileIcon", partials: {}, subs: {} } }, subs: {} });
defaultTemplates["file-summary-wrapper"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-file-list-wrapper\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-list-header\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-list-title\">Files changed ("); t.b(t.v(t.f("filesNumber", c, p, 0))); t.b(")</span>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-hide\">hide</a>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-show\">show</a>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <ol class=\"d2h-file-list\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("files", c, p, 0))); t.b("\n" + i); t.b(" </ol>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["generic-block-header"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("lineClass", c, p, 0))); t.b(" "); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\"></td>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b(t.t(t.f("blockHeader", c, p, 0))); t.b("</div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["generic-empty-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" File without changes"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["generic-file-path"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-file-name-wrapper\">"); t.b("\n" + i); t.b(t.rp("<fileIcon0", c, p, " ")); t.b(" <span class=\"d2h-file-name\">"); t.b(t.v(t.f("fileDiffName", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(t.rp("<fileTag1", c, p, " ")); t.b("</span>"); t.b("\n" + i); t.b("<label class=\"d2h-file-collapse\">"); t.b("\n" + i); t.b(" <input class=\"d2h-file-collapse-input\" type=\"checkbox\" name=\"viewed\" value=\"viewed\">"); t.b("\n" + i); t.b(" Viewed"); t.b("\n" + i); t.b("</label>"); return t.fl(); }, partials: { "<fileIcon0": { name: "fileIcon", partials: {}, subs: {} }, "<fileTag1": { name: "fileTag", partials: {}, subs: {} } }, subs: {} });
defaultTemplates["generic-line"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("lineClass", c, p, 0))); t.b(" "); t.b(t.v(t.f("type", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("lineNumber", c, p, 0))); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("type", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b("\n" + i); if (t.s(t.f("prefix", c, p, 1), c, p, 0, 162, 238, "{{ }}")) {
t.rs(c, p, function (c, p, t) { t.b(" <span class=\"d2h-code-line-prefix\">"); t.b(t.t(t.f("prefix", c, p, 0))); t.b("</span>"); t.b("\n" + i); });
c.pop();
} if (!t.s(t.f("prefix", c, p, 1), c, p, 1, 0, 0, "")) {
t.b(" <span class=\"d2h-code-line-prefix\">&nbsp;</span>");
t.b("\n" + i);
} ; if (t.s(t.f("content", c, p, 1), c, p, 0, 371, 445, "{{ }}")) {
t.rs(c, p, function (c, p, t) { t.b(" <span class=\"d2h-code-line-ctn\">"); t.b(t.t(t.f("content", c, p, 0))); t.b("</span>"); t.b("\n" + i); });
c.pop();
} if (!t.s(t.f("content", c, p, 1), c, p, 1, 0, 0, "")) {
t.b(" <span class=\"d2h-code-line-ctn\"><br></span>");
t.b("\n" + i);
} ; t.b(" </div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["generic-wrapper"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-wrapper\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("content", c, p, 0))); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["icon-file-added"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\""); t.b("\n" + i); t.b(" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["icon-file-changed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["icon-file-deleted"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["icon-file-renamed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-moved\" height=\"16\" title=\"renamed\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["icon-file"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon\" height=\"16\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"12\">"); t.b("\n" + i); t.b(" <path d=\"M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["line-by-line-file-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div id=\""); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-wrapper\" data-lang=\""); t.b(t.v(t.d("file.language", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-header\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("filePath", c, p, 0))); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-file-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("diffs", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["line-by-line-numbers"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"line-num1\">"); t.b(t.v(t.f("oldNumber", c, p, 0))); t.b("</div>"); t.b("\n" + i); t.b("<div class=\"line-num2\">"); t.b(t.v(t.f("newNumber", c, p, 0))); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["side-by-side-file-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div id=\""); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-wrapper\" data-lang=\""); t.b(t.v(t.d("file.language", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-header\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("filePath", c, p, 0))); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-files-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-side-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.d("diffs.left", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-file-side-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.d("diffs.right", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["tag-file-added"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["tag-file-changed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["tag-file-deleted"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["tag-file-renamed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>"); return t.fl(); }, partials: {}, subs: {} });
defaultTemplates["file-summary-line"] = mustache({ sections: [function (state) {
return "<li class=\"d2h-file-list-line\">\n <span class=\"d2h-file-name-wrapper\">\n" + (state.d ? " {{>fileIcon}}\n" : state.p(state, "fileIcon", " ")) + " <a href=\"#" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-name\">" + (state.d ? "{{fileName}}" : state.v(state, ["fileName"])) + "</a>\n <span class=\"d2h-file-stats\">\n <span class=\"d2h-lines-added\">" + (state.d ? "{{addedLines}}" : state.v(state, ["addedLines"])) + "</span>\n <span class=\"d2h-lines-deleted\">" + (state.d ? "{{deletedLines}}" : state.v(state, ["deletedLines"])) + "</span>\n </span>\n </span>\n</li>";
}] });
defaultTemplates["file-summary-wrapper"] = mustache({ sections: [function (state) {
return "<div class=\"d2h-file-list-wrapper\">\n <div class=\"d2h-file-list-header\">\n <span class=\"d2h-file-list-title\">Files changed (" + (state.d ? "{{filesNumber}}" : state.v(state, ["filesNumber"])) + ")</span>\n <a class=\"d2h-file-switch d2h-hide\">hide</a>\n <a class=\"d2h-file-switch d2h-show\">show</a>\n </div>\n <ol class=\"d2h-file-list\">\n " + (state.d ? "{{{files}}}" : state.v(state, ["files"], 0)) + "\n </ol>\n</div>";
}] });
defaultTemplates["generic-block-header"] = mustache({ sections: [function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{lineClass}}" : state.v(state, ["lineClass"])) + " " + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\"></td>\n <td class=\"" + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">" + (state.d ? "{{{blockHeader}}}" : state.v(state, ["blockHeader"], 0)) + "</div>\n </td>\n</tr>";
}] });
defaultTemplates["generic-empty-diff"] = mustache({ sections: [function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">\n File without changes\n </div>\n </td>\n</tr>";
}] });
defaultTemplates["generic-file-path"] = mustache({ sections: [function (state) {
return "<span class=\"d2h-file-name-wrapper\">\n" + (state.d ? " {{>fileIcon}}\n" : state.p(state, "fileIcon", " ")) + " <span class=\"d2h-file-name\">" + (state.d ? "{{fileDiffName}}" : state.v(state, ["fileDiffName"])) + "</span>\n" + (state.d ? " {{>fileTag}}\n" : state.p(state, "fileTag", " ")) + "</span>\n<label class=\"d2h-file-collapse\">\n <input class=\"d2h-file-collapse-input\" type=\"checkbox\" name=\"viewed\" value=\"viewed\">\n Viewed\n</label>";
}] });
defaultTemplates["generic-line"] = mustache({ sections: [function (state) {
return " <span class=\"d2h-code-line-prefix\">" + (state.d ? "{{{prefix}}}" : state.v(state, ["prefix"], 0)) + "</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-prefix\">&nbsp;</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-ctn\">" + (state.d ? "{{{content}}}" : state.v(state, ["content"], 0)) + "</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-ctn\"><br></span>\n";
}, function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{lineClass}}" : state.v(state, ["lineClass"])) + " " + (state.d ? "{{type}}" : state.v(state, ["type"])) + "\">\n " + (state.d ? "{{{lineNumber}}}" : state.v(state, ["lineNumber"], 0)) + "\n </td>\n <td class=\"" + (state.d ? "{{type}}" : state.v(state, ["type"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">\n" + (state.d ? " {{#prefix}}\n" : "") + state.s(state, ["prefix"], 0) + (state.d ? " {{/prefix}}\n" : "") + (state.d ? " {{^prefix}}\n" : "") + state.z(state, ["prefix"], 1) + (state.d ? " {{/prefix}}\n" : "") + (state.d ? " {{#content}}\n" : "") + state.s(state, ["content"], 2) + (state.d ? " {{/content}}\n" : "") + (state.d ? " {{^content}}\n" : "") + state.z(state, ["content"], 3) + (state.d ? " {{/content}}\n" : "") + " </div>\n </td>\n</tr>";
}] });
defaultTemplates["generic-wrapper"] = mustache({ sections: [function (state) {
return "<div class=\"d2h-wrapper\">\n " + (state.d ? "{{{content}}}" : state.v(state, ["content"], 0)) + "\n</div>";
}] });
defaultTemplates["icon-file-added"] = mustache({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\"\n width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>\n</svg>";
}] });
defaultTemplates["icon-file-changed"] = mustache({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>\n</svg>";
}] });
defaultTemplates["icon-file-deleted"] = mustache({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>\n</svg>";
}] });
defaultTemplates["icon-file-renamed"] = mustache({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-moved\" height=\"16\" title=\"renamed\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z\"></path>\n</svg>";
}] });
defaultTemplates["icon-file"] = mustache({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon\" height=\"16\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"12\">\n <path d=\"M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z\"></path>\n</svg>";
}] });
defaultTemplates["line-by-line-file-diff"] = mustache({ sections: [function (state) {
return "<div id=\"" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-wrapper\" data-lang=\"" + (state.d ? "{{file.language}}" : state.v(state, ["file", "language"])) + "\">\n <div class=\"d2h-file-header\">\n " + (state.d ? "{{{filePath}}}" : state.v(state, ["filePath"], 0)) + "\n </div>\n <div class=\"d2h-file-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs}}}" : state.v(state, ["diffs"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n</div>";
}] });
defaultTemplates["line-by-line-numbers"] = mustache({ sections: [function (state) {
return "<div class=\"line-num1\">" + (state.d ? "{{oldNumber}}" : state.v(state, ["oldNumber"])) + "</div>\n<div class=\"line-num2\">" + (state.d ? "{{newNumber}}" : state.v(state, ["newNumber"])) + "</div>";
}] });
defaultTemplates["side-by-side-file-diff"] = mustache({ sections: [function (state) {
return "<div id=\"" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-wrapper\" data-lang=\"" + (state.d ? "{{file.language}}" : state.v(state, ["file", "language"])) + "\">\n <div class=\"d2h-file-header\">\n " + (state.d ? "{{{filePath}}}" : state.v(state, ["filePath"], 0)) + "\n </div>\n <div class=\"d2h-files-diff\">\n <div class=\"d2h-file-side-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs.left}}}" : state.v(state, ["diffs", "left"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n <div class=\"d2h-file-side-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs.right}}}" : state.v(state, ["diffs", "right"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n </div>\n</div>";
}] });
defaultTemplates["tag-file-added"] = mustache({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>";
}] });
defaultTemplates["tag-file-changed"] = mustache({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>";
}] });
defaultTemplates["tag-file-deleted"] = mustache({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>";
}] });
defaultTemplates["tag-file-renamed"] = mustache({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>";
}] });
//# sourceMappingURL=diff2html-templates.js.map

@@ -1,2 +0,2 @@

import * as Hogan from 'hogan.js';
import { CompiledTemplate, Partials } from 'wontache';
export interface RawTemplates {

@@ -6,3 +6,3 @@ [name: string]: string;

export interface CompiledTemplates {
[name: string]: Hogan.Template;
[name: string]: CompiledTemplate;
}

@@ -16,7 +16,7 @@ export interface HoganJsUtilsConfig {

constructor({ compiledTemplates, rawTemplates }: HoganJsUtilsConfig);
static compile(templateString: string): Hogan.Template;
render(namespace: string, view: string, params: Hogan.Context, partials?: Hogan.Partials, indent?: string): string;
template(namespace: string, view: string): Hogan.Template;
static compile(templateString: string): CompiledTemplate;
render(namespace: string, view: string, params: object, partials?: Partials): string;
template(namespace: string, view: string): CompiledTemplate;
private templateKey;
}
//# sourceMappingURL=hoganjs-utils.d.ts.map

@@ -12,3 +12,3 @@ var __assign = (this && this.__assign) || function () {

};
import * as Hogan from 'hogan.js';
import mustache from 'wontache';
import { defaultTemplates } from './diff2html-templates';

@@ -21,3 +21,3 @@ var HoganJsUtils = (function () {

var name = _a[0], templateString = _a[1];
var compiledTemplate = Hogan.compile(templateString, { asString: false });
var compiledTemplate = mustache(templateString);
return __assign(__assign({}, previousTemplates), (_b = {}, _b[name] = compiledTemplate, _b));

@@ -28,9 +28,9 @@ }, {});

HoganJsUtils.compile = function (templateString) {
return Hogan.compile(templateString, { asString: false });
return mustache(templateString);
};
HoganJsUtils.prototype.render = function (namespace, view, params, partials, indent) {
HoganJsUtils.prototype.render = function (namespace, view, params, partials) {
var templateKey = this.templateKey(namespace, view);
try {
var template = this.preCompiledTemplates[templateKey];
return template.render(params, partials, indent);
return template(params, { partials: partials });
}

@@ -37,0 +37,0 @@ catch (e) {

@@ -49,11 +49,13 @@ var __assign = (this && this.__assign) || function () {

var fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, renderUtils.getFileIcon(file));
return fileDiffTemplate.render({
return fileDiffTemplate({
file: file,
fileHtmlId: renderUtils.getHtmlId(file),
diffs: diffs,
filePath: filePathTemplate.render({
filePath: filePathTemplate({
fileDiffName: renderUtils.filenameDiff(file),
}, {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
partials: {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
},
}),

@@ -60,0 +62,0 @@ });

@@ -49,11 +49,13 @@ var __assign = (this && this.__assign) || function () {

var fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, renderUtils.getFileIcon(file));
return fileDiffTemplate.render({
return fileDiffTemplate({
file: file,
fileHtmlId: renderUtils.getHtmlId(file),
diffs: diffs,
filePath: filePathTemplate.render({
filePath: filePathTemplate({
fileDiffName: renderUtils.filenameDiff(file),
}, {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
partials: {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
},
}),

@@ -60,0 +62,0 @@ });

@@ -1,7 +0,5 @@

import * as Hogan from "hogan.js";
declare type CompiledTemplates = {
[name: string]: Hogan.Template;
import { CompiledTemplate } from 'wontache';
export declare const defaultTemplates: {
[_: string]: CompiledTemplate;
};
export declare const defaultTemplates: CompiledTemplates;
export {};
//# sourceMappingURL=diff2html-templates.d.ts.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTemplates = void 0;
var Hogan = __importStar(require("hogan.js"));
var wontache_1 = __importDefault(require("wontache"));
exports.defaultTemplates = {};
exports.defaultTemplates["file-summary-line"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<li class=\"d2h-file-list-line\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-name-wrapper\">"); t.b("\n" + i); t.b(t.rp("<fileIcon0", c, p, " ")); t.b(" <a href=\"#"); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-name\">"); t.b(t.v(t.f("fileName", c, p, 0))); t.b("</a>"); t.b("\n" + i); t.b(" <span class=\"d2h-file-stats\">"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-added\">"); t.b(t.v(t.f("addedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-deleted\">"); t.b(t.v(t.f("deletedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b("</li>"); return t.fl(); }, partials: { "<fileIcon0": { name: "fileIcon", partials: {}, subs: {} } }, subs: {} });
exports.defaultTemplates["file-summary-wrapper"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-file-list-wrapper\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-list-header\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-list-title\">Files changed ("); t.b(t.v(t.f("filesNumber", c, p, 0))); t.b(")</span>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-hide\">hide</a>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-show\">show</a>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <ol class=\"d2h-file-list\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("files", c, p, 0))); t.b("\n" + i); t.b(" </ol>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["generic-block-header"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("lineClass", c, p, 0))); t.b(" "); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\"></td>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b(t.t(t.f("blockHeader", c, p, 0))); t.b("</div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["generic-empty-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" File without changes"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["generic-file-path"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-file-name-wrapper\">"); t.b("\n" + i); t.b(t.rp("<fileIcon0", c, p, " ")); t.b(" <span class=\"d2h-file-name\">"); t.b(t.v(t.f("fileDiffName", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(t.rp("<fileTag1", c, p, " ")); t.b("</span>"); t.b("\n" + i); t.b("<label class=\"d2h-file-collapse\">"); t.b("\n" + i); t.b(" <input class=\"d2h-file-collapse-input\" type=\"checkbox\" name=\"viewed\" value=\"viewed\">"); t.b("\n" + i); t.b(" Viewed"); t.b("\n" + i); t.b("</label>"); return t.fl(); }, partials: { "<fileIcon0": { name: "fileIcon", partials: {}, subs: {} }, "<fileTag1": { name: "fileTag", partials: {}, subs: {} } }, subs: {} });
exports.defaultTemplates["generic-line"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("lineClass", c, p, 0))); t.b(" "); t.b(t.v(t.f("type", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("lineNumber", c, p, 0))); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("type", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); t.b("\n" + i); if (t.s(t.f("prefix", c, p, 1), c, p, 0, 162, 238, "{{ }}")) {
t.rs(c, p, function (c, p, t) { t.b(" <span class=\"d2h-code-line-prefix\">"); t.b(t.t(t.f("prefix", c, p, 0))); t.b("</span>"); t.b("\n" + i); });
c.pop();
} if (!t.s(t.f("prefix", c, p, 1), c, p, 1, 0, 0, "")) {
t.b(" <span class=\"d2h-code-line-prefix\">&nbsp;</span>");
t.b("\n" + i);
} ; if (t.s(t.f("content", c, p, 1), c, p, 0, 371, 445, "{{ }}")) {
t.rs(c, p, function (c, p, t) { t.b(" <span class=\"d2h-code-line-ctn\">"); t.b(t.t(t.f("content", c, p, 0))); t.b("</span>"); t.b("\n" + i); });
c.pop();
} if (!t.s(t.f("content", c, p, 1), c, p, 1, 0, 0, "")) {
t.b(" <span class=\"d2h-code-line-ctn\"><br></span>");
t.b("\n" + i);
} ; t.b(" </div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["generic-wrapper"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-wrapper\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("content", c, p, 0))); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["icon-file-added"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\""); t.b("\n" + i); t.b(" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["icon-file-changed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["icon-file-deleted"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["icon-file-renamed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-moved\" height=\"16\" title=\"renamed\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["icon-file"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon\" height=\"16\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"12\">"); t.b("\n" + i); t.b(" <path d=\"M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["line-by-line-file-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div id=\""); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-wrapper\" data-lang=\""); t.b(t.v(t.d("file.language", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-header\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("filePath", c, p, 0))); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-file-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("diffs", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["line-by-line-numbers"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"line-num1\">"); t.b(t.v(t.f("oldNumber", c, p, 0))); t.b("</div>"); t.b("\n" + i); t.b("<div class=\"line-num2\">"); t.b(t.v(t.f("newNumber", c, p, 0))); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["side-by-side-file-diff"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div id=\""); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-wrapper\" data-lang=\""); t.b(t.v(t.d("file.language", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-header\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("filePath", c, p, 0))); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-files-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-side-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.d("diffs.left", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <div class=\"d2h-file-side-diff\">"); t.b("\n" + i); t.b(" <div class=\"d2h-code-wrapper\">"); t.b("\n" + i); t.b(" <table class=\"d2h-diff-table\">"); t.b("\n" + i); t.b(" <tbody class=\"d2h-diff-tbody\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.d("diffs.right", c, p, 0))); t.b("\n" + i); t.b(" </tbody>"); t.b("\n" + i); t.b(" </table>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["tag-file-added"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["tag-file-changed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["tag-file-deleted"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["tag-file-renamed"] = new Hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>"); return t.fl(); }, partials: {}, subs: {} });
exports.defaultTemplates["file-summary-line"] = (0, wontache_1.default)({ sections: [function (state) {
return "<li class=\"d2h-file-list-line\">\n <span class=\"d2h-file-name-wrapper\">\n" + (state.d ? " {{>fileIcon}}\n" : state.p(state, "fileIcon", " ")) + " <a href=\"#" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-name\">" + (state.d ? "{{fileName}}" : state.v(state, ["fileName"])) + "</a>\n <span class=\"d2h-file-stats\">\n <span class=\"d2h-lines-added\">" + (state.d ? "{{addedLines}}" : state.v(state, ["addedLines"])) + "</span>\n <span class=\"d2h-lines-deleted\">" + (state.d ? "{{deletedLines}}" : state.v(state, ["deletedLines"])) + "</span>\n </span>\n </span>\n</li>";
}] });
exports.defaultTemplates["file-summary-wrapper"] = (0, wontache_1.default)({ sections: [function (state) {
return "<div class=\"d2h-file-list-wrapper\">\n <div class=\"d2h-file-list-header\">\n <span class=\"d2h-file-list-title\">Files changed (" + (state.d ? "{{filesNumber}}" : state.v(state, ["filesNumber"])) + ")</span>\n <a class=\"d2h-file-switch d2h-hide\">hide</a>\n <a class=\"d2h-file-switch d2h-show\">show</a>\n </div>\n <ol class=\"d2h-file-list\">\n " + (state.d ? "{{{files}}}" : state.v(state, ["files"], 0)) + "\n </ol>\n</div>";
}] });
exports.defaultTemplates["generic-block-header"] = (0, wontache_1.default)({ sections: [function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{lineClass}}" : state.v(state, ["lineClass"])) + " " + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\"></td>\n <td class=\"" + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">" + (state.d ? "{{{blockHeader}}}" : state.v(state, ["blockHeader"], 0)) + "</div>\n </td>\n</tr>";
}] });
exports.defaultTemplates["generic-empty-diff"] = (0, wontache_1.default)({ sections: [function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{CSSLineClass.INFO}}" : state.v(state, ["CSSLineClass", "INFO"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">\n File without changes\n </div>\n </td>\n</tr>";
}] });
exports.defaultTemplates["generic-file-path"] = (0, wontache_1.default)({ sections: [function (state) {
return "<span class=\"d2h-file-name-wrapper\">\n" + (state.d ? " {{>fileIcon}}\n" : state.p(state, "fileIcon", " ")) + " <span class=\"d2h-file-name\">" + (state.d ? "{{fileDiffName}}" : state.v(state, ["fileDiffName"])) + "</span>\n" + (state.d ? " {{>fileTag}}\n" : state.p(state, "fileTag", " ")) + "</span>\n<label class=\"d2h-file-collapse\">\n <input class=\"d2h-file-collapse-input\" type=\"checkbox\" name=\"viewed\" value=\"viewed\">\n Viewed\n</label>";
}] });
exports.defaultTemplates["generic-line"] = (0, wontache_1.default)({ sections: [function (state) {
return " <span class=\"d2h-code-line-prefix\">" + (state.d ? "{{{prefix}}}" : state.v(state, ["prefix"], 0)) + "</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-prefix\">&nbsp;</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-ctn\">" + (state.d ? "{{{content}}}" : state.v(state, ["content"], 0)) + "</span>\n";
}, function (state) {
return " <span class=\"d2h-code-line-ctn\"><br></span>\n";
}, function (state) {
return "<tr>\n <td class=\"" + (state.d ? "{{lineClass}}" : state.v(state, ["lineClass"])) + " " + (state.d ? "{{type}}" : state.v(state, ["type"])) + "\">\n " + (state.d ? "{{{lineNumber}}}" : state.v(state, ["lineNumber"], 0)) + "\n </td>\n <td class=\"" + (state.d ? "{{type}}" : state.v(state, ["type"])) + "\">\n <div class=\"" + (state.d ? "{{contentClass}}" : state.v(state, ["contentClass"])) + "\">\n" + (state.d ? " {{#prefix}}\n" : "") + state.s(state, ["prefix"], 0) + (state.d ? " {{/prefix}}\n" : "") + (state.d ? " {{^prefix}}\n" : "") + state.z(state, ["prefix"], 1) + (state.d ? " {{/prefix}}\n" : "") + (state.d ? " {{#content}}\n" : "") + state.s(state, ["content"], 2) + (state.d ? " {{/content}}\n" : "") + (state.d ? " {{^content}}\n" : "") + state.z(state, ["content"], 3) + (state.d ? " {{/content}}\n" : "") + " </div>\n </td>\n</tr>";
}] });
exports.defaultTemplates["generic-wrapper"] = (0, wontache_1.default)({ sections: [function (state) {
return "<div class=\"d2h-wrapper\">\n " + (state.d ? "{{{content}}}" : state.v(state, ["content"], 0)) + "\n</div>";
}] });
exports.defaultTemplates["icon-file-added"] = (0, wontache_1.default)({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\"\n width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>\n</svg>";
}] });
exports.defaultTemplates["icon-file-changed"] = (0, wontache_1.default)({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>\n</svg>";
}] });
exports.defaultTemplates["icon-file-deleted"] = (0, wontache_1.default)({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>\n</svg>";
}] });
exports.defaultTemplates["icon-file-renamed"] = (0, wontache_1.default)({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon d2h-moved\" height=\"16\" title=\"renamed\" version=\"1.1\"\n viewBox=\"0 0 14 16\" width=\"14\">\n <path d=\"M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z\"></path>\n</svg>";
}] });
exports.defaultTemplates["icon-file"] = (0, wontache_1.default)({ sections: [function (state) {
return "<svg aria-hidden=\"true\" class=\"d2h-icon\" height=\"16\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"12\">\n <path d=\"M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z\"></path>\n</svg>";
}] });
exports.defaultTemplates["line-by-line-file-diff"] = (0, wontache_1.default)({ sections: [function (state) {
return "<div id=\"" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-wrapper\" data-lang=\"" + (state.d ? "{{file.language}}" : state.v(state, ["file", "language"])) + "\">\n <div class=\"d2h-file-header\">\n " + (state.d ? "{{{filePath}}}" : state.v(state, ["filePath"], 0)) + "\n </div>\n <div class=\"d2h-file-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs}}}" : state.v(state, ["diffs"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n</div>";
}] });
exports.defaultTemplates["line-by-line-numbers"] = (0, wontache_1.default)({ sections: [function (state) {
return "<div class=\"line-num1\">" + (state.d ? "{{oldNumber}}" : state.v(state, ["oldNumber"])) + "</div>\n<div class=\"line-num2\">" + (state.d ? "{{newNumber}}" : state.v(state, ["newNumber"])) + "</div>";
}] });
exports.defaultTemplates["side-by-side-file-diff"] = (0, wontache_1.default)({ sections: [function (state) {
return "<div id=\"" + (state.d ? "{{fileHtmlId}}" : state.v(state, ["fileHtmlId"])) + "\" class=\"d2h-file-wrapper\" data-lang=\"" + (state.d ? "{{file.language}}" : state.v(state, ["file", "language"])) + "\">\n <div class=\"d2h-file-header\">\n " + (state.d ? "{{{filePath}}}" : state.v(state, ["filePath"], 0)) + "\n </div>\n <div class=\"d2h-files-diff\">\n <div class=\"d2h-file-side-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs.left}}}" : state.v(state, ["diffs", "left"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n <div class=\"d2h-file-side-diff\">\n <div class=\"d2h-code-wrapper\">\n <table class=\"d2h-diff-table\">\n <tbody class=\"d2h-diff-tbody\">\n " + (state.d ? "{{{diffs.right}}}" : state.v(state, ["diffs", "right"], 0)) + "\n </tbody>\n </table>\n </div>\n </div>\n </div>\n</div>";
}] });
exports.defaultTemplates["tag-file-added"] = (0, wontache_1.default)({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>";
}] });
exports.defaultTemplates["tag-file-changed"] = (0, wontache_1.default)({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>";
}] });
exports.defaultTemplates["tag-file-deleted"] = (0, wontache_1.default)({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>";
}] });
exports.defaultTemplates["tag-file-renamed"] = (0, wontache_1.default)({ sections: [function (state) {
return "<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>";
}] });
//# sourceMappingURL=diff2html-templates.js.map

@@ -1,2 +0,2 @@

import * as Hogan from 'hogan.js';
import { CompiledTemplate, Partials } from 'wontache';
export interface RawTemplates {

@@ -6,3 +6,3 @@ [name: string]: string;

export interface CompiledTemplates {
[name: string]: Hogan.Template;
[name: string]: CompiledTemplate;
}

@@ -16,7 +16,7 @@ export interface HoganJsUtilsConfig {

constructor({ compiledTemplates, rawTemplates }: HoganJsUtilsConfig);
static compile(templateString: string): Hogan.Template;
render(namespace: string, view: string, params: Hogan.Context, partials?: Hogan.Partials, indent?: string): string;
template(namespace: string, view: string): Hogan.Template;
static compile(templateString: string): CompiledTemplate;
render(namespace: string, view: string, params: object, partials?: Partials): string;
template(namespace: string, view: string): CompiledTemplate;
private templateKey;
}
//# sourceMappingURL=hoganjs-utils.d.ts.map

@@ -13,27 +13,7 @@ "use strict";

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var Hogan = __importStar(require("hogan.js"));
var wontache_1 = __importDefault(require("wontache"));
var diff2html_templates_1 = require("./diff2html-templates");

@@ -46,3 +26,3 @@ var HoganJsUtils = (function () {

var name = _a[0], templateString = _a[1];
var compiledTemplate = Hogan.compile(templateString, { asString: false });
var compiledTemplate = (0, wontache_1.default)(templateString);
return __assign(__assign({}, previousTemplates), (_b = {}, _b[name] = compiledTemplate, _b));

@@ -53,9 +33,9 @@ }, {});

HoganJsUtils.compile = function (templateString) {
return Hogan.compile(templateString, { asString: false });
return (0, wontache_1.default)(templateString);
};
HoganJsUtils.prototype.render = function (namespace, view, params, partials, indent) {
HoganJsUtils.prototype.render = function (namespace, view, params, partials) {
var templateKey = this.templateKey(namespace, view);
try {
var template = this.preCompiledTemplates[templateKey];
return template.render(params, partials, indent);
return template(params, { partials: partials });
}

@@ -62,0 +42,0 @@ catch (e) {

@@ -75,11 +75,13 @@ "use strict";

var fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, renderUtils.getFileIcon(file));
return fileDiffTemplate.render({
return fileDiffTemplate({
file: file,
fileHtmlId: renderUtils.getHtmlId(file),
diffs: diffs,
filePath: filePathTemplate.render({
filePath: filePathTemplate({
fileDiffName: renderUtils.filenameDiff(file),
}, {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
partials: {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
},
}),

@@ -86,0 +88,0 @@ });

@@ -75,11 +75,13 @@ "use strict";

var fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, renderUtils.getFileIcon(file));
return fileDiffTemplate.render({
return fileDiffTemplate({
file: file,
fileHtmlId: renderUtils.getHtmlId(file),
diffs: diffs,
filePath: filePathTemplate.render({
filePath: filePathTemplate({
fileDiffName: renderUtils.filenameDiff(file),
}, {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
partials: {
fileIcon: fileIconTemplate,
fileTag: fileTagTemplate,
},
}),

@@ -86,0 +88,0 @@ });

{
"name": "diff2html",
"version": "3.4.19",
"version": "3.4.20-usewontache.1.60e7a2e",
"homepage": "https://diff2html.xyz",

@@ -85,3 +85,3 @@ "description": "Fast Diff to colorized HTML",

"diff": "5.1.0",
"hogan.js": "3.0.2"
"wontache": "0.1.0"
},

@@ -93,3 +93,2 @@ "optionalDependencies": {

"@types/diff": "5.0.2",
"@types/hogan.js": "3.0.1",
"@types/jest": "28.1.6",

@@ -96,0 +95,0 @@ "@types/mkdirp": "1.0.2",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc