Memperbarui brotli dari 1.x ke 2.x
Perbandingan API publik brotli 1.3.3 dan 2.1.0, dihitung otomatis dari tipe TypeScript-nya. Tanda tangan yang berubah adalah kemungkinan perubahan tidak kompatibel, bukan kepastian.
Ringkasan
| Jalur impor yang dihapus | 0 |
|---|---|
| Ekspor yang dihapus | 0 |
| Tanda tangan yang berubah | 2 |
| Anggota kelas atau antarmuka yang dihapus | 0 |
| Anggota kelas atau antarmuka yang berubah | 0 |
| Baru ditandai usang | 0 |
| Perubahan persyaratan (engines, dependensi peer) | 0 |
| Ekspor baru | 4 |
Ekspor yang dihapus
Tidak ada yang terdeteksi.
Tanda tangan yang berubah
| export | Sebelum | Sesudah |
|---|---|---|
brotli · compress | (buffer: Buffer, options?: CompressOptions | undefined): Uint8Array<ArrayBufferLike> | null | (buffer: string | ArrayLike<number>, options?: boolean | CompressOptions | undefined): Promise<Uint8Array<ArrayBufferLike> | null> |
brotli · decompress | (buffer: Buffer, outputSize?: number | undefined): Uint8Array<ArrayBufferLike> | (buffer: ArrayLike<number>, outSize?: number | null | undefined): Uint8Array<ArrayBufferLike> |
Anggota kelas atau antarmuka yang dihapus
Tidak ada yang terdeteksi.
Anggota kelas atau antarmuka yang berubah
Tidak ada yang terdeteksi.
Baru ditandai usang
Tidak ada yang terdeteksi.
Perubahan persyaratan (engines, dependensi peer)
Tidak ada yang terdeteksi.
Ekspor baru (4)
| import | export | kind |
|---|---|---|
brotli | CompressOptions | interface |
brotli/compress | compress | function |
brotli/compress | CompressOptions | interface |
brotli/decompress | decompress | function |
Changelog di antara versi ini
Teks yang diterbitkan oleh penulis paket, ditampilkan apa adanya.
2.1.0
### Changed
- Use the nullish coalescing (??) operator to check if the value is defined (#38)
- Use imports field to ship differential implementation for node and browser2.0.0
### Changed
- **Breaking:** Converted the package to ESM only. All public entry points use
named `compress` and/or `decompress` exports with no default export.
- **Breaking:** `compress()` now returns `Promise<Uint8Array | null>` and must
be awaited. Compression options, output bytes, and `null` results are unchanged.
`decompress()` remains synchronous.
- Public entry points are limited to the package root, `brotli/compress`, and
`brotli/decompress`, including `.js` aliases for both standalone modules.
Standalone modules export their named function.
- Encoder initialization is deferred until the first compression call. Concurrent
calls share one initialization Promise, including failures, with no automatic
retries. Initialization and runtime errors reject the compression Promise.
- Removed top-level await and enabled modern Node.js `require()` through every
public entry point. Unflagged ESM loading is supported in Node 20.19+, 22.12+,
and later releases; see the [Node documentation](https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require).
The distribution remains ESM only.
- Encoding still runs on the calling thread without workers. Keep the input,
options, and dictionary unchanged until compression settles; no input copying
is added.
### Added
- TypeScript declarations for the package root and standalone modules, including
their `.js` aliases and the `CompressOptions` type.
- Tests for ESM and CommonJS exports, lazy and shared initialization, Promise
results and failures, and browser bundles, including dictionary initialization
and decompression without the encoder.
### Migration
```javascript
import { compress, decompress } from 'brotli';
const compressed = await compress(input);
const original = decompress(compressed);
```
To load either function independently:
```javascript
import { compress } from 'brotli/compress';
import { decompress } from 'brotli/decompress';
```
Modern Node.js CommonJS consumers can destructure named exports from the root
or standalone modules:
```javascript
const { compress, decompress } = require('brotli');
// Alternatively: const { compress } = require('brotli/compress');
compress(input).then(compressed => {
const original = decompress(compressed);
}).catch(console.error);
```
Older Node.js CommonJS consumers can continue to use dynamic `import()`.Berikan fakta ini ke agen AI Anda
Vigia adalah server MCP gratis: agen coding Anda memeriksa versi, perubahan yang merusak kompatibilitas, dan kerentanan sebelum menulis kode. Tanpa pendaftaran, tanpa kunci API.
claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp
Tambahkan ke CursorTambahkan ke VS Code★ Bintang di GitHub
Klien MCP lainnya
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }Skill agen (SKILL.md): memberi tahu agen kapan memakai Vigia · GitHub Action untuk pull request
Pertanyaan umum
Apa saja perubahan tidak kompatibel saat memperbarui brotli dari 1 ke 2?
Antara brotli 1.3.3 dan 2.1.0, Vigia menemukan 0 ekspor yang dihapus, 2 tanda tangan yang berubah, dan 0 anggota kelas atau antarmuka yang dihapus atau berubah.
Apa yang ditandai usang di brotli 2?
0 ekspor atau anggota baru ditandai usang di brotli 2.1.0.
Untuk agen
GET https://vigia.coredls.cloud/v1/packages/npm/brotli/upgrade?from=1.3.3&to=2.1.0