Skip to content

Commit

Permalink
chore: broken build
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 22, 2025
1 parent 1de94c4 commit 3c261e0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 48 deletions.
78 changes: 37 additions & 41 deletions packages/schema-org/src/vue/runtime/composables.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MaybeComputedRefOrFalsy } from '@unhead/vue'
import type { ResolvableProperties } from '@unhead/vue'
import type {
AggregateOffer,
AggregateRating,
Expand Down Expand Up @@ -41,10 +41,6 @@ import type { Arrayable } from '../../types'
import { injectHead, useHead } from '@unhead/vue'
import { UnheadSchemaOrg } from '../../plugin'

export type DeepMaybeRef<T> = {
[key in keyof T]?: MaybeComputedRefOrFalsy<T[key]>
}

function provideResolver<T>(input?: T, resolver?: string) {
if (!input)
input = {} as T
Expand All @@ -54,113 +50,113 @@ function provideResolver<T>(input?: T, resolver?: string) {
return input
}

export function defineAddress<T extends Record<string, any>>(input?: DeepMaybeRef<PostalAddress & T>) {
export function defineAddress<T extends Record<string, any>>(input?: ResolvableProperties<PostalAddress & T>) {
return provideResolver(input, 'address')
}
export function defineAggregateOffer<T extends Record<string, any>>(input?: DeepMaybeRef<AggregateOffer & T>) {
export function defineAggregateOffer<T extends Record<string, any>>(input?: ResolvableProperties<AggregateOffer & T>) {
return provideResolver(input, 'aggregateOffer')
}
export function defineAggregateRating<T extends Record<string, any>>(input?: DeepMaybeRef<AggregateRating & T>) {
export function defineAggregateRating<T extends Record<string, any>>(input?: ResolvableProperties<AggregateRating & T>) {
return provideResolver(input, 'aggregateRating')
}
export function defineArticle<T extends Record<string, any>>(input?: DeepMaybeRef<Article & T>) {
export function defineArticle<T extends Record<string, any>>(input?: ResolvableProperties<Article & T>) {
return provideResolver(input, 'article')
}
export function defineBreadcrumb<T extends Record<string, any>>(input?: DeepMaybeRef<BreadcrumbList & T>) {
export function defineBreadcrumb<T extends Record<string, any>>(input?: ResolvableProperties<BreadcrumbList & T>) {
return provideResolver(input, 'breadcrumb')
}
export function defineComment<T extends Record<string, any>>(input?: DeepMaybeRef<Comment & T>) {
export function defineComment<T extends Record<string, any>>(input?: ResolvableProperties<Comment & T>) {
return provideResolver(input, 'comment')
}
export function defineEvent<T extends Record<string, any>>(input?: DeepMaybeRef<Event & T>) {
export function defineEvent<T extends Record<string, any>>(input?: ResolvableProperties<Event & T>) {
return provideResolver(input, 'event')
}
export function defineFoodEstablishment<T extends Record<string, any>>(input?: DeepMaybeRef<FoodEstablishment & T>) {
export function defineFoodEstablishment<T extends Record<string, any>>(input?: ResolvableProperties<FoodEstablishment & T>) {
return provideResolver(input, 'foodEstablishment')
}
export function defineVirtualLocation<T extends Record<string, any>>(input?: DeepMaybeRef<VirtualLocation & T>) {
export function defineVirtualLocation<T extends Record<string, any>>(input?: ResolvableProperties<VirtualLocation & T>) {
return provideResolver(input, 'virtualLocation')
}
export function definePlace<T extends Record<string, any>>(input?: DeepMaybeRef<Place & T>) {
export function definePlace<T extends Record<string, any>>(input?: ResolvableProperties<Place & T>) {
return provideResolver(input, 'place')
}
export function defineHowTo<T extends Record<string, any>>(input?: DeepMaybeRef<HowTo & T>) {
export function defineHowTo<T extends Record<string, any>>(input?: ResolvableProperties<HowTo & T>) {
return provideResolver(input, 'howTo')
}
export function defineHowToStep<T extends Record<string, any>>(input?: DeepMaybeRef<HowToStep & T>) {
export function defineHowToStep<T extends Record<string, any>>(input?: ResolvableProperties<HowToStep & T>) {
return provideResolver(input, 'howToStep')
}
export function defineImage<T extends Record<string, any>>(input?: DeepMaybeRef<ImageObject & T>) {
export function defineImage<T extends Record<string, any>>(input?: ResolvableProperties<ImageObject & T>) {
return provideResolver(input, 'image')
}
export function defineJobPosting<T extends Record<string, any>>(input?: DeepMaybeRef<JobPosting & T>) {
export function defineJobPosting<T extends Record<string, any>>(input?: ResolvableProperties<JobPosting & T>) {
return provideResolver(input, 'jobPosting')
}
export function defineLocalBusiness<T extends Record<string, any>>(input?: DeepMaybeRef<LocalBusiness & T>) {
export function defineLocalBusiness<T extends Record<string, any>>(input?: ResolvableProperties<LocalBusiness & T>) {
return provideResolver(input, 'localBusiness')
}
export function defineOffer<T extends Record<string, any>>(input?: DeepMaybeRef<Offer & T>) {
export function defineOffer<T extends Record<string, any>>(input?: ResolvableProperties<Offer & T>) {
return provideResolver(input, 'offer')
}
export function defineOpeningHours<T extends Record<string, any>>(input?: DeepMaybeRef<OpeningHoursSpecification & T>) {
export function defineOpeningHours<T extends Record<string, any>>(input?: ResolvableProperties<OpeningHoursSpecification & T>) {
return provideResolver(input, 'openingHours')
}
export function defineOrganization<T extends Record<string, any>>(input?: DeepMaybeRef<Organization & T>) {
export function defineOrganization<T extends Record<string, any>>(input?: ResolvableProperties<Organization & T>) {
return provideResolver(input, 'organization')
}
export function definePerson<T extends Record<string, any>>(input?: DeepMaybeRef<Person & T>) {
export function definePerson<T extends Record<string, any>>(input?: ResolvableProperties<Person & T>) {
return provideResolver(input, 'person')
}
export function defineProduct<T extends Record<string, any>>(input?: DeepMaybeRef<Product & T>) {
export function defineProduct<T extends Record<string, any>>(input?: ResolvableProperties<Product & T>) {
return provideResolver(input, 'product')
}
export function defineQuestion<T extends Record<string, any>>(input?: DeepMaybeRef<Question & T>) {
export function defineQuestion<T extends Record<string, any>>(input?: ResolvableProperties<Question & T>) {
return provideResolver(input, 'question')
}
export function defineRecipe<T extends Record<string, any>>(input?: DeepMaybeRef<Recipe & T>) {
export function defineRecipe<T extends Record<string, any>>(input?: ResolvableProperties<Recipe & T>) {
return provideResolver(input, 'recipe')
}
export function defineReview<T extends Record<string, any>>(input?: DeepMaybeRef<Review & T>) {
export function defineReview<T extends Record<string, any>>(input?: ResolvableProperties<Review & T>) {
return provideResolver(input, 'review')
}
export function defineVideo<T extends Record<string, any>>(input?: DeepMaybeRef<VideoObject & T>) {
export function defineVideo<T extends Record<string, any>>(input?: ResolvableProperties<VideoObject & T>) {
return provideResolver(input, 'video')
}
export function defineWebPage<T extends Record<string, any>>(input?: DeepMaybeRef<WebPage & T>) {
export function defineWebPage<T extends Record<string, any>>(input?: ResolvableProperties<WebPage & T>) {
return provideResolver(input, 'webPage')
}
export function defineWebSite<T extends Record<string, any>>(input?: DeepMaybeRef<WebSite & T>) {
export function defineWebSite<T extends Record<string, any>>(input?: ResolvableProperties<WebSite & T>) {
return provideResolver(input, 'webSite')
}
export function defineBook<T extends Record<string, any>>(input?: DeepMaybeRef<Book & T>) {
export function defineBook<T extends Record<string, any>>(input?: ResolvableProperties<Book & T>) {
return provideResolver(input, 'book')
}
export function defineCourse<T extends Record<string, any>>(input?: DeepMaybeRef<Course & T>) {
export function defineCourse<T extends Record<string, any>>(input?: ResolvableProperties<Course & T>) {
return provideResolver(input, 'course')
}
export function defineItemList<T extends Record<string, any>>(input?: DeepMaybeRef<ItemList & T>) {
export function defineItemList<T extends Record<string, any>>(input?: ResolvableProperties<ItemList & T>) {
return provideResolver(input, 'itemList')
}
export function defineListItem<T extends Record<string, any>>(input?: DeepMaybeRef<ListItem & T>) {
export function defineListItem<T extends Record<string, any>>(input?: ResolvableProperties<ListItem & T>) {
return provideResolver(input, 'listItem')
}
export function defineMovie<T extends Record<string, any>>(input?: DeepMaybeRef<Movie & T>) {
export function defineMovie<T extends Record<string, any>>(input?: ResolvableProperties<Movie & T>) {
return provideResolver(input, 'movie')
}
export function defineSearchAction<T extends Record<string, any>>(input?: DeepMaybeRef<SearchAction & T>) {
export function defineSearchAction<T extends Record<string, any>>(input?: ResolvableProperties<SearchAction & T>) {
return provideResolver(input, 'searchAction')
}
export function defineReadAction<T extends Record<string, any>>(input?: DeepMaybeRef<ReadAction & T>) {
export function defineReadAction<T extends Record<string, any>>(input?: ResolvableProperties<ReadAction & T>) {
return provideResolver(input, 'readAction')
}
export function defineSoftwareApp<T extends Record<string, any>>(input?: DeepMaybeRef<SoftwareApp & T>) {
export function defineSoftwareApp<T extends Record<string, any>>(input?: ResolvableProperties<SoftwareApp & T>) {
return provideResolver(input, 'softwareApp')
}
export function defineBookEdition<T extends Record<string, any>>(input?: DeepMaybeRef<BookEdition & T>) {
export function defineBookEdition<T extends Record<string, any>>(input?: ResolvableProperties<BookEdition & T>) {
return provideResolver(input, 'bookEdition')
}

export type UseSchemaOrgInput = Arrayable<DeepMaybeRef<Thing | Record<string, any>>>
export type UseSchemaOrgInput = Arrayable<ResolvableProperties<Thing | Record<string, any>>>

export function useSchemaOrg(input: UseSchemaOrgInput) {
// lazy initialise the plugin
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ export interface ResolvedHead<E extends MergeHead = ResolvedSchemaAugmentations>

export type UseSeoMetaInput = MetaFlatInput & { title?: Title, titleTemplate?: TitleTemplate }

export type { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead'
export type { BodyEvents, DataKeys, DefinedValueOrEmptyObject, HttpEventAttributes, LinkBase, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead'
2 changes: 1 addition & 1 deletion packages/scripts/test/unit/warmup.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LinkBase } from 'zhead'
import type { LinkBase } from '@unhead/schema'
import { createHead as createServerHead } from 'unhead/server'
import { describe, it } from 'vitest'
import { useScript } from '../../src/useScript'
Expand Down
3 changes: 1 addition & 2 deletions packages/vue/src/composables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {
Ref,
} from 'vue'
import type {
ReactiveHead,
UseHeadInput,
UseHeadOptions,
UseHeadSafeInput,
Expand Down Expand Up @@ -45,7 +44,7 @@ export function useHead<T extends MergeHead>(input: UseHeadInput<T>, options: Us
function clientUseHead<T extends MergeHead>(head: VueHeadClient<T>, input: UseHeadInput<T>, options: HeadEntryOptions = {}): ActiveHeadEntry<UseHeadInput<T>> {
const deactivated = ref(false)

const resolvedInput: Ref<ReactiveHead> = ref({})
const resolvedInput: Ref<UseHeadInput<T>> = ref({})
watchEffect(() => {
resolvedInput.value = deactivated.value
? {}
Expand Down
3 changes: 1 addition & 2 deletions packages/vue/src/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {
Ref,
} from 'vue'
import type {
ReactiveHead,
UseHeadInput,
UseHeadOptions,
UseHeadSafeInput,
Expand Down Expand Up @@ -80,7 +79,7 @@ export function useHead<T extends MergeHead>(input: UseHeadInput<T>, options: Us
function clientUseHead<T extends MergeHead>(head: VueHeadClient<T>, input: UseHeadInput<T>, options: HeadEntryOptions = {}): ActiveHeadEntry<UseHeadInput<T>> | void {
const deactivated = ref(false)

const resolvedInput: Ref<ReactiveHead> = ref({})
const resolvedInput: Ref<UseHeadInput<T>> = ref({})
watchEffect(() => {
resolvedInput.value = deactivated.value
? {}
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import type {
EntryAugmentation,
Falsey,
HeadEntryOptions,
HttpEventAttributes,
LinkBase,
MaybeArray,
MaybeEventFnHandlers,
MaybeFunction,
MergeHead,
MetaFlatInput,
ResolvableValues,
SchemaAugmentations,
ScriptBase,
Unhead,
} from '@unhead/schema'
import type { Plugin, Ref } from 'vue'
import type { HttpEventAttributes, LinkBase, ScriptBase } from 'zhead'
import type { MaybeComputedRef, ResolvableArray, ResolvableProperties } from './util'

export interface HtmlAttr extends Omit<BaseHtmlAttr, 'class'> {
Expand Down

0 comments on commit 3c261e0

Please sign in to comment.