Home / File/ assetSource.ts — vite Source File

assetSource.ts — vite Source File

Architecture documentation for assetSource.ts, a typescript file in the vite codebase. 1 imports, 3 dependents.

File typescript ViteCore ConfigEngine 1 imports 3 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  a2a61cd6_2d46_2c12_335a_793c63cb8a19["assetSource.ts"]
  f254ed68_2782_1441_34e4_258ed6a8f434["parse5"]
  a2a61cd6_2d46_2c12_335a_793c63cb8a19 --> f254ed68_2782_1441_34e4_258ed6a8f434
  ec8b45d7_5d26_7be1_b946_be1735a3b6f0["assetSource.spec.ts"]
  ec8b45d7_5d26_7be1_b946_be1735a3b6f0 --> a2a61cd6_2d46_2c12_335a_793c63cb8a19
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  f8fe0737_718a_5509_b722_473f207d5906 --> a2a61cd6_2d46_2c12_335a_793c63cb8a19
  3f56d5b2_9fca_532f_3bfc_6bfb2be77015["indexHtml.ts"]
  3f56d5b2_9fca_532f_3bfc_6bfb2be77015 --> a2a61cd6_2d46_2c12_335a_793c63cb8a19
  style a2a61cd6_2d46_2c12_335a_793c63cb8a19 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { DefaultTreeAdapterMap, Token } from 'parse5'

interface HtmlAssetSource {
  srcAttributes?: string[]
  srcsetAttributes?: string[]
  /**
   * Called before handling an attribute to determine if it should be processed.
   */
  filter?: (data: HtmlAssetSourceFilterData) => boolean
}

interface HtmlAssetSourceFilterData {
  key: string
  value: string
  attributes: Record<string, string>
}

// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name
// https://wiki.whatwg.org/wiki/MetaExtensions
const ALLOWED_META_NAME = [
  'msapplication-tileimage',
  'msapplication-square70x70logo',
  'msapplication-square150x150logo',
  'msapplication-wide310x150logo',
  'msapplication-square310x310logo',
  'msapplication-config',
  'twitter:image',
]

// https://ogp.me
const ALLOWED_META_PROPERTY = [
  'og:image',
  'og:image:url',
  'og:image:secure_url',
  'og:audio',
  'og:audio:secure_url',
  'og:video',
  'og:video:secure_url',
]

const DEFAULT_HTML_ASSET_SOURCES: Record<string, HtmlAssetSource> = {
  audio: {
    srcAttributes: ['src'],
  },
  embed: {
    srcAttributes: ['src'],
  },
  img: {
    srcAttributes: ['src'],
    srcsetAttributes: ['srcset'],
  },
  image: {
    srcAttributes: ['href', 'xlink:href'],
  },
  input: {
    srcAttributes: ['src'],
  },
  link: {
    srcAttributes: ['href'],
    srcsetAttributes: ['imagesrcset'],
// ... (92 more lines)

Domain

Subdomains

Dependencies

  • parse5

Frequently Asked Questions

What does assetSource.ts do?
assetSource.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 assetSource.ts?
assetSource.ts defines 3 function(s): data, getAttrKey, getNodeAssetAttributes.
What does assetSource.ts depend on?
assetSource.ts imports 1 module(s): parse5.
What files import assetSource.ts?
assetSource.ts is imported by 3 file(s): assetSource.spec.ts, html.ts, indexHtml.ts.
Where is assetSource.ts in the architecture?
assetSource.ts is located at packages/vite/src/node/assetSource.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node).

Analyze Your Own Codebase

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

Try Supermodel Free