@codingame/monaco-vscode-rollup-vsix-plugin 5.1.2 → 5.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-rollup-vsix-plugin",
3
- "version": "5.1.2",
3
+ "version": "5.2.0",
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@5.1.2",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@5.2.0",
22
22
  "css-url-parser": "^1.1.3",
23
23
  "memfs": "^4.9.2",
24
24
  "mime-types": "^2.1.35",
@@ -7602,7 +7602,13 @@ function assertPatternsInput(input) {
7602
7602
  }
7603
7603
  var out = FastGlob;
7604
7604
 
7605
+ const plainTextExtensions = [
7606
+ '.d.ts'
7607
+ ];
7605
7608
  function lookupMime(path) {
7609
+ if (plainTextExtensions.some(e => path.endsWith(e))) {
7610
+ return 'text/plain';
7611
+ }
7606
7612
  const mimeType = mime.lookup(path);
7607
7613
  if (mimeType === false) {
7608
7614
  return undefined;
@@ -7616,11 +7622,12 @@ function getPaths(filePath) {
7616
7622
  }
7617
7623
  return paths;
7618
7624
  }
7619
- function toResource(path) {
7625
+ function toResource(resourcePath, fs, cwd) {
7620
7626
  return {
7621
- path,
7622
- extensionPaths: getPaths(path),
7623
- mimeType: lookupMime(path)
7627
+ path: resourcePath,
7628
+ extensionPaths: getPaths(resourcePath),
7629
+ mimeType: lookupMime(resourcePath),
7630
+ size: fs.statSync(path$a.resolve(cwd, resourcePath)).size
7624
7631
  };
7625
7632
  }
7626
7633
  function extractCommandResources(command) {
@@ -7723,10 +7730,10 @@ async function getExtensionResources(manifest, fs, cwd) {
7723
7730
  fs: fs,
7724
7731
  cwd,
7725
7732
  onlyFiles: true
7726
- })).map(toResource);
7733
+ })).map(p => toResource(p, fs, cwd));
7727
7734
  }
7728
7735
  else {
7729
- return (await extractResourcesFromExtensionManifest(manifest, fs, cwd)).map(toResource);
7736
+ return (await extractResourcesFromExtensionManifest(manifest, fs, cwd)).map(p => toResource(p, fs, cwd));
7730
7737
  }
7731
7738
  }
7732
7739
  async function extractResourcesFromExtensionManifest(manifest, fs, cwd) {
@@ -7871,7 +7878,8 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest =
7871
7878
  return resource.extensionPaths.map(extensionPath => ({
7872
7879
  pathInExtension: getVsixPath(extensionPath),
7873
7880
  url,
7874
- mimeType: resource.mimeType
7881
+ mimeType: resource.mimeType,
7882
+ size: resource.size
7875
7883
  }));
7876
7884
  }))).flat();
7877
7885
  return `
@@ -7881,8 +7889,11 @@ const manifest = ${JSON.stringify(manifest)}
7881
7889
 
7882
7890
  const { registerFileUrl, whenReady } = registerExtension(manifest, undefined, ${JSON.stringify({ system: true, readmePath, changelogPath })})
7883
7891
 
7884
- ${pathMapping.map(({ pathInExtension, url, mimeType }) => (`
7885
- registerFileUrl('${pathInExtension}', ${url}${mimeType != null ? `, '${mimeType}'` : ''})`)).join('\n')}
7892
+ ${pathMapping.map(({ pathInExtension, url, mimeType, size }) => (`
7893
+ registerFileUrl('${pathInExtension}', ${url}, ${JSON.stringify({
7894
+ mimeType,
7895
+ size
7896
+ })})`)).join('\n')}
7886
7897
 
7887
7898
  export { whenReady }
7888
7899
  `;