loader

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: AGPL-3.0 Imports: 16 Imported by: 5

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 added in v0.25.0

func CreateFilesystems(osfs fsext.Fs) map[string]fsext.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 added in v0.25.0

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]fsext.Fs, moduleSpecifier *url.URL, originalModuleSpecifier string,
) (*SourceData, error)

Load loads the provided moduleSpecifier from the given filesystems which are map of fsext.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 added in v0.25.0

func ReadSource(
	logger logrus.FieldLogger, src, pwd string, filesystems map[string]fsext.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