adaptar-vite-plugin 1.0.0 → 1.0.3
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/dist/hmr-interceptor.js +1 -1
- package/dist/index.d.ts +1 -2
- package/package.json +3 -3
- package/src/hmr-interceptor.ts +3 -3
- package/src/index.ts +2 -3
package/dist/hmr-interceptor.js
CHANGED
|
@@ -16,7 +16,7 @@ export function interceptHmrErrors(server) {
|
|
|
16
16
|
let suppressReloadUntil = 0;
|
|
17
17
|
// Cast to any to override — Vite 7 exposes an overloaded signature that
|
|
18
18
|
// TypeScript cannot directly assign to. We restore full type safety inside
|
|
19
|
-
// the function body by narrowing against
|
|
19
|
+
// the function body by narrowing against HMRPayload ourselves.
|
|
20
20
|
server.ws.send = function (payload) {
|
|
21
21
|
if (payload && typeof payload === "object") {
|
|
22
22
|
// ── Fatal build / HMR error ──────────────────────────────────────────
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
1
|
/**
|
|
3
2
|
* Adaptar Vite Plugin
|
|
4
3
|
*
|
|
@@ -11,4 +10,4 @@ import type { Plugin } from "vite";
|
|
|
11
10
|
* 3. `hmr-interceptor` — intercepts Vite's internal WebSocket to surface
|
|
12
11
|
* build/HMR errors as structured `adaptar:error` events.
|
|
13
12
|
*/
|
|
14
|
-
export declare function adaptar():
|
|
13
|
+
export declare function adaptar(): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptar-vite-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Vite plugin for Adaptar preview error and selection bridging",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^20.0.0",
|
|
14
14
|
"typescript": "^5.0.0",
|
|
15
|
-
"vite": "^
|
|
15
|
+
"vite": "^5.4.19"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"vite": ">=
|
|
18
|
+
"vite": ">=4.0.0"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [],
|
|
21
21
|
"author": "",
|
package/src/hmr-interceptor.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ViteDevServer,
|
|
1
|
+
import type { ViteDevServer, HMRPayload } from "vite";
|
|
2
2
|
|
|
3
3
|
export interface AdaptarErrorPayload {
|
|
4
4
|
message: string;
|
|
@@ -31,8 +31,8 @@ export function interceptHmrErrors(server: ViteDevServer): void {
|
|
|
31
31
|
|
|
32
32
|
// Cast to any to override — Vite 7 exposes an overloaded signature that
|
|
33
33
|
// TypeScript cannot directly assign to. We restore full type safety inside
|
|
34
|
-
// the function body by narrowing against
|
|
35
|
-
(server.ws as any).send = function (payload:
|
|
34
|
+
// the function body by narrowing against HMRPayload ourselves.
|
|
35
|
+
(server.ws as any).send = function (payload: HMRPayload): void {
|
|
36
36
|
if (payload && typeof payload === "object") {
|
|
37
37
|
// ── Fatal build / HMR error ──────────────────────────────────────────
|
|
38
38
|
if (payload.type === "error") {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
1
|
import { interceptHmrErrors } from "./hmr-interceptor.js";
|
|
3
2
|
import { buildHtmlTags } from "./html-tags.js";
|
|
4
3
|
|
|
@@ -14,7 +13,7 @@ import { buildHtmlTags } from "./html-tags.js";
|
|
|
14
13
|
* 3. `hmr-interceptor` — intercepts Vite's internal WebSocket to surface
|
|
15
14
|
* build/HMR errors as structured `adaptar:error` events.
|
|
16
15
|
*/
|
|
17
|
-
export function adaptar():
|
|
16
|
+
export function adaptar(): any {
|
|
18
17
|
return {
|
|
19
18
|
name: "adaptar-vite-bridge",
|
|
20
19
|
enforce: "pre",
|
|
@@ -34,7 +33,7 @@ export function adaptar(): Plugin {
|
|
|
34
33
|
return buildHtmlTags();
|
|
35
34
|
},
|
|
36
35
|
|
|
37
|
-
configureServer(server) {
|
|
36
|
+
configureServer(server: any) {
|
|
38
37
|
interceptHmrErrors(server);
|
|
39
38
|
},
|
|
40
39
|
};
|