ovsx 1.1.1 → 1.2.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.
- package/README.md +71 -1
- package/lib/get.js +1 -1
- package/lib/get.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/list-options.d.ts +24 -0
- package/lib/list-options.d.ts.map +1 -0
- package/lib/list-options.js +15 -0
- package/lib/list-options.js.map +1 -0
- package/lib/list.d.ts +18 -0
- package/lib/list.d.ts.map +1 -0
- package/lib/list.js +46 -0
- package/lib/list.js.map +1 -0
- package/lib/main.js +78 -2
- package/lib/main.js.map +1 -1
- package/lib/oidc.d.ts +22 -0
- package/lib/oidc.d.ts.map +1 -0
- package/lib/oidc.js +101 -0
- package/lib/oidc.js.map +1 -0
- package/lib/publish-options.d.ts +8 -1
- package/lib/publish-options.d.ts.map +1 -1
- package/lib/publish.d.ts.map +1 -1
- package/lib/publish.js +73 -4
- package/lib/publish.js.map +1 -1
- package/lib/registry-options.d.ts +8 -0
- package/lib/registry-options.d.ts.map +1 -1
- package/lib/registry.d.ts +119 -1
- package/lib/registry.d.ts.map +1 -1
- package/lib/registry.js +187 -19
- package/lib/registry.js.map +1 -1
- package/lib/search-options.d.ts +48 -0
- package/lib/search-options.d.ts.map +1 -0
- package/lib/search-options.js +15 -0
- package/lib/search-options.js.map +1 -0
- package/lib/search.d.ts +22 -0
- package/lib/search.d.ts.map +1 -0
- package/lib/search.js +86 -0
- package/lib/search.js.map +1 -0
- package/lib/show-options.d.ts +33 -0
- package/lib/show-options.d.ts.map +1 -0
- package/lib/show-options.js +15 -0
- package/lib/show-options.js.map +1 -0
- package/lib/show.d.ts +18 -0
- package/lib/show.d.ts.map +1 -0
- package/lib/show.js +289 -0
- package/lib/show.js.map +1 -0
- package/lib/table.d.ts +27 -0
- package/lib/table.d.ts.map +1 -0
- package/lib/table.js +56 -0
- package/lib/table.js.map +1 -0
- package/lib/trusted-publishing-options.d.ts +30 -0
- package/lib/trusted-publishing-options.d.ts.map +1 -0
- package/lib/trusted-publishing-options.js +15 -0
- package/lib/trusted-publishing-options.js.map +1 -0
- package/lib/trusted-publishing.d.ts +35 -0
- package/lib/trusted-publishing.d.ts.map +1 -0
- package/lib/trusted-publishing.js +112 -0
- package/lib/trusted-publishing.js.map +1 -0
- package/lib/unpublish-options.d.ts +34 -0
- package/lib/unpublish-options.d.ts.map +1 -0
- package/lib/unpublish-options.js +15 -0
- package/lib/unpublish-options.js.map +1 -0
- package/lib/unpublish.d.ts +22 -0
- package/lib/unpublish.d.ts.map +1 -0
- package/lib/unpublish.js +137 -0
- package/lib/unpublish.js.map +1 -0
- package/lib/util.d.ts +39 -1
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +91 -5
- package/lib/util.js.map +1 -1
- package/lib/verify-options.d.ts +24 -0
- package/lib/verify-options.d.ts.map +1 -0
- package/lib/verify-options.js +15 -0
- package/lib/verify-options.js.map +1 -0
- package/lib/verify-signature-options.d.ts +32 -0
- package/lib/verify-signature-options.d.ts.map +1 -0
- package/lib/verify-signature-options.js +15 -0
- package/lib/verify-signature-options.js.map +1 -0
- package/lib/verify-signature.d.ts +28 -0
- package/lib/verify-signature.d.ts.map +1 -0
- package/lib/verify-signature.js +105 -0
- package/lib/verify-signature.js.map +1 -0
- package/lib/verify.d.ts +21 -0
- package/lib/verify.d.ts.map +1 -0
- package/lib/verify.js +97 -0
- package/lib/verify.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/zip.d.ts +10 -0
- package/lib/zip.d.ts.map +1 -1
- package/lib/zip.js +31 -0
- package/lib/zip.js.map +1 -1
- package/package.json +9 -5
- package/src/get.ts +1 -1
- package/src/index.ts +4 -0
- package/src/list-options.ts +25 -0
- package/src/list.ts +48 -0
- package/src/main.ts +89 -3
- package/src/oidc.ts +107 -0
- package/src/publish-options.ts +8 -1
- package/src/publish.ts +97 -5
- package/src/registry-options.ts +8 -0
- package/src/registry.ts +292 -19
- package/src/search-options.ts +49 -0
- package/src/search.ts +95 -0
- package/src/show-options.ts +34 -0
- package/src/show.ts +328 -0
- package/src/table.ts +53 -0
- package/src/trusted-publishing-options.ts +30 -0
- package/src/trusted-publishing.ts +148 -0
- package/src/unpublish-options.ts +35 -0
- package/src/unpublish.ts +160 -0
- package/src/util.ts +102 -5
- package/src/verify-options.ts +25 -0
- package/src/verify-signature-options.ts +32 -0
- package/src/verify-signature.ts +124 -0
- package/src/verify.ts +107 -0
- package/src/version.ts +1 -1
- package/src/zip.ts +31 -1
|
@@ -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=unpublish-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpublish-options.js","sourceRoot":"","sources":["../src/unpublish-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { UnpublishOptions } from './unpublish-options';
|
|
14
|
+
/**
|
|
15
|
+
* Oldest registry version that exposes the `delete` endpoint used by this command.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MIN_UNPUBLISH_REGISTRY_VERSION = "1.2.0";
|
|
18
|
+
/**
|
|
19
|
+
* Deletes an extension or some of its versions from the registry.
|
|
20
|
+
*/
|
|
21
|
+
export declare function unpublish(options?: UnpublishOptions): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=unpublish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpublish.d.ts","sourceRoot":"","sources":["../src/unpublish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAY/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;GAEG;AACH,eAAO,MAAM,8BAA8B,UAAU,CAAC;AAEtD;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B7E"}
|
package/lib/unpublish.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
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.MIN_UNPUBLISH_REGISTRY_VERSION = void 0;
|
|
16
|
+
exports.unpublish = unpublish;
|
|
17
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
18
|
+
// `import * as isCI from 'is-ci'` would bind to a namespace object instead of the boolean `is-ci`
|
|
19
|
+
// exports whenever the importer applies ES module interop (e.g. a bundler, or vitest's own
|
|
20
|
+
// transform), making the truthiness check below always true. `import = require` always binds
|
|
21
|
+
// directly to the exported value, regardless of how the importing tool handles interop.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
+
const isCI = require("is-ci");
|
|
24
|
+
const semver = require("semver");
|
|
25
|
+
const pat_1 = require("./pat");
|
|
26
|
+
const registry_1 = require("./registry");
|
|
27
|
+
const util_1 = require("./util");
|
|
28
|
+
/**
|
|
29
|
+
* Oldest registry version that exposes the `delete` endpoint used by this command.
|
|
30
|
+
*/
|
|
31
|
+
exports.MIN_UNPUBLISH_REGISTRY_VERSION = '1.2.0';
|
|
32
|
+
/**
|
|
33
|
+
* Deletes an extension or some of its versions from the registry.
|
|
34
|
+
*/
|
|
35
|
+
async function unpublish(options = {}) {
|
|
36
|
+
(0, util_1.addEnvOptions)(options);
|
|
37
|
+
if (options.targets && !options.versions) {
|
|
38
|
+
throw new Error("Please specify the versions to delete with '--versions' when using '--target'.");
|
|
39
|
+
}
|
|
40
|
+
const extensionId = options.extensionId ?? await readExtensionId();
|
|
41
|
+
const match = (0, util_1.matchExtensionId)(extensionId);
|
|
42
|
+
if (!match) {
|
|
43
|
+
throw new Error('The extension identifier must have the form `namespace.extension` or `namespace/extension`.');
|
|
44
|
+
}
|
|
45
|
+
const [, namespace, extension] = match;
|
|
46
|
+
const registry = new registry_1.Registry(options);
|
|
47
|
+
await ensureUnpublishSupported(registry);
|
|
48
|
+
options.pat = await (0, pat_1.getPAT)(namespace, { ...options, namespace }, false);
|
|
49
|
+
const targetVersions = getTargetVersions(options);
|
|
50
|
+
await confirmUnpublish(`${namespace}.${extension}`, targetVersions, registry.url, options.force);
|
|
51
|
+
const result = await registry.deleteExtension(namespace, extension, targetVersions, options.pat);
|
|
52
|
+
if (result.error) {
|
|
53
|
+
throw new Error(result.error);
|
|
54
|
+
}
|
|
55
|
+
// the registry reports one line per deleted version, and nothing at all if there was nothing to delete
|
|
56
|
+
console.log(`🗑 ${result.success || `Nothing to delete for ${namespace}.${extension}`}`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads the extension identifier from the `package.json` in the current directory,
|
|
60
|
+
* so that `ovsx unpublish` can be run from an extension folder without arguments.
|
|
61
|
+
*/
|
|
62
|
+
async function readExtensionId() {
|
|
63
|
+
let error;
|
|
64
|
+
try {
|
|
65
|
+
const manifest = await (0, util_1.readManifest)();
|
|
66
|
+
if (manifest.publisher && manifest.name) {
|
|
67
|
+
return `${manifest.publisher}.${manifest.name}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
error = e;
|
|
72
|
+
}
|
|
73
|
+
throw new Error('Unable to read the extension identifier. Please supply it as an argument or run ovsx from the extension folder.' +
|
|
74
|
+
(error ? `\n\n${error}` : ''));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Fails fast with an actionable message when the registry is known to be too old to support
|
|
78
|
+
* deleting extensions, rather than letting the delete request fail with a generic 404.
|
|
79
|
+
*
|
|
80
|
+
* The check is best-effort: registries that don't expose `/api/version` at all, or report a
|
|
81
|
+
* version that can't be parsed as semver (e.g. a build without `ovsx.registry.version` set),
|
|
82
|
+
* are assumed to support the endpoint. The delete request itself will surface any real
|
|
83
|
+
* incompatibility in that case.
|
|
84
|
+
*/
|
|
85
|
+
async function ensureUnpublishSupported(registry) {
|
|
86
|
+
let reportedVersion;
|
|
87
|
+
try {
|
|
88
|
+
reportedVersion = (await registry.getRegistryVersion()).version;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// `coerce` drops any prerelease/build suffix (e.g. `1.2.0-dev.0` or `1.2.0-SNAPSHOT` both
|
|
94
|
+
// become `1.2.0`), so development builds of a supported release compare as supported too.
|
|
95
|
+
const version = semver.coerce(reportedVersion);
|
|
96
|
+
if (version && semver.lt(version, exports.MIN_UNPUBLISH_REGISTRY_VERSION)) {
|
|
97
|
+
throw new Error(`The registry at ${registry.url} runs version ${reportedVersion}, but deleting extensions requires `
|
|
98
|
+
+ `version ${exports.MIN_UNPUBLISH_REGISTRY_VERSION} or later.`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the versions to delete, or `undefined` to delete the extension as a whole.
|
|
103
|
+
* A version without target platform tells the registry to delete all target platforms
|
|
104
|
+
* of that version.
|
|
105
|
+
*/
|
|
106
|
+
function getTargetVersions(options) {
|
|
107
|
+
if (!options.versions) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (!options.targets) {
|
|
111
|
+
return options.versions.map(version => ({ version }));
|
|
112
|
+
}
|
|
113
|
+
return options.versions.flatMap(version => options.targets.map(targetPlatform => ({ version, targetPlatform })));
|
|
114
|
+
}
|
|
115
|
+
async function confirmUnpublish(extensionId, targetVersions, registryUrl, force) {
|
|
116
|
+
if (force) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (isCI || !process.stdin.isTTY) {
|
|
120
|
+
throw new Error("Aborted. Use '--force' to delete without confirmation.");
|
|
121
|
+
}
|
|
122
|
+
const what = targetVersions
|
|
123
|
+
? targetVersions.map(target => describe(extensionId, target)).join(', ')
|
|
124
|
+
: `all versions of ${extensionId}`;
|
|
125
|
+
const confirmed = await (0, prompts_1.confirm)({
|
|
126
|
+
message: `Delete ${what} from ${registryUrl}? Deleted versions can never be published again.`,
|
|
127
|
+
default: false
|
|
128
|
+
});
|
|
129
|
+
if (!confirmed) {
|
|
130
|
+
throw new Error('Aborted.');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function describe(extensionId, target) {
|
|
134
|
+
const version = `${extensionId} v${target.version}`;
|
|
135
|
+
return target.targetPlatform ? `${version}@${target.targetPlatform}` : version;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=unpublish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpublish.js","sourceRoot":"","sources":["../src/unpublish.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E;;;AAuB/E,8BA2BC;AAhDD,+CAA4C;AAC5C,kGAAkG;AAClG,2FAA2F;AAC3F,6FAA6F;AAC7F,wFAAwF;AACxF,iEAAiE;AACjE,8BAA+B;AAC/B,iCAAiC;AACjC,+BAA+B;AAC/B,yCAA6D;AAE7D,iCAAuE;AAEvE;;GAEG;AACU,QAAA,8BAA8B,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACI,KAAK,UAAU,SAAS,CAAC,UAA4B,EAAE;IAC1D,IAAA,oBAAa,EAAC,OAAO,CAAC,CAAC;IACvB,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IACtG,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,eAAe,EAAE,CAAC;IACnE,MAAM,KAAK,GAAG,IAAA,uBAAgB,EAAC,WAAW,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;IACnH,CAAC;IAED,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAEzC,OAAO,CAAC,GA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IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,IAAI,GAAG,cAAc;QACvB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxE,CAAC,CAAC,mBAAmB,WAAW,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,MAAM,IAAA,iBAAO,EAAC;QAC5B,OAAO,EAAE,UAAU,IAAI,SAAS,WAAW,kDAAkD;QAC7F,OAAO,EAAE,KAAK;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,WAAmB,EAAE,MAA6B;IAChE,MAAM,OAAO,GAAG,GAAG,WAAW,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;IACpD,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACnF,CAAC"}
|
package/lib/util.d.ts
CHANGED
|
@@ -11,15 +11,53 @@ import * as fs from 'fs';
|
|
|
11
11
|
import * as tmp from 'tmp';
|
|
12
12
|
import * as http from 'http';
|
|
13
13
|
import { RegistryOptions } from './registry-options';
|
|
14
|
+
import { TrustedPublishingOptions } from './trusted-publishing-options';
|
|
14
15
|
export { promisify } from 'util';
|
|
15
16
|
export declare function addEnvOptions(options: RegistryOptions): void;
|
|
17
|
+
export declare function addTrustedPublishingEnvOptions(options: TrustedPublishingOptions): void;
|
|
18
|
+
/** How long a request may make no progress before it is abandoned; see RegistryOptions.timeout. */
|
|
19
|
+
export declare const DEFAULT_TIMEOUT = 30000;
|
|
20
|
+
/**
|
|
21
|
+
* The configured request timeout, for requests that have no RegistryOptions to read it from - the CI
|
|
22
|
+
* token exchange deliberately shares nothing with the registry, but there is no reason for it to be
|
|
23
|
+
* on a different clock.
|
|
24
|
+
*/
|
|
25
|
+
export declare function configuredTimeout(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Parses a commander option that must be a non-negative whole number, so a typo is reported by the
|
|
28
|
+
* CLI rather than sent to the registry as a bad request.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseNonNegativeInt(value: string): number;
|
|
16
31
|
export declare function matchExtensionId(id: string): RegExpExecArray | null;
|
|
17
32
|
export declare function optionalStat(path: fs.PathLike): Promise<fs.Stats | undefined>;
|
|
18
33
|
export declare function makeDirs(path: fs.PathLike): Promise<void>;
|
|
19
34
|
export declare function createTempFile(options: tmp.TmpNameOptions): Promise<string>;
|
|
20
35
|
export declare function rejectError(err: any): Promise<never>;
|
|
21
36
|
export declare function handleError(debug?: boolean, additionalMessage?: string, exit?: boolean): (reason: any) => void;
|
|
22
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Formats a byte count for display, e.g. `1536` -> `1.5 KB`. Mirrors the registry's own
|
|
39
|
+
* `FileUtils.byteCountToDisplaySize` formatting so client- and server-side size limit messages read
|
|
40
|
+
* the same way.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatBytes(bytes: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* An error carrying the HTTP status that produced it, so a caller can tell "the registry refused this"
|
|
45
|
+
* from "the registry could not answer right now" without matching on the message.
|
|
46
|
+
*/
|
|
47
|
+
export interface StatusError extends Error {
|
|
48
|
+
status?: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function withStatus(error: Error, status?: number): StatusError;
|
|
51
|
+
/**
|
|
52
|
+
* A URL in the form it can safely be printed: no user info and no query string.
|
|
53
|
+
*
|
|
54
|
+
* `createNamespace`, `verifyPat`, `publish` and `delete` all put the personal access token in a
|
|
55
|
+
* `token` query parameter, and an error message goes straight to stderr and from there into CI logs.
|
|
56
|
+
* The query carries nothing an error needs, so it is dropped whole rather than filtered key by key -
|
|
57
|
+
* a filter has to be kept in step with every parameter anyone ever adds.
|
|
58
|
+
*/
|
|
59
|
+
export declare function redactUrl(url: URL | string): string;
|
|
60
|
+
export declare function statusError(response: http.IncomingMessage): StatusError;
|
|
23
61
|
export declare function readFile(name: string, packagePath?: string, encoding?: BufferEncoding): Promise<string>;
|
|
24
62
|
export declare function readManifest(packagePath?: string): Promise<Manifest>;
|
|
25
63
|
export declare function validateManifest(manifest: Manifest): void;
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAElF,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;kFAQkF;AAElF,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAM5D;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAItF;AAED,mGAAmG;AACnG,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,C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AC,CAchH;AAED,wBAAsB,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAG1E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAUzD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAehI;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrF;AAED,MAAM,WAAW,QAAQ;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/lib/util.js
CHANGED
|
@@ -9,14 +9,20 @@
|
|
|
9
9
|
* SPDX-License-Identifier: EPL-2.0
|
|
10
10
|
********************************************************************************/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.promisify = void 0;
|
|
12
|
+
exports.DEFAULT_TIMEOUT = exports.promisify = void 0;
|
|
13
13
|
exports.addEnvOptions = addEnvOptions;
|
|
14
|
+
exports.addTrustedPublishingEnvOptions = addTrustedPublishingEnvOptions;
|
|
15
|
+
exports.configuredTimeout = configuredTimeout;
|
|
16
|
+
exports.parseNonNegativeInt = parseNonNegativeInt;
|
|
14
17
|
exports.matchExtensionId = matchExtensionId;
|
|
15
18
|
exports.optionalStat = optionalStat;
|
|
16
19
|
exports.makeDirs = makeDirs;
|
|
17
20
|
exports.createTempFile = createTempFile;
|
|
18
21
|
exports.rejectError = rejectError;
|
|
19
22
|
exports.handleError = handleError;
|
|
23
|
+
exports.formatBytes = formatBytes;
|
|
24
|
+
exports.withStatus = withStatus;
|
|
25
|
+
exports.redactUrl = redactUrl;
|
|
20
26
|
exports.statusError = statusError;
|
|
21
27
|
exports.readFile = readFile;
|
|
22
28
|
exports.readManifest = readManifest;
|
|
@@ -33,6 +39,48 @@ function addEnvOptions(options) {
|
|
|
33
39
|
options.pat ?? (options.pat = process.env.OVSX_PAT);
|
|
34
40
|
options.username ?? (options.username = process.env.OVSX_USERNAME);
|
|
35
41
|
options.password ?? (options.password = process.env.OVSX_PASSWORD);
|
|
42
|
+
options.timeout ?? (options.timeout = parseIntEnv(process.env.OVSX_TIMEOUT));
|
|
43
|
+
}
|
|
44
|
+
function addTrustedPublishingEnvOptions(options) {
|
|
45
|
+
options.trustedPublishing ?? (options.trustedPublishing = parseBooleanEnv(process.env.OVSX_TRUSTED_PUBLISHING));
|
|
46
|
+
options.idToken ?? (options.idToken = process.env.OVSX_ID_TOKEN);
|
|
47
|
+
options.oidcAudience ?? (options.oidcAudience = process.env.OVSX_OIDC_AUDIENCE);
|
|
48
|
+
}
|
|
49
|
+
/** How long a request may make no progress before it is abandoned; see RegistryOptions.timeout. */
|
|
50
|
+
exports.DEFAULT_TIMEOUT = 30000;
|
|
51
|
+
/**
|
|
52
|
+
* The configured request timeout, for requests that have no RegistryOptions to read it from - the CI
|
|
53
|
+
* token exchange deliberately shares nothing with the registry, but there is no reason for it to be
|
|
54
|
+
* on a different clock.
|
|
55
|
+
*/
|
|
56
|
+
function configuredTimeout() {
|
|
57
|
+
return parseIntEnv(process.env.OVSX_TIMEOUT) ?? exports.DEFAULT_TIMEOUT;
|
|
58
|
+
}
|
|
59
|
+
function parseIntEnv(value) {
|
|
60
|
+
if (value === undefined || value.trim().length === 0) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const parsed = Number(value.trim());
|
|
64
|
+
// Left undefined rather than throwing, so a mistyped variable falls back to the default instead
|
|
65
|
+
// of stopping a command that would otherwise work.
|
|
66
|
+
return Number.isInteger(parsed) && parsed >= 0 ? parsed : undefined;
|
|
67
|
+
}
|
|
68
|
+
function parseBooleanEnv(value) {
|
|
69
|
+
if (value === undefined || value.trim().length === 0) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
return ['true', '1', 'yes'].includes(value.trim().toLowerCase());
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parses a commander option that must be a non-negative whole number, so a typo is reported by the
|
|
76
|
+
* CLI rather than sent to the registry as a bad request.
|
|
77
|
+
*/
|
|
78
|
+
function parseNonNegativeInt(value) {
|
|
79
|
+
const parsed = Number(value);
|
|
80
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
81
|
+
throw new Error(`Expected a non-negative whole number, got '${value}'.`);
|
|
82
|
+
}
|
|
83
|
+
return parsed;
|
|
36
84
|
}
|
|
37
85
|
function matchExtensionId(id) {
|
|
38
86
|
return /^([\w-]+)(?:\.|\/)([\w-]+)$/.exec(id);
|
|
@@ -93,11 +141,49 @@ function handleError(debug, additionalMessage, exit = true) {
|
|
|
93
141
|
}
|
|
94
142
|
};
|
|
95
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Formats a byte count for display, e.g. `1536` -> `1.5 KB`. Mirrors the registry's own
|
|
146
|
+
* `FileUtils.byteCountToDisplaySize` formatting so client- and server-side size limit messages read
|
|
147
|
+
* the same way.
|
|
148
|
+
*/
|
|
149
|
+
function formatBytes(bytes) {
|
|
150
|
+
const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
151
|
+
let size = bytes;
|
|
152
|
+
let unit = 0;
|
|
153
|
+
while (size >= 1024 && unit < units.length - 1) {
|
|
154
|
+
size /= 1024;
|
|
155
|
+
unit++;
|
|
156
|
+
}
|
|
157
|
+
return `${Math.floor(size)} ${units[unit]}`;
|
|
158
|
+
}
|
|
159
|
+
function withStatus(error, status) {
|
|
160
|
+
const withStatusCode = error;
|
|
161
|
+
withStatusCode.status = status;
|
|
162
|
+
return withStatusCode;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A URL in the form it can safely be printed: no user info and no query string.
|
|
166
|
+
*
|
|
167
|
+
* `createNamespace`, `verifyPat`, `publish` and `delete` all put the personal access token in a
|
|
168
|
+
* `token` query parameter, and an error message goes straight to stderr and from there into CI logs.
|
|
169
|
+
* The query carries nothing an error needs, so it is dropped whole rather than filtered key by key -
|
|
170
|
+
* a filter has to be kept in step with every parameter anyone ever adds.
|
|
171
|
+
*/
|
|
172
|
+
function redactUrl(url) {
|
|
173
|
+
try {
|
|
174
|
+
const parsed = typeof url === 'string' ? new URL(url) : url;
|
|
175
|
+
return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Not parseable, so nothing can be assumed about what it holds.
|
|
179
|
+
return '<url>';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
96
182
|
function statusError(response) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
183
|
+
const message = response.statusMessage
|
|
184
|
+
? `The server responded with status ${response.statusCode}: ${response.statusMessage}`
|
|
185
|
+
: `The server responded with status ${response.statusCode}.`;
|
|
186
|
+
return withStatus(new Error(message), response.statusCode);
|
|
101
187
|
}
|
|
102
188
|
function readFile(name, packagePath, encoding = 'utf-8') {
|
|
103
189
|
return new Promise((resolve, reject) => {
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;;AAWlF,sCAMC;AAED,wEAIC;AAUD,8CAEC;AAuBD,kDAMC;AAED,4CAEC;AAED,oCAIC;AAED,4BAaC;AAED,wCASC;AAED,kCAGC;AAED,kCAmBC;AAOD,kCASC;AAUD,gCAIC;AAUD,8BAQC;AA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AE,CAAC,CAAC,CAAC;IAClD,OAAO,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -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 VerifyOptions extends RegistryOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Path to the downloaded .vsix package to verify.
|
|
17
|
+
*/
|
|
18
|
+
packagePath: string;
|
|
19
|
+
/**
|
|
20
|
+
* Target platform. Defaults to universal.
|
|
21
|
+
*/
|
|
22
|
+
target?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=verify-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-options.d.ts","sourceRoot":"","sources":["../src/verify-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,eAAe;IAClD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -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=verify-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-options.js","sourceRoot":"","sources":["../src/verify-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
|
|
@@ -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
|
+
export interface VerifySignatureOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Path to the .vsix package.
|
|
16
|
+
*/
|
|
17
|
+
packagePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* Path to the signature manifest file (the `.signature.manifest` entry of a registry's
|
|
20
|
+
* signature archive).
|
|
21
|
+
*/
|
|
22
|
+
manifestPath: string;
|
|
23
|
+
/**
|
|
24
|
+
* Path to the signature file (the `.signature.sig` entry of a registry's signature archive).
|
|
25
|
+
*/
|
|
26
|
+
signaturePath: string;
|
|
27
|
+
/**
|
|
28
|
+
* Path to the registry's public key file, in PEM format.
|
|
29
|
+
*/
|
|
30
|
+
publicKeyPath: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=verify-signature-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-signature-options.d.ts","sourceRoot":"","sources":["../src/verify-signature-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -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=verify-signature-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-signature-options.js","sourceRoot":"","sources":["../src/verify-signature-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { VerifySignatureOptions } from './verify-signature-options';
|
|
14
|
+
/**
|
|
15
|
+
* Verifies a package/manifest/signature file trio entirely offline, the same way `vsce
|
|
16
|
+
* verify-signature` does - no registry involved, every input is a local file. Unlike `verify`,
|
|
17
|
+
* which fetches everything it needs from a registry for a package identified by name, this is for
|
|
18
|
+
* a signature archive you already extracted yourself (e.g. the `.sigzip` a registry serves has a
|
|
19
|
+
* `.signature.sig` and a `.signature.manifest` entry, matching `--signaturePath` and
|
|
20
|
+
* `--manifestPath` here).
|
|
21
|
+
*
|
|
22
|
+
* `vsce verify-signature` validates against Microsoft's own (closed-source) signing scheme and
|
|
23
|
+
* has no need for a public key argument - VS Code's Marketplace keys are baked into its verifier.
|
|
24
|
+
* Open VSX's registries each hold their own Ed25519 key pair instead, so `--publicKeyPath` is
|
|
25
|
+
* required here to say which registry's signature this is supposed to be.
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifySignature(options: VerifySignatureOptions): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=verify-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-signature.d.ts","sourceRoot":"","sources":["../src/verify-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAK/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAYpE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BpF"}
|