server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// esm.sh build version
	VERSION = 78
)

Variables

This section is empty.

Functions

func Serve

func Serve(efs EmbedFS, fefs EmbedFS)

Serve serves ESM server

Types

type BuildOutput

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

type BuildQueue

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

A Queue for esbuild

func (*BuildQueue) Add

func (q *BuildQueue) Add(task *BuildTask) *BuildQueueConsumer

Add adds a new build task.

func (*BuildQueue) Len

func (q *BuildQueue) Len() int

Len returns the number of tasks of the queue.

func (*BuildQueue) RemoveConsumer

func (q *BuildQueue) RemoveConsumer(task *BuildTask, c *BuildQueueConsumer)

type BuildQueueConsumer

type BuildQueueConsumer struct {
	C chan BuildOutput
}

type BuildTask

type BuildTask struct {
	CdnOrigin    string            `json:"cdnOrigin"`
	BuildVersion int               `json:"buildVersion"`
	Pkg          Pkg               `json:"pkg"`
	Alias        map[string]string `json:"alias"`
	Deps         PkgSlice          `json:"deps"`
	Target       string            `json:"target"`
	BundleMode   bool              `json:"bundle"`
	NoRequire    bool              `json:"noRequire"`
	DevMode      bool              `json:"dev"`
	// contains filtered or unexported fields
}

func (*BuildTask) Build

func (task *BuildTask) Build() (esm *ModuleMeta, err error)

func (*BuildTask) CopyDTS

func (task *BuildTask) CopyDTS(dts string, buildVersion int) (n int, err error)

func (*BuildTask) ID

func (task *BuildTask) ID() string

type EmbedFS

type EmbedFS interface {
	ReadFile(name string) ([]byte, error)
}

type ModuleMeta

type ModuleMeta struct {
	Exports       []string `json:"-"`
	ExportDefault bool     `json:"d"`
	CJS           bool     `json:"c"`
	TypesOnly     bool     `json:"o"`
	Dts           string   `json:"t"`
	PackageCSS    bool     `json:"s"`
}

ESM defines the ES Module meta

type NSTask

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

type Node

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

Node defines the nodejs info

type NpmPackage

type NpmPackage struct {
	Name             string            `json:"name"`
	Version          string            `json:"version"`
	Main             string            `json:"main,omitempty"`
	Module           string            `json:"module,omitempty"`
	JsnextMain       string            `json:"jsnext:main,omitempty"`
	Es2015           string            `json:"es2015,omitempty"`
	Type             string            `json:"type,omitempty"`
	Types            string            `json:"types,omitempty"`
	Typings          string            `json:"typings,omitempty"`
	Dependencies     map[string]string `json:"dependencies,omitempty"`
	PeerDependencies map[string]string `json:"peerDependencies,omitempty"`
	DefinedExports   interface{}       `json:"exports,omitempty"`
}

NpmPackage defines the package.json of npm

type NpmPackageVerions

type NpmPackageVerions struct {
	DistTags map[string]string     `json:"dist-tags"`
	Versions map[string]NpmPackage `json:"versions"`
}

NpmPackageVerions defines versions of a npm package

type OldMeta

type OldMeta struct {
	*NpmPackage
	ExportDefault bool     `json:"exportDefault"`
	Exports       []string `json:"exports"`
	Dts           string   `json:"dts"`
	PackageCSS    bool     `json:"packageCSS"`
}

type Pkg

type Pkg struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	Submodule string `json:"submodule"`
}

func (Pkg) Equels

func (m Pkg) Equels(other Pkg) bool

func (Pkg) ImportPath

func (m Pkg) ImportPath() string

func (Pkg) String

func (m Pkg) String() string

type PkgSlice

type PkgSlice []Pkg

sortable pkg slice

func (PkgSlice) Get

func (a PkgSlice) Get(name string) (Pkg, bool)

func (PkgSlice) Has

func (a PkgSlice) Has(name string) bool

func (PkgSlice) Len

func (a PkgSlice) Len() int

func (PkgSlice) Less

func (a PkgSlice) Less(i, j int) bool

func (PkgSlice) String

func (a PkgSlice) String() string

func (PkgSlice) Swap

func (a PkgSlice) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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