@flightdev/image 0.0.2 → 0.1.0
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 +13 -13
- package/package.json +102 -96
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @flightdev/image
|
|
2
2
|
|
|
3
3
|
Image optimization package for Flight Framework with Sharp, Squoosh, and CDN adapters.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @flightdev/image
|
|
9
9
|
|
|
10
10
|
# Install your preferred processor:
|
|
11
11
|
npm install sharp # For Node.js (fastest)
|
|
@@ -15,8 +15,8 @@ npm install sharp # For Node.js (fastest)
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import { createImage } from '@
|
|
19
|
-
import { sharp } from '@
|
|
18
|
+
import { createImage } from '@flightdev/image';
|
|
19
|
+
import { sharp } from '@flightdev/image/sharp';
|
|
20
20
|
|
|
21
21
|
const image = createImage(sharp());
|
|
22
22
|
|
|
@@ -44,7 +44,7 @@ const responsive = await image.responsive('./hero.jpg', {
|
|
|
44
44
|
Fastest option for Node.js environments.
|
|
45
45
|
|
|
46
46
|
```typescript
|
|
47
|
-
import { sharp } from '@
|
|
47
|
+
import { sharp } from '@flightdev/image/sharp';
|
|
48
48
|
|
|
49
49
|
const adapter = sharp({
|
|
50
50
|
cache: true, // Enable internal cache
|
|
@@ -58,7 +58,7 @@ const adapter = sharp({
|
|
|
58
58
|
Works on Edge runtimes (Cloudflare Workers, Vercel Edge).
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import { squoosh } from '@
|
|
61
|
+
import { squoosh } from '@flightdev/image/squoosh';
|
|
62
62
|
|
|
63
63
|
const adapter = squoosh();
|
|
64
64
|
```
|
|
@@ -68,7 +68,7 @@ const adapter = squoosh();
|
|
|
68
68
|
CDN-based optimization, no local processing.
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
|
-
import { cloudinary } from '@
|
|
71
|
+
import { cloudinary } from '@flightdev/image/cloudinary';
|
|
72
72
|
|
|
73
73
|
const adapter = cloudinary({
|
|
74
74
|
cloudName: 'my-cloud',
|
|
@@ -80,7 +80,7 @@ const adapter = cloudinary({
|
|
|
80
80
|
### Imgix (CDN)
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
import { imgix } from '@
|
|
83
|
+
import { imgix } from '@flightdev/image/imgix';
|
|
84
84
|
|
|
85
85
|
const adapter = imgix({
|
|
86
86
|
domain: 'my-source.imgix.net',
|
|
@@ -93,7 +93,7 @@ const adapter = imgix({
|
|
|
93
93
|
### React
|
|
94
94
|
|
|
95
95
|
```tsx
|
|
96
|
-
import { Image } from '@
|
|
96
|
+
import { Image } from '@flightdev/image/react';
|
|
97
97
|
|
|
98
98
|
<Image
|
|
99
99
|
src="/hero.jpg"
|
|
@@ -110,7 +110,7 @@ import { Image } from '@flight-framework/image/react';
|
|
|
110
110
|
|
|
111
111
|
```vue
|
|
112
112
|
<script setup>
|
|
113
|
-
import { FlightImage } from '@
|
|
113
|
+
import { FlightImage } from '@flightdev/image/vue';
|
|
114
114
|
</script>
|
|
115
115
|
|
|
116
116
|
<template>
|
|
@@ -129,7 +129,7 @@ import { FlightImage } from '@flight-framework/image/vue';
|
|
|
129
129
|
|
|
130
130
|
```svelte
|
|
131
131
|
<script>
|
|
132
|
-
import { createImageProps, lazyImage } from '@
|
|
132
|
+
import { createImageProps, lazyImage } from '@flightdev/image/svelte';
|
|
133
133
|
|
|
134
134
|
const props = createImageProps({
|
|
135
135
|
src: '/hero.jpg',
|
|
@@ -145,7 +145,7 @@ import { FlightImage } from '@flight-framework/image/vue';
|
|
|
145
145
|
### Solid
|
|
146
146
|
|
|
147
147
|
```tsx
|
|
148
|
-
import { Image } from '@
|
|
148
|
+
import { Image } from '@flightdev/image/solid';
|
|
149
149
|
|
|
150
150
|
<Image
|
|
151
151
|
src="/hero.jpg"
|
|
@@ -185,7 +185,7 @@ import { Image } from '@flight-framework/image/solid';
|
|
|
185
185
|
Implement the `ImageAdapter` interface:
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
|
-
import type { ImageAdapter } from '@
|
|
188
|
+
import type { ImageAdapter } from '@flightdev/image';
|
|
189
189
|
|
|
190
190
|
export function myAdapter(config: MyConfig): ImageAdapter {
|
|
191
191
|
return {
|
package/package.json
CHANGED
|
@@ -1,97 +1,103 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@flightdev/image",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agnostic image optimization for Flight Framework. Choose your processor: Sharp, Squoosh, Cloudinary, or custom.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./sharp": {
|
|
12
|
+
"types": "./dist/adapters/sharp.d.ts",
|
|
13
|
+
"import": "./dist/adapters/sharp.js"
|
|
14
|
+
},
|
|
15
|
+
"./squoosh": {
|
|
16
|
+
"types": "./dist/adapters/squoosh.d.ts",
|
|
17
|
+
"import": "./dist/adapters/squoosh.js"
|
|
18
|
+
},
|
|
19
|
+
"./cloudinary": {
|
|
20
|
+
"types": "./dist/adapters/cloudinary.d.ts",
|
|
21
|
+
"import": "./dist/adapters/cloudinary.js"
|
|
22
|
+
},
|
|
23
|
+
"./imgix": {
|
|
24
|
+
"types": "./dist/adapters/imgix.d.ts",
|
|
25
|
+
"import": "./dist/adapters/imgix.js"
|
|
26
|
+
},
|
|
27
|
+
"./react": {
|
|
28
|
+
"types": "./dist/components/react.d.ts",
|
|
29
|
+
"import": "./dist/components/react.js"
|
|
30
|
+
},
|
|
31
|
+
"./vue": {
|
|
32
|
+
"types": "./dist/components/vue.d.ts",
|
|
33
|
+
"import": "./dist/components/vue.js"
|
|
34
|
+
},
|
|
35
|
+
"./svelte": {
|
|
36
|
+
"types": "./dist/components/svelte.d.ts",
|
|
37
|
+
"import": "./dist/components/svelte.js"
|
|
38
|
+
},
|
|
39
|
+
"./solid": {
|
|
40
|
+
"types": "./dist/components/solid.d.ts",
|
|
41
|
+
"import": "./dist/components/solid.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup",
|
|
49
|
+
"dev": "tsup --watch",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"test:watch": "vitest",
|
|
52
|
+
"typecheck": "tsc --noEmit"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"sharp": "\u003e=0.33.0",
|
|
57
|
+
"react": "\u003e=18.0.0",
|
|
58
|
+
"vue": "\u003e=3.0.0",
|
|
59
|
+
"svelte": "\u003e=4.0.0",
|
|
60
|
+
"solid-js": "\u003e=1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"sharp": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"vue": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"svelte": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"solid-js": {
|
|
76
|
+
"optional": true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@types/node": "^22.0.0",
|
|
81
|
+
"tsup": "^8.0.0",
|
|
82
|
+
"typescript": "^5.7.0",
|
|
83
|
+
"vitest": "^2.0.0"
|
|
84
|
+
},
|
|
85
|
+
"keywords": [
|
|
86
|
+
"flight",
|
|
87
|
+
"image",
|
|
88
|
+
"optimization",
|
|
89
|
+
"sharp",
|
|
90
|
+
"webp",
|
|
91
|
+
"avif",
|
|
92
|
+
"responsive",
|
|
93
|
+
"agnostic"
|
|
94
|
+
],
|
|
95
|
+
"author": "Flight Contributors",
|
|
96
|
+
"license": "MIT",
|
|
97
|
+
"homepage": "https://github.com/EliosLT/FlightDev",
|
|
98
|
+
"repository": {
|
|
99
|
+
"url": "https://github.com/EliosLT/FlightDev.git",
|
|
100
|
+
"directory": "packages/image",
|
|
101
|
+
"type": "git"
|
|
102
|
+
}
|
|
97
103
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024-2026 Flight Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|