@codingame/monaco-vscode-rollup-vsix-plugin 1.85.2 → 1.85.3

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": "1.85.2",
3
+ "version": "1.85.3",
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@1.85.2",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.85.3",
22
22
  "memfs": "^4.6.0",
23
23
  "mime-types": "^2.1.35",
24
24
  "yauzl": "^2.10.0"
@@ -1,15 +1,12 @@
1
- /// <reference types="node" />
2
1
  import { FilterPattern } from '@rollup/pluginutils';
3
2
  import { Plugin } from 'rollup';
4
3
  import { IExtensionManifest } from './vscode/src/vs/platform/extensions/common/extensions.js';
5
- import { ExtensionResource } from './extension-tools.js';
6
4
 
7
5
  interface Options {
8
6
  include?: FilterPattern;
9
7
  exclude?: FilterPattern;
10
8
  transformManifest?: (manifest: IExtensionManifest) => IExtensionManifest;
11
- getAdditionalResources?: (manifest: IExtensionManifest, readFile: (path: string) => Promise<Buffer>, readDir: (path: string) => Promise<string[]>, glob: (pattern: string) => Promise<ExtensionResource[]>) => Promise<ExtensionResource[]>;
12
9
  }
13
- declare function plugin({ include, exclude, transformManifest, getAdditionalResources }?: Options): Plugin;
10
+ declare function plugin({ include, exclude, transformManifest }?: Options): Plugin;
14
11
 
15
12
  export { plugin as default };
@@ -1,14 +1,15 @@
1
- import { addExtension, createFilter } from '@rollup/pluginutils';
1
+ import { createFilter } from '@rollup/pluginutils';
2
2
  import * as yauzl from 'yauzl';
3
3
  import { createFsFromVolume, Volume } from 'memfs';
4
- import require$$0 from 'os';
5
- import * as path$a from 'path';
6
- import path__default from 'path';
7
- import require$$0$1 from 'util';
8
- import require$$0$2 from 'stream';
9
- import require$$0$4 from 'events';
10
- import require$$0$3 from 'fs';
4
+ import require$$0$1 from 'os';
5
+ import * as require$$0 from 'path';
6
+ import require$$0__default from 'path';
7
+ import require$$0$2 from 'util';
8
+ import require$$0$3 from 'stream';
9
+ import require$$0$5 from 'events';
10
+ import require$$0$4 from 'fs';
11
11
  import * as mime from 'mime-types';
12
+ import path$a from 'node:path';
12
13
 
13
14
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
14
15
 
@@ -78,8 +79,8 @@ var path$9 = {};
78
79
 
79
80
  Object.defineProperty(path$9, "__esModule", { value: true });
80
81
  path$9.convertPosixPathToPattern = path$9.convertWindowsPathToPattern = path$9.convertPathToPattern = path$9.escapePosixPath = path$9.escapeWindowsPath = path$9.escape = path$9.removeLeadingDotSegment = path$9.makeAbsolute = path$9.unixify = void 0;
81
- const os = require$$0;
82
- const path$8 = path__default;
82
+ const os = require$$0$1;
83
+ const path$8 = require$$0__default;
83
84
  const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
84
85
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
85
86
  /**
@@ -319,8 +320,8 @@ var isGlob$1 = function isGlob(str, options) {
319
320
  };
320
321
 
321
322
  var isGlob = isGlob$1;
322
- var pathPosixDirname = path__default.posix.dirname;
323
- var isWin32 = require$$0.platform() === 'win32';
323
+ var pathPosixDirname = require$$0__default.posix.dirname;
324
+ var isWin32 = require$$0$1.platform() === 'win32';
324
325
 
325
326
  var slash = '/';
326
327
  var backslash = /\\/g;
@@ -816,7 +817,7 @@ var toRegexRange_1 = toRegexRange$1;
816
817
  * Licensed under the MIT License.
817
818
  */
818
819
 
819
- const util$1 = require$$0$1;
820
+ const util$1 = require$$0$2;
820
821
  const toRegexRange = toRegexRange_1;
821
822
 
822
823
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -1781,7 +1782,7 @@ var braces_1 = braces$1;
1781
1782
 
1782
1783
  var utils$f = {};
1783
1784
 
1784
- const path$7 = path__default;
1785
+ const path$7 = require$$0__default;
1785
1786
  const WIN_SLASH = '\\\\/';
1786
1787
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1787
1788
 
@@ -1961,7 +1962,7 @@ var constants$3 = {
1961
1962
 
1962
1963
  (function (exports) {
1963
1964
 
1964
- const path = path__default;
1965
+ const path = require$$0__default;
1965
1966
  const win32 = process.platform === 'win32';
1966
1967
  const {
1967
1968
  REGEX_BACKSLASH,
@@ -3505,7 +3506,7 @@ parse$2.fastpaths = (input, options) => {
3505
3506
 
3506
3507
  var parse_1 = parse$2;
3507
3508
 
3508
- const path$6 = path__default;
3509
+ const path$6 = require$$0__default;
3509
3510
  const scan = scan_1;
3510
3511
  const parse$1 = parse_1;
3511
3512
  const utils$c = utils$f;
@@ -3848,7 +3849,7 @@ var picomatch_1 = picomatch$2;
3848
3849
 
3849
3850
  var picomatch$1 = picomatch_1;
3850
3851
 
3851
- const util = require$$0$1;
3852
+ const util = require$$0$2;
3852
3853
  const braces = braces_1;
3853
3854
  const picomatch = picomatch$1;
3854
3855
  const utils$b = utils$f;
@@ -4316,7 +4317,7 @@ var micromatch_1 = micromatch$1;
4316
4317
 
4317
4318
  Object.defineProperty(pattern$1, "__esModule", { value: true });
4318
4319
  pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
4319
- const path$5 = path__default;
4320
+ const path$5 = require$$0__default;
4320
4321
  const globParent = globParent$1;
4321
4322
  const micromatch = micromatch_1;
4322
4323
  const GLOBSTAR = '**';
@@ -4511,7 +4512,7 @@ var stream$4 = {};
4511
4512
  * Copyright (c) 2014-2020 Teambition
4512
4513
  * Licensed under the MIT license.
4513
4514
  */
4514
- const Stream = require$$0$2;
4515
+ const Stream = require$$0$3;
4515
4516
  const PassThrough = Stream.PassThrough;
4516
4517
  const slice = Array.prototype.slice;
4517
4518
 
@@ -4891,7 +4892,7 @@ var fs$5 = {};
4891
4892
  (function (exports) {
4892
4893
  Object.defineProperty(exports, "__esModule", { value: true });
4893
4894
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4894
- const fs = require$$0$3;
4895
+ const fs = require$$0$4;
4895
4896
  exports.FILE_SYSTEM_ADAPTER = {
4896
4897
  lstat: fs.lstat,
4897
4898
  stat: fs.stat,
@@ -5242,7 +5243,7 @@ var fs$1 = {};
5242
5243
  (function (exports) {
5243
5244
  Object.defineProperty(exports, "__esModule", { value: true });
5244
5245
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5245
- const fs = require$$0$3;
5246
+ const fs = require$$0$4;
5246
5247
  exports.FILE_SYSTEM_ADAPTER = {
5247
5248
  lstat: fs.lstat,
5248
5249
  stat: fs.stat,
@@ -5261,7 +5262,7 @@ var fs$1 = {};
5261
5262
  } (fs$1));
5262
5263
 
5263
5264
  Object.defineProperty(settings$2, "__esModule", { value: true });
5264
- const path$3 = path__default;
5265
+ const path$3 = require$$0__default;
5265
5266
  const fsStat$3 = out$1;
5266
5267
  const fs = fs$1;
5267
5268
  let Settings$1 = class Settings {
@@ -5682,7 +5683,7 @@ let Reader$1 = class Reader {
5682
5683
  reader$1.default = Reader$1;
5683
5684
 
5684
5685
  Object.defineProperty(async$4, "__esModule", { value: true });
5685
- const events_1 = require$$0$4;
5686
+ const events_1 = require$$0$5;
5686
5687
  const fsScandir$2 = out$2;
5687
5688
  const fastq = queueExports;
5688
5689
  const common$1 = common$3;
@@ -5811,7 +5812,7 @@ function callSuccessCallback(callback, entries) {
5811
5812
  var stream$2 = {};
5812
5813
 
5813
5814
  Object.defineProperty(stream$2, "__esModule", { value: true });
5814
- const stream_1$5 = require$$0$2;
5815
+ const stream_1$5 = require$$0$3;
5815
5816
  const async_1$3 = async$4;
5816
5817
  class StreamProvider {
5817
5818
  constructor(_root, _settings) {
@@ -5924,7 +5925,7 @@ sync$3.default = SyncProvider;
5924
5925
  var settings$1 = {};
5925
5926
 
5926
5927
  Object.defineProperty(settings$1, "__esModule", { value: true });
5927
- const path$2 = path__default;
5928
+ const path$2 = require$$0__default;
5928
5929
  const fsScandir = out$2;
5929
5930
  class Settings {
5930
5931
  constructor(_options = {}) {
@@ -5986,7 +5987,7 @@ function getSettings(settingsOrOptions = {}) {
5986
5987
  var reader = {};
5987
5988
 
5988
5989
  Object.defineProperty(reader, "__esModule", { value: true });
5989
- const path$1 = path__default;
5990
+ const path$1 = require$$0__default;
5990
5991
  const fsStat$2 = out$1;
5991
5992
  const utils$6 = utils$k;
5992
5993
  class Reader {
@@ -6021,7 +6022,7 @@ reader.default = Reader;
6021
6022
  var stream$1 = {};
6022
6023
 
6023
6024
  Object.defineProperty(stream$1, "__esModule", { value: true });
6024
- const stream_1$3 = require$$0$2;
6025
+ const stream_1$3 = require$$0$3;
6025
6026
  const fsStat$1 = out$1;
6026
6027
  const fsWalk$2 = out$3;
6027
6028
  const reader_1$2 = reader;
@@ -6374,7 +6375,7 @@ class EntryTransformer {
6374
6375
  entry.default = EntryTransformer;
6375
6376
 
6376
6377
  Object.defineProperty(provider, "__esModule", { value: true });
6377
- const path = path__default;
6378
+ const path = require$$0__default;
6378
6379
  const deep_1 = deep;
6379
6380
  const entry_1 = entry$1;
6380
6381
  const error_1 = error;
@@ -6447,7 +6448,7 @@ async$7.default = ProviderAsync;
6447
6448
  var stream = {};
6448
6449
 
6449
6450
  Object.defineProperty(stream, "__esModule", { value: true });
6450
- const stream_1$1 = require$$0$2;
6451
+ const stream_1$1 = require$$0$3;
6451
6452
  const stream_2 = stream$1;
6452
6453
  const provider_1$1 = provider;
6453
6454
  class ProviderStream extends provider_1$1.default {
@@ -6552,8 +6553,8 @@ var settings = {};
6552
6553
  (function (exports) {
6553
6554
  Object.defineProperty(exports, "__esModule", { value: true });
6554
6555
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
6555
- const fs = require$$0$3;
6556
- const os = require$$0;
6556
+ const fs = require$$0$4;
6557
+ const os = require$$0$1;
6557
6558
  /**
6558
6559
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
6559
6560
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
@@ -7591,213 +7592,26 @@ function getParseErrorMessage(errorCode) {
7591
7592
  }
7592
7593
  }
7593
7594
 
7594
- var embeddedRegexp = /^data:(.*?),(.*?)/;
7595
- var commentRegexp = /\/\*([\s\S]*?)\*\//g;
7596
- var urlsRegexp = /(?:@import\s+)?url\s*\(\s*(("(.*?)")|('(.*?)')|(.*?))\s*\)|(?:@import\s+)(("(.*?)")|('(.*?)')|(.*?))[\s;]/ig;
7597
-
7598
- function isEmbedded (src) {
7599
- return embeddedRegexp.test(src.trim());
7600
- }
7601
-
7602
- function getUrls (text) {
7603
- var urls = [];
7604
- var urlMatch, url;
7605
-
7606
- text = text.replace(commentRegexp, '');
7607
-
7608
- while ((urlMatch = urlsRegexp.exec(text))) {
7609
- // Match 3, 5, 6 group if '[@import] url(path)', match 9, 11, 12 group if '@import path'
7610
- url = urlMatch[3] || urlMatch[5] || urlMatch[6] || urlMatch[9] || urlMatch[11] || urlMatch[12];
7611
-
7612
- if (url && !isEmbedded(url) && urls.indexOf(url) === -1) {
7613
- urls.push(url);
7614
- }
7615
- }
7616
-
7617
- return urls;
7618
- }
7619
-
7620
- var cssParser = getUrls;
7621
-
7622
- var parseCssUrls = cssParser;
7623
- var cssUrlParser = parseCssUrls;
7624
-
7625
- var parseCssUrl = /*@__PURE__*/getDefaultExportFromCjs(cssUrlParser);
7626
-
7627
- function extractCommandResources(command) {
7628
- if (Array.isArray(command)) {
7629
- return command.flatMap(extractCommandResources);
7595
+ function lookupMime(path) {
7596
+ const mimeType = mime.lookup(path);
7597
+ if (mimeType === false) {
7598
+ return undefined;
7630
7599
  }
7631
- if (command.icon != null) {
7632
- if (typeof command.icon === 'object') {
7633
- return [{ path: command.icon.light }, { path: command.icon.dark }];
7634
- }
7635
- else {
7636
- return [{ path: command.icon }];
7637
- }
7638
- }
7639
- return [];
7600
+ return mimeType;
7640
7601
  }
7641
- function extractGrammarResources(grammar) {
7642
- return [{ path: grammar.path }];
7643
- }
7644
- function extractLanguageResources(language) {
7645
- const resources = [];
7646
- if (language.icon != null) {
7647
- resources.push({ path: language.icon.dark }, { path: language.icon.light });
7648
- }
7649
- if (language.configuration != null) {
7650
- resources.push({ path: language.configuration, mimeType: 'application/json' });
7651
- }
7652
- return resources;
7653
- }
7654
- function extractSnippetsResources(snippet) {
7655
- return [{ path: snippet.path, mimeType: 'application/json' }];
7656
- }
7657
- async function extractThemeResources(theme, getFileContent) {
7658
- const themeContent = await getFileContent(theme.path);
7659
- const themeDocument = parseJson(theme.path, themeContent.toString('utf8'));
7660
- const paths = [{ path: theme.path, mimeType: 'application/json' }];
7661
- if (themeDocument.fonts != null) {
7662
- for (const font of themeDocument.fonts) {
7663
- for (const src of font.src) {
7664
- paths.push({ path: path$a.join(path$a.dirname(theme.path), src.path) });
7665
- }
7666
- }
7667
- }
7668
- if (themeDocument.iconDefinitions != null) {
7669
- for (const iconDefinition of Object.values(themeDocument.iconDefinitions)) {
7670
- if (iconDefinition.iconPath != null) {
7671
- paths.push({ path: path$a.join(path$a.dirname(theme.path), iconDefinition.iconPath) });
7672
- }
7673
- }
7602
+ function getPaths(filePath) {
7603
+ const paths = [filePath];
7604
+ if (path$a.extname(filePath) === '.js') {
7605
+ paths.push(filePath.substring(0, filePath.lastIndexOf('.')));
7674
7606
  }
7675
7607
  return paths;
7676
7608
  }
7677
- function extractJsonValidationResources(jsonValidation) {
7678
- if (jsonValidation.url.startsWith('./')) {
7679
- return [{ path: jsonValidation.url }];
7680
- }
7681
- return [];
7682
- }
7683
- function extractViewsContainerResources(viewContainers) {
7684
- return Object.values(viewContainers).flatMap(containers => containers.map(container => ({ path: container.icon })));
7685
- }
7686
- async function extractResourcesFromExtensionManifestContribute(contribute, getFileContent) {
7687
- const resources = [];
7688
- if (contribute.commands != null)
7689
- resources.push(...extractCommandResources(contribute.commands));
7690
- if (contribute.grammars != null)
7691
- resources.push(...contribute.grammars.flatMap(extractGrammarResources));
7692
- if (contribute.languages != null)
7693
- resources.push(...contribute.languages.flatMap(extractLanguageResources));
7694
- if (contribute.snippets != null)
7695
- resources.push(...contribute.snippets.flatMap(extractSnippetsResources));
7696
- if (contribute.themes != null)
7697
- resources.push(...((await Promise.all(contribute.themes.map(theme => extractThemeResources(theme, getFileContent), getFileContent))).flat()));
7698
- if (contribute.iconThemes != null)
7699
- resources.push(...((await Promise.all(contribute.iconThemes.map(theme => extractThemeResources(theme, getFileContent), getFileContent))).flat()));
7700
- if (contribute.productIconThemes != null)
7701
- resources.push(...((await Promise.all(contribute.productIconThemes.map(theme => extractThemeResources(theme, getFileContent), getFileContent))).flat()));
7702
- if (contribute.jsonValidation != null)
7703
- resources.push(...contribute.jsonValidation.flatMap(extractJsonValidationResources));
7704
- if (contribute.viewsContainers != null)
7705
- resources.push(...extractViewsContainerResources(contribute.viewsContainers));
7706
- if (contribute['markdown.previewStyles'] != null) {
7707
- resources.push(...(await Promise.all(contribute['markdown.previewStyles'].map(async (path) => [
7708
- { path, mimeType: 'text/css' },
7709
- ...(await extractResources(path, getFileContent))
7710
- ]))).flat());
7711
- }
7712
- if (contribute['markdown.previewScripts'] != null) {
7713
- resources.push(...(await Promise.all(contribute['markdown.previewScripts'].map(async (path) => [
7714
- { path, mimeType: 'text/javascript' },
7715
- ...(await extractResources(path, getFileContent))
7716
- ]))).flat());
7717
- }
7718
- return resources.filter((resource, index, list) => !resource.path.startsWith('$(') && !list.slice(0, index).some(o => o === resource));
7719
- }
7720
- async function extractResourcesFromExtensionManifest(manifest, getFileContent, listFiles) {
7721
- let resources = [];
7722
- if (manifest.contributes != null) {
7723
- resources.push(...await extractResourcesFromExtensionManifestContribute(manifest.contributes, getFileContent));
7724
- }
7725
- if (manifest.browser != null) {
7726
- const jsPath = addExtension(manifest.browser, '.js');
7727
- resources.push({ path: manifest.browser, mimeType: 'text/javascript', realPath: jsPath });
7728
- resources.push(...(await extractResources(jsPath, getFileContent)));
7729
- }
7730
- if (manifest.main != null) {
7731
- const jsPath = addExtension(manifest.main, '.js');
7732
- resources.push({ path: manifest.main, mimeType: 'text/javascript', realPath: jsPath });
7733
- resources.push(...(await extractResources(jsPath, getFileContent)));
7734
- }
7735
- const nlsFiles = (await listFiles('/')).filter(file => /^package\.nls(?:\..*)?\.json$/.exec(file) != null);
7736
- resources.push(...nlsFiles.map(path => ({
7609
+ function toResource(path) {
7610
+ return {
7737
7611
  path,
7738
- mimeType: 'application/json'
7739
- })));
7740
- if (manifest.l10n != null) {
7741
- const bundleFiles = (await listFiles(manifest.l10n)).filter(file => /^bundle\.l10n(?:\..*)?\.json$/.exec(file) != null);
7742
- resources.push(...bundleFiles.map(path => ({
7743
- path,
7744
- mimeType: 'application/json'
7745
- })));
7746
- }
7747
- resources = resources.map(r => {
7748
- if (r.mimeType == null) {
7749
- const detectedType = mime.lookup(r.path);
7750
- if (detectedType !== false) {
7751
- return {
7752
- ...r,
7753
- mimeType: detectedType
7754
- };
7755
- }
7756
- }
7757
- return r;
7758
- });
7759
- // remove duplicates
7760
- return Object.values(Object.fromEntries(resources.map(r => [r.path, r])));
7761
- }
7762
- async function extractResources(resourcePath, getFileContent) {
7763
- const resources = [];
7764
- const content = (await getFileContent(resourcePath)).toString('utf-8');
7765
- if (resourcePath.endsWith('.js')) {
7766
- for (const match of content.matchAll(/\/\/# sourceMappingURL=(.*)$/g)) {
7767
- resources.push({ path: path$a.join(path$a.dirname(resourcePath), match[1]) });
7768
- }
7769
- for (const match of content.matchAll(/Uri\.joinPath\(context\.extensionUri, '([^']+)'\)/g)) {
7770
- resources.push({ path: match[1] });
7771
- resources.push(...(await extractResources(match[1], getFileContent)));
7772
- }
7773
- for (const match of content.matchAll(/this.extensionResource\('media', '(.*)'\)/g)) {
7774
- resources.push({ path: `./media/${match[1]}` });
7775
- resources.push(...(await extractResources(`./media/${match[1]}`, getFileContent)));
7776
- }
7777
- for (const match of content.matchAll(/this\._extensionResourcePath\(resourceProvider, '(.*)'\)/g)) {
7778
- resources.push({ path: `./media/${match[1]}` });
7779
- resources.push(...(await extractResources(`./media/${match[1]}`, getFileContent)));
7780
- }
7781
- for (const match of content.matchAll(/this\.extensionResourceUrl\('media', '(.*)'\)/g)) {
7782
- resources.push({ path: `./media/${match[1]}` });
7783
- resources.push(...(await extractResources(`./media/${match[1]}`, getFileContent)));
7784
- }
7785
- }
7786
- if (resourcePath.endsWith('.css')) {
7787
- const urls = parseCssUrl(content);
7788
- for (const url of urls) {
7789
- const assetPath = './' + path$a.join(path$a.dirname(resourcePath), url);
7790
- try {
7791
- await getFileContent(assetPath);
7792
- resources.push({ path: assetPath });
7793
- }
7794
- catch (err) {
7795
- // ignore, the file doesn't exist
7796
- // It happens for the markdown-math extension without consequences
7797
- }
7798
- }
7799
- }
7800
- return resources;
7612
+ extensionPaths: getPaths(path),
7613
+ mimeType: lookupMime(path)
7614
+ };
7801
7615
  }
7802
7616
  function parseJson(path, text) {
7803
7617
  const errors = [];
@@ -7848,9 +7662,9 @@ async function readVsix(file) {
7848
7662
  });
7849
7663
  }
7850
7664
  function getVsixPath(file) {
7851
- return path$a.relative('/', path$a.resolve('/', file));
7665
+ return require$$0.relative('/', require$$0.resolve('/', file));
7852
7666
  }
7853
- function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest => manifest, getAdditionalResources = () => Promise.resolve([]) } = {}) {
7667
+ function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest => manifest } = {}) {
7854
7668
  const filter = createFilter(include, exclude);
7855
7669
  return {
7856
7670
  name: 'vsix-loader',
@@ -7867,29 +7681,15 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest =
7867
7681
  if (!filter(id))
7868
7682
  return null;
7869
7683
  const vsixFS = await readVsix(id);
7870
- const readFileSync = (filePath) => vsixFS.readFileSync(path$a.join('/', filePath));
7684
+ const readFileSync = (filePath) => vsixFS.readFileSync(require$$0.join('/', filePath));
7871
7685
  const manifest = transformManifest(parseJson(id, readFileSync('package.json').toString('utf8')));
7872
- const getFileContent = async (filePath) => {
7873
- return readFileSync(filePath);
7874
- };
7875
- const listFiles = async (filePath) => {
7876
- return vsixFS.readdirSync(path$a.join('/', filePath));
7877
- };
7878
- const extensionResources = (await extractResourcesFromExtensionManifest(manifest, getFileContent, listFiles))
7879
- .filter(resource => vsixFS.existsSync(path$a.join('/', resource.realPath ?? resource.path)));
7880
- async function _glob(pattern) {
7881
- return (await glob(pattern, {
7882
- fs: vsixFS,
7883
- cwd: '/',
7884
- onlyFiles: true
7885
- })).map(path => ({ path }));
7886
- }
7887
- const resources = [
7888
- ...extensionResources,
7889
- ...await getAdditionalResources(manifest, getFileContent, listFiles, _glob)
7890
- ];
7686
+ const resources = (await glob('**/*', {
7687
+ fs: vsixFS,
7688
+ cwd: id,
7689
+ onlyFiles: true
7690
+ })).map(toResource);
7891
7691
  const pathMapping = (await Promise.all(resources.map(async (resource) => {
7892
- const assetPath = getVsixPath(resource.realPath ?? resource.path);
7692
+ const assetPath = getVsixPath(resource.path);
7893
7693
  let url;
7894
7694
  if (process.env.NODE_ENV === 'development') {
7895
7695
  const fileType = resource.mimeType ?? 'text/javascript';
@@ -7898,21 +7698,15 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = manifest =
7898
7698
  else {
7899
7699
  url = 'import.meta.ROLLUP_FILE_URL_' + this.emitFile({
7900
7700
  type: 'asset',
7901
- name: `${path$a.basename(id)}/${path$a.basename(assetPath)}`,
7701
+ name: `${require$$0.basename(id)}/${require$$0.basename(assetPath)}`,
7902
7702
  source: readFileSync(assetPath)
7903
7703
  });
7904
7704
  }
7905
- return [{
7906
- pathInExtension: getVsixPath(resource.path),
7907
- url,
7908
- mimeType: resource.mimeType
7909
- }, ...(resource.realPath != null
7910
- ? [{
7911
- pathInExtension: getVsixPath(resource.realPath),
7912
- url,
7913
- mimeType: resource.mimeType
7914
- }]
7915
- : [])];
7705
+ return resource.extensionPaths.map(extensionPath => ({
7706
+ pathInExtension: getVsixPath(extensionPath),
7707
+ url,
7708
+ mimeType: resource.mimeType
7709
+ }));
7916
7710
  }))).flat();
7917
7711
  return `
7918
7712
  import { registerExtension } from 'vscode/extensions'
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- interface ExtensionResource {
3
- path: string;
4
- realPath?: string;
5
- mimeType?: string;
6
- }
7
-
8
- export type { ExtensionResource };