@vite-hub/source 0.0.4 → 0.3.0

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.
Files changed (52) hide show
  1. package/README.md +267 -96
  2. package/dist/client.d.ts +27 -10
  3. package/dist/client.js +99 -15
  4. package/dist/collection-B8sgxw5-.d.ts +290 -0
  5. package/dist/collection-C0Rvrx3p.js +297 -0
  6. package/dist/collection-route-BplWPxHR.js +10 -0
  7. package/dist/drizzle.d.ts +48 -0
  8. package/dist/drizzle.js +87 -0
  9. package/dist/error-diagnostics-ClQKdi7c.js +194 -0
  10. package/dist/github-D5S0dEZe.js +1312 -0
  11. package/dist/{glob.js → glob-DmdMVqjx.js} +154 -57
  12. package/dist/index.d.ts +284 -62
  13. package/dist/index.js +583 -29
  14. package/dist/invariant-DolT9EEx.js +22 -0
  15. package/dist/mcp.d.ts +3 -4
  16. package/dist/mcp.js +184 -5917
  17. package/dist/object-CtSHeGQO.js +17 -0
  18. package/dist/{path-CUhvUREm.js → path-DFlSryRA.js} +90 -40
  19. package/dist/root-DJNmqCEW.js +11 -0
  20. package/dist/server.d.ts +24 -11
  21. package/dist/server.js +97 -26
  22. package/dist/types-Ln-FxVFn.d.ts +98 -0
  23. package/dist/vite.d.ts +202 -14
  24. package/dist/vite.js +1683 -122
  25. package/package.json +55 -58
  26. package/dist/auth-Ddw55OUG.js +0 -1261
  27. package/dist/client-CDfTmtQu.js +0 -7903
  28. package/dist/collection-B8pXGM2d.js +0 -141
  29. package/dist/collection-CF2ON__k.d.ts +0 -92
  30. package/dist/collection-route-Dw7QLFyx.js +0 -6
  31. package/dist/content/client.d.ts +0 -3
  32. package/dist/content/client.js +0 -2
  33. package/dist/content.d.ts +0 -44
  34. package/dist/content.js +0 -157
  35. package/dist/file-BSWQg9Qv.js +0 -503
  36. package/dist/file-EQ3AjVM6.d.ts +0 -20
  37. package/dist/file.d.ts +0 -2
  38. package/dist/file.js +0 -2
  39. package/dist/github.d.ts +0 -17
  40. package/dist/github.js +0 -1033
  41. package/dist/glob.d.ts +0 -15
  42. package/dist/markdown.d.ts +0 -7
  43. package/dist/markdown.js +0 -10
  44. package/dist/path-BzmU4Eni.js +0 -36
  45. package/dist/registry-C8skfCSV.js +0 -120
  46. package/dist/sse-CE9Q2JqM.js +0 -407
  47. package/dist/streamableHttp-BszaXLmg.js +0 -491
  48. package/dist/types-AIBmt_m6.js +0 -6275
  49. package/dist/types-Bu3WvNX9.d.ts +0 -71
  50. package/tsconfig.vite.json +0 -6
  51. package/types/source/fallback.d.ts +0 -1
  52. package/types/source/index.d.ts +0 -1
@@ -1,71 +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
- revision?: SourceRevision;
12
- rootDir: string;
13
- sourceRootDir?: string;
14
- source?: string;
15
- workspace?: string;
16
- }
17
- interface SourceCacheOptions {
18
- maxAge?: number;
19
- }
20
- interface SourceRevision {
21
- id: string;
22
- immutable: boolean;
23
- ref?: string;
24
- }
25
- interface SourceItem<TKey extends string = string, TData = unknown, TMetadata extends object = Record<string, unknown>> {
26
- key: TKey;
27
- path?: string;
28
- content?: SourceContent;
29
- data?: TData;
30
- mediaType?: string;
31
- metadata?: TMetadata;
32
- }
33
- interface Source<TKey extends string = string, TData = unknown, TMetadata extends object = Record<string, unknown>> {
34
- name: string;
35
- cache?: false | SourceCacheOptions;
36
- fingerprint?: unknown;
37
- resolveRevision?(ctx: SourceContext): Promise<SourceRevision | undefined>;
38
- prepare?(ctx: SourceContext): Promise<void>;
39
- getKeys(ctx: SourceContext): Promise<TKey[]>;
40
- getItem(key: TKey, ctx: SourceContext): Promise<SourceItem<TKey, TData, TMetadata>>;
41
- getItems?(ctx: SourceContext): Promise<SourceItem<TKey, TData, TMetadata>[]>;
42
- getMeta?(key: TKey, ctx: SourceContext): Promise<TMetadata | undefined>;
43
- }
44
- interface SourceListEntry<TKey extends string = string> {
45
- key: TKey;
46
- type: "file" | "directory";
47
- }
48
- declare global {
49
- interface ViteHubSourceMap {}
50
- }
51
- interface SourceMap extends ViteHubSourceMap {}
52
- type SourceKeyOf<TSource> = TSource extends Source<infer TKey, any, any> ? TKey : string;
53
- type SourceDataOf<TSource> = TSource extends Source<any, infer TData, any> ? TData : unknown;
54
- type SourceMetadataOf<TSource> = TSource extends Source<any, any, infer TMetadata> ? TMetadata : Record<string, unknown>;
55
- type RegisteredSource<TName extends SourceName> = TName extends keyof ViteHubSourceMap ? ViteHubSourceMap[TName] : Source;
56
- type SourceName = [keyof ViteHubSourceMap] extends [never] ? string : Extract<keyof ViteHubSourceMap, string>;
57
- type SourceKey<TName extends SourceName = SourceName> = Extract<SourceKeyOf<RegisteredSource<TName>>, string>;
58
- type SourceData<TName extends SourceName = SourceName> = SourceDataOf<RegisteredSource<TName>>;
59
- type SourceMetadata<TName extends SourceName = SourceName> = SourceMetadataOf<RegisteredSource<TName>>;
60
- interface SourceReader<TName extends SourceName = SourceName> {
61
- revision(): Promise<SourceRevision | undefined>;
62
- keys(): Promise<SourceKey<TName>[]>;
63
- get(key: SourceKey<TName>): Promise<SourceItem<SourceKey<TName>, SourceData<TName>, SourceMetadata<TName>>>;
64
- items(): Promise<Array<SourceItem<SourceKey<TName>, SourceData<TName>, SourceMetadata<TName>>>>;
65
- read<TOptions extends ReadSourceOptions | undefined = undefined>(key: SourceKey<TName>, options?: TOptions): Promise<ReadSourceResult<TOptions>>;
66
- meta(key: SourceKey<TName>): Promise<SourceMetadata<TName> | undefined>;
67
- exists(key: SourceKey<TName>): Promise<boolean>;
68
- list(prefix?: SourceKey<TName> | (string & {}) | ""): Promise<SourceListEntry<SourceKey<TName>>[]>;
69
- }
70
- //#endregion
71
- export { SourceContent as a, SourceItem as c, SourceMap as d, SourceMetadata as f, SourceRevision as h, SourceCacheOptions as i, SourceKey as l, SourceReader as m, ReadSourceResult as n, SourceContext as o, SourceName as p, Source as r, SourceData as s, ReadSourceOptions as t, SourceListEntry as u };
@@ -1,6 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "rootDirs": ["${configDir}/.vitehub/types/source", "./types/source"]
4
- },
5
- "files": ["./types/source/index.d.ts", "./types/source/fallback.d.ts"]
6
- }
@@ -1 +0,0 @@
1
- declare module "*vitehub-source-registry.js" {}
@@ -1 +0,0 @@
1
- import "./vitehub-source-registry.js"