Оновлення brotli з 1.x до 2.x
Порівняння публічного API brotli 1.3.3 і 2.1.0, обчислене автоматично за їхніми типами TypeScript. Змінена сигнатура — можлива несумісна зміна, а не гарантія.
Підсумок
| Видалені шляхи імпорту | 0 |
|---|---|
| Видалені експорти | 0 |
| Змінені сигнатури | 2 |
| Видалені члени класів або інтерфейсів | 0 |
| Змінені члени класів або інтерфейсів | 0 |
| Нові застарівання | 0 |
| Зміни вимог (engines, peer-залежності) | 0 |
| Нові експорти | 4 |
Видалені експорти
Не виявлено.
Змінені сигнатури
| export | Було | Стало |
|---|---|---|
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> |
Видалені члени класів або інтерфейсів
Не виявлено.
Змінені члени класів або інтерфейсів
Не виявлено.
Нові застарівання
Не виявлено.
Зміни вимог (engines, peer-залежності)
Не виявлено.
Нові експорти (4)
| import | export | kind |
|---|---|---|
brotli | CompressOptions | interface |
brotli/compress | compress | function |
brotli/compress | CompressOptions | interface |
brotli/decompress | decompress | function |
Changelog між цими версіями
Текст, опублікований авторами пакета, показано без змін.
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()`.Передайте ці дані своєму ШІ-агенту
Vigia — безкоштовний MCP-сервер: ваш агент для програмування перевіряє версії, несумісні зміни та вразливості, перш ніж писати код. Без реєстрації та API-ключа.
claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp
Додати в CursorДодати в VS Code★ Зірка на GitHub
Будь-який інший MCP-клієнт
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }Навичка для агентів (SKILL.md): підказує агенту, коли використовувати Vigia · GitHub Action для pull request
Поширені запитання
Які несумісні зміни під час оновлення brotli з 1 до 2?
Між brotli 1.3.3 і 2.1.0 Vigia знайшла видалених експортів: 0, змінених сигнатур: 2, видалених або змінених членів класів та інтерфейсів: 0.
Що застаріло в brotli 2?
У brotli 2.1.0 новими застарілими позначено експортів або членів: 0.
Для агентів
GET https://vigia.coredls.cloud/v1/packages/npm/brotli/upgrade?from=1.3.3&to=2.1.0