Home / File/ keep-alive.ts — vue Source File

keep-alive.ts — vue Source File

Architecture documentation for keep-alive.ts, a typescript file in the vue codebase. 7 imports, 1 dependents.

File typescript VueCore Instance 7 imports 1 dependents 9 functions

Entity Profile

Dependency Diagram

graph LR
  302828a5_7155_979e_f7d9_5b26a70fd7d0["keep-alive.ts"]
  82e2e746_8f28_fbf0_8cf7_69eca6423e4a["create-component.ts"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 82e2e746_8f28_fbf0_8cf7_69eca6423e4a
  07237020_2f32_55be_02ad_e77197985632["getComponentName"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 07237020_2f32_55be_02ad_e77197985632
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  0b94d479_4c91_cb17_f853_bbf7580e667b["index"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 0b94d479_4c91_cb17_f853_bbf7580e667b
  973389ac_8625_30a3_53ce_b1b48fae58c5["vnode"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 973389ac_8625_30a3_53ce_b1b48fae58c5
  ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1
  64c87498_c46a_6944_ab9d_8e45519852a8["component"]
  302828a5_7155_979e_f7d9_5b26a70fd7d0 --> 64c87498_c46a_6944_ab9d_8e45519852a8
  4c0d032d_003a_b195_24cf_2160ed442cf9["index.ts"]
  4c0d032d_003a_b195_24cf_2160ed442cf9 --> 302828a5_7155_979e_f7d9_5b26a70fd7d0
  style 302828a5_7155_979e_f7d9_5b26a70fd7d0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isRegExp, isArray, remove } from 'shared/util'
import { getFirstComponentChild } from 'core/vdom/helpers/index'
import type VNode from 'core/vdom/vnode'
import type { VNodeComponentOptions } from 'types/vnode'
import type { Component } from 'types/component'
import { getComponentName } from '../vdom/create-component'

type CacheEntry = {
  name?: string
  tag?: string
  componentInstance?: Component
}

type CacheEntryMap = Record<string, CacheEntry | null>

function _getComponentName(opts?: VNodeComponentOptions): string | null {
  return opts && (getComponentName(opts.Ctor.options as any) || opts.tag)
}

function matches(
  pattern: string | RegExp | Array<string>,
  name: string
): boolean {
  if (isArray(pattern)) {
    return pattern.indexOf(name) > -1
  } else if (typeof pattern === 'string') {
    return pattern.split(',').indexOf(name) > -1
  } else if (isRegExp(pattern)) {
    return pattern.test(name)
  }
  /* istanbul ignore next */
  return false
}

function pruneCache(
  keepAliveInstance: {
    cache: CacheEntryMap
    keys: string[]
    _vnode: VNode
    $vnode: VNode
  },
  filter: Function
) {
  const { cache, keys, _vnode, $vnode } = keepAliveInstance
  for (const key in cache) {
    const entry = cache[key]
    if (entry) {
      const name = entry.name
      if (name && !filter(name)) {
        pruneCacheEntry(cache, key, keys, _vnode)
      }
    }
  }
  $vnode.componentOptions!.children = undefined
}

function pruneCacheEntry(
  cache: CacheEntryMap,
  key: string,
  keys: Array<string>,
// ... (112 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does keep-alive.ts do?
keep-alive.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Instance subdomain.
What functions are defined in keep-alive.ts?
keep-alive.ts defines 9 function(s): _getComponentName, default.created, default.destroyed, default.mounted, default.render, default.updated, matches, pruneCache, pruneCacheEntry.
What does keep-alive.ts depend on?
keep-alive.ts imports 7 module(s): component, create-component.ts, getComponentName, index, util, vnode, vnode.
What files import keep-alive.ts?
keep-alive.ts is imported by 1 file(s): index.ts.
Where is keep-alive.ts in the architecture?
keep-alive.ts is located at src/core/components/keep-alive.ts (domain: VueCore, subdomain: Instance, directory: src/core/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free