]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: replace brotli with node:zlib (#8045)
authorJayFate <48240828+JayFate@users.noreply.github.com>
Mon, 10 Apr 2023 06:06:28 +0000 (14:06 +0800)
committerGitHub <noreply@github.com>
Mon, 10 Apr 2023 06:06:28 +0000 (14:06 +0800)
Signed-off-by: JayFate <48240828+JayFate@users.noreply.github.com>
package.json
packages/size-check/brotli.js
pnpm-lock.yaml
scripts/build.js

index 4f565fdb2d9a3970bae39bef65028c29c36cce13..35d89e177a4654e188b48f5d2015a60f29e1af70 100644 (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",
index 1e7ea0c774b0d26788079ba5ea28011cd13bbb7a..f9dedac0b1c4f2b18938d5d78fc3de2e8bd8963f 100644 (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}`)
index 63322096743dee438ab0c89d85526ec97d3de228..73e9b2c6c817a60a10af08e6aa50fd4575b82318 100644 (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}
index 5272c49c388d78abc41d3dfa69ae38546f9faaba..05ed32ebc5c9c71d4b8e92ddf552ca236f7b28f0 100644 (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(