mirror of https://github.com/vuejs/core.git
chore: fix runtime-vapor dts build
This commit is contained in:
parent
ddfd83639a
commit
b20bcf1fb6
|
@ -187,12 +187,9 @@ type NormalizedProp = PropOptions & {
|
|||
/**
|
||||
* normalized value is a tuple of the actual normalized options
|
||||
* and an array of prop keys that need value casting (booleans and defaults)
|
||||
* @internal
|
||||
*/
|
||||
export type NormalizedProps = Record<string, NormalizedProp>
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
export type NormalizedPropsOptions = [NormalizedProps, string[]] | []
|
||||
|
||||
export function initProps(
|
||||
|
|
|
@ -487,11 +487,22 @@ export const DeprecationTypes = (
|
|||
// **IMPORTANT** These APIs are exposed solely for @vue/runtime-vapor and may
|
||||
// change without notice between versions. User code should never rely on them.
|
||||
|
||||
/**
|
||||
* these types cannot be marked internal because runtime-vapor's type relies on
|
||||
* them, but they should be considered internal
|
||||
* @private
|
||||
*/
|
||||
export {
|
||||
type ComponentInternalOptions,
|
||||
type GenericComponentInstance,
|
||||
type LifecycleHook,
|
||||
} from './component'
|
||||
export { type NormalizedPropsOptions } from './componentProps'
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export {
|
||||
type NormalizedPropsOptions,
|
||||
baseNormalizePropsOptions,
|
||||
resolvePropValue,
|
||||
validateProps,
|
||||
|
@ -507,14 +518,7 @@ export { type SchedulerJob, queueJob, flushOnAppMount } from './scheduler'
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export {
|
||||
type ComponentInternalOptions,
|
||||
type GenericComponentInstance,
|
||||
type LifecycleHook,
|
||||
expose,
|
||||
nextUid,
|
||||
validateComponentName,
|
||||
} from './component'
|
||||
export { expose, nextUid, validateComponentName } from './component'
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import { Fragment, insert, normalizeBlock, prepend, remove } from '../src/block'
|
||||
import {
|
||||
VaporFragment,
|
||||
insert,
|
||||
normalizeBlock,
|
||||
prepend,
|
||||
remove,
|
||||
} from '../src/block'
|
||||
|
||||
const node1 = document.createTextNode('node1')
|
||||
const node2 = document.createTextNode('node2')
|
||||
|
@ -13,7 +19,7 @@ describe('block + node ops', () => {
|
|||
node2,
|
||||
node3,
|
||||
])
|
||||
const frag = new Fragment(node2)
|
||||
const frag = new VaporFragment(node2)
|
||||
frag.anchor = anchor
|
||||
expect(normalizeBlock([node1, frag, [node3]])).toEqual([
|
||||
node1,
|
||||
|
@ -39,14 +45,14 @@ describe('block + node ops', () => {
|
|||
test('prepend', () => {
|
||||
const container = document.createElement('div')
|
||||
prepend(container, [node1], node2)
|
||||
prepend(container, new Fragment(node3))
|
||||
prepend(container, new VaporFragment(node3))
|
||||
expect(Array.from(container.childNodes)).toEqual([node3, node1, node2])
|
||||
})
|
||||
|
||||
test('remove', () => {
|
||||
const container = document.createElement('div')
|
||||
container.append(node1, node2, node3)
|
||||
const frag = new Fragment(node3)
|
||||
const frag = new VaporFragment(node3)
|
||||
remove([node1], container)
|
||||
remove(frag, container)
|
||||
expect(Array.from(container.childNodes)).toEqual([node2])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { resolveDynamicComponent } from '@vue/runtime-dom'
|
||||
import { DynamicFragment, type Fragment } from './block'
|
||||
import { DynamicFragment, type VaporFragment } from './block'
|
||||
import { createComponentWithFallback } from './component'
|
||||
import { renderEffect } from './renderEffect'
|
||||
import type { RawProps } from './componentProps'
|
||||
|
@ -10,7 +10,7 @@ export function createDynamicComponent(
|
|||
rawProps?: RawProps | null,
|
||||
rawSlots?: RawSlots | null,
|
||||
isSingleRoot?: boolean,
|
||||
): Fragment {
|
||||
): VaporFragment {
|
||||
const frag = __DEV__
|
||||
? new DynamicFragment('dynamic-component')
|
||||
: new DynamicFragment()
|
||||
|
|
|
@ -9,13 +9,18 @@ import {
|
|||
} from '@vue/reactivity'
|
||||
import { getSequence, isArray, isObject, isString } from '@vue/shared'
|
||||
import { createComment, createTextNode } from './dom/node'
|
||||
import { type Block, Fragment, insert, remove as removeBlock } from './block'
|
||||
import {
|
||||
type Block,
|
||||
VaporFragment,
|
||||
insert,
|
||||
remove as removeBlock,
|
||||
} from './block'
|
||||
import { warn } from '@vue/runtime-dom'
|
||||
import { currentInstance, isVaporComponent } from './component'
|
||||
import type { DynamicSlot } from './componentSlots'
|
||||
import { renderEffect } from './renderEffect'
|
||||
|
||||
class ForBlock extends Fragment {
|
||||
class ForBlock extends VaporFragment {
|
||||
scope: EffectScope | undefined
|
||||
key: any
|
||||
|
||||
|
@ -64,13 +69,13 @@ export const createFor = (
|
|||
isComponent = false,
|
||||
once?: boolean,
|
||||
// hydrationNode?: Node,
|
||||
): Fragment => {
|
||||
): VaporFragment => {
|
||||
let isMounted = false
|
||||
let oldBlocks: ForBlock[] = []
|
||||
let newBlocks: ForBlock[]
|
||||
let parent: ParentNode | undefined | null
|
||||
const parentAnchor = __DEV__ ? createComment('for') : createTextNode()
|
||||
const ref = new Fragment(oldBlocks)
|
||||
const ref = new VaporFragment(oldBlocks)
|
||||
const instance = currentInstance!
|
||||
|
||||
if (__DEV__ && !instance) {
|
||||
|
|
|
@ -10,14 +10,14 @@ import { EffectScope, pauseTracking, resetTracking } from '@vue/reactivity'
|
|||
|
||||
export type Block =
|
||||
| Node
|
||||
| Fragment
|
||||
| VaporFragment
|
||||
| DynamicFragment
|
||||
| VaporComponentInstance
|
||||
| Block[]
|
||||
|
||||
export type BlockFn = (...args: any[]) => Block
|
||||
|
||||
export class Fragment {
|
||||
export class VaporFragment {
|
||||
nodes: Block
|
||||
anchor?: Node
|
||||
|
||||
|
@ -26,7 +26,7 @@ export class Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
export class DynamicFragment extends Fragment {
|
||||
export class DynamicFragment extends VaporFragment {
|
||||
anchor: Node
|
||||
scope: EffectScope | undefined
|
||||
current?: BlockFn
|
||||
|
@ -76,8 +76,8 @@ export class DynamicFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
export function isFragment(val: NonNullable<unknown>): val is Fragment {
|
||||
return val instanceof Fragment
|
||||
export function isFragment(val: NonNullable<unknown>): val is VaporFragment {
|
||||
return val instanceof VaporFragment
|
||||
}
|
||||
|
||||
export function isBlock(val: NonNullable<unknown>): val is Block {
|
||||
|
|
|
@ -64,8 +64,8 @@ import { setDynamicProps } from './dom/prop'
|
|||
import {
|
||||
type DynamicSlotSource,
|
||||
type RawSlots,
|
||||
type Slot,
|
||||
type StaticSlots,
|
||||
type VaporSlot,
|
||||
dynamicSlotsProxyHandlers,
|
||||
getSlot,
|
||||
} from './componentSlots'
|
||||
|
@ -97,7 +97,7 @@ export interface ObjectVaporComponent
|
|||
props?: any,
|
||||
emit?: EmitFn,
|
||||
attrs?: any,
|
||||
slots?: Record<string, Slot>,
|
||||
slots?: Record<string, VaporSlot>,
|
||||
): Block
|
||||
|
||||
name?: string
|
||||
|
@ -135,7 +135,7 @@ export type LooseRawProps = Record<
|
|||
$?: DynamicPropsSource[]
|
||||
}
|
||||
|
||||
type LooseRawSlots = Record<string, Slot | DynamicSlotSource[]> & {
|
||||
type LooseRawSlots = Record<string, VaporSlot | DynamicSlotSource[]> & {
|
||||
$?: DynamicSlotSource[]
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ import { currentInstance } from '@vue/runtime-core'
|
|||
import type { LooseRawProps, VaporComponentInstance } from './component'
|
||||
import { renderEffect } from './renderEffect'
|
||||
|
||||
export type RawSlots = Record<string, Slot> & {
|
||||
export type RawSlots = Record<string, VaporSlot> & {
|
||||
$?: DynamicSlotSource[]
|
||||
}
|
||||
|
||||
export type StaticSlots = Record<string, Slot>
|
||||
export type StaticSlots = Record<string, VaporSlot>
|
||||
|
||||
export type Slot = BlockFn
|
||||
export type DynamicSlot = { name: string; fn: Slot }
|
||||
export type VaporSlot = BlockFn
|
||||
export type DynamicSlot = { name: string; fn: VaporSlot }
|
||||
export type DynamicSlotFn = () => DynamicSlot | DynamicSlot[]
|
||||
export type DynamicSlotSource = StaticSlots | DynamicSlotFn
|
||||
|
||||
|
@ -61,7 +61,7 @@ export const dynamicSlotsProxyHandlers: ProxyHandler<RawSlots> = {
|
|||
export function getSlot(
|
||||
target: RawSlots,
|
||||
key: string,
|
||||
): (Slot & { _bound?: Slot }) | undefined {
|
||||
): (VaporSlot & { _bound?: VaporSlot }) | undefined {
|
||||
if (key === '$') return
|
||||
const dynamicSources = target.$
|
||||
if (dynamicSources) {
|
||||
|
@ -112,7 +112,7 @@ const dynamicSlotsPropsProxyHandlers: ProxyHandler<RawProps> = {
|
|||
export function createSlot(
|
||||
name: string | (() => string),
|
||||
rawProps?: LooseRawProps | null,
|
||||
fallback?: Slot,
|
||||
fallback?: VaporSlot,
|
||||
): Block {
|
||||
const instance = currentInstance as VaporComponentInstance
|
||||
const rawSlots = instance.rawSlots
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// public APIs
|
||||
export { createVaporApp } from './apiCreateApp'
|
||||
export { defineVaporComponent } from './apiDefineComponent'
|
||||
export { vaporInteropPlugin } from './vdomInterop'
|
||||
|
||||
// compiler-use only
|
||||
export { insert, prepend, remove } from './block'
|
||||
export {
|
||||
createComponent,
|
||||
createComponentWithFallback,
|
||||
mountComponent,
|
||||
unmountComponent,
|
||||
type VaporComponentInstance,
|
||||
} from './component'
|
||||
export { createComponent, createComponentWithFallback } from './component'
|
||||
export { renderEffect } from './renderEffect'
|
||||
export { createSlot } from './componentSlots'
|
||||
export { template, children, next } from './dom/template'
|
||||
|
@ -44,4 +39,3 @@ export {
|
|||
applySelectModel,
|
||||
applyDynamicModel,
|
||||
} from './directives/vModel'
|
||||
export { vaporInteropPlugin } from './vdomInterop'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// for type generation only
|
||||
export * from './index'
|
||||
export * from '@vue/runtime-vapor'
|
|
@ -22,7 +22,7 @@ export default targetPackages.map(
|
|||
/** @returns {import('rollup').RollupOptions} */
|
||||
pkg => {
|
||||
return {
|
||||
input: `./temp/packages/${pkg}/src/index.d.ts`,
|
||||
input: `./temp/packages/${pkg}/src/index${pkg === 'vue' ? '-with-vapor' : ''}.d.ts`,
|
||||
output: {
|
||||
file: `packages/${pkg}/dist/${pkg}.d.ts`,
|
||||
format: 'es',
|
||||
|
|
Loading…
Reference in New Issue