Home / File/ vite-plugin-actions.ts — astro Source File

vite-plugin-actions.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 10 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  c764e5f3_4c84_7ed2_850a_416ea85094cd["vite-plugin-actions.ts"]
  1ddffc51_ee9d_5b0c_968e_331983e95ff4["../core/build/internal.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 1ddffc51_ee9d_5b0c_968e_331983e95ff4
  e099eff3_3f90_76ac_3751_a9ff5a6b8f25["../../core/build/types.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> e099eff3_3f90_76ac_3751_a9ff5a6b8f25
  c396bb1c_7eee_221a_d665_5744d13dc23f["../core/build/util.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> c396bb1c_7eee_221a_d665_5744d13dc23f
  8651c206_171a_4a48_b04b_b47f5573b5da["../prerender/utils.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 8651c206_171a_4a48_b04b_b47f5573b5da
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  9f5b84fa_f8a8_ed7f_2a86_7ecc740bf1d4["../actions/consts.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 9f5b84fa_f8a8_ed7f_2a86_7ecc740bf1d4
  0dff10e7_1ebb_867f_8463_a5e280d1ba90["../actions/utils.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 0dff10e7_1ebb_867f_8463_a5e280d1ba90
  7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"]
  c764e5f3_4c84_7ed2_850a_416ea85094cd --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7
  style c764e5f3_4c84_7ed2_850a_416ea85094cd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type fsMod from 'node:fs';
import type { Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from '../core/build/internal.js';
import type { StaticBuildOptions } from '../core/build/types.js';
import { shouldAppendForwardSlash } from '../core/build/util.js';
import { getServerOutputDirectory } from '../prerender/utils.js';
import type { AstroSettings } from '../types/astro.js';
import {
	ACTIONS_ENTRYPOINT_VIRTUAL_MODULE_ID,
	ACTIONS_RESOLVED_ENTRYPOINT_VIRTUAL_MODULE_ID,
	OPTIONS_VIRTUAL_MODULE_ID,
	RESOLVED_NOOP_ENTRYPOINT_VIRTUAL_MODULE_ID,
	RESOLVED_OPTIONS_VIRTUAL_MODULE_ID,
	RESOLVED_VIRTUAL_MODULE_ID,
	VIRTUAL_MODULE_ID,
} from './consts.js';
import { isActionsFilePresent } from './utils.js';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';

/**
 * This plugin is used to retrieve the final entry point of the bundled actions.ts file
 * @param opts
 * @param internals
 */
export function vitePluginActionsBuild(
	opts: StaticBuildOptions,
	internals: BuildInternals,
): VitePlugin {
	return {
		name: '@astro/plugin-actions-build',

		applyToEnvironment(environment) {
			return (
				environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr ||
				environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ||
				environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro
			);
		},

		writeBundle(_, bundle) {
			for (const [chunkName, chunk] of Object.entries(bundle)) {
				if (
					chunk.type !== 'asset' &&
					chunk.facadeModuleId === ACTIONS_RESOLVED_ENTRYPOINT_VIRTUAL_MODULE_ID
				) {
					const outputDirectory = getServerOutputDirectory(opts.settings);
					internals.astroActionsEntryPoint = new URL(chunkName, outputDirectory);
				}
			}
		},
	};
}

export function vitePluginActions({
	fs,
	settings,
}: {
	fs: typeof fsMod;
	settings: AstroSettings;
}): VitePlugin {
// ... (82 more lines)

Domain

Subdomains

Dependencies

  • ../../core/build/types.js
  • ../actions/consts.js
  • ../actions/utils.js
  • ../core/build/internal.js
  • ../core/build/util.js
  • ../core/constants.js
  • ../prerender/utils.js
  • ../types/astro.js
  • node:fs
  • vite

Frequently Asked Questions

What does vite-plugin-actions.ts do?
vite-plugin-actions.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in vite-plugin-actions.ts?
vite-plugin-actions.ts defines 2 function(s): vitePluginActions, vitePluginActionsBuild.
What does vite-plugin-actions.ts depend on?
vite-plugin-actions.ts imports 10 module(s): ../../core/build/types.js, ../actions/consts.js, ../actions/utils.js, ../core/build/internal.js, ../core/build/util.js, ../core/constants.js, ../prerender/utils.js, ../types/astro.js, and 2 more.
Where is vite-plugin-actions.ts in the architecture?
vite-plugin-actions.ts is located at packages/astro/src/actions/vite-plugin-actions.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/actions).

Analyze Your Own Codebase

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

Try Supermodel Free