loader

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package loader is about loading files from either the filesystem or through https requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFilesystems

func CreateFilesystems(osfs afero.Fs) map[string]afero.Fs

CreateFilesystems creates the correct filesystem map for the current OS

func Dir

func Dir(old *url.URL) *url.URL

Dir returns the directory for the path.

func Resolve

func Resolve(pwd *url.URL, moduleSpecifier string) (*url.URL, error)

Resolve a relative path to an absolute one.

Types

type SourceData

type SourceData struct {
	Data []byte
	URL  *url.URL
}

SourceData wraps a source file; data and filename.

func Load

func Load(
	logger logrus.FieldLogger, filesystems map[string]afero.Fs, moduleSpecifier *url.URL, originalModuleSpecifier string,
) (*SourceData, error)

Load loads the provided moduleSpecifier from the given filesystems which are map of afero.Fs for a given scheme which is they key of the map. If the scheme is https then a request will be made if the files is not found in the map and written to the map.

func ReadSource

func ReadSource(
	logger logrus.FieldLogger, src, pwd string, filesystems map[string]afero.Fs, stdin io.Reader,
) (*SourceData, error)

ReadSource Reads a source file from any supported destination.

Jump to

Keyboard shortcuts

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