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 dependency ohash to v2 (v3) #3362

Open
wants to merge 4 commits into
base: v3
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions docs/app/components/content/HighlightInlineType.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { murmurHash } from 'ohash'
import { hash } from 'ohash'

const props = defineProps<{
type: string
Expand All @@ -23,7 +23,7 @@ const type = computed(() => {
return type
})

const { data: ast } = await useAsyncData(`hightlight-inline-code-${murmurHash(type.value)}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
const { data: ast } = await useAsyncData(`hightlight-inline-code-${hash(type.value).slice(0, 10)}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"knitwork": "^1.2.0",
"magic-string": "^0.30.17",
"mlly": "^1.7.4",
"ohash": "^1.1.4",
"ohash": "^2.0.7",
"pathe": "^2.0.3",
"reka-ui": "^2.0.2",
"scule": "^1.3.0",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/runtime/components/InputMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface InputMenuSlots<T, M extends boolean> {
import { computed, ref, toRef, onMounted, toRaw } from 'vue'
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from 'reka-ui'
import { defu } from 'defu'
import { isEqual } from 'ohash'
import { isEqual } from 'ohash/utils'
import { reactivePick, createReusableTemplate } from '@vueuse/core'
import { useAppConfig } from '#imports'
import { useButtonGroup } from '../composables/useButtonGroup'
Expand Down
12 changes: 8 additions & 4 deletions src/runtime/components/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface LinkSlots {

<script setup lang="ts">
import { computed } from 'vue'
import { isEqual, diff } from 'ohash'
import { isEqual, diff } from 'ohash/utils'
import { useForwardProps } from 'reka-ui'
import { reactiveOmit } from '@vueuse/core'
import { useRoute } from '#imports'
Expand Down Expand Up @@ -124,11 +124,15 @@ const ui = computed(() => tv({
function isPartiallyEqual(item1: any, item2: any) {
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
if (q.type === 'added') {
filtered.push(q.key)
filtered.add(q.key)
}
return filtered
}, [] as string[])
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
}, new Set<string>())

const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)))
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)))

return isEqual(item1Filtered, item2Filtered)
}

function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEqual } from 'ohash'
import { isEqual } from 'ohash/utils'

export function pick<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Pick<Data, Keys> {
const result = {} as Pick<Data, Keys>
Expand Down
12 changes: 8 additions & 4 deletions src/runtime/vue/components/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface LinkSlots {

<script setup lang="ts">
import { computed, getCurrentInstance } from 'vue'
import { isEqual, diff } from 'ohash'
import { isEqual, diff } from 'ohash/utils'
import { useForwardProps } from 'reka-ui'
import { reactiveOmit } from '@vueuse/core'
import { hasProtocol } from 'ufo'
Expand Down Expand Up @@ -140,11 +140,15 @@ const ui = computed(() => tv({
function isPartiallyEqual(item1: any, item2: any) {
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
if (q.type === 'added') {
filtered.push(q.key)
filtered.add(q.key)
}
return filtered
}, [] as string[])
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
}, new Set<string>())

const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)))
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)))

return isEqual(item1Filtered, item2Filtered)
}

const isExternal = computed(() => {
Expand Down
Loading