UNPKG

monaco-editor-core

Version:
17 lines • 1.21 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { FileAccess, nodeModulesAsarPath, nodeModulesPath } from './base/common/network.js'; import * as platform from './base/common/platform.js'; const cache = new Map(); export function resolveAmdNodeModulePath(nodeModuleName, pathInsideNodeModule) { const product = globalThis._VSCODE_PRODUCT_JSON; const isBuilt = Boolean((product ?? globalThis.vscode?.context?.configuration()?.product)?.commit); const useASAR = (isBuilt && (platform.isElectron || (platform.isWebWorker && platform.hasElectronUserAgent))); const nodeModulePath = `${nodeModuleName}/${pathInsideNodeModule}`; const actualNodeModulesPath = (useASAR ? nodeModulesAsarPath : nodeModulesPath); const resourcePath = `${actualNodeModulesPath}/${nodeModulePath}`; return FileAccess.asBrowserUri(resourcePath).toString(true); } //# sourceMappingURL=amdX.js.map