Skip to content

Commit 72ecb3e

Browse files
committed
fix(core): prefer vue-demi to resolve monorepo hoisting issues
1 parent 2f36356 commit 72ecb3e

File tree

13 files changed

+20
-26
lines changed

13 files changed

+20
-26
lines changed

packages/schema-org/components/SchemaOrgInspector/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, h, ref, watch } from 'vue'
1+
import { defineComponent, h, ref, watch } from 'vue-demi'
22
import { injectSchemaOrg } from '../../useSchemaOrg'
33
import type { SchemaOrgClient } from '../../types'
44

packages/schema-org/components/defineSchemaOrgComponent.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { computed, defineComponent, h, ref, unref } from 'vue'
2-
import type { Ref, VNode } from 'vue'
3-
import type { SchemaNode, SchemaOrgClient } from '../types'
4-
import { injectSchemaOrg, useSchemaOrg } from '../useSchemaOrg'
1+
import { computed, defineComponent, h, ref, unref } from 'vue-demi'
2+
import type { Ref, VNode } from 'vue-demi'
3+
import type { SchemaNode } from '../types'
4+
import { useSchemaOrg } from '../useSchemaOrg'
55
import { shallowVNodesToText } from '../utils'
66

77
export interface SchemaOrgComponentProps {
@@ -26,20 +26,14 @@ const ignoreKey = (s: string) => {
2626
return ['class', 'style'].includes(s)
2727
}
2828

29-
export const defineSchemaOrgComponent = (name: string, defineFn: (data: any) => any) => {
29+
export const defineSchemaOrgComponent = (name: string, defineFn?: (data: any) => any) => {
3030
return defineComponent<SchemaOrgComponentProps>({
3131
name,
3232
props: {
3333
as: String,
3434
renderScopedSlots: Boolean,
3535
} as unknown as any,
3636
setup(props, { slots, attrs }) {
37-
let schemaApi: SchemaOrgClient | null = null
38-
try {
39-
schemaApi = injectSchemaOrg()
40-
}
41-
catch (e) {}
42-
4337
const node: Ref<SchemaNode | null> = ref(null)
4438

4539
const nodePartial = computed(() => {

packages/schema-org/createSchemaOrg/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'vitest'
2-
import { getCurrentInstance } from 'vue'
2+
import { getCurrentInstance } from 'vue-demi'
33
import type { WebPage } from '../nodes/WebPage'
44
import { PrimaryWebPageId, defineWebPage, defineWebPagePartial } from '../nodes/WebPage'
55
import { createMockClient, useSetup } from '../../.test'

packages/schema-org/createSchemaOrg/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { InjectionKey } from 'vue'
1+
import type { InjectionKey } from 'vue-demi'
22
import { joinURL, withProtocol, withTrailingSlash } from 'ufo'
33
import { defu } from 'defu'
44
import { hash } from 'ohash'
5-
import { getCurrentInstance, onMounted, reactive, readonly, ref, unref, watchEffect } from 'vue'
5+
import { getCurrentInstance, onMounted, reactive, readonly, ref, unref, watchEffect } from 'vue-demi'
66
import type {
77
ConsolaFn,
88
CreateSchemaOrgInput,

packages/schema-org/nodes/Article/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'vitest'
2-
import { reactive } from 'vue'
2+
import { reactive } from 'vue-demi'
33
import { mockCreateSchemaOptions, mockRoute, useSetup } from '../../../.test'
44
import { injectSchemaOrg, useSchemaOrg } from '../../useSchemaOrg'
55
import type { WebPage } from '../WebPage'

packages/schema-org/nodes/WebPage/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'vitest'
2-
import { computed, unref } from 'vue'
2+
import { computed, unref } from 'vue-demi'
33
import { defineOrganization } from '@vueuse/schema-org'
44
import { mockRoute, useSetup } from '../../../.test'
55
import { injectSchemaOrg, useSchemaOrg } from '../../useSchemaOrg'

packages/schema-org/providers/useVueUseHead.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, watchEffect } from 'vue'
1+
import { computed, watchEffect } from 'vue-demi'
22
import type { HeadClient } from '@vueuse/head'
33
import { injectHead } from '@vueuse/head'
44

packages/schema-org/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { DeepPartial, Optional } from 'utility-types'
22
import type { RouteLocationNormalizedLoaded } from 'vue-router'
3-
import type { App, Ref } from 'vue'
3+
import type { App, Ref } from 'vue-demi'
44
import type { ConsolaLogObject } from 'consola'
55
import type { ImageInput } from './nodes/Image'
66

packages/schema-org/useSchemaOrg/client.ts renamed to packages/schema-org/useSchemaOrg/csr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getCurrentInstance, onBeforeUnmount, ref, watch } from 'vue'
1+
import { getCurrentInstance, onBeforeUnmount, ref, watch } from 'vue-demi'
22
import type { Arrayable, Id, SchemaOrgClient, UseSchemaOrgInput } from '../types'
33

44
let _routeChanged = false

packages/schema-org/useSchemaOrg/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { inject } from 'vue'
1+
import { inject } from 'vue-demi'
22
import { PROVIDE_KEY } from '../createSchemaOrg'
33
import type { Arrayable, SchemaOrgClient, UseSchemaOrgInput } from '../types'
44
import { handleNodesSSR } from './ssr'
5-
import { handleNodesCSR } from './client'
5+
import { handleNodesCSR } from './csr'
66

77
export function injectSchemaOrg() {
88
const schemaOrg = inject<SchemaOrgClient>(PROVIDE_KEY)
@@ -31,5 +31,5 @@ export function useSchemaOrg(input: Arrayable<UseSchemaOrgInput>) {
3131
return handleNodesCSR(client, input)
3232
}
3333

34-
export * from './client'
34+
export * from './csr'
3535
export * from './ssr'

0 commit comments

Comments
 (0)