Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to svelte-4 and SvelteKit-2 #80

Closed
wants to merge 14 commits into from
11 changes: 6 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
"@tailwindcss/typography": "^0.5.9",
"@typescript-eslint/eslint-plugin": "^5.60.0",
Expand All @@ -36,14 +37,14 @@
"tailwindcss": "^3.3.1",
"tslib": "^2.5.3",
"typescript": "^5.1.3",
"vite": "^4.3.9"
"vite": "^5.0.0"
},
"type": "module",
"dependencies": {
"@iconify/svelte": "3.1.4",
"@microflash/rehype-toc": "1.0.2",
"@sentry/sveltekit": "7.64.0",
"@sveltejs/adapter-vercel": "3.0.2",
"@sveltejs/adapter-vercel": "^4.0.0",
"@vercel/analytics": "1.0.1",
"cloudinary": "^1.32.0",
"flowbite-svelte": "0.44.20",
Expand All @@ -54,4 +55,4 @@
"svelte-typeahead": "4.4.1",
"theme-change": "2.5.0"
}
}
}
6 changes: 3 additions & 3 deletions docs/src/docs/components/clduploadbutton/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ order: 3
<script>
import Callout from '$lib/components/Callout.svelte'
import { CldUploadButton } from 'svelte-cloudinary'
import { env } from '$env/dynamic/public';
import { PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET, PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET } from '$env/static/public';
let info
let infoSecure
</script>
Expand All @@ -26,7 +26,7 @@ class="cldbutton"
info = result?.info;
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
/>

<p><strong>URL:</strong> { info?.secure_url || 'Upload to see example result.' }</p>
Expand All @@ -51,7 +51,7 @@ class="cldbutton"
infoSecure = result?.info;
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET}
/>

<p><strong>URL:</strong> { infoSecure?.secure_url || 'Upload to see example result.' }</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docs/components/clduploadbutton/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 1
<script>
import Callout from '$lib/components/Callout.svelte'
import { CldUploadButton } from 'svelte-cloudinary'
import { env } from '$env/dynamic/public';
import { PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET } from '$env/static/public';
let info
</script>

Expand All @@ -33,7 +33,7 @@ class="cldbutton"
info = result?.info
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
/>
<p>URL: { info?.secure_url }</p>

Expand Down
8 changes: 4 additions & 4 deletions docs/src/docs/components/clduploadwidget/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 3
import Callout from '$lib/components/Callout.svelte'
import { CldUploadWidget } from 'svelte-cloudinary'
import ImageGrid from '$lib/components/ImageGrid.svelte';
import { env } from '$env/dynamic/public';
import { PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET, PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET } from '$env/static/public';
let info
let infoSecure
let infoSecure2
Expand All @@ -24,7 +24,7 @@ order: 3
info = result?.info
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
>
<button on:click|preventDefault={open} class="cldbutton">
Unsigned Upload
Expand All @@ -39,7 +39,7 @@ uploadPreset="svelte-cloudinary-unsigned"
```
<li>

<CldUploadWidget uploadPreset={env.PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading
<CldUploadWidget uploadPreset={PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading
signatureEndpoint="/api/sign-cloudinary-params"
onUpload={(result, widget) => {
infoSecure = result?.info
Expand All @@ -57,7 +57,7 @@ signatureEndpoint="/api/sign-cloudinary-params"
```
</li>
<li>
<CldUploadWidget uploadPreset={env.PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading options={{sources: ['local']}}
<CldUploadWidget uploadPreset={PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading options={{sources: ['local']}}
signatureEndpoint="/api/sign-cloudinary-params"
onUpload={(result, widget) => {
infoSecure2 = result?.info
Expand Down
10 changes: 5 additions & 5 deletions docs/src/docs/components/clduploadwidget/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 1
<script>
import Callout from '$lib/components/Callout.svelte'
import { CldUploadWidget } from 'svelte-cloudinary'
import { env } from '$env/dynamic/public';
import { PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET, PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET } from '$env/static/public';
import Video from '$lib/components/Video.svelte'
let infoUpload
let infoUploadSecure
Expand Down Expand Up @@ -57,7 +57,7 @@ Use the following to generate an unsigned upload widget:
infoUpload = result?.info
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
>
<button on:click|preventDefault={open} class="cldbutton">
Unsigned Upload
Expand Down Expand Up @@ -94,7 +94,7 @@ Here's an example of how you could process the signature in an API endpoint that
```ts
import { v2 as cloudinary } from "cloudinary";
import type { RequestHandler } from './$types';
import { env } from '$env/dynamic/private';
import { CLOUDINARY_API_SECRET } from '$env/static/private';
import { error, json } from "@sveltejs/kit";

export const POST = (async ({ request }) => {
Expand All @@ -104,7 +104,7 @@ export const POST = (async ({ request }) => {
try {
const signature = cloudinary.utils.api_sign_request(
paramsToSign,
env.CLOUDINARY_API_SECRET
CLOUDINARY_API_SECRET
);
return json({ signature })
} catch (e) {
Expand All @@ -118,7 +118,7 @@ To use the above, create a Node-based API route, add the snippet, and use that e
See a full example of an API endpoint used with the Svelte Cloudinary docs: https://github.com/cloudinary-community/svelte-cloudinary/blob/main/docs/src/routes/api/sign-cloudinary-params/+server.ts

<div class="mt-6">
<CldUploadWidget uploadPreset={env.PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading
<CldUploadWidget uploadPreset={PUBLIC_CLOUDINARY_SIGNED_UPLOAD_PRESET} let:open let:isLoading
signatureEndpoint="/api/sign-cloudinary-params"
onUpload={(result, widget) => {
infoUploadSecure = result?.info
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docs/guides/uploading-images-and-videos.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 9

import Callout from '$lib/components/Callout.svelte'
import { CldUploadButton, CldImage } from 'svelte-cloudinary'
import { env } from '$env/dynamic/public';
import { PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET } from '$env/static/public';

let resource

Expand All @@ -26,7 +26,7 @@ class="cldbutton"
resource = result?.info;
widget.close();
}}
uploadPreset={env.PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
uploadPreset={PUBLIC_CLOUDINARY_UNSIGNED_UPLOAD_PRESET}
/>
{#if resource?.resource_type === 'image'}
<CldImage width={resource.width} height={resource.height} src={resource?.public_id} alt="Uploaded Asset" />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/routes/api/sign-cloudinary-params/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const POST = (async ({ request }) => {
return json({ signature })
} catch (e) {
console.error(e)
throw error(500, (e as Error).message)
error(500, (e as Error).message);
}
}) satisfies RequestHandler;

2 changes: 1 addition & 1 deletion docs/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mdsvex } from 'mdsvex';
import mdsvexConfig from './mdsvex.config.js';
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/kit/vite';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { sass } from 'svelte-preprocess-sass';

/** @type {import('@sveltejs/kit').Config} */
Expand Down
Loading
Loading