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
- func ApplyDeclarationAdapterFiles(catalog *Catalog, sources []declarationadapterhost.Source) error
- func ApplyDeclarationAdapterFilesWithRuntime(catalog *Catalog, sources []declarationadapterhost.Source, ...) error
- func AttachRuntimeBindings(catalog *Catalog, sources []declarationadapterhost.Source, ...) error
- func IndexPath(root string) string
- func Write(root string, catalog *Catalog) error
- type Catalog
- func Empty(dependencies map[string]string) *Catalog
- func Generate(root, packageManager string, dependencies map[string]string) (*Catalog, error)
- func GenerateModules(root, packageManager string, dependencies map[string]string, ...) (*Catalog, error)
- func Load(root string, dependencies map[string]string) (*Catalog, error)
- func LoadWithDeclarationAdapters(root string, dependencies map[string]string, ...) (*Catalog, error)
- type Export
- type Field
- type Module
- type ResultBridge
- type RuntimeBinding
- type Type
Constants ¶
const ( // FormatVersion belongs only to the generated TypeScript native type cache. // Package-owned declaration adapters use their independent protocol version. FormatVersion = 5 )
Variables ¶
This section is empty.
Functions ¶
func ApplyDeclarationAdapterFiles ¶ added in v0.3.16
func ApplyDeclarationAdapterFiles(catalog *Catalog, sources []declarationadapterhost.Source) error
ApplyDeclarationAdapterFiles overlays package-owned semantic declarations on top of declarations inferred by the TypeScript adapter from .d.ts files. The extension host validates the shared data protocol; this adapter validates the remaining TypeScript-specific bridge kinds and dependency ownership.
func ApplyDeclarationAdapterFilesWithRuntime ¶ added in v0.3.23
func ApplyDeclarationAdapterFilesWithRuntime(catalog *Catalog, sources []declarationadapterhost.Source, runtime *runtimeadapterhost.Catalog) error
ApplyDeclarationAdapterFilesWithRuntime overlays package-owned semantic declarations and attaches separately validated target-native runtime bindings. Go and Ruby currently accept only runtime-backed declarations; TypeScript additionally retains direct .d.ts-backed declarations.
func AttachRuntimeBindings ¶ added in v0.3.23
func AttachRuntimeBindings(catalog *Catalog, sources []declarationadapterhost.Source, runtime *runtimeadapterhost.Catalog) error
AttachRuntimeBindings restores independently loaded runtime metadata on a declaration catalog read from the TypeScript native type cache.
Types ¶
type Catalog ¶
type Catalog struct {
FormatVersion int `json:"formatVersion"`
TypeScriptVersion string `json:"typescriptVersion,omitempty"`
Dependencies map[string]string `json:"dependencies"`
DeclarationAdapterChecksums map[string]string `json:"declarationAdapterChecksums,omitempty"`
Modules map[string]Module `json:"modules"`
}
func GenerateModules ¶
func LoadWithDeclarationAdapters ¶ added in v0.3.16
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"`
InstanceMembers map[string]Export `json:"instanceMembers,omitempty"`
ClassMembers map[string]Export `json:"classMembers,omitempty"`
ResultBridge *ResultBridge `json:"resultBridge,omitempty"`
UnsupportedFields map[string]string `json:"unsupportedFields,omitempty"`
Runtime *RuntimeBinding `json:"-"`
}
type ResultBridge ¶ added in v0.3.0
ResultBridge describes a package-owned conversion between a native Promise boundary and the standard TypeRB Result. Its placement determines whether it applies to a callback type or to the declared call itself.
type RuntimeBinding ¶ added in v0.3.23
type RuntimeBinding struct {
Identity string
Dependency string
Module string
Symbol string
CallConvention string
MaySuspend bool
PropagatesExecutionScope bool
}
RuntimeBinding is validated target-native lowering metadata attached to a semantic declaration at compile time. It is not persisted in the generated TypeScript declaration cache because runtime adapter files are loaded and validated independently.
type Type ¶
type Type struct {
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
Args []Type `json:"args,omitempty"`
ResultBridge *ResultBridge `json:"resultBridge,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Readonly bool `json:"readonly,omitempty"`
}
Type is the stable on-disk form of a target-independent semantic type.