@codingame/monaco-vscode-rollup-vsix-plugin 29.0.0 → 29.1.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 +1 -1
- package/rollup-vsix-plugin.js +17 -14
package/package.json
CHANGED
package/rollup-vsix-plugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createFilter } from '@rollup/pluginutils';
|
|
|
2
2
|
import * as yauzl from 'yauzl';
|
|
3
3
|
import { createFsFromVolume, Volume } from 'memfs';
|
|
4
4
|
import thenby from 'thenby';
|
|
5
|
-
import * as
|
|
5
|
+
import * as nodePath from 'node:path';
|
|
6
6
|
import parseCssUrl from 'css-url-parser';
|
|
7
7
|
import * as mime from 'mime-types';
|
|
8
8
|
import require$$0 from 'os';
|
|
@@ -8291,7 +8291,7 @@ function lookupMime(path) {
|
|
|
8291
8291
|
}
|
|
8292
8292
|
function getPaths(filePath) {
|
|
8293
8293
|
const paths = [filePath];
|
|
8294
|
-
if (
|
|
8294
|
+
if (nodePath.extname(filePath) === '.js') {
|
|
8295
8295
|
paths.push(filePath.substring(0, filePath.lastIndexOf('.')));
|
|
8296
8296
|
}
|
|
8297
8297
|
return paths;
|
|
@@ -8301,7 +8301,7 @@ function toResource(resourcePath, fs, cwd) {
|
|
|
8301
8301
|
path: resourcePath,
|
|
8302
8302
|
extensionPaths: getPaths(resourcePath),
|
|
8303
8303
|
mimeType: lookupMime(resourcePath),
|
|
8304
|
-
size: fs.statSync(
|
|
8304
|
+
size: fs.statSync(nodePath.resolve(cwd, resourcePath)).size
|
|
8305
8305
|
};
|
|
8306
8306
|
}
|
|
8307
8307
|
function extractCommandResources(command) {
|
|
@@ -8335,23 +8335,26 @@ function extractSnippetsResources(snippet) {
|
|
|
8335
8335
|
return [snippet.path];
|
|
8336
8336
|
}
|
|
8337
8337
|
async function extractThemeResources(theme, fs, cwd) {
|
|
8338
|
-
const themeContent = await fs.promises.readFile(
|
|
8338
|
+
const themeContent = await fs.promises.readFile(nodePath.join(cwd, theme.path));
|
|
8339
8339
|
const themeDocument = parseJson(theme.path, themeContent.toString('utf8'));
|
|
8340
8340
|
const paths = [theme.path];
|
|
8341
8341
|
if (themeDocument.fonts != null) {
|
|
8342
8342
|
for (const font of themeDocument.fonts) {
|
|
8343
8343
|
for (const src of font.src) {
|
|
8344
|
-
paths.push(
|
|
8344
|
+
paths.push(nodePath.join(nodePath.dirname(theme.path), src.path));
|
|
8345
8345
|
}
|
|
8346
8346
|
}
|
|
8347
8347
|
}
|
|
8348
8348
|
if (themeDocument.iconDefinitions != null) {
|
|
8349
8349
|
for (const iconDefinition of Object.values(themeDocument.iconDefinitions)) {
|
|
8350
8350
|
if (iconDefinition.iconPath != null) {
|
|
8351
|
-
paths.push(
|
|
8351
|
+
paths.push(nodePath.join(nodePath.dirname(theme.path), iconDefinition.iconPath));
|
|
8352
8352
|
}
|
|
8353
8353
|
}
|
|
8354
8354
|
}
|
|
8355
|
+
if (themeDocument.include != null) {
|
|
8356
|
+
paths.push(nodePath.join(nodePath.dirname(theme.path), themeDocument.include));
|
|
8357
|
+
}
|
|
8355
8358
|
return paths;
|
|
8356
8359
|
}
|
|
8357
8360
|
function extractJsonValidationResources(jsonValidation) {
|
|
@@ -8443,11 +8446,11 @@ async function extractResourcesFromExtensionManifest(manifest, fs, cwd) {
|
|
|
8443
8446
|
cwd,
|
|
8444
8447
|
onlyFiles: true
|
|
8445
8448
|
});
|
|
8446
|
-
resources.push(...manifestFiles
|
|
8449
|
+
resources.push(...manifestFiles);
|
|
8447
8450
|
if (manifest.l10n != null) {
|
|
8448
8451
|
const bundleFiles = await outExports.glob('{bundle.l10n.json,bundle.l10n.*.json}', {
|
|
8449
8452
|
fs: fs,
|
|
8450
|
-
cwd:
|
|
8453
|
+
cwd: nodePath.join(cwd, manifest.l10n),
|
|
8451
8454
|
onlyFiles: true
|
|
8452
8455
|
});
|
|
8453
8456
|
resources.push(...bundleFiles);
|
|
@@ -8456,7 +8459,7 @@ async function extractResourcesFromExtensionManifest(manifest, fs, cwd) {
|
|
|
8456
8459
|
resources.push(manifest.icon);
|
|
8457
8460
|
}
|
|
8458
8461
|
// remove duplicates
|
|
8459
|
-
return Array.from(new Set(resources));
|
|
8462
|
+
return Array.from(new Set(resources.map((p) => nodePath.normalize(p))));
|
|
8460
8463
|
}
|
|
8461
8464
|
async function extractResources(resourcePath, fs, cwd) {
|
|
8462
8465
|
const resources = [];
|
|
@@ -8464,9 +8467,9 @@ async function extractResources(resourcePath, fs, cwd) {
|
|
|
8464
8467
|
if (resourcePath.endsWith('.css')) {
|
|
8465
8468
|
const urls = parseCssUrl(content);
|
|
8466
8469
|
for (const url of urls) {
|
|
8467
|
-
const assetPath = './' +
|
|
8470
|
+
const assetPath = './' + nodePath.join(nodePath.dirname(resourcePath), url);
|
|
8468
8471
|
try {
|
|
8469
|
-
await fs.promises.access(
|
|
8472
|
+
await fs.promises.access(nodePath.join(cwd, assetPath));
|
|
8470
8473
|
resources.push(assetPath);
|
|
8471
8474
|
}
|
|
8472
8475
|
catch {
|
|
@@ -8527,7 +8530,7 @@ async function readVsix(file) {
|
|
|
8527
8530
|
});
|
|
8528
8531
|
}
|
|
8529
8532
|
function getVsixPath(file) {
|
|
8530
|
-
return
|
|
8533
|
+
return nodePath.posix.relative('/', nodePath.posix.resolve('/', file));
|
|
8531
8534
|
}
|
|
8532
8535
|
function plugin({ include = '**/*.vsix', exclude, transformManifest = (manifest) => manifest } = {}) {
|
|
8533
8536
|
const filter = createFilter(include, exclude);
|
|
@@ -8546,7 +8549,7 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = (manifest)
|
|
|
8546
8549
|
if (!filter(id))
|
|
8547
8550
|
return null;
|
|
8548
8551
|
const vsixFS = await readVsix(id);
|
|
8549
|
-
const readFileSync = (filePath) => vsixFS.readFileSync(
|
|
8552
|
+
const readFileSync = (filePath) => vsixFS.readFileSync(nodePath.join('/', filePath));
|
|
8550
8553
|
const manifest = transformManifest(parseJson(id, readFileSync('package.json').toString('utf8')));
|
|
8551
8554
|
const resources = await getExtensionResources(manifest, vsixFS, '/');
|
|
8552
8555
|
const resourcePaths = resources.map((r) => r.path);
|
|
@@ -8564,7 +8567,7 @@ function plugin({ include = '**/*.vsix', exclude, transformManifest = (manifest)
|
|
|
8564
8567
|
'import.meta.ROLLUP_FILE_URL_' +
|
|
8565
8568
|
this.emitFile({
|
|
8566
8569
|
type: 'asset',
|
|
8567
|
-
name: `${
|
|
8570
|
+
name: `${nodePath.basename(id)}/${nodePath.basename(assetPath)}`,
|
|
8568
8571
|
source: readFileSync(assetPath)
|
|
8569
8572
|
});
|
|
8570
8573
|
}
|