virtualAppEntrypoint() — astro Function Reference
Architecture documentation for the virtualAppEntrypoint() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD b2bae89a_d085_b9c2_98dc_af3099697799["virtualAppEntrypoint()"] d6b688a6_0829_7b32_b7bf_a47697dce0f3["index.ts"] b2bae89a_d085_b9c2_98dc_af3099697799 -->|defined in| d6b688a6_0829_7b32_b7bf_a47697dce0f3 0810e4f9_dbbe_5f5e_c908_9b85909deafe["getViteConfiguration()"] 0810e4f9_dbbe_5f5e_c908_9b85909deafe -->|calls| b2bae89a_d085_b9c2_98dc_af3099697799 style b2bae89a_d085_b9c2_98dc_af3099697799 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/vue/src/index.ts lines 37–107
function virtualAppEntrypoint(options?: Options): Plugin {
let isBuild: boolean;
let root: string;
let appEntrypoint: string | undefined;
return {
name: VIRTUAL_MODULE_ID,
config(_, { command }) {
isBuild = command === 'build';
},
configResolved(config) {
root = config.root;
if (options?.appEntrypoint) {
appEntrypoint = options.appEntrypoint.startsWith('.')
? path.resolve(root, options.appEntrypoint)
: options.appEntrypoint;
}
},
resolveId: {
filter: {
id: new RegExp(`^${VIRTUAL_MODULE_ID}$`),
},
handler() {
return RESOLVED_VIRTUAL_MODULE_ID;
},
},
load: {
filter: {
id: new RegExp(`^${RESOLVED_VIRTUAL_MODULE_ID}$`),
},
handler() {
if (appEntrypoint) {
return `\
export const setup = async (app) => {
const mod = await import(${JSON.stringify(appEntrypoint)});
if ('default' in mod) {
await mod.default(app);
} else {
${
!isBuild
? `console.warn("[@astrojs/vue] appEntrypoint \`" + ${JSON.stringify(
appEntrypoint,
)} + "\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.");`
: ''
}
}
}`;
}
return `export const setup = () => {};`;
},
},
// Ensure that Vue components reference appEntrypoint directly
// This allows Astro to associate global styles imported in this file
// with the pages they should be injected to
transform: {
filter: {
id: /\.vue$/,
},
handler(code) {
if (!appEntrypoint) return;
const s = new MagicString(code);
s.prepend(`import ${JSON.stringify(appEntrypoint)};\n`);
return {
code: s.toString(),
map: s.generateMap({ hires: 'boundary' }),
};
},
},
};
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does virtualAppEntrypoint() do?
virtualAppEntrypoint() is a function in the astro codebase, defined in packages/integrations/vue/src/index.ts.
Where is virtualAppEntrypoint() defined?
virtualAppEntrypoint() is defined in packages/integrations/vue/src/index.ts at line 37.
What calls virtualAppEntrypoint()?
virtualAppEntrypoint() is called by 1 function(s): getViteConfiguration.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free