next
Version:
The React Framework
48 lines (47 loc) • 1.92 kB
TypeScript
import type { StackFrame } from 'next/dist/compiled/stacktrace-parser';
import { getSourceMapFromFile } from '../internal/helpers/get-source-map-from-file';
import { type OriginalStackFrameResponse } from './shared';
export { getServerError } from '../internal/helpers/node-stack-frames';
export { parseStack } from '../internal/helpers/parse-stack';
export { getSourceMapFromFile };
import type { IncomingMessage, ServerResponse } from 'http';
import type webpack from 'webpack';
import type { RawSourceMap } from 'next/dist/compiled/source-map08';
type IgnoredSources = Array<{
url: string;
ignored: boolean;
}>;
export interface IgnorableStackFrame extends StackFrame {
ignored: boolean;
}
type Source = {
type: 'file';
sourceMap: RawSourceMap;
ignoredSources: IgnoredSources;
modulePath: string;
} | {
type: 'bundle';
sourceMap: RawSourceMap;
ignoredSources: IgnoredSources;
compilation: webpack.Compilation;
moduleId: string;
modulePath: string;
};
export declare function getIgnoredSources(sourceMap: RawSourceMap): IgnoredSources;
export declare function createOriginalStackFrame({ source, rootDirectory, frame, errorMessage, }: {
source: Source;
rootDirectory: string;
frame: StackFrame;
errorMessage?: string;
}): Promise<OriginalStackFrameResponse | null>;
export declare function getOverlayMiddleware(options: {
rootDirectory: string;
clientStats: () => webpack.Stats | null;
serverStats: () => webpack.Stats | null;
edgeServerStats: () => webpack.Stats | null;
}): (req: IncomingMessage, res: ServerResponse, next: () => void) => Promise<void>;
export declare function getSourceMapMiddleware(options: {
clientStats: () => webpack.Stats | null;
serverStats: () => webpack.Stats | null;
edgeServerStats: () => webpack.Stats | null;
}): (req: IncomingMessage, res: ServerResponse, next: () => void) => Promise<void>;