Skip to content

Commit

Permalink
fix: exports common types
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 13, 2021
1 parent d6ff749 commit 9a45b9b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ export * from './useWebWorkerFn'
export * from './useWindowFocus'
export * from './useWindowScroll'
export * from './useWindowSize'
export * from './types'
export * from '@vueuse/shared'
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/core/useDraggable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Ref, ref, unref, computed } from 'vue-demi'
import { MaybeRef, toRefs, isClient } from '@vueuse/shared'
import { useEventListener } from '../useEventListener'
import { MaybeElementRef } from '../unrefElement'
import { PointerType, Position } from '../_types'
import { PointerType, Position } from '../types'
import { defaultWindow } from '../_configurable'

export interface UseDraggableOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/useMouse/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref } from 'vue-demi'
import { useEventListener } from '../useEventListener'
import { ConfigurableWindow, defaultWindow } from '../_configurable'
import { Position } from '../_types'
import { Position } from '../types'

export interface MouseOptions extends ConfigurableWindow {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/usePointer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MaybeRef, objectPick, toRefs } from '@vueuse/shared'
import { ref, Ref } from 'vue-demi'
import { useEventListener } from '../useEventListener'
import { ConfigurableWindow, defaultWindow } from '../_configurable'
import { PointerType, Position } from '../_types'
import { PointerType, Position } from '../types'
import { MaybeElementRef } from '../unrefElement'

export interface UsePointerState extends Position {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/usePointerSwipe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MaybeRef } from '@vueuse/shared'
import { computed, reactive, readonly, Ref, ref } from 'vue-demi'
import { useEventListener } from '../useEventListener'
import { SwipeDirection } from '../useSwipe/index'
import { Position } from '../_types'
import { Position } from '../types'

export interface PointerSwipeOptions {
/**
Expand Down
3 changes: 1 addition & 2 deletions packages/core/useSwipe/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { noop, MaybeRef } from '@vueuse/shared'
import { computed, reactive, ref, ComputedRef, Ref } from 'vue-demi'

import { useEventListener } from '../useEventListener'
import { ConfigurableWindow, defaultWindow } from '../_configurable'
import { Position } from '../_types'
import { Position } from '../types'

export enum SwipeDirection {
UP = 'UP',
Expand Down
20 changes: 10 additions & 10 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ export async function updateImport({ packages, functions }: PackageIndexes) {
if (manualImport)
continue

let content: string
let imports: string[]
if (name === 'components') {
content = functions
imports = functions
.sort((a, b) => a.name.localeCompare(b.name))
.flatMap((fn) => {
const arr = []
Expand All @@ -190,23 +190,23 @@ export async function updateImport({ packages, functions }: PackageIndexes) {
arr.push(`export * from '../${fn.package}/${fn.name}/directive'`)
return arr
})
.join('\n')
}
else {
content = functions
imports = functions
.filter(i => i.package === name)
.map(f => f.name)
.sort()
.map(name => `export * from './${name}'`)
.join('\n')
}

if (name === 'core')
content += '\nexport * from \'@vueuse/shared\''

content += '\n'
if (name === 'core') {
imports.push(
'export * from \'./types\'',
'export * from \'@vueuse/shared\'',
)
}

await fs.writeFile(join(dir, 'index.ts'), content)
await fs.writeFile(join(dir, 'index.ts'), `${imports.join('\n')}\n`)
}
}

Expand Down

0 comments on commit 9a45b9b

Please sign in to comment.