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 CompilerSFC ScriptAnalyzer 7 imports 1 dependents 9 functions

Entity Profile

Dependency Diagram

graph LR
  df063946_7158_b993_ea79_ae2622374b9a["keep-alive.ts"]
  a6875054_df8a_0ce4_8a16_374ce422dc53["create-component.ts"]
  df063946_7158_b993_ea79_ae2622374b9a --> a6875054_df8a_0ce4_8a16_374ce422dc53
  16abdeb5_17d6_b741_ca16_dfc41a7d0df5["getComponentName"]
  df063946_7158_b993_ea79_ae2622374b9a --> 16abdeb5_17d6_b741_ca16_dfc41a7d0df5
  156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"]
  df063946_7158_b993_ea79_ae2622374b9a --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa
  c078cebd_36ee_e879_0a89_19cf4b3ed9a7["index"]
  df063946_7158_b993_ea79_ae2622374b9a --> c078cebd_36ee_e879_0a89_19cf4b3ed9a7
  f6868225_acf7_afdc_ebd3_15704ddb6566["vnode"]
  df063946_7158_b993_ea79_ae2622374b9a --> f6868225_acf7_afdc_ebd3_15704ddb6566
  81ed4f13_7d68_6e21_7425_cf978f68576f["vnode"]
  df063946_7158_b993_ea79_ae2622374b9a --> 81ed4f13_7d68_6e21_7425_cf978f68576f
  907f4994_ea28_43b1_7976_0db9f0e97637["component"]
  df063946_7158_b993_ea79_ae2622374b9a --> 907f4994_ea28_43b1_7976_0db9f0e97637
  f344b645_583a_944f_6ad1_202173e0522d["index.ts"]
  f344b645_583a_944f_6ad1_202173e0522d --> df063946_7158_b993_ea79_ae2622374b9a
  style df063946_7158_b993_ea79_ae2622374b9a 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 CompilerSFC domain, ScriptAnalyzer 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: CompilerSFC, subdomain: ScriptAnalyzer, directory: src/core/components).

Analyze Your Own Codebase

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

Try Supermodel Free