@modern-js/types 2.64.1 → 2.64.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/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.64.1",
18
+ "version": "2.64.3",
19
19
  "types": "./index.d.ts",
20
20
  "exports": {
21
21
  ".": {
@@ -35,6 +35,9 @@
35
35
  ],
36
36
  "hoist-non-react-statics": [
37
37
  "./packages/hoist-non-react-statics.d.ts"
38
+ ],
39
+ "server": [
40
+ "./server/index.d.ts"
38
41
  ]
39
42
  }
40
43
  },
@@ -45,8 +48,8 @@
45
48
  "http-proxy-middleware": "^2.0.4",
46
49
  "jest": "^29",
47
50
  "type-fest": "2.15.0",
48
- "@scripts/build": "2.64.1",
49
- "@scripts/jest-config": "2.64.1"
51
+ "@scripts/build": "2.64.3",
52
+ "@scripts/jest-config": "2.64.3"
50
53
  },
51
54
  "sideEffects": false,
52
55
  "publishConfig": {
package/server/hook.d.ts CHANGED
@@ -4,7 +4,7 @@ import type {
4
4
  ServerResponse,
5
5
  } from 'http';
6
6
  import type { ServerRoute } from './route';
7
- import type { Reporter } from './utils';
7
+ import type { Logger, Metrics, Reporter } from './utils';
8
8
 
9
9
  export type CookieAPI = {
10
10
  /**
package/server/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './bff';
6
6
  export * from './devServer';
7
7
  export * from './middleware';
8
8
  export * from './monitor';
9
+ export * from './rsc';
package/server/route.d.ts CHANGED
@@ -9,6 +9,8 @@ export interface ServerRoute {
9
9
  isSPA?: boolean;
10
10
  // if route is ssr page
11
11
  isSSR?: boolean;
12
+ // if route is rsc page
13
+ isRSC?: boolean;
12
14
  // if route is stream response
13
15
  isStream?: boolean;
14
16
  // if route is api service
@@ -0,0 +1,121 @@
1
+ export type ImportManifestEntry = {
2
+ id: string | number;
3
+ chunks: (string | number)[];
4
+ styles?: string[];
5
+ name: string;
6
+ };
7
+
8
+ export interface ClientReference {
9
+ readonly id: string | number;
10
+ readonly exportName: string;
11
+ ssrId?: string | number;
12
+ }
13
+
14
+ export interface ClientManifest {
15
+ [id: string]: ImportManifestEntry;
16
+ }
17
+
18
+ export interface ServerManifest {
19
+ [id: string]: ImportManifestEntry;
20
+ }
21
+
22
+ export interface ServerReferencesModuleInfo {
23
+ readonly exportNames: string[];
24
+ moduleId?: string | number;
25
+ }
26
+
27
+ export type ClientReferencesMap = Map<string, ClientReference[]>;
28
+
29
+ export type ServerReferencesMap = Map<string, ServerReferencesModuleInfo>;
30
+
31
+ export type ModuleLoading = null | {
32
+ prefix: string;
33
+ crossOrigin?: 'use-credentials' | '';
34
+ };
35
+
36
+ export type SSRModuleMap = {
37
+ [clientId: string]: {
38
+ [clientExportName: string]: ImportManifestEntry;
39
+ };
40
+ };
41
+
42
+ export type SSRManifest = {
43
+ moduleMap: SSRModuleMap;
44
+ moduleLoading: ModuleLoading;
45
+ styles: string[];
46
+ };
47
+
48
+ export type ServerManifest = {
49
+ [id: string]: ImportManifestEntry;
50
+ };
51
+
52
+ export type ClientManifest = {
53
+ [id: string]: ImportManifestEntry;
54
+ };
55
+
56
+ declare module 'react-server-dom-webpack/server' {
57
+ export const registerClientReference: <T>(
58
+ proxyImplementation: any,
59
+ id: string,
60
+ exportName: string,
61
+ ) => ClientReference[];
62
+
63
+ export const registerServerReference: <T>(
64
+ proxyImplementation: any,
65
+ id: string,
66
+ exportName: string,
67
+ ) => ServerReference[];
68
+ }
69
+
70
+ declare module 'react-server-dom-webpack/server.edge' {
71
+ type Options = {
72
+ environmentName?: string;
73
+ identifierPrefix?: string;
74
+ signal?: AbortSignal;
75
+ temporaryReferences?: TemporaryReferenceSet;
76
+ onError?: ((error: unknown) => void) | undefined;
77
+ onPostpone?: ((reason: string) => void) | undefined;
78
+ };
79
+
80
+ export function renderToReadableStream(
81
+ model: ReactClientValue,
82
+ webpackMap: ClientManifest,
83
+ options?: Options,
84
+ ): ReadableStream;
85
+ export function decodeReply<T>(
86
+ body: string | FormData,
87
+ webpackMap?: ServerManifest,
88
+ ): Promise<T>;
89
+ }
90
+
91
+ declare module 'react-server-dom-webpack/client' {
92
+ type CallServerCallback = <T, A extends unknown[] = unknown[]>(
93
+ string,
94
+ args: A,
95
+ ) => Promise<T>;
96
+
97
+ type Options<T> = {
98
+ callServer?: CallServerCallback<T>;
99
+ temporaryReferences?: TemporaryReferenceSet;
100
+ };
101
+
102
+ export function createFromFetch<T>(
103
+ promiseForResponse: Promise<Response>,
104
+ options?: Options<T>,
105
+ ): Promise<T>;
106
+ export function encodeReply(
107
+ value: ReactServerValue,
108
+ options?: { temporaryReferences?: TemporaryReferenceSet },
109
+ ): Promise<string | URLSearchParams | FormData>;
110
+ }
111
+
112
+ declare module 'react-server-dom-webpack/client.edge' {
113
+ export type Options = {
114
+ ssrManifest: SSRManifest;
115
+ nonce?: string;
116
+ };
117
+ export function createFromReadableStream<T>(
118
+ stream: ReadableStream,
119
+ options: Options<T>,
120
+ ): Promise<T>;
121
+ }