@tramvai/module-render 2.100.0 → 2.101.1

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/lib/server.es.js CHANGED
@@ -3,7 +3,7 @@ import { Module, provide, commandLineListTokens, DI_TOKEN } from '@tramvai/core'
3
3
  import { CREATE_CACHE_TOKEN, LOGGER_TOKEN, REQUEST_MANAGER_TOKEN, RESPONSE_MANAGER_TOKEN, CONTEXT_TOKEN } from '@tramvai/tokens-common';
4
4
  import { PAGE_SERVICE_TOKEN } from '@tramvai/tokens-router';
5
5
  import { ClientHintsModule, USER_AGENT_TOKEN } from '@tramvai/module-client-hints';
6
- import { RESOURCES_REGISTRY, RESOURCE_INLINE_OPTIONS, RENDER_SLOTS, POLYFILL_CONDITION, HTML_ATTRS, MODERN_SATISFIES_TOKEN, RENDER_FLOW_AFTER_TOKEN, FETCH_WEBPACK_STATS_TOKEN, CUSTOM_RENDER, EXTEND_RENDER, REACT_SERVER_RENDER_MODE, ResourceType } from '@tramvai/tokens-render';
6
+ import { RESOURCES_REGISTRY, RESOURCE_INLINE_OPTIONS, BACK_FORWARD_CACHE_ENABLED, RENDER_SLOTS, POLYFILL_CONDITION, HTML_ATTRS, MODERN_SATISFIES_TOKEN, RENDER_FLOW_AFTER_TOKEN, FETCH_WEBPACK_STATS_TOKEN, CUSTOM_RENDER, EXTEND_RENDER, REACT_SERVER_RENDER_MODE, ResourceType } from '@tramvai/tokens-render';
7
7
  export * from '@tramvai/tokens-render';
8
8
  import { Scope } from '@tinkoff/dippy';
9
9
  import { satisfies } from '@tinkoff/user-agent';
@@ -78,7 +78,7 @@ RenderModule = RenderModule_1 = __decorate([
78
78
  }),
79
79
  provide({
80
80
  provide: commandLineListTokens.generatePage,
81
- useFactory: ({ htmlBuilder, logger, requestManager, responseManager, context, pageService, }) => {
81
+ useFactory: ({ htmlBuilder, logger, requestManager, responseManager, context, bfcacheEnabled, pageService, }) => {
82
82
  const log = logger('module-render');
83
83
  // eslint-disable-next-line max-statements
84
84
  return async function render() {
@@ -166,7 +166,7 @@ Page Error Boundary will be rendered for the client`,
166
166
  // TODO Заменить после выкатки на прод и прохода всех тестов на cache-control = no-cache,no-store,max-age=0,must-revalidate
167
167
  responseManager.setHeader('expires', '0');
168
168
  responseManager.setHeader('pragma', 'no-cache');
169
- responseManager.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
169
+ responseManager.setHeader('cache-control', `${bfcacheEnabled ? '' : 'no-store, '}no-cache, must-revalidate`);
170
170
  responseManager.setBody(html);
171
171
  };
172
172
  },
@@ -177,6 +177,7 @@ Page Error Boundary will be rendered for the client`,
177
177
  htmlBuilder: 'htmlBuilder',
178
178
  context: CONTEXT_TOKEN,
179
179
  pageService: PAGE_SERVICE_TOKEN,
180
+ bfcacheEnabled: BACK_FORWARD_CACHE_ENABLED,
180
181
  },
181
182
  multi: true,
182
183
  }),
@@ -286,6 +287,10 @@ Page Error Boundary will be rendered for the client`,
286
287
  provide: FETCH_WEBPACK_STATS_TOKEN,
287
288
  useValue: fetchWebpackStats,
288
289
  }),
290
+ provide({
291
+ provide: BACK_FORWARD_CACHE_ENABLED,
292
+ useValue: true,
293
+ }),
289
294
  ],
290
295
  })
291
296
  ], RenderModule);
package/lib/server.js CHANGED
@@ -79,7 +79,7 @@ exports.RenderModule = RenderModule_1 = tslib.__decorate([
79
79
  }),
80
80
  core.provide({
81
81
  provide: core.commandLineListTokens.generatePage,
82
- useFactory: ({ htmlBuilder, logger, requestManager, responseManager, context, pageService, }) => {
82
+ useFactory: ({ htmlBuilder, logger, requestManager, responseManager, context, bfcacheEnabled, pageService, }) => {
83
83
  const log = logger('module-render');
84
84
  // eslint-disable-next-line max-statements
85
85
  return async function render() {
@@ -167,7 +167,7 @@ Page Error Boundary will be rendered for the client`,
167
167
  // TODO Заменить после выкатки на прод и прохода всех тестов на cache-control = no-cache,no-store,max-age=0,must-revalidate
168
168
  responseManager.setHeader('expires', '0');
169
169
  responseManager.setHeader('pragma', 'no-cache');
170
- responseManager.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
170
+ responseManager.setHeader('cache-control', `${bfcacheEnabled ? '' : 'no-store, '}no-cache, must-revalidate`);
171
171
  responseManager.setBody(html);
172
172
  };
173
173
  },
@@ -178,6 +178,7 @@ Page Error Boundary will be rendered for the client`,
178
178
  htmlBuilder: 'htmlBuilder',
179
179
  context: tokensCommon.CONTEXT_TOKEN,
180
180
  pageService: tokensRouter.PAGE_SERVICE_TOKEN,
181
+ bfcacheEnabled: tokensRender.BACK_FORWARD_CACHE_ENABLED,
181
182
  },
182
183
  multi: true,
183
184
  }),
@@ -287,6 +288,10 @@ Page Error Boundary will be rendered for the client`,
287
288
  provide: tokensRender.FETCH_WEBPACK_STATS_TOKEN,
288
289
  useValue: fetchWebpackStats.fetchWebpackStats,
289
290
  }),
291
+ core.provide({
292
+ provide: tokensRender.BACK_FORWARD_CACHE_ENABLED,
293
+ useValue: true,
294
+ }),
290
295
  ],
291
296
  })
292
297
  ], exports.RenderModule);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-render",
3
- "version": "2.100.0",
3
+ "version": "2.101.1",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,14 +26,13 @@
26
26
  "@tinkoff/layout-factory": "0.3.8",
27
27
  "@tinkoff/errors": "0.3.8",
28
28
  "@tinkoff/url": "0.8.6",
29
- "@tinkoff/user-agent": "0.4.283",
30
- "@tramvai/module-client-hints": "2.100.0",
31
- "@tramvai/module-page-render-mode": "2.100.0",
32
- "@tramvai/module-router": "2.100.0",
33
- "@tramvai/react": "2.100.0",
29
+ "@tinkoff/user-agent": "0.4.285",
30
+ "@tramvai/module-client-hints": "2.101.1",
31
+ "@tramvai/module-router": "2.101.1",
32
+ "@tramvai/react": "2.101.1",
34
33
  "@tramvai/safe-strings": "0.5.9",
35
- "@tramvai/tokens-render": "2.100.0",
36
- "@tramvai/experiments": "2.100.0",
34
+ "@tramvai/tokens-render": "2.101.1",
35
+ "@tramvai/experiments": "2.101.1",
37
36
  "@types/loadable__server": "^5.12.6",
38
37
  "node-fetch": "^2.6.1"
39
38
  },
@@ -41,14 +40,14 @@
41
40
  "@tinkoff/dippy": "0.8.15",
42
41
  "@tinkoff/utils": "^2.1.2",
43
42
  "@tinkoff/react-hooks": "0.1.6",
44
- "@tramvai/cli": "2.100.0",
45
- "@tramvai/core": "2.100.0",
46
- "@tramvai/module-common": "2.100.0",
47
- "@tramvai/state": "2.100.0",
48
- "@tramvai/test-helpers": "2.100.0",
49
- "@tramvai/tokens-common": "2.100.0",
50
- "@tramvai/tokens-router": "2.100.0",
51
- "@tramvai/tokens-server-private": "2.100.0",
43
+ "@tramvai/cli": "2.101.1",
44
+ "@tramvai/core": "2.101.1",
45
+ "@tramvai/module-common": "2.101.1",
46
+ "@tramvai/state": "2.101.1",
47
+ "@tramvai/test-helpers": "2.101.1",
48
+ "@tramvai/tokens-common": "2.101.1",
49
+ "@tramvai/tokens-router": "2.101.1",
50
+ "@tramvai/tokens-server-private": "2.101.1",
52
51
  "express": "^4.17.1",
53
52
  "prop-types": "^15.6.2",
54
53
  "react": ">=16.14.0",