nativepackage

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package nativepackage owns cached type information derived from native target-language packages. The cache is generated by trb install and keeps native declaration parsing out of ordinary compiler and language-service requests.

Index

Constants

View Source
const (
	FormatVersion = 1
)

Variables

This section is empty.

Functions

func ApplyProviderFiles

func ApplyProviderFiles(catalog *Catalog, sources []ProviderSource) error

ApplyProviderFiles overlays declarative package-owned corrections on top of declarations inferred from .d.ts files. Two providers cannot redefine the same symbol, which keeps the result independent from package traversal order.

func IndexPath

func IndexPath(root string) string

func Write

func Write(root string, catalog *Catalog) error

Types

type Catalog

type Catalog struct {
	FormatVersion     int               `json:"formatVersion"`
	TypeScriptVersion string            `json:"typescriptVersion,omitempty"`
	Dependencies      map[string]string `json:"dependencies"`
	ProviderChecksums map[string]string `json:"providerChecksums,omitempty"`
	Modules           map[string]Module `json:"modules"`
	UnavailableReason string            `json:"-"`
}

func Empty

func Empty(dependencies map[string]string) *Catalog

func Generate

func Generate(root, packageManager string, dependencies map[string]string) (*Catalog, error)

func GenerateModules

func GenerateModules(root, packageManager string, dependencies map[string]string, requestedModules []string) (*Catalog, error)

func Load

func Load(root string, dependencies map[string]string) (*Catalog, error)

func LoadWithProviders

func LoadWithProviders(root string, dependencies map[string]string, providers []ProviderSource) (*Catalog, error)

func (*Catalog) Module

func (c *Catalog) Module(importPath string) (Module, bool)

func (*Catalog) Owns

func (c *Catalog) Owns(importPath string) bool

type Export

type Export struct {
	Kind              string            `json:"kind"`
	Type              Type              `json:"type"`
	AliasTarget       *Type             `json:"aliasTarget,omitempty"`
	Parameters        []Type            `json:"parameters,omitempty"`
	Required          int               `json:"required,omitempty"`
	Variadic          bool              `json:"variadic,omitempty"`
	TypeParameters    []string          `json:"typeParameters,omitempty"`
	Fields            []Field           `json:"fields,omitempty"`
	Members           map[string]Export `json:"members,omitempty"`
	UnsupportedFields map[string]string `json:"unsupportedFields,omitempty"`
}

type Field

type Field struct {
	Name     string `json:"name"`
	Type     Type   `json:"type"`
	Optional bool   `json:"optional,omitempty"`
}

type Module

type Module struct {
	Exports     map[string]Export `json:"exports"`
	Records     map[string]Export `json:"records,omitempty"`
	Unsupported map[string]string `json:"unsupported,omitempty"`
}

type Provider

type Provider struct {
	FormatVersion int               `json:"formatVersion"`
	Modules       map[string]Module `json:"modules"`
}

func ReadProvider

func ReadProvider(path string) (*Provider, error)

type ProviderSource

type ProviderSource struct {
	Package      string
	Path         string
	Dependencies map[string]string
}

type Type

type Type struct {
	Kind         string `json:"kind"`
	Name         string `json:"name,omitempty"`
	Args         []Type `json:"args,omitempty"`
	Fails        *Type  `json:"fails,omitempty"`
	EffectBridge string `json:"effectBridge,omitempty"`
	Nullable     bool   `json:"nullable,omitempty"`
	Readonly     bool   `json:"readonly,omitempty"`
}

Type is the stable on-disk form of a target-independent semantic type.

func FromSemantic

func FromSemantic(typ types.Type) Type

func (Type) Semantic

func (t Type) Semantic() types.Type

Jump to

Keyboard shortcuts

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