Documentation
¶
Index ¶
- Constants
- Variables
- func Start()
- type AllowList
- type BanList
- type BanScope
- type BuildArgs
- type BuildContext
- type BuildEntry
- type BuildMeta
- type BuildMetaDB
- type BuildOutput
- type BuildQueue
- type BuildTask
- type BundleMode
- type Config
- type Database
- type DiskStatus
- type EsmPath
- type GitRef
- type LandingPageOptions
- type LegacyBuildMeta
- type LoaderOutput
- type NpmRC
- type NpmRegistry
- type NpmRegistryConfig
- type Ref
- type ResolvedTransformOptions
- type RouteKind
- type Stat
- type TransformOptions
- type TransformOutput
- type TsImportKind
Constants ¶
const DEBUG = false
production mode
const (
MB = 1 << 20
)
Variables ¶
var VERSION = "v137"
may be changed by `-ldflags`
Functions ¶
Types ¶
type AllowList ¶
func (*AllowList) IsPackageAllowed ¶
IsPackageAllowed Checking if the package is allowed. The `packages` list is the highest priority allow rule to match, so the `includes` list in the `scopes` list won't take effect if the package is allowed in `packages` list
type BanList ¶
func (*BanList) IsPackageBanned ¶
IsPackageBanned Checking if the package is banned. The `packages` list is the highest priority ban rule to match, so the `excludes` list in the `scopes` list won't take effect if the package is banned in `packages` list
type BuildContext ¶
type BuildContext struct {
// contains filtered or unexported fields
}
func (*BuildContext) Build ¶
func (ctx *BuildContext) Build(buildCtx context.Context) (meta *BuildMeta, err error)
func (*BuildContext) Context ¶
func (ctx *BuildContext) Context() context.Context
func (*BuildContext) Exists ¶
func (ctx *BuildContext) Exists() (meta *BuildMeta, ok bool, err error)
func (*BuildContext) Path ¶
func (ctx *BuildContext) Path() string
type BuildEntry ¶
type BuildEntry struct {
// contains filtered or unexported fields
}
BuildEntry represents the build entrypoints of a module
type BuildMetaDB ¶
type BuildMetaDB struct {
// contains filtered or unexported fields
}
func NewBuildMetaDB ¶
func NewBuildMetaDB(backStorage storage.Storage) *BuildMetaDB
func (*BuildMetaDB) Delete ¶
func (storage *BuildMetaDB) Delete(key string) (err error)
type BuildOutput ¶
type BuildOutput struct {
// contains filtered or unexported fields
}
type BuildQueue ¶
type BuildQueue struct {
// contains filtered or unexported fields
}
BuildQueue schedules build tasks of esm.sh
func NewBuildQueue ¶
func NewBuildQueue(concurrency int) *BuildQueue
func (*BuildQueue) Add ¶
func (q *BuildQueue) Add(ctx *BuildContext) chan BuildOutput
Add adds a new build task to the queue.
func (*BuildQueue) Snapshot ¶
func (q *BuildQueue) Snapshot() []map[string]any
type BundleMode ¶
type BundleMode uint8
const ( BundleDefault BundleMode = iota BundleDeps BundleFalse )
type Config ¶
type Config struct {
Port uint16 `json:"port"`
TlsPort uint16 `json:"tlsPort"`
CustomLandingPage LandingPageOptions `json:"customLandingPage"`
WorkDir string `json:"workDir"`
CorsAllowOrigins []string `json:"corsAllowOrigins"`
AllowList AllowList `json:"allowList"`
BanList BanList `json:"banList"`
BuildConcurrency uint16 `json:"buildConcurrency"`
BuildWaitTime uint16 `json:"buildWaitTime"`
BuildTimeout uint16 `json:"buildTimeout"`
Storage storage.StorageOptions `json:"storage"`
LogDir string `json:"logDir"`
LogLevel string `json:"logLevel"`
AccessLog bool `json:"accessLog"`
NpmRegistry string `json:"npmRegistry"`
NpmBackupRegistry string `json:"npmBackupRegistry"`
NpmToken string `json:"npmToken"`
NpmUser string `json:"npmUser"`
NpmPassword string `json:"npmPassword"`
NpmScopedRegistries map[string]NpmRegistryConfig `json:"npmScopedRegistries"`
NpmQueryCacheTTL uint32 `json:"npmQueryCacheTTL"`
MinifyRaw json.RawMessage `json:"minify"`
SourceMapRaw json.RawMessage `json:"sourceMap"`
CompressRaw json.RawMessage `json:"compress"`
Minify bool `json:"-"`
SourceMap bool `json:"-"`
Compress bool `json:"-"`
}
Config represents the configuration of esm.sh server.
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
LoadConfig loads config from the given file. Panic if failed to load.
type Database ¶
type Database interface {
Get(key string) (value []byte, err error)
Put(key string, value []byte) (err error)
Delete(key string) (err error)
Close() (err error)
}
deprecated
func OpenBoltDB ¶
type DiskStatus ¶
type DiskStatus uint8
const ( DiskStatusError DiskStatus = iota DiskStatusOk DiskStatusLow DiskStatusFull )
type LandingPageOptions ¶
type LegacyBuildMeta ¶
type LoaderOutput ¶
type NpmRC ¶
type NpmRC struct {
// contains filtered or unexported fields
}
func DefaultNpmRC ¶
func DefaultNpmRC() *NpmRC
type NpmRegistry ¶
type NpmRegistry struct {
NpmRegistryConfig
// contains filtered or unexported fields
}
type NpmRegistryConfig ¶
type ResolvedTransformOptions ¶
type ResolvedTransformOptions struct {
TransformOptions
// contains filtered or unexported fields
}
type TransformOptions ¶
type TransformOptions struct {
Filename string `json:"filename"`
Lang string `json:"lang"`
Code string `json:"code"`
ImportMapRaw json.RawMessage `json:"importMap"`
JSXImportSource string `json:"jsxImportSource"`
Target string `json:"target"`
SourceMap string `json:"sourceMap"`
Minify bool `json:"minify"`
}
type TransformOutput ¶
type TsImportKind ¶
type TsImportKind uint8
const ( TsReferenceTypes TsImportKind = iota TsReferencePath TsImportDecl TsImportCall TsDeclareModule )
Source Files
¶
- build.go
- build_analyzer.go
- build_args.go
- build_meta.go
- build_queue.go
- build_resolver.go
- build_rewriter.go
- build_target.go
- cache.go
- cjs_module_lexer.go
- config.go
- consts.go
- db.go
- db_bolt.go
- disk.go
- dts_lexer.go
- dts_transform.go
- git.go
- legacy_router.go
- loader.go
- loader_implements.go
- npmrc.go
- path.go
- release.go
- router.go
- server.go
- transform.go
- unenv.go
- utils.go