@vscode/vsce 3.9.3-10 → 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/out/package.js +21 -21
- package/out/secretLint.js +5 -9
- package/out/util.js +14 -15
- package/package.json +1 -2
package/out/package.js
CHANGED
|
@@ -70,10 +70,10 @@ const minimatch_1 = require("minimatch");
|
|
|
70
70
|
const parse5_1 = require("parse5");
|
|
71
71
|
const marked_1 = require("marked");
|
|
72
72
|
const url = __importStar(require("url"));
|
|
73
|
+
const util_2 = require("util");
|
|
73
74
|
const mime_1 = __importDefault(require("mime"));
|
|
74
75
|
const semver = __importStar(require("semver"));
|
|
75
76
|
const url_join_1 = __importDefault(require("url-join"));
|
|
76
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
77
77
|
const validation_1 = require("./validation");
|
|
78
78
|
const npm_1 = require("./npm");
|
|
79
79
|
const GitHost = __importStar(require("hosted-git-info"));
|
|
@@ -1566,7 +1566,7 @@ async function packageCommand(options = {}) {
|
|
|
1566
1566
|
}
|
|
1567
1567
|
const stats = await fs.promises.stat(packagePath);
|
|
1568
1568
|
const packageSize = util.bytesToString(stats.size);
|
|
1569
|
-
util.log.done(`Packaged: ${packagePath} ` +
|
|
1569
|
+
util.log.done(`Packaged: ${packagePath} ` + (0, util_2.styleText)('bold', `(${files.length} files, ${packageSize})`));
|
|
1570
1570
|
}
|
|
1571
1571
|
/**
|
|
1572
1572
|
* Lists the files included in the extension's package.
|
|
@@ -1602,26 +1602,26 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1602
1602
|
const jsFiles = files.filter(f => /\.js$/i.test(f.path));
|
|
1603
1603
|
if (files.length > 5000 || jsFiles.length > 100) {
|
|
1604
1604
|
let message = '';
|
|
1605
|
-
message += `This extension consists of ${
|
|
1606
|
-
message += `For performance reasons, you should bundle your extension: ${
|
|
1607
|
-
message += `You should also exclude unnecessary files by adding them to your .vscodeignore: ${
|
|
1605
|
+
message += `This extension consists of ${(0, util_2.styleText)('bold', String(files.length))} files, out of which ${(0, util_2.styleText)('bold', String(jsFiles.length))} are JavaScript files. `;
|
|
1606
|
+
message += `For performance reasons, you should bundle your extension: ${(0, util_2.styleText)('underline', 'https://aka.ms/vscode-bundle-extension')}. `;
|
|
1607
|
+
message += `You should also exclude unnecessary files by adding them to your .vscodeignore: ${(0, util_2.styleText)('underline', 'https://aka.ms/vscode-vscodeignore')}.\n`;
|
|
1608
1608
|
util.log.warn(message);
|
|
1609
1609
|
}
|
|
1610
1610
|
// Warn if the extension does not have a .vscodeignore file or a files property in package.json
|
|
1611
1611
|
const hasIgnoreFile = fs.existsSync(options.ignoreFile ?? path.join(cwd, '.vscodeignore'));
|
|
1612
1612
|
if (!hasIgnoreFile && !manifest.files) {
|
|
1613
1613
|
let message = '';
|
|
1614
|
-
message += `Neither a ${
|
|
1614
|
+
message += `Neither a ${(0, util_2.styleText)('bold', '.vscodeignore')} file nor a ${(0, util_2.styleText)('bold', '"files"')} property in package.json was found. `;
|
|
1615
1615
|
message += `To ensure only necessary files are included in your extension, `;
|
|
1616
|
-
message += `add a .vscodeignore file or specify the "files" property in package.json. More info: ${
|
|
1616
|
+
message += `add a .vscodeignore file or specify the "files" property in package.json. More info: ${(0, util_2.styleText)('underline', 'https://aka.ms/vscode-vscodeignore')}\n`;
|
|
1617
1617
|
util.log.warn(message);
|
|
1618
1618
|
}
|
|
1619
1619
|
// Throw an error if the extension uses both a .vscodeignore file and the files property in package.json
|
|
1620
1620
|
else if (hasIgnoreFile && manifest.files !== undefined && manifest.files.length > 0) {
|
|
1621
1621
|
let message = '';
|
|
1622
|
-
message += `Both a ${
|
|
1622
|
+
message += `Both a ${(0, util_2.styleText)('bold', '.vscodeignore')} file and a ${(0, util_2.styleText)('bold', '"files"')} property in package.json were found. `;
|
|
1623
1623
|
message += `VSCE does not support combining both strategies. `;
|
|
1624
|
-
message += `Either remove the ${
|
|
1624
|
+
message += `Either remove the ${(0, util_2.styleText)('bold', '.vscodeignore')} file or the ${(0, util_2.styleText)('bold', '"files"')} property in package.json.`;
|
|
1625
1625
|
util.log.error(message);
|
|
1626
1626
|
process.exit(1);
|
|
1627
1627
|
}
|
|
@@ -1646,11 +1646,11 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1646
1646
|
});
|
|
1647
1647
|
if (unusedIncludePatterns.length > 0) {
|
|
1648
1648
|
let message = '';
|
|
1649
|
-
message += `The following include patterns in the ${
|
|
1649
|
+
message += `The following include patterns in the ${(0, util_2.styleText)('bold', '"files"')} property in package.json do not match any files packaged in the extension:\n`;
|
|
1650
1650
|
message += unusedIncludePatterns.map(p => ` - ${p.relative}`).join('\n');
|
|
1651
1651
|
message += '\nRemove any include pattern which is not needed.\n';
|
|
1652
|
-
message += `\n=> Run ${
|
|
1653
|
-
message += `=> Use ${
|
|
1652
|
+
message += `\n=> Run ${(0, util_2.styleText)('bold', 'vsce ls --tree')} to see all included files.\n`;
|
|
1653
|
+
message += `=> Use ${(0, util_2.styleText)('bold', '--allow-unused-files-pattern')} to skip this check`;
|
|
1654
1654
|
util.log.error(message);
|
|
1655
1655
|
process.exit(1);
|
|
1656
1656
|
}
|
|
@@ -1664,11 +1664,11 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1664
1664
|
})), 35 // Print up to 35 files/folders
|
|
1665
1665
|
);
|
|
1666
1666
|
let message = '';
|
|
1667
|
-
message +=
|
|
1667
|
+
message += (0, util_2.styleText)(['bold', 'blue'], `Files included in the VSIX:\n`);
|
|
1668
1668
|
message += printableFileStructure.join('\n');
|
|
1669
1669
|
// If not all files have been printed, mention how all files can be printed
|
|
1670
1670
|
if (files.length + 1 > printableFileStructure.length) {
|
|
1671
|
-
message += `\n\n=> Run ${
|
|
1671
|
+
message += `\n\n=> Run ${(0, util_2.styleText)('bold', 'vsce ls --tree')} to see all included files.`;
|
|
1672
1672
|
}
|
|
1673
1673
|
message += '\n';
|
|
1674
1674
|
util.log.info(message);
|
|
@@ -1703,33 +1703,33 @@ async function scanFilesForSecrets(files, fileExclusion, options) {
|
|
|
1703
1703
|
if (noneDotEnvSecretsFound.length > 0) {
|
|
1704
1704
|
const uniqueSecretIds = new Set(noneDotEnvSecretsFound.map(result => result.ruleId));
|
|
1705
1705
|
const secretsFoundRuleNames = Array.from(uniqueSecretIds).map(secretLint_1.getRuleNameFromRuleId);
|
|
1706
|
-
let errorMessage = `${
|
|
1706
|
+
let errorMessage = `${(0, util_2.styleText)('bold', 'Potential security issue detected:')}`;
|
|
1707
1707
|
errorMessage += ` Your extension package contains sensitive information that should not be published.`;
|
|
1708
1708
|
errorMessage += ` Please remove these secrets before packaging.`;
|
|
1709
1709
|
errorMessage += `\n` + noneDotEnvSecretsFound.map(secretLint_1.prettyPrintLintResult).join('\n');
|
|
1710
1710
|
let hintMessage = `\nIn case of false positives, you can allow specific types of secrets with `;
|
|
1711
1711
|
hintMessage += secretsFoundRuleNames.map(name => `--allow-package-secrets ${name}`).join(' ');
|
|
1712
1712
|
hintMessage += ` or use --allow-package-all-secrets to skip this check entirely (not recommended).`;
|
|
1713
|
-
util.log.error(errorMessage +
|
|
1713
|
+
util.log.error(errorMessage + (0, util_2.styleText)('italic', hintMessage));
|
|
1714
1714
|
process.exit(1);
|
|
1715
1715
|
}
|
|
1716
1716
|
// .env file found
|
|
1717
1717
|
const allRuleIds = new Set(secretsFound.map(result => result.ruleId).filter(Boolean));
|
|
1718
1718
|
if (!options.allowPackageEnvFile && allRuleIds.has('@secretlint/secretlint-rule-no-dotenv')) {
|
|
1719
|
-
let errorMessage = `${
|
|
1719
|
+
let errorMessage = `${(0, util_2.styleText)(['bold', 'red'], '.env')} files should not be packaged.`;
|
|
1720
1720
|
switch (fileExclusion) {
|
|
1721
1721
|
case FileExclusionType.None:
|
|
1722
|
-
errorMessage += ` Ignore the file in your ${
|
|
1722
|
+
errorMessage += ` Ignore the file in your ${(0, util_2.styleText)('bold', '.vscodeignore')} or exclude it from the package.json ${(0, util_2.styleText)('bold', 'files')} property.`;
|
|
1723
1723
|
break;
|
|
1724
1724
|
case FileExclusionType.VSCodeIgnore:
|
|
1725
|
-
errorMessage += ` Ignore the file in your ${
|
|
1725
|
+
errorMessage += ` Ignore the file in your ${(0, util_2.styleText)('bold', '.vscodeignore')}.`;
|
|
1726
1726
|
break;
|
|
1727
1727
|
case FileExclusionType.PackageFiles:
|
|
1728
|
-
errorMessage += ` Do not include the file in your package.json ${
|
|
1728
|
+
errorMessage += ` Do not include the file in your package.json ${(0, util_2.styleText)('bold', 'files')} property.`;
|
|
1729
1729
|
break;
|
|
1730
1730
|
}
|
|
1731
1731
|
const hintMessage = `\nTo ignore this check, you can use --allow-package-env-file (not recommended).`;
|
|
1732
|
-
util.log.error(errorMessage +
|
|
1732
|
+
util.log.error(errorMessage + (0, util_2.styleText)('italic', hintMessage));
|
|
1733
1733
|
process.exit(1);
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
package/out/secretLint.js
CHANGED
|
@@ -32,19 +32,16 @@ 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.lintFiles = lintFiles;
|
|
40
37
|
exports.lintText = lintText;
|
|
41
38
|
exports.getRuleNameFromRuleId = getRuleNameFromRuleId;
|
|
42
39
|
exports.prettyPrintLintResult = prettyPrintLintResult;
|
|
43
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
44
40
|
const os = __importStar(require("os"));
|
|
45
41
|
const path = __importStar(require("path"));
|
|
42
|
+
const util_1 = require("util");
|
|
46
43
|
const url_1 = require("url");
|
|
47
|
-
const
|
|
44
|
+
const util_2 = require("./util");
|
|
48
45
|
const secretsScanningRules = [
|
|
49
46
|
{
|
|
50
47
|
id: "@secretlint/secretlint-rule-preset-recommend",
|
|
@@ -133,7 +130,7 @@ async function lintFiles(filePaths, scanSecrets, scanDotEnv) {
|
|
|
133
130
|
}));
|
|
134
131
|
}
|
|
135
132
|
catch (error) {
|
|
136
|
-
|
|
133
|
+
util_2.log.error('Error occurred while scanning secrets (files):', error);
|
|
137
134
|
process.exit(1);
|
|
138
135
|
}
|
|
139
136
|
return parseResult(results);
|
|
@@ -159,7 +156,7 @@ async function lintText(content, fileName, scanSecrets, scanDotEnv) {
|
|
|
159
156
|
});
|
|
160
157
|
}
|
|
161
158
|
catch (error) {
|
|
162
|
-
|
|
159
|
+
util_2.log.error('Error occurred while scanning secrets (content):', error);
|
|
163
160
|
process.exit(1);
|
|
164
161
|
}
|
|
165
162
|
return parseResult([result]);
|
|
@@ -194,10 +191,9 @@ function getRuleNameFromRuleId(ruleId) {
|
|
|
194
191
|
}
|
|
195
192
|
function prettyPrintLintResult(result) {
|
|
196
193
|
const text = result.message;
|
|
197
|
-
const titleColor = result.level === "error" ? chalk_1.default.bold.red : chalk_1.default.bold.yellow;
|
|
198
194
|
const title = text.length > 54 ? text.slice(0, 50) + '...' : text;
|
|
199
195
|
const ruleName = getRuleNameFromRuleId(result.ruleId);
|
|
200
|
-
let output = `\t${
|
|
196
|
+
let output = `\t${(0, util_1.styleText)(['bold', result.level === "error" ? 'red' : 'yellow'], title)} [${ruleName}]\n`;
|
|
201
197
|
output += `\t${prettyPrintLocation(result)}\n`;
|
|
202
198
|
return output;
|
|
203
199
|
}
|
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);
|
|
@@ -155,10 +154,10 @@ var LogMessageType;
|
|
|
155
154
|
LogMessageType[LogMessageType["ERROR"] = 3] = "ERROR";
|
|
156
155
|
})(LogMessageType || (LogMessageType = {}));
|
|
157
156
|
const LogPrefix = {
|
|
158
|
-
[LogMessageType.DONE]:
|
|
159
|
-
[LogMessageType.INFO]:
|
|
160
|
-
[LogMessageType.WARNING]:
|
|
161
|
-
[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 '),
|
|
162
161
|
};
|
|
163
162
|
function _log(type, msg, ...args) {
|
|
164
163
|
args = [LogPrefix[type], msg, ...args];
|
|
@@ -303,11 +302,11 @@ async function generateFileStructureTree(rootFolder, filePaths, printLinesLimit
|
|
|
303
302
|
});
|
|
304
303
|
});
|
|
305
304
|
let output = [];
|
|
306
|
-
output.push(
|
|
305
|
+
output.push((0, util_1.styleText)('bold', rootFolder));
|
|
307
306
|
output.push(...createTreeOutput(folderTree, maxDepth, totalFileSizes));
|
|
308
307
|
for (const [size, filePath] of fileSizes) {
|
|
309
308
|
if (size > FILE_SIZE_WARNING_THRESHOLD * totalFileSizes) {
|
|
310
|
-
output.push(`\nThe file ${filePath} is ${
|
|
309
|
+
output.push(`\nThe file ${filePath} is ${(0, util_1.styleText)('red', 'large')} (${bytesToString(size)})`);
|
|
311
310
|
break;
|
|
312
311
|
}
|
|
313
312
|
}
|
|
@@ -316,20 +315,20 @@ async function generateFileStructureTree(rootFolder, filePaths, printLinesLimit
|
|
|
316
315
|
function createTreeOutput(fileSystem, maxDepth, totalFileSizes) {
|
|
317
316
|
const getColorFromSize = (size) => {
|
|
318
317
|
if (size > FILE_SIZE_WARNING_THRESHOLD * totalFileSizes) {
|
|
319
|
-
return
|
|
318
|
+
return 'red';
|
|
320
319
|
}
|
|
321
320
|
else if (size > FILE_SIZE_LARGE_THRESHOLD * totalFileSizes) {
|
|
322
|
-
return
|
|
321
|
+
return 'yellow';
|
|
323
322
|
}
|
|
324
323
|
else {
|
|
325
|
-
return
|
|
324
|
+
return 'gray';
|
|
326
325
|
}
|
|
327
326
|
};
|
|
328
327
|
const createFileOutput = (prefix, fileName, fileSize) => {
|
|
329
328
|
let fileSizeColored = '';
|
|
330
329
|
if (fileSize > 0) {
|
|
331
330
|
const fileSizeString = `[${bytesToString(fileSize)}]`;
|
|
332
|
-
fileSizeColored = getColorFromSize(fileSize)
|
|
331
|
+
fileSizeColored = (0, util_1.styleText)(getColorFromSize(fileSize), fileSizeString);
|
|
333
332
|
}
|
|
334
333
|
return `${prefix}${fileName} ${fileSizeColored}`;
|
|
335
334
|
};
|
|
@@ -337,14 +336,14 @@ function createTreeOutput(fileSystem, maxDepth, totalFileSizes) {
|
|
|
337
336
|
if (depth < maxDepth) {
|
|
338
337
|
// Max depth is not reached, print only the folder
|
|
339
338
|
// as children will be printed
|
|
340
|
-
return prefix +
|
|
339
|
+
return prefix + (0, util_1.styleText)('bold', `${folderName}/`);
|
|
341
340
|
}
|
|
342
341
|
// Max depth is reached, print the folder name and additional metadata
|
|
343
342
|
// as children will not be printed
|
|
344
343
|
const folderSizeString = bytesToString(folderSize);
|
|
345
|
-
const folder =
|
|
346
|
-
const numFilesString =
|
|
347
|
-
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}]`);
|
|
348
347
|
return `${prefix}${folder} ${numFilesString} ${folderSizeColored}`;
|
|
349
348
|
};
|
|
350
349
|
const createTreeLayerOutput = (tree, depth, prefix, path) => {
|
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",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"@secretlint/types": "^10.1.2",
|
|
49
49
|
"@vscode/vsce-sign": "^2.0.0",
|
|
50
50
|
"azure-devops-node-api": "^12.5.0",
|
|
51
|
-
"chalk": "^4.1.2",
|
|
52
51
|
"cockatiel": "^3.1.2",
|
|
53
52
|
"commander": "^12.1.0",
|
|
54
53
|
"form-data": "^4.0.0",
|