Home / File/ vite-plugin-content-imports.ts — astro Source File

vite-plugin-content-imports.ts — astro Source File

Architecture documentation for vite-plugin-content-imports.ts, a typescript file in the astro codebase. 16 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  157f6669_1b64_2b6d_ca39_b0f784c87ad2["vite-plugin-content-imports.ts"]
  7736b52f_fbd9_8cde_2cdd_bef67918c9e4["../assets/utils/proxy.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> 7736b52f_fbd9_8cde_2cdd_bef67918c9e4
  dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f["../../core/errors/errors.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> d3861967_b647_84d2_ff48_15013353bd56
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  7f07e12d_4af0_1918_f31b_31410b415993["../types/public/content.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> 7f07e12d_4af0_1918_f31b_31410b415993
  eb7ca709_080c_a438_b9d7_f1238835779d["../content/consts.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> eb7ca709_080c_a438_b9d7_f1238835779d
  520c567a_b741_f105_70ac_c637eacc7f83["../content/utils.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> 520c567a_b741_f105_70ac_c637eacc7f83
  7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  ca52ff61_c81f_c2ca_81b6_5a678b65fd31["devalue"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2 --> ca52ff61_c81f_c2ca_81b6_5a678b65fd31
  style 157f6669_1b64_2b6d_ca39_b0f784c87ad2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type fsMod from 'node:fs';
import { extname } from 'node:path';
import { pathToFileURL } from 'node:url';
import * as devalue from 'devalue';
import type { PluginContext } from 'rollup';
import type { Plugin, RunnableDevEnvironment } from 'vite';
import { getProxyCode } from '../assets/utils/proxy.js';
import { AstroError } from '../core/errors/errors.js';
import { AstroErrorData } from '../core/errors/index.js';
import type { Logger } from '../core/logger/core.js';
import type { AstroSettings } from '../types/astro.js';
import type { AstroConfig } from '../types/public/config.js';
import type {
	ContentEntryModule,
	ContentEntryType,
	DataEntryModule,
	DataEntryType,
} from '../types/public/content.js';
import { CONTENT_FLAG, DATA_FLAG } from './consts.js';
import {
	type ContentConfig,
	getContentEntryExts,
	getContentEntryIdAndSlug,
	getContentPaths,
	getDataEntryExts,
	getDataEntryId,
	getEntryCollectionName,
	getEntryConfigByExtMap,
	getEntryData,
	getEntryType,
	getSymlinkedContentCollections,
	globalContentConfigObserver,
	hasContentFlag,
	parseEntrySlug,
	reloadContentConfigObserver,
	reverseSymlink,
} from './utils.js';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';

function getContentRendererByViteId(
	viteId: string,
	settings: Pick<AstroSettings, 'contentEntryTypes'>,
): ContentEntryType['getRenderModule'] | undefined {
	let ext = viteId.split('.').pop();
	if (!ext) return undefined;
	for (const contentEntryType of settings.contentEntryTypes) {
		if (
			Boolean(contentEntryType.getRenderModule) &&
			contentEntryType.extensions.includes('.' + ext)
		) {
			return contentEntryType.getRenderModule;
		}
	}
	return undefined;
}

const CHOKIDAR_MODIFIED_EVENTS = ['add', 'unlink', 'change'];
/**
 * If collection entries change, import modules need to be invalidated.
 * Reasons why:
// ... (377 more lines)

Subdomains

Dependencies

  • ../../core/errors/errors.js
  • ../assets/utils/proxy.js
  • ../content/consts.js
  • ../content/utils.js
  • ../core/constants.js
  • ../core/errors/index.js
  • ../core/logger/core.js
  • ../types/astro.js
  • ../types/public/config.js
  • ../types/public/content.js
  • devalue
  • node:fs
  • node:path
  • node:url
  • rollup
  • vite

Frequently Asked Questions

What does vite-plugin-content-imports.ts do?
vite-plugin-content-imports.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 vite-plugin-content-imports.ts?
vite-plugin-content-imports.ts defines 7 function(s): astroContentImportPlugin, getContentConfigFromGlobal, getContentEntryModule, getContentRendererByViteId, getDataEntryModule, getEntryModuleBaseInfo, stringifyEntryData.
What does vite-plugin-content-imports.ts depend on?
vite-plugin-content-imports.ts imports 16 module(s): ../../core/errors/errors.js, ../assets/utils/proxy.js, ../content/consts.js, ../content/utils.js, ../core/constants.js, ../core/errors/index.js, ../core/logger/core.js, ../types/astro.js, and 8 more.
Where is vite-plugin-content-imports.ts in the architecture?
vite-plugin-content-imports.ts is located at packages/astro/src/content/vite-plugin-content-imports.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