@vscode/vsce 2.16.0 → 2.18.0

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 CHANGED
@@ -95,6 +95,13 @@ Once the watcher is up and running, you can run out of sources with:
95
95
  node vsce
96
96
  ```
97
97
 
98
+ Tests can be executed with:
99
+
100
+ ```npm
101
+ $ npm test
102
+ ```
103
+
104
+ > **Note:** [Yarn](https://www.npmjs.com/package/yarn) is required to run the tests.
98
105
  ## About
99
106
 
100
107
  This tool assists in packaging and publishing Visual Studio Code extensions.
package/out/api.js CHANGED
@@ -34,7 +34,11 @@ exports.publish = publish;
34
34
  * @public
35
35
  */
36
36
  function listFiles(options = {}) {
37
- return (0, package_1.listFiles)(options);
37
+ return (0, package_1.listFiles)({
38
+ ...options,
39
+ useYarn: options.packageManager === PackageManager.Yarn,
40
+ dependencies: options.packageManager !== PackageManager.None,
41
+ });
38
42
  }
39
43
  exports.listFiles = listFiles;
40
44
  /**
package/out/package.js CHANGED
@@ -46,6 +46,7 @@ const validation_1 = require("./validation");
46
46
  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
+ const jsonc = __importStar(require("jsonc-parser"));
49
50
  const MinimatchOptions = { dot: true };
50
51
  function isInMemoryFile(file) {
51
52
  return !!file.contents;
@@ -693,7 +694,7 @@ class LaunchEntryPointProcessor extends BaseProcessor {
693
694
  }
694
695
  }
695
696
  appendJSExt(filePath) {
696
- if (filePath.endsWith('.js')) {
697
+ if (filePath.endsWith('.js') || filePath.endsWith('.cjs')) {
697
698
  return filePath;
698
699
  }
699
700
  return filePath + '.js';
@@ -713,7 +714,7 @@ class IconProcessor extends BaseProcessor {
713
714
  constructor(manifest) {
714
715
  super(manifest);
715
716
  this.didFindIcon = false;
716
- this.icon = manifest.icon && `extension/${manifest.icon}`;
717
+ this.icon = manifest.icon && path.posix.normalize(`extension/${manifest.icon}`);
717
718
  delete this.vsix.icon;
718
719
  }
719
720
  onFile(file) {
@@ -876,12 +877,29 @@ function validateManifest(manifest) {
876
877
  if (!manifest.engines['vscode']) {
877
878
  throw new Error('Manifest missing field: engines.vscode');
878
879
  }
879
- (0, validation_1.validateEngineCompatibility)(manifest.engines['vscode']);
880
+ const engineVersion = manifest.engines['vscode'];
881
+ (0, validation_1.validateEngineCompatibility)(engineVersion);
880
882
  const hasActivationEvents = !!manifest.activationEvents;
883
+ const hasImplicitLanguageActivationEvents = manifest.contributes?.languages;
884
+ const hasOtherImplicitActivationEvents = manifest.contributes?.commands ||
885
+ manifest.contributes?.authentication ||
886
+ manifest.contributes?.customEditors ||
887
+ manifest.contributes?.views;
888
+ const hasImplicitActivationEvents = hasImplicitLanguageActivationEvents || hasOtherImplicitActivationEvents;
881
889
  const hasMain = !!manifest.main;
882
890
  const hasBrowser = !!manifest.browser;
883
- if (hasActivationEvents) {
884
- if (!hasMain && !hasBrowser) {
891
+ let parsedEngineVersion;
892
+ try {
893
+ const engineSemver = (0, parse_semver_1.default)(`vscode@${engineVersion}`);
894
+ parsedEngineVersion = engineSemver.version;
895
+ }
896
+ catch (err) {
897
+ throw new Error('Failed to parse semver of engines.vscode');
898
+ }
899
+ if (hasActivationEvents ||
900
+ ((engineVersion === '*' || semver.satisfies(parsedEngineVersion, '>=1.74', { includePrerelease: true })) &&
901
+ hasImplicitActivationEvents)) {
902
+ if (!hasMain && !hasBrowser && (hasActivationEvents || !hasImplicitLanguageActivationEvents)) {
885
903
  throw new Error("Manifest needs either a 'main' or 'browser' property, given it has a 'activationEvents' property.");
886
904
  }
887
905
  }
@@ -951,7 +969,8 @@ function readManifest(cwd = process.cwd(), nls = true) {
951
969
  return Promise.resolve(JSON.parse(manifestStr));
952
970
  }
953
971
  catch (e) {
954
- return Promise.reject(`Error parsing 'package.json' manifest file: not a valid JSON file.`);
972
+ console.error(`Error parsing 'package.json' manifest file: not a valid JSON file.`);
973
+ throw e;
955
974
  }
956
975
  })
957
976
  .then(validateManifest);
@@ -963,10 +982,11 @@ function readManifest(cwd = process.cwd(), nls = true) {
963
982
  .catch(err => (err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('{}')))
964
983
  .then(raw => {
965
984
  try {
966
- return Promise.resolve(JSON.parse(raw));
985
+ return Promise.resolve(jsonc.parse(raw));
967
986
  }
968
987
  catch (e) {
969
- return Promise.reject(`Error parsing JSON manifest translations file: ${manifestNLSPath}`);
988
+ console.error(`Error parsing JSON manifest translations file: ${manifestNLSPath}`);
989
+ throw e;
970
990
  }
971
991
  });
972
992
  return Promise.all([manifest, manifestNLS]).then(([manifest, translations]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/vsce",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "VSCode Extension Manager",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,8 +32,7 @@
32
32
  "build": "npm run compile && npm run api",
33
33
  "watch:build": "npm run compile -- --watch",
34
34
  "test": "mocha",
35
- "watch:test": "npm run test -- --watch",
36
- "prepare": "husky install"
35
+ "watch:test": "npm run test -- --watch"
37
36
  },
38
37
  "engines": {
39
38
  "node": ">= 14"
@@ -45,6 +44,7 @@
45
44
  "commander": "^6.1.0",
46
45
  "glob": "^7.0.6",
47
46
  "hosted-git-info": "^4.0.2",
47
+ "jsonc-parser": "^3.2.0",
48
48
  "leven": "^3.1.0",
49
49
  "markdown-it": "^12.3.2",
50
50
  "mime": "^1.3.4",
@@ -76,10 +76,7 @@
76
76
  "@types/xml2js": "^0.4.4",
77
77
  "@types/yauzl": "^2.9.2",
78
78
  "@types/yazl": "^2.4.2",
79
- "husky": "^7.0.4",
80
79
  "mocha": "^9.2.0",
81
- "prettier": "2.1.2",
82
- "pretty-quick": "^3.0.2",
83
80
  "source-map-support": "^0.4.2",
84
81
  "ts-node": "^10.9.1",
85
82
  "typescript": "^4.3.2"
@@ -93,11 +90,5 @@
93
90
  ],
94
91
  "watch-files": "src/**",
95
92
  "spec": "src/test/**/*.ts"
96
- },
97
- "prettier": {
98
- "useTabs": true,
99
- "printWidth": 120,
100
- "singleQuote": true,
101
- "arrowParens": "avoid"
102
93
  }
103
94
  }