@medicomind/rolldown-compression-wasm32-wasi 2.1.7 → 2.1.8
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.
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medicomind/rolldown-compression-wasm32-wasi",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"cpu": [
|
|
5
|
-
"wasm32"
|
|
6
|
-
],
|
|
3
|
+
"version": "2.1.8",
|
|
7
4
|
"main": "rolldown-compression.wasi.cjs",
|
|
8
5
|
"files": [
|
|
9
6
|
"rolldown-compression.wasm32-wasi.wasm",
|
|
10
7
|
"rolldown-compression.wasi.cjs",
|
|
8
|
+
"rolldown-compression.wasi.d.cts",
|
|
11
9
|
"rolldown-compression.wasi-browser.js",
|
|
12
10
|
"wasi-worker.mjs",
|
|
13
11
|
"wasi-worker-browser.mjs"
|
|
@@ -16,15 +14,22 @@
|
|
|
16
14
|
"keywords": [
|
|
17
15
|
"rolldown",
|
|
18
16
|
"rolldown-plugin",
|
|
17
|
+
"vite",
|
|
18
|
+
"vite-plugin",
|
|
19
19
|
"compression",
|
|
20
|
+
"compress",
|
|
20
21
|
"gzip",
|
|
21
22
|
"brotli",
|
|
22
23
|
"zstd",
|
|
23
|
-
"
|
|
24
|
+
"zstandard",
|
|
25
|
+
"rust",
|
|
26
|
+
"native",
|
|
27
|
+
"napi-rs",
|
|
28
|
+
"performance"
|
|
24
29
|
],
|
|
25
30
|
"license": "MIT",
|
|
26
31
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
32
|
+
"node": ">=22.14.0 <23.0.0-0 || >=23.5.0"
|
|
28
33
|
},
|
|
29
34
|
"repository": {
|
|
30
35
|
"type": "git",
|
|
@@ -34,10 +39,12 @@
|
|
|
34
39
|
"registry": "https://registry.npmjs.org/",
|
|
35
40
|
"access": "public"
|
|
36
41
|
},
|
|
42
|
+
"types": "rolldown-compression.wasi.d.cts",
|
|
37
43
|
"browser": "rolldown-compression.wasi-browser.js",
|
|
44
|
+
"type": "module",
|
|
38
45
|
"dependencies": {
|
|
39
|
-
"@napi-rs/wasm-runtime": "
|
|
40
|
-
"@emnapi/core": "
|
|
41
|
-
"@emnapi/runtime": "
|
|
46
|
+
"@napi-rs/wasm-runtime": "~1.2.2",
|
|
47
|
+
"@emnapi/core": "2.0.0-alpha.3",
|
|
48
|
+
"@emnapi/runtime": "2.0.0-alpha.3"
|
|
42
49
|
}
|
|
43
50
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/** Batch-wide options for [`compress_buffers`]. */
|
|
4
|
+
export interface BatchOptions {
|
|
5
|
+
/** Worker threads; 0 or omitted = number of logical CPUs. */
|
|
6
|
+
concurrency?: number
|
|
7
|
+
/**
|
|
8
|
+
* Mark results whose compressed size >= original as skipped and
|
|
9
|
+
* return no data for them. Default: false.
|
|
10
|
+
*/
|
|
11
|
+
skipIfLargerOrEqual?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Compress a batch of buffers off the JS main thread.
|
|
16
|
+
*
|
|
17
|
+
* `tasks[i]` describes how to compress `buffers[i]`. Algorithm names and
|
|
18
|
+
* levels are validated synchronously so misconfiguration fails fast;
|
|
19
|
+
* I/O-shaped failures during compression are reported per task via
|
|
20
|
+
* [`CompressResult::error`].
|
|
21
|
+
*/
|
|
22
|
+
export declare function compressBuffers(tasks: Array<CompressTask>, buffers: Array<Buffer>, options?: BatchOptions | undefined | null): Promise<Array<CompressResult>>
|
|
23
|
+
|
|
24
|
+
/** Outcome of a single task within a batch. */
|
|
25
|
+
export interface CompressResult {
|
|
26
|
+
fileName: string
|
|
27
|
+
algorithm: string
|
|
28
|
+
/** Compressed bytes. Empty when `skipped` is true or `error` is set. */
|
|
29
|
+
data: Buffer
|
|
30
|
+
originalSize: number
|
|
31
|
+
compressedSize: number
|
|
32
|
+
/**
|
|
33
|
+
* True when compression would not shrink the input and
|
|
34
|
+
* `skipIfLargerOrEqual` was requested.
|
|
35
|
+
*/
|
|
36
|
+
skipped: boolean
|
|
37
|
+
/** Per-task failure. A failed task never aborts the rest of the batch. */
|
|
38
|
+
error?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* One compression task: pairs with the buffer at the same index in the
|
|
43
|
+
* `buffers` argument of [`compress_buffers`].
|
|
44
|
+
*/
|
|
45
|
+
export interface CompressTask {
|
|
46
|
+
fileName: string
|
|
47
|
+
/** Canonical algorithm name: "gzip" | "brotli" | "zstd". */
|
|
48
|
+
algorithm: string
|
|
49
|
+
/**
|
|
50
|
+
* Compression level; algorithm default when omitted
|
|
51
|
+
* (gzip 6, brotli 11, zstd 19).
|
|
52
|
+
*/
|
|
53
|
+
level?: number
|
|
54
|
+
/** Brotli only: log2 window size (10-24, default 22). */
|
|
55
|
+
windowBits?: number
|
|
56
|
+
/**
|
|
57
|
+
* Brotli only: target section size in bytes per worker thread when
|
|
58
|
+
* large inputs are split across the brotli worker pool; inputs at
|
|
59
|
+
* least four times this size take the multithreaded path. Defaults
|
|
60
|
+
* to one window (`2^windowBits` bytes), i.e. 4 MiB and
|
|
61
|
+
* multithreading from 16 MiB at the default window.
|
|
62
|
+
*/
|
|
63
|
+
sectionSize?: number
|
|
64
|
+
}
|
|
Binary file
|