Skip to content

Commit

Permalink
use crypto.randomUUID() (#5042)
Browse files Browse the repository at this point in the history
* use crypto.randomUUID() instead of @lukeed/uuid - closes #4929

* changeset
  • Loading branch information
Rich-Harris committed May 23, 2022
1 parent ceef881 commit d5cf5e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-islands-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Use crypto.randomUUID() instead of @lukeed/uuid
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"type": "module",
"dependencies": {
"@fontsource/fira-mono": "^4.5.0",
"@lukeed/uuid": "^2.0.0",
"cookie": "^0.4.1"
}
}
3 changes: 1 addition & 2 deletions packages/create-svelte/templates/default/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { v4 as uuid } from '@lukeed/uuid';
import type { Handle } from '@sveltejs/kit';
import * as cookie from 'cookie';

/** @type {import('@sveltejs/kit').Handle} */
export const handle: Handle = async ({ event, resolve }) => {
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
event.locals.userid = cookies['userid'] || uuid();
event.locals.userid = cookies['userid'] || crypto.randomUUID();

const response = await resolve(event);

Expand Down

0 comments on commit d5cf5e0

Please sign in to comment.