@visulima/vite-overlay 2.0.0-alpha.33 → 2.0.0-alpha.34
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 +18 -0
- package/README.md +40 -19
- package/dist/index.d.ts +97 -13
- package/dist/index.js +118 -123
- package/dist/packem_shared/createViteSolutionFinder-DcYc-9Gb.js +4 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## @visulima/vite-overlay [2.0.0-alpha.34](https://github.com/visulima/visulima/compare/@visulima/vite-overlay@2.0.0-alpha.33...@visulima/vite-overlay@2.0.0-alpha.34) (2026-06-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **vite-overlay:** harden xss/redos and fix suggestion ranking in overlay ([fa7d531](https://github.com/visulima/visulima/commit/fa7d531915bde1f0fe57226f4efdc1cc1fc00ec6))
|
|
6
|
+
* **vite-overlay:** restore plugin-hint fallback, Svelte hint, and XSS escaping ([15a4162](https://github.com/visulima/visulima/commit/15a41624c7f9045cebbd246821fb4a5cab28b07c))
|
|
7
|
+
* **vite-overlay:** sanitize markdown, cache dir walk ([5430c78](https://github.com/visulima/visulima/commit/5430c780ab97b692d8e968900ba7b2564f19944a))
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* **vite-overlay:** apply prettier style cleanup to src and tests ([77f376b](https://github.com/visulima/visulima/commit/77f376bd9a04032af01ba53392882d2dc95e4619))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.33
|
|
17
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.13
|
|
18
|
+
|
|
1
19
|
## @visulima/vite-overlay [2.0.0-alpha.33](https://github.com/visulima/visulima/compare/@visulima/vite-overlay@2.0.0-alpha.32...@visulima/vite-overlay@2.0.0-alpha.33) (2026-06-04)
|
|
2
20
|
|
|
3
21
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -93,14 +93,23 @@ export default defineConfig({
|
|
|
93
93
|
// Array of console method names to forward (default: ["error"])
|
|
94
94
|
forwardedConsoleMethods: ["error", "warn"],
|
|
95
95
|
|
|
96
|
-
// Custom
|
|
96
|
+
// Custom plugin names for framework detection (all optional)
|
|
97
97
|
reactPluginName: "@vitejs/plugin-react",
|
|
98
|
-
|
|
99
|
-
// Custom Vue plugin name for detection (optional)
|
|
100
98
|
vuePluginName: "@vitejs/plugin-vue",
|
|
99
|
+
sveltePluginName: "@sveltejs/vite-plugin-svelte",
|
|
100
|
+
preactPluginName: "@preact/preset-vite",
|
|
101
|
+
solidPluginName: "vite-plugin-solid",
|
|
102
|
+
|
|
103
|
+
// Explicit framework override; skips auto-detection (optional)
|
|
104
|
+
// "react" | "vue" | "svelte" | "preact" | "solid"
|
|
105
|
+
framework: "react",
|
|
106
|
+
|
|
107
|
+
// Capture process-wide unhandled rejections and show them in the overlay (default: true).
|
|
108
|
+
// Set to false to leave Node's default crash semantics untouched.
|
|
109
|
+
interceptUnhandledRejection: true,
|
|
101
110
|
|
|
102
111
|
// Whether to show the balloon button in the overlay (default: true)
|
|
103
|
-
|
|
112
|
+
showBalloonButton: true,
|
|
104
113
|
|
|
105
114
|
// Overlay configuration (optional)
|
|
106
115
|
overlay: {
|
|
@@ -138,19 +147,25 @@ export default defineConfig({
|
|
|
138
147
|
|
|
139
148
|
#### Options
|
|
140
149
|
|
|
141
|
-
| Option
|
|
142
|
-
|
|
|
143
|
-
| `forwardConsole`
|
|
144
|
-
| `forwardedConsoleMethods`
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
150
|
+
| Option | Type | Default | Description |
|
|
151
|
+
| ----------------------------- | ----------------------------------------------------- | ----------- | -------------------------------------------------------------------------------- |
|
|
152
|
+
| `forwardConsole` | `boolean` | `true` | Enable/disable client-side runtime error logging and overlay display |
|
|
153
|
+
| `forwardedConsoleMethods` | `string[]` | `["error"]` | Array of console method names to intercept and forward to overlay |
|
|
154
|
+
| `framework` | `"react" \| "vue" \| "svelte" \| "preact" \| "solid"` | `undefined` | Explicit framework override; skips auto-detection |
|
|
155
|
+
| `interceptUnhandledRejection` | `boolean` | `true` | Capture process-wide `unhandledRejection` and render it in the overlay |
|
|
156
|
+
| `reactPluginName` | `string` | `undefined` | Custom React plugin name for detection |
|
|
157
|
+
| `vuePluginName` | `string` | `undefined` | Custom Vue plugin name for detection |
|
|
158
|
+
| `sveltePluginName` | `string` | `undefined` | Custom Svelte plugin name for detection |
|
|
159
|
+
| `preactPluginName` | `string` | `undefined` | Custom Preact plugin name for detection |
|
|
160
|
+
| `solidPluginName` | `string` | `undefined` | Custom Solid plugin name for detection |
|
|
161
|
+
| `showBalloonButton` | `boolean` | `true` | Whether to show the floating balloon button for error navigation |
|
|
162
|
+
| `overlay` | `OverlayConfig` | `undefined` | Overlay configuration options |
|
|
163
|
+
| `overlay.balloon` | `BalloonConfig` | `undefined` | Balloon button configuration |
|
|
164
|
+
| `overlay.balloon.style` | `string \| CSS.Properties` | `undefined` | Balloon button styles (string or CSS.Properties object) |
|
|
165
|
+
| `overlay.customCSS` | `string \| CSS.Properties` | `undefined` | Custom CSS to inject for styling customization (string or CSS.Properties object) |
|
|
166
|
+
| `solutionFinders` | `SolutionFinder[]` | `[]` | Array of custom solution finder functions for enhanced error analysis |
|
|
167
|
+
| `showBallonButton` | `boolean` | `undefined` | **@deprecated** Misspelling of `showBalloonButton` |
|
|
168
|
+
| `logClientRuntimeError` | `boolean` | `undefined` | **@deprecated** Use `forwardConsole` instead |
|
|
154
169
|
|
|
155
170
|
## Error Handling
|
|
156
171
|
|
|
@@ -188,7 +203,7 @@ When errors occur, a floating balloon button appears in the bottom-right corner
|
|
|
188
203
|
- Navigate through multiple errors
|
|
189
204
|
- Access error overlay controls
|
|
190
205
|
|
|
191
|
-
The balloon button can be disabled by setting `
|
|
206
|
+
The balloon button can be disabled by setting `showBalloonButton: false` in the plugin options.
|
|
192
207
|
|
|
193
208
|
### Keyboard Shortcuts
|
|
194
209
|
|
|
@@ -202,10 +217,16 @@ The balloon button can be disabled by setting `showBallonButton: false` in the p
|
|
|
202
217
|
|
|
203
218
|
You can extend the plugin with custom solution finders:
|
|
204
219
|
|
|
220
|
+
All public option types are exported from the package, so you can type a shared config object or a custom solution finder without reaching into `@visulima/error`:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import type { BalloonConfig, BalloonPosition, OverlayConfig, SolutionFinder, VisulimaViteOverlayOptions } from "@visulima/vite-overlay";
|
|
224
|
+
```
|
|
225
|
+
|
|
205
226
|
```typescript
|
|
206
227
|
import { defineConfig } from "vite";
|
|
207
228
|
import errorOverlay from "@visulima/vite-overlay";
|
|
208
|
-
import type { SolutionFinder } from "@visulima/
|
|
229
|
+
import type { SolutionFinder } from "@visulima/vite-overlay";
|
|
209
230
|
|
|
210
231
|
const customSolutionFinder: SolutionFinder = {
|
|
211
232
|
name: "custom-finder",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { SolutionFinder } from '@visulima/error/solution';
|
|
2
1
|
import { Plugin } from 'vite';
|
|
3
2
|
import '@visulima/error/error';
|
|
3
|
+
import { SolutionFinder } from '@visulima/error/solution';
|
|
4
|
+
export type { Solution, SolutionFinder } from '@visulima/error/solution';
|
|
4
5
|
import { Properties } from 'csstype';
|
|
5
6
|
/**
|
|
7
|
+
* Framework hint used to route framework-aware solutions. When omitted, the plugin
|
|
8
|
+
* auto-detects the framework from the configured Vite plugins.
|
|
9
|
+
*/
|
|
10
|
+
type Framework = "preact" | "react" | "solid" | "svelte" | "vue";
|
|
11
|
+
/**
|
|
6
12
|
* Balloon position options
|
|
7
13
|
*/
|
|
8
14
|
type BalloonPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
@@ -33,6 +39,87 @@ interface OverlayConfig {
|
|
|
33
39
|
*/
|
|
34
40
|
readonly customCSS?: string | Properties;
|
|
35
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Options accepted by the `@visulima/vite-overlay` plugin.
|
|
44
|
+
*/
|
|
45
|
+
interface VisulimaViteOverlayOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Whether client runtime errors are forwarded to (and displayed in) the overlay.
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
readonly forwardConsole?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Console method names to forward from the client (e.g. `["error", "warn"]`).
|
|
53
|
+
* @default ["error"]
|
|
54
|
+
*/
|
|
55
|
+
readonly forwardedConsoleMethods?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* Explicitly set the framework used for framework-aware hints. When omitted, the plugin
|
|
58
|
+
* auto-detects React / Vue / Svelte / Preact / Solid from the configured Vite plugins.
|
|
59
|
+
*/
|
|
60
|
+
readonly framework?: Framework;
|
|
61
|
+
/**
|
|
62
|
+
* Capture process-wide `unhandledRejection` events and render them in the overlay.
|
|
63
|
+
* Set to `false` to leave Node's default crash semantics untouched (useful when other
|
|
64
|
+
* tooling in the dev process produces unrelated rejections).
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
readonly interceptUnhandledRejection?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use {@link VisulimaViteOverlayOptions.forwardConsole} instead.
|
|
70
|
+
*/
|
|
71
|
+
readonly logClientRuntimeError?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Overlay UI configuration (balloon button, custom CSS).
|
|
74
|
+
*/
|
|
75
|
+
readonly overlay?: OverlayConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Custom Preact plugin name to match during auto-detection.
|
|
78
|
+
*/
|
|
79
|
+
readonly preactPluginName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Custom React plugin name to match during auto-detection.
|
|
82
|
+
*/
|
|
83
|
+
readonly reactPluginName?: string;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Misspelling of {@link VisulimaViteOverlayOptions.showBalloonButton}. Kept for
|
|
86
|
+
* backward compatibility; prefer `showBalloonButton` or `overlay.balloon.enabled`.
|
|
87
|
+
*/
|
|
88
|
+
readonly showBallonButton?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to show the balloon button.
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
readonly showBalloonButton?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Custom Solid plugin name to match during auto-detection.
|
|
96
|
+
*/
|
|
97
|
+
readonly solidPluginName?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Custom solution finders to run before the built-in finders.
|
|
100
|
+
*/
|
|
101
|
+
readonly solutionFinders?: SolutionFinder[];
|
|
102
|
+
/**
|
|
103
|
+
* Custom Svelte plugin name to match during auto-detection.
|
|
104
|
+
*/
|
|
105
|
+
readonly sveltePluginName?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Custom Vue plugin name to match during auto-detection.
|
|
108
|
+
*/
|
|
109
|
+
readonly vuePluginName?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates a solution finder specifically designed for Vite-related errors.
|
|
113
|
+
* Provides intelligent suggestions for common Vite import resolution and configuration issues.
|
|
114
|
+
* @param rootPath The root path of the project
|
|
115
|
+
* @returns A solution finder object for Vite-specific error handling
|
|
116
|
+
*/
|
|
117
|
+
declare const createViteSolutionFinder: (rootPath: string) => SolutionFinder;
|
|
118
|
+
/**
|
|
119
|
+
* Default export for creating Vite solution finders.
|
|
120
|
+
* @see createViteSolutionFinder
|
|
121
|
+
*/
|
|
122
|
+
|
|
36
123
|
/**
|
|
37
124
|
* Main Vite plugin for error overlay functionality.
|
|
38
125
|
* Intercepts runtime errors and displays them in a user-friendly overlay.
|
|
@@ -43,22 +130,19 @@ interface OverlayConfig {
|
|
|
43
130
|
* @param options.reactPluginName Custom React plugin name (optional)
|
|
44
131
|
* @param options.solutionFinders Custom solution finders (optional)
|
|
45
132
|
* @param options.vuePluginName Custom Vue plugin name (optional)
|
|
46
|
-
* @param options.
|
|
133
|
+
* @param options.sveltePluginName Custom Svelte plugin name (optional)
|
|
134
|
+
* @param options.preactPluginName Custom Preact plugin name (optional)
|
|
135
|
+
* @param options.solidPluginName Custom Solid plugin name (optional)
|
|
136
|
+
* @param options.framework Explicit framework override; skips auto-detection (optional)
|
|
137
|
+
* @param options.interceptUnhandledRejection Capture process-wide unhandled rejections (optional, default true)
|
|
138
|
+
* @param options.showBalloonButton Whether to show the balloon button (optional)
|
|
139
|
+
* @param options.showBallonButton [deprecated] Misspelling of showBalloonButton
|
|
47
140
|
* @param options.overlay Overlay configuration (optional)
|
|
48
141
|
* @returns The Vite plugin configuration
|
|
49
142
|
*/
|
|
50
|
-
declare const errorOverlayPlugin: (options?:
|
|
51
|
-
forwardConsole?: boolean;
|
|
52
|
-
forwardedConsoleMethods?: string[];
|
|
53
|
-
logClientRuntimeError?: boolean;
|
|
54
|
-
overlay?: OverlayConfig;
|
|
55
|
-
reactPluginName?: string;
|
|
56
|
-
showBallonButton?: boolean;
|
|
57
|
-
solutionFinders?: SolutionFinder[];
|
|
58
|
-
vuePluginName?: string;
|
|
59
|
-
}) => Plugin;
|
|
143
|
+
declare const errorOverlayPlugin: (options?: VisulimaViteOverlayOptions) => Plugin;
|
|
60
144
|
/**
|
|
61
145
|
* Default export of the Vite error overlay plugin.
|
|
62
146
|
* Use this plugin to enable error overlay functionality in your Vite project.
|
|
63
147
|
*/
|
|
64
|
-
export { errorOverlayPlugin as default };
|
|
148
|
+
export { type BalloonConfig, type BalloonPosition, type BalloonStyle, type Framework, type OverlayConfig, type VisulimaViteOverlayOptions, createViteSolutionFinder, errorOverlayPlugin as default };
|