Home / Function/ createPlugin() — astro Function Reference

createPlugin() — astro Function Reference

Architecture documentation for the createPlugin() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  8ba3e243_b8fa_126b_ca4d_207f806fd142["createPlugin()"]
  55004deb_f74c_122b_7d00_ae962d3aa84d["index.ts"]
  8ba3e243_b8fa_126b_ca4d_207f806fd142 -->|defined in| 55004deb_f74c_122b_7d00_ae962d3aa84d
  18d2d7c0_36dd_9d77_a834_f2ea1ea1c40b["virtualEntrypoint()"]
  8ba3e243_b8fa_126b_ca4d_207f806fd142 -->|calls| 18d2d7c0_36dd_9d77_a834_f2ea1ea1c40b
  style 8ba3e243_b8fa_126b_ca4d_207f806fd142 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/alpinejs/src/index.ts lines 94–117

export default function createPlugin(options?: Options): AstroIntegration {
	return {
		name: '@astrojs/alpinejs',
		hooks: {
			'astro:config:setup': ({ injectScript, updateConfig }) => {
				// This gets injected into the user's page, so the import will pull
				// from the project's version of Alpine.js in their package.json.
				injectScript(
					'page',
					`import Alpine from 'alpinejs';
import { setup } from 'virtual:@astrojs/alpinejs/entrypoint';
setup(Alpine);
window.Alpine = Alpine;
document.addEventListener('DOMContentLoaded', () => Alpine.start());`,
				);
				updateConfig({
					vite: {
						plugins: [virtualEntrypoint(options)],
					},
				});
			},
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does createPlugin() do?
createPlugin() is a function in the astro codebase, defined in packages/integrations/alpinejs/src/index.ts.
Where is createPlugin() defined?
createPlugin() is defined in packages/integrations/alpinejs/src/index.ts at line 94.
What does createPlugin() call?
createPlugin() calls 1 function(s): virtualEntrypoint.

Analyze Your Own Codebase

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

Try Supermodel Free