@tramvai/module-server 2.130.4 → 2.130.7

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.
@@ -3,6 +3,7 @@ import { createElement } from 'react';
3
3
  import { renderToString } from 'react-dom/server';
4
4
  import { parse } from '@tinkoff/url';
5
5
  import { isRedirectFoundError, isNotFoundError, isHttpError } from '@tinkoff/errors';
6
+ import { safeStringify } from '@tramvai/safe-strings';
6
7
  import { ChunkExtractor } from '@loadable/server';
7
8
 
8
9
  const errorHandler = (app, { log, beforeError, afterError, fetchWebpackStats, }) => {
@@ -128,9 +129,9 @@ ${RootErrorBoundary !== null
128
129
  };
129
130
  const body = renderToString(createElement(RootErrorBoundary, { error: serializedError, url })).replace('</head>', [
130
131
  '<script>' +
131
- `window.serverUrl = ${JSON.stringify(url)};` +
132
- `window.serverError = new Error("${serializedError.message}");` +
133
- `Object.assign(window.serverError, ${JSON.stringify(serializedError)});` +
132
+ `window.serverUrl = ${safeStringify(url)};` +
133
+ `window.serverError = new Error(${safeStringify(serializedError.message)});` +
134
+ `Object.assign(window.serverError, ${safeStringify(serializedError)});` +
134
135
  '</script>',
135
136
  extractor.getStyleTags(),
136
137
  extractor.getScriptTags(),
@@ -7,6 +7,7 @@ var react = require('react');
7
7
  var server$1 = require('react-dom/server');
8
8
  var url = require('@tinkoff/url');
9
9
  var errors = require('@tinkoff/errors');
10
+ var safeStrings = require('@tramvai/safe-strings');
10
11
  var server = require('@loadable/server');
11
12
 
12
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -136,9 +137,9 @@ ${RootErrorBoundary !== null
136
137
  };
137
138
  const body = server$1.renderToString(react.createElement(RootErrorBoundary, { error: serializedError, url: url$1 })).replace('</head>', [
138
139
  '<script>' +
139
- `window.serverUrl = ${JSON.stringify(url$1)};` +
140
- `window.serverError = new Error("${serializedError.message}");` +
141
- `Object.assign(window.serverError, ${JSON.stringify(serializedError)});` +
140
+ `window.serverUrl = ${safeStrings.safeStringify(url$1)};` +
141
+ `window.serverError = new Error(${safeStrings.safeStringify(serializedError.message)});` +
142
+ `Object.assign(window.serverError, ${safeStrings.safeStringify(serializedError)});` +
142
143
  '</script>',
143
144
  extractor.getStyleTags(),
144
145
  extractor.getScriptTags(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-server",
3
- "version": "2.130.4",
3
+ "version": "2.130.7",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -25,11 +25,12 @@
25
25
  "@tinkoff/monkeypatch": "2.0.5",
26
26
  "@tinkoff/terminus": "0.1.9",
27
27
  "@tinkoff/url": "0.8.6",
28
- "@tramvai/module-cache-warmup": "2.130.4",
29
- "@tramvai/module-metrics": "2.130.4",
30
- "@tramvai/papi": "2.130.4",
31
- "@tramvai/tokens-server": "2.130.4",
32
- "@tramvai/tokens-server-private": "2.130.4",
28
+ "@tramvai/module-cache-warmup": "2.130.7",
29
+ "@tramvai/module-metrics": "2.130.7",
30
+ "@tramvai/papi": "2.130.7",
31
+ "@tramvai/tokens-server": "2.130.7",
32
+ "@tramvai/tokens-server-private": "2.130.7",
33
+ "@tramvai/safe-strings": "0.5.11",
33
34
  "fastify": "^4.14.1",
34
35
  "@fastify/cookie": "^8.3.0",
35
36
  "@fastify/compress": "^6.2.0",
@@ -41,14 +42,14 @@
41
42
  "peerDependencies": {
42
43
  "@tinkoff/dippy": "0.8.15",
43
44
  "@tinkoff/utils": "^2.1.2",
44
- "@tramvai/cli": "2.130.4",
45
- "@tramvai/core": "2.130.4",
46
- "@tramvai/react": "2.130.4",
47
- "@tramvai/module-common": "2.130.4",
48
- "@tramvai/module-environment": "2.130.4",
49
- "@tramvai/tokens-common": "2.130.4",
50
- "@tramvai/tokens-core-private": "2.130.4",
51
- "@tramvai/tokens-render": "2.130.4",
45
+ "@tramvai/cli": "2.130.7",
46
+ "@tramvai/core": "2.130.7",
47
+ "@tramvai/react": "2.130.7",
48
+ "@tramvai/module-common": "2.130.7",
49
+ "@tramvai/module-environment": "2.130.7",
50
+ "@tramvai/tokens-common": "2.130.7",
51
+ "@tramvai/tokens-core-private": "2.130.7",
52
+ "@tramvai/tokens-render": "2.130.7",
52
53
  "react": ">=16.14.0",
53
54
  "react-dom": ">=16.14.0",
54
55
  "tslib": "^2.4.0"