refactor: rename/re-organize files

This commit is contained in:
Evan You 2019-11-02 12:18:35 -04:00
parent abdaf10d88
commit 90b9884eb4
12 changed files with 34 additions and 33 deletions

View File

@ -1,4 +1,3 @@
import { ComponentOptions } from '../src/component'
import { import {
h, h,
TestElement, TestElement,
@ -7,9 +6,10 @@ import {
ref, ref,
KeepAlive, KeepAlive,
serializeInner, serializeInner,
nextTick nextTick,
ComponentOptions
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { KeepAliveProps } from '../src/keepAlive' import { KeepAliveProps } from '../../src/components/KeepAlive'
describe('keep-alive', () => { describe('keep-alive', () => {
let one: ComponentOptions let one: ComponentOptions

View File

@ -2,7 +2,7 @@ import { Component, Data, validateComponentName } from './component'
import { ComponentOptions } from './apiOptions' import { ComponentOptions } from './apiOptions'
import { ComponentPublicInstance } from './componentProxy' import { ComponentPublicInstance } from './componentProxy'
import { Directive, validateDirectiveName } from './directives' import { Directive, validateDirectiveName } from './directives'
import { RootRenderFunction } from './createRenderer' import { RootRenderFunction } from './renderer'
import { InjectionKey } from './apiInject' import { InjectionKey } from './apiInject'
import { isFunction, NO } from '@vue/shared' import { isFunction, NO } from '@vue/shared'
import { warn } from './warning' import { warn } from './warning'

View File

@ -10,7 +10,7 @@ import { warn } from './warning'
import { capitalize } from '@vue/shared' import { capitalize } from '@vue/shared'
import { pauseTracking, resumeTracking, DebuggerEvent } from '@vue/reactivity' import { pauseTracking, resumeTracking, DebuggerEvent } from '@vue/reactivity'
export { onActivated, onDeactivated } from './keepAlive' export { onActivated, onDeactivated } from './components/KeepAlive'
export function injectHook( export function injectHook(
type: LifecycleHooks, type: LifecycleHooks,

View File

@ -27,7 +27,7 @@ import {
callWithAsyncErrorHandling callWithAsyncErrorHandling
} from './errorHandling' } from './errorHandling'
import { onBeforeUnmount } from './apiLifecycle' import { onBeforeUnmount } from './apiLifecycle'
import { queuePostRenderEffect } from './createRenderer' import { queuePostRenderEffect } from './renderer'
export type WatchHandler<T = any> = ( export type WatchHandler<T = any> = (
value: T, value: T,

View File

@ -25,7 +25,7 @@ import {
makeMap, makeMap,
isPromise isPromise
} from '@vue/shared' } from '@vue/shared'
import { SuspenseBoundary } from './suspense' import { SuspenseBoundary } from './rendererSuspense'
import { import {
CompilerError, CompilerError,
CompilerOptions, CompilerOptions,

View File

@ -6,19 +6,19 @@ import {
ComponentInternalInstance, ComponentInternalInstance,
LifecycleHooks, LifecycleHooks,
currentInstance currentInstance
} from './component' } from '../component'
import { VNode, cloneVNode, isVNode } from './vnode' import { VNode, cloneVNode, isVNode } from '../vnode'
import { warn } from './warning' import { warn } from '../warning'
import { onBeforeUnmount, injectHook, onUnmounted } from './apiLifecycle' import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle'
import { isString, isArray } from '@vue/shared' import { isString, isArray } from '@vue/shared'
import { watch } from './apiWatch' import { watch } from '../apiWatch'
import { ShapeFlags } from './shapeFlags' import { ShapeFlags } from '../shapeFlags'
import { SuspenseBoundary } from './suspense' import { SuspenseBoundary } from '../rendererSuspense'
import { import {
RendererInternals, RendererInternals,
queuePostRenderEffect, queuePostRenderEffect,
invokeHooks invokeHooks
} from './createRenderer' } from '../renderer'
type MatchPattern = string | RegExp | string[] | RegExp[] type MatchPattern = string | RegExp | string[] | RegExp[]

View File

@ -1,14 +1,18 @@
// Public API ------------------------------------------------------------------ // Public API ------------------------------------------------------------------
export { createComponent } from './apiCreateComponent'
export { nextTick } from './scheduler'
export * from './apiReactivity' export * from './apiReactivity'
export * from './apiWatch' export * from './apiWatch'
export * from './apiLifecycle' export * from './apiLifecycle'
export * from './apiInject' export * from './apiInject'
export { nextTick } from './scheduler'
export { createComponent } from './apiCreateComponent'
// Advanced API ---------------------------------------------------------------- // Advanced API ----------------------------------------------------------------
// For getting a hold of the internal instance in setup() - useful for advanced
// plugins
export { getCurrentInstance } from './component'
// For raw render function users // For raw render function users
export { h } from './h' export { h } from './h'
export { export {
@ -21,7 +25,7 @@ export {
// VNode type symbols // VNode type symbols
export { Text, Comment, Fragment, Portal, Suspense } from './vnode' export { Text, Comment, Fragment, Portal, Suspense } from './vnode'
// Internal Components // Internal Components
export { KeepAlive } from './keepAlive' export { KeepAlive } from './components/KeepAlive'
// VNode flags // VNode flags
export { PublicShapeFlags as ShapeFlags } from './shapeFlags' export { PublicShapeFlags as ShapeFlags } from './shapeFlags'
import { PublicPatchFlags } from '@vue/shared' import { PublicPatchFlags } from '@vue/shared'
@ -40,11 +44,8 @@ export const PatchFlags = PublicPatchFlags as {
BAIL: number BAIL: number
} }
// For advanced plugins
export { getCurrentInstance } from './component'
// For custom renderers // For custom renderers
export { createRenderer, RootRenderFunction } from './createRenderer' export { createRenderer, RootRenderFunction } from './renderer'
export { warn } from './warning' export { warn } from './warning'
export { export {
handleError, handleError,
@ -94,7 +95,7 @@ export {
} from './apiOptions' } from './apiOptions'
export { ComponentPublicInstance } from './componentProxy' export { ComponentPublicInstance } from './componentProxy'
export { RendererOptions } from './createRenderer' export { RendererOptions } from './renderer'
export { Slot, Slots } from './componentSlots' export { Slot, Slots } from './componentSlots'
export { export {
Prop, Prop,
@ -110,6 +111,6 @@ export {
FunctionDirective, FunctionDirective,
DirectiveArguments DirectiveArguments
} from './directives' } from './directives'
export { SuspenseBoundary } from './suspense' export { SuspenseBoundary } from './rendererSuspense'
export const version = __VERSION__ export const version = __VERSION__

View File

@ -47,11 +47,11 @@ import { ComponentPublicInstance } from './componentProxy'
import { App, createAppAPI } from './apiApp' import { App, createAppAPI } from './apiApp'
import { import {
SuspenseBoundary, SuspenseBoundary,
SuspenseImpl, Suspense,
queueEffectWithSuspense queueEffectWithSuspense
} from './suspense' } from './rendererSuspense'
import { ErrorCodes, callWithErrorHandling } from './errorHandling' import { ErrorCodes, callWithErrorHandling } from './errorHandling'
import { KeepAliveSink } from './keepAlive' import { KeepAliveSink } from './components/KeepAlive'
export interface RendererOptions<HostNode = any, HostElement = any> { export interface RendererOptions<HostNode = any, HostElement = any> {
patchProp( patchProp(
@ -265,7 +265,7 @@ export function createRenderer<
optimized optimized
) )
} else if (__FEATURE_SUSPENSE__ && shapeFlag & ShapeFlags.SUSPENSE) { } else if (__FEATURE_SUSPENSE__ && shapeFlag & ShapeFlags.SUSPENSE) {
;(type as typeof SuspenseImpl).process( ;(type as typeof Suspense).process(
n1, n1,
n2, n2,
container, container,

View File

@ -3,13 +3,13 @@ import { ShapeFlags } from './shapeFlags'
import { isFunction, isArray } from '@vue/shared' import { isFunction, isArray } from '@vue/shared'
import { ComponentInternalInstance, handleSetupResult } from './component' import { ComponentInternalInstance, handleSetupResult } from './component'
import { Slots } from './componentSlots' import { Slots } from './componentSlots'
import { RendererInternals } from './createRenderer' import { RendererInternals } from './renderer'
import { queuePostFlushCb, queueJob } from './scheduler' import { queuePostFlushCb, queueJob } from './scheduler'
import { updateHOCHostEl } from './componentRenderUtils' import { updateHOCHostEl } from './componentRenderUtils'
import { handleError, ErrorCodes } from './errorHandling' import { handleError, ErrorCodes } from './errorHandling'
import { pushWarningContext, popWarningContext } from './warning' import { pushWarningContext, popWarningContext } from './warning'
export const SuspenseImpl = { export const Suspense = {
__isSuspense: true, __isSuspense: true,
process( process(
n1: VNode | null, n1: VNode | null,

View File

@ -16,9 +16,9 @@ import { RawSlots } from './componentSlots'
import { ShapeFlags } from './shapeFlags' import { ShapeFlags } from './shapeFlags'
import { isReactive, Ref } from '@vue/reactivity' import { isReactive, Ref } from '@vue/reactivity'
import { AppContext } from './apiApp' import { AppContext } from './apiApp'
import { SuspenseBoundary } from './suspense' import { SuspenseBoundary } from './rendererSuspense'
import { DirectiveBinding } from './directives' import { DirectiveBinding } from './directives'
import { SuspenseImpl } from './suspense' import { Suspense as SuspenseImpl } from './rendererSuspense'
export const Fragment = (Symbol(__DEV__ ? 'Fragment' : undefined) as any) as { export const Fragment = (Symbol(__DEV__ ? 'Fragment' : undefined) as any) as {
// type differentiator for h() // type differentiator for h()
@ -48,7 +48,7 @@ export type VNodeTypes =
| typeof Portal | typeof Portal
| typeof Text | typeof Text
| typeof Comment | typeof Comment
| typeof SuspenseImpl | typeof Suspense
export interface VNodeProps { export interface VNodeProps {
[key: string]: any [key: string]: any