genfs

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(path string) (*virtual.File, error)
	Set(path string, file *virtual.File) error
	Link(from string, toPatterns ...string) error
}

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

func (*Dir) DirGenerator

func (d *Dir) DirGenerator(path string, generator DirGenerator)

func (*Dir) ExternalGenerator

func (d *Dir) ExternalGenerator(path string, generator ExternalGenerator)

func (*Dir) FileGenerator

func (d *Dir) FileGenerator(path string, generator FileGenerator)

func (*Dir) FileServer

func (d *Dir) FileServer(path string, server FileServer)

func (*Dir) GenerateDir

func (d *Dir) GenerateDir(path string, fn func(fsys FS, dir *Dir) error)

func (*Dir) GenerateExternal

func (d *Dir) GenerateExternal(path string, fn func(fsys FS, file *External) error)

func (*Dir) GenerateFile

func (d *Dir) GenerateFile(path string, fn func(fsys FS, file *File) error)

func (*Dir) Mode

func (d *Dir) Mode() fs.FileMode

func (*Dir) Mount

func (d *Dir) Mount(mount fs.FS) error

func (*Dir) Path

func (d *Dir) Path() string

func (*Dir) Relative

func (d *Dir) Relative() string

func (*Dir) ServeFile

func (d *Dir) ServeFile(path string, fn func(fsys FS, file *File) error)

func (*Dir) Target

func (d *Dir) Target() string

type DirGenerator

type DirGenerator interface {
	GenerateDir(fsys FS, dir *Dir) error
}

type Embed

type Embed struct {
	Data []byte
}

func (*Embed) GenerateFile

func (e *Embed) GenerateFile(fsys FS, file *File) error

type External

type External struct {
	// contains filtered or unexported fields
}

func (*External) Mode

func (e *External) Mode() fs.FileMode

func (*External) Path

func (e *External) Path() string

func (*External) Target

func (e *External) Target() string

type ExternalGenerator

type ExternalGenerator interface {
	GenerateExternal(fsys FS, file *External) error
}

type FS

type FS interface {
	fs.FS
	fs.ReadDirFS
	fs.GlobFS
	Watch(patterns ...string) error
}

type File

type File struct {
	Data []byte
	// contains filtered or unexported fields
}

func (*File) Ext added in v0.2.8

func (f *File) Ext() string

Ext returns the extension to the target file path (e.g. `.svelte`)

func (*File) Mode

func (f *File) Mode() fs.FileMode

func (*File) Path

func (f *File) Path() string

func (*File) Relative

func (f *File) Relative() string

func (*File) Target

func (f *File) Target() string

type FileGenerator

type FileGenerator interface {
	GenerateFile(fsys FS, file *File) error
}

type FileServer

type FileServer interface {
	ServeFile(fsys FS, file *File) error
}

type FileSystem

type FileSystem struct {
	// contains filtered or unexported fields
}

func New

func New(cache Cache, fsys fs.FS, log log.Log) *FileSystem

func (*FileSystem) DirGenerator

func (f *FileSystem) DirGenerator(path string, generator DirGenerator)

func (*FileSystem) ExternalGenerator

func (f *FileSystem) ExternalGenerator(path string, generator ExternalGenerator)

func (*FileSystem) FileGenerator

func (f *FileSystem) FileGenerator(path string, generator FileGenerator)

func (*FileSystem) FileServer

func (f *FileSystem) FileServer(dir string, server FileServer)

func (*FileSystem) GenerateDir

func (f *FileSystem) GenerateDir(path string, fn func(fsys FS, dir *Dir) error)

func (*FileSystem) GenerateExternal

func (f *FileSystem) GenerateExternal(path string, fn func(fsys FS, file *External) error)

func (*FileSystem) GenerateFile

func (f *FileSystem) GenerateFile(path string, fn func(fsys FS, file *File) error)

func (*FileSystem) Open

func (f *FileSystem) Open(target string) (fs.File, error)

func (*FileSystem) ReadDir

func (f *FileSystem) ReadDir(target string) ([]fs.DirEntry, error)

func (*FileSystem) ServeFile

func (f *FileSystem) ServeFile(dir string, fn func(fsys FS, file *File) error)

type GenerateDir

type GenerateDir func(fsys FS, dir *Dir) error

func (GenerateDir) GenerateDir

func (fn GenerateDir) GenerateDir(fsys FS, dir *Dir) error

type GenerateFile

type GenerateFile func(fsys FS, file *File) error

func (GenerateFile) GenerateFile

func (fn GenerateFile) GenerateFile(fsys FS, file *File) error

type Generators

type Generators interface {
	GenerateFile(path string, fn func(fsys FS, file *File) error)
	FileGenerator(path string, generator FileGenerator)
	GenerateDir(path string, fn func(fsys FS, dir *Dir) error)
	DirGenerator(path string, generator DirGenerator)
	ServeFile(dir string, fn func(fsys FS, file *File) error)
	FileServer(dir string, server FileServer)
	GenerateExternal(path string, fn func(fsys FS, file *External) error)
	ExternalGenerator(path string, generator ExternalGenerator)
}

type ServeFile

type ServeFile func(fsys FS, file *File) error

func (ServeFile) ServeFile

func (fn ServeFile) ServeFile(fsys FS, file *File) error

Jump to

Keyboard shortcuts

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