2019-10-08 01:32:29 +08:00
|
|
|
export const FRAGMENT = Symbol(__DEV__ ? `Fragment` : ``)
|
|
|
|
export const PORTAL = Symbol(__DEV__ ? `Portal` : ``)
|
|
|
|
export const SUSPENSE = Symbol(__DEV__ ? `Suspense` : ``)
|
|
|
|
export const OPEN_BLOCK = Symbol(__DEV__ ? `openBlock` : ``)
|
|
|
|
export const CREATE_BLOCK = Symbol(__DEV__ ? `createBlock` : ``)
|
|
|
|
export const CREATE_VNODE = Symbol(__DEV__ ? `createVNode` : ``)
|
2019-10-25 05:55:00 +08:00
|
|
|
export const CREATE_COMMENT = Symbol(__DEV__ ? `createCommentVNode` : ``)
|
|
|
|
export const CREATE_TEXT = Symbol(__DEV__ ? `createTextVNode` : ``)
|
2019-10-08 01:32:29 +08:00
|
|
|
export const RESOLVE_COMPONENT = Symbol(__DEV__ ? `resolveComponent` : ``)
|
2019-10-19 00:09:04 +08:00
|
|
|
export const RESOLVE_DYNAMIC_COMPONENT = Symbol(
|
|
|
|
__DEV__ ? `resolveDynamicComponent` : ``
|
|
|
|
)
|
2019-10-08 01:32:29 +08:00
|
|
|
export const RESOLVE_DIRECTIVE = Symbol(__DEV__ ? `resolveDirective` : ``)
|
2019-10-19 04:35:01 +08:00
|
|
|
export const WITH_DIRECTIVES = Symbol(__DEV__ ? `withDirectives` : ``)
|
2019-10-08 01:32:29 +08:00
|
|
|
export const RENDER_LIST = Symbol(__DEV__ ? `renderList` : ``)
|
|
|
|
export const RENDER_SLOT = Symbol(__DEV__ ? `renderSlot` : ``)
|
|
|
|
export const CREATE_SLOTS = Symbol(__DEV__ ? `createSlots` : ``)
|
|
|
|
export const TO_STRING = Symbol(__DEV__ ? `toString` : ``)
|
|
|
|
export const MERGE_PROPS = Symbol(__DEV__ ? `mergeProps` : ``)
|
|
|
|
export const TO_HANDLERS = Symbol(__DEV__ ? `toHandlers` : ``)
|
|
|
|
export const CAMELIZE = Symbol(__DEV__ ? `camelize` : ``)
|
2019-10-24 05:57:40 +08:00
|
|
|
export const SET_BLOCK_TRACKING = Symbol(__DEV__ ? `setBlockTracking` : ``)
|
2019-10-06 05:18:25 +08:00
|
|
|
|
|
|
|
// Name mapping for runtime helpers that need to be imported from 'vue' in
|
|
|
|
// generated code. Make sure these are correctly exported in the runtime!
|
2019-10-11 06:02:51 +08:00
|
|
|
// Using `any` here because TS doesn't allow symbols as index type.
|
|
|
|
export const helperNameMap: any = {
|
2019-10-06 05:18:25 +08:00
|
|
|
[FRAGMENT]: `Fragment`,
|
|
|
|
[PORTAL]: `Portal`,
|
|
|
|
[SUSPENSE]: `Suspense`,
|
|
|
|
[OPEN_BLOCK]: `openBlock`,
|
|
|
|
[CREATE_BLOCK]: `createBlock`,
|
|
|
|
[CREATE_VNODE]: `createVNode`,
|
2019-10-25 05:55:00 +08:00
|
|
|
[CREATE_COMMENT]: `createCommentVNode`,
|
|
|
|
[CREATE_TEXT]: `createTextVNode`,
|
2019-10-06 05:18:25 +08:00
|
|
|
[RESOLVE_COMPONENT]: `resolveComponent`,
|
2019-10-19 00:09:04 +08:00
|
|
|
[RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
|
2019-10-06 05:18:25 +08:00
|
|
|
[RESOLVE_DIRECTIVE]: `resolveDirective`,
|
2019-10-19 04:35:01 +08:00
|
|
|
[WITH_DIRECTIVES]: `withDirectives`,
|
2019-10-06 05:18:25 +08:00
|
|
|
[RENDER_LIST]: `renderList`,
|
|
|
|
[RENDER_SLOT]: `renderSlot`,
|
|
|
|
[CREATE_SLOTS]: `createSlots`,
|
|
|
|
[TO_STRING]: `toString`,
|
|
|
|
[MERGE_PROPS]: `mergeProps`,
|
|
|
|
[TO_HANDLERS]: `toHandlers`,
|
2019-10-24 05:57:40 +08:00
|
|
|
[CAMELIZE]: `camelize`,
|
|
|
|
[SET_BLOCK_TRACKING]: `setBlockTracking`
|
2019-10-06 05:18:25 +08:00
|
|
|
}
|
2019-10-11 06:02:51 +08:00
|
|
|
|
|
|
|
export function registerRuntimeHelpers(helpers: any) {
|
|
|
|
Object.getOwnPropertySymbols(helpers).forEach(s => {
|
|
|
|
helperNameMap[s] = helpers[s]
|
|
|
|
})
|
|
|
|
}
|