Skip to content

Commit 2d58ca0

Browse files
committed
fix: patch update, generate CldImageProps.svelte.d.ts
1 parent cc425a0 commit 2d58ca0

File tree

8 files changed

+43
-29
lines changed

8 files changed

+43
-29
lines changed

pnpm-lock.yaml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

svelte-cloudinary/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
"svelte-preprocess": "^5.0.3",
5454
"tslib": "^2.4.1",
5555
"typescript": "^5.0.0",
56+
"unpic": "3.6.1",
5657
"vite": "^4.3.0",
5758
"vitest": "^0.25.3"
5859
},
59-
"svelte": "./dist/index.js",
6060
"types": "./dist/index.d.ts",
6161
"type": "module",
6262
"dependencies": {

svelte-cloudinary/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export type { GetCldOgImageUrl } from '$lib/helpers/getCldOgImageUrl.ts';
66

77
export type { CloudinaryVideoPlayer, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsColors, CloudinaryVideoPlayerOptionsLogo } from './types/player.ts';
88

9+
export { default as CldImage } from '$lib/components/CldImage.svelte';

svelte-cloudinary/src/lib/components/CldImage.svelte

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
<script lang="ts" context="module">
2-
// This types still comes wrong
3-
// import type { ImageProps } from '@unpic/svelte'
4-
// But this is the same used by the @unpic/svelte package
5-
import type { UnpicImageProps } from '@unpic/core';
6-
import type { HTMLImgAttributes } from 'svelte/elements';
7-
type ImageProps = UnpicImageProps<HTMLImgAttributes, string | null>;
8-
import type { ImageOptions } from '@cloudinary-util/url-loader';
9-
export type CldImageProps = ImageOptions &
10-
ImageProps & {
11-
layout: ImageProps['layout'];
12-
};
13-
</script>
14-
151
<script lang="ts">
2+
import { CldImageProps } from '../CldImageProps.ts'
3+
// This unused import is a hack to get around a bug in svelte2tsx
4+
import type { UrlTransformer, ImageCdn } from "unpic";
5+
import type { ImageOptions } from '@cloudinary-util/url-loader';
166
import { getTransformations } from '@cloudinary-util/util';
177
import { transformationPlugins } from '@cloudinary-util/url-loader';
188
import { Image } from '@unpic/svelte';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This types still comes wrong
2+
// import type { ImageProps } from '@unpic/svelte'
3+
// But this is the same used by the @unpic/svelte package
4+
import type { UnpicImageProps } from '@unpic/core';
5+
import type { HTMLImgAttributes } from 'svelte/elements';
6+
type ImageProps = UnpicImageProps<HTMLImgAttributes, string | null>;
7+
import type { ImageOptions } from '@cloudinary-util/url-loader';
8+
export type CldImageProps = ImageOptions &
9+
ImageProps & {
10+
layout: ImageProps['layout'];
11+
};

svelte-cloudinary/src/lib/components/CldOgImage.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { getCldImageUrl } from '$lib/helpers/getCldImageUrl.js';
33
import type { ImageOptions } from '@cloudinary-util/url-loader';
4-
import type { CldImageProps } from './CldImage.svelte';
4+
import type { CldImageProps } from './CldImageTypes.ts';
55
import { OG_IMAGE_WIDTH, OG_IMAGE_WIDTH_RESIZE, OG_IMAGE_HEIGHT } from '$lib/constants/sizes.js';
66
77
const TWITTER_CARD = 'summary_large_image';

svelte-cloudinary/src/lib/index.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

svelte-cloudinary/src/lib/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Reexport your entry components here
2+
import CldImage from './components/CldImage.svelte'
3+
export { CldImage }
4+
export type { CldImageProps } from "./types.ts";
5+
6+
import CldOgImage from './components/CldOgImage.svelte'
7+
export { CldOgImage }
8+
9+
import CldUploadWidget from './components/CldUploadWidget.svelte'
10+
export { CldUploadWidget}
11+
12+
import CldUploadButton from './components/CldUploadButton.svelte'
13+
export { CldUploadButton}
14+
15+
export { getCldImageUrl } from '$lib/helpers/getCldImageUrl.ts';
16+
export type { GetCldImageUrl, GetCldImageUrlOptions, GetCldImageUrlConfig, GetCldImageUrlAnalytics } from '$lib/helpers/getCldImageUrl.ts';
17+
18+
export { getCldOgImageUrl } from '$lib/helpers/getCldOgImageUrl.ts';
19+
export type { GetCldOgImageUrl } from '$lib/helpers/getCldOgImageUrl.ts';
20+
21+
export type { CloudinaryVideoPlayer, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsColors, CloudinaryVideoPlayerOptionsLogo } from './types/player.ts';
22+

0 commit comments

Comments
 (0)