Skip to content

Commit d41a1a2

Browse files
author
Peng Jie
committed
chore(deps): update
1 parent 29db697 commit d41a1a2

File tree

7 files changed

+1525
-1434
lines changed

7 files changed

+1525
-1434
lines changed

example/compare-markdown/yarn.lock

Lines changed: 774 additions & 420 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
}
6464
},
6565
"dependencies": {
66-
"diff2html": "^2.9.0",
66+
"diff2html": "^3.1.6",
6767
"difflib": "^0.2.4",
6868
"prop-types": "^15.7.2",
6969
"recompose": "^0.30.0"

src/__tests__/__snapshots__/index.spec.js.snap

Lines changed: 192 additions & 14 deletions
Large diffs are not rendered by default.

src/__tests__/__snapshots__/utils.spec.js.snap

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`should convert input string into compared html 1`] = `
4-
"<div class=\\"d2h-wrapper\\">
4+
"<div class=\\"d2h-file-list-wrapper\\">
5+
<div class=\\"d2h-file-list-header\\">
6+
<span class=\\"d2h-file-list-title\\">Files changed (1)</span>
7+
<a class=\\"d2h-file-switch d2h-hide\\">hide</a>
8+
<a class=\\"d2h-file-switch d2h-show\\">show</a>
9+
</div>
10+
<ol class=\\"d2h-file-list\\">
11+
<li class=\\"d2h-file-list-line\\">
12+
<span class=\\"d2h-file-name-wrapper\\">
13+
<svg aria-hidden=\\"true\\" class=\\"d2h-icon d2h-changed\\" height=\\"16\\" title=\\"modified\\" version=\\"1.1\\"
14+
viewBox=\\"0 0 14 16\\" width=\\"14\\">
15+
<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>
16+
</svg> <a href=\\"#d2h-425049\\" class=\\"d2h-file-name\\">Unknown-File-Name</a>
17+
<span class=\\"d2h-file-stats\\">
18+
<span class=\\"d2h-lines-added\\">+1</span>
19+
<span class=\\"d2h-lines-deleted\\">-1</span>
20+
</span>
21+
</span>
22+
</li>
23+
</ol>
24+
</div><div class=\\"d2h-wrapper\\">
525
<div id=\\"d2h-425049\\" class=\\"d2h-file-wrapper\\" data-lang=\\"\\">
626
<div class=\\"d2h-file-header\\">
727
<span class=\\"d2h-file-name-wrapper\\">
@@ -21,11 +41,11 @@ exports[`should convert input string into compared html 1`] = `
2141
<div class=\\"d2h-code-side-line d2h-info\\">@@ -1 +1 @@</div>
2242
</td>
2343
</tr><tr>
24-
<td class=\\"d2h-code-side-linenumber d2h-del\\">
44+
<td class=\\"d2h-code-side-linenumber d2h-del d2h-change\\">
2545
1
2646
</td>
27-
<td class=\\"d2h-del\\">
28-
<div class=\\"d2h-code-side-line d2h-del\\">
47+
<td class=\\"d2h-del d2h-change\\">
48+
<div class=\\"d2h-code-side-line d2h-del d2h-change\\">
2949
<span class=\\"d2h-code-line-prefix\\">-</span>
3050
<span class=\\"d2h-code-line-ctn\\"><del>Hello</del> <del>World</del></span>
3151
</div>
@@ -45,11 +65,11 @@ exports[`should convert input string into compared html 1`] = `
4565
<div class=\\"d2h-code-side-line d2h-info\\"></div>
4666
</td>
4767
</tr><tr>
48-
<td class=\\"d2h-code-side-linenumber d2h-ins\\">
68+
<td class=\\"d2h-code-side-linenumber d2h-ins d2h-change\\">
4969
1
5070
</td>
51-
<td class=\\"d2h-ins\\">
52-
<div class=\\"d2h-code-side-line d2h-ins\\">
71+
<td class=\\"d2h-ins d2h-change\\">
72+
<div class=\\"d2h-code-side-line d2h-ins d2h-change\\">
5373
<span class=\\"d2h-code-line-prefix\\">+</span>
5474
<span class=\\"d2h-code-line-ctn\\"><ins>Hellow</ins> <ins>Hellow</ins></span>
5575
</div>

src/__tests__/index.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
2-
import { shallow, mount } from 'enzyme';
2+
import { mount } from 'enzyme';
33
import renderer from 'react-test-renderer';
44
import { readFileSync } from 'fs';
55
import { ReactGhLikeDiff, RenderDiffResult } from '../index';
6-
import { defaultOptions } from '../utils';
76

87
test('should render innerHTML by dangerouslySetInnerHTML', () => {
98
const html = '<h1>Hello World</h1>';

src/utils.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { unifiedDiff } from 'difflib';
22
import { format } from 'util';
33
import { compose } from 'recompose';
4-
5-
const {
6-
Diff2Html: { getPrettyHtml }
7-
} = require('diff2html');
4+
const { html } = require('diff2html');
85

96
export const defaultOptions = {
107
originalFileName: 'Unknown-File-Name',
@@ -44,6 +41,6 @@ const compare = ({ past, current, options }) => {
4441
};
4542

4643
export const genPrettyHtml = ({ diffString, options }) =>
47-
getPrettyHtml(diffString, options);
44+
html(diffString, options);
4845

4946
export default compose(genPrettyHtml, compare);

0 commit comments

Comments
 (0)