@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/package.js
CHANGED
|
@@ -65,22 +65,22 @@ const cp = __importStar(require("child_process"));
|
|
|
65
65
|
const yazl = __importStar(require("yazl"));
|
|
66
66
|
const nls_1 = require("./nls");
|
|
67
67
|
const util = __importStar(require("./util"));
|
|
68
|
-
const
|
|
68
|
+
const tinyglobby_1 = require("tinyglobby");
|
|
69
69
|
const minimatch_1 = require("minimatch");
|
|
70
|
-
const
|
|
71
|
-
const
|
|
70
|
+
const parse5_1 = require("parse5");
|
|
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"));
|
|
80
|
-
const parse_semver_1 = __importDefault(require("parse-semver"));
|
|
81
80
|
const jsonc = __importStar(require("jsonc-parser"));
|
|
82
81
|
const vsceSign = __importStar(require("@vscode/vsce-sign"));
|
|
83
82
|
const secretLint_1 = require("./secretLint");
|
|
83
|
+
const packageSpec_1 = require("./packageSpec");
|
|
84
84
|
const minimatchOptions = { dot: true };
|
|
85
85
|
function isInMemoryFile(file) {
|
|
86
86
|
return !!file.contents;
|
|
@@ -94,12 +94,13 @@ function read(file) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
class BaseProcessor {
|
|
97
|
+
manifest;
|
|
97
98
|
constructor(manifest) {
|
|
98
99
|
this.manifest = manifest;
|
|
99
|
-
this.assets = [];
|
|
100
|
-
this.tags = [];
|
|
101
|
-
this.vsix = Object.create(null);
|
|
102
100
|
}
|
|
101
|
+
assets = [];
|
|
102
|
+
tags = [];
|
|
103
|
+
vsix = Object.create(null);
|
|
103
104
|
async onFile(file) {
|
|
104
105
|
return file;
|
|
105
106
|
}
|
|
@@ -299,6 +300,7 @@ exports.Targets = new Set([
|
|
|
299
300
|
'web',
|
|
300
301
|
]);
|
|
301
302
|
class ManifestProcessor extends BaseProcessor {
|
|
303
|
+
options;
|
|
302
304
|
constructor(manifest, options = {}) {
|
|
303
305
|
super(manifest);
|
|
304
306
|
this.options = options;
|
|
@@ -326,7 +328,7 @@ class ManifestProcessor extends BaseProcessor {
|
|
|
326
328
|
if (target || preRelease) {
|
|
327
329
|
let engineSemver;
|
|
328
330
|
try {
|
|
329
|
-
engineSemver = (0,
|
|
331
|
+
engineSemver = (0, packageSpec_1.parsePackageSpec)(`vscode@${manifest.engines.vscode}`);
|
|
330
332
|
}
|
|
331
333
|
catch (err) {
|
|
332
334
|
throw new Error('Failed to parse semver of engines.vscode');
|
|
@@ -430,6 +432,44 @@ class ManifestProcessor extends BaseProcessor {
|
|
|
430
432
|
}
|
|
431
433
|
exports.ManifestProcessor = ManifestProcessor;
|
|
432
434
|
class TagsProcessor extends BaseProcessor {
|
|
435
|
+
static Keywords = {
|
|
436
|
+
git: ['git'],
|
|
437
|
+
npm: ['node'],
|
|
438
|
+
spell: ['markdown'],
|
|
439
|
+
bootstrap: ['bootstrap'],
|
|
440
|
+
lint: ['linters'],
|
|
441
|
+
linting: ['linters'],
|
|
442
|
+
react: ['javascript'],
|
|
443
|
+
js: ['javascript'],
|
|
444
|
+
node: ['javascript', 'node'],
|
|
445
|
+
'c++': ['c++'],
|
|
446
|
+
Cplusplus: ['c++'],
|
|
447
|
+
xml: ['xml'],
|
|
448
|
+
angular: ['javascript'],
|
|
449
|
+
jquery: ['javascript'],
|
|
450
|
+
php: ['php'],
|
|
451
|
+
python: ['python'],
|
|
452
|
+
latex: ['latex'],
|
|
453
|
+
ruby: ['ruby'],
|
|
454
|
+
java: ['java'],
|
|
455
|
+
erlang: ['erlang'],
|
|
456
|
+
sql: ['sql'],
|
|
457
|
+
nodejs: ['node'],
|
|
458
|
+
'c#': ['c#'],
|
|
459
|
+
css: ['css'],
|
|
460
|
+
javascript: ['javascript'],
|
|
461
|
+
ftp: ['ftp'],
|
|
462
|
+
haskell: ['haskell'],
|
|
463
|
+
unity: ['unity'],
|
|
464
|
+
terminal: ['terminal'],
|
|
465
|
+
powershell: ['powershell'],
|
|
466
|
+
laravel: ['laravel'],
|
|
467
|
+
meteor: ['meteor'],
|
|
468
|
+
emmet: ['emmet'],
|
|
469
|
+
eslint: ['linters'],
|
|
470
|
+
tfs: ['tfs'],
|
|
471
|
+
rust: ['rust'],
|
|
472
|
+
};
|
|
433
473
|
async onEnd() {
|
|
434
474
|
const keywords = this.manifest.keywords ?? [];
|
|
435
475
|
const contributes = this.manifest.contributes;
|
|
@@ -493,51 +533,25 @@ class TagsProcessor extends BaseProcessor {
|
|
|
493
533
|
}
|
|
494
534
|
}
|
|
495
535
|
exports.TagsProcessor = TagsProcessor;
|
|
496
|
-
TagsProcessor.Keywords = {
|
|
497
|
-
git: ['git'],
|
|
498
|
-
npm: ['node'],
|
|
499
|
-
spell: ['markdown'],
|
|
500
|
-
bootstrap: ['bootstrap'],
|
|
501
|
-
lint: ['linters'],
|
|
502
|
-
linting: ['linters'],
|
|
503
|
-
react: ['javascript'],
|
|
504
|
-
js: ['javascript'],
|
|
505
|
-
node: ['javascript', 'node'],
|
|
506
|
-
'c++': ['c++'],
|
|
507
|
-
Cplusplus: ['c++'],
|
|
508
|
-
xml: ['xml'],
|
|
509
|
-
angular: ['javascript'],
|
|
510
|
-
jquery: ['javascript'],
|
|
511
|
-
php: ['php'],
|
|
512
|
-
python: ['python'],
|
|
513
|
-
latex: ['latex'],
|
|
514
|
-
ruby: ['ruby'],
|
|
515
|
-
java: ['java'],
|
|
516
|
-
erlang: ['erlang'],
|
|
517
|
-
sql: ['sql'],
|
|
518
|
-
nodejs: ['node'],
|
|
519
|
-
'c#': ['c#'],
|
|
520
|
-
css: ['css'],
|
|
521
|
-
javascript: ['javascript'],
|
|
522
|
-
ftp: ['ftp'],
|
|
523
|
-
haskell: ['haskell'],
|
|
524
|
-
unity: ['unity'],
|
|
525
|
-
terminal: ['terminal'],
|
|
526
|
-
powershell: ['powershell'],
|
|
527
|
-
laravel: ['laravel'],
|
|
528
|
-
meteor: ['meteor'],
|
|
529
|
-
emmet: ['emmet'],
|
|
530
|
-
eslint: ['linters'],
|
|
531
|
-
tfs: ['tfs'],
|
|
532
|
-
rust: ['rust'],
|
|
533
|
-
};
|
|
534
536
|
class MarkdownProcessor extends BaseProcessor {
|
|
537
|
+
name;
|
|
538
|
+
assetType;
|
|
539
|
+
options;
|
|
540
|
+
regexp;
|
|
541
|
+
baseContentUrl;
|
|
542
|
+
baseImagesUrl;
|
|
543
|
+
rewriteRelativeLinks;
|
|
544
|
+
isGitHub;
|
|
545
|
+
isGitLab;
|
|
546
|
+
repositoryUrl;
|
|
547
|
+
gitHubIssueLinking;
|
|
548
|
+
gitLabIssueLinking;
|
|
549
|
+
filesProcessed = 0;
|
|
535
550
|
constructor(manifest, name, filePath, assetType, options = {}) {
|
|
536
551
|
super(manifest);
|
|
537
552
|
this.name = name;
|
|
538
553
|
this.assetType = assetType;
|
|
539
554
|
this.options = options;
|
|
540
|
-
this.filesProcessed = 0;
|
|
541
555
|
this.regexp = new RegExp(`^${util.filePathToVsixPath(filePath)}$`, 'i');
|
|
542
556
|
const guess = this.guessBaseUrls(options.githubBranch || options.gitlabBranch);
|
|
543
557
|
this.baseContentUrl = options.baseContentUrl || (guess && guess.content);
|
|
@@ -627,11 +641,33 @@ class MarkdownProcessor extends BaseProcessor {
|
|
|
627
641
|
contents = contents.replace(markdownIssueRegex, issueReplace);
|
|
628
642
|
}
|
|
629
643
|
}
|
|
630
|
-
const html = (
|
|
631
|
-
const
|
|
644
|
+
const html = marked_1.marked.parse(contents, { async: false });
|
|
645
|
+
const document = (0, parse5_1.parse)(html);
|
|
646
|
+
const images = [];
|
|
647
|
+
let hasSvg = false;
|
|
648
|
+
const nodes = [document];
|
|
649
|
+
while (nodes.length > 0) {
|
|
650
|
+
const node = nodes.pop();
|
|
651
|
+
if ('tagName' in node) {
|
|
652
|
+
if (node.tagName === 'img') {
|
|
653
|
+
images.push(node);
|
|
654
|
+
}
|
|
655
|
+
else if (node.tagName === 'svg') {
|
|
656
|
+
hasSvg = true;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const children = 'content' in node
|
|
660
|
+
? node.content.childNodes
|
|
661
|
+
: 'childNodes' in node
|
|
662
|
+
? node.childNodes
|
|
663
|
+
: [];
|
|
664
|
+
for (let index = children.length - 1; index >= 0; index--) {
|
|
665
|
+
nodes.push(children[index]);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
632
668
|
if (this.rewriteRelativeLinks) {
|
|
633
|
-
|
|
634
|
-
const rawSrc =
|
|
669
|
+
for (const image of images) {
|
|
670
|
+
const rawSrc = image.attrs.find(attribute => attribute.name === 'src')?.value;
|
|
635
671
|
if (!rawSrc) {
|
|
636
672
|
throw new Error(`Images in ${this.name} must have a source.`);
|
|
637
673
|
}
|
|
@@ -652,11 +688,11 @@ class MarkdownProcessor extends BaseProcessor {
|
|
|
652
688
|
if (/\.svg$/i.test(srcUrl.pathname) && !isHostTrusted(srcUrl)) {
|
|
653
689
|
throw new Error(`SVGs are restricted in ${this.name}; please use other file image formats, such as PNG: ${src}`);
|
|
654
690
|
}
|
|
655
|
-
}
|
|
691
|
+
}
|
|
656
692
|
}
|
|
657
|
-
|
|
693
|
+
if (hasSvg) {
|
|
658
694
|
throw new Error(`SVG tags are not allowed in ${this.name}.`);
|
|
659
|
-
}
|
|
695
|
+
}
|
|
660
696
|
return {
|
|
661
697
|
path: file.path,
|
|
662
698
|
contents: Buffer.from(contents, 'utf8'),
|
|
@@ -734,10 +770,13 @@ class ChangelogProcessor extends MarkdownProcessor {
|
|
|
734
770
|
}
|
|
735
771
|
exports.ChangelogProcessor = ChangelogProcessor;
|
|
736
772
|
class LicenseProcessor extends BaseProcessor {
|
|
773
|
+
options;
|
|
774
|
+
didFindLicense = false;
|
|
775
|
+
expectedLicenseName;
|
|
776
|
+
filter;
|
|
737
777
|
constructor(manifest, options = {}) {
|
|
738
778
|
super(manifest);
|
|
739
779
|
this.options = options;
|
|
740
|
-
this.didFindLicense = false;
|
|
741
780
|
const match = /^SEE LICENSE IN (.*)$/.exec(manifest.license || '');
|
|
742
781
|
if (!match || !match[1]) {
|
|
743
782
|
this.expectedLicenseName = 'LICENSE, LICENSE.md, or LICENSE.txt';
|
|
@@ -776,9 +815,9 @@ class LicenseProcessor extends BaseProcessor {
|
|
|
776
815
|
}
|
|
777
816
|
exports.LicenseProcessor = LicenseProcessor;
|
|
778
817
|
class LaunchEntryPointProcessor extends BaseProcessor {
|
|
818
|
+
seenFiles = new Set();
|
|
779
819
|
constructor(manifest) {
|
|
780
820
|
super(manifest);
|
|
781
|
-
this.seenFiles = new Set();
|
|
782
821
|
}
|
|
783
822
|
onFile(file) {
|
|
784
823
|
this.seenFiles.add(util.normalize(file.path));
|
|
@@ -811,9 +850,10 @@ class LaunchEntryPointProcessor extends BaseProcessor {
|
|
|
811
850
|
}
|
|
812
851
|
}
|
|
813
852
|
class IconProcessor extends BaseProcessor {
|
|
853
|
+
icon;
|
|
854
|
+
didFindIcon = false;
|
|
814
855
|
constructor(manifest) {
|
|
815
856
|
super(manifest);
|
|
816
|
-
this.didFindIcon = false;
|
|
817
857
|
this.icon = manifest.icon && path.posix.normalize(util.filePathToVsixPath(manifest.icon));
|
|
818
858
|
delete this.vsix.icon;
|
|
819
859
|
}
|
|
@@ -893,9 +933,9 @@ function deduceExtensionKinds(manifest) {
|
|
|
893
933
|
return result;
|
|
894
934
|
}
|
|
895
935
|
class NLSProcessor extends BaseProcessor {
|
|
936
|
+
translations = Object.create(null);
|
|
896
937
|
constructor(manifest) {
|
|
897
938
|
super(manifest);
|
|
898
|
-
this.translations = Object.create(null);
|
|
899
939
|
if (!manifest.contributes ||
|
|
900
940
|
!manifest.contributes.localizations ||
|
|
901
941
|
manifest.contributes.localizations.length === 0) {
|
|
@@ -928,11 +968,8 @@ class NLSProcessor extends BaseProcessor {
|
|
|
928
968
|
}
|
|
929
969
|
exports.NLSProcessor = NLSProcessor;
|
|
930
970
|
class ValidationProcessor extends BaseProcessor {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
this.files = new Map();
|
|
934
|
-
this.duplicates = new Set();
|
|
935
|
-
}
|
|
971
|
+
files = new Map();
|
|
972
|
+
duplicates = new Set();
|
|
936
973
|
async onFile(file) {
|
|
937
974
|
const lower = file.path.toLowerCase();
|
|
938
975
|
const existing = this.files.get(lower);
|
|
@@ -984,7 +1021,7 @@ function validateManifestForPackaging(manifest) {
|
|
|
984
1021
|
const hasBrowser = !!manifest.browser;
|
|
985
1022
|
let parsedEngineVersion;
|
|
986
1023
|
try {
|
|
987
|
-
const engineSemver = (0,
|
|
1024
|
+
const engineSemver = (0, packageSpec_1.parsePackageSpec)(`vscode@${engines.vscode}`);
|
|
988
1025
|
parsedEngineVersion = engineSemver.version;
|
|
989
1026
|
}
|
|
990
1027
|
catch (err) {
|
|
@@ -1248,9 +1285,46 @@ const defaultIgnore = [
|
|
|
1248
1285
|
'**/.vscode-test/**',
|
|
1249
1286
|
'**/.vscode-test-web/**',
|
|
1250
1287
|
];
|
|
1288
|
+
/**
|
|
1289
|
+
* `tinyglobby` skips symbolic links altogether when `followSymbolicLinks` is disabled, while
|
|
1290
|
+
* vsce treats them as regular files instead (see the `--follow-symlinks` option). Presenting
|
|
1291
|
+
* symbolic links to the crawler as regular files keeps them in the result without recursing
|
|
1292
|
+
* into symlinked directories.
|
|
1293
|
+
*/
|
|
1294
|
+
const symlinksAsFilesFileSystem = {
|
|
1295
|
+
readdir: (dir, options, callback) => fs.readdir(dir, options, (err, entries) => callback(err, err ? entries : entries.map(asFile))),
|
|
1296
|
+
readdirSync: (dir, options) => fs.readdirSync(dir, options).map(asFile),
|
|
1297
|
+
};
|
|
1298
|
+
function asFile(entry) {
|
|
1299
|
+
if (!entry.isSymbolicLink()) {
|
|
1300
|
+
return entry;
|
|
1301
|
+
}
|
|
1302
|
+
return Object.create(entry, {
|
|
1303
|
+
isFile: { value: () => true },
|
|
1304
|
+
isDirectory: { value: () => false },
|
|
1305
|
+
isSymbolicLink: { value: () => false },
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* `glob` matched patterns case-insensitively on Windows and macOS and case-sensitively
|
|
1310
|
+
* everywhere else, based on `process.platform` rather than on the actual filesystem.
|
|
1311
|
+
* `tinyglobby` always matches case-sensitively, so this keeps the previous behaviour, which
|
|
1312
|
+
* matters for the `node_modules` folder being ignored regardless of how it is cased on disk.
|
|
1313
|
+
* Keep this keyed off the platform: probing the filesystem instead would change what is
|
|
1314
|
+
* packaged on case-sensitive macOS volumes and case-insensitive Linux mounts.
|
|
1315
|
+
*/
|
|
1316
|
+
const caseSensitiveMatch = process.platform !== 'win32' && process.platform !== 'darwin';
|
|
1251
1317
|
async function collectAllFiles(cwd, dependencies, dependencyEntryPoints, followSymlinks = true) {
|
|
1252
1318
|
const deps = await (0, npm_1.getDependencies)(cwd, dependencies, dependencyEntryPoints);
|
|
1253
|
-
const promises = deps.map(dep => (0,
|
|
1319
|
+
const promises = deps.map(dep => (0, tinyglobby_1.glob)('**', {
|
|
1320
|
+
cwd: dep,
|
|
1321
|
+
onlyFiles: true,
|
|
1322
|
+
followSymbolicLinks: followSymlinks,
|
|
1323
|
+
fs: followSymlinks ? undefined : symlinksAsFilesFileSystem,
|
|
1324
|
+
caseSensitiveMatch,
|
|
1325
|
+
dot: true,
|
|
1326
|
+
ignore: ['node_modules/**'],
|
|
1327
|
+
}).then(files => files.map(f => path.relative(cwd, path.join(dep, f))).map(f => f.replace(/\\/g, '/'))));
|
|
1254
1328
|
return Promise.all(promises).then(util.flatten);
|
|
1255
1329
|
}
|
|
1256
1330
|
function getDependenciesOption(options) {
|
|
@@ -1492,7 +1566,7 @@ async function packageCommand(options = {}) {
|
|
|
1492
1566
|
}
|
|
1493
1567
|
const stats = await fs.promises.stat(packagePath);
|
|
1494
1568
|
const packageSize = util.bytesToString(stats.size);
|
|
1495
|
-
util.log.done(`Packaged: ${packagePath} ` +
|
|
1569
|
+
util.log.done(`Packaged: ${packagePath} ` + (0, util_2.styleText)('bold', `(${files.length} files, ${packageSize})`));
|
|
1496
1570
|
}
|
|
1497
1571
|
/**
|
|
1498
1572
|
* Lists the files included in the extension's package.
|
|
@@ -1528,26 +1602,26 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1528
1602
|
const jsFiles = files.filter(f => /\.js$/i.test(f.path));
|
|
1529
1603
|
if (files.length > 5000 || jsFiles.length > 100) {
|
|
1530
1604
|
let message = '';
|
|
1531
|
-
message += `This extension consists of ${
|
|
1532
|
-
message += `For performance reasons, you should bundle your extension: ${
|
|
1533
|
-
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`;
|
|
1534
1608
|
util.log.warn(message);
|
|
1535
1609
|
}
|
|
1536
1610
|
// Warn if the extension does not have a .vscodeignore file or a files property in package.json
|
|
1537
1611
|
const hasIgnoreFile = fs.existsSync(options.ignoreFile ?? path.join(cwd, '.vscodeignore'));
|
|
1538
1612
|
if (!hasIgnoreFile && !manifest.files) {
|
|
1539
1613
|
let message = '';
|
|
1540
|
-
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. `;
|
|
1541
1615
|
message += `To ensure only necessary files are included in your extension, `;
|
|
1542
|
-
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`;
|
|
1543
1617
|
util.log.warn(message);
|
|
1544
1618
|
}
|
|
1545
1619
|
// Throw an error if the extension uses both a .vscodeignore file and the files property in package.json
|
|
1546
1620
|
else if (hasIgnoreFile && manifest.files !== undefined && manifest.files.length > 0) {
|
|
1547
1621
|
let message = '';
|
|
1548
|
-
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. `;
|
|
1549
1623
|
message += `VSCE does not support combining both strategies. `;
|
|
1550
|
-
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.`;
|
|
1551
1625
|
util.log.error(message);
|
|
1552
1626
|
process.exit(1);
|
|
1553
1627
|
}
|
|
@@ -1572,11 +1646,11 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1572
1646
|
});
|
|
1573
1647
|
if (unusedIncludePatterns.length > 0) {
|
|
1574
1648
|
let message = '';
|
|
1575
|
-
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`;
|
|
1576
1650
|
message += unusedIncludePatterns.map(p => ` - ${p.relative}`).join('\n');
|
|
1577
1651
|
message += '\nRemove any include pattern which is not needed.\n';
|
|
1578
|
-
message += `\n=> Run ${
|
|
1579
|
-
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`;
|
|
1580
1654
|
util.log.error(message);
|
|
1581
1655
|
process.exit(1);
|
|
1582
1656
|
}
|
|
@@ -1590,11 +1664,11 @@ async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
|
1590
1664
|
})), 35 // Print up to 35 files/folders
|
|
1591
1665
|
);
|
|
1592
1666
|
let message = '';
|
|
1593
|
-
message +=
|
|
1667
|
+
message += (0, util_2.styleText)(['bold', 'blue'], `Files included in the VSIX:\n`);
|
|
1594
1668
|
message += printableFileStructure.join('\n');
|
|
1595
1669
|
// If not all files have been printed, mention how all files can be printed
|
|
1596
1670
|
if (files.length + 1 > printableFileStructure.length) {
|
|
1597
|
-
message += `\n\n=> Run ${
|
|
1671
|
+
message += `\n\n=> Run ${(0, util_2.styleText)('bold', 'vsce ls --tree')} to see all included files.`;
|
|
1598
1672
|
}
|
|
1599
1673
|
message += '\n';
|
|
1600
1674
|
util.log.info(message);
|
|
@@ -1629,33 +1703,33 @@ async function scanFilesForSecrets(files, fileExclusion, options) {
|
|
|
1629
1703
|
if (noneDotEnvSecretsFound.length > 0) {
|
|
1630
1704
|
const uniqueSecretIds = new Set(noneDotEnvSecretsFound.map(result => result.ruleId));
|
|
1631
1705
|
const secretsFoundRuleNames = Array.from(uniqueSecretIds).map(secretLint_1.getRuleNameFromRuleId);
|
|
1632
|
-
let errorMessage = `${
|
|
1706
|
+
let errorMessage = `${(0, util_2.styleText)('bold', 'Potential security issue detected:')}`;
|
|
1633
1707
|
errorMessage += ` Your extension package contains sensitive information that should not be published.`;
|
|
1634
1708
|
errorMessage += ` Please remove these secrets before packaging.`;
|
|
1635
1709
|
errorMessage += `\n` + noneDotEnvSecretsFound.map(secretLint_1.prettyPrintLintResult).join('\n');
|
|
1636
1710
|
let hintMessage = `\nIn case of false positives, you can allow specific types of secrets with `;
|
|
1637
1711
|
hintMessage += secretsFoundRuleNames.map(name => `--allow-package-secrets ${name}`).join(' ');
|
|
1638
1712
|
hintMessage += ` or use --allow-package-all-secrets to skip this check entirely (not recommended).`;
|
|
1639
|
-
util.log.error(errorMessage +
|
|
1713
|
+
util.log.error(errorMessage + (0, util_2.styleText)('italic', hintMessage));
|
|
1640
1714
|
process.exit(1);
|
|
1641
1715
|
}
|
|
1642
1716
|
// .env file found
|
|
1643
1717
|
const allRuleIds = new Set(secretsFound.map(result => result.ruleId).filter(Boolean));
|
|
1644
1718
|
if (!options.allowPackageEnvFile && allRuleIds.has('@secretlint/secretlint-rule-no-dotenv')) {
|
|
1645
|
-
let errorMessage = `${
|
|
1719
|
+
let errorMessage = `${(0, util_2.styleText)(['bold', 'red'], '.env')} files should not be packaged.`;
|
|
1646
1720
|
switch (fileExclusion) {
|
|
1647
1721
|
case FileExclusionType.None:
|
|
1648
|
-
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.`;
|
|
1649
1723
|
break;
|
|
1650
1724
|
case FileExclusionType.VSCodeIgnore:
|
|
1651
|
-
errorMessage += ` Ignore the file in your ${
|
|
1725
|
+
errorMessage += ` Ignore the file in your ${(0, util_2.styleText)('bold', '.vscodeignore')}.`;
|
|
1652
1726
|
break;
|
|
1653
1727
|
case FileExclusionType.PackageFiles:
|
|
1654
|
-
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.`;
|
|
1655
1729
|
break;
|
|
1656
1730
|
}
|
|
1657
1731
|
const hintMessage = `\nTo ignore this check, you can use --allow-package-env-file (not recommended).`;
|
|
1658
|
-
util.log.error(errorMessage +
|
|
1732
|
+
util.log.error(errorMessage + (0, util_2.styleText)('italic', hintMessage));
|
|
1659
1733
|
process.exit(1);
|
|
1660
1734
|
}
|
|
1661
1735
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.parsePackageSpec = parsePackageSpec;
|
|
37
|
+
const semver = __importStar(require("semver"));
|
|
38
|
+
function parsePackageSpec(value) {
|
|
39
|
+
const separator = value.indexOf('@', value.startsWith('@') ? 1 : 0);
|
|
40
|
+
const name = separator === -1 ? value : value.slice(0, separator);
|
|
41
|
+
const originalVersion = separator === -1 ? '' : value.slice(separator + 1);
|
|
42
|
+
const range = semver.validRange(originalVersion);
|
|
43
|
+
if (originalVersion && !range) {
|
|
44
|
+
throw new Error(`Invalid semver range: ${originalVersion}`);
|
|
45
|
+
}
|
|
46
|
+
const version = originalVersion.replace(/^[^0-9]+/, '') || 'latest';
|
|
47
|
+
return { name, range: range ?? '*', version };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=packageSpec.js.map
|
package/out/publicgalleryapi.js
CHANGED
|
@@ -5,10 +5,12 @@ const HttpClient_1 = require("typed-rest-client/HttpClient");
|
|
|
5
5
|
const GalleryInterfaces_1 = require("azure-devops-node-api/interfaces/GalleryInterfaces");
|
|
6
6
|
const Serialization_1 = require("azure-devops-node-api/Serialization");
|
|
7
7
|
class PublicGalleryAPI {
|
|
8
|
+
baseUrl;
|
|
9
|
+
apiVersion;
|
|
10
|
+
client = new HttpClient_1.HttpClient('vsce');
|
|
8
11
|
constructor(baseUrl, apiVersion = '3.0-preview.1') {
|
|
9
12
|
this.baseUrl = baseUrl;
|
|
10
13
|
this.apiVersion = apiVersion;
|
|
11
|
-
this.client = new HttpClient_1.HttpClient('vsce');
|
|
12
14
|
}
|
|
13
15
|
post(url, data, additionalHeaders) {
|
|
14
16
|
return this.client.post(`${this.baseUrl}/_apis/public${url}`, data, additionalHeaders);
|