@fiyuu/runtime 0.1.0 → 0.1.1
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/package.json +5 -5
- package/src/bundler.ts +151 -0
- package/src/cli.ts +32 -0
- package/src/{client-runtime.js → client-runtime.ts} +3 -2
- package/src/inspector.ts +329 -0
- package/src/{server-devtools.js → server-devtools.ts} +22 -11
- package/src/server-loader.ts +213 -0
- package/src/server-middleware.ts +71 -0
- package/src/server-renderer.ts +260 -0
- package/src/server-router.ts +77 -0
- package/src/server-types.ts +198 -0
- package/src/server-utils.ts +137 -0
- package/src/server-websocket.ts +71 -0
- package/src/server.ts +1089 -0
- package/src/service.ts +97 -0
- package/LICENSE +0 -674
- package/README.md +0 -194
- package/src/bundler.d.ts +0 -9
- package/src/bundler.js +0 -124
- package/src/cli.d.ts +0 -2
- package/src/cli.js +0 -25
- package/src/client-runtime.d.ts +0 -15
- package/src/index.js +0 -4
- package/src/inspector.d.ts +0 -38
- package/src/inspector.js +0 -261
- package/src/server-devtools.d.ts +0 -13
- package/src/server-loader.d.ts +0 -26
- package/src/server-loader.js +0 -158
- package/src/server-middleware.d.ts +0 -7
- package/src/server-middleware.js +0 -49
- package/src/server-renderer.d.ts +0 -34
- package/src/server-renderer.js +0 -213
- package/src/server-router.d.ts +0 -14
- package/src/server-router.js +0 -67
- package/src/server-types.d.ts +0 -167
- package/src/server-types.js +0 -5
- package/src/server-utils.d.ts +0 -15
- package/src/server-utils.js +0 -97
- package/src/server-websocket.d.ts +0 -7
- package/src/server-websocket.js +0 -55
- package/src/server.d.ts +0 -68
- package/src/server.js +0 -779
- package/src/service.d.ts +0 -28
- package/src/service.js +0 -71
- /package/src/{index.d.ts → index.ts} +0 -0
package/src/server-types.d.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types and interfaces for the Fiyuu runtime server.
|
|
3
|
-
* All other server modules import from here — no implementation code.
|
|
4
|
-
*/
|
|
5
|
-
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
6
|
-
import type { WebSocket } from "ws";
|
|
7
|
-
import type { createProjectGraph, FeatureRecord, FiyuuConfig, MetaDefinition, RenderMode } from "@fiyuu/core";
|
|
8
|
-
import type { FiyuuDB } from "@fiyuu/db";
|
|
9
|
-
import type { FiyuuRealtime } from "@fiyuu/realtime";
|
|
10
|
-
import type { ClientAsset } from "./bundler.js";
|
|
11
|
-
import type { InsightsReport } from "./inspector.js";
|
|
12
|
-
export type { IncomingMessage, ServerResponse };
|
|
13
|
-
export type { FeatureRecord, FiyuuConfig, MetaDefinition, RenderMode };
|
|
14
|
-
export interface ModuleShape {
|
|
15
|
-
default?: unknown;
|
|
16
|
-
execute?: (context: any) => Promise<unknown> | unknown;
|
|
17
|
-
page?: {
|
|
18
|
-
intent: string;
|
|
19
|
-
};
|
|
20
|
-
cache?: {
|
|
21
|
-
ttl?: number;
|
|
22
|
-
vary?: string[];
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export interface LayoutModule {
|
|
26
|
-
default?: unknown;
|
|
27
|
-
}
|
|
28
|
-
export interface GeaRenderable {
|
|
29
|
-
props?: Record<string, unknown>;
|
|
30
|
-
template?: (props?: Record<string, unknown>) => string;
|
|
31
|
-
toString: () => string;
|
|
32
|
-
}
|
|
33
|
-
export interface ApiRouteModule {
|
|
34
|
-
GET?: (context: RequestContext) => Promise<unknown> | unknown;
|
|
35
|
-
POST?: (context: RequestContext) => Promise<unknown> | unknown;
|
|
36
|
-
PUT?: (context: RequestContext) => Promise<unknown> | unknown;
|
|
37
|
-
PATCH?: (context: RequestContext) => Promise<unknown> | unknown;
|
|
38
|
-
DELETE?: (context: RequestContext) => Promise<unknown> | unknown;
|
|
39
|
-
}
|
|
40
|
-
export interface SocketModule {
|
|
41
|
-
registerSocketServer?: () => {
|
|
42
|
-
namespace?: string;
|
|
43
|
-
events?: string[];
|
|
44
|
-
onConnect?: (socket: WebSocket) => void;
|
|
45
|
-
onMessage?: (socket: WebSocket, message: string) => void;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export interface MiddlewareModule {
|
|
49
|
-
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
|
50
|
-
}
|
|
51
|
-
export interface MiddlewareContext {
|
|
52
|
-
request: IncomingMessage;
|
|
53
|
-
url: URL;
|
|
54
|
-
responseHeaders: Record<string, string>;
|
|
55
|
-
requestId: string;
|
|
56
|
-
warnings: string[];
|
|
57
|
-
}
|
|
58
|
-
export interface MiddlewareResult {
|
|
59
|
-
headers?: Record<string, string>;
|
|
60
|
-
response?: {
|
|
61
|
-
status?: number;
|
|
62
|
-
json?: unknown;
|
|
63
|
-
body?: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
export type MiddlewareNext = () => Promise<void>;
|
|
67
|
-
export type MiddlewareHandler = (context: MiddlewareContext, next: MiddlewareNext) => Promise<MiddlewareResult | void> | MiddlewareResult | void;
|
|
68
|
-
export interface RequestContext {
|
|
69
|
-
request: IncomingMessage;
|
|
70
|
-
route: string;
|
|
71
|
-
feature: FeatureRecord | null;
|
|
72
|
-
input?: Record<string, unknown>;
|
|
73
|
-
}
|
|
74
|
-
export interface StartServerOptions {
|
|
75
|
-
mode: "dev" | "start";
|
|
76
|
-
rootDirectory: string;
|
|
77
|
-
appDirectory: string;
|
|
78
|
-
config?: FiyuuConfig;
|
|
79
|
-
port?: number;
|
|
80
|
-
maxPort?: number;
|
|
81
|
-
clientOutputDirectory: string;
|
|
82
|
-
staticClientRoot: string;
|
|
83
|
-
}
|
|
84
|
-
export interface StartedServer {
|
|
85
|
-
port: number;
|
|
86
|
-
url: string;
|
|
87
|
-
websocketUrl?: string;
|
|
88
|
-
close: () => Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
export interface QueryCacheEntry {
|
|
91
|
-
data: unknown;
|
|
92
|
-
expiresAt: number;
|
|
93
|
-
}
|
|
94
|
-
export interface SsgCacheEntry {
|
|
95
|
-
html: string;
|
|
96
|
-
etag: string;
|
|
97
|
-
expiresAt: number | null;
|
|
98
|
-
revalidateSeconds: number | null;
|
|
99
|
-
}
|
|
100
|
-
export interface RuntimeState {
|
|
101
|
-
graph: Awaited<ReturnType<typeof createProjectGraph>>;
|
|
102
|
-
features: FeatureRecord[];
|
|
103
|
-
routeIndex: RouteIndex;
|
|
104
|
-
assets: ClientAsset[];
|
|
105
|
-
assetsByRoute: Map<string, ClientAsset>;
|
|
106
|
-
insights: InsightsReport;
|
|
107
|
-
ssgCache: Map<string, SsgCacheEntry>;
|
|
108
|
-
queryCache: Map<string, QueryCacheEntry>;
|
|
109
|
-
queryInflight: Map<string, Promise<unknown>>;
|
|
110
|
-
queryCacheLastPruneAt: number;
|
|
111
|
-
layoutStackCache: Map<string, Array<{
|
|
112
|
-
component: unknown;
|
|
113
|
-
meta: MetaDefinition;
|
|
114
|
-
}>>;
|
|
115
|
-
featureMetaCache: Map<string, MetaDefinition>;
|
|
116
|
-
mergedMetaCache: Map<string, MetaDefinition>;
|
|
117
|
-
serverEvents: Array<{
|
|
118
|
-
at: string;
|
|
119
|
-
level: "info" | "warn" | "error";
|
|
120
|
-
event: string;
|
|
121
|
-
details?: string;
|
|
122
|
-
}>;
|
|
123
|
-
version: number;
|
|
124
|
-
warnings: string[];
|
|
125
|
-
db: FiyuuDB;
|
|
126
|
-
realtime: FiyuuRealtime;
|
|
127
|
-
serviceNames: string[];
|
|
128
|
-
}
|
|
129
|
-
export interface TinyRouteContext {
|
|
130
|
-
request: IncomingMessage;
|
|
131
|
-
response: ServerResponse;
|
|
132
|
-
url: URL;
|
|
133
|
-
state: RuntimeState;
|
|
134
|
-
options: StartServerOptions;
|
|
135
|
-
liveClients: Set<ServerResponse>;
|
|
136
|
-
}
|
|
137
|
-
export interface TinyRoute {
|
|
138
|
-
method: "GET" | "POST";
|
|
139
|
-
path: string;
|
|
140
|
-
type: "exact" | "prefix";
|
|
141
|
-
devOnly?: boolean;
|
|
142
|
-
handler: (context: TinyRouteContext) => Promise<void> | void;
|
|
143
|
-
}
|
|
144
|
-
export interface StatusPageInput {
|
|
145
|
-
statusCode: number;
|
|
146
|
-
title: string;
|
|
147
|
-
summary: string;
|
|
148
|
-
detail?: string;
|
|
149
|
-
route?: string;
|
|
150
|
-
method?: string;
|
|
151
|
-
requestId?: string;
|
|
152
|
-
hints?: string[];
|
|
153
|
-
diagnostics?: string[];
|
|
154
|
-
}
|
|
155
|
-
export interface RouteMatch {
|
|
156
|
-
feature: FeatureRecord;
|
|
157
|
-
params: Record<string, string>;
|
|
158
|
-
}
|
|
159
|
-
export interface DynamicRouteMatcher {
|
|
160
|
-
feature: FeatureRecord;
|
|
161
|
-
regex: RegExp;
|
|
162
|
-
paramNames: string[];
|
|
163
|
-
}
|
|
164
|
-
export interface RouteIndex {
|
|
165
|
-
exact: Map<string, FeatureRecord>;
|
|
166
|
-
dynamic: DynamicRouteMatcher[];
|
|
167
|
-
}
|
package/src/server-types.js
DELETED
package/src/server-utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure utility functions for the Fiyuu runtime server.
|
|
3
|
-
* No dependencies on other server modules — safe to import anywhere.
|
|
4
|
-
*/
|
|
5
|
-
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
6
|
-
import type { RuntimeState } from "./server-types.js";
|
|
7
|
-
export declare function escapeHtml(value: unknown): string;
|
|
8
|
-
export declare function serialize(value: unknown): string;
|
|
9
|
-
export declare function createRequestId(): string;
|
|
10
|
-
export declare function prefersHtmlResponse(request: IncomingMessage): boolean;
|
|
11
|
-
export declare function sendJson(response: ServerResponse, statusCode: number, value: unknown): void;
|
|
12
|
-
export declare function sendText(response: ServerResponse, statusCode: number, message: string): void;
|
|
13
|
-
export declare function createWeakEtag(value: string): string;
|
|
14
|
-
export declare function parseRequestBody(request: IncomingMessage): Promise<Record<string, unknown>>;
|
|
15
|
-
export declare function pushServerEvent(state: RuntimeState, level: "info" | "warn" | "error", event: string, details?: string): void;
|
package/src/server-utils.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure utility functions for the Fiyuu runtime server.
|
|
3
|
-
* No dependencies on other server modules — safe to import anywhere.
|
|
4
|
-
*/
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
|
-
// ── HTML escaping ─────────────────────────────────────────────────────────────
|
|
7
|
-
export function escapeHtml(value) {
|
|
8
|
-
const text = value == null ? "" : String(value);
|
|
9
|
-
return text
|
|
10
|
-
.replaceAll("&", "&")
|
|
11
|
-
.replaceAll("<", "<")
|
|
12
|
-
.replaceAll(">", ">")
|
|
13
|
-
.replaceAll('"', """)
|
|
14
|
-
.replaceAll("'", "'");
|
|
15
|
-
}
|
|
16
|
-
// ── Serialisation ─────────────────────────────────────────────────────────────
|
|
17
|
-
export function serialize(value) {
|
|
18
|
-
return JSON.stringify(value ?? null).replaceAll("<", "\\u003c");
|
|
19
|
-
}
|
|
20
|
-
// ── Request ID ────────────────────────────────────────────────────────────────
|
|
21
|
-
export function createRequestId() {
|
|
22
|
-
return `req_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
23
|
-
}
|
|
24
|
-
// ── Content negotiation ───────────────────────────────────────────────────────
|
|
25
|
-
export function prefersHtmlResponse(request) {
|
|
26
|
-
if ((request.url ?? "").startsWith("/api")) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
const accept = request.headers.accept ?? "";
|
|
30
|
-
if (accept.includes("application/json") && !accept.includes("text/html")) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
// ── Response helpers ──────────────────────────────────────────────────────────
|
|
36
|
-
export function sendJson(response, statusCode, value) {
|
|
37
|
-
response.statusCode = statusCode;
|
|
38
|
-
response.setHeader("content-type", "application/json; charset=utf-8");
|
|
39
|
-
response.end(`${JSON.stringify(value, null, 2)}\n`);
|
|
40
|
-
}
|
|
41
|
-
export function sendText(response, statusCode, message) {
|
|
42
|
-
response.statusCode = statusCode;
|
|
43
|
-
response.setHeader("content-type", "text/plain; charset=utf-8");
|
|
44
|
-
response.end(message);
|
|
45
|
-
}
|
|
46
|
-
export function createWeakEtag(value) {
|
|
47
|
-
const digest = createHash("sha1").update(value).digest("base64url");
|
|
48
|
-
return `W/\"${digest}\"`;
|
|
49
|
-
}
|
|
50
|
-
const MAX_BODY_BYTES = 1_048_576; // 1 MB
|
|
51
|
-
export async function parseRequestBody(request) {
|
|
52
|
-
const chunks = [];
|
|
53
|
-
let totalBytes = 0;
|
|
54
|
-
for await (const chunk of request) {
|
|
55
|
-
const buffer = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
|
|
56
|
-
totalBytes += buffer.byteLength;
|
|
57
|
-
if (totalBytes > MAX_BODY_BYTES) {
|
|
58
|
-
throw Object.assign(new Error("Request body too large (limit: 1 MB)."), { statusCode: 413 });
|
|
59
|
-
}
|
|
60
|
-
chunks.push(buffer);
|
|
61
|
-
}
|
|
62
|
-
const rawBody = Buffer.concat(chunks).toString("utf8").trim();
|
|
63
|
-
if (!rawBody) {
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
const contentType = request.headers["content-type"] ?? "";
|
|
67
|
-
if (contentType.includes("application/json")) {
|
|
68
|
-
const parsed = JSON.parse(rawBody);
|
|
69
|
-
// Reject prototype pollution attempts.
|
|
70
|
-
if (parsed !== null && typeof parsed === "object") {
|
|
71
|
-
const hasOwn = Object.prototype.hasOwnProperty;
|
|
72
|
-
if (hasOwn.call(parsed, "__proto__") ||
|
|
73
|
-
hasOwn.call(parsed, "constructor") ||
|
|
74
|
-
hasOwn.call(parsed, "prototype")) {
|
|
75
|
-
throw Object.assign(new Error("Request body contains forbidden keys."), { statusCode: 400 });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return parsed;
|
|
79
|
-
}
|
|
80
|
-
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
81
|
-
const entries = [...new URLSearchParams(rawBody).entries()].filter(([key]) => key !== "__proto__" && key !== "constructor" && key !== "prototype");
|
|
82
|
-
return Object.fromEntries(entries);
|
|
83
|
-
}
|
|
84
|
-
return { raw: rawBody };
|
|
85
|
-
}
|
|
86
|
-
// ── Server event log ──────────────────────────────────────────────────────────
|
|
87
|
-
export function pushServerEvent(state, level, event, details) {
|
|
88
|
-
state.serverEvents.unshift({
|
|
89
|
-
at: new Date().toISOString(),
|
|
90
|
-
level,
|
|
91
|
-
event,
|
|
92
|
-
details,
|
|
93
|
-
});
|
|
94
|
-
if (state.serverEvents.length > 120) {
|
|
95
|
-
state.serverEvents.length = 120;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket server attachment for the Fiyuu runtime.
|
|
3
|
-
* Wires up a ws.WebSocketServer on the HTTP server's upgrade event.
|
|
4
|
-
*/
|
|
5
|
-
import { createServer } from "node:http";
|
|
6
|
-
import type { StartServerOptions } from "./server-types.js";
|
|
7
|
-
export declare function attachWebsocketServer(server: ReturnType<typeof createServer>, options: StartServerOptions, websocketPath: string): Promise<string | undefined>;
|
package/src/server-websocket.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket server attachment for the Fiyuu runtime.
|
|
3
|
-
* Wires up a ws.WebSocketServer on the HTTP server's upgrade event.
|
|
4
|
-
*/
|
|
5
|
-
import { existsSync } from "node:fs";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { WebSocketServer } from "ws";
|
|
8
|
-
import { importModule } from "./server-loader.js";
|
|
9
|
-
export async function attachWebsocketServer(server, options, websocketPath) {
|
|
10
|
-
if (!options.config?.websocket?.enabled) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
const socketModulePath = path.join(options.rootDirectory, "server", "socket.ts");
|
|
14
|
-
const socketModule = existsSync(socketModulePath)
|
|
15
|
-
? (await importModule(socketModulePath, options.mode))
|
|
16
|
-
: null;
|
|
17
|
-
const registration = socketModule?.registerSocketServer?.() ?? {};
|
|
18
|
-
const wss = new WebSocketServer({
|
|
19
|
-
noServer: true,
|
|
20
|
-
maxPayload: options.config?.websocket?.maxPayloadBytes ?? 64 * 1024,
|
|
21
|
-
});
|
|
22
|
-
wss.on("connection", (socket) => {
|
|
23
|
-
socket.send(JSON.stringify({
|
|
24
|
-
type: "fiyuu:ready",
|
|
25
|
-
namespace: registration.namespace ?? "app",
|
|
26
|
-
events: registration.events ?? [],
|
|
27
|
-
}));
|
|
28
|
-
registration.onConnect?.(socket);
|
|
29
|
-
socket.on("message", (message) => {
|
|
30
|
-
registration.onMessage?.(socket, message.toString());
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
const handledSockets = new WeakSet();
|
|
34
|
-
server.on("upgrade", (request, socket, head) => {
|
|
35
|
-
if (handledSockets.has(socket))
|
|
36
|
-
return;
|
|
37
|
-
handledSockets.add(socket);
|
|
38
|
-
if (!request.url) {
|
|
39
|
-
socket.destroy();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const url = new URL(request.url, "http://localhost");
|
|
43
|
-
if (url.pathname !== websocketPath)
|
|
44
|
-
return;
|
|
45
|
-
try {
|
|
46
|
-
wss.handleUpgrade(request, socket, head, (client) => {
|
|
47
|
-
wss.emit("connection", client, request);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
// Another WebSocket handler already processed this socket
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return `ws://localhost:${options.port ?? 4050}${websocketPath}`;
|
|
55
|
-
}
|
package/src/server.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fiyuu runtime server — main orchestrator.
|
|
3
|
-
*
|
|
4
|
-
* This file wires together the modular pieces:
|
|
5
|
-
* server-types → shared interfaces
|
|
6
|
-
* server-utils → serialise, escapeHtml, sendJson/Text, parseBody, …
|
|
7
|
-
* server-router → buildRouteIndex, matchRoute
|
|
8
|
-
* server-loader → importModule, layout/meta loading, query cache, renderGeaComponent
|
|
9
|
-
* server-renderer → renderDocument, renderStatusPage, serveClientAsset, …
|
|
10
|
-
* server-devtools → renderUnifiedToolsScript (dev only)
|
|
11
|
-
* server-middleware→ runMiddleware
|
|
12
|
-
* server-websocket → attachWebsocketServer
|
|
13
|
-
*/
|
|
14
|
-
import { type RenderMode } from "@fiyuu/core";
|
|
15
|
-
export type { StartServerOptions, StartedServer } from "./server-types.js";
|
|
16
|
-
import type { StartedServer, StartServerOptions } from "./server-types.js";
|
|
17
|
-
declare global {
|
|
18
|
-
interface Window {
|
|
19
|
-
__FIYUU_DATA__?: unknown;
|
|
20
|
-
__FIYUU_ROUTE__?: string;
|
|
21
|
-
__FIYUU_INTENT__?: string;
|
|
22
|
-
__FIYUU_RENDER__?: RenderMode;
|
|
23
|
-
__FIYUU_WS_PATH__?: string;
|
|
24
|
-
__FIYUU_DEVTOOLS__?: unknown;
|
|
25
|
-
fiyuu?: {
|
|
26
|
-
theme: {
|
|
27
|
-
get(): "light" | "dark";
|
|
28
|
-
set(value: "light" | "dark"): void;
|
|
29
|
-
toggle(): void;
|
|
30
|
-
bindToggle(elementId: string): void;
|
|
31
|
-
onChange(fn: (theme: "light" | "dark") => void): void;
|
|
32
|
-
};
|
|
33
|
-
bind(elementId: string, value?: unknown, asHtml?: boolean): void;
|
|
34
|
-
partial(elementId: string, url: string, options?: {
|
|
35
|
-
loading?: string;
|
|
36
|
-
}): Promise<void>;
|
|
37
|
-
onError(callback: (event: {
|
|
38
|
-
message: string;
|
|
39
|
-
error: Error | null;
|
|
40
|
-
source: string | null;
|
|
41
|
-
line: number | null;
|
|
42
|
-
}) => void): void;
|
|
43
|
-
state<T>(key: string, initialValue: T): {
|
|
44
|
-
get(): T;
|
|
45
|
-
set(value: T): void;
|
|
46
|
-
bind(elementId: string): object;
|
|
47
|
-
onChange(fn: (value: T) => void): object;
|
|
48
|
-
};
|
|
49
|
-
router: {
|
|
50
|
-
navigate(url: string): Promise<void>;
|
|
51
|
-
on(event: "navigate" | "before", fn: (detail: {
|
|
52
|
-
route: string;
|
|
53
|
-
render?: string;
|
|
54
|
-
title?: string;
|
|
55
|
-
}) => void | false): object;
|
|
56
|
-
};
|
|
57
|
-
ws(overridePath?: string): {
|
|
58
|
-
on(type: string, handler: (data: unknown) => void): object;
|
|
59
|
-
onOpen(handler: () => void): object;
|
|
60
|
-
onClose(handler: () => void): object;
|
|
61
|
-
onError(handler: () => void): object;
|
|
62
|
-
send(data: unknown): object;
|
|
63
|
-
status(): "connecting" | "connected" | "closed" | "unavailable";
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export declare function startServer(options: StartServerOptions): Promise<StartedServer>;
|