@tramvai/module-render 5.45.2 → 5.47.0

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,7 +3,7 @@ import { flushFiles } from './utils/flushFiles.es.js';
3
3
 
4
4
  const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderMode, }) => {
5
5
  const webpackStats = await fetchWebpackStats({ modern });
6
- const { publicPath } = webpackStats;
6
+ const { publicPath, polyfillCondition } = webpackStats;
7
7
  // получает файл полифилла из stats.json\stats.modern.json.
8
8
  // В зависимости от версии браузера будет использован полифилл из legacy или modern сборки,
9
9
  // т.к. полифиллы для них могут отличаться на основании преобразований `@babel/preset-env`
@@ -16,6 +16,9 @@ const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderM
16
16
  const href = genHref(script);
17
17
  result.push({
18
18
  type: ResourceType.inlineScript,
19
+ attrs: {
20
+ id: 'polyfills',
21
+ },
19
22
  slot: ResourceSlot.HEAD_POLYFILLS,
20
23
  // all scripts are "async" for streaming, so we need to guarantee that polyfills will be loaded before.
21
24
  // will hurt performance, because polufills will block page rendering
@@ -23,7 +26,7 @@ const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderM
23
26
  payload: `(function (){
24
27
  var con;
25
28
  try {
26
- con = ${condition};
29
+ con = ${polyfillCondition} || ${condition};
27
30
  } catch (e) {
28
31
  con = true;
29
32
  }
@@ -7,7 +7,7 @@ var flushFiles = require('./utils/flushFiles.js');
7
7
 
8
8
  const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderMode, }) => {
9
9
  const webpackStats = await fetchWebpackStats({ modern });
10
- const { publicPath } = webpackStats;
10
+ const { publicPath, polyfillCondition } = webpackStats;
11
11
  // получает файл полифилла из stats.json\stats.modern.json.
12
12
  // В зависимости от версии браузера будет использован полифилл из legacy или modern сборки,
13
13
  // т.к. полифиллы для них могут отличаться на основании преобразований `@babel/preset-env`
@@ -20,6 +20,9 @@ const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderM
20
20
  const href = genHref(script);
21
21
  result.push({
22
22
  type: tokensRender.ResourceType.inlineScript,
23
+ attrs: {
24
+ id: 'polyfills',
25
+ },
23
26
  slot: tokensRender.ResourceSlot.HEAD_POLYFILLS,
24
27
  // all scripts are "async" for streaming, so we need to guarantee that polyfills will be loaded before.
25
28
  // will hurt performance, because polufills will block page rendering
@@ -27,7 +30,7 @@ const polyfillResources = async ({ condition, modern, fetchWebpackStats, renderM
27
30
  payload: `(function (){
28
31
  var con;
29
32
  try {
30
- con = ${condition};
33
+ con = ${polyfillCondition} || ${condition};
31
34
  } catch (e) {
32
35
  con = true;
33
36
  }
package/lib/server.d.ts CHANGED
@@ -2,7 +2,7 @@ import { PageErrorStore, setPageErrorEvent } from '@tramvai/module-router';
2
2
  import type { RenderModuleConfig } from './shared/types';
3
3
  export { PageErrorStore, setPageErrorEvent };
4
4
  export * from '@tramvai/tokens-render';
5
- export declare const DEFAULT_POLYFILL_CONDITION = "!window.Promise.prototype.finally || !window.URL || !window.AbortController || !window.IntersectionObserver || !Object.fromEntries || !window.ResizeObserver || !window.queueMicrotask";
5
+ export declare const DEFAULT_POLYFILL_CONDITION = "false";
6
6
  export declare class RenderModule {
7
7
  static forRoot({ polyfillCondition }: RenderModuleConfig): {
8
8
  mainModule: typeof RenderModule;
package/lib/server.es.js CHANGED
@@ -34,7 +34,7 @@ const RESOURCES_REGISTRY_SIZE_CACHE_SIZE = 300;
34
34
  const RESOURCES_REGISTRY_DISABLED_URL_CACHE_SIZE = 300;
35
35
  const RESOURCES_REGISTRY_FILES_CACHE_TTL = 24 * 60 * 60 * 1000; // 24h
36
36
  const RESOURCES_REGISTRY_SIZE_CACHE_TTL = 24 * 60 * 60 * 1000; // 24h
37
- const DEFAULT_POLYFILL_CONDITION = '!window.Promise.prototype.finally || !window.URL || !window.AbortController || !window.IntersectionObserver || !Object.fromEntries || !window.ResizeObserver || !window.queueMicrotask';
37
+ const DEFAULT_POLYFILL_CONDITION = 'false';
38
38
  let RenderModule = RenderModule_1 = class RenderModule {
39
39
  static forRoot({ polyfillCondition }) {
40
40
  const providers = [];
package/lib/server.js CHANGED
@@ -35,7 +35,7 @@ const RESOURCES_REGISTRY_SIZE_CACHE_SIZE = 300;
35
35
  const RESOURCES_REGISTRY_DISABLED_URL_CACHE_SIZE = 300;
36
36
  const RESOURCES_REGISTRY_FILES_CACHE_TTL = 24 * 60 * 60 * 1000; // 24h
37
37
  const RESOURCES_REGISTRY_SIZE_CACHE_TTL = 24 * 60 * 60 * 1000; // 24h
38
- const DEFAULT_POLYFILL_CONDITION = '!window.Promise.prototype.finally || !window.URL || !window.AbortController || !window.IntersectionObserver || !Object.fromEntries || !window.ResizeObserver || !window.queueMicrotask';
38
+ const DEFAULT_POLYFILL_CONDITION = 'false';
39
39
  exports.RenderModule = RenderModule_1 = class RenderModule {
40
40
  static forRoot({ polyfillCondition }) {
41
41
  const providers = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-render",
3
- "version": "5.45.2",
3
+ "version": "5.47.0",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,15 +26,15 @@
26
26
  "@tinkoff/layout-factory": "0.6.3",
27
27
  "@tinkoff/errors": "0.6.2",
28
28
  "@tinkoff/url": "0.11.2",
29
- "@tinkoff/user-agent": "0.7.108",
29
+ "@tinkoff/user-agent": "0.7.111",
30
30
  "@tinkoff/request-core": "^0.10.0",
31
31
  "@tinkoff/request-plugin-protocol-http": "^0.12.1",
32
- "@tramvai/module-client-hints": "5.45.2",
33
- "@tramvai/module-router": "5.45.2",
34
- "@tramvai/react": "5.45.2",
32
+ "@tramvai/module-client-hints": "5.47.0",
33
+ "@tramvai/module-router": "5.47.0",
34
+ "@tramvai/react": "5.47.0",
35
35
  "@tramvai/safe-strings": "0.8.4",
36
- "@tramvai/tokens-render": "5.45.2",
37
- "@tramvai/experiments": "5.45.2",
36
+ "@tramvai/tokens-render": "5.47.0",
37
+ "@tramvai/experiments": "5.47.0",
38
38
  "@types/loadable__server": "^5.12.6",
39
39
  "node-fetch": "^2.6.1"
40
40
  },
@@ -42,14 +42,14 @@
42
42
  "@tinkoff/dippy": "0.11.4",
43
43
  "@tinkoff/utils": "^2.1.2",
44
44
  "@tinkoff/react-hooks": "0.4.2",
45
- "@tramvai/cli": "5.45.2",
46
- "@tramvai/core": "5.45.2",
47
- "@tramvai/module-common": "5.45.2",
48
- "@tramvai/state": "5.45.2",
49
- "@tramvai/test-helpers": "5.45.2",
50
- "@tramvai/tokens-common": "5.45.2",
51
- "@tramvai/tokens-router": "5.45.2",
52
- "@tramvai/tokens-server-private": "5.45.2",
45
+ "@tramvai/cli": "5.47.0",
46
+ "@tramvai/core": "5.47.0",
47
+ "@tramvai/module-common": "5.47.0",
48
+ "@tramvai/state": "5.47.0",
49
+ "@tramvai/test-helpers": "5.47.0",
50
+ "@tramvai/tokens-common": "5.47.0",
51
+ "@tramvai/tokens-router": "5.47.0",
52
+ "@tramvai/tokens-server-private": "5.47.0",
53
53
  "express": "^4.17.1",
54
54
  "prop-types": "^15.6.2",
55
55
  "react": ">=16.14.0",