vite-plugin-content-assets.ts — astro Source File
Architecture documentation for vite-plugin-content-assets.ts, a typescript file in the astro codebase. 18 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff["vite-plugin-content-assets.ts"] 617c63d5_1302_acd7_3e75_06534fb7e782["../../assets/utils/getAssetsPrefix.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> 617c63d5_1302_acd7_3e75_06534fb7e782 a4f2698c_5256_262a_ba7c_f72b51878d10["../core/app/types.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> a4f2698c_5256_262a_ba7c_f72b51878d10 7e4494c0_5563_4329_1bff_a84be66e1bc2["../core/path.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> 7e4494c0_5563_4329_1bff_a84be66e1bc2 1ddffc51_ee9d_5b0c_968e_331983e95ff4["../core/build/internal.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> 1ddffc51_ee9d_5b0c_968e_331983e95ff4 f67ebbc0_ff1e_652d_46a3_bdd9ce42c5b6["../core/build/static-build.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> f67ebbc0_ff1e_652d_46a3_bdd9ce42c5b6 ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> f68003f1_292f_ca44_03ce_21af87a33c7b e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> e9b74c5a_8d34_34a7_e196_5e41b87214aa efa645f9_2724_da8e_6cfc_0fef8f15e226["../vite-plugin-astro-server/util.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> efa645f9_2724_da8e_6cfc_0fef8f15e226 fde1d0cd_5fc0_0be4_88d8_2707f2b10bc5["./vite.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> fde1d0cd_5fc0_0be4_88d8_2707f2b10bc5 eb7ca709_080c_a438_b9d7_f1238835779d["../content/consts.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> eb7ca709_080c_a438_b9d7_f1238835779d 520c567a_b741_f105_70ac_c637eacc7f83["../content/utils.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> 520c567a_b741_f105_70ac_c637eacc7f83 7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b f202f4fa_f9f9_9398_9510_7a42ce8ea007["../environments.js"] 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff --> f202f4fa_f9f9_9398_9510_7a42ce8ea007 style 7a46444b_6633_b7e5_30ac_f5b4aa6a43ff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { extname } from 'node:path';
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
import type { AssetsPrefix } from '../core/app/types.js';
import { fileExtension } from '../core/path.js';
import { fileURLToPath } from 'node:url';
import { isRunnableDevEnvironment, type Plugin, type RunnableDevEnvironment } from 'vite';
import type { BuildInternals } from '../core/build/internal.js';
import type { ExtractedChunk } from '../core/build/static-build.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { wrapId } from '../core/util.js';
import type { AstroSettings } from '../types/astro.js';
import { isBuildableCSSRequest } from '../vite-plugin-astro-server/util.js';
import { crawlGraph } from '../vite-plugin-astro-server/vite.js';
import {
CONTENT_IMAGE_FLAG,
CONTENT_RENDER_FLAG,
LINKS_PLACEHOLDER,
PROPAGATED_ASSET_FLAG,
STYLES_PLACEHOLDER,
} from './consts.js';
import { hasContentFlag } from './utils.js';
import { joinPaths, prependForwardSlash, slash } from '@astrojs/internal-helpers/path';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';
import { isAstroServerEnvironment } from '../environments.js';
export function astroContentAssetPropagationPlugin({
settings,
}: {
settings: AstroSettings;
}): Plugin {
let environment: RunnableDevEnvironment | undefined = undefined;
return {
name: 'astro:content-asset-propagation',
enforce: 'pre',
resolveId: {
filter: {
id: new RegExp(`(?:\\?|&)(?:${CONTENT_IMAGE_FLAG}|${CONTENT_RENDER_FLAG})(?:&|=|$)`),
},
async handler(id, importer, opts) {
if (hasContentFlag(id, CONTENT_IMAGE_FLAG)) {
const [base, query] = id.split('?');
const params = new URLSearchParams(query);
const importerParam = params.get('importer');
const importerPath = importerParam
? fileURLToPath(new URL(importerParam, settings.config.root))
: importer;
const resolved = await this.resolve(base, importerPath, { skipSelf: true, ...opts });
if (!resolved) {
throw new AstroError({
...AstroErrorData.ImageNotFound,
message: AstroErrorData.ImageNotFound.message(base),
});
}
return resolved;
}
if (hasContentFlag(id, CONTENT_RENDER_FLAG)) {
const base = id.split('?')[0];
// ... (218 more lines)
Domain
Subdomains
Types
Dependencies
- ../../assets/utils/getAssetsPrefix.js
- ../content/consts.js
- ../content/utils.js
- ../core/app/types.js
- ../core/build/internal.js
- ../core/build/static-build.js
- ../core/constants.js
- ../core/errors/index.js
- ../core/path.js
- ../core/util.js
- ../environments.js
- ../types/astro.js
- ../vite-plugin-astro-server/util.js
- ./vite.js
- node:path
- node:url
- path
- vite
Source
Frequently Asked Questions
What does vite-plugin-content-assets.ts do?
vite-plugin-content-assets.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-assets.ts?
vite-plugin-content-assets.ts defines 3 function(s): astroContentAssetPropagationPlugin, contentAssetsBuildPostHook, getStylesForURL.
What does vite-plugin-content-assets.ts depend on?
vite-plugin-content-assets.ts imports 18 module(s): ../../assets/utils/getAssetsPrefix.js, ../content/consts.js, ../content/utils.js, ../core/app/types.js, ../core/build/internal.js, ../core/build/static-build.js, ../core/constants.js, ../core/errors/index.js, and 10 more.
Where is vite-plugin-content-assets.ts in the architecture?
vite-plugin-content-assets.ts is located at packages/astro/src/content/vite-plugin-content-assets.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