@nestjs-ssr/react 0.2.3 → 0.2.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/README.md +36 -33
- package/dist/cli/init.js +2 -1
- package/dist/cli/init.mjs +2 -1
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/dist/{index-Dq1yt0sX.d.mts → index-BMdluY1g.d.mts} +51 -39
- package/dist/{index-CaGD266H.d.ts → index-rl0S5kqW.d.ts} +51 -39
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -43
- package/dist/index.mjs +48 -43
- package/dist/render/index.d.mts +1 -1
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.js +46 -41
- package/dist/render/index.mjs +46 -41
- package/package.json +1 -1
package/dist/render/index.mjs
CHANGED
|
@@ -1129,39 +1129,32 @@ var RenderModule = class _RenderModule {
|
|
|
1129
1129
|
__name(this, "RenderModule");
|
|
1130
1130
|
}
|
|
1131
1131
|
/**
|
|
1132
|
-
*
|
|
1132
|
+
* Configure the render module
|
|
1133
1133
|
*
|
|
1134
1134
|
* @param config - Optional render configuration
|
|
1135
1135
|
* @returns Dynamic module
|
|
1136
1136
|
*
|
|
1137
1137
|
* @example
|
|
1138
1138
|
* ```ts
|
|
1139
|
-
* // Zero config -
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1139
|
+
* // Zero config - uses defaults
|
|
1140
|
+
* RenderModule.forRoot()
|
|
1141
|
+
*
|
|
1142
|
+
* // Enable streaming SSR
|
|
1143
|
+
* RenderModule.forRoot({ mode: 'stream' })
|
|
1143
1144
|
*
|
|
1144
1145
|
* // Enable HMR with proxy mode
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* RenderModule.register({
|
|
1148
|
-
* vite: { mode: 'proxy', port: 5173 }
|
|
1149
|
-
* })
|
|
1150
|
-
* ],
|
|
1146
|
+
* RenderModule.forRoot({
|
|
1147
|
+
* vite: { mode: 'proxy', port: 5173 }
|
|
1151
1148
|
* })
|
|
1152
1149
|
*
|
|
1153
|
-
* // Enable streaming SSR
|
|
1154
|
-
* RenderModule.register({ mode: 'stream' })
|
|
1155
|
-
*
|
|
1156
1150
|
* // Custom error pages
|
|
1157
|
-
* RenderModule.
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
* errorPageProduction: MyCustomProdErrorPage,
|
|
1151
|
+
* RenderModule.forRoot({
|
|
1152
|
+
* errorPageDevelopment: DevErrorPage,
|
|
1153
|
+
* errorPageProduction: ProdErrorPage,
|
|
1161
1154
|
* })
|
|
1162
1155
|
* ```
|
|
1163
1156
|
*/
|
|
1164
|
-
static
|
|
1157
|
+
static forRoot(config) {
|
|
1165
1158
|
const providers = [
|
|
1166
1159
|
RenderService,
|
|
1167
1160
|
TemplateParserService,
|
|
@@ -1224,35 +1217,42 @@ var RenderModule = class _RenderModule {
|
|
|
1224
1217
|
};
|
|
1225
1218
|
}
|
|
1226
1219
|
/**
|
|
1227
|
-
*
|
|
1220
|
+
* Configure the render module with async factory
|
|
1228
1221
|
*
|
|
1229
|
-
* Use
|
|
1222
|
+
* Use when configuration depends on other services (database, config service, etc.)
|
|
1230
1223
|
*
|
|
1231
1224
|
* @param options - Async configuration options
|
|
1232
1225
|
* @returns Dynamic module
|
|
1233
1226
|
*
|
|
1234
1227
|
* @example
|
|
1235
1228
|
* ```ts
|
|
1236
|
-
* // Load
|
|
1237
|
-
* RenderModule.
|
|
1229
|
+
* // Load config from ConfigService
|
|
1230
|
+
* RenderModule.forRootAsync({
|
|
1231
|
+
* imports: [ConfigModule],
|
|
1232
|
+
* inject: [ConfigService],
|
|
1233
|
+
* useFactory: (config: ConfigService) => ({
|
|
1234
|
+
* mode: config.get('SSR_MODE'),
|
|
1235
|
+
* defaultHead: { title: config.get('APP_NAME') },
|
|
1236
|
+
* }),
|
|
1237
|
+
* })
|
|
1238
|
+
*
|
|
1239
|
+
* // Load from database
|
|
1240
|
+
* RenderModule.forRootAsync({
|
|
1238
1241
|
* imports: [TenantModule],
|
|
1239
|
-
* inject: [
|
|
1240
|
-
* useFactory: async (
|
|
1241
|
-
* const tenant = await
|
|
1242
|
+
* inject: [TenantService],
|
|
1243
|
+
* useFactory: async (tenantService: TenantService) => {
|
|
1244
|
+
* const tenant = await tenantService.getCurrent();
|
|
1242
1245
|
* return {
|
|
1243
1246
|
* defaultHead: {
|
|
1244
|
-
* title: tenant.
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
* { rel: 'icon', href: tenant.favicon }
|
|
1248
|
-
* ]
|
|
1249
|
-
* }
|
|
1247
|
+
* title: tenant.name,
|
|
1248
|
+
* links: [{ rel: 'icon', href: tenant.favicon }],
|
|
1249
|
+
* },
|
|
1250
1250
|
* };
|
|
1251
|
-
* }
|
|
1251
|
+
* },
|
|
1252
1252
|
* })
|
|
1253
1253
|
* ```
|
|
1254
1254
|
*/
|
|
1255
|
-
static
|
|
1255
|
+
static forRootAsync(options) {
|
|
1256
1256
|
const configProvider = {
|
|
1257
1257
|
provide: "RENDER_CONFIG",
|
|
1258
1258
|
useFactory: options.useFactory,
|
|
@@ -1268,7 +1268,6 @@ var RenderModule = class _RenderModule {
|
|
|
1268
1268
|
provide: APP_INTERCEPTOR,
|
|
1269
1269
|
useClass: RenderInterceptor
|
|
1270
1270
|
},
|
|
1271
|
-
// Vite configuration provider - reads from config
|
|
1272
1271
|
{
|
|
1273
1272
|
provide: "VITE_CONFIG",
|
|
1274
1273
|
useFactory: /* @__PURE__ */ __name((config) => config?.vite || {}, "useFactory"),
|
|
@@ -1276,7 +1275,6 @@ var RenderModule = class _RenderModule {
|
|
|
1276
1275
|
"RENDER_CONFIG"
|
|
1277
1276
|
]
|
|
1278
1277
|
},
|
|
1279
|
-
// SSR mode provider - reads from config
|
|
1280
1278
|
{
|
|
1281
1279
|
provide: "SSR_MODE",
|
|
1282
1280
|
useFactory: /* @__PURE__ */ __name((config) => config?.mode, "useFactory"),
|
|
@@ -1284,7 +1282,6 @@ var RenderModule = class _RenderModule {
|
|
|
1284
1282
|
"RENDER_CONFIG"
|
|
1285
1283
|
]
|
|
1286
1284
|
},
|
|
1287
|
-
// Error page providers - read from config
|
|
1288
1285
|
{
|
|
1289
1286
|
provide: "ERROR_PAGE_DEVELOPMENT",
|
|
1290
1287
|
useFactory: /* @__PURE__ */ __name((config) => config?.errorPageDevelopment, "useFactory"),
|
|
@@ -1299,7 +1296,6 @@ var RenderModule = class _RenderModule {
|
|
|
1299
1296
|
"RENDER_CONFIG"
|
|
1300
1297
|
]
|
|
1301
1298
|
},
|
|
1302
|
-
// Default head provider - reads from config
|
|
1303
1299
|
{
|
|
1304
1300
|
provide: "DEFAULT_HEAD",
|
|
1305
1301
|
useFactory: /* @__PURE__ */ __name((config) => config?.defaultHead, "useFactory"),
|
|
@@ -1307,7 +1303,6 @@ var RenderModule = class _RenderModule {
|
|
|
1307
1303
|
"RENDER_CONFIG"
|
|
1308
1304
|
]
|
|
1309
1305
|
},
|
|
1310
|
-
// Custom template provider - reads from config
|
|
1311
1306
|
{
|
|
1312
1307
|
provide: "CUSTOM_TEMPLATE",
|
|
1313
1308
|
useFactory: /* @__PURE__ */ __name((config) => config?.template, "useFactory"),
|
|
@@ -1315,7 +1310,6 @@ var RenderModule = class _RenderModule {
|
|
|
1315
1310
|
"RENDER_CONFIG"
|
|
1316
1311
|
]
|
|
1317
1312
|
},
|
|
1318
|
-
// Allowed headers provider - reads from config
|
|
1319
1313
|
{
|
|
1320
1314
|
provide: "ALLOWED_HEADERS",
|
|
1321
1315
|
useFactory: /* @__PURE__ */ __name((config) => config?.allowedHeaders || [], "useFactory"),
|
|
@@ -1323,7 +1317,6 @@ var RenderModule = class _RenderModule {
|
|
|
1323
1317
|
"RENDER_CONFIG"
|
|
1324
1318
|
]
|
|
1325
1319
|
},
|
|
1326
|
-
// Allowed cookies provider - reads from config
|
|
1327
1320
|
{
|
|
1328
1321
|
provide: "ALLOWED_COOKIES",
|
|
1329
1322
|
useFactory: /* @__PURE__ */ __name((config) => config?.allowedCookies || [], "useFactory"),
|
|
@@ -1342,6 +1335,18 @@ var RenderModule = class _RenderModule {
|
|
|
1342
1335
|
]
|
|
1343
1336
|
};
|
|
1344
1337
|
}
|
|
1338
|
+
/**
|
|
1339
|
+
* @deprecated Use forRoot() instead
|
|
1340
|
+
*/
|
|
1341
|
+
static register(config) {
|
|
1342
|
+
return this.forRoot(config);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* @deprecated Use forRootAsync() instead
|
|
1346
|
+
*/
|
|
1347
|
+
static registerAsync(options) {
|
|
1348
|
+
return this.forRootAsync(options);
|
|
1349
|
+
}
|
|
1345
1350
|
};
|
|
1346
1351
|
RenderModule = _ts_decorate6([
|
|
1347
1352
|
Global(),
|