chore: replace brotli with node:zlib (#8045)

Signed-off-by: JayFate <48240828+JayFate@users.noreply.github.com>
This commit is contained in:
JayFate 2023-04-10 14:06:28 +08:00 committed by GitHub
parent 19e17a951c
commit 37701a88c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 14 deletions

View File

@ -69,7 +69,6 @@
"@typescript-eslint/parser": "^5.56.0",
"@vitest/coverage-istanbul": "^0.29.7",
"@vue/consolidate": "0.17.3",
"brotli": "^1.3.2",
"chalk": "^4.1.0",
"conventional-changelog-cli": "^2.0.31",
"enquirer": "^2.3.2",

View File

@ -1,6 +1,6 @@
const { compress } = require('brotli')
const { brotliCompressSync } = require('zlib')
const file = require('fs').readFileSync('dist/index.js')
const compressed = compress(file)
const compressed = brotliCompressSync(file)
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
console.log(`brotli: ${compressedSize}`)

View File

@ -18,7 +18,6 @@ importers:
'@typescript-eslint/parser': ^5.56.0
'@vitest/coverage-istanbul': ^0.29.7
'@vue/consolidate': 0.17.3
brotli: ^1.3.2
chalk: ^4.1.0
conventional-changelog-cli: ^2.0.31
enquirer: ^2.3.2
@ -65,7 +64,6 @@ importers:
'@typescript-eslint/parser': 5.56.0_qesohl5arz7pvqyycxtsqomlr4
'@vitest/coverage-istanbul': 0.29.7_vitest@0.29.7
'@vue/consolidate': 0.17.3
brotli: 1.3.3
chalk: 4.1.2
conventional-changelog-cli: 2.2.2
enquirer: 2.3.6
@ -1467,12 +1465,6 @@ packages:
fill-range: 7.0.1
dev: true
/brotli/1.3.3:
resolution: {integrity: sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==}
dependencies:
base64-js: 1.5.1
dev: true
/browserslist/4.21.5:
resolution: {integrity: sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}

View File

@ -20,8 +20,7 @@ import fs from 'node:fs/promises'
import { existsSync, readFileSync, rmSync } from 'node:fs'
import path from 'node:path'
import minimist from 'minimist'
import { gzipSync } from 'node:zlib'
import { compress } from 'brotli'
import { gzipSync, brotliCompressSync } from 'node:zlib'
import chalk from 'chalk'
import execa from 'execa'
import { cpus } from 'node:os'
@ -143,7 +142,7 @@ function checkFileSize(filePath) {
const minSize = (file.length / 1024).toFixed(2) + 'kb'
const gzipped = gzipSync(file)
const gzippedSize = (gzipped.length / 1024).toFixed(2) + 'kb'
const compressed = compress(file)
const compressed = brotliCompressSync(file)
// @ts-ignore
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
console.log(