mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
scan builtin extensions
This commit is contained in:
@@ -78,7 +78,7 @@ function fromLocal(extensionPath: string, forWeb: boolean): Stream {
|
||||
});
|
||||
}
|
||||
|
||||
return minimizeLanguageJSON(input)
|
||||
return minimizeLanguageJSON(input);
|
||||
}
|
||||
|
||||
|
||||
@@ -307,3 +307,35 @@ export function packageMarketplaceWebExtensionsStream(builtInExtensions: IBuiltI
|
||||
});
|
||||
return es.merge(extensions);
|
||||
}
|
||||
|
||||
export interface IScannedBuiltinExtension {
|
||||
extensionPath: string,
|
||||
packageJSON: any,
|
||||
packagsNLSPath?: string,
|
||||
readmePath?: string,
|
||||
changelogPath?: string,
|
||||
}
|
||||
|
||||
export function scanBuiltinExtensions(extensionsRoot: string, forWeb: boolean): IScannedBuiltinExtension[] {
|
||||
const scannedExtensions: IScannedBuiltinExtension[] = [];
|
||||
const extensionsFolders = fs.readdirSync(extensionsRoot);
|
||||
for (const extensionFolder of extensionsFolders) {
|
||||
const packageJSON = JSON.parse(fs.readFileSync(path.join(extensionsRoot, extensionFolder, 'package.json')).toString('utf8'));
|
||||
const extensionKind: string[] = packageJSON['extensionKind'] || [];
|
||||
if (forWeb && extensionKind.indexOf('web') === -1) {
|
||||
continue;
|
||||
}
|
||||
const children = fs.readdirSync(path.join(extensionsRoot, extensionFolder));
|
||||
const packageNLS = children.filter(child => child === 'package.nls.json')[0];
|
||||
const readme = children.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
|
||||
const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
|
||||
scannedExtensions.push({
|
||||
extensionPath: extensionFolder,
|
||||
packageJSON: packageJSON,
|
||||
packagsNLSPath: packageNLS ? path.join(extensionFolder, packageNLS) : undefined,
|
||||
readmePath: readme ? path.join(extensionFolder, readme) : undefined,
|
||||
changelogPath: changelog ? path.join(extensionFolder, changelog) : undefined,
|
||||
});
|
||||
}
|
||||
return scannedExtensions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user