@visulima/error 5.0.4 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/code-frame/get-marker-lines.d.ts +19 -0
- package/dist/code-frame/index-to-line-column.d.ts +7 -0
- package/dist/code-frame/index.d.ts +15 -7
- package/dist/{packem_shared/types-CrVmNoPV.d.ts → code-frame/types.d.ts} +4 -6
- package/dist/error/capture-raw-stack-trace.d.ts +2 -0
- package/dist/error/get-error-causes.d.ts +6 -0
- package/dist/error/index.d.ts +12 -96
- package/dist/error/render/error.d.ts +22 -0
- package/dist/error/serialize/deserialize.d.ts +14 -0
- package/dist/error/serialize/error-constructors.d.ts +25 -0
- package/dist/error/serialize/error-proto.d.ts +10 -0
- package/dist/error/serialize/non-error.d.ts +7 -0
- package/dist/error/serialize/serialize.d.ts +14 -0
- package/dist/error/types.d.ts +33 -0
- package/dist/error/visulima-error.d.ts +16 -0
- package/dist/index.d.ts +12 -17
- package/dist/solution/ai/ai-finder.d.ts +12 -0
- package/dist/solution/ai/ai-prompt.d.ts +2 -4
- package/dist/{packem_shared/ai-solution-response-BuaDQAEU.d.ts → solution/ai/ai-solution-response.d.ts} +1 -2
- package/dist/solution/ai/index.d.ts +3 -16
- package/dist/solution/error-hint-finder.d.ts +3 -0
- package/dist/solution/index.d.ts +3 -8
- package/dist/solution/rule-based-finder.d.ts +3 -0
- package/dist/{packem_shared/types-BtQS7FHG.d.ts → solution/types.d.ts} +4 -6
- package/dist/stacktrace/index.d.ts +3 -26
- package/dist/stacktrace/parse-stacktrace.d.ts +6 -0
- package/dist/stacktrace/stringify.d.ts +15 -0
- package/dist/stacktrace/types.d.ts +10 -0
- package/dist/util/normalize-lf.d.ts +2 -0
- package/dist/util/process.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
## @visulima/error [5.0.6](https://github.com/visulima/visulima/compare/@visulima/error@5.0.5...@visulima/error@5.0.6) (2025-11-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* bump packem, to fix minified version of the code ([2a36ceb](https://github.com/visulima/visulima/commit/2a36ceb09251b0ca1178701a26547a871ed717a7))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/path:** upgraded to 2.0.5
|
|
11
|
+
|
|
12
|
+
## @visulima/error [5.0.5](https://github.com/visulima/visulima/compare/@visulima/error@5.0.4...@visulima/error@5.0.5) (2025-11-12)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
|
|
17
|
+
|
|
18
|
+
### Miscellaneous Chores
|
|
19
|
+
|
|
20
|
+
* Add jsr file to all packages for release ([#565](https://github.com/visulima/visulima/issues/565)) ([ec91652](https://github.com/visulima/visulima/commit/ec91652b4e4112adf14ba152c1239a7703ba425a))
|
|
21
|
+
* update license files and clean up TypeScript definitions ([fe668cc](https://github.com/visulima/visulima/commit/fe668cc26de23591d4df54a0954455ebbe31b22d))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Dependencies
|
|
25
|
+
|
|
26
|
+
* **@visulima/path:** upgraded to 2.0.4
|
|
27
|
+
|
|
1
28
|
## @visulima/error [5.0.4](https://github.com/visulima/visulima/compare/@visulima/error@5.0.3...@visulima/error@5.0.4) (2025-11-07)
|
|
2
29
|
|
|
3
30
|
### Bug Fixes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a copy of the codeFrame function from Babel
|
|
3
|
+
* @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L68-L143
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Extract what lines should be marked and highlighted.
|
|
11
|
+
*/
|
|
12
|
+
import type { CodeFrameNodeLocation } from "./types.d.ts";
|
|
13
|
+
type MarkerLines = Record<number, true | [number | undefined, number | undefined]>;
|
|
14
|
+
declare const getMarkerLines: (loc: CodeFrameNodeLocation, source: string[], linesAbove: number, linesBelow: number) => {
|
|
15
|
+
end: number;
|
|
16
|
+
markerLines: MarkerLines;
|
|
17
|
+
start: number;
|
|
18
|
+
};
|
|
19
|
+
export default getMarkerLines;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This is a modified copy of the codeFrameColumns function from Babel
|
|
3
|
+
* @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L145-L217
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
8
|
+
*/
|
|
9
|
+
import type { CodeFrameNodeLocation, CodeFrameOptions } from "./types.d.ts";
|
|
10
|
+
export declare const CODE_FRAME_POINTER: string;
|
|
11
|
+
/**
|
|
12
|
+
* Generate a code frame from string and an error location.
|
|
13
|
+
*/
|
|
14
|
+
export declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
|
|
15
|
+
export type { CodeFrameLocation, CodeFrameNodeLocation, CodeFrameOptions, ColorizeMethod } from "./types.d.ts";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
type CodeFrameLocation = {
|
|
1
|
+
export type CodeFrameLocation = {
|
|
2
2
|
column?: number;
|
|
3
3
|
line: number;
|
|
4
4
|
};
|
|
5
|
-
type CodeFrameNodeLocation = {
|
|
5
|
+
export type CodeFrameNodeLocation = {
|
|
6
6
|
end?: CodeFrameLocation;
|
|
7
7
|
start: CodeFrameLocation;
|
|
8
8
|
};
|
|
9
|
-
type ColorizeMethod = (value: string) => string;
|
|
10
|
-
type CodeFrameOptions = {
|
|
9
|
+
export type ColorizeMethod = (value: string) => string;
|
|
10
|
+
export type CodeFrameOptions = {
|
|
11
11
|
color?: {
|
|
12
12
|
gutter?: ColorizeMethod;
|
|
13
13
|
marker?: ColorizeMethod;
|
|
@@ -21,5 +21,3 @@ type CodeFrameOptions = {
|
|
|
21
21
|
showLineNumbers?: boolean;
|
|
22
22
|
tabWidth?: number | false;
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
export type { CodeFrameLocation as C, CodeFrameNodeLocation as a, CodeFrameOptions as b, ColorizeMethod as c };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VisulimaError } from "./visulima-error.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Will return an array of all causes in the error in the order they occurred.
|
|
4
|
+
*/
|
|
5
|
+
declare const getErrorCauses: <E = Error | VisulimaError | unknown>(error: E) => E[];
|
|
6
|
+
export default getErrorCauses;
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,96 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
interface ErrorLocation {
|
|
15
|
-
column?: number;
|
|
16
|
-
file?: string;
|
|
17
|
-
line?: number;
|
|
18
|
-
}
|
|
19
|
-
type ErrorHint = string[] | string;
|
|
20
|
-
|
|
21
|
-
declare const isVisulimaError: (error: unknown) => error is VisulimaError;
|
|
22
|
-
declare class VisulimaError extends Error {
|
|
23
|
-
loc: ErrorLocation | undefined;
|
|
24
|
-
title: string | undefined;
|
|
25
|
-
hint: ErrorHint | undefined;
|
|
26
|
-
type: string;
|
|
27
|
-
constructor({ cause, hint, location, message, name, stack, title }: ErrorProperties);
|
|
28
|
-
setLocation(location: ErrorLocation): void;
|
|
29
|
-
setName(name: string): void;
|
|
30
|
-
setMessage(message: string): void;
|
|
31
|
-
setHint(hint: ErrorHint): void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare const getErrorCauses: <E = Error | VisulimaError | unknown>(error: E) => E[];
|
|
35
|
-
|
|
36
|
-
type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
37
|
-
color: CodeFrameOptions["color"] & {
|
|
38
|
-
fileLine: ColorizeMethod;
|
|
39
|
-
hint: ColorizeMethod;
|
|
40
|
-
method: ColorizeMethod;
|
|
41
|
-
title: ColorizeMethod;
|
|
42
|
-
};
|
|
43
|
-
cwd: string;
|
|
44
|
-
displayShortPath: boolean;
|
|
45
|
-
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
46
|
-
framesMaxLimit: number;
|
|
47
|
-
hideErrorCauseCodeView: boolean;
|
|
48
|
-
hideErrorCodeView: boolean;
|
|
49
|
-
hideErrorErrorsCodeView: boolean;
|
|
50
|
-
hideErrorTitle: boolean;
|
|
51
|
-
hideMessage: boolean;
|
|
52
|
-
indentation: number | "\t";
|
|
53
|
-
prefix: string;
|
|
54
|
-
};
|
|
55
|
-
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
56
|
-
|
|
57
|
-
interface DeserializeOptions {
|
|
58
|
-
maxDepth?: number;
|
|
59
|
-
}
|
|
60
|
-
type DeserializeOptionsType = DeserializeOptions;
|
|
61
|
-
declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
|
|
62
|
-
|
|
63
|
-
type ErrorConstructor = new (...arguments_: any[]) => Error;
|
|
64
|
-
declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
|
|
65
|
-
declare const isErrorLike: (value: unknown) => value is {
|
|
66
|
-
message?: string;
|
|
67
|
-
name?: string;
|
|
68
|
-
stack?: string;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
72
|
-
aggregateErrors?: SerializedError<ErrorType>[];
|
|
73
|
-
cause?: unknown;
|
|
74
|
-
code?: string;
|
|
75
|
-
message: string;
|
|
76
|
-
name: string;
|
|
77
|
-
raw?: ErrorType;
|
|
78
|
-
stack?: string;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
declare class NonError extends Error {
|
|
82
|
-
constructor(message: string);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface JsonError extends Error {
|
|
86
|
-
toJSON: () => SerializedError;
|
|
87
|
-
}
|
|
88
|
-
type Options = {
|
|
89
|
-
exclude?: string[];
|
|
90
|
-
maxDepth?: number;
|
|
91
|
-
useToJSON?: boolean;
|
|
92
|
-
};
|
|
93
|
-
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
94
|
-
|
|
95
|
-
export { NonError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
|
|
96
|
-
export type { ErrorHint, ErrorLocation, ErrorProperties, Options as ErrorWithCauseSerializerOptions, Options$1 as RenderErrorOptions, SerializedError };
|
|
1
|
+
export { default as captureRawStackTrace } from "./capture-raw-stack-trace.d.ts";
|
|
2
|
+
export { default as getErrorCauses } from "./get-error-causes.d.ts";
|
|
3
|
+
export type { Options as RenderErrorOptions } from "./render/error.d.ts";
|
|
4
|
+
export { renderError } from "./render/error.d.ts";
|
|
5
|
+
export { default as deserializeError } from "./serialize/deserialize.d.ts";
|
|
6
|
+
export { addKnownErrorConstructor, isErrorLike } from "./serialize/error-constructors.d.ts";
|
|
7
|
+
export type { SerializedError } from "./serialize/error-proto.d.ts";
|
|
8
|
+
export { default as NonError } from "./serialize/non-error.d.ts";
|
|
9
|
+
export type { Options as ErrorWithCauseSerializerOptions } from "./serialize/serialize.d.ts";
|
|
10
|
+
export { serialize as serializeError } from "./serialize/serialize.d.ts";
|
|
11
|
+
export type { ErrorHint, ErrorLocation, ErrorProperties } from "./types.d.ts";
|
|
12
|
+
export { isVisulimaError, VisulimaError } from "./visulima-error.d.ts";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CodeFrameOptions, ColorizeMethod } from "../../index.d.ts";
|
|
2
|
+
import type { VisulimaError } from "../visulima-error.d.ts";
|
|
3
|
+
export type Options = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
4
|
+
color: CodeFrameOptions["color"] & {
|
|
5
|
+
fileLine: ColorizeMethod;
|
|
6
|
+
hint: ColorizeMethod;
|
|
7
|
+
method: ColorizeMethod;
|
|
8
|
+
title: ColorizeMethod;
|
|
9
|
+
};
|
|
10
|
+
cwd: string;
|
|
11
|
+
displayShortPath: boolean;
|
|
12
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
13
|
+
framesMaxLimit: number;
|
|
14
|
+
hideErrorCauseCodeView: boolean;
|
|
15
|
+
hideErrorCodeView: boolean;
|
|
16
|
+
hideErrorErrorsCodeView: boolean;
|
|
17
|
+
hideErrorTitle: boolean;
|
|
18
|
+
hideMessage: boolean;
|
|
19
|
+
indentation: number | "\t";
|
|
20
|
+
prefix: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options>) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface DeserializeOptions {
|
|
2
|
+
maxDepth?: number;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Options for deserializing error objects.
|
|
6
|
+
*/
|
|
7
|
+
type DeserializeOptionsType = DeserializeOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Deserialize a value back to its original form.
|
|
10
|
+
* If the value looks like a serialized error, it will be reconstructed as an Error instance.
|
|
11
|
+
* Otherwise, it will be wrapped in a NonError.
|
|
12
|
+
*/
|
|
13
|
+
declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
|
|
14
|
+
export default deserialize;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type ErrorConstructor = new (...arguments_: any[]) => Error;
|
|
2
|
+
/**
|
|
3
|
+
* Add a known error constructor to the registry.
|
|
4
|
+
* @param constructor The error constructor to add
|
|
5
|
+
* @param name Optional custom name to use instead of instance.name
|
|
6
|
+
* @throws {Error} If the constructor is already known or incompatible
|
|
7
|
+
*/
|
|
8
|
+
export declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Get all known error constructors.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getKnownErrorConstructors: () => Map<string, new (...arguments_: any[]) => Error>;
|
|
13
|
+
/**
|
|
14
|
+
* Get a specific error constructor by name.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getErrorConstructor: (name: string) => (new (...arguments_: any[]) => Error) | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Check if an object looks like a serialized error.
|
|
19
|
+
*/
|
|
20
|
+
export declare const isErrorLike: (value: unknown) => value is {
|
|
21
|
+
message?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
stack?: string;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const ErrorProto: SerializedError;
|
|
2
|
+
export type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
3
|
+
aggregateErrors?: SerializedError<ErrorType>[];
|
|
4
|
+
cause?: unknown;
|
|
5
|
+
code?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
name: string;
|
|
8
|
+
raw?: ErrorType;
|
|
9
|
+
stack?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SerializedError } from "./error-proto.d.ts";
|
|
2
|
+
interface JsonError extends Error {
|
|
3
|
+
toJSON: () => SerializedError;
|
|
4
|
+
}
|
|
5
|
+
export type Options = {
|
|
6
|
+
exclude?: string[];
|
|
7
|
+
maxDepth?: number;
|
|
8
|
+
useToJSON?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Serialize an `Error` object into a plain object.
|
|
12
|
+
*/
|
|
13
|
+
export declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ErrorProperties {
|
|
2
|
+
cause?: Error | unknown;
|
|
3
|
+
hint?: ErrorHint;
|
|
4
|
+
location?: ErrorLocation;
|
|
5
|
+
message?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
stack?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ErrorLocation {
|
|
11
|
+
column?: number;
|
|
12
|
+
file?: string;
|
|
13
|
+
line?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A message that explains to the user how they can fix the error.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const error = new VisulimaError({
|
|
20
|
+
* hint: "Try running `npm install` to install missing dependencies.",
|
|
21
|
+
* location: {
|
|
22
|
+
* file: "src/index.ts",
|
|
23
|
+
* line: 1,
|
|
24
|
+
* column: 1,
|
|
25
|
+
* },
|
|
26
|
+
* message: "Cannot find module 'react'",
|
|
27
|
+
* name: "ModuleNotFoundError",
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* For more complex hints, you can pass an array of strings or a single string in markdown format.
|
|
32
|
+
*/
|
|
33
|
+
export type ErrorHint = string[] | string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ErrorHint, ErrorLocation, ErrorProperties } from "./types.d.ts";
|
|
2
|
+
export declare const isVisulimaError: (error: unknown) => error is VisulimaError;
|
|
3
|
+
export declare class VisulimaError extends Error {
|
|
4
|
+
loc: ErrorLocation | undefined;
|
|
5
|
+
title: string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* A message that explains to the user how they can fix the error.
|
|
8
|
+
*/
|
|
9
|
+
hint: ErrorHint | undefined;
|
|
10
|
+
type: string;
|
|
11
|
+
constructor({ cause, hint, location, message, name, stack, title }: ErrorProperties);
|
|
12
|
+
setLocation(location: ErrorLocation): void;
|
|
13
|
+
setName(name: string): void;
|
|
14
|
+
setMessage(message: string): void;
|
|
15
|
+
setHint(hint: ErrorHint): void;
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
column: number;
|
|
14
|
-
line: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { indexToLineColumn };
|
|
1
|
+
export type { CodeFrameLocation, CodeFrameNodeLocation, CodeFrameOptions, ColorizeMethod } from "./code-frame/index.d.ts";
|
|
2
|
+
export { CODE_FRAME_POINTER, codeFrame } from "./code-frame/index.d.ts";
|
|
3
|
+
export { default as indexToLineColumn } from "./code-frame/index-to-line-column.d.ts";
|
|
4
|
+
export type { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError } from "./error/index.d.ts";
|
|
5
|
+
export { addKnownErrorConstructor, captureRawStackTrace, deserializeError, getErrorCauses, isErrorLike, isVisulimaError, NonError, renderError, serializeError, VisulimaError, } from "./error/index.d.ts";
|
|
6
|
+
export { default as aiPrompt } from "./solution/ai/ai-prompt.d.ts";
|
|
7
|
+
export { default as aiSolutionResponse } from "./solution/ai/ai-solution-response.d.ts";
|
|
8
|
+
export { default as errorHintFinder } from "./solution/error-hint-finder.d.ts";
|
|
9
|
+
export { default as ruleBasedFinder } from "./solution/rule-based-finder.d.ts";
|
|
10
|
+
export type { Solution, SolutionError, SolutionFinder, SolutionFinderFile } from "./solution/types.d.ts";
|
|
11
|
+
export type { Trace, TraceType } from "./stacktrace/index.d.ts";
|
|
12
|
+
export { formatStackFrameLine, formatStacktrace, parseStacktrace } from "./stacktrace/index.d.ts";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LanguageModel } from "ai";
|
|
2
|
+
import type { SolutionFinder } from "../types.d.ts";
|
|
3
|
+
interface CacheOptions {
|
|
4
|
+
directory?: string;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const aiFinder: (model: LanguageModel, options?: {
|
|
9
|
+
cache?: CacheOptions;
|
|
10
|
+
temperature?: number;
|
|
11
|
+
}) => SolutionFinder;
|
|
12
|
+
export default aiFinder;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { SolutionFinderFile } from "../types.d.ts";
|
|
3
2
|
declare const aiPrompt: ({ applicationType, error, file, }: {
|
|
4
3
|
applicationType: string | undefined;
|
|
5
4
|
error: Error;
|
|
6
5
|
file: SolutionFinderFile;
|
|
7
6
|
}) => string;
|
|
8
|
-
|
|
9
|
-
export { aiPrompt as default };
|
|
7
|
+
export default aiPrompt;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { default as
|
|
4
|
-
export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.js';
|
|
5
|
-
|
|
6
|
-
interface CacheOptions {
|
|
7
|
-
directory?: string;
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
ttl?: number;
|
|
10
|
-
}
|
|
11
|
-
declare const aiFinder: (model: LanguageModel, options?: {
|
|
12
|
-
cache?: CacheOptions;
|
|
13
|
-
temperature?: number;
|
|
14
|
-
}) => SolutionFinder;
|
|
15
|
-
|
|
16
|
-
export { aiFinder };
|
|
1
|
+
export { default as aiFinder } from "./ai-finder.d.ts";
|
|
2
|
+
export { default as aiPrompt } from "./ai-prompt.d.ts";
|
|
3
|
+
export { default as aiSolutionResponse } from "./ai-solution-response.d.ts";
|
package/dist/solution/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
declare const errorHintFinder: SolutionFinder;
|
|
5
|
-
|
|
6
|
-
declare const ruleBasedFinder: SolutionFinder;
|
|
7
|
-
|
|
8
|
-
export { SolutionFinder, errorHintFinder, ruleBasedFinder };
|
|
1
|
+
export { default as errorHintFinder } from "./error-hint-finder.d.ts";
|
|
2
|
+
export { default as ruleBasedFinder } from "./rule-based-finder.d.ts";
|
|
3
|
+
export type { Solution, SolutionError, SolutionFinder, SolutionFinderFile } from "./types.d.ts";
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
type Solution = {
|
|
1
|
+
export type Solution = {
|
|
2
2
|
body: string;
|
|
3
3
|
header?: string;
|
|
4
4
|
};
|
|
5
|
-
type SolutionFinderFile = {
|
|
5
|
+
export type SolutionFinderFile = {
|
|
6
6
|
file: string;
|
|
7
7
|
language?: string;
|
|
8
8
|
line: number;
|
|
9
9
|
snippet?: string | undefined;
|
|
10
10
|
};
|
|
11
|
-
type SolutionFinder = {
|
|
11
|
+
export type SolutionFinder = {
|
|
12
12
|
handle: (error: any, file: SolutionFinderFile) => Promise<Solution | undefined>;
|
|
13
13
|
name: string;
|
|
14
14
|
priority: number;
|
|
15
15
|
};
|
|
16
|
-
type SolutionError = Error & {
|
|
16
|
+
export type SolutionError = Error & {
|
|
17
17
|
hint?: Solution;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
export type { Solution as S, SolutionError as a, SolutionFinder as b, SolutionFinderFile as c };
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
evalOrigin?: Trace | undefined;
|
|
5
|
-
file: string | undefined;
|
|
6
|
-
line: number | undefined;
|
|
7
|
-
methodName: string | undefined;
|
|
8
|
-
raw: string;
|
|
9
|
-
type?: TraceType | undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare const parseStacktrace: (error: Error, { filter, frameLimit }?: Partial<{
|
|
13
|
-
filter?: (line: string) => boolean;
|
|
14
|
-
frameLimit: number;
|
|
15
|
-
}>) => Trace[];
|
|
16
|
-
|
|
17
|
-
declare const formatStackFrameLine: (frame: Trace) => string;
|
|
18
|
-
declare const formatStacktrace: (frames: Trace[], options?: {
|
|
19
|
-
header?: {
|
|
20
|
-
message?: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
};
|
|
23
|
-
}) => string;
|
|
24
|
-
|
|
25
|
-
export { formatStackFrameLine, formatStacktrace, parseStacktrace };
|
|
26
|
-
export type { Trace, TraceType };
|
|
1
|
+
export { default as parseStacktrace } from "./parse-stacktrace.d.ts";
|
|
2
|
+
export { formatStackFrameLine, formatStacktrace } from "./stringify.d.ts";
|
|
3
|
+
export type { Trace, TraceType } from "./types.d.ts";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Trace } from "./types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Formats a single parsed stack frame to a standard "at ..." line.
|
|
4
|
+
*/
|
|
5
|
+
export declare const formatStackFrameLine: (frame: Trace) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Turns an array of parsed stack frames into a stack string.
|
|
8
|
+
* Optionally include the "ErrorName: message" header as the first line.
|
|
9
|
+
*/
|
|
10
|
+
export declare const formatStacktrace: (frames: Trace[], options?: {
|
|
11
|
+
header?: {
|
|
12
|
+
message?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
};
|
|
15
|
+
}) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TraceType = "eval" | "internal" | "native" | undefined;
|
|
2
|
+
export interface Trace {
|
|
3
|
+
column: number | undefined;
|
|
4
|
+
evalOrigin?: Trace | undefined;
|
|
5
|
+
file: string | undefined;
|
|
6
|
+
line: number | undefined;
|
|
7
|
+
methodName: string | undefined;
|
|
8
|
+
raw: string;
|
|
9
|
+
type?: TraceType | undefined;
|
|
10
|
+
}
|