Skip to content

Commit

Permalink
refactor(bazel): replace brotli package with Node.js builtin (#152)
Browse files Browse the repository at this point in the history
Node.js v10.16 and greater provides native support for brotli compression. By leveraging this native support the need to use an additional package for brotli has been removed.

PR Close #152
  • Loading branch information
clydin authored and angular-ci committed Aug 16, 2021
1 parent 1638e3f commit 3c3b5a3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
1 change: 0 additions & 1 deletion bazel/benchmark/brotli-cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ nodejs_binary(
name = "brotli-cli",
data = [
"cli.js",
"@npm//brotli",
],
entry_point = ":cli.js",
visibility = ["//visibility:public"],
Expand Down
4 changes: 2 additions & 2 deletions bazel/benchmark/brotli-cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
*/

const fs = require('fs');
const compress = require('brotli/compress');
const {brotliCompressSync} = require('zlib');

function main(args) {
const output = args[0].substring('--output='.length);
const input = args[1];
const buffer = fs.readFileSync(input);
fs.writeFileSync(output, compress(buffer, {mode: 0, quality: 11}));
fs.writeFileSync(output, brotliCompressSync(buffer));
}

if (require.main === module) {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@types/uuid": "^8.3.1",
"@types/yaml": "^1.9.7",
"@types/yargs": "^17.0.0",
"brotli": "^1.3.2",
"chalk": "^4.1.0",
"clang-format": "^1.4.0",
"cli-progress": "^3.7.0",
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

base64-js@^1.1.2, base64-js@^1.3.1:
base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
Expand Down Expand Up @@ -821,13 +821,6 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"

brotli@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/brotli/-/brotli-1.3.2.tgz#525a9cad4fcba96475d7d388f6aecb13eed52f46"
integrity sha1-UlqcrU/LqWR119OI9q7LE+7VL0Y=
dependencies:
base64-js "^1.1.2"

browserstack@^1.5.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.6.1.tgz#e051f9733ec3b507659f395c7a4765a1b1e358b3"
Expand Down

0 comments on commit 3c3b5a3

Please sign in to comment.