@nestjs-ssr/react 0.3.3 → 0.3.5
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/dist/cli/init.js +5 -5
- package/dist/cli/init.mjs +5 -5
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +50 -8
- package/dist/client.mjs +50 -8
- package/dist/{index-DdE--mA2.d.mts → index-CiYcz-1T.d.mts} +89 -4
- package/dist/{index-BzOLOiIZ.d.ts → index-Dq2qZSge.d.ts} +89 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +90 -36
- package/dist/index.mjs +61 -7
- package/dist/render/index.d.mts +3 -3
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.js +58 -24
- package/dist/render/index.mjs +41 -6
- package/dist/{render-response.interface-CxbuKGnV.d.mts → render-response.interface-ClWJXKL4.d.mts} +19 -10
- package/dist/{render-response.interface-CxbuKGnV.d.ts → render-response.interface-ClWJXKL4.d.ts} +19 -10
- package/dist/templates/entry-client.tsx +69 -27
- package/dist/templates/entry-server.tsx +25 -8
- package/dist/{use-page-context-CGT9woWe.d.mts → use-page-context-CVC9DHcL.d.mts} +2 -1
- package/dist/{use-page-context-05ODF4zW.d.ts → use-page-context-DChgHhL9.d.ts} +2 -1
- package/etc/react.api.md +250 -262
- package/package.json +1 -1
- package/src/templates/entry-client.tsx +69 -27
- package/src/templates/entry-server.tsx +25 -8
package/etc/react.api.md
CHANGED
|
@@ -1,262 +1,250 @@
|
|
|
1
|
-
## API Report File for "@nestjs-ssr/react"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// @public
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// @public
|
|
83
|
-
export interface
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// @public
|
|
212
|
-
export
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// @public
|
|
253
|
-
export function useParams(): Record<string, string>;
|
|
254
|
-
|
|
255
|
-
// @public
|
|
256
|
-
export function useQuery(): Record<string, string | string[]>;
|
|
257
|
-
|
|
258
|
-
// @public
|
|
259
|
-
export function useUserAgent(): string | undefined;
|
|
260
|
-
|
|
261
|
-
// (No @packageDocumentation comment for this package)
|
|
262
|
-
```
|
|
1
|
+
## API Report File for "@nestjs-ssr/react"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { CallHandler } from '@nestjs/common';
|
|
8
|
+
import { ComponentType } from 'react';
|
|
9
|
+
import { DynamicModule } from '@nestjs/common';
|
|
10
|
+
import { ExecutionContext } from '@nestjs/common';
|
|
11
|
+
import { NestInterceptor } from '@nestjs/common';
|
|
12
|
+
import { Observable } from 'rxjs';
|
|
13
|
+
import { default as React_2 } from 'react';
|
|
14
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
|
+
import { ReactNode } from 'react';
|
|
16
|
+
import { Reflector } from '@nestjs/core';
|
|
17
|
+
import { Response as Response_2 } from 'express';
|
|
18
|
+
import { ViteDevServer } from 'vite';
|
|
19
|
+
|
|
20
|
+
// @public
|
|
21
|
+
export function createSSRHooks<T extends RenderContext = RenderContext>(): {
|
|
22
|
+
usePageContext: () => T;
|
|
23
|
+
useParams: () => Record<string, string>;
|
|
24
|
+
useQuery: () => Record<string, string | string[]>;
|
|
25
|
+
useRequest: () => T;
|
|
26
|
+
useHeaders: () => Record<string, string>;
|
|
27
|
+
useHeader: (name: string) => string | undefined;
|
|
28
|
+
useCookies: () => Record<string, string>;
|
|
29
|
+
useCookie: (name: string) => string | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Warning: (ae-forgotten-export) The symbol "ErrorPageDevelopmentProps" needs to be exported by the entry point index.d.ts
|
|
33
|
+
//
|
|
34
|
+
// @public
|
|
35
|
+
export function ErrorPageDevelopment({ error, viewPath, phase, }: ErrorPageDevelopmentProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
// @public
|
|
38
|
+
export function ErrorPageProduction(): react_jsx_runtime.JSX.Element;
|
|
39
|
+
|
|
40
|
+
// @public
|
|
41
|
+
export interface HeadData {
|
|
42
|
+
bodyAttributes?: Record<string, string>;
|
|
43
|
+
canonical?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
htmlAttributes?: Record<string, string>;
|
|
46
|
+
jsonLd?: Array<Record<string, any>>;
|
|
47
|
+
keywords?: string;
|
|
48
|
+
links?: Array<{
|
|
49
|
+
rel: string;
|
|
50
|
+
href: string;
|
|
51
|
+
as?: string;
|
|
52
|
+
type?: string;
|
|
53
|
+
crossorigin?: string;
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}>;
|
|
56
|
+
meta?: Array<{
|
|
57
|
+
name?: string;
|
|
58
|
+
property?: string;
|
|
59
|
+
content: string;
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}>;
|
|
62
|
+
ogDescription?: string;
|
|
63
|
+
ogImage?: string;
|
|
64
|
+
ogTitle?: string;
|
|
65
|
+
scripts?: Array<{
|
|
66
|
+
src?: string;
|
|
67
|
+
async?: boolean;
|
|
68
|
+
defer?: boolean;
|
|
69
|
+
type?: string;
|
|
70
|
+
innerHTML?: string;
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
}>;
|
|
73
|
+
title?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// @public
|
|
77
|
+
export function Layout(layout: LayoutComponent<any>, options?: LayoutDecoratorOptions): ClassDecorator;
|
|
78
|
+
|
|
79
|
+
// @public
|
|
80
|
+
export type LayoutComponent<TProps = {}> = ComponentType<LayoutProps<TProps>>;
|
|
81
|
+
|
|
82
|
+
// @public
|
|
83
|
+
export interface LayoutDecoratorOptions {
|
|
84
|
+
props?: Record<string, any>;
|
|
85
|
+
skipRoot?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// @public
|
|
89
|
+
export interface LayoutProps<TProps = {}> {
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
context?: RenderContext;
|
|
92
|
+
head?: HeadData;
|
|
93
|
+
layoutProps?: TProps;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// @public
|
|
97
|
+
export interface PageComponentWithLayout<TPageProps = {}, TLayoutProps = {}> {
|
|
98
|
+
(props: TPageProps): ReactNode;
|
|
99
|
+
layout?: LayoutComponent<TLayoutProps>;
|
|
100
|
+
layoutProps?: TLayoutProps;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// @public
|
|
104
|
+
export function PageContextProvider({ context: initialContext, children, isSegment, }: {
|
|
105
|
+
context: RenderContext;
|
|
106
|
+
children: React_2.ReactNode;
|
|
107
|
+
isSegment?: boolean;
|
|
108
|
+
}): react_jsx_runtime.JSX.Element;
|
|
109
|
+
|
|
110
|
+
// @public
|
|
111
|
+
export type PageProps<TProps = {}> = TProps & {
|
|
112
|
+
head?: HeadData;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Warning: (ae-forgotten-export) The symbol "RenderReturnType" needs to be exported by the entry point index.d.ts
|
|
116
|
+
// Warning: (ae-forgotten-export) The symbol "ExtractComponentData" needs to be exported by the entry point index.d.ts
|
|
117
|
+
//
|
|
118
|
+
// @public
|
|
119
|
+
export function Render<T extends React_2.ComponentType<any>>(component: T, options?: RenderOptions): <TMethod extends (...args: any[]) => RenderReturnType<ExtractComponentData<T>> | Promise<RenderReturnType<ExtractComponentData<T>>>>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<TMethod>) => TypedPropertyDescriptor<TMethod> | void;
|
|
120
|
+
|
|
121
|
+
// @public
|
|
122
|
+
export interface RenderConfig {
|
|
123
|
+
allowedCookies?: string[];
|
|
124
|
+
allowedHeaders?: string[];
|
|
125
|
+
defaultHead?: HeadData;
|
|
126
|
+
// Warning: (ae-forgotten-export) The symbol "ErrorPageDevelopmentProps$1" needs to be exported by the entry point index.d.ts
|
|
127
|
+
errorPageDevelopment?: ComponentType<ErrorPageDevelopmentProps$1>;
|
|
128
|
+
errorPageProduction?: ComponentType;
|
|
129
|
+
mode?: SSRMode;
|
|
130
|
+
template?: string;
|
|
131
|
+
timeout?: number;
|
|
132
|
+
// Warning: (ae-forgotten-export) The symbol "ViteConfig" needs to be exported by the entry point index.d.ts
|
|
133
|
+
vite?: ViteConfig;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// @public
|
|
137
|
+
export interface RenderContext {
|
|
138
|
+
// (undocumented)
|
|
139
|
+
method: string;
|
|
140
|
+
// (undocumented)
|
|
141
|
+
params: Record<string, string>;
|
|
142
|
+
// (undocumented)
|
|
143
|
+
path: string;
|
|
144
|
+
// (undocumented)
|
|
145
|
+
query: Record<string, string | string[]>;
|
|
146
|
+
// (undocumented)
|
|
147
|
+
url: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// @public (undocumented)
|
|
151
|
+
export class RenderInterceptor implements NestInterceptor {
|
|
152
|
+
constructor(reflector: Reflector, renderService: RenderService, allowedHeaders?: string[] | undefined, allowedCookies?: string[] | undefined);
|
|
153
|
+
// (undocumented)
|
|
154
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// @public (undocumented)
|
|
158
|
+
export class RenderModule {
|
|
159
|
+
static forRoot(config?: RenderConfig): DynamicModule;
|
|
160
|
+
static forRootAsync(options: {
|
|
161
|
+
imports?: any[];
|
|
162
|
+
inject?: any[];
|
|
163
|
+
useFactory: (...args: any[]) => Promise<RenderConfig> | RenderConfig;
|
|
164
|
+
}): DynamicModule;
|
|
165
|
+
// @deprecated (undocumented)
|
|
166
|
+
static register(config?: RenderConfig): DynamicModule;
|
|
167
|
+
// @deprecated (undocumented)
|
|
168
|
+
static registerAsync(options: {
|
|
169
|
+
imports?: any[];
|
|
170
|
+
inject?: any[];
|
|
171
|
+
useFactory: (...args: any[]) => Promise<RenderConfig> | RenderConfig;
|
|
172
|
+
}): DynamicModule;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// @public
|
|
176
|
+
export interface RenderOptions {
|
|
177
|
+
layout?: LayoutComponent<any> | false | null;
|
|
178
|
+
layoutProps?: Record<string, any>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// @public
|
|
182
|
+
export interface RenderResponse<T = any> {
|
|
183
|
+
head?: HeadData;
|
|
184
|
+
layoutProps?: Record<string, any>;
|
|
185
|
+
props: T;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// @public
|
|
189
|
+
export class RenderService {
|
|
190
|
+
// Warning: (ae-forgotten-export) The symbol "StringRenderer" needs to be exported by the entry point index.d.ts
|
|
191
|
+
// Warning: (ae-forgotten-export) The symbol "StreamRenderer" needs to be exported by the entry point index.d.ts
|
|
192
|
+
constructor(stringRenderer: StringRenderer, streamRenderer: StreamRenderer, ssrMode?: SSRMode, defaultHead?: HeadData | undefined, customTemplate?: string);
|
|
193
|
+
getRootLayout(): Promise<any | null>;
|
|
194
|
+
render(viewComponent: any, data?: any, res?: Response_2, head?: HeadData): Promise<string | void>;
|
|
195
|
+
// Warning: (ae-forgotten-export) The symbol "SegmentResponse" needs to be exported by the entry point index.d.ts
|
|
196
|
+
renderSegment(viewComponent: any, data: any, swapTarget: string, head?: HeadData): Promise<SegmentResponse>;
|
|
197
|
+
// (undocumented)
|
|
198
|
+
setViteServer(vite: ViteDevServer): void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// @public
|
|
202
|
+
export type SSRMode = 'string' | 'stream';
|
|
203
|
+
|
|
204
|
+
// @public
|
|
205
|
+
export class StreamingErrorHandler {
|
|
206
|
+
constructor(errorPageDevelopment?: ComponentType<ErrorPageDevelopmentProps$1> | undefined, errorPageProduction?: ComponentType | undefined);
|
|
207
|
+
handleShellError(error: Error, res: Response_2, viewPath: string, isDevelopment: boolean): void;
|
|
208
|
+
handleStreamError(error: Error, viewPath: string): void;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// @public
|
|
212
|
+
export class TemplateParserService {
|
|
213
|
+
buildHeadTags(head?: HeadData): string;
|
|
214
|
+
buildInlineScripts(data: any, context: any, componentName: string, layouts?: Array<{
|
|
215
|
+
layout: any;
|
|
216
|
+
props?: any;
|
|
217
|
+
}>): string;
|
|
218
|
+
getClientScriptTag(isDevelopment: boolean, manifest?: any): string;
|
|
219
|
+
getStylesheetTags(isDevelopment: boolean, manifest?: any): string;
|
|
220
|
+
// Warning: (ae-forgotten-export) The symbol "TemplateParts" needs to be exported by the entry point index.d.ts
|
|
221
|
+
parseTemplate(html: string): TemplateParts;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// @public (undocumented)
|
|
225
|
+
export const useCookie: (name: string) => string | undefined;
|
|
226
|
+
|
|
227
|
+
// @public (undocumented)
|
|
228
|
+
export const useCookies: () => Record<string, string>;
|
|
229
|
+
|
|
230
|
+
// @public (undocumented)
|
|
231
|
+
export const useHeader: (name: string) => string | undefined;
|
|
232
|
+
|
|
233
|
+
// @public (undocumented)
|
|
234
|
+
export const useHeaders: () => Record<string, string>;
|
|
235
|
+
|
|
236
|
+
// @public (undocumented)
|
|
237
|
+
export const usePageContext: () => RenderContext;
|
|
238
|
+
|
|
239
|
+
// @public (undocumented)
|
|
240
|
+
export const useParams: () => Record<string, string>;
|
|
241
|
+
|
|
242
|
+
// @public (undocumented)
|
|
243
|
+
export const useQuery: () => Record<string, string | string[]>;
|
|
244
|
+
|
|
245
|
+
// @public (undocumented)
|
|
246
|
+
export const useRequest: () => RenderContext;
|
|
247
|
+
|
|
248
|
+
// (No @packageDocumentation comment for this package)
|
|
249
|
+
|
|
250
|
+
```
|