driftjs-ssr 0.0.16 → 0.0.17

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,81 @@
1
+ declare module 'driftjs-ssr' {
2
+ import type { CompiledModule } from 'driftjs-compiler';
3
+ import type { Context } from 'driftjs-shared';
4
+
5
+ export {
6
+ createContext,
7
+ provide,
8
+ inject,
9
+ provideContext,
10
+ injectContext,
11
+ effect,
12
+ onMount,
13
+ onUnmount,
14
+ type Context,
15
+ } from 'driftjs-shared';
16
+
17
+ export interface SSRExecutionOptions {
18
+ readonly scope?: Record<string, any> | undefined;
19
+ }
20
+
21
+ export interface StreamOptions extends SSRExecutionOptions {
22
+ readonly onShellReady?: (() => void) | undefined;
23
+ readonly onAllReady?: (() => void) | undefined;
24
+ readonly onError?: ((error: unknown) => void) | undefined;
25
+ readonly timeoutMs?: number | undefined;
26
+ readonly nonce?: string | undefined;
27
+ }
28
+
29
+ export interface DriftStream extends ReadableStream<Uint8Array> {
30
+ pipe<T>(destination: T): T;
31
+ abort(reason?: any): void;
32
+ }
33
+
34
+ export interface ServerNode {
35
+ type: 'element' | 'text' | 'comment' | 'fragment';
36
+ tag?: string;
37
+ attrs?: Map<string, string | boolean | null>;
38
+ children: (ServerNode | string)[];
39
+ content?: string;
40
+ }
41
+
42
+ export interface IslandRenderOptions extends SSRExecutionOptions {
43
+ readonly trigger?: 'eager' | 'idle' | 'visible' | 'interaction' | 'media';
44
+ readonly timeout?: number;
45
+ readonly media?: string;
46
+ readonly rootMargin?: string;
47
+ readonly islandTag?: string;
48
+ readonly props?: Record<string, any>;
49
+ }
50
+
51
+ export class DriftServerVM {
52
+ scope: Record<string, any>;
53
+ parentVM: DriftServerVM | null;
54
+ contextMap: Map<symbol, any>;
55
+
56
+ constructor();
57
+ execute(rawModule: CompiledModule, options?: SSRExecutionOptions): ServerNode | null;
58
+ }
59
+
60
+ export function serializeNode(
61
+ node: ServerNode | string | null | undefined,
62
+ isRawText?: boolean,
63
+ rawTag?: string
64
+ ): string;
65
+
66
+ export function renderToString(
67
+ component: CompiledModule,
68
+ options?: SSRExecutionOptions
69
+ ): string;
70
+
71
+ export function renderIslandToString(
72
+ islandName: string,
73
+ component: CompiledModule,
74
+ options?: IslandRenderOptions
75
+ ): string;
76
+
77
+ export function renderToStream(
78
+ component: CompiledModule,
79
+ options?: StreamOptions
80
+ ): DriftStream;
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "driftjs-ssr",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Headless Server-Side Rendering (SSR) register Virtual Machine and HTML serializer for DriftJS.",
5
5
  "keywords": [
6
6
  "driftjs",
@@ -19,10 +19,10 @@
19
19
  ],
20
20
  "main": "./dist/index-cjs.js",
21
21
  "module": "./dist/index-es.js",
22
- "types": "./src/index.ts",
22
+ "types": "./dist/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
- "types": "./src/index.ts",
25
+ "types": "./dist/index.d.ts",
26
26
  "import": "./dist/index-es.js",
27
27
  "require": "./dist/index-cjs.js",
28
28
  "default": "./dist/index-es.js"
@@ -30,13 +30,13 @@
30
30
  },
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "driftjs-compiler": "0.0.16",
34
- "driftjs-shared": "0.0.16"
33
+ "driftjs-compiler": "0.0.17",
34
+ "driftjs-shared": "0.0.17"
35
35
  },
36
36
  "devDependencies": {
37
- "typescript": "^7.0.2",
38
- "vite": "^8.1.5",
39
- "vitest": "^4.1.10"
37
+ "typescript": "7.0.2",
38
+ "vite": "8.3.1",
39
+ "vitest": "5.0.2"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "vite build",