2022-04-18 16:50:25 -08:00
|
|
|
/**
|
|
|
|
* Copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-06-30 21:17:08 +02:00
|
|
|
import url from 'url';
|
|
|
|
import path from 'path';
|
|
|
|
|
2022-04-18 16:50:25 -08:00
|
|
|
export const colors: typeof import('../bundles/utils/node_modules/colors/safe') = require('./utilsBundleImpl').colors;
|
|
|
|
export const debug: typeof import('../bundles/utils/node_modules/@types/debug') = require('./utilsBundleImpl').debug;
|
|
|
|
export const getProxyForUrl: typeof import('../bundles/utils/node_modules/@types/proxy-from-env').getProxyForUrl = require('./utilsBundleImpl').getProxyForUrl;
|
|
|
|
export const HttpsProxyAgent: typeof import('../bundles/utils/node_modules/https-proxy-agent').HttpsProxyAgent = require('./utilsBundleImpl').HttpsProxyAgent;
|
2022-04-18 19:20:49 -08:00
|
|
|
export const jpegjs: typeof import('../bundles/utils/node_modules/jpeg-js') = require('./utilsBundleImpl').jpegjs;
|
2022-04-18 16:50:25 -08:00
|
|
|
export const lockfile: typeof import('../bundles/utils/node_modules/@types/proper-lockfile') = require('./utilsBundleImpl').lockfile;
|
2022-04-18 19:20:49 -08:00
|
|
|
export const mime: typeof import('../bundles/utils/node_modules/@types/mime') = require('./utilsBundleImpl').mime;
|
2022-04-18 20:47:18 -08:00
|
|
|
export const minimatch: typeof import('../bundles/utils/node_modules/@types/minimatch') = require('./utilsBundleImpl').minimatch;
|
|
|
|
export const ms: typeof import('../bundles/utils/node_modules/@types/ms') = require('./utilsBundleImpl').ms;
|
2022-04-18 19:20:49 -08:00
|
|
|
export const PNG: typeof import('../bundles/utils/node_modules/@types/pngjs').PNG = require('./utilsBundleImpl').PNG;
|
2022-04-18 16:50:25 -08:00
|
|
|
export const program: typeof import('../bundles/utils/node_modules/commander').program = require('./utilsBundleImpl').program;
|
2022-04-18 19:20:49 -08:00
|
|
|
export const progress: typeof import('../bundles/utils/node_modules/@types/progress') = require('./utilsBundleImpl').progress;
|
2022-04-18 16:50:25 -08:00
|
|
|
export const rimraf: typeof import('../bundles/utils/node_modules/@types/rimraf') = require('./utilsBundleImpl').rimraf;
|
|
|
|
export const SocksProxyAgent: typeof import('../bundles/utils/node_modules/socks-proxy-agent').SocksProxyAgent = require('./utilsBundleImpl').SocksProxyAgent;
|
2022-04-18 19:20:49 -08:00
|
|
|
export const ws: typeof import('../bundles/utils/node_modules/@types/ws') = require('./utilsBundleImpl').ws;
|
|
|
|
export const wsServer: typeof import('../bundles/utils/node_modules/@types/ws').WebSocketServer = require('./utilsBundleImpl').wsServer;
|
2022-04-19 12:28:05 -08:00
|
|
|
export const wsReceiver = require('./utilsBundleImpl').wsReceiver;
|
|
|
|
export const wsSender = require('./utilsBundleImpl').wsSender;
|
2022-04-18 16:50:25 -08:00
|
|
|
export type { Command } from '../bundles/utils/node_modules/commander';
|
2022-04-18 19:20:49 -08:00
|
|
|
export type { WebSocket, WebSocketServer, RawData as WebSocketRawData, EventEmitter as WebSocketEventEmitter } from '../bundles/utils/node_modules/@types/ws';
|
2022-06-30 21:17:08 +02:00
|
|
|
|
|
|
|
const StackUtils: typeof import('../bundles/utils/node_modules/@types/stack-utils') = require('./utilsBundleImpl').StackUtils;
|
|
|
|
const stackUtils = new StackUtils();
|
|
|
|
|
|
|
|
export function parseStackTraceLine(line: string): { frame: import('../bundles/utils/node_modules/@types/stack-utils').StackLineData | null, fileName: string | null } {
|
|
|
|
const frame = stackUtils.parseLine(line);
|
|
|
|
if (!frame)
|
|
|
|
return { frame: null, fileName: null };
|
|
|
|
let fileName = null;
|
|
|
|
if (frame.file) {
|
|
|
|
// ESM files return file:// URLs, see here: https://github.com/tapjs/stack-utils/issues/60
|
|
|
|
fileName = frame.file.startsWith('file://') ? url.fileURLToPath(frame.file) : path.resolve(process.cwd(), frame.file);
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
frame,
|
|
|
|
fileName,
|
|
|
|
};
|
|
|
|
}
|