@vscode/vsce 3.9.3-1 → 3.9.3-11
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 +26 -8
- package/dist/vsce.d.ts +4 -0
- package/out/main.js +6 -2
- package/out/npm.js +4 -9
- package/out/oidc.js +125 -0
- package/out/package.js +160 -86
- package/out/packageSpec.js +49 -0
- package/out/publicgalleryapi.js +3 -1
- package/out/publish.js +52 -26
- package/out/secretLint.js +134 -65
- package/out/store.js +7 -2
- package/out/util.js +16 -19
- package/out/validation.js +3 -6
- package/package.json +11 -20
- package/out/typings/secret-lint-types.js +0 -878
package/out/publish.js
CHANGED
|
@@ -40,21 +40,30 @@ exports.publish = publish;
|
|
|
40
40
|
exports.unpublish = unpublish;
|
|
41
41
|
exports.getPAT = getPAT;
|
|
42
42
|
const fs = __importStar(require("fs"));
|
|
43
|
-
const util_1 = require("util");
|
|
44
43
|
const semver = __importStar(require("semver"));
|
|
45
44
|
const GalleryInterfaces_1 = require("azure-devops-node-api/interfaces/GalleryInterfaces");
|
|
46
45
|
const package_1 = require("./package");
|
|
47
|
-
const tmp = __importStar(require("tmp"));
|
|
48
46
|
const store_1 = require("./store");
|
|
49
|
-
const
|
|
47
|
+
const util_1 = require("./util");
|
|
50
48
|
const zip_1 = require("./zip");
|
|
51
49
|
const validation_1 = require("./validation");
|
|
52
50
|
const form_data_1 = __importDefault(require("form-data"));
|
|
53
51
|
const path_1 = require("path");
|
|
52
|
+
const os_1 = require("os");
|
|
54
53
|
const cockatiel_1 = require("cockatiel");
|
|
55
54
|
const auth_1 = require("./auth");
|
|
56
|
-
const
|
|
55
|
+
const oidc_1 = require("./oidc");
|
|
56
|
+
async function withTemporaryPackage(fn) {
|
|
57
|
+
const directory = await fs.promises.mkdtemp((0, path_1.join)((0, os_1.tmpdir)(), 'vsce-'));
|
|
58
|
+
try {
|
|
59
|
+
return await fn((0, path_1.join)(directory, 'extension.vsix'));
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
await fs.promises.rm(directory, { recursive: true, force: true });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
57
65
|
async function publish(options = {}) {
|
|
66
|
+
validateAuthenticationOptions(options);
|
|
58
67
|
if (options.packagePath) {
|
|
59
68
|
if (options.version) {
|
|
60
69
|
throw new Error(`Both options not supported simultaneously: 'packagePath' and 'version'.`);
|
|
@@ -106,38 +115,40 @@ async function publish(options = {}) {
|
|
|
106
115
|
else {
|
|
107
116
|
const cwd = options.cwd || process.cwd();
|
|
108
117
|
const manifest = await (0, package_1.readManifest)(cwd);
|
|
109
|
-
(0,
|
|
118
|
+
(0, util_1.patchOptionsWithManifest)(options, manifest);
|
|
110
119
|
// Validate marketplace requirements before prepublish to avoid unnecessary work
|
|
111
120
|
validateManifestForPublishing(manifest, options);
|
|
112
121
|
await (0, package_1.prepublish)(cwd, manifest, options.useYarn);
|
|
113
122
|
await (0, package_1.versionBump)(options);
|
|
114
123
|
if (options.targets) {
|
|
115
124
|
for (const target of options.targets) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
await withTemporaryPackage(async (packagePath) => {
|
|
126
|
+
const packageResult = await (0, package_1.pack)({ ...options, target, packagePath });
|
|
127
|
+
const manifestValidated = validateManifestForPublishing(packageResult.manifest, options);
|
|
128
|
+
const sigzipPath = options.signTool ? await (0, package_1.signPackage)(packagePath, options.signTool) : undefined;
|
|
129
|
+
await _publish(packagePath, sigzipPath, manifestValidated, { ...options, target });
|
|
130
|
+
});
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
133
|
else {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
await withTemporaryPackage(async (packagePath) => {
|
|
135
|
+
const packageResult = await (0, package_1.pack)({ ...options, packagePath });
|
|
136
|
+
const manifestValidated = validateManifestForPublishing(packageResult.manifest, options);
|
|
137
|
+
const sigzipPath = options.signTool ? await (0, package_1.signPackage)(packagePath, options.signTool) : undefined;
|
|
138
|
+
await _publish(packagePath, sigzipPath, manifestValidated, options);
|
|
139
|
+
});
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
142
|
}
|
|
132
143
|
async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
133
144
|
const pat = await getPAT(manifest.publisher, options);
|
|
134
|
-
const api = await (0,
|
|
145
|
+
const api = await (0, util_1.getGalleryAPI)(pat);
|
|
135
146
|
const packageStream = fs.createReadStream(packagePath);
|
|
136
147
|
const name = `${manifest.publisher}.${manifest.name}`;
|
|
137
148
|
const description = options.target
|
|
138
149
|
? `${name} (${options.target}) v${manifest.version}`
|
|
139
150
|
: `${name} v${manifest.version}`;
|
|
140
|
-
|
|
151
|
+
util_1.log.info(`Publishing '${description}'...`);
|
|
141
152
|
let extension = null;
|
|
142
153
|
try {
|
|
143
154
|
try {
|
|
@@ -153,7 +164,7 @@ async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
|
153
164
|
(v.targetPlatform === options.target));
|
|
154
165
|
if (versionExists) {
|
|
155
166
|
if (options.skipDuplicate) {
|
|
156
|
-
|
|
167
|
+
util_1.log.done(`Version ${manifest.version} is already published. Skipping publish.`);
|
|
157
168
|
return;
|
|
158
169
|
}
|
|
159
170
|
else {
|
|
@@ -170,7 +181,7 @@ async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
|
170
181
|
catch (err) {
|
|
171
182
|
if (err.statusCode === 409) {
|
|
172
183
|
if (options.skipDuplicate) {
|
|
173
|
-
|
|
184
|
+
util_1.log.done(`Version ${manifest.version} is already published. Skipping publish.`);
|
|
174
185
|
return;
|
|
175
186
|
}
|
|
176
187
|
else {
|
|
@@ -202,9 +213,9 @@ async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
|
202
213
|
}
|
|
203
214
|
throw err;
|
|
204
215
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
216
|
+
util_1.log.info(`Extension URL (might take a few minutes): ${(0, util_1.getPublishedUrl)(name)}`);
|
|
217
|
+
util_1.log.info(`Hub URL: ${(0, util_1.getHubUrl)(manifest.publisher, manifest.name)}`);
|
|
218
|
+
util_1.log.done(`Published ${description}.`);
|
|
208
219
|
}
|
|
209
220
|
async function _publishSignedPackage(api, packageName, packageStream, sigzipName, sigzipStream, manifest) {
|
|
210
221
|
const extensionType = 'Visual Studio Code';
|
|
@@ -219,7 +230,7 @@ async function _publishSignedPackage(api, packageName, packageStream, sigzipName
|
|
|
219
230
|
});
|
|
220
231
|
const publishWithRetry = (0, cockatiel_1.retry)((0, cockatiel_1.handleWhen)(err => err.message.includes('timeout')), {
|
|
221
232
|
maxAttempts: 3,
|
|
222
|
-
backoff: new cockatiel_1.IterableBackoff([
|
|
233
|
+
backoff: new cockatiel_1.IterableBackoff([5_000, 10_000, 20_000])
|
|
223
234
|
});
|
|
224
235
|
return await publishWithRetry.execute(async () => {
|
|
225
236
|
return await api.publishExtensionWithPublisherSignature(undefined, form, manifest.publisher, manifest.name, extensionType);
|
|
@@ -237,15 +248,15 @@ async function unpublish(options = {}) {
|
|
|
237
248
|
}
|
|
238
249
|
const fullName = `${publisher}.${name}`;
|
|
239
250
|
if (!options.force) {
|
|
240
|
-
const answer = await (0,
|
|
251
|
+
const answer = await (0, util_1.read)(`This will delete ALL published versions! Please type '${fullName}' to confirm: `);
|
|
241
252
|
if (answer !== fullName) {
|
|
242
253
|
throw new Error('Aborted');
|
|
243
254
|
}
|
|
244
255
|
}
|
|
245
256
|
const pat = await getPAT(publisher, options);
|
|
246
|
-
const api = await (0,
|
|
257
|
+
const api = await (0, util_1.getGalleryAPI)(pat);
|
|
247
258
|
await api.deleteExtension(publisher, name);
|
|
248
|
-
|
|
259
|
+
util_1.log.done(`Deleted extension: ${fullName}!`);
|
|
249
260
|
}
|
|
250
261
|
function validateManifestForPublishing(manifest, options) {
|
|
251
262
|
if (manifest.enableProposedApi && !options.allowAllProposedApis && !options.noVerify) {
|
|
@@ -260,6 +271,10 @@ function validateManifestForPublishing(manifest, options) {
|
|
|
260
271
|
return { ...manifest, publisher: (0, validation_1.validatePublisher)(manifest.publisher) };
|
|
261
272
|
}
|
|
262
273
|
async function getPAT(publisher, options) {
|
|
274
|
+
validateAuthenticationOptions(options);
|
|
275
|
+
if (options.oidc) {
|
|
276
|
+
return await (0, oidc_1.getOIDCCredential)(publisher);
|
|
277
|
+
}
|
|
263
278
|
if (options.pat) {
|
|
264
279
|
return options.pat;
|
|
265
280
|
}
|
|
@@ -268,4 +283,15 @@ async function getPAT(publisher, options) {
|
|
|
268
283
|
}
|
|
269
284
|
return (await (0, store_1.getPublisher)(publisher)).pat;
|
|
270
285
|
}
|
|
286
|
+
function validateAuthenticationOptions(options) {
|
|
287
|
+
if (!options.oidc) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (options.pat) {
|
|
291
|
+
throw new Error(`The '--oidc' and '--pat' options cannot be used together.`);
|
|
292
|
+
}
|
|
293
|
+
if (options.azureCredential) {
|
|
294
|
+
throw new Error(`The '--oidc' and '--azure-credential' options cannot be used together.`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
271
297
|
//# sourceMappingURL=publish.js.map
|
package/out/secretLint.js
CHANGED
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.lintFiles = lintFiles;
|
|
7
37
|
exports.lintText = lintText;
|
|
8
38
|
exports.getRuleNameFromRuleId = getRuleNameFromRuleId;
|
|
9
39
|
exports.prettyPrintLintResult = prettyPrintLintResult;
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const util_1 = require("
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const util_1 = require("util");
|
|
43
|
+
const url_1 = require("url");
|
|
44
|
+
const util_2 = require("./util");
|
|
13
45
|
const secretsScanningRules = [
|
|
14
46
|
{
|
|
15
47
|
id: "@secretlint/secretlint-rule-preset-recommend",
|
|
@@ -45,100 +77,137 @@ const dotEnvRules = [
|
|
|
45
77
|
id: "@secretlint/secretlint-rule-no-dotenv"
|
|
46
78
|
}
|
|
47
79
|
];
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
async function getConfig(scanSecrets, scanDotEnv) {
|
|
81
|
+
const [{ creator: recommend }, { creator: noDotenv }] = await Promise.all([
|
|
82
|
+
importSecretLintRule("@secretlint/secretlint-rule-preset-recommend"),
|
|
83
|
+
importSecretLintRule("@secretlint/secretlint-rule-no-dotenv")
|
|
84
|
+
]);
|
|
53
85
|
const rules = [];
|
|
54
86
|
if (scanSecrets) {
|
|
55
|
-
rules.push(
|
|
87
|
+
rules.push({
|
|
88
|
+
...secretsScanningRules[0],
|
|
89
|
+
rule: recommend
|
|
90
|
+
});
|
|
56
91
|
}
|
|
57
92
|
if (scanDotEnv) {
|
|
58
|
-
rules.push(
|
|
93
|
+
rules.push({
|
|
94
|
+
...dotEnvRules[0],
|
|
95
|
+
rule: noDotenv
|
|
96
|
+
});
|
|
59
97
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
98
|
+
return { rules };
|
|
99
|
+
}
|
|
100
|
+
function importSecretLintRule(packageName) {
|
|
101
|
+
return import(packageName);
|
|
102
|
+
}
|
|
103
|
+
async function mapConcurrently(values, mapper) {
|
|
104
|
+
const results = new Array(values.length);
|
|
105
|
+
let nextIndex = 0;
|
|
106
|
+
async function worker() {
|
|
107
|
+
while (nextIndex < values.length) {
|
|
108
|
+
const index = nextIndex++;
|
|
109
|
+
results[index] = await mapper(values[index]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const workerCount = Math.min(os.availableParallelism(), values.length);
|
|
113
|
+
await Promise.all(Array.from({ length: workerCount }, worker));
|
|
114
|
+
return results;
|
|
68
115
|
}
|
|
69
116
|
async function lintFiles(filePaths, scanSecrets, scanDotEnv) {
|
|
70
|
-
|
|
71
|
-
let engineResult;
|
|
117
|
+
let results;
|
|
72
118
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
119
|
+
const [{ lintSource }, { createRawSource }, config] = await Promise.all([
|
|
120
|
+
import("@secretlint/core"),
|
|
121
|
+
import("@secretlint/source-creator"),
|
|
122
|
+
getConfig(scanSecrets, scanDotEnv)
|
|
123
|
+
]);
|
|
124
|
+
results = await mapConcurrently(filePaths, async (filePath) => lintSource({
|
|
125
|
+
source: await createRawSource(filePath),
|
|
126
|
+
options: {
|
|
127
|
+
config,
|
|
128
|
+
maskSecrets: false
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
76
131
|
}
|
|
77
132
|
catch (error) {
|
|
78
|
-
|
|
133
|
+
util_2.log.error('Error occurred while scanning secrets (files):', error);
|
|
79
134
|
process.exit(1);
|
|
80
135
|
}
|
|
81
|
-
return parseResult(
|
|
136
|
+
return parseResult(results);
|
|
82
137
|
}
|
|
83
138
|
async function lintText(content, fileName, scanSecrets, scanDotEnv) {
|
|
84
|
-
|
|
85
|
-
let engineResult;
|
|
139
|
+
let result;
|
|
86
140
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
141
|
+
const [{ lintSource }, config] = await Promise.all([
|
|
142
|
+
import("@secretlint/core"),
|
|
143
|
+
getConfig(scanSecrets, scanDotEnv)
|
|
144
|
+
]);
|
|
145
|
+
result = await lintSource({
|
|
146
|
+
source: {
|
|
147
|
+
content,
|
|
148
|
+
filePath: fileName,
|
|
149
|
+
ext: path.extname(fileName),
|
|
150
|
+
contentType: "text"
|
|
151
|
+
},
|
|
152
|
+
options: {
|
|
153
|
+
config,
|
|
154
|
+
maskSecrets: false
|
|
155
|
+
}
|
|
90
156
|
});
|
|
91
157
|
}
|
|
92
158
|
catch (error) {
|
|
93
|
-
|
|
159
|
+
util_2.log.error('Error occurred while scanning secrets (content):', error);
|
|
94
160
|
process.exit(1);
|
|
95
161
|
}
|
|
96
|
-
return parseResult(
|
|
162
|
+
return parseResult([result]);
|
|
163
|
+
}
|
|
164
|
+
function parseResult(fileResults) {
|
|
165
|
+
const results = fileResults.flatMap(fileResult => fileResult.messages.map((message) => ({
|
|
166
|
+
message: message.message,
|
|
167
|
+
ruleId: message.ruleParentId ? `${message.ruleParentId} > ${message.ruleId}` : message.ruleId,
|
|
168
|
+
level: message.severity === "info" ? "note" : message.severity,
|
|
169
|
+
filePath: process.env.SARIF_URI_ABSOLUTE
|
|
170
|
+
? (0, url_1.pathToFileURL)(fileResult.filePath).toString()
|
|
171
|
+
: path.relative(process.cwd(), fileResult.filePath),
|
|
172
|
+
startLine: fixLine(message.loc.start.line),
|
|
173
|
+
startColumn: fixColumn(message.loc.start.column),
|
|
174
|
+
endLine: fixLine(message.loc.end.line),
|
|
175
|
+
endColumn: fixColumn(message.loc.end.column)
|
|
176
|
+
})));
|
|
177
|
+
return {
|
|
178
|
+
ok: !fileResults.some(fileResult => fileResult.messages.some(message => message.severity === "error")),
|
|
179
|
+
results
|
|
180
|
+
};
|
|
97
181
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
182
|
+
function fixLine(value) {
|
|
183
|
+
return value === null ? undefined : value === 0 ? 1 : value;
|
|
184
|
+
}
|
|
185
|
+
function fixColumn(value) {
|
|
186
|
+
return value === null ? undefined : value === 0 ? 1 : value + 1;
|
|
102
187
|
}
|
|
103
188
|
function getRuleNameFromRuleId(ruleId) {
|
|
104
189
|
const parts = ruleId.split('-rule-');
|
|
105
190
|
return parts[parts.length - 1];
|
|
106
191
|
}
|
|
107
192
|
function prettyPrintLintResult(result) {
|
|
108
|
-
|
|
109
|
-
return JSON.stringify(result);
|
|
110
|
-
}
|
|
111
|
-
const text = result.message.text;
|
|
112
|
-
const titleColor = result.level === undefined || result.level === secret_lint_types_1.Level.Error ? chalk_1.default.bold.red : chalk_1.default.bold.yellow;
|
|
193
|
+
const text = result.message;
|
|
113
194
|
const title = text.length > 54 ? text.slice(0, 50) + '...' : text;
|
|
114
|
-
const ruleName =
|
|
115
|
-
let output = `\t${
|
|
116
|
-
|
|
117
|
-
result.locations.forEach(location => {
|
|
118
|
-
output += `\t${prettyPrintLocation(location)}\n`;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
195
|
+
const ruleName = getRuleNameFromRuleId(result.ruleId);
|
|
196
|
+
let output = `\t${(0, util_1.styleText)(['bold', result.level === "error" ? 'red' : 'yellow'], title)} [${ruleName}]\n`;
|
|
197
|
+
output += `\t${prettyPrintLocation(result)}\n`;
|
|
121
198
|
return output;
|
|
122
199
|
}
|
|
123
|
-
function prettyPrintLocation(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
const uri = location.physicalLocation.artifactLocation?.uri;
|
|
128
|
-
if (!uri) {
|
|
129
|
-
return JSON.stringify(location);
|
|
130
|
-
}
|
|
131
|
-
let output = uri;
|
|
132
|
-
const region = location.physicalLocation.region;
|
|
133
|
-
const regionStringified = region ? prettyPrintRegion(region) : undefined;
|
|
200
|
+
function prettyPrintLocation(result) {
|
|
201
|
+
let output = result.filePath;
|
|
202
|
+
const regionStringified = prettyPrintRegion(result);
|
|
134
203
|
if (regionStringified) {
|
|
135
204
|
output += `#${regionStringified}`;
|
|
136
205
|
}
|
|
137
206
|
return output;
|
|
138
207
|
}
|
|
139
|
-
function prettyPrintRegion(
|
|
140
|
-
const startPosition = prettyPrintPosition(
|
|
141
|
-
const endPosition = prettyPrintPosition(
|
|
208
|
+
function prettyPrintRegion(result) {
|
|
209
|
+
const startPosition = prettyPrintPosition(result.startLine, result.startColumn);
|
|
210
|
+
const endPosition = prettyPrintPosition(result.endLine, result.endColumn);
|
|
142
211
|
if (!startPosition) {
|
|
143
212
|
return undefined;
|
|
144
213
|
}
|
package/out/store.js
CHANGED
|
@@ -49,6 +49,9 @@ const package_1 = require("./package");
|
|
|
49
49
|
const publish_1 = require("./publish");
|
|
50
50
|
;
|
|
51
51
|
class FileStore {
|
|
52
|
+
path;
|
|
53
|
+
publishers;
|
|
54
|
+
static DefaultPath = path.join((0, os_1.homedir)(), '.vsce');
|
|
52
55
|
static async open(path = FileStore.DefaultPath) {
|
|
53
56
|
try {
|
|
54
57
|
const rawStore = await fs.promises.readFile(path, 'utf8');
|
|
@@ -98,10 +101,12 @@ class FileStore {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
exports.FileStore = FileStore;
|
|
101
|
-
FileStore.DefaultPath = path.join((0, os_1.homedir)(), '.vsce');
|
|
102
104
|
class KeytarStore {
|
|
105
|
+
keytar;
|
|
106
|
+
serviceName;
|
|
107
|
+
publishers;
|
|
103
108
|
static async open(serviceName = 'vscode-vsce') {
|
|
104
|
-
const keytar =
|
|
109
|
+
const keytar = require('@napi-rs/keyring/keytar.js');
|
|
105
110
|
const creds = await keytar.findCredentials(serviceName);
|
|
106
111
|
return new KeytarStore(keytar, serviceName, creds.map(({ account, password }) => ({ name: account, pat: password })));
|
|
107
112
|
}
|
package/out/util.js
CHANGED
|
@@ -60,7 +60,6 @@ const fs = __importStar(require("fs"));
|
|
|
60
60
|
const read_1 = __importDefault(require("read"));
|
|
61
61
|
const WebApi_1 = require("azure-devops-node-api/WebApi");
|
|
62
62
|
const GalleryApi_1 = require("azure-devops-node-api/GalleryApi");
|
|
63
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
64
63
|
const publicgalleryapi_1 = require("./publicgalleryapi");
|
|
65
64
|
const os_1 = require("os");
|
|
66
65
|
const __read = (0, util_1.promisify)(read_1.default);
|
|
@@ -118,10 +117,8 @@ function isCancelledError(error) {
|
|
|
118
117
|
return error === CancelledError;
|
|
119
118
|
}
|
|
120
119
|
class CancellationToken {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this._cancelled = false;
|
|
124
|
-
}
|
|
120
|
+
listeners = [];
|
|
121
|
+
_cancelled = false;
|
|
125
122
|
get isCancelled() {
|
|
126
123
|
return this._cancelled;
|
|
127
124
|
}
|
|
@@ -157,10 +154,10 @@ var LogMessageType;
|
|
|
157
154
|
LogMessageType[LogMessageType["ERROR"] = 3] = "ERROR";
|
|
158
155
|
})(LogMessageType || (LogMessageType = {}));
|
|
159
156
|
const LogPrefix = {
|
|
160
|
-
[LogMessageType.DONE]:
|
|
161
|
-
[LogMessageType.INFO]:
|
|
162
|
-
[LogMessageType.WARNING]:
|
|
163
|
-
[LogMessageType.ERROR]:
|
|
157
|
+
[LogMessageType.DONE]: (0, util_1.styleText)(['bgGreen', 'black'], ' DONE '),
|
|
158
|
+
[LogMessageType.INFO]: (0, util_1.styleText)(['bgBlueBright', 'black'], ' INFO '),
|
|
159
|
+
[LogMessageType.WARNING]: (0, util_1.styleText)(['bgYellow', 'black'], ' WARNING '),
|
|
160
|
+
[LogMessageType.ERROR]: (0, util_1.styleText)(['bgRed', 'black'], ' ERROR '),
|
|
164
161
|
};
|
|
165
162
|
function _log(type, msg, ...args) {
|
|
166
163
|
args = [LogPrefix[type], msg, ...args];
|
|
@@ -305,11 +302,11 @@ async function generateFileStructureTree(rootFolder, filePaths, printLinesLimit
|
|
|
305
302
|
});
|
|
306
303
|
});
|
|
307
304
|
let output = [];
|
|
308
|
-
output.push(
|
|
305
|
+
output.push((0, util_1.styleText)('bold', rootFolder));
|
|
309
306
|
output.push(...createTreeOutput(folderTree, maxDepth, totalFileSizes));
|
|
310
307
|
for (const [size, filePath] of fileSizes) {
|
|
311
308
|
if (size > FILE_SIZE_WARNING_THRESHOLD * totalFileSizes) {
|
|
312
|
-
output.push(`\nThe file ${filePath} is ${
|
|
309
|
+
output.push(`\nThe file ${filePath} is ${(0, util_1.styleText)('red', 'large')} (${bytesToString(size)})`);
|
|
313
310
|
break;
|
|
314
311
|
}
|
|
315
312
|
}
|
|
@@ -318,20 +315,20 @@ async function generateFileStructureTree(rootFolder, filePaths, printLinesLimit
|
|
|
318
315
|
function createTreeOutput(fileSystem, maxDepth, totalFileSizes) {
|
|
319
316
|
const getColorFromSize = (size) => {
|
|
320
317
|
if (size > FILE_SIZE_WARNING_THRESHOLD * totalFileSizes) {
|
|
321
|
-
return
|
|
318
|
+
return 'red';
|
|
322
319
|
}
|
|
323
320
|
else if (size > FILE_SIZE_LARGE_THRESHOLD * totalFileSizes) {
|
|
324
|
-
return
|
|
321
|
+
return 'yellow';
|
|
325
322
|
}
|
|
326
323
|
else {
|
|
327
|
-
return
|
|
324
|
+
return 'gray';
|
|
328
325
|
}
|
|
329
326
|
};
|
|
330
327
|
const createFileOutput = (prefix, fileName, fileSize) => {
|
|
331
328
|
let fileSizeColored = '';
|
|
332
329
|
if (fileSize > 0) {
|
|
333
330
|
const fileSizeString = `[${bytesToString(fileSize)}]`;
|
|
334
|
-
fileSizeColored = getColorFromSize(fileSize)
|
|
331
|
+
fileSizeColored = (0, util_1.styleText)(getColorFromSize(fileSize), fileSizeString);
|
|
335
332
|
}
|
|
336
333
|
return `${prefix}${fileName} ${fileSizeColored}`;
|
|
337
334
|
};
|
|
@@ -339,14 +336,14 @@ function createTreeOutput(fileSystem, maxDepth, totalFileSizes) {
|
|
|
339
336
|
if (depth < maxDepth) {
|
|
340
337
|
// Max depth is not reached, print only the folder
|
|
341
338
|
// as children will be printed
|
|
342
|
-
return prefix +
|
|
339
|
+
return prefix + (0, util_1.styleText)('bold', `${folderName}/`);
|
|
343
340
|
}
|
|
344
341
|
// Max depth is reached, print the folder name and additional metadata
|
|
345
342
|
// as children will not be printed
|
|
346
343
|
const folderSizeString = bytesToString(folderSize);
|
|
347
|
-
const folder =
|
|
348
|
-
const numFilesString =
|
|
349
|
-
const folderSizeColored = getColorFromSize(folderSize)
|
|
344
|
+
const folder = (0, util_1.styleText)('bold', `${folderName}/`);
|
|
345
|
+
const numFilesString = (0, util_1.styleText)('green', `(${filesCount} ${filesCount === 1 ? 'file' : 'files'})`);
|
|
346
|
+
const folderSizeColored = (0, util_1.styleText)(getColorFromSize(folderSize), `[${folderSizeString}]`);
|
|
350
347
|
return `${prefix}${folder} ${numFilesString} ${folderSizeColored}`;
|
|
351
348
|
};
|
|
352
349
|
const createTreeLayerOutput = (tree, depth, prefix, path) => {
|
package/out/validation.js
CHANGED
|
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.validatePublisher = validatePublisher;
|
|
40
37
|
exports.validateExtensionName = validateExtensionName;
|
|
@@ -43,8 +40,8 @@ exports.validateEngineCompatibility = validateEngineCompatibility;
|
|
|
43
40
|
exports.validateVSCodeTypesCompatibility = validateVSCodeTypesCompatibility;
|
|
44
41
|
exports.validateExtensionDependencies = validateExtensionDependencies;
|
|
45
42
|
const semver = __importStar(require("semver"));
|
|
46
|
-
const parse_semver_1 = __importDefault(require("parse-semver"));
|
|
47
43
|
const util_1 = require("./util");
|
|
44
|
+
const packageSpec_1 = require("./packageSpec");
|
|
48
45
|
const nameRegex = /^[a-z0-9][a-z0-9\-]*$/i;
|
|
49
46
|
function validatePublisher(publisher) {
|
|
50
47
|
if (!publisher) {
|
|
@@ -97,14 +94,14 @@ function validateVSCodeTypesCompatibility(engineVersion, typeVersion) {
|
|
|
97
94
|
}
|
|
98
95
|
let plainEngineVersion, plainTypeVersion;
|
|
99
96
|
try {
|
|
100
|
-
const engineSemver = (0,
|
|
97
|
+
const engineSemver = (0, packageSpec_1.parsePackageSpec)(`vscode@${engineVersion}`);
|
|
101
98
|
plainEngineVersion = engineSemver.version;
|
|
102
99
|
}
|
|
103
100
|
catch (err) {
|
|
104
101
|
throw new Error('Failed to parse semver of engines.vscode');
|
|
105
102
|
}
|
|
106
103
|
try {
|
|
107
|
-
const typeSemver = (0,
|
|
104
|
+
const typeSemver = (0, packageSpec_1.parsePackageSpec)(`@types/vscode@${typeVersion}`);
|
|
108
105
|
plainTypeVersion = typeSemver.version;
|
|
109
106
|
}
|
|
110
107
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/vsce",
|
|
3
|
-
"version": "3.9.3-
|
|
3
|
+
"version": "3.9.3-11",
|
|
4
4
|
"description": "VS Code Extensions Manager",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,33 +36,31 @@
|
|
|
36
36
|
"watch:test": "npm run test -- --watch"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">= 22"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@azure/identity": "^4.1.0",
|
|
43
|
-
"@
|
|
44
|
-
"@secretlint/
|
|
43
|
+
"@napi-rs/keyring": "^1.3.0",
|
|
44
|
+
"@secretlint/core": "^10.1.2",
|
|
45
45
|
"@secretlint/secretlint-rule-no-dotenv": "^10.1.2",
|
|
46
46
|
"@secretlint/secretlint-rule-preset-recommend": "^10.1.2",
|
|
47
|
+
"@secretlint/source-creator": "^10.1.2",
|
|
48
|
+
"@secretlint/types": "^10.1.2",
|
|
47
49
|
"@vscode/vsce-sign": "^2.0.0",
|
|
48
50
|
"azure-devops-node-api": "^12.5.0",
|
|
49
|
-
"chalk": "^4.1.2",
|
|
50
|
-
"cheerio": "^1.0.0-rc.9",
|
|
51
51
|
"cockatiel": "^3.1.2",
|
|
52
52
|
"commander": "^12.1.0",
|
|
53
53
|
"form-data": "^4.0.0",
|
|
54
|
-
"glob": "^13.0.6",
|
|
55
54
|
"hosted-git-info": "^4.0.2",
|
|
56
55
|
"jsonc-parser": "^3.2.0",
|
|
57
56
|
"leven": "^3.1.0",
|
|
58
|
-
"
|
|
57
|
+
"marked": "^18.0.10",
|
|
59
58
|
"mime": "^1.3.4",
|
|
60
59
|
"minimatch": "^10.2.2",
|
|
61
|
-
"
|
|
60
|
+
"parse5": "^8.0.1",
|
|
62
61
|
"read": "^1.0.7",
|
|
63
|
-
"secretlint": "^10.1.2",
|
|
64
62
|
"semver": "^7.5.2",
|
|
65
|
-
"
|
|
63
|
+
"tinyglobby": "^0.2.17",
|
|
66
64
|
"typed-rest-client": "^1.8.4",
|
|
67
65
|
"url-join": "^4.0.1",
|
|
68
66
|
"xml2js": "^0.5.0",
|
|
@@ -71,28 +69,21 @@
|
|
|
71
69
|
},
|
|
72
70
|
"devDependencies": {
|
|
73
71
|
"@microsoft/api-extractor": "^7.33.7",
|
|
74
|
-
"@types/cheerio": "^0.22.29",
|
|
75
|
-
"@types/glob": "^8.1.0",
|
|
76
72
|
"@types/hosted-git-info": "^3.0.2",
|
|
77
|
-
"@types/markdown-it": "^0.0.2",
|
|
78
73
|
"@types/mime": "^1",
|
|
79
74
|
"@types/mocha": "^7.0.2",
|
|
80
|
-
"@types/node": "^
|
|
75
|
+
"@types/node": "^22.0.0",
|
|
76
|
+
"@types/picomatch": "^4.0.3",
|
|
81
77
|
"@types/read": "^0.0.28",
|
|
82
78
|
"@types/semver": "^6.0.0",
|
|
83
|
-
"@types/tmp": "^0.2.2",
|
|
84
79
|
"@types/url-join": "^4.0.1",
|
|
85
80
|
"@types/xml2js": "^0.4.4",
|
|
86
81
|
"@types/yauzl": "^2.9.2",
|
|
87
82
|
"@types/yazl": "^2.4.2",
|
|
88
83
|
"mocha": "^11.1.0",
|
|
89
|
-
"source-map-support": "^0.4.2",
|
|
90
84
|
"ts-node": "^10.9.1",
|
|
91
85
|
"typescript": "~5.9.0"
|
|
92
86
|
},
|
|
93
|
-
"optionalDependencies": {
|
|
94
|
-
"keytar": "^7.7.0"
|
|
95
|
-
},
|
|
96
87
|
"mocha": {
|
|
97
88
|
"require": [
|
|
98
89
|
"ts-node/register"
|