release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
@@ -2,6 +2,7 @@ import type { DevToolbarCollector } from "./collector.ts";
import { DEV_TOOLBAR_CSS, DEV_TOOLBAR_RUNTIME } from "../client/index.ts";
import { openInEditor } from "./editor.ts";
import { serializeDevToolbarJson } from "./serialize.ts";
import type { DevToolbarPanel, DevToolbarPlatformSnapshot } from "../types.ts";
export interface DevToolbarRouteOptions {
mode: string;
@@ -9,6 +10,8 @@ export interface DevToolbarRouteOptions {
collector: DevToolbarCollector;
editor?: string;
allowOpenEditor?: boolean;
platform?: DevToolbarPlatformSnapshot;
panels?: DevToolbarPanel[];
}
const json = (value: unknown, status = 200) =>
@@ -36,6 +39,8 @@ export async function handleDevToolbarRoute(
return json({
issues: options.collector.getIssues(url.searchParams.get("pathname") ?? undefined),
});
if (url.pathname === "/__wrnexus/dev-toolbar/platform" && request.method === "GET")
return json({ platform: options.platform ?? null, panels: options.panels ?? [] });
if (url.pathname === "/__wrnexus/dev-toolbar/open-editor" && request.method === "POST") {
if (options.allowOpenEditor === false)
return json({ error: "Open in editor is disabled." }, 403);
+21
View File
@@ -132,3 +132,24 @@ declare global {
__wrnexusDevToolbar?: DevToolbarClientApi;
}
}
export interface DevToolbarPanel {
id: string;
title: string;
icon?: string;
description?: string;
badge?: number | string;
order?: number;
issues?: unknown[];
data?: unknown;
}
export interface DevToolbarPlatformSnapshot {
plugins?: Array<{ name: string; version?: string }>;
runtimes?: Array<{ id: string; publicPath?: string; type?: string; load?: string }>;
assets?: Array<{ id: string; publicPath?: string; contentType?: string }>;
componentDirs?: string[];
styles?: unknown[];
routes?: { pages: number; api: number; realtime: number };
[key: string]: unknown;
}