mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-26 13:19:42 +00:00
fix: duplicate vsda
This commit is contained in:
@@ -17,7 +17,7 @@ declare class AsarFilesystem {
|
||||
insertFile(path: string, shouldUnpack: boolean, file: { stat: { size: number; mode: number } }, options: {}): Promise<void>;
|
||||
}
|
||||
|
||||
export function createAsar(folderPath: string, unpackGlobs: string[], skipGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
|
||||
export function createAsar(folderPath: string, unpackGlobs: string[], skipGlobs: string[], duplicateGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
|
||||
|
||||
const shouldUnpackFile = (file: VinylFile): boolean => {
|
||||
for (let i = 0; i < unpackGlobs.length; i++) {
|
||||
@@ -37,6 +37,17 @@ export function createAsar(folderPath: string, unpackGlobs: string[], skipGlobs:
|
||||
return false;
|
||||
};
|
||||
|
||||
// Files that should be duplicated between
|
||||
// node_modules.asar and node_modules
|
||||
const shouldDuplicateFile = (file: VinylFile): boolean => {
|
||||
for (const duplicateGlob of duplicateGlobs) {
|
||||
if (minimatch(file.relative, duplicateGlob)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const filesystem = new Filesystem(folderPath);
|
||||
const out: Buffer[] = [];
|
||||
|
||||
@@ -96,6 +107,15 @@ export function createAsar(folderPath: string, unpackGlobs: string[], skipGlobs:
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (shouldDuplicateFile(file)) {
|
||||
console.log(file.relative);
|
||||
this.queue(new VinylFile({
|
||||
base: '.',
|
||||
path: file.path,
|
||||
stat: file.stat,
|
||||
contents: file.contents
|
||||
}));
|
||||
}
|
||||
const shouldUnpack = shouldUnpackFile(file);
|
||||
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user