mutable-data-store.ts — astro Source File
Architecture documentation for mutable-data-store.ts, a typescript file in the astro codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR fc8b2048_232d_51e7_d71d_a83969632b6f["mutable-data-store.ts"] 0f5629f4_a1af_981a_9bd0_9293cd98e8a8["../assets/utils/resolveImports.js"] fc8b2048_232d_51e7_d71d_a83969632b6f --> 0f5629f4_a1af_981a_9bd0_9293cd98e8a8 ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] fc8b2048_232d_51e7_d71d_a83969632b6f --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 eb7ca709_080c_a438_b9d7_f1238835779d["../content/consts.js"] fc8b2048_232d_51e7_d71d_a83969632b6f --> eb7ca709_080c_a438_b9d7_f1238835779d b1ad5044_5dee_93fa_9942_3365c09d93c8["../../content/data-store.js"] fc8b2048_232d_51e7_d71d_a83969632b6f --> b1ad5044_5dee_93fa_9942_3365c09d93c8 520c567a_b741_f105_70ac_c637eacc7f83["../content/utils.js"] fc8b2048_232d_51e7_d71d_a83969632b6f --> 520c567a_b741_f105_70ac_c637eacc7f83 e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] fc8b2048_232d_51e7_d71d_a83969632b6f --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 ca52ff61_c81f_c2ca_81b6_5a678b65fd31["devalue"] fc8b2048_232d_51e7_d71d_a83969632b6f --> ca52ff61_c81f_c2ca_81b6_5a678b65fd31 36dc1762_e449_3f26_c49f_a74b1d1be613["modern"] fc8b2048_232d_51e7_d71d_a83969632b6f --> 36dc1762_e449_3f26_c49f_a74b1d1be613 style fc8b2048_232d_51e7_d71d_a83969632b6f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { existsSync, promises as fs, type PathLike } from 'node:fs';
import * as devalue from 'devalue';
import { Traverse } from 'neotraverse/modern';
import { imageSrcToImportId, importIdToSymbolName } from '../assets/utils/resolveImports.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { IMAGE_IMPORT_PREFIX } from './consts.js';
import { type DataEntry, ImmutableDataStore } from './data-store.js';
import { contentModuleToId } from './utils.js';
const SAVE_DEBOUNCE_MS = 500;
const MAX_DEPTH = 10;
/**
* Extends the DataStore with the ability to change entries and write them to disk.
* This is kept as a separate class to avoid needing node builtins at runtime, when read-only access is all that is needed.
*/
export class MutableDataStore extends ImmutableDataStore {
#file?: PathLike;
#assetsFile?: PathLike;
#modulesFile?: PathLike;
#saveTimeout: NodeJS.Timeout | undefined;
#assetsSaveTimeout: NodeJS.Timeout | undefined;
#modulesSaveTimeout: NodeJS.Timeout | undefined;
#savePromise: Promise<void> | undefined;
#savePromiseResolve: (() => void) | undefined;
#dirty = false;
#assetsDirty = false;
#modulesDirty = false;
#assetImports = new Set<string>();
#moduleImports = new Map<string, string>();
set(collectionName: string, key: string, value: unknown) {
const collection = this._collections.get(collectionName) ?? new Map();
collection.set(String(key), value);
this._collections.set(collectionName, collection);
this.#saveToDiskDebounced();
}
delete(collectionName: string, key: string) {
const collection = this._collections.get(collectionName);
if (collection) {
collection.delete(String(key));
this.#saveToDiskDebounced();
}
}
clear(collectionName: string) {
this._collections.delete(collectionName);
this.#saveToDiskDebounced();
}
clearAll() {
this._collections.clear();
this.#saveToDiskDebounced();
// ... (428 more lines)
Domain
Subdomains
Classes
Dependencies
- ../../content/data-store.js
- ../assets/utils/resolveImports.js
- ../content/consts.js
- ../content/utils.js
- ../core/errors/index.js
- devalue
- modern
- node:fs
Source
Frequently Asked Questions
What does mutable-data-store.ts do?
mutable-data-store.ts is a source file in the astro codebase, written in typescript. It belongs to the ContentCollections domain, DataLoaders subdomain.
What functions are defined in mutable-data-store.ts?
mutable-data-store.ts defines 7 function(s): Array, assetImport, assets, fileName, id, key, opts.
What does mutable-data-store.ts depend on?
mutable-data-store.ts imports 8 module(s): ../../content/data-store.js, ../assets/utils/resolveImports.js, ../content/consts.js, ../content/utils.js, ../core/errors/index.js, devalue, modern, node:fs.
Where is mutable-data-store.ts in the architecture?
mutable-data-store.ts is located at packages/astro/src/content/mutable-data-store.ts (domain: ContentCollections, subdomain: DataLoaders, directory: packages/astro/src/content).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free