Merge pull request #334 from rtfpessoa/bump-dependencies
bump: Update dependencies
This commit is contained in:
commit
739751a021
9 changed files with 1518 additions and 1567 deletions
58
package.json
58
package.json
|
|
@ -89,34 +89,32 @@
|
||||||
"hogan.js": "3.0.2"
|
"hogan.js": "3.0.2"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"highlight.js": "10.0.2"
|
"highlight.js": "10.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/clipboard": "2.0.1",
|
"@types/clipboard": "2.0.1",
|
||||||
"@types/copy-webpack-plugin": "5.0.0",
|
"@types/copy-webpack-plugin": "6.0.0",
|
||||||
"@types/diff": "4.0.2",
|
"@types/diff": "4.0.2",
|
||||||
"@types/highlight.js": "9.12.3",
|
|
||||||
"@types/hogan.js": "3.0.0",
|
"@types/hogan.js": "3.0.0",
|
||||||
"@types/html-webpack-plugin": "3.2.2",
|
"@types/html-webpack-plugin": "3.2.3",
|
||||||
"@types/jest": "25.2.1",
|
"@types/jest": "26.0.10",
|
||||||
"@types/mini-css-extract-plugin": "0.9.1",
|
"@types/mini-css-extract-plugin": "0.9.1",
|
||||||
"@types/mkdirp": "1.0.0",
|
"@types/mkdirp": "1.0.1",
|
||||||
"@types/node": "13.13.5",
|
"@types/node": "14.0.27",
|
||||||
"@types/nopt": "3.0.29",
|
"@types/nopt": "3.0.29",
|
||||||
"@types/webpack": "4.41.12",
|
"@typescript-eslint/eslint-plugin": "3.9.0",
|
||||||
"@typescript-eslint/eslint-plugin": "2.31.0",
|
"@typescript-eslint/parser": "3.9.0",
|
||||||
"@typescript-eslint/parser": "2.31.0",
|
"autoprefixer": "9.8.6",
|
||||||
"autoprefixer": "9.7.6",
|
"bulma": "^0.9.0",
|
||||||
"bulma": "^0.8.0",
|
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"copy-webpack-plugin": "5.1.1",
|
"copy-webpack-plugin": "6.0.3",
|
||||||
"css-loader": "3.5.3",
|
"css-loader": "4.2.1",
|
||||||
"cssnano": "4.1.10",
|
"cssnano": "4.1.10",
|
||||||
"eslint": "7.0.0",
|
"eslint": "7.7.0",
|
||||||
"eslint-config-prettier": "6.11.0",
|
"eslint-config-prettier": "6.11.0",
|
||||||
"eslint-plugin-import": "2.20.2",
|
"eslint-plugin-import": "2.22.0",
|
||||||
"eslint-plugin-jest": "23.10.0",
|
"eslint-plugin-jest": "23.20.0",
|
||||||
"eslint-plugin-json": "2.1.1",
|
"eslint-plugin-json": "2.1.2",
|
||||||
"eslint-plugin-node": "11.1.0",
|
"eslint-plugin-node": "11.1.0",
|
||||||
"eslint-plugin-optimize-regex": "1.2.0",
|
"eslint-plugin-optimize-regex": "1.2.0",
|
||||||
"eslint-plugin-promise": "4.2.1",
|
"eslint-plugin-promise": "4.2.1",
|
||||||
|
|
@ -127,28 +125,28 @@
|
||||||
"html-webpack-plugin": "4.3.0",
|
"html-webpack-plugin": "4.3.0",
|
||||||
"husky": "4.2.5",
|
"husky": "4.2.5",
|
||||||
"image-webpack-loader": "6.0.0",
|
"image-webpack-loader": "6.0.0",
|
||||||
"is-ci-cli": "2.0.0",
|
"is-ci-cli": "2.1.2",
|
||||||
"jest": "26.0.1",
|
"jest": "26.4.0",
|
||||||
"lint-staged": "10.2.2",
|
"lint-staged": "10.2.11",
|
||||||
"markdown-toc": "^1.2.0",
|
"markdown-toc": "^1.2.0",
|
||||||
"mini-css-extract-plugin": "0.9.0",
|
"mini-css-extract-plugin": "0.10.0",
|
||||||
"mkdirp": "1.0.4",
|
"mkdirp": "1.0.4",
|
||||||
"nopt": "4.0.3",
|
"nopt": "4.0.3",
|
||||||
"postcss": "7.0.29",
|
"postcss": "7.0.32",
|
||||||
"postcss-cli": "7.1.1",
|
"postcss-cli": "7.1.1",
|
||||||
"postcss-import": "12.0.1",
|
"postcss-import": "12.0.1",
|
||||||
"postcss-loader": "3.0.0",
|
"postcss-loader": "3.0.0",
|
||||||
"postcss-preset-env": "6.7.0",
|
"postcss-preset-env": "6.7.0",
|
||||||
"prettier": "2.0.5",
|
"prettier": "2.0.5",
|
||||||
"ts-jest": "25.5.1",
|
"ts-jest": "26.2.0",
|
||||||
"ts-loader": "7.0.3",
|
"ts-loader": "8.0.2",
|
||||||
"ts-node": "8.10.1",
|
"ts-node": "8.10.2",
|
||||||
"typescript": "3.8.3",
|
"typescript": "3.9.7",
|
||||||
"url-loader": "4.1.0",
|
"url-loader": "4.1.0",
|
||||||
"webpack": "4.43.0",
|
"webpack": "4.44.1",
|
||||||
"webpack-cli": "3.3.11",
|
"webpack-cli": "3.3.12",
|
||||||
"webpack-dev-server": "3.11.0",
|
"webpack-dev-server": "3.11.0",
|
||||||
"whatwg-fetch": "3.0.0"
|
"whatwg-fetch": "3.4.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"lodash": ">=4.17.15",
|
"lodash": ">=4.17.15",
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ function extractFiles(files: string[]): string[] {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if (options.version) {
|
if (options.version) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
console.log(require('../package.json').version);
|
console.log(require('../package.json').version);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import * as HighlightJS from 'highlight.js/lib/core';
|
import * as HighlightJS from 'highlight.js/lib/core';
|
||||||
import { ICompiledMode, IHighlightResult, IAutoHighlightResult } from 'highlight.js';
|
// import { CompiledMode, HighlightResult, AutoHighlightResult } from 'highlight.js/lib/core.js';
|
||||||
import { nodeStream, mergeStreams } from './highlight.js-helpers';
|
import { nodeStream, mergeStreams } from './highlight.js-helpers';
|
||||||
|
|
||||||
import { html, Diff2HtmlConfig, defaultDiff2HtmlConfig } from '../../diff2html';
|
import { html, Diff2HtmlConfig, defaultDiff2HtmlConfig } from '../../diff2html';
|
||||||
|
|
@ -116,8 +116,8 @@ export class Diff2HtmlUI {
|
||||||
// Collect all the diff files and execute the highlight on their lines
|
// Collect all the diff files and execute the highlight on their lines
|
||||||
const files = this.targetElement.querySelectorAll('.d2h-file-wrapper');
|
const files = this.targetElement.querySelectorAll('.d2h-file-wrapper');
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
let oldLinesState: ICompiledMode;
|
let oldLinesState: CompiledMode | Language | undefined;
|
||||||
let newLinesState: ICompiledMode;
|
let newLinesState: CompiledMode | Language | undefined;
|
||||||
|
|
||||||
// Collect all the code lines and execute the highlight on them
|
// Collect all the code lines and execute the highlight on them
|
||||||
const codeLines = file.querySelectorAll('.d2h-code-line-ctn');
|
const codeLines = file.querySelectorAll('.d2h-code-line-ctn');
|
||||||
|
|
@ -133,12 +133,12 @@ export class Diff2HtmlUI {
|
||||||
const lineState = lineParent.classList.contains('d2h-del') ? oldLinesState : newLinesState;
|
const lineState = lineParent.classList.contains('d2h-del') ? oldLinesState : newLinesState;
|
||||||
|
|
||||||
const language = file.getAttribute('data-lang');
|
const language = file.getAttribute('data-lang');
|
||||||
const result =
|
const result: HighlightResult =
|
||||||
language && this.hljs.getLanguage(language)
|
language && this.hljs.getLanguage(language)
|
||||||
? this.hljs.highlight(language, text, true, lineState)
|
? this.hljs.highlight(language, text, true, lineState)
|
||||||
: this.hljs.highlightAuto(text);
|
: this.hljs.highlightAuto(text);
|
||||||
|
|
||||||
if (this.instanceOfIHighlightResult(result)) {
|
if (this.instanceOfHighlightResult(result)) {
|
||||||
if (lineParent.classList.contains('d2h-del')) {
|
if (lineParent.classList.contains('d2h-del')) {
|
||||||
oldLinesState = result.top;
|
oldLinesState = result.top;
|
||||||
} else if (lineParent.classList.contains('d2h-ins')) {
|
} else if (lineParent.classList.contains('d2h-ins')) {
|
||||||
|
|
@ -157,7 +157,9 @@ export class Diff2HtmlUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
line.classList.add('hljs');
|
line.classList.add('hljs');
|
||||||
line.classList.add(result.language);
|
if (result.language) {
|
||||||
|
line.classList.add(result.language);
|
||||||
|
}
|
||||||
line.innerHTML = result.value;
|
line.innerHTML = result.value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -170,7 +172,7 @@ export class Diff2HtmlUI {
|
||||||
console.warn('Smart selection is now enabled by default with CSS. No need to call this method anymore.');
|
console.warn('Smart selection is now enabled by default with CSS. No need to call this method anymore.');
|
||||||
}
|
}
|
||||||
|
|
||||||
private instanceOfIHighlightResult(object: IHighlightResult | IAutoHighlightResult): object is IHighlightResult {
|
private instanceOfHighlightResult(object: HighlightResult | AutoHighlightResult): object is HighlightResult {
|
||||||
return 'top' in object;
|
return 'top' in object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
5
typings/highlight.js/highlight.js.d.ts
vendored
5
typings/highlight.js/highlight.js.d.ts
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
declare module 'highlight.js/lib/core' {
|
|
||||||
import hljs from 'highlight.js';
|
|
||||||
|
|
||||||
export = hljs;
|
|
||||||
}
|
|
||||||
5
typings/highlight.js/languages.d.ts
vendored
5
typings/highlight.js/languages.d.ts
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
declare module 'highlight.js/lib/languages/*' {
|
|
||||||
import { HLJSStatic, IModeBase } from 'highlight.js';
|
|
||||||
|
|
||||||
export default function (hljs?: HLJSStatic): IModeBase;
|
|
||||||
}
|
|
||||||
1
typings/merge.d.ts
vendored
1
typings/merge.d.ts
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
declare module 'merge' {
|
declare module 'merge' {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
export function recursive(clone: boolean, ...items: object[]): object;
|
export function recursive(clone: boolean, ...items: object[]): object;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,44 @@ import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||||
|
|
||||||
const pages = ['index', 'demo'];
|
const pages = ['index', 'demo'];
|
||||||
|
|
||||||
|
function plugins(page: string): webpack.Plugin[] {
|
||||||
|
return [
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[id].css',
|
||||||
|
}),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
hash: true,
|
||||||
|
inject: true,
|
||||||
|
title: `${page} page`,
|
||||||
|
filename: `${page}.html`,
|
||||||
|
template: `./website/templates/pages/${page}/${page}.handlebars`,
|
||||||
|
minify: {
|
||||||
|
html5: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
caseSensitive: true,
|
||||||
|
removeEmptyElements: false,
|
||||||
|
removeComments: true,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
useShortDoctype: true,
|
||||||
|
removeEmptyAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
keepClosingSlash: true,
|
||||||
|
minifyJS: true,
|
||||||
|
minifyCSS: true,
|
||||||
|
minifyURLs: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{ from: 'website/favicon.ico', to: 'favicon.ico' },
|
||||||
|
{ from: 'website/robots.txt', to: 'robots.txt' },
|
||||||
|
{ from: 'website/sitemap.xml', to: 'sitemap.xml' },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
const config: webpack.Configuration[] = pages.map(page => {
|
const config: webpack.Configuration[] = pages.map(page => {
|
||||||
return {
|
return {
|
||||||
devServer: {
|
devServer: {
|
||||||
|
|
@ -108,39 +146,7 @@ const config: webpack.Configuration[] = pages.map(page => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: plugins(page),
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: '[name].css',
|
|
||||||
chunkFilename: '[id].css',
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
hash: true,
|
|
||||||
inject: true,
|
|
||||||
title: `${page} page`,
|
|
||||||
filename: `${page}.html`,
|
|
||||||
template: `./website/templates/pages/${page}/${page}.handlebars`,
|
|
||||||
minify: {
|
|
||||||
html5: true,
|
|
||||||
collapseWhitespace: true,
|
|
||||||
caseSensitive: true,
|
|
||||||
removeEmptyElements: false,
|
|
||||||
removeComments: true,
|
|
||||||
removeRedundantAttributes: true,
|
|
||||||
useShortDoctype: true,
|
|
||||||
removeEmptyAttributes: true,
|
|
||||||
removeStyleLinkTypeAttributes: true,
|
|
||||||
keepClosingSlash: true,
|
|
||||||
minifyJS: true,
|
|
||||||
minifyCSS: true,
|
|
||||||
minifyURLs: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{ from: 'website/favicon.ico', to: 'favicon.ico' },
|
|
||||||
{ from: 'website/robots.txt', to: 'robots.txt' },
|
|
||||||
{ from: 'website/sitemap.xml', to: 'sitemap.xml' },
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,23 +170,21 @@ async function prepareInitialState(elements: Elements): Promise<[Diff2HtmlUIConf
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateBrowserUrl(config: Diff2HtmlUIConfig, newDiffUrl: string): void {
|
function updateBrowserUrl(config: Diff2HtmlUIConfig, newDiffUrl: string): void {
|
||||||
if (history.pushState) {
|
const paramString = Object.entries(config)
|
||||||
const paramString = Object.entries(config)
|
.map(([k, v]) => k + '=' + v)
|
||||||
.map(([k, v]) => k + '=' + v)
|
.join('&');
|
||||||
.join('&');
|
const newPageUrl =
|
||||||
const newPageUrl =
|
window.location.protocol +
|
||||||
window.location.protocol +
|
'//' +
|
||||||
'//' +
|
window.location.host +
|
||||||
window.location.host +
|
window.location.pathname +
|
||||||
window.location.pathname +
|
'?' +
|
||||||
'?' +
|
paramString +
|
||||||
paramString +
|
'&' +
|
||||||
'&' +
|
searchParam +
|
||||||
searchParam +
|
'=' +
|
||||||
'=' +
|
newDiffUrl;
|
||||||
newDiffUrl;
|
window.history.pushState({ path: newPageUrl }, '', newPageUrl);
|
||||||
window.history.pushState({ path: newPageUrl }, '', newPageUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Elements = {
|
type Elements = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue