@codingame/monaco-vscode-rollup-vsix-plugin 2.1.3 → 2.2.0-next.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-rollup-vsix-plugin",
3
- "version": "2.1.3",
3
+ "version": "2.2.0-next.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "rollup-vsix-plugin.js",
19
19
  "types": "rollup-vsix-plugin.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@2.1.3",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@2.2.0-next.1",
22
22
  "css-url-parser": "^1.1.3",
23
23
  "memfs": "^4.6.0",
24
24
  "mime-types": "^2.1.35",
@@ -6224,15 +6224,15 @@ var reusify_1 = reusify$1;
6224
6224
 
6225
6225
  var reusify = reusify_1;
6226
6226
 
6227
- function fastqueue (context, worker, concurrency) {
6227
+ function fastqueue (context, worker, _concurrency) {
6228
6228
  if (typeof context === 'function') {
6229
- concurrency = worker;
6229
+ _concurrency = worker;
6230
6230
  worker = context;
6231
6231
  context = null;
6232
6232
  }
6233
6233
 
6234
- if (concurrency < 1) {
6235
- throw new Error('fastqueue concurrency must be greater than 1')
6234
+ if (!(_concurrency >= 1)) {
6235
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
6236
6236
  }
6237
6237
 
6238
6238
  var cache = reusify(Task);
@@ -6247,7 +6247,23 @@ function fastqueue (context, worker, concurrency) {
6247
6247
  saturated: noop,
6248
6248
  pause: pause,
6249
6249
  paused: false,
6250
- concurrency: concurrency,
6250
+
6251
+ get concurrency () {
6252
+ return _concurrency
6253
+ },
6254
+ set concurrency (value) {
6255
+ if (!(value >= 1)) {
6256
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
6257
+ }
6258
+ _concurrency = value;
6259
+
6260
+ if (self.paused) return
6261
+ for (; queueHead && _running < _concurrency;) {
6262
+ _running++;
6263
+ release();
6264
+ }
6265
+ },
6266
+
6251
6267
  running: running,
6252
6268
  resume: resume,
6253
6269
  idle: idle,
@@ -6297,7 +6313,12 @@ function fastqueue (context, worker, concurrency) {
6297
6313
  function resume () {
6298
6314
  if (!self.paused) return
6299
6315
  self.paused = false;
6300
- for (var i = 0; i < self.concurrency; i++) {
6316
+ if (queueHead === null) {
6317
+ _running++;
6318
+ release();
6319
+ return
6320
+ }
6321
+ for (; queueHead && _running < _concurrency;) {
6301
6322
  _running++;
6302
6323
  release();
6303
6324
  }
@@ -6316,7 +6337,7 @@ function fastqueue (context, worker, concurrency) {
6316
6337
  current.callback = done || noop;
6317
6338
  current.errorHandler = errorHandler;
6318
6339
 
6319
- if (_running === self.concurrency || self.paused) {
6340
+ if (_running >= _concurrency || self.paused) {
6320
6341
  if (queueTail) {
6321
6342
  queueTail.next = current;
6322
6343
  queueTail = current;
@@ -6340,7 +6361,7 @@ function fastqueue (context, worker, concurrency) {
6340
6361
  current.callback = done || noop;
6341
6362
  current.errorHandler = errorHandler;
6342
6363
 
6343
- if (_running === self.concurrency || self.paused) {
6364
+ if (_running >= _concurrency || self.paused) {
6344
6365
  if (queueHead) {
6345
6366
  current.next = queueHead;
6346
6367
  queueHead = current;
@@ -6360,7 +6381,7 @@ function fastqueue (context, worker, concurrency) {
6360
6381
  cache.release(holder);
6361
6382
  }
6362
6383
  var next = queueHead;
6363
- if (next) {
6384
+ if (next && _running <= _concurrency) {
6364
6385
  if (!self.paused) {
6365
6386
  if (queueTail === queueHead) {
6366
6387
  queueTail = null;
@@ -6423,9 +6444,9 @@ function Task () {
6423
6444
  };
6424
6445
  }
6425
6446
 
6426
- function queueAsPromised (context, worker, concurrency) {
6447
+ function queueAsPromised (context, worker, _concurrency) {
6427
6448
  if (typeof context === 'function') {
6428
- concurrency = worker;
6449
+ _concurrency = worker;
6429
6450
  worker = context;
6430
6451
  context = null;
6431
6452
  }
@@ -6437,7 +6458,7 @@ function queueAsPromised (context, worker, concurrency) {
6437
6458
  }, cb);
6438
6459
  }
6439
6460
 
6440
- var queue = fastqueue(context, asyncWrapper, concurrency);
6461
+ var queue = fastqueue(context, asyncWrapper, _concurrency);
6441
6462
 
6442
6463
  var pushCb = queue.push;
6443
6464
  var unshiftCb = queue.unshift;
@@ -7715,6 +7736,13 @@ async function getExtensionResources(manifest, fs, cwd) {
7715
7736
  }
7716
7737
  async function extractResourcesFromExtensionManifest(manifest, fs, cwd) {
7717
7738
  const resources = [];
7739
+ const children = await fs.promises.readdir('/');
7740
+ const readme = children.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
7741
+ if (readme != null)
7742
+ resources.push(readme);
7743
+ const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
7744
+ if (changelog != null)
7745
+ resources.push(changelog);
7718
7746
  if (manifest.contributes != null) {
7719
7747
  resources.push(...await extractResourcesFromExtensionManifestContribute(manifest.contributes, fs, cwd));
7720
7748
  }
@@ -7732,6 +7760,9 @@ async function extractResourcesFromExtensionManifest(manifest, fs, cwd) {
7732
7760
  }));
7733
7761
  resources.push(...bundleFiles);
7734
7762
  }
7763
+ if (manifest.icon != null) {
7764
+ resources.push(manifest.icon);
7765
+ }
7735
7766
  // remove duplicates
7736
7767
  return Array.from(new Set(resources));
7737
7768
  }
@@ -7825,6 +7856,9 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest =
7825
7856
  const readFileSync = (filePath) => vsixFS.readFileSync(path$a.join('/', filePath));
7826
7857
  const manifest = transformManifest(parseJson(id, readFileSync('package.json').toString('utf8')));
7827
7858
  const resources = await getExtensionResources(manifest, vsixFS, '/');
7859
+ const resourcePaths = resources.map(r => r.path);
7860
+ const readmePath = resourcePaths.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
7861
+ const changelogPath = resourcePaths.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
7828
7862
  const pathMapping = (await Promise.all(resources.map(async (resource) => {
7829
7863
  const assetPath = getVsixPath(resource.path);
7830
7864
  let url;
@@ -7850,7 +7884,7 @@ import { registerExtension } from 'vscode/extensions'
7850
7884
 
7851
7885
  const manifest = ${JSON.stringify(manifest)}
7852
7886
 
7853
- const { registerFileUrl, whenReady } = registerExtension(manifest)
7887
+ const { registerFileUrl, whenReady } = registerExtension(manifest, undefined, ${JSON.stringify({ system: true, readmePath, changelogPath })})
7854
7888
 
7855
7889
  ${pathMapping.map(({ pathInExtension, url, mimeType }) => (`
7856
7890
  registerFileUrl('${pathInExtension}', ${url}${mimeType != null ? `, '${mimeType}'` : ''})`)).join('\n')}