UNPKG

sussudio

Version:

An unofficial VS Code Internal API

26 lines (25 loc) 1.31 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 "../../../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 = {}));