@nestjs-ssr/react 0.1.1 → 0.1.2
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 +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -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 +6 -2
- package/dist/render/index.js.map +1 -1
- package/dist/render/index.mjs +7 -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,16 @@ 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
|
+
this.entryServerPath = "/" + relativeToApp.replace(/\\/g, "/");
|
|
435
439
|
let templatePath;
|
|
436
440
|
if (this.isDevelopment) {
|
|
437
441
|
const packageTemplatePaths = [
|
|
@@ -527,7 +531,7 @@ var RenderService = class _RenderService {
|
|
|
527
531
|
}
|
|
528
532
|
let renderModule;
|
|
529
533
|
if (this.vite) {
|
|
530
|
-
renderModule = await this.vite.ssrLoadModule(
|
|
534
|
+
renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
|
|
531
535
|
} else {
|
|
532
536
|
if (this.serverManifest) {
|
|
533
537
|
const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
|
|
@@ -611,7 +615,7 @@ var RenderService = class _RenderService {
|
|
|
611
615
|
const templateParts = this.templateParser.parseTemplate(template);
|
|
612
616
|
let renderModule;
|
|
613
617
|
if (this.vite) {
|
|
614
|
-
renderModule = await this.vite.ssrLoadModule(
|
|
618
|
+
renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
|
|
615
619
|
} else {
|
|
616
620
|
if (this.serverManifest) {
|
|
617
621
|
const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
|
|
@@ -7092,10 +7096,10 @@ var Ignore = class {
|
|
|
7092
7096
|
ignored(p) {
|
|
7093
7097
|
const fullpath = p.fullpath();
|
|
7094
7098
|
const fullpaths = `${fullpath}/`;
|
|
7095
|
-
const
|
|
7096
|
-
const relatives = `${
|
|
7099
|
+
const relative2 = p.relative() || ".";
|
|
7100
|
+
const relatives = `${relative2}/`;
|
|
7097
7101
|
for (const m of this.relative) {
|
|
7098
|
-
if (m.match(
|
|
7102
|
+
if (m.match(relative2) || m.match(relatives)) return true;
|
|
7099
7103
|
}
|
|
7100
7104
|
for (const m of this.absolute) {
|
|
7101
7105
|
if (m.match(fullpath) || m.match(fullpaths)) return true;
|
|
@@ -7104,9 +7108,9 @@ var Ignore = class {
|
|
|
7104
7108
|
}
|
|
7105
7109
|
childrenIgnored(p) {
|
|
7106
7110
|
const fullpath = p.fullpath() + "/";
|
|
7107
|
-
const
|
|
7111
|
+
const relative2 = (p.relative() || ".") + "/";
|
|
7108
7112
|
for (const m of this.relativeChildren) {
|
|
7109
|
-
if (m.match(
|
|
7113
|
+
if (m.match(relative2)) return true;
|
|
7110
7114
|
}
|
|
7111
7115
|
for (const m of this.absoluteChildren) {
|
|
7112
7116
|
if (m.match(fullpath)) return true;
|