Skip to content

Commit e77fa27

Browse files
Upgraded dependencies
1 parent 14c9882 commit e77fa27

File tree

9 files changed

+619
-160
lines changed

9 files changed

+619
-160
lines changed

.changeset/odd-grapes-thank.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'astro-m2dx': patch
3+
'astro-m2dx-image': patch
4+
'm2dx-utils': patch
5+
'mintest-green': patch
6+
---
7+
8+
Upgraded dependencies

apps/astro-m2dx/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"preview": "astro preview"
1212
},
1313
"dependencies": {
14-
"@astrojs/image": "^0.11.6",
15-
"@astrojs/mdx": "^0.11.6",
16-
"@astrojs/tailwind": "^2.1.2",
14+
"@astrojs/image": "^0.12.0",
15+
"@astrojs/mdx": "^0.12.0",
16+
"@astrojs/tailwind": "^2.1.3",
1717
"@tailwindcss/typography": "^0.5.8",
18-
"astro": "^1.6.10",
18+
"astro": "^1.6.12",
1919
"astro-icon": "^0.8.0",
2020
"astro-m2dx": "workspace:*",
2121
"astro-m2dx-image": "workspace:*",

apps/astro-m2dx/src/components/GalleryImage/index.astro

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
import { isImageMetadata, parseAspectRatio, Picture, PictureProps } from 'astro-m2dx-image';
2+
import { CallbackProps, parseAspectRatio, Picture, PictureProps } from 'astro-m2dx-image';
33
44
const props = Astro.props as PictureProps;
55
6-
function callback(props: PictureProps) {
7-
const aspetRatioBound = 1.2;
6+
function callback(props: CallbackProps) {
7+
const aspetRatioBound = 4 / 3;
88
props.aspectRatio = parseAspectRatio(props.aspectRatio);
99
if (!props.aspectRatio) {
1010
if (props.width && props.height) {
1111
props.aspectRatio = props.width / props.height;
12-
} else if (isImageMetadata(props.src)) {
13-
props.aspectRatio = props.src.width / (props.src.height ?? 1);
12+
} else if (props.src.width && props.src.height) {
13+
props.aspectRatio = props.src.width / props.src.height;
1414
}
1515
}
1616
if (props.aspectRatio) {

packages/astro-m2dx-image/lib/types.ts

+21-17
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,38 @@ import type { ImgHTMLAttributes } from '@astrojs/image/components';
22
import type { OutputFormat, TransformOptions } from '@astrojs/image/dist/loaders';
33
import type { ImageMetadata } from '@astrojs/image/dist/vite-plugin-astro-image';
44

5-
type AspectRatio = TransformOptions['aspectRatio'];
5+
export type { ImageMetadata };
66

7-
interface ImageProps
7+
export type AspectRatio = TransformOptions['aspectRatio'];
8+
export type Background = TransformOptions['background'];
9+
export type Decoding = HTMLImageElement['decoding'];
10+
export type Fit = TransformOptions['fit'];
11+
export type Format = TransformOptions['format'];
12+
export type Loading = HTMLImageElement['loading'];
13+
export type Position = TransformOptions['position'];
14+
15+
export interface ImageProps
816
extends Omit<TransformOptions, 'src'>,
917
Omit<ImgHTMLAttributes, 'slot' | 'alt' | 'src' | 'width' | 'height'> {
1018
/** Defines an alternative text description of the image. Set to an empty string (alt="") if the image is not a key part of the content (it's decoration or a tracking pixel). */
1119
alt: string;
1220
src: string | ImageMetadata | Promise<{ default: ImageMetadata }>;
1321
}
1422

15-
interface BasePictureProps extends Omit<ImageProps, 'format'> {
23+
/**
24+
* The Picture environment tries to resolve the src and calls a user callback,
25+
* allowing to transform the props, before optimizing the image according to
26+
* the transformed properties.
27+
*/
28+
export interface PictureProps extends Omit<ImageProps, 'format'> {
1629
widths?: number[];
1730
formats?: OutputFormat[];
31+
callback?: (props: CallbackProps) => void | Promise<void>;
1832
}
1933

20-
interface CallbackProps extends Omit<BasePictureProps, 'src'> {
34+
/**
35+
* We guarantee, that src is resolved before any callback is called.
36+
*/
37+
export interface CallbackProps extends Omit<PictureProps, 'src' | 'callback'> {
2138
src: ImageMetadata;
2239
}
23-
24-
interface PictureProps extends BasePictureProps {
25-
callback?: (props: CallbackProps) => void | Promise<void>;
26-
}
27-
28-
export type {
29-
//
30-
AspectRatio,
31-
CallbackProps,
32-
ImageMetadata,
33-
ImageProps,
34-
PictureProps,
35-
};

packages/astro-m2dx-image/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
},
3030
"peerDependencies": {
31-
"@astrojs/image": "^0.11.6",
31+
"@astrojs/image": ">=0.11.6",
3232
"astro": "^1.6.10"
3333
},
3434
"devDependencies": {

packages/astro-m2dx/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"build": "tsup src/index.ts --format esm --dts",
3232
"clean": "rimraf -rf ./dist/",
3333
"test": "mintest",
34-
"test:dev": "tsx watch src/mergeFrontmatter/index.spec.ts",
34+
"test:dev": "tsx watch src/styleDirectives/index.spec.ts",
3535
"test:watch": "tsx watch node_modules/mintest-green/dist/bin.js"
3636
},
3737
"dependencies": {
@@ -50,10 +50,10 @@
5050
"@types/estree": "^1.0.0",
5151
"@types/js-yaml": "^4.0.5",
5252
"@types/mdast": "^3.0.10",
53-
"@types/node": "^18.11.9",
53+
"@types/node": "^18.11.10",
5454
"@types/unist": "2.0.6",
55-
"concurrently": "^7.5.0",
56-
"esbuild": "^0.15.13",
55+
"concurrently": "^7.6.0",
56+
"esbuild": "^0.15.16",
5757
"esbuild-node-externals": "^1.5.0",
5858
"eslint-config-base": "workspace:*",
5959
"hast-util-to-html": "^8.0.3",
@@ -62,10 +62,10 @@
6262
"rehype-format": "^4.0.1",
6363
"rimraf": "^3.0.2",
6464
"tsconfig": "workspace:*",
65-
"tsup": "^6.4.0",
66-
"tsx": "^3.11.0",
67-
"typescript": "^4.8.4",
65+
"tsup": "^6.5.0",
66+
"tsx": "^3.12.1",
67+
"typescript": "^4.9.3",
6868
"unified": "^10.1.2",
69-
"vfile": "^5.3.5"
69+
"vfile": "^5.3.6"
7070
}
7171
}

packages/m2dx-utils/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"@types/estree": "^1.0.0",
4949
"@types/hast": "^2.3.4",
5050
"@types/mdast": "^3.0.10",
51-
"@types/node": "^18.11.9",
51+
"@types/node": "^18.11.10",
5252
"@types/unist": "2.0.6",
53-
"concurrently": "^7.5.0",
54-
"esbuild": "^0.15.14",
53+
"concurrently": "^7.6.0",
54+
"esbuild": "^0.15.16",
5555
"esbuild-node-externals": "^1.5.0",
5656
"mintest-green": "workspace:*",
5757
"rimraf": "^3.0.2",

packages/mintest-green/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"devDependencies": {
4343
"@internal/utils": "workspace:*",
4444
"@types/glob": "^8.0.0",
45-
"@types/node": "^18.11.9",
45+
"@types/node": "^18.11.10",
4646
"rimraf": "^3.0.2",
4747
"tsconfig": "workspace:*",
48-
"tsup": "^6.4.0",
49-
"tsx": "^3.11.0"
48+
"tsup": "^6.5.0",
49+
"tsx": "^3.12.1"
5050
}
5151
}

0 commit comments

Comments
 (0)