Documentation ¶
Index ¶
- Constants
- func ExtensionID(publisher, name, version string) string
- func ExtensionIDFromManifest(manifest *VSIXManifest) string
- func ExtractZip(rawZip []byte, fn func(name string, reader io.Reader) error) error
- func GetZipFileReader(rawZip []byte, filename string) (io.ReadCloser, error)
- func ParseExtensionID(id string) (string, string, string, error)
- func ReadVSIX(ctx context.Context, source string) ([]byte, error)
- func WalkZip(rawZip []byte, fn func(*zip.File) (bool, error)) (io.ReadCloser, error)
- type Artifactory
- func (s *Artifactory) AddExtension(ctx context.Context, manifest *VSIXManifest, vsix []byte) (string, error)
- func (s *Artifactory) FileServer() http.Handler
- func (s *Artifactory) Manifest(ctx context.Context, publisher, name, version string) (*VSIXManifest, error)
- func (s *Artifactory) RemoveExtension(ctx context.Context, publisher, name, version string) error
- func (s *Artifactory) Versions(ctx context.Context, publisher, name string) ([]string, error)
- func (s *Artifactory) WalkExtensions(ctx context.Context, fn func(manifest *VSIXManifest, versions []string) error) error
- type ArtifactoryError
- type ArtifactoryFile
- type ArtifactoryList
- type ArtifactoryOptions
- type ArtifactoryResponse
- type AssetType
- type Local
- func (s *Local) AddExtension(ctx context.Context, manifest *VSIXManifest, vsix []byte) (string, error)
- func (s *Local) FileServer() http.Handler
- func (s *Local) Manifest(ctx context.Context, publisher, name, version string) (*VSIXManifest, error)
- func (s *Local) RemoveExtension(ctx context.Context, publisher, name, version string) error
- func (s *Local) Versions(ctx context.Context, publisher, name string) ([]string, error)
- func (s *Local) WalkExtensions(ctx context.Context, fn func(manifest *VSIXManifest, versions []string) error) error
- type Options
- type PropertyType
- type Storage
- type VSIXAsset
- type VSIXAssets
- type VSIXIdentity
- type VSIXManifest
- type VSIXMetadata
- type VSIXPackageJSON
- type VSIXProperties
- type VSIXProperty
Constants ¶
const ArtifactoryTokenEnvKey = "ARTIFACTORY_TOKEN"
Variables ¶
This section is empty.
Functions ¶
func ExtensionID ¶ added in v1.2.0
ExtensionID returns the full ID of an extension.
func ExtensionIDFromManifest ¶ added in v1.2.1
func ExtensionIDFromManifest(manifest *VSIXManifest) string
ExtensionIDFromManifest returns the full ID of an extension.
func ExtractZip ¶
ExtractZip applies a function with a reader for every file in the zip. If the function returns an error the walk is aborted.
func GetZipFileReader ¶
func GetZipFileReader(rawZip []byte, filename string) (io.ReadCloser, error)
GetZipFileReader returns a reader for a single file in a zip.
func ParseExtensionID ¶ added in v1.2.0
ParseExtensionID parses an extension ID into its separate parts: publisher, name, and version (version may be blank).
func ReadVSIX ¶ added in v1.2.0
ReadVSIX reads the bytes of a VSIX from the specified source. The source might be a URI or a local file path.
Types ¶
type Artifactory ¶ added in v1.2.0
type Artifactory struct {
// contains filtered or unexported fields
}
Artifactory implements Storage. It stores extensions remotely through Artifactory by both copying the VSIX and extracting said VSIX to a tree structure in the form of publisher/extension/version to easily serve individual assets via HTTP.
func NewArtifactoryStorage ¶ added in v1.2.0
func NewArtifactoryStorage(ctx context.Context, options *ArtifactoryOptions) (*Artifactory, error)
func (*Artifactory) AddExtension ¶ added in v1.2.0
func (s *Artifactory) AddExtension(ctx context.Context, manifest *VSIXManifest, vsix []byte) (string, error)
func (*Artifactory) FileServer ¶ added in v1.2.0
func (s *Artifactory) FileServer() http.Handler
func (*Artifactory) Manifest ¶ added in v1.2.0
func (s *Artifactory) Manifest(ctx context.Context, publisher, name, version string) (*VSIXManifest, error)
func (*Artifactory) RemoveExtension ¶ added in v1.2.0
func (s *Artifactory) RemoveExtension(ctx context.Context, publisher, name, version string) error
func (*Artifactory) WalkExtensions ¶ added in v1.2.0
func (s *Artifactory) WalkExtensions(ctx context.Context, fn func(manifest *VSIXManifest, versions []string) error) error
type ArtifactoryError ¶ added in v1.2.0
type ArtifactoryFile ¶ added in v1.2.0
type ArtifactoryList ¶ added in v1.2.1
type ArtifactoryList struct {
Files []ArtifactoryFile `json:"files"`
}
type ArtifactoryOptions ¶ added in v1.2.1
type ArtifactoryResponse ¶ added in v1.2.0
type ArtifactoryResponse struct {
Errors []ArtifactoryError `json:"errors"`
}
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local implements Storage. It stores extensions locally on disk by both copying the VSIX and extracting said VSIX to a tree structure in the form of publisher/extension/version to easily serve individual assets via HTTP.
func NewLocalStorage ¶ added in v1.2.0
func (*Local) AddExtension ¶
func (*Local) FileServer ¶
func (*Local) RemoveExtension ¶
func (*Local) WalkExtensions ¶
type PropertyType ¶
type PropertyType string
const ( DependencyPropertyType PropertyType = "Microsoft.VisualStudio.Code.ExtensionDependencies" PackPropertyType PropertyType = "Microsoft.VisualStudio.Code.ExtensionPack" )
type Storage ¶
type Storage interface { // AddExtension adds the provided VSIX into storage and returns the location // for verification purposes. AddExtension(ctx context.Context, manifest *VSIXManifest, vsix []byte) (string, error) // FileServer provides a handler for fetching extension repository files from // a client. FileServer() http.Handler // Manifest returns the manifest bytes for the provided extension. The // extension asset itself (the VSIX) will be included on the manifest even if // it does not exist on the manifest on disk. Manifest(ctx context.Context, publisher, name, version string) (*VSIXManifest, error) // RemoveExtension removes the provided version of the extension. It errors // if the provided version does not exist or if removing it fails. If version // is blank all versions of that extension will be removed. RemoveExtension(ctx context.Context, publisher, name, version string) error // Versions returns the available versions of the provided extension in sorted // order. If the extension does not exits it returns an error. Versions(ctx context.Context, publisher, name string) ([]string, error) // WalkExtensions applies a function over every extension. The extension // points to the latest version and the versions slice includes all the // versions in sorted order including the latest version (which will be in // [0]). If the function returns an error the error is immediately returned // which aborts the walk. WalkExtensions(ctx context.Context, fn func(manifest *VSIXManifest, versions []string) error) error }
type VSIXAsset ¶
type VSIXAsset struct { Type AssetType `xml:",attr"` Path string `xml:",attr"` Addressable string `xml:",attr"` }
VSIXAsset implements XMLManifest.PackageManifest.Assets.Asset. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L25
type VSIXAssets ¶
type VSIXAssets struct {
Asset []VSIXAsset
}
VSIXAssets implements XMLManifest.PackageManifest.Assets. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L25
type VSIXIdentity ¶
type VSIXIdentity struct { // ID correlates to ExtensionName, *not* ExtensionID. ID string `xml:"Id,attr"` Version string `xml:",attr"` Publisher string `xml:",attr"` TargetPlatform string `xml:",attr"` }
VSIXManifest implement XMLManifest.PackageManifest.Metadata.Identity. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L14
type VSIXManifest ¶
type VSIXManifest struct { Metadata VSIXMetadata Installation struct { InstallationTarget struct { ID string `xml:"Id,attr"` } } Dependencies []string Assets VSIXAssets }
VSIXManifest implement XMLManifest.PackageManifest. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L9-L26
func ReadVSIXManifest ¶ added in v1.2.0
func ReadVSIXManifest(vsix []byte) (*VSIXManifest, error)
ReadVSIXManifest reads and parses an extension manifest from a vsix file. If the manifest is invalid it will be returned along with the validation error.
type VSIXMetadata ¶
type VSIXMetadata struct { Description string DisplayName string Identity VSIXIdentity Tags string GalleryFlags string License string Icon string Properties VSIXProperties Categories string }
VSIXManifest implement XMLManifest.PackageManifest.Metadata. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L11-L22
type VSIXPackageJSON ¶ added in v1.2.0
type VSIXPackageJSON struct {
Browser string `json:"browser"`
}
VSIXPackageJSON partially implements Manifest. https://github.com/microsoft/vscode-vsce/blob/main/src/manifest.ts#L40-L99
func ReadVSIXPackageJSON ¶ added in v1.2.0
func ReadVSIXPackageJSON(vsix []byte, packageJsonPath string) (*VSIXPackageJSON, error)
ReadVSIXPackageJSON reads and parses an extension's package.json from a vsix file.
type VSIXProperties ¶
type VSIXProperties struct {
Property []VSIXProperty
}
VSIXProperties implements XMLManifest.PackageManifest.Metadata.Properties. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L19
type VSIXProperty ¶
type VSIXProperty struct { ID PropertyType `xml:"Id,attr"` Value string `xml:",attr"` }
VSIXProperty implements XMLManifest.PackageManifest.Metadata.Properties.Property. https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L19