@medicomind/rolldown-compression 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +23 -23
  3. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @medicomind/rolldown-compression
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2fa931e`](https://github.com/Medico-Mind/rolldown-compression/commit/2fa931efef1b6e58e48c0782aeed83aee6b9d26b) Thanks [@Mnwa](https://github.com/Mnwa)! - Fix windows warning and up deps
8
+
3
9
  ## 2.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  Fast, native compression plugin for [Rolldown](https://rolldown.rs) and [Vite 8+](#usage-with-vite): compresses emitted assets with **gzip**, **brotli** and **zstd** at build time. The compression core is written in Rust (napi-rs + rayon) — one batched FFI call per build, fanned out across all CPU cores, without ever blocking the JS event loop.
10
10
 
11
- **3x faster builds in a real project**: switching a production app from `node:zlib`-based (node v26.4.0) compression to this plugin cut total build time from 3:50 to 1:23 (294% → 688% CPU utilization) — see [real-world results](#real-world-results).
11
+ **3x faster builds in a real project**: switching a production app from `node:zlib`-based (node v26.4.0) compression to this plugin cut total build time from 3:50 to 1:13 (740% → 688% CPU utilization) — see [real-world results](#real-world-results).
12
12
 
13
13
  API ergonomics mirror [`vite-plugin-compression2`](https://github.com/nonzzz/vite-plugin-compression); see [differences](#differences-from-vite-plugin-compression2).
14
14
 
@@ -80,32 +80,32 @@ export default defineConfig({
80
80
 
81
81
  ## Options
82
82
 
83
- | option | type | default | description |
84
- | --- | --- | --- | --- |
85
- | `include` | `string \| RegExp \| Array<string \| RegExp>` | `/\.(html\|xml\|css\|json\|js\|mjs\|svg\|yaml\|yml\|toml\|txt\|wasm)$/` | Files to compress. Strings are [picomatch](https://github.com/micromatch/picomatch) globs, matched against bundle-relative file names ([`@rollup/pluginutils` `createFilter`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter) semantics). |
86
- | `exclude` | `string \| RegExp \| Array<string \| RegExp>` | — | Files to skip. **Wins over `include`.** |
87
- | `threshold` | `number` | `0` | Minimum original size in bytes for a file to be compressed. |
88
- | `algorithms` | `Array<AlgorithmName \| DefineAlgorithmResult>` | `['gzip', 'brotli']` | Algorithms to run. Aliases `gz`, `br`, `brotliCompress`, `zstandard` normalize to `gzip` / `brotli` / `zstd`. |
89
- | `filename` | `string \| (fileName, algorithm) => string` | `'[path][base]' + ext` | Name of the emitted artifact. Tokens: `[path]` (directory incl. trailing `/`), `[base]`, `[name]`, `[ext]` (with dot), `[hash]` (8-char sha256 of the content). Default extensions: `.gz`, `.br`, `.zst`. |
90
- | `deleteOriginalAssets` | `boolean` | `false` | Remove the original from the bundle after all algorithms processed it. Errors if `filename` resolves to the source name. |
91
- | `skipIfLargerOrEqual` | `boolean` | `true` | Don't emit artifacts whose compressed size is `>=` the original. |
92
- | `concurrency` | `number` | `0` | Native worker threads. `0` = number of logical CPUs. |
93
- | `chunkSize` | `number` | `0` | Max source bytes buffered per native compression batch. `0` = one batch for the whole build. A positive value (e.g. `64 * 1024 * 1024`) caps the plugin's peak memory overhead at roughly one batch of source copies plus its compressed outputs; a single file larger than `chunkSize` still forms its own batch. The bundler keeps the original bundle in memory regardless. In [stream mode](#stream-mode) `0` falls back to a 4 MB batch instead of one big batch. |
94
- | `stream` | `boolean` | `false` | Compress from disk in `writeBundle` (order `post`) instead of in memory in `generateBundle`: files are read on demand in bounded batches (`chunkSize` bytes, default 4 MB), and assets written to disk by other plugins' `writeBundle` hooks are compressed too (see [stream mode](#stream-mode)). |
95
- | `logLevel` | `'silent' \| 'error' \| 'warn' \| 'info'` | `'info'` | Plugin log verbosity; `info` prints a per-algorithm summary at build end. |
96
- | `enableInWatchMode` | `boolean` | `false` | The plugin is a no-op in watch/dev mode unless enabled (see [watch mode](#watch--dev-mode)). |
83
+ | option | type | default | description |
84
+ |------------------------|-------------------------------------------------|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
85
+ | `include` | `string \| RegExp \| Array<string \| RegExp>` | `/\.(html\|xml\|css\|json\|js\|mjs\|svg\|yaml\|yml\|toml\|txt\|wasm)$/` | Files to compress. Strings are [picomatch](https://github.com/micromatch/picomatch) globs, matched against bundle-relative file names ([`@rollup/pluginutils` `createFilter`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter) semantics). |
86
+ | `exclude` | `string \| RegExp \| Array<string \| RegExp>` | — | Files to skip. **Wins over `include`.** |
87
+ | `threshold` | `number` | `0` | Minimum original size in bytes for a file to be compressed. |
88
+ | `algorithms` | `Array<AlgorithmName \| DefineAlgorithmResult>` | `['gzip', 'brotli']` | Algorithms to run. Aliases `gz`, `br`, `brotliCompress`, `zstandard` normalize to `gzip` / `brotli` / `zstd`. |
89
+ | `filename` | `string \| (fileName, algorithm) => string` | `'[path][base]' + ext` | Name of the emitted artifact. Tokens: `[path]` (directory incl. trailing `/`), `[base]`, `[name]`, `[ext]` (with dot), `[hash]` (8-char sha256 of the content). Default extensions: `.gz`, `.br`, `.zst`. |
90
+ | `deleteOriginalAssets` | `boolean` | `false` | Remove the original from the bundle after all algorithms processed it. Errors if `filename` resolves to the source name. |
91
+ | `skipIfLargerOrEqual` | `boolean` | `true` | Don't emit artifacts whose compressed size is `>=` the original. |
92
+ | `concurrency` | `number` | `0` | Native worker threads. `0` = number of logical CPUs. |
93
+ | `chunkSize` | `number` | `0` | Max source bytes buffered per native compression batch. `0` = one batch for the whole build. A positive value (e.g. `64 * 1024 * 1024`) caps the plugin's peak memory overhead at roughly one batch of source copies plus its compressed outputs; a single file larger than `chunkSize` still forms its own batch. The bundler keeps the original bundle in memory regardless. In [stream mode](#stream-mode) `0` falls back to a 4 MB batch instead of one big batch. |
94
+ | `stream` | `boolean` | `false` | Compress from disk in `writeBundle` (order `post`) instead of in memory in `generateBundle`: files are read on demand in bounded batches (`chunkSize` bytes, default 4 MB), and assets written to disk by other plugins' `writeBundle` hooks are compressed too (see [stream mode](#stream-mode)). |
95
+ | `logLevel` | `'silent' \| 'error' \| 'warn' \| 'info'` | `'info'` | Plugin log verbosity; `info` prints a per-algorithm summary at build end. |
96
+ | `enableInWatchMode` | `boolean` | `false` | The plugin is a no-op in watch/dev mode unless enabled (see [watch mode](#watch--dev-mode)). |
97
97
 
98
98
  All options are validated when `compression()` is called — invalid levels (e.g. brotli quality 12), unknown algorithm names or malformed filters throw immediately, not mid-build.
99
99
 
100
100
  ### Per-algorithm options
101
101
 
102
- | algorithm | option | range | default |
103
- | --- | --- | --- | --- |
104
- | `gzip` | `level` | 0–9 | 6 |
105
- | `brotli` | `quality` | 0–11 | 11 |
106
- | `brotli` | `windowBits` | 10–24 | 22 |
107
- | `brotli` | `sectionSize` | ≥ 1 (bytes) | 4 MiB |
108
- | `zstd` | `level` | 1–22 | 19 |
102
+ | algorithm | option | range | default |
103
+ |-----------|---------------|-------------|---------|
104
+ | `gzip` | `level` | 0–9 | 6 |
105
+ | `brotli` | `quality` | 0–11 | 11 |
106
+ | `brotli` | `windowBits` | 10–24 | 22 |
107
+ | `brotli` | `sectionSize` | ≥ 1 (bytes) | 4 MiB |
108
+ | `zstd` | `level` | 1–22 | 19 |
109
109
 
110
110
  ```ts
111
111
  defineAlgorithm('gzip', { level: 9 })
@@ -176,7 +176,7 @@ Switching a production app's build from `node:zlib`-based compression to this pl
176
176
 
177
177
  ```
178
178
  before: npm run build 675.82s user 4.63s system 294% cpu 3:50.92 total
179
- after: npm run build 567.80s user 7.41s system 688% cpu 1:23.58 total
179
+ after: npm run build 537.24s user 5.59s system 740% cpu 1:13.29 total
180
180
  ```
181
181
 
182
182
  **4.03x faster wall clock.** Compression stops being serialized behind the libuv thread pool (default `UV_THREADPOOL_SIZE=4`) and runs on all cores instead — CPU utilization jumps from 235% to 784%.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicomind/rolldown-compression",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Fast native (Rust) gzip / brotli / zstd compression plugin for Rolldown, powered by napi-rs",
5
5
  "keywords": [
6
6
  "rolldown",
@@ -91,13 +91,13 @@
91
91
  "rolldown": "^1.0.0"
92
92
  },
93
93
  "optionalDependencies": {
94
- "@medicomind/rolldown-compression-darwin-arm64": "2.1.0",
95
- "@medicomind/rolldown-compression-darwin-x64": "2.1.0",
96
- "@medicomind/rolldown-compression-linux-arm64-gnu": "2.1.0",
97
- "@medicomind/rolldown-compression-linux-x64-gnu": "2.1.0",
98
- "@medicomind/rolldown-compression-linux-x64-musl": "2.1.0",
99
- "@medicomind/rolldown-compression-wasm32-wasi": "2.1.0",
100
- "@medicomind/rolldown-compression-win32-x64-msvc": "2.1.0"
94
+ "@medicomind/rolldown-compression-darwin-arm64": "2.1.1",
95
+ "@medicomind/rolldown-compression-darwin-x64": "2.1.1",
96
+ "@medicomind/rolldown-compression-linux-arm64-gnu": "2.1.1",
97
+ "@medicomind/rolldown-compression-linux-x64-gnu": "2.1.1",
98
+ "@medicomind/rolldown-compression-linux-x64-musl": "2.1.1",
99
+ "@medicomind/rolldown-compression-wasm32-wasi": "2.1.1",
100
+ "@medicomind/rolldown-compression-win32-x64-msvc": "2.1.1"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@biomejs/biome": "^2.5.3",