@vite-hub/source 0.0.2 → 0.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/README.md +32 -0
- package/dist/index.d.ts +167 -10
- package/dist/index.js +1093 -9
- package/package.json +2 -30
- package/dist/chunk-D7D4PA-g.js +0 -13
- package/dist/custom-EnZvMLiy.d.ts +0 -6
- package/dist/file-slFAccIZ.d.ts +0 -20
- package/dist/github-B4lgrzXQ.js +0 -565
- package/dist/glob-CuxZwoC3.d.ts +0 -15
- package/dist/index-CJpN2j6c.d.ts +0 -17
- package/dist/markdown-Beo-0cqc.d.ts +0 -7
- package/dist/mcp-resources-C7-5Qeh4.d.ts +0 -41
- package/dist/mcp-resources-DSDqTfbK.js +0 -307
- package/dist/path-B5QNI5sY.js +0 -44
- package/dist/sources/custom.d.ts +0 -2
- package/dist/sources/custom.js +0 -6
- package/dist/sources/file.d.ts +0 -2
- package/dist/sources/file.js +0 -57
- package/dist/sources/github.d.ts +0 -2
- package/dist/sources/github.js +0 -2
- package/dist/sources/glob.d.ts +0 -2
- package/dist/sources/glob.js +0 -110
- package/dist/sources/index.d.ts +0 -13
- package/dist/sources/index.js +0 -18
- package/dist/sources/markdown.d.ts +0 -2
- package/dist/sources/markdown.js +0 -10
- package/dist/sources/mcp-resources.d.ts +0 -2
- package/dist/sources/mcp-resources.js +0 -2
- package/dist/types-f6Lyjq8g.d.ts +0 -73
package/dist/types-f6Lyjq8g.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
//#region src/core/types.d.ts
|
|
2
|
-
type SourceContent = string | Uint8Array;
|
|
3
|
-
interface ReadSourceOptions {
|
|
4
|
-
encoding?: "utf8" | "binary";
|
|
5
|
-
}
|
|
6
|
-
type ReadSourceResult<TOptions extends ReadSourceOptions | undefined = undefined> = TOptions extends {
|
|
7
|
-
encoding: "binary";
|
|
8
|
-
} ? Uint8Array : string;
|
|
9
|
-
interface SourceContext {
|
|
10
|
-
abortSignal?: AbortSignal;
|
|
11
|
-
rootDir: string;
|
|
12
|
-
sourceRootDir?: string;
|
|
13
|
-
source?: string;
|
|
14
|
-
workspace?: string;
|
|
15
|
-
}
|
|
16
|
-
interface SourceCacheOptions {
|
|
17
|
-
maxAge?: number;
|
|
18
|
-
}
|
|
19
|
-
interface SourceSearchQuery {
|
|
20
|
-
pattern: string;
|
|
21
|
-
cwd?: string;
|
|
22
|
-
paths?: string[];
|
|
23
|
-
regex?: boolean;
|
|
24
|
-
caseSensitive?: boolean;
|
|
25
|
-
limit?: number;
|
|
26
|
-
}
|
|
27
|
-
interface SourceSearchHit {
|
|
28
|
-
path: string;
|
|
29
|
-
line: number;
|
|
30
|
-
column: number;
|
|
31
|
-
text: string;
|
|
32
|
-
}
|
|
33
|
-
interface SourceItem<TKey extends string = string> {
|
|
34
|
-
key: TKey;
|
|
35
|
-
path?: string;
|
|
36
|
-
content?: SourceContent;
|
|
37
|
-
data?: unknown;
|
|
38
|
-
mediaType?: string;
|
|
39
|
-
metadata?: Record<string, unknown>;
|
|
40
|
-
}
|
|
41
|
-
interface Source<TKey extends string = string> {
|
|
42
|
-
name: string;
|
|
43
|
-
cache?: false | SourceCacheOptions;
|
|
44
|
-
fingerprint?: unknown;
|
|
45
|
-
prepare?(ctx: SourceContext): Promise<void>;
|
|
46
|
-
getKeys(ctx: SourceContext): Promise<TKey[]>;
|
|
47
|
-
getItem(key: TKey, ctx: SourceContext): Promise<SourceItem<TKey>>;
|
|
48
|
-
getItems?(ctx: SourceContext): Promise<SourceItem<TKey>[]>;
|
|
49
|
-
getMeta?(key: TKey, ctx: SourceContext): Promise<Record<string, unknown> | undefined>;
|
|
50
|
-
search?(query: SourceSearchQuery, ctx: SourceContext): Promise<SourceSearchHit[]>;
|
|
51
|
-
watch?: unknown[];
|
|
52
|
-
}
|
|
53
|
-
interface SourceListEntry<TKey extends string = string> {
|
|
54
|
-
key: TKey;
|
|
55
|
-
type: "file" | "directory";
|
|
56
|
-
}
|
|
57
|
-
declare global {
|
|
58
|
-
interface ViteHubSourceMap {}
|
|
59
|
-
}
|
|
60
|
-
interface SourceMap extends ViteHubSourceMap {}
|
|
61
|
-
type SourceKeyOf<TSource> = TSource extends Source<infer TKey> ? TKey : string;
|
|
62
|
-
type SourceName = [keyof ViteHubSourceMap] extends [never] ? string : Extract<keyof ViteHubSourceMap, string>;
|
|
63
|
-
type SourceKey<TName extends SourceName = SourceName> = TName extends keyof ViteHubSourceMap ? Extract<SourceKeyOf<ViteHubSourceMap[TName]>, string> : string;
|
|
64
|
-
interface SourceReader<TName extends SourceName = SourceName> {
|
|
65
|
-
keys(): Promise<SourceKey<TName>[]>;
|
|
66
|
-
get(key: SourceKey<TName>): Promise<SourceItem<SourceKey<TName>>>;
|
|
67
|
-
read<TOptions extends ReadSourceOptions | undefined = undefined>(key: SourceKey<TName>, options?: TOptions): Promise<ReadSourceResult<TOptions>>;
|
|
68
|
-
meta(key: SourceKey<TName>): Promise<Record<string, unknown> | undefined>;
|
|
69
|
-
exists(key: SourceKey<TName>): Promise<boolean>;
|
|
70
|
-
list(prefix?: SourceKey<TName> | (string & {}) | ""): Promise<SourceListEntry<SourceKey<TName>>[]>;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
export { SourceContent as a, SourceKey as c, SourceName as d, SourceReader as f, SourceCacheOptions as i, SourceListEntry as l, SourceSearchQuery as m, ReadSourceResult as n, SourceContext as o, SourceSearchHit as p, Source as r, SourceItem as s, ReadSourceOptions as t, SourceMap as u };
|