From 50a62f2b3901815f05298f9b13c3976b57f9da62 Mon Sep 17 00:00:00 2001 From: Greg Venech Date: Sat, 9 Sep 2017 13:22:57 -0400 Subject: [PATCH 1/6] Replace check-links script with latest version of hyperlink and tap-spot reporter fix(tests): fix build termination issues with `lint:links` refactor(tests): test out `defaultTimeout` branch refactor(tests): test out syntax error patch for hyperlink fix Update hyperlink version Use --verbose option to determine the problem Try my custom hyperlink add limit assets loading per time Change limit to 60 Remove concurrency of hyperlink Switch hyperlink to assetgraph4 feature branch The upcoming major version of Hyperlink is being built here, and we're seeing good improvements on both memory consumption and runtime Switch to node 8 on Travis Hyperlink uses Assetgraph 4, which has node 8 as a minimum version. Add extremely verbose memory output to hyperlink Update hyperlink assetgraph dependency to 4.0.5 This clears out memory leaks from javascript assets where jsdom documents were not properly closed Update hyperlink Switch to raw hyperlink tap output to see more context Update hyperlink reference to include assetgraph 4.1.1 Bring back check-links tap filtering Updated hyperlink and use new skipfilters and tap reporter Update hyperlink to version that doesn't fail on svg redirects and gives false negative content-type-mismatch errors Remove check-links.js. hyperlink --skip and tap-spot do the same Removed tap-parser dependency, which was only used in now deleted check-links script --- .travis.yml | 2 +- package.json | 5 ++-- src/scripts/check-links.js | 50 -------------------------------------- 3 files changed, 4 insertions(+), 53 deletions(-) delete mode 100644 src/scripts/check-links.js diff --git a/.travis.yml b/.travis.yml index 1c8c3de13cc2..b4840fd9df4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ branches: - develop language: node_js node_js: - - "6" + - "8" script: - bash ./src/scripts/deploy.sh sudo: required diff --git a/package.json b/package.json index a767e5a8494b..ccbfb2196de1 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "fetch": "sh src/scripts/fetch.sh", "init:generated": "mkdirp ./generated/loaders && mkdirp ./generated/plugins ", "lint": "run-s lint:*", + "lint:links": "hyperlink -r build/index.html --canonicalroot https://webpack.js.org/ --skip support__ | tap-spot", "lint:js": "eslint . --ext .js --ext .jsx", "lint:markdown": "markdownlint --config ./.markdownlint.json *.md ./src/content/**/*.md", "lint:social": "alex . -q", @@ -66,7 +67,7 @@ "github": "^10.0.0", "html-webpack-plugin": "^3.1.0", "http-server": "^0.10.0", - "hyperlink": "^3.0.1", + "hyperlink": "github:Munter/hyperlink#651f1e2", "loader-utils": "^1.1.0", "lodash": "^4.17.4", "markdown-loader": "^2.0.1", @@ -89,7 +90,7 @@ "sass-loader": "^6.0.6", "sitemap-static": "^0.4.2", "tap-min": "^1.2.1", - "tap-parser": "^6.0.1", + "tap-spot": "^1.0.0", "through2": "^2.0.3", "url-loader": "^0.5.9", "webpack": "^4.2.0", diff --git a/src/scripts/check-links.js b/src/scripts/check-links.js deleted file mode 100644 index 6c6b377a5127..000000000000 --- a/src/scripts/check-links.js +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env node -// Check piped links while allowing a fixed amount to fail -// Adapted from tap-json. -var Parser = require('tap-parser'); -var through = require('through2'); -var duplexer = require('duplexer'); -var minimist = require('minimist'); - -process.stdin - .pipe(checkLinks()) - .pipe(process.stdout); - -function checkLinks(args) { - var argv = minimist(process.argv.slice(2)); - var skip = argv.skip || 0; - - var tap = new Parser(); - var out = through.obj(); - var dup = duplexer(tap, out); - - var data = []; - var name = null; - - tap.on('complete', function(res) { - const failures = res.failures.filter(failure => { - return failure.diag && failure.diag.at ? !( - /class="support__[^"]*"/.test(failure.diag.at) || - /src="https:\/\/img\.shields\.io[^"]*"/.test(failure.diag.at) - ) : false; - }); - - if (failures.length > 0) { - console.log(formatFailures(failures)); - } - - // Fail hard only if over skip threshold - if (failures.length > skip) { - process.exit(1); - } - }); - - return dup; -} - -function formatFailures(failures) { - return failures.map(failure => { - let { diag = {} } = failure; - return failure.name + '\n' + diag.actual + ' at ' + diag.at; - }).join('\n\n'); -} From f9d55b91df68297b8c07f24f0c4c51c5f85a861d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Tue, 10 Apr 2018 01:20:08 +0200 Subject: [PATCH 2/6] Skip gitter sidecar and todo external-redirects --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ccbfb2196de1..211e2ca698a0 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "fetch": "sh src/scripts/fetch.sh", "init:generated": "mkdirp ./generated/loaders && mkdirp ./generated/plugins ", "lint": "run-s lint:*", - "lint:links": "hyperlink -r build/index.html --canonicalroot https://webpack.js.org/ --skip support__ | tap-spot", + "lint:links": "hyperlink -r build/index.html --canonicalroot https://webpack.js.org/ --skip support__ --skip sidecar.gitter.im --todo external-redirect | tee master.tap | tap-spot", "lint:js": "eslint . --ext .js --ext .jsx", "lint:markdown": "markdownlint --config ./.markdownlint.json *.md ./src/content/**/*.md", "lint:social": "alex . -q", From 436362407e1c3ab92014f349f16615d15eede01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Tue, 10 Apr 2018 22:57:10 +0200 Subject: [PATCH 3/6] Fix broken fragment links to node documentation --- src/content/configuration/output.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 84d4916c5100..65a30f94e36a 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -250,7 +250,7 @@ The prefix length of the hash digest to use, defaults to `20`. `string|function` -The hashing algorithm to use, defaults to `'md5'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) are supported. Since `4.0.0-alpha2`, the `hashFunction` can now be a constructor to a custom hash function. You can provide a non-crypto hash function for performance reasons. +The hashing algorithm to use, defaults to `'md5'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options) are supported. Since `4.0.0-alpha2`, the `hashFunction` can now be a constructor to a custom hash function. You can provide a non-crypto hash function for performance reasons. ``` js hashFunction: require('metrohash').MetroHash64 @@ -260,7 +260,7 @@ Make sure that the hashing function will have `update` and `digest` methods avai ## `output.hashSalt` -An optional salt to update the hash via Node.JS' [`hash.update`](https://nodejs.org/api/crypto.html#crypto_hash_update_data_input_encoding). +An optional salt to update the hash via Node.JS' [`hash.update`](https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding). ## `output.hotUpdateChunkFilename` From a18805ec0c0ed33f4bb370759075534ee2532845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Wed, 11 Apr 2018 00:14:06 +0200 Subject: [PATCH 4/6] Update hyperlink and tap-spot --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 211e2ca698a0..47189c46e9c1 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "github": "^10.0.0", "html-webpack-plugin": "^3.1.0", "http-server": "^0.10.0", - "hyperlink": "github:Munter/hyperlink#651f1e2", + "hyperlink": "github:Munter/hyperlink#070916d", "loader-utils": "^1.1.0", "lodash": "^4.17.4", "markdown-loader": "^2.0.1", @@ -90,7 +90,7 @@ "sass-loader": "^6.0.6", "sitemap-static": "^0.4.2", "tap-min": "^1.2.1", - "tap-spot": "^1.0.0", + "tap-spot": "^1.1.1", "through2": "^2.0.3", "url-loader": "^0.5.9", "webpack": "^4.2.0", From 8fb0520ba7cbd676dd816417c936d041777c89bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Wed, 11 Apr 2018 00:15:22 +0200 Subject: [PATCH 5/6] Don't resolve external README internal fragment identifier hrefs to raw.githubusercontent.com --- src/scripts/fetch_package_files.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/fetch_package_files.js b/src/scripts/fetch_package_files.js index 30cb1e374701..19737038f08a 100644 --- a/src/scripts/fetch_package_files.js +++ b/src/scripts/fetch_package_files.js @@ -87,8 +87,8 @@ function fetchPackageFiles(options, finalCb) { // Examples: // - [click here](LICENSE) --> [click here](https://raw.githubusercontent.com/user/repository/branch/LICENSE) // - [click here](./LICENSE) --> [click here](https://raw.githubusercontent.com/user/repository/branch/LICENSE) - // - [click here](#LICENSE) --> [click here](https://raw.githubusercontent.com/user/repository/branch#LICENSE) - .replace(/\[([^[\]]*)\]\(([^)]+)\)/g, (match, textContent, href) => `[${textContent}](${urlModule.resolve(url, href)})`) + // - [click here](#LICENSE) --> [click here](#LICENSE) + .replace(/\[([^[\]]*)\]\(([^)#]+)\)/g, (match, textContent, href) => `[${textContent}](${urlModule.resolve(url, href)})`) // Modify links to keep them within the site .replace(/https?:\/\/github.com\/(webpack|webpack-contrib)\/([-A-za-z0-9]+-loader\/?)([)"])/g, '/loaders/$2/$3') .replace(/https?:\/\/github.com\/(webpack|webpack-contrib)\/([-A-za-z0-9]+-plugin\/?)([)"])/g, '/plugins/$2/$3') From 5dcdf11e2b2dad3a0be9a876b82276c6d873a577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Wed, 11 Apr 2018 00:28:00 +0200 Subject: [PATCH 6/6] hyperlink --todo img.shields.io --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47189c46e9c1..495095accb0d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "fetch": "sh src/scripts/fetch.sh", "init:generated": "mkdirp ./generated/loaders && mkdirp ./generated/plugins ", "lint": "run-s lint:*", - "lint:links": "hyperlink -r build/index.html --canonicalroot https://webpack.js.org/ --skip support__ --skip sidecar.gitter.im --todo external-redirect | tee master.tap | tap-spot", + "lint:links": "hyperlink -r build/index.html --canonicalroot https://webpack.js.org/ --skip support__ --skip sidecar.gitter.im --todo img.shields.io --todo external-redirect | tee master.tap | tap-spot", "lint:js": "eslint . --ext .js --ext .jsx", "lint:markdown": "markdownlint --config ./.markdownlint.json *.md ./src/content/**/*.md", "lint:social": "alex . -q",