clean: Prepare for pre release
This commit is contained in:
parent
8f1208eb01
commit
4a159277a2
5 changed files with 3 additions and 22 deletions
|
|
@ -23,7 +23,7 @@ function getFilename(line: string, linePrefix?: string, extraPrefix?: string): s
|
|||
? new RegExp(`^${escapeForRegExp(linePrefix)} "?(.+?)"?$`)
|
||||
: new RegExp('^"?(.+?)"?$');
|
||||
|
||||
const [, filename = ""] = FilenameRegExp.exec(line) || []; // TODO: Check if this is safe
|
||||
const [, filename = ""] = FilenameRegExp.exec(line) || [];
|
||||
const matchingPrefix = prefixes.find(p => filename.indexOf(p) === 0);
|
||||
const fnameWithoutPrefix = matchingPrefix ? filename.slice(matchingPrefix.length) : filename;
|
||||
|
||||
|
|
@ -132,7 +132,6 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
|
|||
saveBlock();
|
||||
saveFile();
|
||||
|
||||
// TODO: Avoid disabling types
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
currentFile = {
|
||||
|
|
@ -183,7 +182,6 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
|
|||
}
|
||||
|
||||
/* Create block metadata */
|
||||
// TODO: Avoid disabling types
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
currentBlock = {
|
||||
|
|
@ -198,7 +196,6 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
|
|||
function createLine(line: string): void {
|
||||
if (currentFile === null || currentBlock === null || oldLine === null || newLine === null) return;
|
||||
|
||||
// TODO: Avoid disabling types
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
const currentLine: DiffLine = {
|
||||
|
|
@ -208,7 +205,6 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
|
|||
const addedPrefixes = currentFile.isCombined ? ["+ ", " +", "++"] : ["+"];
|
||||
const deletedPrefixes = currentFile.isCombined ? ["- ", " -", "--"] : ["-"];
|
||||
|
||||
// TODO: Check if this makes sense for combined diff
|
||||
if (startsWithAny(line, addedPrefixes)) {
|
||||
currentFile.addedLines++;
|
||||
currentLine.type = LineType.INSERT;
|
||||
|
|
|
|||
|
|
@ -39,10 +39,5 @@ export function html(diffInput: string | DiffFile[], configuration: Diff2HtmlCon
|
|||
? new SideBySideRenderer(hoganUtils, config).render(diffJson)
|
||||
: new LineByLineRenderer(hoganUtils, config).render(diffJson);
|
||||
|
||||
// TODO: Review error handling
|
||||
if (diffOutput === undefined) {
|
||||
throw new Error("OMG we haz no diff. Why???");
|
||||
}
|
||||
|
||||
return fileList + diffOutput;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default class LineByLineRenderer {
|
|||
this.config = { ...defaultLineByLineRendererConfig, ...config };
|
||||
}
|
||||
|
||||
render(diffFiles: DiffFile[]): string | undefined {
|
||||
render(diffFiles: DiffFile[]): string {
|
||||
const diffsHtml = diffFiles
|
||||
.map(file => {
|
||||
let diffs;
|
||||
|
|
@ -55,7 +55,6 @@ export default class LineByLineRenderer {
|
|||
return this.hoganUtils.render(genericTemplatesPath, "wrapper", { content: diffsHtml });
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
makeFileDiffHtml(file: DiffFile, diffs: string): string {
|
||||
if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0) return "";
|
||||
|
||||
|
|
@ -80,7 +79,6 @@ export default class LineByLineRenderer {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
generateEmptyDiff(): string {
|
||||
return this.hoganUtils.render(genericTemplatesPath, "empty-diff", {
|
||||
contentClass: "d2h-code-line",
|
||||
|
|
@ -192,7 +190,6 @@ export default class LineByLineRenderer {
|
|||
return matches;
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
processChangedLines(isCombined: boolean, oldLines: DiffLine[], newLines: DiffLine[]): FileHtml {
|
||||
const fileHtml = {
|
||||
right: "",
|
||||
|
|
@ -253,7 +250,6 @@ export default class LineByLineRenderer {
|
|||
return fileHtml;
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
generateLineHtml(oldLine?: DiffPreparedLine, newLine?: DiffPreparedLine): FileHtml {
|
||||
return {
|
||||
left: this.generateSingleLineHtml(oldLine),
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ export function deconstructLine(line: string, isCombined: boolean): DiffLinePart
|
|||
* returns "my/path/{to → for}/file.js"
|
||||
*/
|
||||
export function filenameDiff(file: DiffFileName): string {
|
||||
// TODO: Review this huuuuuge piece of code, do we need this?
|
||||
// TODO: Move unify path to parsing
|
||||
const oldFilename = unifyPath(file.oldName);
|
||||
const newFilename = unifyPath(file.newName);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default class SideBySideRenderer {
|
|||
this.config = { ...defaultSideBySideRendererConfig, ...config };
|
||||
}
|
||||
|
||||
render(diffFiles: DiffFile[]): string | undefined {
|
||||
render(diffFiles: DiffFile[]): string {
|
||||
const diffsHtml = diffFiles
|
||||
.map(file => {
|
||||
let diffs;
|
||||
|
|
@ -55,7 +55,6 @@ export default class SideBySideRenderer {
|
|||
return this.hoganUtils.render(genericTemplatesPath, "wrapper", { content: diffsHtml });
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
makeFileDiffHtml(file: DiffFile, diffs: FileHtml): string {
|
||||
if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0) return "";
|
||||
|
||||
|
|
@ -80,7 +79,6 @@ export default class SideBySideRenderer {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
generateEmptyDiff(): FileHtml {
|
||||
return {
|
||||
right: "",
|
||||
|
|
@ -207,7 +205,6 @@ export default class SideBySideRenderer {
|
|||
return matches;
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
makeHeaderHtml(blockHeader: string): string {
|
||||
return this.hoganUtils.render(genericTemplatesPath, "block-header", {
|
||||
CSSLineClass: renderUtils.CSSLineClass,
|
||||
|
|
@ -217,7 +214,6 @@ export default class SideBySideRenderer {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
processChangedLines(isCombined: boolean, oldLines: DiffLine[], newLines: DiffLine[]): FileHtml {
|
||||
const fileHtml = {
|
||||
right: "",
|
||||
|
|
@ -276,7 +272,6 @@ export default class SideBySideRenderer {
|
|||
return fileHtml;
|
||||
}
|
||||
|
||||
// TODO: Make this private after improving tests
|
||||
generateLineHtml(oldLine?: DiffPreparedLine, newLine?: DiffPreparedLine): FileHtml {
|
||||
return {
|
||||
left: this.generateSingleHtml(oldLine),
|
||||
|
|
|
|||
Loading…
Reference in a new issue