runtime

package
v0.0.401 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NODE_BUILTINS = map[string]bool{
	"assert":              true,
	"async_hooks":         true,
	"buffer":              true,
	"child_process":       true,
	"cluster":             true,
	"console":             true,
	"constants":           true,
	"crypto":              true,
	"dgram":               true,
	"diagnostics_channel": true,
	"dns":                 true,
	"domain":              true,
	"events":              true,
	"fs":                  true,
	"http":                true,
	"http2":               true,
	"https":               true,
	"inspector":           true,
	"module":              true,
	"net":                 true,
	"os":                  true,
	"path":                true,
	"perf_hooks":          true,
	"process":             true,
	"punycode":            true,
	"querystring":         true,
	"readline":            true,
	"repl":                true,
	"stream":              true,
	"string_decoder":      true,
	"sys":                 true,
	"timers":              true,
	"tls":                 true,
	"trace_events":        true,
	"tty":                 true,
	"url":                 true,
	"util":                true,
	"v8":                  true,
	"vm":                  true,
	"wasi":                true,
	"worker_threads":      true,
	"zlib":                true,
}
View Source
var NODE_EXTENSIONS = []string{".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"}

Functions

func ShouldRebuild

func ShouldRebuild(runtime string, functionID string, file string) bool

Types

type BuildInput

type BuildInput struct {
	Warp    project.Warp
	Project *project.Project
	Dev     bool
}

func (*BuildInput) Out

func (input *BuildInput) Out() string

type BuildOutput

type BuildOutput struct {
	Out     string
	Handler string
	Errors  []string
}

func Build

func Build(ctx context.Context, input *BuildInput) (*BuildOutput, error)

type NodeProperties

type NodeProperties struct {
	Loader    map[string]string `json:"loader"`
	Install   []string
	Banner    string
	ESBuild   esbuild.BuildOptions `json:"esbuild"`
	Minify    bool                 `json:"minify"`
	Format    string               `json:"format"`
	SourceMap bool                 `json:"sourceMap"`
	Splitting bool                 `json:"splitting"`
}

type NodeRuntime

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

func (*NodeRuntime) Build

func (r *NodeRuntime) Build(ctx context.Context, input *BuildInput) (*BuildOutput, error)

func (*NodeRuntime) Match

func (r *NodeRuntime) Match(runtime string) bool

func (*NodeRuntime) Run

func (r *NodeRuntime) Run(ctx context.Context, input *RunInput) (Worker, error)

func (*NodeRuntime) ShouldRebuild

func (r *NodeRuntime) ShouldRebuild(functionID string, file string) bool

type NodeWorker

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

func (*NodeWorker) Logs

func (w *NodeWorker) Logs() io.ReadCloser

func (*NodeWorker) Stop

func (w *NodeWorker) Stop()

type RunInput

type RunInput struct {
	Project    *project.Project
	Warp       project.Warp
	Links      project.Links
	Server     string
	FunctionID string
	WorkerID   string
	Runtime    string
	Build      *BuildOutput
	Env        []string
}

type Runtime

type Runtime interface {
	Match(runtime string) bool
	Build(ctx context.Context, input *BuildInput) (*BuildOutput, error)
	Run(ctx context.Context, input *RunInput) (Worker, error)
	ShouldRebuild(functionID string, path string) bool
}

func GetRuntime

func GetRuntime(input string) (Runtime, bool)

type Worker

type Worker interface {
	Stop()
	Logs() io.ReadCloser
}

func Run

func Run(ctx context.Context, input *RunInput) (Worker, error)

type WorkerProperties added in v0.0.257

type WorkerProperties struct {
	AccountID  string         `json:"accountID"`
	ScriptName string         `json:"scriptName"`
	Build      NodeProperties `json:"build"`
}

type WorkerRuntime added in v0.0.257

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

func (*WorkerRuntime) Build added in v0.0.257

func (w *WorkerRuntime) Build(ctx context.Context, input *BuildInput) (*BuildOutput, error)

func (*WorkerRuntime) Match added in v0.0.257

func (w *WorkerRuntime) Match(runtime string) bool

func (*WorkerRuntime) Run added in v0.0.257

func (r *WorkerRuntime) Run(ctx context.Context, input *RunInput) (Worker, error)

func (*WorkerRuntime) ShouldRebuild added in v0.0.257

func (r *WorkerRuntime) ShouldRebuild(functionID string, file string) bool

Jump to

Keyboard shortcuts

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