Home / File/ hmr.ts — vite Source File

hmr.ts — vite Source File

Architecture documentation for hmr.ts, a typescript file in the vite codebase. 13 imports, 0 dependents.

File typescript ViteCore ConfigEngine 13 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614["hmr.ts"]
  65483538_8ea1_5b64_c60b_f02b8cf38651["hmrDep.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 65483538_8ea1_5b64_c60b_f02b8cf38651
  884d7359_fae0_6bc0_62dc_c2004ebc0f95["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 884d7359_fae0_6bc0_62dc_c2004ebc0f95
  0cf6dd81_5adc_5d51_3c3f_af76251b57f3["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 0cf6dd81_5adc_5d51_3c3f_af76251b57f3
  ade0ed60_faae_4ea2_a363_37d0b3d94365["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> ade0ed60_faae_4ea2_a363_37d0b3d94365
  9d83a8b1_ed78_f235_6b57_fa0d2568d62d["parent.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 9d83a8b1_ed78_f235_6b57_fa0d2568d62d
  83506ffe_7b91_fc02_f046_db3c8302c5ce["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 83506ffe_7b91_fc02_f046_db3c8302c5ce
  c4960491_1a95_3ba0_2175_4275765bb1d1["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> c4960491_1a95_3ba0_2175_4275765bb1d1
  c9e5a2d8_973f_12cd_18ff_17edd1620792["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> c9e5a2d8_973f_12cd_18ff_17edd1620792
  7f63ce28_0565_1ebc_075d_f4ee065c8e3c["./logo.svg"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 7f63ce28_0565_1ebc_075d_f4ee065c8e3c
  39e02846_a1ee_ea83_f4b7_dfc8116f7e51["./logo-no-inline.svg"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 39e02846_a1ee_ea83_f4b7_dfc8116f7e51
  aba697d0_de94_7c67_037f_0669291d9dff["index.js"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> aba697d0_de94_7c67_037f_0669291d9dff
  45a80026_33bf_3f6f_ab27_48f519ed66cf["virtual:file"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> 45a80026_33bf_3f6f_ab27_48f519ed66cf
  f82b2bc2_443b_6801_27cf_4426550fe0fd["virtual:file-dep"]
  2bff1ddd_39d7_0bc8_e313_78c6a7eae614 --> f82b2bc2_443b_6801_27cf_4426550fe0fd
  style 2bff1ddd_39d7_0bc8_e313_78c6a7eae614 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { virtual } from 'virtual:file'
import { virtual as virtualDep } from 'virtual:file-dep'
import { foo as depFoo, nestedFoo } from './hmrDep'
import './importing-updated'
import './invalidation-circular-deps'
import './file-delete-restore'
import './optional-chaining/parent'
import './intermediate-file-delete'
import './circular'
import './prune'
import logo from './logo.svg'
import logoNoInline from './logo-no-inline.svg'
import { msg as softInvalidationMsg } from './soft-invalidation'

export const foo = 1
text('.app', foo)
text('.dep', depFoo)
text('.nested', nestedFoo)
text('.virtual', virtual)
text('.virtual-dep', virtualDep)
text('.soft-invalidation', softInvalidationMsg)
setImgSrc('#logo', logo)
setImgSrc('#logo-no-inline', logoNoInline)

text('.virtual-dep', 0)

const btn = document.querySelector('.virtual-update') as HTMLButtonElement
btn.onclick = () => {
  if (import.meta.hot) {
    import.meta.hot.send('virtual:increment')
  }
}

const btnDep = document.querySelector(
  '.virtual-update-dep',
) as HTMLButtonElement
btnDep.onclick = () => {
  if (import.meta.hot) {
    import.meta.hot.send('virtual:increment', '-dep')
  }
}

if (import.meta.hot) {
  import.meta.hot.accept(({ foo }) => {
    console.log('(self-accepting 1) foo is now:', foo)
  })

  import.meta.hot.accept(({ foo }) => {
    console.log('(self-accepting 2) foo is now:', foo)
  })

  const handleDep = (type, newFoo, newNestedFoo) => {
    console.log(`(${type}) foo is now: ${newFoo}`)
    console.log(`(${type}) nested foo is now: ${newNestedFoo}`)
    text('.dep', newFoo)
    text('.nested', newNestedFoo)
  }

  import.meta.hot.accept('./logo.svg', (newUrl) => {
    setImgSrc('#logo', newUrl.default)
// ... (108 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does hmr.ts do?
hmr.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in hmr.ts?
hmr.ts defines 6 function(s): btn, btnDep, handleDep, removeCb, setImgSrc, text.
What does hmr.ts depend on?
hmr.ts imports 13 module(s): ./logo-no-inline.svg, ./logo.svg, hmrDep.js, index.js, index.js, index.js, index.js, index.js, and 5 more.
Where is hmr.ts in the architecture?
hmr.ts is located at playground/hmr/hmr.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground/hmr).

Analyze Your Own Codebase

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

Try Supermodel Free