@hops-ops/distributed 4.8.0 → 4.10.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 (37) hide show
  1. package/README.md +46 -8
  2. package/dist/generation.d.ts +15 -0
  3. package/dist/generation.js +41 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/protocol.d.ts +2 -0
  7. package/dist/protocol.js +5 -0
  8. package/dist/replica/command-runtime/create.js +11 -0
  9. package/dist/replica/command-runtime/errors.js +2 -0
  10. package/dist/replica/command-runtime/types.d.ts +7 -1
  11. package/dist/replica/distributed-replica/impl-protocol.d.ts +1 -0
  12. package/dist/replica/distributed-replica/impl-protocol.js +1 -0
  13. package/dist/replica/distributed-replica/impl.js +11 -0
  14. package/dist/replica/distributed-replica/watch.js +13 -1
  15. package/dist/replica/index.d.ts +1 -1
  16. package/dist/replica/types.d.ts +38 -0
  17. package/dist/sveltekit/boundary-lifecycle.d.ts +37 -0
  18. package/dist/sveltekit/boundary-lifecycle.js +355 -0
  19. package/dist/sveltekit/boundary-variables.d.ts +57 -0
  20. package/dist/sveltekit/boundary-variables.js +290 -0
  21. package/dist/sveltekit/context.d.ts +3 -0
  22. package/dist/sveltekit/context.js +8 -0
  23. package/dist/sveltekit/index.d.ts +7 -3
  24. package/dist/sveltekit/index.js +6 -2
  25. package/dist/sveltekit/islands/boundaries.d.ts +104 -0
  26. package/dist/sveltekit/islands/boundaries.js +734 -0
  27. package/dist/sveltekit/lifecycle.d.ts +57 -0
  28. package/dist/sveltekit/lifecycle.js +454 -0
  29. package/dist/sveltekit/operation-identity.d.ts +4 -0
  30. package/dist/sveltekit/operation-identity.js +10 -0
  31. package/dist/sveltekit/replica.d.ts +29 -2
  32. package/dist/sveltekit/replica.js +102 -6
  33. package/dist/sveltekit/server-replica.d.ts +10 -26
  34. package/dist/sveltekit/server-replica.js +159 -132
  35. package/dist/sveltekit/vite.d.ts +46 -3
  36. package/dist/sveltekit/vite.js +643 -36
  37. package/package.json +4 -3
@@ -1,3 +1,5 @@
1
+ import { type DistributedSvelteKitBoundaryRegistration } from './islands/boundaries.js';
2
+ export { analyzeDistributedSvelteKitBoundaries, validateDistributedSvelteKitBoundaryPlan, type DistributedIslandInventory, type DistributedIslandPlanInput, type DistributedSvelteKitBoundary, type DistributedSvelteKitBoundaryAnalysisClient, type DistributedSvelteKitBoundaryAnalysisOptions, type DistributedSvelteKitBoundaryOccurrence, type DistributedSvelteKitBoundaryPlan, type DistributedSvelteKitBoundaryRegistration } from './islands/boundaries.js';
1
3
  export type DistributedGraphqlProxyOptions = {
2
4
  /** Absolute Distributed API origin, for example `http://127.0.0.1:8791`. */
3
5
  target: string;
@@ -28,8 +30,8 @@ export type DistributedSvelteKitClientCompiler = Readonly<{
28
30
  surface?: string;
29
31
  /** GraphQL globs passed verbatim as repeated `distributed client --documents`. */
30
32
  documents: readonly string[];
31
- /** Explicit `OPERATION=/route` fallbacks. */
32
- routes?: readonly string[];
33
+ /** Typed fallback when static component ownership cannot be proven. */
34
+ boundaries?: readonly DistributedSvelteKitBoundaryRegistration[];
33
35
  /** Compiler-owned artifact directory, relative to `cwd` by default. */
34
36
  out: string;
35
37
  }>;
@@ -40,6 +42,12 @@ export type DistributedSvelteKitViteOptions = Readonly<{
40
42
  command?: string;
41
43
  /** Prefix argv, e.g. `cargo run ... --`; never interpreted by a shell. */
42
44
  commandArgs?: readonly string[];
45
+ /** SvelteKit route source root. Defaults to `src/routes`. */
46
+ routesDir?: string;
47
+ /** SvelteKit library source root. Defaults to `src/lib`. */
48
+ libDir?: string;
49
+ /** Additional project-local `$name` aliases used by static component imports. */
50
+ aliases?: Readonly<Record<string, string>>;
43
51
  clients: readonly DistributedSvelteKitClientCompiler[];
44
52
  }>;
45
53
  type ViteWebSocketLike = Readonly<{
@@ -49,12 +57,26 @@ type ViteModuleGraphLike = Readonly<{
49
57
  getModuleById(id: string): unknown;
50
58
  invalidateModule(module: unknown): void;
51
59
  }>;
60
+ type ViteMiddlewareRequest = Readonly<{
61
+ method?: string;
62
+ headers: Readonly<Record<string, string | readonly string[] | undefined>>;
63
+ on(event: 'data', listener: (chunk: Uint8Array) => void): void;
64
+ on(event: 'end' | 'error', listener: (value?: unknown) => void): void;
65
+ }>;
66
+ type ViteMiddlewareResponse = {
67
+ statusCode: number;
68
+ setHeader(name: string, value: string): void;
69
+ end(body?: string | Uint8Array): void;
70
+ };
52
71
  type ViteServerLike = Readonly<{
53
72
  watcher: Readonly<{
54
73
  add(paths: string | readonly string[]): void;
55
74
  }>;
56
75
  ws: ViteWebSocketLike;
57
76
  moduleGraph: ViteModuleGraphLike;
77
+ middlewares?: Readonly<{
78
+ use(path: string, handler: (request: ViteMiddlewareRequest, response: ViteMiddlewareResponse) => void): void;
79
+ }>;
58
80
  httpServer?: Readonly<{
59
81
  once(event: 'close', listener: () => void): void;
60
82
  }> | null;
@@ -62,6 +84,7 @@ type ViteServerLike = Readonly<{
62
84
  type ViteHotContextLike = Readonly<{
63
85
  file: string;
64
86
  server: ViteServerLike;
87
+ modules?: readonly unknown[];
65
88
  }>;
66
89
  type RollupWatchContextLike = Readonly<{
67
90
  addWatchFile(path: string): void;
@@ -77,10 +100,31 @@ export type DistributedSvelteKitVitePlugin = Readonly<{
77
100
  buildStart(this: RollupWatchContextLike): void;
78
101
  resolveId(source: string): string | undefined;
79
102
  load(id: string): string | undefined;
103
+ transformIndexHtml(): LifecycleHtmlTag[];
80
104
  handleHotUpdate(context: ViteHotContextLike): Promise<never[] | undefined>;
81
105
  watchChange(id: string): Promise<void>;
82
106
  closeBundle(): Promise<void>;
83
107
  }>;
108
+ export type DistributedLifecycleVitePlugin = Readonly<{
109
+ name: string;
110
+ enforce: 'pre';
111
+ configResolved(config: Readonly<{
112
+ root: string;
113
+ }>): void;
114
+ configureServer(server: ViteServerLike): void;
115
+ transformIndexHtml(): LifecycleHtmlTag[];
116
+ handleHotUpdate(context: ViteHotContextLike): never[] | undefined;
117
+ }>;
118
+ type LifecycleHtmlTag = Readonly<{
119
+ tag: 'meta';
120
+ attrs: Readonly<{
121
+ name: string;
122
+ content: string;
123
+ }>;
124
+ injectTo: 'head-prepend';
125
+ }>;
126
+ /** Lifecycle-only side channel for projects using committed generated clients. */
127
+ export declare function distributedLifecycle(): DistributedLifecycleVitePlugin;
84
128
  /** Generate every configured surface through the same transaction used by Vite. */
85
129
  export declare function generateDistributedSvelteKit(options: DistributedSvelteKitViteOptions): Promise<void>;
86
130
  /** Check every configured surface through canonical `distributed client --check`; never write. */
@@ -100,4 +144,3 @@ export declare function distributedSvelteKit(options: DistributedSvelteKitViteOp
100
144
  * generation and is safe to call from `svelte.config.js`.
101
145
  */
102
146
  export declare function distributedSvelteKitAliases(options: Pick<DistributedSvelteKitViteOptions, 'cwd' | 'clients'>): Readonly<Record<string, string>>;
103
- export {};