plugin

package
v0.13.8-0...-a8de8dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HoudiniCore

type HoudiniCore struct {
	plugins.Plugin[config.PluginConfig]
}

func (*HoudiniCore) AfterExtract

func (p *HoudiniCore) AfterExtract(ctx context.Context) error

AfterExtract is called after all of the plugins have added their documents to the project. We'll use this plugin to parse each document and load it into the database.

func (*HoudiniCore) AfterValidate

func (p *HoudiniCore) AfterValidate(ctx context.Context) error

func (*HoudiniCore) BeforeValidate

func (p *HoudiniCore) BeforeValidate(ctx context.Context) error

BeforeValidate removes generated documents before validation runs. On a fresh database this is (almost) a no-op: generation (list operations, pagination variants, refetch queries, argument variants) happens in AfterValidate, after every rule has already run. But long-lived databases (the language server, the dev server's HMR loop) re-validate with the previous run's generated documents still present, and the validation rules were never designed to see them: a @plural fragment spread copied into a list operation fragment sits at the document root, a pagination variant carries its arguments as variables, and both produce phantom errors attributed to the user's file. Deleting them here restores the fresh-run invariant; AfterValidate recreates them from the validated state.

Two exceptions to "delete everything generated":

  • inline component-field fragments are created at load time (AfterExtract), not by AfterValidate — deleting them would leave the selections that TransformFields rewrites pointing at nothing
  • on task-scoped runs, other files' generated documents must survive: only the task's documents get regenerated afterwards

func (*HoudiniCore) Environment

func (p *HoudiniCore) Environment(mode string) (map[string]string, error)

func (*HoudiniCore) ExtractDocuments

func (p *HoudiniCore) ExtractDocuments(
	ctx context.Context,
	input plugins.ExtractDocumentsInput,
) error

ExtractDocuments is responsible for walking down the project directory structure and extracting the raw graphql documents from the files. These files will be parsed in a later step to allow for other plugins to find additional documents we don't know about

func (*HoudiniCore) GenerateDocuments

func (p *HoudiniCore) GenerateDocuments(ctx context.Context) ([]string, error)

func (*HoudiniCore) GenerateRuntime

func (p *HoudiniCore) GenerateRuntime(ctx context.Context) ([]string, error)

func (*HoudiniCore) IncludeRuntime

func (p *HoudiniCore) IncludeRuntime(ctx context.Context) (string, error)

func (*HoudiniCore) Name

func (p *HoudiniCore) Name() string

func (*HoudiniCore) Order

func (p *HoudiniCore) Order() plugins.PluginOrder

func (*HoudiniCore) Schema

func (p *HoudiniCore) Schema(ctx context.Context) error

The core plugin is responsible for parsing the users schrma file and loading it into the database

func (*HoudiniCore) TransformRuntime

func (p *HoudiniCore) TransformRuntime(
	ctx context.Context,
	filepath string,
	content string,
) (string, error)

func (*HoudiniCore) Validate

func (p *HoudiniCore) Validate(ctx context.Context) error

type RuleFunc

type RuleFunc = func(ctx context.Context, db plugins.DatabasePool[config.PluginConfig], errs *plugins.ErrorList)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL