1
>
/*---------------------------------------------------------------------------------------------
appNodeModules.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { AppResourcePath, nodeModulesAsarUnpackedPath, nodeModulesPath } from '../../../base/common/network.js';
7
>
import product from '../../product/common/product.js';
8
>
9
function hasUnpackedNodeModulesArchive(): boolean {
10
return !!process.versions['electron'] && !!product.commit && !process.env['VSCODE_DEV'];
11
}
13
>
/**
14
>
* The {@link AppResourcePath} of the `node_modules` root that actually holds VS
15
>
* Code's bundled modules, suitable for passing to `FileAccess.asFileUri`.
16
>
*/
17
>
export function getAppNodeModulesPath(): AppResourcePath {
18
return hasUnpackedNodeModulesArchive() ? nodeModulesAsarUnpackedPath : nodeModulesPath;
19
}
21
>
/**
22
>
* The bare directory name (`node_modules` or `node_modules.asar.unpacked`) of the
23
>
* resolved root, for callers that build paths from an app root themselves.
24
>
*/
25
>
export function getAppNodeModulesDirName(): 'node_modules' | 'node_modules.asar.unpacked' {
26
return hasUnpackedNodeModulesArchive() ? 'node_modules.asar.unpacked' : 'node_modules';
27
}