@nestjs-ssr/react 0.1.4 → 0.1.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/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, relative, win32, posix } from 'path';
5
+ import path2, { join, 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,20 +426,12 @@ var RenderService = class _RenderService {
426
426
  serverManifest = null;
427
427
  isDevelopment;
428
428
  ssrMode;
429
- entryServerPath;
430
429
  constructor(templateParser, streamingErrorHandler, ssrMode, defaultHead) {
431
430
  this.templateParser = templateParser;
432
431
  this.streamingErrorHandler = streamingErrorHandler;
433
432
  this.defaultHead = defaultHead;
434
433
  this.isDevelopment = process.env.NODE_ENV !== "production";
435
434
  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
- }
443
435
  let templatePath;
444
436
  if (this.isDevelopment) {
445
437
  const packageTemplatePaths = [
@@ -535,7 +527,7 @@ var RenderService = class _RenderService {
535
527
  }
536
528
  let renderModule;
537
529
  if (this.vite) {
538
- renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
530
+ renderModule = await this.vite.ssrLoadModule("/src/entry-server.tsx");
539
531
  } else {
540
532
  if (this.serverManifest) {
541
533
  const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
@@ -619,7 +611,7 @@ var RenderService = class _RenderService {
619
611
  const templateParts = this.templateParser.parseTemplate(template);
620
612
  let renderModule;
621
613
  if (this.vite) {
622
- renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
614
+ renderModule = await this.vite.ssrLoadModule("/src/entry-server.tsx");
623
615
  } else {
624
616
  if (this.serverManifest) {
625
617
  const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
@@ -7100,10 +7092,10 @@ var Ignore = class {
7100
7092
  ignored(p) {
7101
7093
  const fullpath = p.fullpath();
7102
7094
  const fullpaths = `${fullpath}/`;
7103
- const relative2 = p.relative() || ".";
7104
- const relatives = `${relative2}/`;
7095
+ const relative = p.relative() || ".";
7096
+ const relatives = `${relative}/`;
7105
7097
  for (const m of this.relative) {
7106
- if (m.match(relative2) || m.match(relatives)) return true;
7098
+ if (m.match(relative) || m.match(relatives)) return true;
7107
7099
  }
7108
7100
  for (const m of this.absolute) {
7109
7101
  if (m.match(fullpath) || m.match(fullpaths)) return true;
@@ -7112,9 +7104,9 @@ var Ignore = class {
7112
7104
  }
7113
7105
  childrenIgnored(p) {
7114
7106
  const fullpath = p.fullpath() + "/";
7115
- const relative2 = (p.relative() || ".") + "/";
7107
+ const relative = (p.relative() || ".") + "/";
7116
7108
  for (const m of this.relativeChildren) {
7117
- if (m.match(relative2)) return true;
7109
+ if (m.match(relative)) return true;
7118
7110
  }
7119
7111
  for (const m of this.absoluteChildren) {
7120
7112
  if (m.match(fullpath)) return true;