@vscode/vsce 2.17.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/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) {
@@ -879,11 +880,12 @@ function validateManifest(manifest) {
879
880
  const engineVersion = manifest.engines['vscode'];
880
881
  (0, validation_1.validateEngineCompatibility)(engineVersion);
881
882
  const hasActivationEvents = !!manifest.activationEvents;
882
- const hasImplicitActivationEvents = manifest.contributes?.commands ||
883
+ const hasImplicitLanguageActivationEvents = manifest.contributes?.languages;
884
+ const hasOtherImplicitActivationEvents = manifest.contributes?.commands ||
883
885
  manifest.contributes?.authentication ||
884
- manifest.contributes?.languages ||
885
886
  manifest.contributes?.customEditors ||
886
887
  manifest.contributes?.views;
888
+ const hasImplicitActivationEvents = hasImplicitLanguageActivationEvents || hasOtherImplicitActivationEvents;
887
889
  const hasMain = !!manifest.main;
888
890
  const hasBrowser = !!manifest.browser;
889
891
  let parsedEngineVersion;
@@ -897,7 +899,7 @@ function validateManifest(manifest) {
897
899
  if (hasActivationEvents ||
898
900
  ((engineVersion === '*' || semver.satisfies(parsedEngineVersion, '>=1.74', { includePrerelease: true })) &&
899
901
  hasImplicitActivationEvents)) {
900
- if (!hasMain && !hasBrowser) {
902
+ if (!hasMain && !hasBrowser && (hasActivationEvents || !hasImplicitLanguageActivationEvents)) {
901
903
  throw new Error("Manifest needs either a 'main' or 'browser' property, given it has a 'activationEvents' property.");
902
904
  }
903
905
  }
@@ -967,7 +969,8 @@ function readManifest(cwd = process.cwd(), nls = true) {
967
969
  return Promise.resolve(JSON.parse(manifestStr));
968
970
  }
969
971
  catch (e) {
970
- 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;
971
974
  }
972
975
  })
973
976
  .then(validateManifest);
@@ -979,10 +982,11 @@ function readManifest(cwd = process.cwd(), nls = true) {
979
982
  .catch(err => (err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('{}')))
980
983
  .then(raw => {
981
984
  try {
982
- return Promise.resolve(JSON.parse(raw));
985
+ return Promise.resolve(jsonc.parse(raw));
983
986
  }
984
987
  catch (e) {
985
- return Promise.reject(`Error parsing JSON manifest translations file: ${manifestNLSPath}`);
988
+ console.error(`Error parsing JSON manifest translations file: ${manifestNLSPath}`);
989
+ throw e;
986
990
  }
987
991
  });
988
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.17.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
  }