@visulima/ono 1.0.10 → 1.0.12
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 +24 -0
- package/dist/error-inspector/components/causes-viewer/index.d.ts +7 -0
- package/dist/error-inspector/components/copy-button.d.ts +8 -0
- package/dist/error-inspector/components/copy-dropdown.d.ts +10 -0
- package/dist/error-inspector/components/error-card/index.d.ts +13 -0
- package/dist/error-inspector/components/error-card/solutions.d.ts +7 -0
- package/dist/error-inspector/components/error-card/sticky-header.d.ts +5 -0
- package/dist/error-inspector/components/header-bar/editor-selector.d.ts +3 -0
- package/dist/error-inspector/components/header-bar/index.d.ts +11 -0
- package/dist/error-inspector/components/header-bar/theme-toggle.d.ts +6 -0
- package/dist/error-inspector/components/header-tabs.d.ts +10 -0
- package/dist/error-inspector/components/raw-stack-trace.d.ts +2 -0
- package/dist/error-inspector/components/shortcuts-button.d.ts +5 -0
- package/dist/error-inspector/components/stack-trace-viewer/index.d.ts +7 -0
- package/dist/error-inspector/components/stack-trace-viewer/types.d.ts +5 -0
- package/dist/error-inspector/components/stack-trace-viewer/utils/get-type.d.ts +3 -0
- package/dist/error-inspector/components/stack-trace-viewer/utils/group-similar-types.d.ts +4 -0
- package/dist/error-inspector/components/tooltip.d.ts +4 -0
- package/dist/error-inspector/index.d.ts +6 -0
- package/dist/error-inspector/layout.d.ts +12 -0
- package/dist/error-inspector/page/create-request-context.d.ts +3 -44
- package/dist/error-inspector/page/stack.d.ts +15 -0
- package/dist/error-inspector/page/types.d.ts +62 -0
- package/dist/error-inspector/types.d.ts +43 -0
- package/dist/error-inspector/utils/cn.d.ts +2 -0
- package/dist/error-inspector/utils/sanitize.d.ts +7 -0
- package/dist/index.d.ts +12 -26
- package/dist/index.js +121 -122
- package/dist/server/open-in-editor.d.ts +19 -9
- package/dist/server/open-in-editor.js +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils/process.d.ts +7 -0
- package/dist/utils/revision-hash.d.ts +2 -0
- package/dist/utils/runtimes.d.ts +3 -0
- package/package.json +16 -16
- package/dist/packem_shared/types-B8vYgwmD.d.ts +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## @visulima/ono [1.0.12](https://github.com/visulima/visulima/compare/@visulima/ono@1.0.11...@visulima/ono@1.0.12) (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/error:** upgraded to 5.0.6
|
|
11
|
+
* **@visulima/path:** upgraded to 2.0.5
|
|
12
|
+
|
|
13
|
+
## @visulima/ono [1.0.11](https://github.com/visulima/visulima/compare/@visulima/ono@1.0.10...@visulima/ono@1.0.11) (2025-11-12)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* **@visulima/error:** upgraded to 5.0.5
|
|
23
|
+
* **@visulima/path:** upgraded to 2.0.4
|
|
24
|
+
|
|
1
25
|
## @visulima/ono [1.0.10](https://github.com/visulima/visulima/compare/@visulima/ono@1.0.9...@visulima/ono@1.0.10) (2025-11-07)
|
|
2
26
|
|
|
3
27
|
### Bug Fixes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const copyDropdown: ({ label, secondaryLabel, secondaryText, successText, targetId, }: {
|
|
2
|
+
label?: string;
|
|
3
|
+
secondaryLabel?: string;
|
|
4
|
+
secondaryText: string;
|
|
5
|
+
successText?: string;
|
|
6
|
+
targetId: string;
|
|
7
|
+
}) => {
|
|
8
|
+
html: string;
|
|
9
|
+
};
|
|
10
|
+
export default copyDropdown;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VisulimaError } from "@visulima/error/error";
|
|
2
|
+
import type { SolutionError, SolutionFinder } from "@visulima/error/solution";
|
|
3
|
+
import type { RuntimeName } from "../../../utils/runtimes.d.ts";
|
|
4
|
+
declare const errorCard: ({ error, runtimeName, solutionFinders, version, }: {
|
|
5
|
+
error: Error | SolutionError | VisulimaError;
|
|
6
|
+
runtimeName: RuntimeName | undefined;
|
|
7
|
+
solutionFinders: SolutionFinder[];
|
|
8
|
+
version: string | undefined;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
html: string;
|
|
11
|
+
scripts: string[];
|
|
12
|
+
}>;
|
|
13
|
+
export default errorCard;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VisulimaError } from "@visulima/error/error";
|
|
2
|
+
import type { SolutionError, SolutionFinder } from "@visulima/error/solution";
|
|
3
|
+
declare const solutions: (error: Error | SolutionError | VisulimaError, solutionFinders?: SolutionFinder[]) => Promise<{
|
|
4
|
+
html: string;
|
|
5
|
+
script: string;
|
|
6
|
+
}>;
|
|
7
|
+
export default solutions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Editors from "../../../../../../shared/utils/editors.d.ts";
|
|
2
|
+
import type { Theme } from "../../../types.d.ts";
|
|
3
|
+
declare const headerBar: (options: Partial<{
|
|
4
|
+
editor: Editors;
|
|
5
|
+
openInEditorUrl?: string;
|
|
6
|
+
theme: Theme;
|
|
7
|
+
}>, hasContextTab?: boolean) => {
|
|
8
|
+
html: string;
|
|
9
|
+
script: string;
|
|
10
|
+
};
|
|
11
|
+
export default headerBar;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VisulimaError } from "@visulima/error/error";
|
|
2
|
+
import type { SolutionError, SolutionFinder } from "@visulima/error/solution";
|
|
3
|
+
import type { TemplateOptions } from "./types.d.ts";
|
|
4
|
+
type ErrorType = Error | SolutionError | VisulimaError;
|
|
5
|
+
declare const template: (error: ErrorType, solutionFinders?: SolutionFinder[], options?: TemplateOptions) => Promise<string>;
|
|
6
|
+
export default template;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Theme } from "../types.d.ts";
|
|
2
|
+
declare const layout: ({ content, cspNonce, css, description, error, scripts, theme, title, }: {
|
|
3
|
+
content: string;
|
|
4
|
+
cspNonce?: string;
|
|
5
|
+
css: string;
|
|
6
|
+
description: string;
|
|
7
|
+
error: Error;
|
|
8
|
+
scripts: string[];
|
|
9
|
+
theme?: Theme;
|
|
10
|
+
title: string;
|
|
11
|
+
}) => string;
|
|
12
|
+
export default layout;
|
|
@@ -1,45 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type NativeRequest = typeof globalThis.Request;
|
|
5
|
-
type NativeHeaders = typeof globalThis.Headers;
|
|
6
|
-
interface CustomHeaders {
|
|
7
|
-
entries: () => IterableIterator<[string, string]>;
|
|
8
|
-
forEach: (callback: (value: string, key: string) => void) => void;
|
|
9
|
-
get: (name: string) => string | null;
|
|
10
|
-
}
|
|
11
|
-
interface CustomRequest {
|
|
12
|
-
clone?: () => CustomRequest;
|
|
13
|
-
headers?: Record<string, string | string[]> | CustomHeaders;
|
|
14
|
-
json?: () => Promise<unknown>;
|
|
15
|
-
method?: string;
|
|
16
|
-
text?: () => Promise<string>;
|
|
17
|
-
url?: string;
|
|
18
|
-
}
|
|
19
|
-
type HeadersLike = NativeHeaders | CustomHeaders;
|
|
20
|
-
type RequestLike = NativeRequest | (IncomingMessage & {
|
|
21
|
-
body?: unknown;
|
|
22
|
-
clone?: () => RequestLike;
|
|
23
|
-
json?: () => Promise<unknown>;
|
|
24
|
-
text?: () => Promise<string>;
|
|
25
|
-
}) | CustomRequest | {
|
|
26
|
-
body?: unknown;
|
|
27
|
-
headers?: Record<string, string | string[]> | HeadersLike;
|
|
28
|
-
method?: string;
|
|
29
|
-
off?: (event: string, handler: (chunk: unknown) => void) => void;
|
|
30
|
-
on?: (event: string, handler: (chunk: unknown) => void) => void;
|
|
31
|
-
setEncoding?: (encoding: string) => void;
|
|
32
|
-
url?: string;
|
|
33
|
-
};
|
|
34
|
-
type ContextContentOptions = {
|
|
35
|
-
context?: Record<string, unknown>;
|
|
36
|
-
headerAllowlist?: string[];
|
|
37
|
-
headerDenylist?: string[];
|
|
38
|
-
maskValue?: string;
|
|
39
|
-
previewBytes?: number;
|
|
40
|
-
totalCapBytes?: number;
|
|
41
|
-
};
|
|
42
|
-
|
|
1
|
+
import type { ContentPage } from "../types.d.ts";
|
|
2
|
+
import type { ContextContentOptions, RequestLike } from "./types.d.ts";
|
|
43
3
|
declare const createRequestContext: (request: RequestLike, options: ContextContentOptions) => Promise<ContentPage | undefined>;
|
|
44
|
-
|
|
45
|
-
export { createRequestContext as default };
|
|
4
|
+
export default createRequestContext;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VisulimaError } from "@visulima/error/error";
|
|
2
|
+
import type { SolutionError, SolutionFinder } from "@visulima/error/solution";
|
|
3
|
+
import type { ContentPage, TemplateOptions } from "../types.d.ts";
|
|
4
|
+
type ErrorType = Error | SolutionError | VisulimaError;
|
|
5
|
+
/**
|
|
6
|
+
* Generates the stack page content for the error inspector
|
|
7
|
+
* This page displays error details, stack traces, and related causes
|
|
8
|
+
* @param error The main error to display
|
|
9
|
+
* @param solutionFinders Array of solution finder functions
|
|
10
|
+
* @param options Template options including sanitization settings
|
|
11
|
+
* @returns Promise resolving to content page data
|
|
12
|
+
* @throws TypeError if input validation fails
|
|
13
|
+
*/
|
|
14
|
+
declare const stack: (error: ErrorType, solutionFinders?: SolutionFinder[], options?: TemplateOptions) => Promise<ContentPage>;
|
|
15
|
+
export default stack;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IncomingMessage } from "node:http";
|
|
2
|
+
type NativeRequest = typeof globalThis.Request;
|
|
3
|
+
type NativeHeaders = typeof globalThis.Headers;
|
|
4
|
+
interface CustomHeaders {
|
|
5
|
+
entries: () => IterableIterator<[string, string]>;
|
|
6
|
+
forEach: (callback: (value: string, key: string) => void) => void;
|
|
7
|
+
get: (name: string) => string | null;
|
|
8
|
+
}
|
|
9
|
+
interface CustomRequest {
|
|
10
|
+
clone?: () => CustomRequest;
|
|
11
|
+
headers?: Record<string, string | string[]> | CustomHeaders;
|
|
12
|
+
json?: () => Promise<unknown>;
|
|
13
|
+
method?: string;
|
|
14
|
+
text?: () => Promise<string>;
|
|
15
|
+
url?: string;
|
|
16
|
+
}
|
|
17
|
+
type HeadersLike = NativeHeaders | CustomHeaders;
|
|
18
|
+
type RequestLikeType = NativeRequest | CustomRequest;
|
|
19
|
+
type RequestLike = NativeRequest | (IncomingMessage & {
|
|
20
|
+
body?: unknown;
|
|
21
|
+
clone?: () => RequestLike;
|
|
22
|
+
json?: () => Promise<unknown>;
|
|
23
|
+
text?: () => Promise<string>;
|
|
24
|
+
}) | CustomRequest | {
|
|
25
|
+
body?: unknown;
|
|
26
|
+
headers?: Record<string, string | string[]> | HeadersLike;
|
|
27
|
+
method?: string;
|
|
28
|
+
off?: (event: string, handler: (chunk: unknown) => void) => void;
|
|
29
|
+
on?: (event: string, handler: (chunk: unknown) => void) => void;
|
|
30
|
+
setEncoding?: (encoding: string) => void;
|
|
31
|
+
url?: string;
|
|
32
|
+
};
|
|
33
|
+
type ExpressRequest = {
|
|
34
|
+
body?: unknown;
|
|
35
|
+
headers?: Record<string, string | string[]> | HeadersLike;
|
|
36
|
+
method?: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const isNativeRequest: (request: RequestLike) => request is NativeRequest;
|
|
40
|
+
export declare const isIncomingMessage: (request: RequestLike) => request is IncomingMessage;
|
|
41
|
+
export declare const isExpressRequest: (request: RequestLike) => request is ExpressRequest;
|
|
42
|
+
export declare const isHeadersObject: (object: unknown) => object is HeadersLike;
|
|
43
|
+
export type HeaderValue = string | string[] | undefined;
|
|
44
|
+
export type HeadersRecord = Record<string, HeaderValue>;
|
|
45
|
+
export type HeadersInput = HeadersRecord | HeadersLike | undefined;
|
|
46
|
+
export type HeadersOutput = Record<string, string | string[]> | undefined;
|
|
47
|
+
export type ContextContentOptions = {
|
|
48
|
+
context?: Record<string, unknown>;
|
|
49
|
+
headerAllowlist?: string[];
|
|
50
|
+
headerDenylist?: string[];
|
|
51
|
+
maskValue?: string;
|
|
52
|
+
previewBytes?: number;
|
|
53
|
+
totalCapBytes?: number;
|
|
54
|
+
};
|
|
55
|
+
export type { HeadersLike, RequestLike, RequestLikeType };
|
|
56
|
+
export declare const runtime: {
|
|
57
|
+
hasNativeHeaders: boolean;
|
|
58
|
+
hasNativeRequest: boolean;
|
|
59
|
+
isBun: boolean;
|
|
60
|
+
isDeno: boolean;
|
|
61
|
+
isNodeJS: string | false;
|
|
62
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type Editors from "../../../../shared/utils/editors.d.ts";
|
|
2
|
+
import type { Theme } from "../types.d.ts";
|
|
3
|
+
export type RequestTimings = {
|
|
4
|
+
elapsedMs?: number;
|
|
5
|
+
end?: number;
|
|
6
|
+
start?: number;
|
|
7
|
+
};
|
|
8
|
+
export type AppContext = {
|
|
9
|
+
routing?: {
|
|
10
|
+
params?: Record<string, string>;
|
|
11
|
+
query?: Record<string, string | string[]>;
|
|
12
|
+
route?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type UserContext = {
|
|
16
|
+
client?: {
|
|
17
|
+
geo?: unknown;
|
|
18
|
+
ip?: string;
|
|
19
|
+
userAgent?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type GitContext = {
|
|
23
|
+
branch?: string;
|
|
24
|
+
commit?: string;
|
|
25
|
+
dirty?: boolean;
|
|
26
|
+
tag?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ContentPage = {
|
|
29
|
+
code: {
|
|
30
|
+
html: string;
|
|
31
|
+
script?: string;
|
|
32
|
+
};
|
|
33
|
+
defaultSelected?: boolean;
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
export type TemplateOptions = {
|
|
38
|
+
content?: ContentPage[];
|
|
39
|
+
cspNonce?: string;
|
|
40
|
+
editor?: Editors;
|
|
41
|
+
openInEditorUrl?: string;
|
|
42
|
+
theme?: Theme;
|
|
43
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TemplateOptions } from "../types.d.ts";
|
|
2
|
+
export declare const sanitizeHtml: (value: unknown) => string;
|
|
3
|
+
export declare const sanitizeAttribute: (value: unknown) => string;
|
|
4
|
+
export declare const sanitizeUrlAttribute: (value: unknown) => string;
|
|
5
|
+
export declare const sanitizeCodeHtml: (value: unknown) => string;
|
|
6
|
+
export declare const sanitizeCspNonce: (value: unknown) => string | undefined;
|
|
7
|
+
export declare const sanitizeOptions: (options?: TemplateOptions) => TemplateOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
import { SolutionFinder } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type ColorizeMethod = (value: string) => string;
|
|
6
|
-
type BaseCliOptions = {
|
|
7
|
-
solutionTitle?: string;
|
|
1
|
+
import type { SolutionFinder } from "@visulima/error/solution";
|
|
2
|
+
import type { BaseCliOptions } from "../../../shared/utils/cli-error-builder.d.ts";
|
|
3
|
+
import type { TemplateOptions as BaseTemplateOptions } from "./error-inspector/types.d.ts";
|
|
4
|
+
export type TemplateOptions = BaseTemplateOptions & {
|
|
8
5
|
solutionFinders?: SolutionFinder[];
|
|
9
|
-
debug?: boolean;
|
|
10
|
-
} & Partial<Omit<RenderErrorOptions, "color">> & {
|
|
11
|
-
color?: {
|
|
12
|
-
codeFrame?: RenderErrorOptions["color"];
|
|
13
|
-
boxen?: {
|
|
14
|
-
headerTextColor?: ColorizeMethod;
|
|
15
|
-
textColor?: ColorizeMethod;
|
|
16
|
-
borderColor?: ColorizeMethod;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
6
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
declare class Ono {
|
|
7
|
+
export type CliOptions = BaseCliOptions;
|
|
8
|
+
export declare class Ono {
|
|
9
|
+
/**
|
|
10
|
+
* Render error to HTML.
|
|
11
|
+
*/
|
|
26
12
|
toHTML(error: unknown, options?: TemplateOptions): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Render error to ANSI output.
|
|
15
|
+
*/
|
|
27
16
|
toANSI(error: unknown, options?: CliOptions): Promise<{
|
|
28
17
|
errorAnsi: string;
|
|
29
18
|
solutionBox: undefined | string;
|
|
30
19
|
}>;
|
|
31
20
|
}
|
|
32
|
-
|
|
33
|
-
export { Ono };
|
|
34
|
-
export type { CliOptions, TemplateOptions };
|