Home / Function/ addAssetImport() — astro Function Reference

addAssetImport() — astro Function Reference

Architecture documentation for the addAssetImport() function in mutable-data-store.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  46376fa6_b848_94c4_1def_bd808a3a4fec["addAssetImport()"]
  ecb98618_124a_e276_dd98_561beaedc6ea["MutableDataStore"]
  46376fa6_b848_94c4_1def_bd808a3a4fec -->|defined in| ecb98618_124a_e276_dd98_561beaedc6ea
  e8128657_5ca2_5835_1b1d_0ba8f6e44da0["addAssetImports()"]
  e8128657_5ca2_5835_1b1d_0ba8f6e44da0 -->|calls| 46376fa6_b848_94c4_1def_bd808a3a4fec
  f03b05d5_a06a_1438_1154_d1d6dcdbbdb9["scopedStore()"]
  f03b05d5_a06a_1438_1154_d1d6dcdbbdb9 -->|calls| 46376fa6_b848_94c4_1def_bd808a3a4fec
  style 46376fa6_b848_94c4_1def_bd808a3a4fec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/mutable-data-store.ts lines 63–72

	addAssetImport(assetImport: string, filePath?: string) {
		const id = imageSrcToImportId(assetImport, filePath);
		if (id) {
			this.#assetImports.add(id);
			// We debounce the writes to disk because addAssetImport is called for every image in every file,
			// and can be called many times in quick succession by a filesystem watcher. We only want to write
			// the file once, after all the imports have been added.
			this.#writeAssetsImportsDebounced();
		}
	}

Subdomains

Frequently Asked Questions

What does addAssetImport() do?
addAssetImport() is a function in the astro codebase, defined in packages/astro/src/content/mutable-data-store.ts.
Where is addAssetImport() defined?
addAssetImport() is defined in packages/astro/src/content/mutable-data-store.ts at line 63.
What calls addAssetImport()?
addAssetImport() is called by 2 function(s): addAssetImports, scopedStore.

Analyze Your Own Codebase

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

Try Supermodel Free