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..495095accb0d 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__ --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", @@ -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#070916d", "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.1.1", "through2": "^2.0.3", "url-loader": "^0.5.9", "webpack": "^4.2.0", 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` 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'); -} 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')