MCPcopy
hub / github.com/vitejs/vite / handleAttributeKey

Function handleAttributeKey

packages/vite/src/node/assetSource.ts:152–162  ·  view source on GitHub ↗
(
    key: string,
    type: 'src' | 'srcset',
    filter?: (data: HtmlAssetSourceFilterData) => boolean,
  )

Source from the content-addressed store, hash-verified

150
151 const actions: HtmlAssetAttribute[] = []
152 function handleAttributeKey(
153 key: string,
154 type: 'src' | 'srcset',
155 filter?: (data: HtmlAssetSourceFilterData) => boolean,
156 ) {
157 const value = attributes[key]
158 if (!value) return
159 if (filter && !filter({ key, value, attributes })) return
160 const location = node.sourceCodeLocation!.attrs![key]
161 actions.push({ type, key, value, attributes, location })
162 }
163
164 // Run matching for default asset sources
165 if (defaults) {

Callers 1

getNodeAssetAttributesFunction · 0.85

Calls 1

filterFunction · 0.85

Tested by

no test coverage detected