@visulima/ono 2.0.10 → 2.0.11
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 +2 -0
- package/dist/error-inspector/page/create-request-context.d.ts +1 -1
- package/dist/index.d.ts +39 -39
- package/dist/index.js +54 -54
- package/dist/packem_shared/{types.d-D1UE67tt.d.ts → types.d-Dm3db2h3.d.ts} +1 -1
- package/dist/server/open-in-editor.d.ts +12 -12
- package/dist/server/open-in-editor.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
## @visulima/ono [2.0.11](https://github.com/visulima/visulima/compare/%40visulima%2Fono%402.0.10...%40visulima%2Fono%402.0.11) (2026-07-27)
|
|
2
|
+
|
|
1
3
|
## @visulima/ono [2.0.10](https://github.com/visulima/visulima/compare/%40visulima%2Fono%402.0.9...%40visulima%2Fono%402.0.10) (2026-07-27)
|
|
2
4
|
|
|
3
5
|
## @visulima/ono [2.0.9](https://github.com/visulima/visulima/compare/%40visulima%2Fono%402.0.8...%40visulima%2Fono%402.0.9) (2026-07-27)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentPage } from "../../packem_shared/types.d-
|
|
1
|
+
import { C as ContentPage } from "../../packem_shared/types.d-Dm3db2h3.js";
|
|
2
2
|
import { IncomingMessage } from 'node:http';
|
|
3
3
|
type NativeRequest = typeof globalThis.Request;
|
|
4
4
|
type NativeHeaders = typeof globalThis.Headers;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SolutionFinder } from '@visulima/error/solution';
|
|
2
2
|
import { RenderErrorOptions } from '@visulima/error/error';
|
|
3
|
-
import { T as TemplateOptions$1 } from "./packem_shared/types.d-
|
|
3
|
+
import { T as TemplateOptions$1 } from "./packem_shared/types.d-Dm3db2h3.js";
|
|
4
4
|
/** A single parsed stack frame in the structured error payload. */
|
|
5
5
|
interface OnoJsonFrame {
|
|
6
6
|
column?: number;
|
|
@@ -32,21 +32,21 @@ type ToJsonOptions = {
|
|
|
32
32
|
solutionFinders?: SolutionFinder[];
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* Build a structured, JSON-serializable representation of an error — its name/message, the parsed
|
|
36
|
-
* stack frames for the error and every entry in its `cause` chain, the detected runtime, and a
|
|
37
|
-
* suggested solution (using the same solution-finder protocol as the HTML/ANSI renderers).
|
|
38
|
-
*
|
|
39
|
-
* Useful for API servers that want to return parsed error data when the client requests
|
|
40
|
-
* `Accept: application/json`, mirroring Youch's `toJSON()`.
|
|
41
|
-
* @param error the value thrown (any value is coerced to an `Error`).
|
|
42
|
-
* @param options optional custom solution finders.
|
|
43
|
-
* @returns a plain object safe to pass to `JSON.stringify`.
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const payload = await toJSON(error);
|
|
47
|
-
* response.json(payload);
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
35
|
+
* Build a structured, JSON-serializable representation of an error — its name/message, the parsed
|
|
36
|
+
* stack frames for the error and every entry in its `cause` chain, the detected runtime, and a
|
|
37
|
+
* suggested solution (using the same solution-finder protocol as the HTML/ANSI renderers).
|
|
38
|
+
*
|
|
39
|
+
* Useful for API servers that want to return parsed error data when the client requests
|
|
40
|
+
* `Accept: application/json`, mirroring Youch's `toJSON()`.
|
|
41
|
+
* @param error the value thrown (any value is coerced to an `Error`).
|
|
42
|
+
* @param options optional custom solution finders.
|
|
43
|
+
* @returns a plain object safe to pass to `JSON.stringify`.
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const payload = await toJSON(error);
|
|
47
|
+
* response.json(payload);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
50
|
declare const toJSON: (error: unknown, options?: ToJsonOptions) => Promise<OnoJson>;
|
|
51
51
|
type ColorizeMethod = (value: string) => string;
|
|
52
52
|
type BaseCliOptions = {
|
|
@@ -68,47 +68,47 @@ type TemplateOptions = TemplateOptions$1 & {
|
|
|
68
68
|
};
|
|
69
69
|
type CliOptions = BaseCliOptions;
|
|
70
70
|
/**
|
|
71
|
-
* Render an error to a Shiki-highlighted HTML error page.
|
|
72
|
-
* @param error the value thrown (any value is coerced to an `Error`).
|
|
73
|
-
* @param options template options, including custom `solutionFinders`.
|
|
74
|
-
*/
|
|
71
|
+
* Render an error to a Shiki-highlighted HTML error page.
|
|
72
|
+
* @param error the value thrown (any value is coerced to an `Error`).
|
|
73
|
+
* @param options template options, including custom `solutionFinders`.
|
|
74
|
+
*/
|
|
75
75
|
declare const renderHtml: (error: unknown, options?: TemplateOptions) => Promise<string>;
|
|
76
76
|
/**
|
|
77
|
-
* Render an error to ANSI terminal output.
|
|
78
|
-
* @param error the value thrown (any value is coerced to an `Error`).
|
|
79
|
-
* @param options CLI options forwarded to the shared ANSI builder.
|
|
80
|
-
*/
|
|
77
|
+
* Render an error to ANSI terminal output.
|
|
78
|
+
* @param error the value thrown (any value is coerced to an `Error`).
|
|
79
|
+
* @param options CLI options forwarded to the shared ANSI builder.
|
|
80
|
+
*/
|
|
81
81
|
declare const renderAnsi: (error: unknown, options?: CliOptions) => Promise<{
|
|
82
82
|
errorAnsi: string;
|
|
83
83
|
solutionBox: undefined | string;
|
|
84
84
|
}>;
|
|
85
85
|
/**
|
|
86
|
-
* Render an error to a structured, JSON-serializable payload (parsed frames, cause chain, runtime,
|
|
87
|
-
* suggested solution). Useful for SPA/REST error responses (`Accept: application/json`).
|
|
88
|
-
* @param error the value thrown (any value is coerced to an `Error`).
|
|
89
|
-
* @param options optional custom `solutionFinders`.
|
|
90
|
-
*/
|
|
86
|
+
* Render an error to a structured, JSON-serializable payload (parsed frames, cause chain, runtime,
|
|
87
|
+
* suggested solution). Useful for SPA/REST error responses (`Accept: application/json`).
|
|
88
|
+
* @param error the value thrown (any value is coerced to an `Error`).
|
|
89
|
+
* @param options optional custom `solutionFinders`.
|
|
90
|
+
*/
|
|
91
91
|
declare const renderJson: typeof toJSON;
|
|
92
92
|
/**
|
|
93
|
-
* Convenience class wrapping the standalone {@link renderHtml}, {@link renderAnsi} and
|
|
94
|
-
* {@link renderJson} renderers. The standalone functions are preferred for tree-shaking; the class
|
|
95
|
-
* remains for backwards compatibility.
|
|
96
|
-
*/
|
|
93
|
+
* Convenience class wrapping the standalone {@link renderHtml}, {@link renderAnsi} and
|
|
94
|
+
* {@link renderJson} renderers. The standalone functions are preferred for tree-shaking; the class
|
|
95
|
+
* remains for backwards compatibility.
|
|
96
|
+
*/
|
|
97
97
|
declare class Ono {
|
|
98
98
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
* Render error to HTML.
|
|
100
|
+
*/
|
|
101
101
|
toHTML(error: unknown, options?: TemplateOptions): Promise<string>;
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
* Render error to ANSI output.
|
|
104
|
+
*/
|
|
105
105
|
toANSI(error: unknown, options?: CliOptions): Promise<{
|
|
106
106
|
errorAnsi: string;
|
|
107
107
|
solutionBox: undefined | string;
|
|
108
108
|
}>;
|
|
109
109
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
* Render error to a structured JSON payload.
|
|
111
|
+
*/
|
|
112
112
|
toJSON(error: unknown, options?: ToJsonOptions): ReturnType<typeof toJSON>;
|
|
113
113
|
}
|
|
114
114
|
export { CliOptions, Ono, type OnoJson, type OnoJsonError, type OnoJsonFrame, TemplateOptions, type ToJsonOptions, renderAnsi, renderHtml, renderJson };
|