@squoosh-kit/core 0.0.1 → 0.0.2
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/README.md +49 -12
- package/package.json +4 -10
package/README.md
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/%40squoosh-kit%2Fcore)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**The complete Squoosh Kit experience in a single package**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`@squoosh-kit/core` brings together all the image processing power of Squoosh Kit in one convenient package. Perfect for when you want everything at your fingertips without worrying about which specific package to install.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- [`@squoosh-kit/resize`](https://www.npmjs.com/package/@squoosh-kit/resize) - High-quality image resizing.
|
|
9
|
+
This meta-package re-exports all functionality from the individual Squoosh Kit packages, so you get WebP encoding, high-quality resizing, and all the underlying runtime utilities in one place.
|
|
11
10
|
|
|
12
11
|
## Installation
|
|
13
12
|
|
|
@@ -19,20 +18,58 @@ npm install @squoosh-kit/core
|
|
|
19
18
|
|
|
20
19
|
## Quick Start
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
Everything you need, right at your fingertips:
|
|
23
22
|
|
|
24
23
|
```typescript
|
|
25
|
-
import {
|
|
24
|
+
import { encode, resize, createWebpEncoder, createResizer } from '@squoosh-kit/core';
|
|
26
25
|
|
|
27
|
-
//
|
|
28
|
-
const webpData = await
|
|
26
|
+
// Quick one-off operations
|
|
27
|
+
const webpData = await encode(
|
|
28
|
+
new AbortController().signal,
|
|
29
|
+
imageData,
|
|
30
|
+
{ quality: 85 }
|
|
31
|
+
);
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const resizedImage = await resize(
|
|
34
|
+
new AbortController().signal,
|
|
35
|
+
imageData,
|
|
36
|
+
{ width: 800, height: 600 }
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Or create reusable processors for batch operations
|
|
40
|
+
const encoder = createWebpEncoder('worker');
|
|
41
|
+
const resizer = createResizer('worker');
|
|
32
42
|
```
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
## What's Included
|
|
45
|
+
|
|
46
|
+
This package bundles together:
|
|
47
|
+
|
|
48
|
+
- **WebP Encoding** - Convert images to the modern WebP format with fine-tuned quality control
|
|
49
|
+
- **Image Resizing** - High-quality Lanczos3 resizing for crisp, clear results
|
|
50
|
+
- **Worker Management** - Automatic Web Worker integration to keep your app responsive
|
|
51
|
+
- **TypeScript Support** - Full type definitions for a great development experience
|
|
52
|
+
|
|
53
|
+
## When to Use Core vs Individual Packages
|
|
54
|
+
|
|
55
|
+
**Use `@squoosh-kit/core` when:**
|
|
56
|
+
- You're just getting started and want everything available
|
|
57
|
+
- Your project needs both WebP encoding and resizing
|
|
58
|
+
- You prefer a single dependency for simplicity
|
|
59
|
+
- You're building a prototype or proof of concept
|
|
60
|
+
|
|
61
|
+
**Consider individual packages when:**
|
|
62
|
+
- You only need one specific feature (like just WebP encoding)
|
|
63
|
+
- Bundle size is critical and you want to minimize dependencies
|
|
64
|
+
- You need fine-grained control over versions
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
All functions follow the same patterns as the individual packages. For detailed documentation, see:
|
|
69
|
+
|
|
70
|
+
- [WebP Encoding API](./webp) - Advanced encoding options and examples
|
|
71
|
+
- [Resize API](./resize) - Resizing algorithms and configuration details
|
|
35
72
|
|
|
36
73
|
## License
|
|
37
74
|
|
|
38
|
-
MIT
|
|
75
|
+
MIT - part of the Squoosh Kit family
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squoosh-kit/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"entry": "src/index.ts",
|
|
6
5
|
"description": "Per-feature adapters around Squoosh codecs (Bun-first), worker/client runtimes.",
|
|
7
6
|
"author": "Bartosz Nowak <bnowak008@gmail.com>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -59,15 +58,10 @@
|
|
|
59
58
|
],
|
|
60
59
|
"sideEffects": false,
|
|
61
60
|
"scripts": {
|
|
62
|
-
"
|
|
63
|
-
"build:declarations": "tsc",
|
|
64
|
-
"build:code": "bun build --sourcemap --minify --format=esm --splitting --target=bun --outdir=dist src/index.ts",
|
|
65
|
-
"build": "bun run copy:assets && bun run build:declarations && bun run build:code",
|
|
66
|
-
"build:production": "bun run build",
|
|
67
|
-
"prepublishOnly": "bun run build && bun test",
|
|
68
|
-
"test": "bun test",
|
|
61
|
+
"build": "tsc",
|
|
69
62
|
"clean:local": "rm -rf dist *.tsbuildinfo",
|
|
70
|
-
"prepack": "bun run build"
|
|
63
|
+
"prepack": "bun run build && bun test",
|
|
64
|
+
"test": "bun test"
|
|
71
65
|
},
|
|
72
66
|
"dependencies": {
|
|
73
67
|
"@squoosh-kit/webp": "0.1.0",
|