@vscode/vsce 2.30.1-0 → 2.30.1-1
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/dist/vsce.d.ts +2 -0
- package/out/main.js +6 -2
- package/out/package.js +47 -18
- package/out/util.js +9 -1
- package/out/zip.js +2 -1
- package/package.json +1 -1
package/dist/vsce.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare interface IPackageOptions {
|
|
|
117
117
|
readonly preRelease?: boolean;
|
|
118
118
|
readonly allowStarActivation?: boolean;
|
|
119
119
|
readonly allowMissingRepository?: boolean;
|
|
120
|
+
readonly allowUnusedFilesPattern?: boolean;
|
|
120
121
|
readonly skipLicense?: boolean;
|
|
121
122
|
readonly signTool?: string;
|
|
122
123
|
}
|
|
@@ -172,6 +173,7 @@ export declare interface IPublishOptions {
|
|
|
172
173
|
readonly preRelease?: boolean;
|
|
173
174
|
readonly allowStarActivation?: boolean;
|
|
174
175
|
readonly allowMissingRepository?: boolean;
|
|
176
|
+
readonly allowUnusedFilesPattern?: boolean;
|
|
175
177
|
readonly skipDuplicate?: boolean;
|
|
176
178
|
readonly skipLicense?: boolean;
|
|
177
179
|
readonly sigzipPath?: string[];
|
package/out/main.js
CHANGED
|
@@ -114,9 +114,10 @@ module.exports = function (argv) {
|
|
|
114
114
|
.option('--pre-release', 'Mark this package as a pre-release')
|
|
115
115
|
.option('--allow-star-activation', 'Allow using * in activation events')
|
|
116
116
|
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
|
|
117
|
+
.option('--allow-unused-files-pattern', 'Allow include patterns for the files field in package.json that does not match any file')
|
|
117
118
|
.option('--skip-license', 'Allow packaging without license file')
|
|
118
119
|
.option('--sign-tool <path>', 'Path to the VSIX signing tool. Will be invoked with two arguments: `SIGNTOOL <path/to/extension.signature.manifest> <path/to/extension.signature.p7s>`.')
|
|
119
|
-
.action((version, { out, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, githubBranch, gitlabBranch, rewriteRelativeLinks, baseContentUrl, baseImagesUrl, yarn, ignoreFile, gitHubIssueLinking, gitLabIssueLinking, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipLicense, signTool, }) => main((0, package_1.packageCommand)({
|
|
120
|
+
.action((version, { out, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, githubBranch, gitlabBranch, rewriteRelativeLinks, baseContentUrl, baseImagesUrl, yarn, ignoreFile, gitHubIssueLinking, gitLabIssueLinking, dependencies, preRelease, allowStarActivation, allowMissingRepository, allowUnusedFilesPattern, skipLicense, signTool, }) => main((0, package_1.packageCommand)({
|
|
120
121
|
packagePath: out,
|
|
121
122
|
version,
|
|
122
123
|
target,
|
|
@@ -139,6 +140,7 @@ module.exports = function (argv) {
|
|
|
139
140
|
preRelease,
|
|
140
141
|
allowStarActivation,
|
|
141
142
|
allowMissingRepository,
|
|
143
|
+
allowUnusedFilesPattern,
|
|
142
144
|
skipLicense,
|
|
143
145
|
signTool,
|
|
144
146
|
})));
|
|
@@ -175,9 +177,10 @@ module.exports = function (argv) {
|
|
|
175
177
|
.option('--pre-release', 'Mark this package as a pre-release')
|
|
176
178
|
.option('--allow-star-activation', 'Allow using * in activation events')
|
|
177
179
|
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
|
|
180
|
+
.option('--allow-unused-files-pattern', 'Allow include patterns for the files field in package.json that does not match any file')
|
|
178
181
|
.option('--skip-duplicate', 'Fail silently if version already exists on the marketplace')
|
|
179
182
|
.option('--skip-license', 'Allow publishing without license file')
|
|
180
|
-
.action((version, { pat, azureCredential, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, manifestPath, signaturePath, sigzipPath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipDuplicate, skipLicense, signTool, }) => main((0, publish_1.publish)({
|
|
183
|
+
.action((version, { pat, azureCredential, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, manifestPath, signaturePath, sigzipPath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, allowUnusedFilesPattern, skipDuplicate, skipLicense, signTool, }) => main((0, publish_1.publish)({
|
|
181
184
|
pat,
|
|
182
185
|
azureCredential,
|
|
183
186
|
version,
|
|
@@ -205,6 +208,7 @@ module.exports = function (argv) {
|
|
|
205
208
|
preRelease,
|
|
206
209
|
allowStarActivation,
|
|
207
210
|
allowMissingRepository,
|
|
211
|
+
allowUnusedFilesPattern,
|
|
208
212
|
skipDuplicate,
|
|
209
213
|
skipLicense,
|
|
210
214
|
signTool
|
package/out/package.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.printAndValidatePackagedFiles = exports.ls = exports.listFiles = exports.packageCommand = exports.createSignatureArchive = exports.generateManifest = exports.signPackage = exports.pack = exports.prepublish = exports.collect = exports.createDefaultProcessors = exports.processFiles = exports.toContentTypes = exports.toVsixManifest = exports.readManifest = exports.validateManifest = exports.ValidationProcessor = exports.NLSProcessor = exports.isWebKind = exports.LicenseProcessor = exports.ChangelogProcessor = exports.ReadmeProcessor = exports.MarkdownProcessor = exports.TagsProcessor = exports.ManifestProcessor = exports.Targets = exports.versionBump = exports.BaseProcessor = exports.read = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const util_1 = require("util");
|
|
@@ -500,7 +500,7 @@ class MarkdownProcessor extends BaseProcessor {
|
|
|
500
500
|
super(manifest);
|
|
501
501
|
this.name = name;
|
|
502
502
|
this.assetType = assetType;
|
|
503
|
-
this.regexp = new RegExp(
|
|
503
|
+
this.regexp = new RegExp(`^${util.filePathToVsixPath(filePath)}$`, 'i');
|
|
504
504
|
const guess = this.guessBaseUrls(options.githubBranch || options.gitlabBranch);
|
|
505
505
|
this.baseContentUrl = options.baseContentUrl || (guess && guess.content);
|
|
506
506
|
this.baseImagesUrl = options.baseImagesUrl || options.baseContentUrl || (guess && guess.images);
|
|
@@ -682,7 +682,7 @@ class LicenseProcessor extends BaseProcessor {
|
|
|
682
682
|
}
|
|
683
683
|
else {
|
|
684
684
|
this.expectedLicenseName = match[1];
|
|
685
|
-
const regexp = new RegExp(
|
|
685
|
+
const regexp = new RegExp(`^${util.filePathToVsixPath(match[1])}$`);
|
|
686
686
|
this.filter = regexp.test.bind(regexp);
|
|
687
687
|
}
|
|
688
688
|
delete this.vsix.license;
|
|
@@ -744,7 +744,7 @@ class IconProcessor extends BaseProcessor {
|
|
|
744
744
|
constructor(manifest) {
|
|
745
745
|
super(manifest);
|
|
746
746
|
this.didFindIcon = false;
|
|
747
|
-
this.icon = manifest.icon && path.posix.normalize(
|
|
747
|
+
this.icon = manifest.icon && path.posix.normalize(util.filePathToVsixPath(manifest.icon));
|
|
748
748
|
delete this.vsix.icon;
|
|
749
749
|
}
|
|
750
750
|
onFile(file) {
|
|
@@ -839,7 +839,7 @@ class NLSProcessor extends BaseProcessor {
|
|
|
839
839
|
for (const translation of localization.translations) {
|
|
840
840
|
if (translation.id === 'vscode' && !!translation.path) {
|
|
841
841
|
const translationPath = util.normalize(translation.path.replace(/^\.[\/\\]/, ''));
|
|
842
|
-
translations[localization.languageId.toUpperCase()] =
|
|
842
|
+
translations[localization.languageId.toUpperCase()] = util.filePathToVsixPath(translationPath);
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
}
|
|
@@ -1110,7 +1110,7 @@ async function toVsixManifest(vsix) {
|
|
|
1110
1110
|
</Installation>
|
|
1111
1111
|
<Dependencies/>
|
|
1112
1112
|
<Assets>
|
|
1113
|
-
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="
|
|
1113
|
+
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="${util.filePathToVsixPath('package.json')}" Addressable="true" />
|
|
1114
1114
|
${vsix.assets
|
|
1115
1115
|
.map(asset => `<Asset Type="${escape(asset.type)}" Path="${escape(asset.path)}" Addressable="true" />`)
|
|
1116
1116
|
.join('\n')}
|
|
@@ -1275,7 +1275,7 @@ function collect(manifest, options = {}) {
|
|
|
1275
1275
|
const ignoreFile = options.ignoreFile || undefined;
|
|
1276
1276
|
const processors = createDefaultProcessors(manifest, options);
|
|
1277
1277
|
return collectFiles(cwd, getDependenciesOption(options), packagedDependencies, ignoreFile, manifest.files).then(fileNames => {
|
|
1278
|
-
const files = fileNames.map(f => ({ path:
|
|
1278
|
+
const files = fileNames.map(f => ({ path: util.filePathToVsixPath(f), localPath: path.join(cwd, f) }));
|
|
1279
1279
|
return processFiles(processors, files);
|
|
1280
1280
|
});
|
|
1281
1281
|
}
|
|
@@ -1346,7 +1346,7 @@ async function pack(options = {}) {
|
|
|
1346
1346
|
const cwd = options.cwd || process.cwd();
|
|
1347
1347
|
const manifest = await readManifest(cwd);
|
|
1348
1348
|
const files = await collect(manifest, options);
|
|
1349
|
-
await
|
|
1349
|
+
await printAndValidatePackagedFiles(files, cwd, manifest, options);
|
|
1350
1350
|
if (options.version && !(options.updatePackageJson ?? true)) {
|
|
1351
1351
|
manifest.version = options.version;
|
|
1352
1352
|
}
|
|
@@ -1428,7 +1428,7 @@ exports.ls = ls;
|
|
|
1428
1428
|
/**
|
|
1429
1429
|
* Prints the packaged files of an extension.
|
|
1430
1430
|
*/
|
|
1431
|
-
async function
|
|
1431
|
+
async function printAndValidatePackagedFiles(files, cwd, manifest, options) {
|
|
1432
1432
|
// Warn if the extension contains a lot of files
|
|
1433
1433
|
const jsFiles = files.filter(f => /\.js$/i.test(f.path));
|
|
1434
1434
|
if (files.length > 5000 || jsFiles.length > 100) {
|
|
@@ -1439,20 +1439,49 @@ async function printPackagedFiles(files, cwd, manifest, options) {
|
|
|
1439
1439
|
util.log.warn(message);
|
|
1440
1440
|
}
|
|
1441
1441
|
// Warn if the extension does not have a .vscodeignore file or a files property in package.json
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1442
|
+
const hasIgnoreFile = fs.existsSync(options.ignoreFile ?? path.join(cwd, '.vscodeignore'));
|
|
1443
|
+
if (!hasIgnoreFile && !manifest.files) {
|
|
1444
|
+
let message = '';
|
|
1445
|
+
message += `Neither a ${chalk_1.default.bold('.vscodeignore')} file nor a ${chalk_1.default.bold('"files"')} property in package.json was found. `;
|
|
1446
|
+
message += `To ensure only necessary files are included in your extension, `;
|
|
1447
|
+
message += `add a .vscodeignore file or specify the "files" property in package.json. More info: ${chalk_1.default.underline('https://aka.ms/vscode-vscodeignore')}\n`;
|
|
1448
|
+
util.log.warn(message);
|
|
1449
|
+
}
|
|
1450
|
+
// Throw an error if the extension uses both a .vscodeignore file and the files property in package.json
|
|
1451
|
+
else if (hasIgnoreFile && manifest.files !== undefined && manifest.files.length > 0) {
|
|
1452
|
+
let message = '';
|
|
1453
|
+
message += `Both a ${chalk_1.default.bold('.vscodeignore')} file and a ${chalk_1.default.bold('"files"')} property in package.json were found. `;
|
|
1454
|
+
message += `VSCE does not support combining both strategies. `;
|
|
1455
|
+
message += `Either remove the ${chalk_1.default.bold('.vscodeignore')} file or the ${chalk_1.default.bold('"files"')} property in package.json.`;
|
|
1456
|
+
util.log.error(message);
|
|
1457
|
+
process.exit(1);
|
|
1458
|
+
}
|
|
1459
|
+
// Throw an error if the extension uses the files property in package.json and
|
|
1460
|
+
// the package does not include at least one file for each include pattern
|
|
1461
|
+
else if (manifest.files !== undefined && manifest.files.length > 0 && !options.allowUnusedFilesPattern) {
|
|
1462
|
+
const originalFilePaths = files.map(f => util.vsixPathToFilePath(f.path));
|
|
1463
|
+
const unusedIncludePatterns = [];
|
|
1464
|
+
for (const includePattern of manifest.files) {
|
|
1465
|
+
const hasMatchingFile = originalFilePaths.some(file => (0, minimatch_1.default)(file, includePattern, MinimatchOptions));
|
|
1466
|
+
if (!hasMatchingFile) {
|
|
1467
|
+
unusedIncludePatterns.push(includePattern);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
if (unusedIncludePatterns.length > 0) {
|
|
1445
1471
|
let message = '';
|
|
1446
|
-
message += `
|
|
1447
|
-
message +=
|
|
1448
|
-
message +=
|
|
1449
|
-
|
|
1472
|
+
message += `The following include patterns in the ${chalk_1.default.bold('"files"')} property in package.json do not match any files packaged in the extension:\n`;
|
|
1473
|
+
message += unusedIncludePatterns.map(p => ` - ${p}`).join('\n');
|
|
1474
|
+
message += '\nRemove any include pattern which is not needed.\n';
|
|
1475
|
+
message += `\n=> Run ${chalk_1.default.bold('vsce ls --tree')} to see all included files.\n`;
|
|
1476
|
+
message += `=> Use ${chalk_1.default.bold('--allow-unused-files-patterns')} to skip this check`;
|
|
1477
|
+
util.log.error(message);
|
|
1478
|
+
process.exit(1);
|
|
1450
1479
|
}
|
|
1451
1480
|
}
|
|
1452
1481
|
// Print the files included in the package
|
|
1453
1482
|
const printableFileStructure = await util.generateFileStructureTree(getDefaultPackageName(manifest, options), files.map(f => ({
|
|
1454
1483
|
// File path relative to the extension root
|
|
1455
|
-
origin:
|
|
1484
|
+
origin: util.vsixPathToFilePath(f.path),
|
|
1456
1485
|
// File path in the VSIX
|
|
1457
1486
|
tree: f.path
|
|
1458
1487
|
})), 35 // Print up to 35 files/folders
|
|
@@ -1467,5 +1496,5 @@ async function printPackagedFiles(files, cwd, manifest, options) {
|
|
|
1467
1496
|
message += '\n';
|
|
1468
1497
|
util.log.info(message);
|
|
1469
1498
|
}
|
|
1470
|
-
exports.
|
|
1499
|
+
exports.printAndValidatePackagedFiles = printAndValidatePackagedFiles;
|
|
1471
1500
|
//# sourceMappingURL=package.js.map
|
package/out/util.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.generateFileStructureTree = exports.bytesToString = exports.patchOptionsWithManifest = exports.log = exports.sequence = exports.CancellationToken = exports.isCancelledError = exports.nonnull = exports.flatten = exports.chain = exports.normalize = exports.getPublicGalleryAPI = exports.getSecurityRolesAPI = exports.getGalleryAPI = exports.getHubUrl = exports.getMarketplaceUrl = exports.getPublishedUrl = exports.read = void 0;
|
|
29
|
+
exports.generateFileStructureTree = exports.vsixPathToFilePath = exports.filePathToVsixPath = exports.bytesToString = exports.patchOptionsWithManifest = exports.log = exports.sequence = exports.CancellationToken = exports.isCancelledError = exports.nonnull = exports.flatten = exports.chain = exports.normalize = exports.getPublicGalleryAPI = exports.getSecurityRolesAPI = exports.getGalleryAPI = exports.getHubUrl = exports.getMarketplaceUrl = exports.getPublishedUrl = exports.read = void 0;
|
|
30
30
|
const util_1 = require("util");
|
|
31
31
|
const fs = __importStar(require("fs"));
|
|
32
32
|
const read_1 = __importDefault(require("read"));
|
|
@@ -204,6 +204,14 @@ function bytesToString(bytes) {
|
|
|
204
204
|
return `${size} ${unit}`;
|
|
205
205
|
}
|
|
206
206
|
exports.bytesToString = bytesToString;
|
|
207
|
+
function filePathToVsixPath(originalFilePath) {
|
|
208
|
+
return `extension/${originalFilePath}`;
|
|
209
|
+
}
|
|
210
|
+
exports.filePathToVsixPath = filePathToVsixPath;
|
|
211
|
+
function vsixPathToFilePath(extensionFilePath) {
|
|
212
|
+
return extensionFilePath.startsWith('extension/') ? extensionFilePath.substring('extension/'.length) : extensionFilePath;
|
|
213
|
+
}
|
|
214
|
+
exports.vsixPathToFilePath = vsixPathToFilePath;
|
|
207
215
|
const FOLDER_SIZE_KEY = "/__FOlDER_SIZE__\\";
|
|
208
216
|
const FOLDER_FILES_TOTAL_KEY = "/__FOLDER_CHILDREN__\\";
|
|
209
217
|
const FILE_SIZE_WARNING_THRESHOLD = 0.85;
|
package/out/zip.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readVSIXPackage = exports.readZip = void 0;
|
|
4
4
|
const yauzl_1 = require("yauzl");
|
|
5
5
|
const xml_1 = require("./xml");
|
|
6
|
+
const util_1 = require("./util");
|
|
6
7
|
async function bufferStream(stream) {
|
|
7
8
|
return await new Promise((c, e) => {
|
|
8
9
|
const buffers = [];
|
|
@@ -40,7 +41,7 @@ async function readZip(packagePath, filter) {
|
|
|
40
41
|
exports.readZip = readZip;
|
|
41
42
|
async function readVSIXPackage(packagePath) {
|
|
42
43
|
const map = await readZip(packagePath, name => /^extension\/package\.json$|^extension\.vsixmanifest$/i.test(name));
|
|
43
|
-
const rawManifest = map.get('
|
|
44
|
+
const rawManifest = map.get((0, util_1.filePathToVsixPath)('package.json'));
|
|
44
45
|
if (!rawManifest) {
|
|
45
46
|
throw new Error('Manifest not found');
|
|
46
47
|
}
|