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

chore(deps): update all non-major dependencies #121

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE=node:20.14.0-alpine
ARG NODE=node:20.15.1-alpine

FROM $NODE as build

Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.21.1",
"@antfu/eslint-config": "^2.22.0",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@hywax/vitepress-yandex-metrika": "^0.4.0",
"@nuxt/devtools": "latest",
"@nuxtjs/color-mode": "^3.4.1",
"@nuxtjs/color-mode": "^3.4.2",
"@nuxtjs/i18n": "^8.3.1",
"@nuxtjs/tailwindcss": "^6.12.0",
"@types/node": "^20.14.2",
"@vite-pwa/nuxt": "^0.8.0",
"@nuxtjs/tailwindcss": "^6.12.1",
"@types/node": "^20.14.10",
"@vite-pwa/nuxt": "^0.9.1",
"changelogen": "^0.5.5",
"eslint": "^9.5.0",
"eslint": "^9.6.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"nuxt": "^3.12.2",
"nuxt": "^3.12.3",
"nuxt-icon": "^0.6.10",
"typescript": "^5.4.5",
"vitepress": "^1.2.3",
"vue-tsc": "^2.0.21"
"typescript": "^5.5.3",
"vitepress": "^1.3.0",
"vue-tsc": "^2.0.26"
},
"resolutions": {
"rollup": "npm:@rollup/wasm-node"
},
"lint-staged": {
"*.ts": "yarn run lint"
}
}
}
10 changes: 6 additions & 4 deletions src/composables/useWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export type WsClientReturn = Pick<UseWebSocketReturn<string>, 'open' | 'close' |
off: SendHook
send: ReceiveHook
}
export type SendHook = <E extends SendMessage['event']>(event: E, handler: (data: Omit<SendMessageMap[E], 'event'>) => any) => void
type SendHandler = <E extends SendMessage['event']>(data: Omit<SendMessageMap[E], 'event'>) => any

export type SendHook = <E extends SendMessage['event']>(event: E, handler: SendHandler) => void
export type ReceiveHook = <E extends ReceivedMessage['event']>(event: E, handler: (data: Omit<ReceivedMessageMap[E], 'event'>) => any) => void

function createEventMessage<E extends SendMessage['event'] | ReceivedMessage['event']>(event: E, data: Record<string, any> = {}): string {
Expand All @@ -17,7 +19,7 @@ export function wsClient(): WsClientReturn {
const url = useRequestURL()
const isSecure = url.protocol === 'https:'
const endpoint = `${(isSecure ? 'wss://' : 'ws://') + url.host}/api/websocket`
const sendHandlers = new Map<SendMessage['event'], Set<Function>>()
const sendHandlers = new Map<SendMessage['event'], Set<SendHandler>>()
const { status, open, close, send: _send } = useWebSocket(endpoint, {
heartbeat: {
message: createEventMessage('ping'),
Expand All @@ -33,13 +35,13 @@ export function wsClient(): WsClientReturn {
},
})

const off: SendHook = (event, handler) => {
const off: SendHook = (event, handler: SendHandler) => {
if (sendHandlers.has(event)) {
sendHandlers.get(event)?.delete(handler)
}
}

const on: SendHook = (event, handler) => {
const on: SendHook = (event, handler: SendHandler) => {
if (!sendHandlers.has(event)) {
sendHandlers.set(event, new Set())
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export function isUrl(ur: string) {
const _url = new URL(ur)
return true
} catch (_) {
return false
console.error('Invalid URL:', _)
}

return false
}
Loading
Loading