mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Move all packages to a types directory
This commit is contained in:
25
types/diff2html/diff2html-tests.ts
Normal file
25
types/diff2html/diff2html-tests.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
import Diff2Html = require('diff2html');
|
||||
|
||||
let d2h = Diff2Html.Diff2Html;
|
||||
|
||||
class Diff2HtmlOptionsImpl implements Diff2Html.Options {
|
||||
constructor (public inputFormat: string) {
|
||||
}
|
||||
}
|
||||
|
||||
let strInput =
|
||||
'diff --git a/sample b/sample\n' +
|
||||
'index 0000001..0ddf2ba\n' +
|
||||
'--- a/sample\n' +
|
||||
'+++ b/sample\n' +
|
||||
'@@ -1 +1 @@\n' +
|
||||
'-test\n' +
|
||||
'+test1r\n';
|
||||
|
||||
let strConfiguration = new Diff2HtmlOptionsImpl('diff');
|
||||
let diffInput = d2h.getJsonFromDiff(strInput, strConfiguration);
|
||||
|
||||
let diffConfiguration = new Diff2HtmlOptionsImpl('json');
|
||||
let htmlString = d2h.getPrettyHtml(diffInput, diffConfiguration);
|
||||
console.log(htmlString);
|
||||
66
types/diff2html/index.d.ts
vendored
Normal file
66
types/diff2html/index.d.ts
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// Type definitions for diff2html
|
||||
// Project: https://github.com/rtfpessoa/diff2html
|
||||
// Definitions by: rtfpessoa <https://github.com/rtfpessoa/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Diff2Html {
|
||||
|
||||
export interface Options {
|
||||
inputFormat?: string;
|
||||
outputFormat?: string;
|
||||
showFiles?: boolean;
|
||||
matching?: string;
|
||||
synchronisedScroll?: boolean;
|
||||
matchWordsThreshold?: number;
|
||||
matchingMaxComparisons?: number;
|
||||
}
|
||||
|
||||
export interface Line {
|
||||
content: string;
|
||||
type: string;
|
||||
oldNumber: number;
|
||||
newNumber: number;
|
||||
}
|
||||
|
||||
export interface Block {
|
||||
oldStartLine: number;
|
||||
oldStartLine2?: number;
|
||||
newStartLine: number;
|
||||
header: string;
|
||||
lines: Line[];
|
||||
}
|
||||
|
||||
export interface Result {
|
||||
addedLines: number;
|
||||
deletedLines: number;
|
||||
isCombined: boolean;
|
||||
isGitDiff: boolean;
|
||||
oldName: string;
|
||||
newName: string;
|
||||
language: string;
|
||||
blocks: Block[];
|
||||
oldMode?: string;
|
||||
newMode?: string;
|
||||
deletedFileMode?: string;
|
||||
newFileMode?: string;
|
||||
isDeleted?: boolean;
|
||||
isNew?: boolean;
|
||||
isCopy?: boolean;
|
||||
isRename?: boolean;
|
||||
unchangedPercentage?: number;
|
||||
changedPercentage?: number;
|
||||
checksumBefore?: string;
|
||||
checksumAfter?: string;
|
||||
mode?: string;
|
||||
}
|
||||
|
||||
export interface Diff2Html {
|
||||
getJsonFromDiff(input: string, configuration?: Options): Result;
|
||||
getPrettyHtml(input: any, configuration?: Options): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "diff2html" {
|
||||
var d2h: { "Diff2Html": Diff2Html.Diff2Html };
|
||||
export = d2h;
|
||||
}
|
||||
23
types/diff2html/tsconfig.json
Normal file
23
types/diff2html/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"diff2html-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user