Skip to content

Commit 15d04d4

Browse files
chore(main): release 3.20.0 (#146)
* chore(main): release 3.20.0 * chore: format --------- Co-authored-by: mixie-bot[bot] <127146692+mixie-bot[bot]@users.noreply.github.com> Co-authored-by: mixie-bot[bot] <mixie-bot[bot]@users.noreply.github.com>
1 parent 71c8796 commit 15d04d4

8 files changed

+210
-179
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.19.0"
2+
".": "3.20.0"
33
}

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<!-- deno-fmt-ignore-file -->
22
# Changelog
33

4+
## [3.20.0](https://github.com/ascorbic/unpic/compare/v3.19.0...v3.20.0) (2024-11-11)
5+
6+
7+
### Features
8+
9+
* add Hygraph support ([#142](https://github.com/ascorbic/unpic/issues/142)) ([71c8796](https://github.com/ascorbic/unpic/commit/71c879626abf3cc1181314b0683bfcfe3e2fec23))
10+
411
## [3.19.0](https://github.com/ascorbic/unpic/compare/v3.18.1...v3.19.0) (2024-10-26)
512

613

deno.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unpic/lib",
3-
"version": "3.19.0",
3+
"version": "3.20.0",
44
"exports": "./mod.ts",
55
"tasks": {
66
"build:npm": "deno run --allow-all scripts/build_npm.ts"

src/parse.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const parsers = {
5353
imagekit,
5454
uploadcare,
5555
supabase,
56-
hygraph
56+
hygraph,
5757
};
5858

5959
export const cdnIsSupportedForParse = (

src/transform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const getTransformer = (cdn: ImageCdn) => ({
5454
imagekit,
5555
uploadcare,
5656
supabase,
57-
hygraph
57+
hygraph,
5858
}[cdn]);
5959

6060
/**

src/transformers/hygraph.test.ts

+73-72
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,88 @@ import { assertEquals } from "jsr:@std/assert";
22
import { HygraphParams, parse, transform } from "./hygraph.ts";
33
import { ParsedUrl } from "../types.ts";
44

5-
const imageBase = "https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/cm2tr64fx7gvu07n85chjmuno";
5+
const imageBase =
6+
"https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/cm2tr64fx7gvu07n85chjmuno";
67

78
const imageWithAutoFormat =
8-
"https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/resize=fit:crop,width:400,height:400/auto_image/cm2tr64fx7gvu07n85chjmuno";
9+
"https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/resize=fit:crop,width:400,height:400/auto_image/cm2tr64fx7gvu07n85chjmuno";
910

10-
const imageWithExplicitFormat =
11-
"https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/resize=fit:crop,width:400,height:400/output=format:jpg/cm2tr64fx7gvu07n85chjmuno";
11+
const imageWithExplicitFormat =
12+
"https://us-west-2.graphassets.com/cm2apl1zp07l506n66dmd9xo8/resize=fit:crop,width:400,height:400/output=format:jpg/cm2tr64fx7gvu07n85chjmuno";
1213

1314
Deno.test("hygraph", async (t) => {
14-
await t.step("parses a URL with auto format", () => {
15-
const parsed = parse(imageWithAutoFormat);
16-
const expected: ParsedUrl<HygraphParams> = {
17-
base: imageWithAutoFormat,
18-
cdn: "hygraph",
19-
format: "auto",
20-
width: 400,
21-
height: 400,
22-
params: {
23-
transformations: {
24-
resize: {
25-
width: 400,
26-
height: 400,
27-
fit: "crop",
28-
},
29-
auto_image: {},
30-
},
31-
region: "us-west-2",
32-
envId: "cm2apl1zp07l506n66dmd9xo8",
33-
handle: "cm2tr64fx7gvu07n85chjmuno",
34-
},
35-
};
15+
await t.step("parses a URL with auto format", () => {
16+
const parsed = parse(imageWithAutoFormat);
17+
const expected: ParsedUrl<HygraphParams> = {
18+
base: imageWithAutoFormat,
19+
cdn: "hygraph",
20+
format: "auto",
21+
width: 400,
22+
height: 400,
23+
params: {
24+
transformations: {
25+
resize: {
26+
width: 400,
27+
height: 400,
28+
fit: "crop",
29+
},
30+
auto_image: {},
31+
},
32+
region: "us-west-2",
33+
envId: "cm2apl1zp07l506n66dmd9xo8",
34+
handle: "cm2tr64fx7gvu07n85chjmuno",
35+
},
36+
};
3637

37-
assertEquals(parsed, expected);
38-
});
38+
assertEquals(parsed, expected);
39+
});
3940

40-
await t.step("parses a URL with explicit format", () => {
41-
const parsed = parse(imageWithExplicitFormat);
42-
const expected: ParsedUrl<HygraphParams> = {
43-
base: imageWithExplicitFormat,
44-
cdn: "hygraph",
45-
format: "jpg",
46-
width: 400,
47-
height: 400,
48-
params: {
49-
transformations: {
50-
resize: {
51-
width: 400,
52-
height: 400,
53-
fit: "crop",
54-
},
55-
output: {
56-
format: "jpg",
57-
},
58-
},
59-
region: "us-west-2",
60-
envId: "cm2apl1zp07l506n66dmd9xo8",
61-
handle: "cm2tr64fx7gvu07n85chjmuno",
62-
},
63-
};
41+
await t.step("parses a URL with explicit format", () => {
42+
const parsed = parse(imageWithExplicitFormat);
43+
const expected: ParsedUrl<HygraphParams> = {
44+
base: imageWithExplicitFormat,
45+
cdn: "hygraph",
46+
format: "jpg",
47+
width: 400,
48+
height: 400,
49+
params: {
50+
transformations: {
51+
resize: {
52+
width: 400,
53+
height: 400,
54+
fit: "crop",
55+
},
56+
output: {
57+
format: "jpg",
58+
},
59+
},
60+
region: "us-west-2",
61+
envId: "cm2apl1zp07l506n66dmd9xo8",
62+
handle: "cm2tr64fx7gvu07n85chjmuno",
63+
},
64+
};
6465

65-
assertEquals(parsed, expected);
66-
});
66+
assertEquals(parsed, expected);
67+
});
6768

68-
await t.step("transforms a URL with auto format", () => {
69-
const result = transform({
70-
url: imageBase,
71-
width: 400,
72-
height: 400,
73-
});
69+
await t.step("transforms a URL with auto format", () => {
70+
const result = transform({
71+
url: imageBase,
72+
width: 400,
73+
height: 400,
74+
});
7475

75-
assertEquals(result?.toString(), imageWithAutoFormat);
76-
});
76+
assertEquals(result?.toString(), imageWithAutoFormat);
77+
});
7778

78-
await t.step("transforms a URL with explicit format", () => {
79-
const result = transform({
80-
url: imageBase,
81-
width: 400,
82-
height: 400,
83-
format: "jpg",
84-
});
85-
86-
assertEquals(result?.toString(), imageWithExplicitFormat);
87-
});
79+
await t.step("transforms a URL with explicit format", () => {
80+
const result = transform({
81+
url: imageBase,
82+
width: 400,
83+
height: 400,
84+
format: "jpg",
85+
});
86+
87+
assertEquals(result?.toString(), imageWithExplicitFormat);
88+
});
8889
});

0 commit comments

Comments
 (0)