// re-export everything from core
// h, Component, reactivity API, nextTick, flags & types
export * from '@vue/runtime-core'
+
+export * from './jsx'
? E[K]
: (payload: E[K]) => void
}
+
+import { VNodeRef } from '@vue/runtime-core'
+
+export type ReservedProps = {
+ key?: string | number | symbol
+ ref?: VNodeRef
+ ref_for?: boolean
+ ref_key?: string
+}
+
+export type NativeElements = {
+ [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] &
+ ReservedProps
+}
-import { VNode, VNodeRef } from '@vue/runtime-dom'
-import { IntrinsicElementAttributes } from './dom'
-
-export type ReservedProps = {
- key?: string | number | symbol
- ref?: VNodeRef
- ref_for?: boolean
- ref_key?: string
-}
-
-export type NativeElements = {
- [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] &
- ReservedProps
-}
+import type {
+ VNode,
+ IntrinsicElementAttributes,
+ ReservedProps,
+ NativeElements
+} from '@vue/runtime-dom'
/**
* JSX namespace for usage with @jsxImportsSource directive
// global JSX namespace registration
// somehow we have to copy=pase the jsx-runtime types here to make TypeScript happy
-import { VNode, VNodeRef } from '@vue/runtime-dom'
-import { IntrinsicElementAttributes } from './jsx-runtime/dom'
-
-export * from './jsx-runtime/dom'
-
-export type ReservedProps = {
- key?: string | number | symbol
- ref?: VNodeRef
- ref_for?: boolean
- ref_key?: string
-}
-
-export type NativeElements = {
- [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] &
- ReservedProps
-}
+import type {
+ VNode,
+ IntrinsicElementAttributes,
+ ReservedProps,
+ NativeElements
+} from '@vue/runtime-dom'
declare global {
namespace JSX {
// imports the global JSX namespace registration for compat.
// TODO: remove in 3.4
import '../jsx'
-
-export * from '../jsx-runtime/dom'
return false
}
+ const isExported = new Set()
const shouldRemoveExport = new Set()
+
+ // pass 0: check all exported types
+ for (const node of ast.program.body) {
+ if (node.type === 'ExportNamedDeclaration' && !node.source) {
+ for (let i = 0; i < node.specifiers.length; i++) {
+ const spec = node.specifiers[i]
+ if (spec.type === 'ExportSpecifier') {
+ isExported.add(spec.local.name)
+ }
+ }
+ }
+ }
+
// pass 1: remove internals + add exports
for (const node of ast.program.body) {
if (
node.type === 'TSInterfaceDeclaration') &&
!node.id.name.startsWith(`_`)
) {
- shouldRemoveExport.add(node.id.name)
+ const name = node.id.name
+ shouldRemoveExport.add(name)
if (!removeInternal(node)) {
- // @ts-ignore
- s.prependLeft(node.start, `export `)
+ if (isExported.has(name)) {
+ // @ts-ignore
+ s.prependLeft(node.start, `export `)
+ }
// traverse further for internal properties
if (node.type === 'TSInterfaceDeclaration') {
node.body.body.forEach(removeInternal)