@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.
@@ -367,6 +367,7 @@ declare class RenderService {
367
367
  private serverManifest;
368
368
  private isDevelopment;
369
369
  private ssrMode;
370
+ private readonly entryServerPath;
370
371
  constructor(templateParser: TemplateParserService, streamingErrorHandler: StreamingErrorHandler, ssrMode?: SSRMode, defaultHead?: HeadData | undefined);
371
372
  setViteServer(vite: ViteDevServer): void;
372
373
  /**
@@ -367,6 +367,7 @@ declare class RenderService {
367
367
  private serverManifest;
368
368
  private isDevelopment;
369
369
  private ssrMode;
370
+ private readonly entryServerPath;
370
371
  constructor(templateParser: TemplateParserService, streamingErrorHandler: StreamingErrorHandler, ssrMode?: SSRMode, defaultHead?: HeadData | undefined);
371
372
  setViteServer(vite: ViteDevServer): void;
372
373
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HeadData } from './index-Bptct1Q3.mjs';
2
- export { E as ErrorPageDevelopment, f as ErrorPageProduction, c as RenderConfig, b as RenderInterceptor, R as RenderModule, e as RenderResponse, a as RenderService, d as SSRMode, S as StreamingErrorHandler, T as TemplateParserService } from './index-Bptct1Q3.mjs';
1
+ import { H as HeadData } from './index-C7qZ7BPg.mjs';
2
+ export { E as ErrorPageDevelopment, f as ErrorPageProduction, c as RenderConfig, b as RenderInterceptor, R as RenderModule, e as RenderResponse, a as RenderService, d as SSRMode, S as StreamingErrorHandler, T as TemplateParserService } from './index-C7qZ7BPg.mjs';
3
3
  import * as _nestjs_common from '@nestjs/common';
4
4
  export { viewRegistryPlugin } from './vite/index.mjs';
5
5
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HeadData } from './index-Bptct1Q3.js';
2
- export { E as ErrorPageDevelopment, f as ErrorPageProduction, c as RenderConfig, b as RenderInterceptor, R as RenderModule, e as RenderResponse, a as RenderService, d as SSRMode, S as StreamingErrorHandler, T as TemplateParserService } from './index-Bptct1Q3.js';
1
+ import { H as HeadData } from './index-C7qZ7BPg.js';
2
+ export { E as ErrorPageDevelopment, f as ErrorPageProduction, c as RenderConfig, b as RenderInterceptor, R as RenderModule, e as RenderResponse, a as RenderService, d as SSRMode, S as StreamingErrorHandler, T as TemplateParserService } from './index-C7qZ7BPg.js';
3
3
  import * as _nestjs_common from '@nestjs/common';
4
4
  export { viewRegistryPlugin } from './vite/index.js';
5
5
  import 'react';
package/dist/index.js CHANGED
@@ -453,12 +453,20 @@ exports.RenderService = class _RenderService {
453
453
  serverManifest = null;
454
454
  isDevelopment;
455
455
  ssrMode;
456
+ entryServerPath;
456
457
  constructor(templateParser, streamingErrorHandler, ssrMode, defaultHead) {
457
458
  this.templateParser = templateParser;
458
459
  this.streamingErrorHandler = streamingErrorHandler;
459
460
  this.defaultHead = defaultHead;
460
461
  this.isDevelopment = process.env.NODE_ENV !== "production";
461
462
  this.ssrMode = ssrMode || process.env.SSR_MODE || "string";
463
+ const absoluteTemplatePath = path2.join(__dirname, "../templates/entry-server.tsx");
464
+ const relativeToApp = path2.relative(process.cwd(), absoluteTemplatePath);
465
+ if (relativeToApp.startsWith("..")) {
466
+ this.entryServerPath = absoluteTemplatePath;
467
+ } else {
468
+ this.entryServerPath = "/" + relativeToApp.replace(/\\/g, "/");
469
+ }
462
470
  let templatePath;
463
471
  if (this.isDevelopment) {
464
472
  const packageTemplatePaths = [
@@ -554,7 +562,7 @@ exports.RenderService = class _RenderService {
554
562
  }
555
563
  let renderModule;
556
564
  if (this.vite) {
557
- renderModule = await this.vite.ssrLoadModule("/src/entry-server.tsx");
565
+ renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
558
566
  } else {
559
567
  if (this.serverManifest) {
560
568
  const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
@@ -638,7 +646,7 @@ exports.RenderService = class _RenderService {
638
646
  const templateParts = this.templateParser.parseTemplate(template);
639
647
  let renderModule;
640
648
  if (this.vite) {
641
- renderModule = await this.vite.ssrLoadModule("/src/entry-server.tsx");
649
+ renderModule = await this.vite.ssrLoadModule(this.entryServerPath);
642
650
  } else {
643
651
  if (this.serverManifest) {
644
652
  const manifestEntry = Object.entries(this.serverManifest).find(([key, value]) => value.isEntry && key.includes("entry-server"));
@@ -7119,10 +7127,10 @@ var Ignore = class {
7119
7127
  ignored(p) {
7120
7128
  const fullpath = p.fullpath();
7121
7129
  const fullpaths = `${fullpath}/`;
7122
- const relative = p.relative() || ".";
7123
- const relatives = `${relative}/`;
7130
+ const relative2 = p.relative() || ".";
7131
+ const relatives = `${relative2}/`;
7124
7132
  for (const m of this.relative) {
7125
- if (m.match(relative) || m.match(relatives)) return true;
7133
+ if (m.match(relative2) || m.match(relatives)) return true;
7126
7134
  }
7127
7135
  for (const m of this.absolute) {
7128
7136
  if (m.match(fullpath) || m.match(fullpaths)) return true;
@@ -7131,9 +7139,9 @@ var Ignore = class {
7131
7139
  }
7132
7140
  childrenIgnored(p) {
7133
7141
  const fullpath = p.fullpath() + "/";
7134
- const relative = (p.relative() || ".") + "/";
7142
+ const relative2 = (p.relative() || ".") + "/";
7135
7143
  for (const m of this.relativeChildren) {
7136
- if (m.match(relative)) return true;
7144
+ if (m.match(relative2)) return true;
7137
7145
  }
7138
7146
  for (const m of this.absoluteChildren) {
7139
7147
  if (m.match(fullpath)) return true;