@vscode/vsce 2.29.1-0 → 2.29.1-2

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/main.js CHANGED
@@ -64,7 +64,7 @@ function main(task) {
64
64
  }
65
65
  task.catch(fatal).then(() => {
66
66
  if (latestVersion && semver.gt(latestVersion, pkg.version)) {
67
- util_1.log.info(`\nThe latest version of ${pkg.name} is ${latestVersion} and you have ${pkg.version}.\nUpdate it now: npm install -g ${pkg.name}`);
67
+ util_1.log.info(`The latest version of ${pkg.name} is ${latestVersion} and you have ${pkg.version}.\nUpdate it now: npm install -g ${pkg.name}`);
68
68
  }
69
69
  else {
70
70
  token.cancel();
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.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;
29
+ exports.printPackagedFiles = 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");
@@ -42,6 +42,7 @@ const url = __importStar(require("url"));
42
42
  const mime_1 = __importDefault(require("mime"));
43
43
  const semver = __importStar(require("semver"));
44
44
  const url_join_1 = __importDefault(require("url-join"));
45
+ const chalk_1 = __importDefault(require("chalk"));
45
46
  const validation_1 = require("./validation");
46
47
  const npm_1 = require("./npm");
47
48
  const GitHost = __importStar(require("hosted-git-info"));
@@ -388,7 +389,11 @@ class ManifestProcessor extends BaseProcessor {
388
389
  }
389
390
  }
390
391
  if (!this.options.allowStarActivation && this.manifest.activationEvents?.some(e => e === '*')) {
391
- util.log.warn(`Using '*' activation is usually a bad idea as it impacts performance.\nMore info: https://code.visualstudio.com/api/references/activation-events#Start-up\nUse --allow-star-activation to bypass.`);
392
+ let message = '';
393
+ message += `Using '*' activation is usually a bad idea as it impacts performance.\n`;
394
+ message += `More info: https://code.visualstudio.com/api/references/activation-events#Start-up\n`;
395
+ message += `Use --allow-star-activation to bypass.`;
396
+ util.log.warn(message);
392
397
  if (!/^y$/i.test(await util.read('Do you want to continue? [y/N] '))) {
393
398
  throw new Error('Aborted');
394
399
  }
@@ -889,6 +894,7 @@ class ValidationProcessor extends BaseProcessor {
889
894
  exports.ValidationProcessor = ValidationProcessor;
890
895
  function validateManifest(manifest) {
891
896
  (0, validation_1.validateExtensionName)(manifest.name);
897
+ (0, validation_1.validatePublisher)(manifest.publisher);
892
898
  if (!manifest.version) {
893
899
  throw new Error('Manifest missing field: version');
894
900
  }
@@ -1340,10 +1346,7 @@ async function pack(options = {}) {
1340
1346
  const cwd = options.cwd || process.cwd();
1341
1347
  const manifest = await readManifest(cwd);
1342
1348
  const files = await collect(manifest, options);
1343
- const jsFiles = files.filter(f => /\.js$/i.test(f.path));
1344
- if (files.length > 5000 || jsFiles.length > 100) {
1345
- console.log(`This extension consists of ${files.length} files, out of which ${jsFiles.length} are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore`);
1346
- }
1349
+ printPackagedFiles(files, cwd, manifest, options);
1347
1350
  if (options.version && !(options.updatePackageJson ?? true)) {
1348
1351
  manifest.version = options.version;
1349
1352
  }
@@ -1425,4 +1428,40 @@ async function ls(options = {}) {
1425
1428
  }
1426
1429
  }
1427
1430
  exports.ls = ls;
1431
+ /**
1432
+ * Prints the packaged files of an extension.
1433
+ */
1434
+ function printPackagedFiles(files, cwd, manifest, options) {
1435
+ // Warn if the extension contains a lot of files
1436
+ const jsFiles = files.filter(f => /\.js$/i.test(f.path));
1437
+ if (files.length > 5000 || jsFiles.length > 100) {
1438
+ let message = '\n';
1439
+ message += `This extension consists of ${chalk_1.default.bold(String(files.length))} files, out of which ${chalk_1.default.bold(String(jsFiles.length))} are JavaScript files. `;
1440
+ message += `For performance reasons, you should bundle your extension: ${chalk_1.default.underline('https://aka.ms/vscode-bundle-extension')}. `;
1441
+ message += `You should also exclude unnecessary files by adding them to your .vscodeignore: ${chalk_1.default.underline('https://aka.ms/vscode-vscodeignore')}.\n`;
1442
+ console.log(message);
1443
+ }
1444
+ // Warn if the extension does not have a .vscodeignore file or a files property in package.json
1445
+ if (!options.ignoreFile && !manifest.files) {
1446
+ const hasDeaultIgnore = fs.existsSync(path.join(cwd, '.vscodeignore'));
1447
+ if (!hasDeaultIgnore) {
1448
+ let message = '';
1449
+ message += `Neither a ${chalk_1.default.bold('.vscodeignore')} file nor a ${chalk_1.default.bold('"files"')} property in package.json was found. `;
1450
+ message += `To ensure only necessary files are included in your extension package, `;
1451
+ message += `add a .vscodeignore file or specify the "files" property in package.json. More info: ${chalk_1.default.underline('https://aka.ms/vscode-vscodeignore')}`;
1452
+ util.log.warn(message);
1453
+ }
1454
+ }
1455
+ // Print the files included in the package
1456
+ const printableFileStructure = util.generateFileStructureTree(getDefaultPackageName(manifest, options), files.map(f => f.path), 35);
1457
+ let message = '';
1458
+ message += chalk_1.default.bold.blue(`Files included in the VSIX:\n`);
1459
+ message += printableFileStructure.join('\n');
1460
+ if (files.length + 1 > printableFileStructure.length) {
1461
+ // If not all files have been printed, mention how all files can be printed
1462
+ message += `\n\n=> Run ${chalk_1.default.bold('vsce ls')} to see a list of all included files.\n`;
1463
+ }
1464
+ util.log.info(message);
1465
+ }
1466
+ exports.printPackagedFiles = printPackagedFiles;
1428
1467
  //# sourceMappingURL=package.js.map
package/out/util.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- 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;
6
+ exports.generateFileStructureTree = 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;
7
7
  const util_1 = require("util");
8
8
  const read_1 = __importDefault(require("read"));
9
9
  const WebApi_1 = require("azure-devops-node-api/WebApi");
@@ -166,4 +166,82 @@ function patchOptionsWithManifest(options, manifest) {
166
166
  }
167
167
  }
168
168
  exports.patchOptionsWithManifest = patchOptionsWithManifest;
169
+ function generateFileStructureTree(rootFolder, filePaths, maxPrint = Number.MAX_VALUE) {
170
+ const folderTree = {};
171
+ const depthCounts = [];
172
+ // Build a tree structure from the file paths
173
+ filePaths.forEach(filePath => {
174
+ const parts = filePath.split('/');
175
+ let currentLevel = folderTree;
176
+ parts.forEach((part, depth) => {
177
+ if (!currentLevel[part]) {
178
+ currentLevel[part] = depth === parts.length - 1 ? null : {};
179
+ if (depthCounts.length <= depth) {
180
+ depthCounts.push(0);
181
+ }
182
+ depthCounts[depth]++;
183
+ }
184
+ currentLevel = currentLevel[part];
185
+ });
186
+ });
187
+ // Get max depth
188
+ let currentDepth = 0;
189
+ let countUpToCurrentDepth = depthCounts[0];
190
+ for (let i = 1; i < depthCounts.length; i++) {
191
+ if (countUpToCurrentDepth + depthCounts[i] > maxPrint) {
192
+ break;
193
+ }
194
+ currentDepth++;
195
+ countUpToCurrentDepth += depthCounts[i];
196
+ }
197
+ const maxDepth = currentDepth;
198
+ let message = [];
199
+ // Helper function to print the tree
200
+ const printTree = (tree, depth, prefix) => {
201
+ // Print all files before folders
202
+ const sortedFolderKeys = Object.keys(tree).filter(key => tree[key] !== null).sort();
203
+ const sortedFileKeys = Object.keys(tree).filter(key => tree[key] === null).sort();
204
+ const sortedKeys = [...sortedFileKeys, ...sortedFolderKeys];
205
+ for (let i = 0; i < sortedKeys.length; i++) {
206
+ const key = sortedKeys[i];
207
+ const isLast = i === sortedKeys.length - 1;
208
+ const localPrefix = prefix + (isLast ? '└─ ' : '├─ ');
209
+ const childPrefix = prefix + (isLast ? ' ' : '│ ');
210
+ if (tree[key] === null) {
211
+ // It's a file
212
+ message.push(localPrefix + key);
213
+ }
214
+ else {
215
+ // It's a folder
216
+ if (depth < maxDepth) {
217
+ // maxdepth is not reached, print the folder and its children
218
+ message.push(localPrefix + chalk_1.default.bold(`${key}/`));
219
+ printTree(tree[key], depth + 1, childPrefix);
220
+ }
221
+ else {
222
+ // max depth is reached, print the folder but not its children
223
+ const filesCount = countFiles(tree[key]);
224
+ message.push(localPrefix + chalk_1.default.bold(`${key}/`) + chalk_1.default.green(` (${filesCount} ${filesCount === 1 ? 'file' : 'files'})`));
225
+ }
226
+ }
227
+ }
228
+ };
229
+ // Helper function to count the number of files in a tree
230
+ const countFiles = (tree) => {
231
+ let filesCount = 0;
232
+ for (const key in tree) {
233
+ if (tree[key] === null) {
234
+ filesCount++;
235
+ }
236
+ else {
237
+ filesCount += countFiles(tree[key]);
238
+ }
239
+ }
240
+ return filesCount;
241
+ };
242
+ message.push(chalk_1.default.bold(rootFolder));
243
+ printTree(folderTree, 0, '');
244
+ return message;
245
+ }
246
+ exports.generateFileStructureTree = generateFileStructureTree;
169
247
  //# sourceMappingURL=util.js.map
package/out/validation.js CHANGED
@@ -35,7 +35,7 @@ function validatePublisher(publisher) {
35
35
  throw new Error(`Missing publisher name. Learn more: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions`);
36
36
  }
37
37
  if (!nameRegex.test(publisher)) {
38
- throw new Error(`Invalid publisher name '${publisher}'. Expected the identifier of a publisher, not its human-friendly name. Learn more: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions`);
38
+ throw new Error(`Invalid publisher name '${publisher}'. Expected the identifier of a publisher, not its human-friendly name. Learn more: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions`);
39
39
  }
40
40
  }
41
41
  exports.validatePublisher = validatePublisher;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/vsce",
3
- "version": "2.29.1-0",
3
+ "version": "2.29.1-2",
4
4
  "description": "VS Code Extensions Manager",
5
5
  "repository": {
6
6
  "type": "git",