compile.ts — astro Source File
Architecture documentation for compile.ts, a typescript file in the astro codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a1b2a752_beb5_d4f4_ce1d_6f9443e365d3["compile.ts"] 7653db5d_041a_9bc3_ee8f_644afc1eecba["../core/compile/index.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> 7653db5d_041a_9bc3_ee8f_644afc1eecba d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> d3861967_b647_84d2_ff48_15013353bd56 c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> c32d12e2_d85e_28c0_eea7_9b29629857e0 87530382_6d99_2339_182d_074e3de33bc8["../vite-plugin-utils/index.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> 87530382_6d99_2339_182d_074e3de33bc8 578ea01d_496b_3b43_98f2_7b2f0ce78d7e["../vite-plugin-astro/types.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> 578ea01d_496b_3b43_98f2_7b2f0ce78d7e d25683f6_6ac0_f5eb_b4b1_ac7cda6eb3c8["./utils.js"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> d25683f6_6ac0_f5eb_b4b1_ac7cda6eb3c8 263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"] a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7 style a1b2a752_beb5_d4f4_ce1d_6f9443e365d3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type ESBuildTransformResult, transformWithEsbuild } from 'vite';
import { type CompileProps, type CompileResult, compile } from '../core/compile/index.js';
import type { Logger } from '../core/logger/core.js';
import type { AstroConfig } from '../types/public/config.js';
import { getFileInfo } from '../vite-plugin-utils/index.js';
import type { CompileMetadata } from './types.js';
import { frontmatterRE } from './utils.js';
interface CompileAstroOption {
compileProps: CompileProps;
astroFileToCompileMetadata: Map<string, CompileMetadata>;
logger: Logger;
}
export interface CompileAstroResult extends Omit<CompileResult, 'map'> {
map: ESBuildTransformResult['map'];
}
interface EnhanceCompilerErrorOptions {
err: Error;
id: string;
source: string;
config: AstroConfig;
logger: Logger;
}
export async function compileAstro({
compileProps,
astroFileToCompileMetadata,
logger,
}: CompileAstroOption): Promise<CompileAstroResult> {
let transformResult: CompileResult;
let esbuildResult: ESBuildTransformResult;
try {
transformResult = await compile(compileProps);
// Compile all TypeScript to JavaScript.
// Also, catches invalid JS/TS in the compiled output before returning.
esbuildResult = await transformWithEsbuild(transformResult.code, compileProps.filename, {
...compileProps.viteConfig.esbuild,
loader: 'ts',
sourcemap: 'external',
tsconfigRaw: {
compilerOptions: {
// Ensure client:only imports are treeshaken
verbatimModuleSyntax: false,
importsNotUsedAsValues: 'remove',
},
},
});
} catch (err: any) {
await enhanceCompileError({
err,
id: compileProps.filename,
source: compileProps.source,
config: compileProps.astroConfig,
logger: logger,
});
throw err;
}
// ... (78 more lines)
Domain
Subdomains
Functions
Dependencies
- ../core/compile/index.js
- ../core/logger/core.js
- ../types/public/config.js
- ../vite-plugin-astro/types.js
- ../vite-plugin-utils/index.js
- ./utils.js
- vite
Source
Frequently Asked Questions
What does compile.ts do?
compile.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 compile.ts?
compile.ts defines 2 function(s): compileAstro, enhanceCompileError.
What does compile.ts depend on?
compile.ts imports 7 module(s): ../core/compile/index.js, ../core/logger/core.js, ../types/public/config.js, ../vite-plugin-astro/types.js, ../vite-plugin-utils/index.js, ./utils.js, vite.
Where is compile.ts in the architecture?
compile.ts is located at packages/astro/src/vite-plugin-astro/compile.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-astro).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free