2019-10-07 17:32:29 +00:00
|
|
|
export const FRAGMENT = Symbol(__DEV__ ? `Fragment` : ``)
|
2020-03-31 14:52:42 +00:00
|
|
|
export const TELEPORT = Symbol(__DEV__ ? `Teleport` : ``)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const SUSPENSE = Symbol(__DEV__ ? `Suspense` : ``)
|
2019-11-05 15:26:36 +00:00
|
|
|
export const KEEP_ALIVE = Symbol(__DEV__ ? `KeepAlive` : ``)
|
2019-11-24 23:37:59 +00:00
|
|
|
export const BASE_TRANSITION = Symbol(__DEV__ ? `BaseTransition` : ``)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const OPEN_BLOCK = Symbol(__DEV__ ? `openBlock` : ``)
|
|
|
|
export const CREATE_BLOCK = Symbol(__DEV__ ? `createBlock` : ``)
|
|
|
|
export const CREATE_VNODE = Symbol(__DEV__ ? `createVNode` : ``)
|
2019-10-24 21:55:00 +00:00
|
|
|
export const CREATE_COMMENT = Symbol(__DEV__ ? `createCommentVNode` : ``)
|
|
|
|
export const CREATE_TEXT = Symbol(__DEV__ ? `createTextVNode` : ``)
|
2020-02-12 16:56:42 +00:00
|
|
|
export const CREATE_STATIC = Symbol(__DEV__ ? `createStaticVNode` : ``)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const RESOLVE_COMPONENT = Symbol(__DEV__ ? `resolveComponent` : ``)
|
2019-10-18 16:09:04 +00:00
|
|
|
export const RESOLVE_DYNAMIC_COMPONENT = Symbol(
|
|
|
|
__DEV__ ? `resolveDynamicComponent` : ``
|
|
|
|
)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const RESOLVE_DIRECTIVE = Symbol(__DEV__ ? `resolveDirective` : ``)
|
2019-10-18 20:35:01 +00:00
|
|
|
export const WITH_DIRECTIVES = Symbol(__DEV__ ? `withDirectives` : ``)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const RENDER_LIST = Symbol(__DEV__ ? `renderList` : ``)
|
|
|
|
export const RENDER_SLOT = Symbol(__DEV__ ? `renderSlot` : ``)
|
|
|
|
export const CREATE_SLOTS = Symbol(__DEV__ ? `createSlots` : ``)
|
2020-01-26 22:35:21 +00:00
|
|
|
export const TO_DISPLAY_STRING = Symbol(__DEV__ ? `toDisplayString` : ``)
|
2019-10-07 17:32:29 +00:00
|
|
|
export const MERGE_PROPS = Symbol(__DEV__ ? `mergeProps` : ``)
|
|
|
|
export const TO_HANDLERS = Symbol(__DEV__ ? `toHandlers` : ``)
|
|
|
|
export const CAMELIZE = Symbol(__DEV__ ? `camelize` : ``)
|
2020-07-13 21:36:46 +00:00
|
|
|
export const CAPITALIZE = Symbol(__DEV__ ? `capitalize` : ``)
|
2020-10-19 21:15:53 +00:00
|
|
|
export const TO_HANDLER_KEY = Symbol(__DEV__ ? `toHandlerKey` : ``)
|
2019-10-23 21:57:40 +00:00
|
|
|
export const SET_BLOCK_TRACKING = Symbol(__DEV__ ? `setBlockTracking` : ``)
|
2021-03-05 16:10:06 +00:00
|
|
|
export const SET_SCOPE_ID = Symbol(__DEV__ ? `setScopeId` : ``)
|
2020-03-16 15:23:29 +00:00
|
|
|
export const WITH_CTX = Symbol(__DEV__ ? `withCtx` : ``)
|
2020-11-10 21:28:34 +00:00
|
|
|
export const UNREF = Symbol(__DEV__ ? `unref` : ``)
|
2020-11-17 17:42:58 +00:00
|
|
|
export const IS_REF = Symbol(__DEV__ ? `isRef` : ``)
|
2019-10-05 21:18:25 +00: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-10 22:02:51 +00:00
|
|
|
// Using `any` here because TS doesn't allow symbols as index type.
|
|
|
|
export const helperNameMap: any = {
|
2019-10-05 21:18:25 +00:00
|
|
|
[FRAGMENT]: `Fragment`,
|
2020-03-31 14:52:42 +00:00
|
|
|
[TELEPORT]: `Teleport`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[SUSPENSE]: `Suspense`,
|
2019-11-05 15:26:36 +00:00
|
|
|
[KEEP_ALIVE]: `KeepAlive`,
|
2019-11-24 23:37:59 +00:00
|
|
|
[BASE_TRANSITION]: `BaseTransition`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[OPEN_BLOCK]: `openBlock`,
|
|
|
|
[CREATE_BLOCK]: `createBlock`,
|
|
|
|
[CREATE_VNODE]: `createVNode`,
|
2019-10-24 21:55:00 +00:00
|
|
|
[CREATE_COMMENT]: `createCommentVNode`,
|
|
|
|
[CREATE_TEXT]: `createTextVNode`,
|
2020-02-12 16:56:42 +00:00
|
|
|
[CREATE_STATIC]: `createStaticVNode`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[RESOLVE_COMPONENT]: `resolveComponent`,
|
2019-10-18 16:09:04 +00:00
|
|
|
[RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[RESOLVE_DIRECTIVE]: `resolveDirective`,
|
2019-10-18 20:35:01 +00:00
|
|
|
[WITH_DIRECTIVES]: `withDirectives`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[RENDER_LIST]: `renderList`,
|
|
|
|
[RENDER_SLOT]: `renderSlot`,
|
|
|
|
[CREATE_SLOTS]: `createSlots`,
|
2020-01-26 22:35:21 +00:00
|
|
|
[TO_DISPLAY_STRING]: `toDisplayString`,
|
2019-10-05 21:18:25 +00:00
|
|
|
[MERGE_PROPS]: `mergeProps`,
|
|
|
|
[TO_HANDLERS]: `toHandlers`,
|
2019-10-23 21:57:40 +00:00
|
|
|
[CAMELIZE]: `camelize`,
|
2020-07-13 21:36:46 +00:00
|
|
|
[CAPITALIZE]: `capitalize`,
|
2020-10-19 21:15:53 +00:00
|
|
|
[TO_HANDLER_KEY]: `toHandlerKey`,
|
2019-12-16 17:11:51 +00:00
|
|
|
[SET_BLOCK_TRACKING]: `setBlockTracking`,
|
2021-03-05 16:10:06 +00:00
|
|
|
[SET_SCOPE_ID]: `setScopeId`,
|
2020-11-10 21:28:34 +00:00
|
|
|
[WITH_CTX]: `withCtx`,
|
2020-11-17 17:42:58 +00:00
|
|
|
[UNREF]: `unref`,
|
|
|
|
[IS_REF]: `isRef`
|
2019-10-05 21:18:25 +00:00
|
|
|
}
|
2019-10-10 22:02:51 +00:00
|
|
|
|
|
|
|
export function registerRuntimeHelpers(helpers: any) {
|
|
|
|
Object.getOwnPropertySymbols(helpers).forEach(s => {
|
|
|
|
helperNameMap[s] = helpers[s]
|
|
|
|
})
|
|
|
|
}
|