Home / Function/ myPlugin() — astro Function Reference

myPlugin() — astro Function Reference

Architecture documentation for the myPlugin() function in my-plugin.mjs from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  3d9f2687_4d24_11d9_138b_50a5983a73d5["myPlugin()"]
  3a81e448_4868_dec4_05e0_b1387b26138e["my-plugin.mjs"]
  3d9f2687_4d24_11d9_138b_50a5983a73d5 -->|defined in| 3a81e448_4868_dec4_05e0_b1387b26138e
  style 3d9f2687_4d24_11d9_138b_50a5983a73d5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/virtual-astro-file/src/plugin/my-plugin.mjs lines 1–33

export default function myPlugin() {
	const pluginId = `@my-plugin/virtual.astro`;
	return {
		enforce: 'pre',
		name: 'virtual-astro-plugin',
		resolveId: {
			filter: {
				id: new RegExp(`^${pluginId}$`),
			},
			handler(id) {
				return id;
			},
		},
		load: {
			filter: {
				id: new RegExp(`^${pluginId}$`),
			},
			handler() {
				return `---
const works = true;
---
<h1 id="something">This is a virtual module id</h1>
<h2 id="works">{works}</h2>
<style>
  h1 {
		color: green;
	}
</style>
`;
			},
		},
	};
}

Subdomains

Frequently Asked Questions

What does myPlugin() do?
myPlugin() is a function in the astro codebase, defined in packages/astro/test/fixtures/virtual-astro-file/src/plugin/my-plugin.mjs.
Where is myPlugin() defined?
myPlugin() is defined in packages/astro/test/fixtures/virtual-astro-file/src/plugin/my-plugin.mjs at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free