@vite-hub/source 0.0.3 → 0.0.4

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.
@@ -0,0 +1,7 @@
1
+ import { r as Source } from "./types-Bu3WvNX9.js";
2
+ import { n as FileSourceOptions } from "./file-EQ3AjVM6.js";
3
+
4
+ //#region src/sources/markdown.d.ts
5
+ declare function markdown<const TKey extends string = string>(options: FileSourceOptions<TKey>): Source<TKey>;
6
+ //#endregion
7
+ export { markdown };
@@ -0,0 +1,10 @@
1
+ import { t as file } from "./file-BSWQg9Qv.js";
2
+ //#region src/sources/markdown.ts
3
+ function markdown(options) {
4
+ return file({
5
+ ...options,
6
+ mediaType: options.mediaType || "text/markdown"
7
+ });
8
+ }
9
+ //#endregion
10
+ export { markdown };
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,152 @@
1
+ import { i as SourceCacheOptions, o as SourceContext, r as Source } from "./types-Bu3WvNX9.js";
2
+
3
+ //#region src/sources/mcp-resources.d.ts
4
+ interface McpResourcesRequestOptions {
5
+ maxTotalTimeout?: number;
6
+ onprogress?: (progress: {
7
+ message?: string;
8
+ progress: number;
9
+ total?: number;
10
+ }) => void;
11
+ onresumptiontoken?: (token: string) => void;
12
+ relatedRequestId?: number | string;
13
+ relatedTask?: {
14
+ taskId: string;
15
+ };
16
+ resetTimeoutOnProgress?: boolean;
17
+ resumptionToken?: string;
18
+ signal?: AbortSignal;
19
+ task?: {
20
+ pollInterval?: number;
21
+ ttl?: number;
22
+ };
23
+ timeout?: number;
24
+ }
25
+ interface McpResourceDescriptor {
26
+ _meta?: Record<string, unknown>;
27
+ annotations?: {
28
+ audience?: Array<"assistant" | "user">;
29
+ lastModified?: string;
30
+ priority?: number;
31
+ };
32
+ description?: string;
33
+ icons?: Array<{
34
+ mimeType?: string;
35
+ sizes?: string[];
36
+ src: string;
37
+ theme?: "dark" | "light";
38
+ }>;
39
+ mimeType?: string;
40
+ name: string;
41
+ size?: number;
42
+ title?: string;
43
+ uri: string;
44
+ }
45
+ type McpResourceContent = {
46
+ _meta?: Record<string, unknown>;
47
+ blob: string;
48
+ mimeType?: string;
49
+ uri: string;
50
+ } | {
51
+ _meta?: Record<string, unknown>;
52
+ mimeType?: string;
53
+ text: string;
54
+ uri: string;
55
+ };
56
+ type McpResourcesMessage = {
57
+ id: number | string;
58
+ jsonrpc: "2.0";
59
+ method: string;
60
+ params?: {
61
+ [key: string]: unknown;
62
+ _meta?: Record<string, unknown>;
63
+ };
64
+ } | {
65
+ id?: never;
66
+ jsonrpc: "2.0";
67
+ method: string;
68
+ params?: {
69
+ [key: string]: unknown;
70
+ _meta?: Record<string, unknown>;
71
+ };
72
+ } | {
73
+ id: number | string;
74
+ jsonrpc: "2.0";
75
+ method?: never;
76
+ result: {
77
+ [key: string]: unknown;
78
+ _meta?: Record<string, unknown>;
79
+ };
80
+ } | {
81
+ error: {
82
+ code: number;
83
+ data?: unknown;
84
+ message: string;
85
+ };
86
+ id: number | string;
87
+ jsonrpc: "2.0";
88
+ method?: never;
89
+ };
90
+ interface McpResourcesTransport {
91
+ close(): Promise<void>;
92
+ onclose?: () => void;
93
+ onerror?: (error: Error) => void;
94
+ onmessage?: (message: McpResourcesMessage) => void;
95
+ send(message: McpResourcesMessage): Promise<void>;
96
+ start(): Promise<void>;
97
+ }
98
+ interface McpResourcesClient {
99
+ close?: () => void | Promise<void>;
100
+ getServerVersion?: () => {
101
+ name: string;
102
+ version: string;
103
+ } | undefined;
104
+ listResources: (params?: {
105
+ cursor?: string;
106
+ }, options?: McpResourcesRequestOptions) => Promise<{
107
+ nextCursor?: string;
108
+ resources: McpResourceDescriptor[];
109
+ }>;
110
+ readResource: (params: {
111
+ uri: string;
112
+ }, options?: McpResourcesRequestOptions) => Promise<{
113
+ contents: McpResourceContent[];
114
+ }>;
115
+ serverInfo?: unknown;
116
+ }
117
+ type McpResourcesTransportConfig = McpResourcesTransport | {
118
+ authProvider?: unknown;
119
+ fetch?: (url: string | URL, init?: RequestInit) => Promise<Response>;
120
+ reconnectionOptions?: {
121
+ initialReconnectionDelay: number;
122
+ maxReconnectionDelay: number;
123
+ maxRetries: number;
124
+ reconnectionDelayGrowFactor: number;
125
+ };
126
+ requestInit?: RequestInit;
127
+ sessionId?: string;
128
+ type?: "http";
129
+ url: string | URL;
130
+ } | {
131
+ authProvider?: unknown;
132
+ eventSourceInit?: unknown;
133
+ fetch?: (url: string | URL, init?: RequestInit) => Promise<Response>;
134
+ requestInit?: RequestInit;
135
+ type: "sse";
136
+ url: string | URL;
137
+ };
138
+ interface McpResourcesClientConfig {
139
+ transport: McpResourcesTransportConfig;
140
+ }
141
+ type McpResourcesServer = McpResourcesClient | McpResourcesClientConfig | ((ctx: SourceContext) => McpResourcesClient | McpResourcesClientConfig | Promise<McpResourcesClient | McpResourcesClientConfig>);
142
+ interface McpResourcesSourceOptions<TKey extends string = string> {
143
+ cache?: false | SourceCacheOptions;
144
+ ignore?: string | readonly string[];
145
+ include?: string | string[];
146
+ path?: (resource: McpResourceDescriptor) => TKey | string | undefined;
147
+ request?: McpResourcesRequestOptions;
148
+ server: McpResourcesServer;
149
+ }
150
+ declare function mcpResources<const TKey extends string = string>(options: McpResourcesSourceOptions<TKey>): Source<TKey>;
151
+ //#endregion
152
+ export { type McpResourceContent, type McpResourceDescriptor, type McpResourcesClient, type McpResourcesClientConfig, type McpResourcesRequestOptions, type McpResourcesServer, type McpResourcesSourceOptions, type McpResourcesTransport, type McpResourcesTransportConfig, mcpResources };