UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

26 lines (25 loc) 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 { basename, isAbsolute, join } from '@sussudio/base/common/path.mjs'; import { createDecorator } from '../../instantiation/common/instantiation.mjs'; export const IV8InspectProfilingService = createDecorator('IV8InspectProfilingService'); export var Utils; (function (Utils) { function isValidProfile(profile) { return Boolean(profile.samples && profile.timeDeltas); } Utils.isValidProfile = isValidProfile; function rewriteAbsolutePaths(profile, replace = 'noAbsolutePaths') { for (const node of profile.nodes) { if (node.callFrame && node.callFrame.url) { if (isAbsolute(node.callFrame.url) || /^\w[\w\d+.-]*:\/\/\/?/.test(node.callFrame.url)) { node.callFrame.url = join(replace, basename(node.callFrame.url)); } } } return profile; } Utils.rewriteAbsolutePaths = rewriteAbsolutePaths; })(Utils || (Utils = {}));