@nestjs-ssr/react 0.1.1 → 0.1.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/dist/{index-Bptct1Q3.d.mts → index-C7qZ7BPg.d.mts} +1 -0
- package/dist/{index-Bptct1Q3.d.ts → index-C7qZ7BPg.d.ts} +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/dist/render/index.d.mts +1 -1
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.js +10 -2
- package/dist/render/index.js.map +1 -1
- package/dist/render/index.mjs +11 -3
- package/dist/render/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { Injectable, Logger, Optional, Inject, Global, Module, SetMetadata } fro
|
|
|
2
2
|
import { HttpAdapterHost, APP_INTERCEPTOR, Reflector } from '@nestjs/core';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import { existsSync, readFileSync, realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync } from 'fs';
|
|
5
|
-
import path2, { join, win32, posix } from 'path';
|
|
5
|
+
import path2, { join, relative, win32, posix } from 'path';
|
|
6
6
|
import serialize from 'serialize-javascript';
|
|
7
7
|
import escapeHtml from 'escape-html';
|
|
8
8
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
@@ -426,12 +426,20 @@ var RenderService = class _RenderService {
|
|
|
426
426
|
serverManifest = null;
|
|
427
427
|
isDevelopment;
|
|
428
428
|
ssrMode;
|
|
429
|
+
entryServerPath;
|
|
429
430
|
constructor(templateParser, streamingErrorHandler, ssrMode, defaultHead) {
|
|
430
431
|
this.templateParser = templateParser;
|
|
431
432
|
this.streamingErrorHandler = streamingErrorHandler;
|
|
432
433
|
this.defaultHead = defaultHead;
|
|
433
434
|
this.isDevelopment = process.env.NODE_ENV !== "production";
|
|
434
435
|
this.ssrMode = ssrMode || process.env.SSR_MODE || "string";
|
|
436
|
+
const absoluteTemplatePath = join(__dirname, "../templates/entry-server.tsx");
|
|
437
|
+
const relativeToApp = relative(process.cwd(), absoluteTemplatePath);
|
|
438
|
+
if (relativeToApp.startsWith("..")) {
|
|
439
|
+
this.entryServerPath = absoluteTemplatePath;
|
|
440
|
+
} else {
|
|
441
|
+
this.entryServerPath = "/" + relativeToApp.replace(/\\/g, "/");
|
|
442
|
+
}
|
|
435
443
|
let templatePath;
|
|
436
444
|
if (this.isDevelopment) {
|
|
437
445
|
const packageTemplatePaths = [
|
|
@@ -527,7 +535,7 @@ var RenderService = class _RenderService {
|
|
|
527
535
|
}
|
|
528
536
|
let renderModule;
|
|
529
537
|
if (this.vite) {
|
|
530
|
-
renderModule = await this.vite.ssrLoadModule(
|
|
538
|
+
renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
|
|
531
539
|
} else {
|
|
532
540
|
if (this.serverManifest) {
|
|
533
541
|
const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
|
|
@@ -611,7 +619,7 @@ var RenderService = class _RenderService {
|
|
|
611
619
|
const templateParts = this.templateParser.parseTemplate(template);
|
|
612
620
|
let renderModule;
|
|
613
621
|
if (this.vite) {
|
|
614
|
-
renderModule = await this.vite.ssrLoadModule(
|
|
622
|
+
renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
|
|
615
623
|
} else {
|
|
616
624
|
if (this.serverManifest) {
|
|
617
625
|
const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
|
|
@@ -7092,10 +7100,10 @@ var Ignore = class {
|
|
|
7092
7100
|
ignored(p) {
|
|
7093
7101
|
const fullpath = p.fullpath();
|
|
7094
7102
|
const fullpaths = `${fullpath}/`;
|
|
7095
|
-
const
|
|
7096
|
-
const relatives = `${
|
|
7103
|
+
const relative2 = p.relative() || ".";
|
|
7104
|
+
const relatives = `${relative2}/`;
|
|
7097
7105
|
for (const m of this.relative) {
|
|
7098
|
-
if (m.match(
|
|
7106
|
+
if (m.match(relative2) || m.match(relatives)) return true;
|
|
7099
7107
|
}
|
|
7100
7108
|
for (const m of this.absolute) {
|
|
7101
7109
|
if (m.match(fullpath) || m.match(fullpaths)) return true;
|
|
@@ -7104,9 +7112,9 @@ var Ignore = class {
|
|
|
7104
7112
|
}
|
|
7105
7113
|
childrenIgnored(p) {
|
|
7106
7114
|
const fullpath = p.fullpath() + "/";
|
|
7107
|
-
const
|
|
7115
|
+
const relative2 = (p.relative() || ".") + "/";
|
|
7108
7116
|
for (const m of this.relativeChildren) {
|
|
7109
|
-
if (m.match(
|
|
7117
|
+
if (m.match(relative2)) return true;
|
|
7110
7118
|
}
|
|
7111
7119
|
for (const m of this.absoluteChildren) {
|
|
7112
7120
|
if (m.match(fullpath)) return true;
|