@@ -12,8 +12,6 @@ import (
12
12
"golang.org/x/xerrors"
13
13
)
14
14
15
- const VSIXAssetType = "Microsoft.VisualStudio.Services.VSIXPackage"
16
-
17
15
// VSIXManifest implement XMLManifest.PackageManifest.
18
16
// https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L9-L26
19
17
type VSIXManifest struct {
@@ -57,11 +55,18 @@ type VSIXProperties struct {
57
55
Property []VSIXProperty
58
56
}
59
57
58
+ type PropertyType string
59
+
60
+ const (
61
+ DependencyPropertyType PropertyType = "Microsoft.VisualStudio.Code.ExtensionDependencies"
62
+ PackPropertyType PropertyType = "Microsoft.VisualStudio.Code.ExtensionPack"
63
+ )
64
+
60
65
// VSIXProperty implements XMLManifest.PackageManifest.Metadata.Properties.Property.
61
66
// https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L19
62
67
type VSIXProperty struct {
63
- ID string `xml:"Id,attr"`
64
- Value string `xml:",attr"`
68
+ ID PropertyType `xml:"Id,attr"`
69
+ Value string `xml:",attr"`
65
70
}
66
71
67
72
// VSIXAssets implements XMLManifest.PackageManifest.Assets.
@@ -70,20 +75,33 @@ type VSIXAssets struct {
70
75
Asset []VSIXAsset
71
76
}
72
77
78
+ type AssetType string
79
+
80
+ const (
81
+ VSIXAssetType AssetType = "Microsoft.VisualStudio.Services.VSIXPackage"
82
+ )
83
+
73
84
// VSIXAsset implements XMLManifest.PackageManifest.Assets.Asset.
74
85
// https://github.com/microsoft/vscode-vsce/blob/main/src/xml.ts#L25
75
86
type VSIXAsset struct {
76
- Type string `xml:",attr"`
77
- Path string `xml:",attr"`
78
- Addressable string `xml:",attr"`
87
+ Type AssetType `xml:",attr"`
88
+ Path string `xml:",attr"`
89
+ Addressable string `xml:",attr"`
90
+ }
91
+
92
+ type Extension struct {
93
+ ID string
94
+ Location string
95
+ Dependencies []string
96
+ Pack []string
79
97
}
80
98
81
99
// TODO: Add Artifactory implementation of Storage.
82
100
type Storage interface {
83
101
// AddExtension adds the extension found at the specified source by copying it
84
- // into the extension storage directory and returns the location of the new
102
+ // into the extension storage directory and returns details about the added
85
103
// extension. The source may be an URI or a local file path.
86
- AddExtension (ctx context.Context , source string ) (string , error )
104
+ AddExtension (ctx context.Context , source string ) (* Extension , error )
87
105
// FileServer provides a handler for fetching extension repository files from
88
106
// a client.
89
107
FileServer () http.Handler
0 commit comments