@vscode/vsce 2.26.1 → 2.26.2-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 CHANGED
@@ -118,6 +118,7 @@ export declare interface IPackageOptions {
118
118
  readonly allowStarActivation?: boolean;
119
119
  readonly allowMissingRepository?: boolean;
120
120
  readonly skipLicense?: boolean;
121
+ readonly signTool?: string;
121
122
  }
122
123
 
123
124
  /**
@@ -174,6 +175,7 @@ export declare interface IPublishOptions {
174
175
  readonly skipDuplicate?: boolean;
175
176
  readonly skipLicense?: boolean;
176
177
  readonly sigzipPath?: string[];
178
+ readonly signTool?: string;
177
179
  }
178
180
 
179
181
  /**
package/out/main.js CHANGED
@@ -114,7 +114,8 @@ module.exports = function (argv) {
114
114
  .option('--allow-star-activation', 'Allow using * in activation events')
115
115
  .option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
116
116
  .option('--skip-license', 'Allow packaging without license file')
117
- .action((version, { out, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, githubBranch, gitlabBranch, rewriteRelativeLinks, baseContentUrl, baseImagesUrl, yarn, ignoreFile, gitHubIssueLinking, gitLabIssueLinking, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipLicense, }) => main((0, package_1.packageCommand)({
117
+ .option('--sign-tool', 'Path to the VSIX signing tool. Will be invoked with two arguments: `SIGNTOOL <path/to/extension.signature.manifest> <path/to/extension.signature.p7s>`.')
118
+ .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)({
118
119
  packagePath: out,
119
120
  version,
120
121
  target,
@@ -138,6 +139,7 @@ module.exports = function (argv) {
138
139
  allowStarActivation,
139
140
  allowMissingRepository,
140
141
  skipLicense,
142
+ signTool,
141
143
  })));
142
144
  commander_1.default
143
145
  .command('publish [version]')
@@ -153,6 +155,7 @@ module.exports = function (argv) {
153
155
  .option('--no-update-package-json', 'Do not update `package.json`. Valid only when [version] is provided.')
154
156
  .option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
155
157
  .option('--sigzipPath <paths...>', 'Signature archives to publish alongside the VSIX packages.')
158
+ .option('--sign-tool', 'Path to the VSIX signing tool. Will be invoked with two arguments: `SIGNTOOL <path/to/extension.signature.manifest> <path/to/extension.signature.p7s>`. This will be ignored if --sigzipPath is provided.')
156
159
  .option('--githubBranch <branch>', 'The GitHub branch used to infer relative links in README.md. Can be overridden by --baseContentUrl and --baseImagesUrl.')
157
160
  .option('--gitlabBranch <branch>', 'The GitLab branch used to infer relative links in README.md. Can be overridden by --baseContentUrl and --baseImagesUrl.')
158
161
  .option('--baseContentUrl <url>', 'Prepend all relative links in README.md with the specified URL.')
@@ -171,7 +174,7 @@ module.exports = function (argv) {
171
174
  .option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
172
175
  .option('--skip-duplicate', 'Fail silently if version already exists on the marketplace')
173
176
  .option('--skip-license', 'Allow publishing without license file')
174
- .action((version, { pat, azureCredential, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, sigzipPath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipDuplicate, skipLicense, }) => main((0, publish_1.publish)({
177
+ .action((version, { pat, azureCredential, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, sigzipPath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipDuplicate, skipLicense, signTool, }) => main((0, publish_1.publish)({
175
178
  pat,
176
179
  azureCredential,
177
180
  version,
@@ -199,6 +202,7 @@ module.exports = function (argv) {
199
202
  allowMissingRepository,
200
203
  skipDuplicate,
201
204
  skipLicense,
205
+ signTool
202
206
  })));
203
207
  commander_1.default
204
208
  .command('unpublish [extensionid]')
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.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.ls = exports.listFiles = exports.packageCommand = 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");
@@ -47,6 +47,7 @@ const npm_1 = require("./npm");
47
47
  const GitHost = __importStar(require("hosted-git-info"));
48
48
  const parse_semver_1 = __importDefault(require("parse-semver"));
49
49
  const jsonc = __importStar(require("jsonc-parser"));
50
+ const vsce_sign_1 = require("@vscode/vsce-sign");
50
51
  const MinimatchOptions = { dot: true };
51
52
  function isInMemoryFile(file) {
52
53
  return !!file.contents;
@@ -1008,8 +1009,11 @@ function readManifest(cwd = process.cwd(), nls = true) {
1008
1009
  }
1009
1010
  const manifestNLS = fs.promises
1010
1011
  .readFile(manifestNLSPath, 'utf8')
1011
- .catch(err => (err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('{}')))
1012
+ .catch(err => (err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve(undefined)))
1012
1013
  .then(raw => {
1014
+ if (!raw) {
1015
+ return Promise.resolve(undefined);
1016
+ }
1013
1017
  try {
1014
1018
  return Promise.resolve(jsonc.parse(raw));
1015
1019
  }
@@ -1019,6 +1023,9 @@ function readManifest(cwd = process.cwd(), nls = true) {
1019
1023
  }
1020
1024
  });
1021
1025
  return Promise.all([manifest, manifestNLS]).then(([manifest, translations]) => {
1026
+ if (!translations) {
1027
+ return manifest;
1028
+ }
1022
1029
  return (0, nls_1.patchNLS)(manifest, translations);
1023
1030
  });
1024
1031
  }
@@ -1343,6 +1350,20 @@ async function pack(options = {}) {
1343
1350
  return { manifest, packagePath, files };
1344
1351
  }
1345
1352
  exports.pack = pack;
1353
+ async function signPackage(packageFile, signScript) {
1354
+ const packageFolder = path.dirname(packageFile);
1355
+ const packageName = path.basename(packageFile, '.vsix');
1356
+ const manifestFile = path.join(packageFolder, `${packageName}.signature.manifest`);
1357
+ const signatureFile = path.join(packageFolder, `${packageName}.signature.p7s`);
1358
+ const signatureZip = path.join(packageFolder, `${packageName}.signature.zip`);
1359
+ // Generate the signature manifest file
1360
+ await (0, vsce_sign_1.generateManifest)(packageFile, manifestFile);
1361
+ // Sign the manifest file to generate the signature file
1362
+ cp.spawnSync(signScript, [manifestFile, signatureFile], { stdio: 'inherit' });
1363
+ // Create a signature zip file containing the manifest and signature file
1364
+ return (0, vsce_sign_1.zip)(manifestFile, signatureFile, signatureZip);
1365
+ }
1366
+ exports.signPackage = signPackage;
1346
1367
  async function packageCommand(options = {}) {
1347
1368
  const cwd = options.cwd || process.cwd();
1348
1369
  const manifest = await readManifest(cwd);
@@ -1350,6 +1371,9 @@ async function packageCommand(options = {}) {
1350
1371
  await prepublish(cwd, manifest, options.useYarn);
1351
1372
  await versionBump(options);
1352
1373
  const { packagePath, files } = await pack(options);
1374
+ if (options.signTool) {
1375
+ await signPackage(packagePath, options.signTool);
1376
+ }
1353
1377
  const stats = await fs.promises.stat(packagePath);
1354
1378
  let size = 0;
1355
1379
  let unit = '';
package/out/publish.js CHANGED
@@ -72,7 +72,11 @@ async function publish(options = {}) {
72
72
  }
73
73
  }
74
74
  validateMarketplaceRequirements(vsix.manifest, options);
75
- await _publish(packagePath, options.sigzipPath?.[index], vsix.manifest, { ...options, target });
75
+ let sigzipPath = options.sigzipPath?.[index];
76
+ if (!sigzipPath && options.signTool) {
77
+ sigzipPath = await (0, package_1.signPackage)(packagePath, options.signTool);
78
+ }
79
+ await _publish(packagePath, sigzipPath, vsix.manifest, { ...options, target });
76
80
  }
77
81
  }
78
82
  else {
@@ -87,13 +91,15 @@ async function publish(options = {}) {
87
91
  for (const target of options.targets) {
88
92
  const packagePath = await tmpName();
89
93
  const packageResult = await (0, package_1.pack)({ ...options, target, packagePath });
90
- await _publish(packagePath, undefined, packageResult.manifest, { ...options, target });
94
+ const sigzipPath = options.signTool ? await (0, package_1.signPackage)(packagePath, options.signTool) : undefined;
95
+ await _publish(packagePath, sigzipPath, packageResult.manifest, { ...options, target });
91
96
  }
92
97
  }
93
98
  else {
94
99
  const packagePath = await tmpName();
95
100
  const packageResult = await (0, package_1.pack)({ ...options, packagePath });
96
- await _publish(packagePath, undefined, packageResult.manifest, options);
101
+ const sigzipPath = options.signTool ? await (0, package_1.signPackage)(packagePath, options.signTool) : undefined;
102
+ await _publish(packagePath, sigzipPath, packageResult.manifest, options);
97
103
  }
98
104
  }
99
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/vsce",
3
- "version": "2.26.1",
3
+ "version": "2.26.2-1",
4
4
  "description": "VS Code Extensions Manager",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@azure/identity": "^4.1.0",
42
+ "@vscode/vsce-sign": "^2.0.0",
42
43
  "azure-devops-node-api": "^12.5.0",
43
44
  "chalk": "^2.4.2",
44
45
  "cheerio": "^1.0.0-rc.9",