@visulima/ono 1.0.10 → 1.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/error-inspector/components/causes-viewer/index.d.ts +7 -0
  3. package/dist/error-inspector/components/copy-button.d.ts +8 -0
  4. package/dist/error-inspector/components/copy-dropdown.d.ts +10 -0
  5. package/dist/error-inspector/components/error-card/index.d.ts +13 -0
  6. package/dist/error-inspector/components/error-card/solutions.d.ts +7 -0
  7. package/dist/error-inspector/components/error-card/sticky-header.d.ts +5 -0
  8. package/dist/error-inspector/components/header-bar/editor-selector.d.ts +3 -0
  9. package/dist/error-inspector/components/header-bar/index.d.ts +11 -0
  10. package/dist/error-inspector/components/header-bar/theme-toggle.d.ts +6 -0
  11. package/dist/error-inspector/components/header-tabs.d.ts +10 -0
  12. package/dist/error-inspector/components/raw-stack-trace.d.ts +2 -0
  13. package/dist/error-inspector/components/shortcuts-button.d.ts +5 -0
  14. package/dist/error-inspector/components/stack-trace-viewer/index.d.ts +7 -0
  15. package/dist/error-inspector/components/stack-trace-viewer/types.d.ts +5 -0
  16. package/dist/error-inspector/components/stack-trace-viewer/utils/get-type.d.ts +3 -0
  17. package/dist/error-inspector/components/stack-trace-viewer/utils/group-similar-types.d.ts +4 -0
  18. package/dist/error-inspector/components/tooltip.d.ts +4 -0
  19. package/dist/error-inspector/index.d.ts +6 -0
  20. package/dist/error-inspector/layout.d.ts +12 -0
  21. package/dist/error-inspector/page/create-request-context.d.ts +3 -44
  22. package/dist/error-inspector/page/stack.d.ts +15 -0
  23. package/dist/error-inspector/page/types.d.ts +62 -0
  24. package/dist/error-inspector/types.d.ts +43 -0
  25. package/dist/error-inspector/utils/cn.d.ts +2 -0
  26. package/dist/error-inspector/utils/sanitize.d.ts +7 -0
  27. package/dist/index.d.ts +12 -26
  28. package/dist/index.js +121 -122
  29. package/dist/server/open-in-editor.d.ts +19 -9
  30. package/dist/server/open-in-editor.js +1 -1
  31. package/dist/types.d.ts +1 -0
  32. package/dist/utils/process.d.ts +7 -0
  33. package/dist/utils/revision-hash.d.ts +2 -0
  34. package/dist/utils/runtimes.d.ts +3 -0
  35. package/package.json +16 -16
  36. package/dist/packem_shared/types-B8vYgwmD.d.ts +0 -53
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## @visulima/ono [1.0.11](https://github.com/visulima/visulima/compare/@visulima/ono@1.0.10...@visulima/ono@1.0.11) (2025-11-12)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/error:** upgraded to 5.0.5
11
+ * **@visulima/path:** upgraded to 2.0.4
12
+
1
13
  ## @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
14
 
3
15
  ### Bug Fixes
@@ -0,0 +1,7 @@
1
+ declare const causes: (causeList: unknown[], options?: {
2
+ openInEditorUrl?: string;
3
+ }) => Promise<{
4
+ html: string;
5
+ script: string;
6
+ }>;
7
+ export default causes;
@@ -0,0 +1,8 @@
1
+ declare const copyButton: ({ label, successText, targetId }: {
2
+ label?: string;
3
+ successText?: string;
4
+ targetId: string;
5
+ }) => {
6
+ html: string;
7
+ };
8
+ export default copyButton;
@@ -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,5 @@
1
+ declare const stickyHeader: (error: Error) => Promise<{
2
+ html: string;
3
+ script: string;
4
+ }>;
5
+ export default stickyHeader;
@@ -0,0 +1,3 @@
1
+ import Editors from "../../../../../../shared/utils/editors.d.ts";
2
+ declare const editorSelector: (editor?: Editors) => string;
3
+ export default editorSelector;
@@ -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 { Theme } from "../../../types.d.ts";
2
+ declare const themeToggle: (theme?: Theme) => {
3
+ html: string;
4
+ script: string;
5
+ };
6
+ export default themeToggle;
@@ -0,0 +1,10 @@
1
+ export type HeaderTab = {
2
+ icon?: string;
3
+ id: string;
4
+ name: string;
5
+ selected?: boolean;
6
+ };
7
+ export declare const headerTabs: (tabs: HeaderTab[]) => {
8
+ html: string;
9
+ script: string;
10
+ };
@@ -0,0 +1,2 @@
1
+ declare const rawStackTrace: (stack?: string) => string;
2
+ export default rawStackTrace;
@@ -0,0 +1,5 @@
1
+ declare const shortcutsButton: () => {
2
+ html: string;
3
+ script: string;
4
+ };
5
+ export default shortcutsButton;
@@ -0,0 +1,7 @@
1
+ declare const stackTraceViewer: (error: Error, options?: {
2
+ openInEditorUrl?: string;
3
+ }) => Promise<{
4
+ html: string;
5
+ script: string;
6
+ }>;
7
+ export default stackTraceViewer;
@@ -0,0 +1,5 @@
1
+ export type GroupType = "internal" | "node_modules" | "webpack" | "native" | "bun" | undefined;
2
+ export type Item = {
3
+ html: string;
4
+ type: GroupType;
5
+ };
@@ -0,0 +1,3 @@
1
+ import type { GroupType } from "../types.d.ts";
2
+ declare const getType: (filePath: string) => GroupType;
3
+ export default getType;
@@ -0,0 +1,4 @@
1
+ import type { Item } from "../types.d.ts";
2
+ type Grouped = Item | Item[];
3
+ declare const groupSimilarTypes: (list: Item[]) => Grouped[];
4
+ export default groupSimilarTypes;
@@ -0,0 +1,4 @@
1
+ declare const tooltip: ({ message }?: {
2
+ message?: string;
3
+ }) => string;
4
+ export default tooltip;
@@ -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 { C as ContentPage } from '../../packem_shared/types-B8vYgwmD.js';
2
- import { IncomingMessage } from 'node:http';
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,2 @@
1
+ export declare const cn: (...inputs: (string | false | null | undefined)[]) => string;
2
+ export default cn;
@@ -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 '@visulima/error/solution';
2
- import { RenderErrorOptions } from '@visulima/error/error';
3
- import { T as TemplateOptions$1 } from './packem_shared/types-B8vYgwmD.js';
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
- type TemplateOptions = TemplateOptions$1 & {
22
- solutionFinders?: SolutionFinder[];
23
- };
24
- type CliOptions = BaseCliOptions;
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 };