ovsx 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +73 -1
  2. package/lib/check-license.d.ts.map +1 -1
  3. package/lib/check-license.js +3 -2
  4. package/lib/check-license.js.map +1 -1
  5. package/lib/get.js +6 -6
  6. package/lib/get.js.map +1 -1
  7. package/lib/http.d.ts +32 -0
  8. package/lib/http.d.ts.map +1 -0
  9. package/lib/http.js +170 -0
  10. package/lib/http.js.map +1 -0
  11. package/lib/index.d.ts +4 -0
  12. package/lib/index.d.ts.map +1 -1
  13. package/lib/index.js +4 -0
  14. package/lib/index.js.map +1 -1
  15. package/lib/list-options.d.ts +24 -0
  16. package/lib/list-options.d.ts.map +1 -0
  17. package/lib/list-options.js +15 -0
  18. package/lib/list-options.js.map +1 -0
  19. package/lib/list.d.ts +18 -0
  20. package/lib/list.d.ts.map +1 -0
  21. package/lib/list.js +46 -0
  22. package/lib/list.js.map +1 -0
  23. package/lib/main.js +111 -32
  24. package/lib/main.js.map +1 -1
  25. package/lib/oidc.d.ts +22 -0
  26. package/lib/oidc.d.ts.map +1 -0
  27. package/lib/oidc.js +59 -0
  28. package/lib/oidc.js.map +1 -0
  29. package/lib/publish-options.d.ts +8 -1
  30. package/lib/publish-options.d.ts.map +1 -1
  31. package/lib/publish.d.ts.map +1 -1
  32. package/lib/publish.js +150 -13
  33. package/lib/publish.js.map +1 -1
  34. package/lib/registry-options.d.ts +8 -0
  35. package/lib/registry-options.d.ts.map +1 -1
  36. package/lib/registry.d.ts +161 -5
  37. package/lib/registry.d.ts.map +1 -1
  38. package/lib/registry.js +259 -100
  39. package/lib/registry.js.map +1 -1
  40. package/lib/search-options.d.ts +48 -0
  41. package/lib/search-options.d.ts.map +1 -0
  42. package/lib/search-options.js +15 -0
  43. package/lib/search-options.js.map +1 -0
  44. package/lib/search.d.ts +22 -0
  45. package/lib/search.d.ts.map +1 -0
  46. package/lib/search.js +86 -0
  47. package/lib/search.js.map +1 -0
  48. package/lib/show-options.d.ts +33 -0
  49. package/lib/show-options.d.ts.map +1 -0
  50. package/lib/show-options.js +15 -0
  51. package/lib/show-options.js.map +1 -0
  52. package/lib/show.d.ts +18 -0
  53. package/lib/show.d.ts.map +1 -0
  54. package/lib/show.js +289 -0
  55. package/lib/show.js.map +1 -0
  56. package/lib/table.d.ts +27 -0
  57. package/lib/table.d.ts.map +1 -0
  58. package/lib/table.js +56 -0
  59. package/lib/table.js.map +1 -0
  60. package/lib/trusted-publishing-options.d.ts +30 -0
  61. package/lib/trusted-publishing-options.d.ts.map +1 -0
  62. package/lib/trusted-publishing-options.js +15 -0
  63. package/lib/trusted-publishing-options.js.map +1 -0
  64. package/lib/trusted-publishing.d.ts +35 -0
  65. package/lib/trusted-publishing.d.ts.map +1 -0
  66. package/lib/trusted-publishing.js +112 -0
  67. package/lib/trusted-publishing.js.map +1 -0
  68. package/lib/unpublish-options.d.ts +34 -0
  69. package/lib/unpublish-options.d.ts.map +1 -0
  70. package/lib/unpublish-options.js +15 -0
  71. package/lib/unpublish-options.js.map +1 -0
  72. package/lib/unpublish.d.ts +22 -0
  73. package/lib/unpublish.d.ts.map +1 -0
  74. package/lib/unpublish.js +137 -0
  75. package/lib/unpublish.js.map +1 -0
  76. package/lib/util.d.ts +51 -9
  77. package/lib/util.d.ts.map +1 -1
  78. package/lib/util.js +130 -67
  79. package/lib/util.js.map +1 -1
  80. package/lib/verify-options.d.ts +24 -0
  81. package/lib/verify-options.d.ts.map +1 -0
  82. package/lib/verify-options.js +15 -0
  83. package/lib/verify-options.js.map +1 -0
  84. package/lib/verify-signature-options.d.ts +32 -0
  85. package/lib/verify-signature-options.d.ts.map +1 -0
  86. package/lib/verify-signature-options.js +15 -0
  87. package/lib/verify-signature-options.js.map +1 -0
  88. package/lib/verify-signature.d.ts +28 -0
  89. package/lib/verify-signature.d.ts.map +1 -0
  90. package/lib/verify-signature.js +105 -0
  91. package/lib/verify-signature.js.map +1 -0
  92. package/lib/verify.d.ts +21 -0
  93. package/lib/verify.d.ts.map +1 -0
  94. package/lib/verify.js +97 -0
  95. package/lib/verify.js.map +1 -0
  96. package/lib/zip.d.ts +10 -0
  97. package/lib/zip.d.ts.map +1 -1
  98. package/lib/zip.js +33 -10
  99. package/lib/zip.js.map +1 -1
  100. package/package.json +21 -14
  101. package/src/check-license.ts +4 -3
  102. package/src/get.ts +7 -7
  103. package/src/http.ts +176 -0
  104. package/src/index.ts +4 -0
  105. package/src/list-options.ts +25 -0
  106. package/src/list.ts +48 -0
  107. package/src/main.ts +125 -34
  108. package/src/oidc.ts +65 -0
  109. package/src/publish-options.ts +8 -1
  110. package/src/publish.ts +208 -14
  111. package/src/registry-options.ts +8 -0
  112. package/src/registry.ts +379 -98
  113. package/src/search-options.ts +49 -0
  114. package/src/search.ts +95 -0
  115. package/src/show-options.ts +34 -0
  116. package/src/show.ts +328 -0
  117. package/src/table.ts +53 -0
  118. package/src/trusted-publishing-options.ts +30 -0
  119. package/src/trusted-publishing.ts +148 -0
  120. package/src/unpublish-options.ts +35 -0
  121. package/src/unpublish.ts +160 -0
  122. package/src/util.ts +138 -70
  123. package/src/verify-options.ts +25 -0
  124. package/src/verify-signature-options.ts +32 -0
  125. package/src/verify-signature.ts +124 -0
  126. package/src/verify.ts +107 -0
  127. package/src/zip.ts +33 -13
  128. package/lib/version.d.ts +0 -2
  129. package/lib/version.d.ts.map +0 -1
  130. package/lib/version.js +0 -5
  131. package/lib/version.js.map +0 -1
  132. package/src/version.ts +0 -1
package/README.md CHANGED
@@ -10,6 +10,10 @@ npm install --global ovsx
10
10
 
11
11
  `ovsx` uses open-vsx.org as default instance for publishing and downloading extensions. If you are using a different instance, specify it via the `--registryUrl` (or `-r`) argument or an environment variable named `OVSX_REGISTRY_URL`.
12
12
 
13
+ If your registry sits behind a reverse proxy that requires its own HTTP Basic auth (separate from your Open VSX personal access token), set `OVSX_USERNAME` and `OVSX_PASSWORD`.
14
+
15
+ Requests give up if they stop making progress for 30 seconds, so a registry that accepts a connection and then goes quiet does not leave the command hanging. `OVSX_TIMEOUT` changes that, in milliseconds; `OVSX_TIMEOUT=0` disables it. It measures inactivity rather than total time, so a large extension downloading slowly is not cut off, and it covers the ID token request made for trusted publishing as well as the registry's own.
16
+
13
17
  ### Publish Extensions
14
18
 
15
19
  You can use `ovsx` for publishing [VS Code extensions](https://code.visualstudio.com/api) to an Open VSX instance. This is very similar to [vsce](https://github.com/microsoft/vscode-vsce), the publishing tool for the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/vscode).
@@ -24,12 +28,68 @@ Variants:
24
28
  * `ovsx publish <file>`
25
29
  publishes an already packaged file.
26
30
 
31
+ Before uploading, `ovsx` checks the packaged extension's size against the limit the registry reports on `/api/version`, so an oversized package is rejected locally instead of failing after the whole file has been uploaded.
32
+
33
+ #### Package managers
34
+
35
+ Packaging is done by `vsce`, which walks your production dependencies to decide what goes into the `.vsix`. It knows how to do that for two package managers only - npm, and yarn v1 via `--yarn` - and [will not be adding more](https://github.com/microsoft/vscode-vsce/issues/421#issuecomment-1853665094). For anything else, pnpm included, there are two options:
36
+
37
+ * `ovsx publish --no-dependencies`
38
+ skips the dependency walk altogether. This is the right answer for a bundled extension - one built with esbuild, webpack or similar, where the bundle already contains everything the extension needs at runtime - regardless of which package manager installed the sources.
39
+ * `ovsx publish --follow-symlinks`
40
+ recurses into symlinked directories instead of packing each symlink as a file. A `node_modules` assembled out of symlinks, as pnpm's is, needs this for the walk to reach the real dependency files.
41
+
42
+ ### Trusted Publishing
43
+
44
+ Instead of a long-lived personal access token, `ovsx` can publish from a CI workflow with a short-lived token that the registry issues in exchange for an OIDC ID token of the workflow. The registry only issues such a token if the workflow matches a trusted publisher that a namespace owner registered under [trusted publishers](https://open-vsx.org/user-settings/trusted-publishers). No access token needs to be stored as a secret.
45
+
46
+ On GitHub Actions the workflow needs the `id-token: write` permission, everything else is detected automatically:
47
+
48
+ ```yaml
49
+ permissions:
50
+ contents: read
51
+ id-token: write
52
+ jobs:
53
+ publish:
54
+ runs-on: ubuntu-latest
55
+ # only needed if the trusted publisher pins an environment
56
+ environment: publish
57
+ steps:
58
+ - uses: actions/checkout@v5
59
+ - uses: actions/setup-node@v5
60
+ - run: npm ci
61
+ - run: npx ovsx publish --trusted-publishing
62
+ ```
63
+
64
+ Options:
65
+ * `--trusted-publishing` requires trusted publishing and fails if no ID token can be obtained. Without it, trusted publishing is used whenever an ID token is available and no access token was given; a `--pat` (or `OVSX_PAT`) always takes precedence.
66
+ * `--idToken <token>` passes the ID token explicitly. Use this on CI systems that expose the token as a variable, for example with GitLab CI's [`id_tokens`](https://docs.gitlab.com/ci/yaml/#id_tokens) keyword. The environment variable `OVSX_ID_TOKEN` does the same.
67
+ * `--oidcAudience <audience>` sets the audience requested for the ID token, by default the registry URL. Use it if the registry expects a different audience, and make sure it matches the `aud` claim the registry validates. The environment variable `OVSX_OIDC_AUDIENCE` does the same.
68
+
69
+ The issued token is valid for a few minutes only and is never written to the token store, but it does carry publishing rights, so treat CI logs accordingly.
70
+
71
+ ### Delete Extensions
72
+
73
+ You can delete extensions you published with `ovsx unpublish`, the counterpart of `vsce unpublish`. This requires an access token as described above, and the token's user must be a member of the extension's namespace: namespace owners may delete any version, other members only the versions they published themselves. This requires a registry running version 1.2.0 or later.
74
+
75
+ Deleting is irreversible: the files of a deleted version are removed and its version number stays reserved, so the same version can never be published again. You will be asked for confirmation unless you pass `--force` (or `-f`).
76
+
77
+ Variants:
78
+ * `ovsx unpublish`
79
+ deletes all versions of the extension in the current working directory, as identified by the `publisher` and `name` fields of its package.json.
80
+ * `ovsx unpublish <extension>`
81
+ deletes all versions of the given extension, identified with the format `namespace.extension`.
82
+ * `ovsx unpublish <extension> --versions <versions...>`
83
+ deletes only the given versions, e.g. `ovsx unpublish foo.bar -v 1.0.0 1.0.1`.
84
+ * `ovsx unpublish <extension> --versions <versions...> --target <targets...>`
85
+ deletes only the given [target platforms](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions) of the given versions, e.g. `ovsx unpublish foo.bar -v 1.0.0 -t linux-x64`.
86
+
27
87
  ### Create a Namespace
28
88
 
29
89
  The `publisher` field of your extension's package.json defines the namespace into which the extension will be published. Before you publish the first extension in a namespace, you must create it. This requires an access token as described above.
30
90
 
31
91
  * `ovsx create-namespace <name>`
32
- creates the specifed namespace. The name must correspond to the `publisher` of your extension.
92
+ creates the specified namespace. The name must correspond to the `publisher` of your extension.
33
93
 
34
94
  Creating a namespace does _not_ automatically give you the exclusive publishing rights. Initially, everyone will be able to publish an extension with the new namespace. If you want exclusive publishing rights, you can [claim ownership of a namespace](https://github.com/eclipse/openvsx/wiki/Namespace-Access).
35
95
 
@@ -47,6 +107,18 @@ Variants:
47
107
  * `ovsx get <extension> --metadata -o <path>`
48
108
  downloads the JSON metadata of an extension and saves it in the specified file or directory.
49
109
 
110
+ ### Verify a Downloaded Package
111
+
112
+ If the registry signs published packages, `ovsx verify <path>` checks a downloaded `.vsix` file's signature against the registry's public key - the same check VS Code itself performs when installing a signed extension. The namespace, extension name and version are read from the package itself, so no extra arguments are needed beyond the file path (and `-t`/`--target` for a [target platform specific extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions)).
113
+
114
+ * `ovsx verify <extension.vsix>`
115
+ verifies the package's signature and exits with an error if it is missing, invalid, or does not match - meaning the package was not published by, or was tampered with after being published by, the registry it was downloaded from.
116
+
117
+ If you already have the package, manifest and signature files on disk - e.g. extracted from a registry's signature archive - and don't want `ovsx` to talk to a registry at all, `ovsx verify-signature` verifies that trio entirely offline, mirroring `vsce verify-signature`:
118
+
119
+ * `ovsx verify-signature -i <package.vsix> -m <manifest> -s <signature> -k <publicKey>`
120
+ verifies the signature against the package, and cross-checks the manifest's recorded digests against the package's actual contents - reporting which entry doesn't match, if any. Unlike `vsce verify-signature`, a public key must be supplied explicitly (`-k`/`--publicKeyPath`): Open VSX registries each hold their own signing key, rather than trusting a single baked-in Marketplace key the way VS Code's own verifier does.
121
+
50
122
  ### Store Access Tokens
51
123
 
52
124
  The `login` command lets you store an access token for a namespace.
@@ -1 +1 @@
1
- {"version":3,"file":"check-license.d.ts","sourceRoot":"","sources":["../src/check-license.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAKlF,OAAO,EAC0B,QAAQ,EACxC,MAAM,QAAQ,CAAC;AAsChB,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB5F;AAED,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrE"}
1
+ {"version":3,"file":"check-license.d.ts","sourceRoot":"","sources":["../src/check-license.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAMlF,OAAO,EAC0B,QAAQ,EACxC,MAAM,QAAQ,CAAC;AAsChB,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB5F;AAED,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrE"}
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.isLicenseOk = isLicenseOk;
13
13
  exports.checkLicense = checkLicense;
14
14
  const fs = require("fs");
15
+ const path = require("path");
15
16
  const isCI = require("is-ci");
16
17
  const prompts_1 = require("@inquirer/prompts");
17
18
  const util_1 = require("./util");
@@ -81,12 +82,12 @@ async function useMITLicense(manifest, packagePath) {
81
82
  manifest.license = 'MIT';
82
83
  await (0, util_1.writeManifest)(manifest, packagePath);
83
84
  const license = MIT_LICENSE_TEXT.replace('<YEAR> <COPYRIGHT HOLDER>', copyright);
84
- await (0, util_1.writeFile)('LICENSE', license, packagePath);
85
+ await fs.promises.writeFile(path.join(packagePath ?? process.cwd(), 'LICENSE'), license, 'utf-8');
85
86
  console.log('LICENSE file has been written. Please commit it to the source repository.');
86
87
  }
87
88
  const LICENSE_FILE_NAMES = ['license.md', 'license', 'license.txt', 'licence.md', 'licence', 'licence.txt'];
88
89
  async function hasLicenseFile(packagePath) {
89
- const fileNames = await (0, util_1.promisify)(fs.readdir)(packagePath ?? '.');
90
+ const fileNames = await fs.promises.readdir(packagePath ?? '.');
90
91
  for (const fileName of fileNames) {
91
92
  for (const licFileName of LICENSE_FILE_NAMES) {
92
93
  if (fileName.toLowerCase() === licFileName) {
@@ -1 +1 @@
1
- {"version":3,"file":"check-license.js","sourceRoot":"","sources":["../src/check-license.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;AA6ClF,kCAiBC;AAED,oCAKC;AAnED,yBAAyB;AACzB,8BAA8B;AAC9B,+CAAkD;AAClD,iCAEgB;AAEhB,KAAK,UAAU,UAAU,CAAC,WAAmB,EAAE,QAAkB;IAC7D,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,QAAQ,CAAC,SAAS,GAAG,GAAG,GAAG,QAAQ,CAAC,IAAI,GAAG,gCAAgC;UAChG,8FAA8F;UAC9F,4FAA4F;UAC5F,gGAAgG;UAChG,uDAAuD,CAAC,CAAC;IAC/D,IAAI,MAA6B,CAAC;IAClC,GAAG,CAAC;QACA,MAAM,GAAG,MAAM,IAAA,gBAAM,EAAC;YAClB,OAAO,EAAE,2CAA2C;kBAC9C,QAAQ,CAAC,SAAS,GAAG,GAAG,GAAG,QAAQ,CAAC,IAAI;kBACxC,yBAAyB;YAC/B,OAAO,EAAE;gBACL,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;gBAC/B,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;aAC9B;YACD,OAAO,EAAE,IAAI;SAChB,CAAC,CAAC;QAC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S,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClG,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAE5G,KAAK,UAAU,cAAc,CAAC,WAAoB;IAC9C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;IAChE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,KAAK,MAAM,WAAW,IAAI,kBAAkB,EAAE,CAAC;YAC3C,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,WAAW,EAAE,CAAC;gBACzC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,gBAAgB,GAAW;;;;;;;;;;;;;;;;;;UAkBvB,CAAC"}
package/lib/get.js CHANGED
@@ -23,7 +23,7 @@ async function getExtension(options) {
23
23
  const registry = new registry_1.Registry(options);
24
24
  const match = (0, util_1.matchExtensionId)(options.extensionId);
25
25
  if (!match) {
26
- throw new Error('The extension identifier must have the form `namespace.extension`.');
26
+ throw new Error('The extension identifier must have the form `namespace.extension` or `namespace/extension`.');
27
27
  }
28
28
  const extension = await registry.getMetadata(match[1], match[2], options.target);
29
29
  if (extension.error) {
@@ -66,7 +66,7 @@ async function printMetadata(registry, extension, output) {
66
66
  return;
67
67
  }
68
68
  let filePath;
69
- const stats = await (0, util_1.optionalStat)(output);
69
+ const stats = fs.statSync(output, { throwIfNoEntry: false });
70
70
  if (stats?.isDirectory() || !stats && output.endsWith(path.sep)) {
71
71
  const fileName = `${extension.namespace}.${extension.name}-${extension.version}.json`;
72
72
  filePath = path.resolve(process.cwd(), output, fileName);
@@ -74,8 +74,8 @@ async function printMetadata(registry, extension, output) {
74
74
  else {
75
75
  filePath = path.resolve(process.cwd(), output);
76
76
  }
77
- await (0, util_1.makeDirs)(path.dirname(filePath));
78
- await (0, util_1.promisify)(fs.writeFile)(filePath, metadata);
77
+ await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
78
+ await fs.promises.writeFile(filePath, metadata);
79
79
  }
80
80
  async function download(registry, extension, output) {
81
81
  const downloadUrl = extension.files.download;
@@ -86,7 +86,7 @@ async function download(registry, extension, output) {
86
86
  const fileName = decodeURIComponent(downloadUrl.substring(fileNameIndex + 1));
87
87
  let filePath;
88
88
  if (output) {
89
- const stats = await (0, util_1.optionalStat)(output);
89
+ const stats = fs.statSync(output, { throwIfNoEntry: false });
90
90
  if (stats?.isDirectory() || !stats && output.endsWith(path.sep)) {
91
91
  filePath = path.resolve(process.cwd(), output, fileName);
92
92
  }
@@ -97,7 +97,7 @@ async function download(registry, extension, output) {
97
97
  else {
98
98
  filePath = path.resolve(process.cwd(), fileName);
99
99
  }
100
- await (0, util_1.makeDirs)(path.dirname(filePath));
100
+ await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
101
101
  const target = extension.targetPlatform !== 'universal' ? '@' + extension.targetPlatform : '';
102
102
  console.log(`Downloading ${extension.namespace}.${extension.name}-${extension.version}${target} to ${filePath}`);
103
103
  await registry.download(filePath, new URL(downloadUrl));
package/lib/get.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../src/get.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;AAYlF,oCAuBC;AAjCD,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,yCAAiD;AACjD,iCAAyG;AAGzG;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,OAAmB;IAClD,IAAA,oBAAa,EAAC,OAAO,CAAC,CAAC;I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,EAAE,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,MAAM,GAAG,SAAS,CAAC,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,OAAO,CAAC,GAAG,CAAC,eAAe,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,OAAO,GAAG,MAAM,OAAO,QAAQ,EAAE,CAAC,CAAC;IACjH,MAAM,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC5D,CAAC"}
package/lib/http.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import * as http from 'http';
14
+ import * as fs from 'fs';
15
+ export type RequestBody = () => string | Buffer | Uint8Array | fs.ReadStream;
16
+ /**
17
+ * Sends a request and follows redirects to `onResponse`'s final response, reporting any failure
18
+ * to `fail`. A GET follows every redirect; a request with a body follows only 307/308, sending
19
+ * the body again, because 301/302/303 turn it into a GET without one. Credentials are dropped
20
+ * once a redirect leaves the origin. Only the headers in `options` are sent, so a caller that
21
+ * passes none carries no credentials.
22
+ */
23
+ export declare function send(url: URL, options: http.RequestOptions, body: RequestBody | undefined, onResponse: (response: http.IncomingMessage) => void, fail: (err: Error) => void, hops?: number): void;
24
+ /** Sends a GET with only the given headers and resolves with the parsed JSON response. */
25
+ export declare function getJson<T>(url: URL, headers: http.OutgoingHttpHeaders, timeout: number): Promise<T>;
26
+ /**
27
+ * Reads a response as JSON. A non-2xx status rejects with the `message` or `error` of a JSON
28
+ * error body when there is one, and with the status otherwise. An HTML page rejects with an
29
+ * Error rather than its markup, since it usually means the URL points at a website, not an API.
30
+ */
31
+ export declare function jsonResponse<T>(resolve: (value: T) => void, reject: (reason: any) => void): (res: http.IncomingMessage) => void;
32
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AASzB,MAAM,MAAM,WAAW,GAAG,MAAM,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AAE7E;;;;;;GAMG;AACH,wBAAgB,IAAI,CAChB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,IAAI,CAAC,cAAc,EAC5B,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,UAAU,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,EACpD,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,EAC1B,IAAI,SAAI,GACT,IAAI,CAqDN;AAED,0FAA0F;AAC1F,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAInG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,CAsC/H"}
package/lib/http.js ADDED
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0.
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.send = send;
16
+ exports.getJson = getJson;
17
+ exports.jsonResponse = jsonResponse;
18
+ const http = require("http");
19
+ const https = require("https");
20
+ const fs = require("fs");
21
+ const util_1 = require("./util");
22
+ // Hop limit the fetch standard uses.
23
+ const MAX_REDIRECTS = 20;
24
+ // Dropped on a redirect to another origin; X-OpenVSX-Token carries the PAT just like Authorization.
25
+ const CREDENTIAL_HEADERS = /^(?:authorization|cookie|proxy-authorization|x-openvsx-token)$/i;
26
+ /**
27
+ * Sends a request and follows redirects to `onResponse`'s final response, reporting any failure
28
+ * to `fail`. A GET follows every redirect; a request with a body follows only 307/308, sending
29
+ * the body again, because 301/302/303 turn it into a GET without one. Credentials are dropped
30
+ * once a redirect leaves the origin. Only the headers in `options` are sent, so a caller that
31
+ * passes none carries no credentials.
32
+ */
33
+ function send(url, options, body, onResponse, fail, hops = 0) {
34
+ const protocol = url.protocol === 'https:' ? https : http;
35
+ const request = protocol.request(url, options, response => {
36
+ const status = response.statusCode ?? 0;
37
+ const location = response.headers.location;
38
+ if (status < 300 || status > 399 || !location) {
39
+ onResponse(response);
40
+ return;
41
+ }
42
+ response.resume();
43
+ let next;
44
+ try {
45
+ next = new URL(location, url);
46
+ }
47
+ catch (err) {
48
+ fail(err);
49
+ return;
50
+ }
51
+ if (hops >= MAX_REDIRECTS) {
52
+ fail(new Error(`The request to ${(0, util_1.redactUrl)(url)} was redirected more than ${MAX_REDIRECTS} times.`));
53
+ }
54
+ else if (next.protocol !== 'https:' && next.protocol !== 'http:') {
55
+ fail(new Error(`The request to ${(0, util_1.redactUrl)(url)} was redirected to unsupported URL ${(0, util_1.redactUrl)(next)}.`));
56
+ }
57
+ else if (body && status !== 307 && status !== 308) {
58
+ fail((0, util_1.withStatus)(new Error(`The ${options.method} request to ${(0, util_1.redactUrl)(url)} was redirected to ${(0, util_1.redactUrl)(next)} `
59
+ + `with status ${status}, which drops the request body. Use the redirect target as the registry URL.`), status));
60
+ }
61
+ else {
62
+ // The server may answer before reading the body: abandon this hop so its stream
63
+ // releases the file and a late reset on its socket can't fail the next hop.
64
+ request.removeListener('error', fail);
65
+ request.on('error', () => { });
66
+ if (content instanceof fs.ReadStream) {
67
+ content.unpipe(request);
68
+ content.destroy();
69
+ }
70
+ request.destroy();
71
+ const headers = next.origin === url.origin ? options.headers : withoutCredentials(options.headers);
72
+ send(next, { ...options, headers }, body, onResponse, fail, hops + 1);
73
+ }
74
+ });
75
+ request.on('error', fail);
76
+ failOnTimeout(request, url, options.timeout, fail);
77
+ const content = body?.();
78
+ if (content instanceof fs.ReadStream) {
79
+ content.on('error', (err) => {
80
+ request.destroy();
81
+ fail(err);
82
+ });
83
+ request.on('error', () => content.close());
84
+ content.on('open', () => content.pipe(request));
85
+ }
86
+ else {
87
+ request.end(content);
88
+ }
89
+ }
90
+ /** Sends a GET with only the given headers and resolves with the parsed JSON response. */
91
+ function getJson(url, headers, timeout) {
92
+ return new Promise((resolve, reject) => {
93
+ send(url, { method: 'GET', headers, timeout }, undefined, jsonResponse(resolve, reject), reject);
94
+ });
95
+ }
96
+ /**
97
+ * Reads a response as JSON. A non-2xx status rejects with the `message` or `error` of a JSON
98
+ * error body when there is one, and with the status otherwise. An HTML page rejects with an
99
+ * Error rather than its markup, since it usually means the URL points at a website, not an API.
100
+ */
101
+ function jsonResponse(resolve, reject) {
102
+ return response => {
103
+ response.setEncoding('utf-8');
104
+ let json = '';
105
+ // A connection lost after the headers have arrived ends the response without 'end' ever
106
+ // firing, so without this the promise is never settled and the command waits on a body
107
+ // that is not coming. The configured timeout would eventually rescue it, but rejecting
108
+ // here reports what actually happened instead of thirty seconds of silence.
109
+ response.on('error', reject);
110
+ response.on('data', chunk => json += chunk);
111
+ response.on('end', () => {
112
+ if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode > 299)) {
113
+ if (json.trimStart().startsWith('{')) {
114
+ try {
115
+ const parsed = JSON.parse(json);
116
+ const message = parsed.message || parsed.error;
117
+ if (message) {
118
+ // keep the status: the message alone cannot say whether retrying is worth it
119
+ reject((0, util_1.withStatus)(new Error(message), response.statusCode));
120
+ return;
121
+ }
122
+ }
123
+ catch (err) {
124
+ // Ignore the error and reject with response status
125
+ }
126
+ }
127
+ reject((0, util_1.statusError)(response));
128
+ }
129
+ else if (isHtml(response, json)) {
130
+ reject((0, util_1.withStatus)(new Error(`The server responded with status ${response.statusCode} and an HTML page instead of JSON.`), response.statusCode));
131
+ }
132
+ else {
133
+ try {
134
+ resolve(JSON.parse(json));
135
+ }
136
+ catch (err) {
137
+ reject(err);
138
+ }
139
+ }
140
+ });
141
+ };
142
+ }
143
+ /**
144
+ * Node's `timeout` option only raises an event - the request stays open, which is why a server
145
+ * that accepts a connection and then says nothing used to hold a command open indefinitely.
146
+ * Destroying the request with an error routes through the error handling each caller already
147
+ * has, so a stalled request rejects the way any other failure does. With a timeout of zero the
148
+ * event never fires and this does nothing.
149
+ */
150
+ function failOnTimeout(request, url, timeout, fail) {
151
+ request.on('timeout', () => {
152
+ // Reported before the request is torn down, rather than by destroying it with the error.
153
+ // Destroying raises errors of its own - ECONNRESET on the response, a premature close
154
+ // from pipeline - and node guarantees no order between those and the request's own. In
155
+ // practice the request's arrives first, so this is belt and braces rather than the thing
156
+ // that stops the wrong error being reported; that is the caller claiming the failure
157
+ // before it does any asynchronous cleanup.
158
+ fail(new Error(`No response from ${(0, util_1.redactUrl)(url)} for ${timeout} ms.`));
159
+ request.destroy();
160
+ });
161
+ }
162
+ // The body check covers servers that send HTML without a text/html Content-Type.
163
+ function isHtml(response, body) {
164
+ const contentType = response.headers['content-type']?.split(';')[0].trim().toLowerCase();
165
+ return contentType === 'text/html' || /^\s*<(?:!doctype\s+html|html)[\s>]/i.test(body);
166
+ }
167
+ function withoutCredentials(headers = {}) {
168
+ return Object.fromEntries(Object.entries(headers).filter(([name]) => !CREDENTIAL_HEADERS.test(name)));
169
+ }
170
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E;;AAsB/E,oBA4DC;AAGD,0BAIC;AAOD,oCAsCC;AApID,6BAA6B;AAC7B,+BAA+B;AAC/B,yBAAyB;AACzB,iCAA4D;AAE5D,qCAAqC;AACrC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,oGAAoG;AACpG,MAAM,kBAAkB,GAAG,iEAAiE,CAAC;AAI7F;;;;;;GAMG;AACH,SAAgB,IAAI,CAChB,GAAQ,EACR,OAA4B,EAC5B,IAA6B,EAC7B,UAAoD,EACpD,IAA0B,EAC1B,IAAI,GAAG,CAAC;IAER,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,IAAI,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CAAC,CAAC,CAAC;QACzE,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,iFAAiF;AACjF,SAAS,MAAM,CAAC,QAA8B,EAAE,IAAY;IACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzF,OAAO,WAAW,KAAK,WAAW,IAAI,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAoC,EAAE;IAC9D,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1G,CAAC"}
package/lib/index.d.ts CHANGED
@@ -18,6 +18,10 @@ export * from './publish';
18
18
  export * from './publish-options';
19
19
  export * from './registry';
20
20
  export * from './registry-options';
21
+ export * from './trusted-publishing';
22
+ export * from './trusted-publishing-options';
23
+ export * from './unpublish';
24
+ export * from './unpublish-options';
21
25
  export * from './verify-pat';
22
26
  export * from './verify-pat-options';
23
27
  export { isLicenseOk } from './check-license';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAElF,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAElF,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
package/lib/index.js CHANGED
@@ -35,6 +35,10 @@ __exportStar(require("./publish"), exports);
35
35
  __exportStar(require("./publish-options"), exports);
36
36
  __exportStar(require("./registry"), exports);
37
37
  __exportStar(require("./registry-options"), exports);
38
+ __exportStar(require("./trusted-publishing"), exports);
39
+ __exportStar(require("./trusted-publishing-options"), exports);
40
+ __exportStar(require("./unpublish"), exports);
41
+ __exportStar(require("./unpublish-options"), exports);
38
42
  __exportStar(require("./verify-pat"), exports);
39
43
  __exportStar(require("./verify-pat-options"), exports);
40
44
  var check_license_1 = require("./check-license");
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;;;;;;;;;;;;;;;;AAElF,qDAAmC;AACnC,6DAA2C;AAC3C,wCAAsB;AACtB,gDAA8B;AAC9B,0CAAwB;AACxB,kDAAgC;AAChC,2CAAyB;AACzB,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,qDAAmC;AACnC,+CAA6B;AAC7B,uDAAqC;AACrC,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,+BAAwD;AAA/C,wGAAA,gBAAgB,OAAA;AAAE,oGAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;;;;;;;;;;;;;;;;AAElF,qDAAmC;AACnC,6DAA2C;AAC3C,wCAAsB;AACtB,gDAA8B;AAC9B,0CAAwB;AACxB,kDAAgC;AAChC,2CAAyB;AACzB,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,qDAAmC;AACnC,uDAAqC;AACrC,+DAA6C;AAC7C,8CAA4B;AAC5B,sDAAoC;AACpC,+CAA6B;AAC7B,uDAAqC;AACrC,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,+BAAwD;AAA/C,wGAAA,gBAAgB,OAAA;AAAE,oGAAA,YAAY,OAAA"}
@@ -0,0 +1,24 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import { RegistryOptions } from './registry-options';
14
+ export interface ListOptions extends RegistryOptions {
15
+ /**
16
+ * Namespace whose extensions should be listed.
17
+ */
18
+ namespace: string;
19
+ /**
20
+ * Print the raw namespace metadata as JSON instead of a list.
21
+ */
22
+ json?: boolean;
23
+ }
24
+ //# sourceMappingURL=list-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-options.d.ts","sourceRoot":"","sources":["../src/list-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,WAAY,SAAQ,eAAe;IAChD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0.
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=list-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-options.js","sourceRoot":"","sources":["../src/list-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
package/lib/list.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import { ListOptions } from './list-options';
14
+ /**
15
+ * Lists the extensions published in a namespace.
16
+ */
17
+ export declare function list(options: ListOptions): Promise<void>;
18
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B9D"}
package/lib/list.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0.
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.list = list;
16
+ const registry_1 = require("./registry");
17
+ const table_1 = require("./table");
18
+ const util_1 = require("./util");
19
+ /**
20
+ * Lists the extensions published in a namespace.
21
+ */
22
+ async function list(options) {
23
+ (0, util_1.addEnvOptions)(options);
24
+ const registry = new registry_1.Registry(options);
25
+ const namespace = await registry.getNamespace(options.namespace);
26
+ if (namespace.error) {
27
+ throw new Error(namespace.error);
28
+ }
29
+ if (options.json) {
30
+ console.log(JSON.stringify(namespace, null, 4));
31
+ return;
32
+ }
33
+ // Sorted here rather than relying on the response's key order, so the output is stable and
34
+ // scriptable regardless of how the registry happens to serialise the map.
35
+ const names = Object.keys(namespace.extensions ?? {}).sort((a, b) => a.localeCompare(b));
36
+ const verified = namespace.verified ? ' (verified)' : '';
37
+ console.log(`${namespace.name}${verified} - ${(0, table_1.formatCount)(names.length, 'extension')}`);
38
+ if (names.length === 0) {
39
+ return;
40
+ }
41
+ console.log();
42
+ for (const name of names) {
43
+ console.log(` ${namespace.name}.${name}`);
44
+ }
45
+ }
46
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E;;AAU/E,oBA0BC;AAjCD,yCAAsC;AACtC,mCAAsC;AACtC,iCAAuC;AAEvC;;GAEG;AACI,KAAK,UAAU,IAAI,CAAC,OAAoB;IAC3C,IAAA,oBAAa,EAAC,OAAO,CAAC,CAAC;IACvB,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjE,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAChD,OAAO;IACX,CAAC;IAED,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,GAAG,QAAQ,MAAM,IAA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