@tramvai/module-render 2.119.5 → 2.121.2

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.
@@ -5,6 +5,13 @@ import { isFileSystemPageComponent, fileSystemPageToWebpackChunkName } from '@tr
5
5
  import { PRELOAD_JS } from '../../constants/performance.es.js';
6
6
  import { flushFiles } from '../utils/flushFiles.es.js';
7
7
 
8
+ let criticalChunks = [];
9
+ try {
10
+ criticalChunks = JSON.parse(process.env.__TRAMVAI_CRITICAL_CHUNKS);
11
+ }
12
+ catch (e) {
13
+ // do nothing
14
+ }
8
15
  const bundleResource = async ({ bundle, modern, extractor, pageComponent, fetchWebpackStats, }) => {
9
16
  // for file-system pages preload page chunk against bundle chunk
10
17
  const chunkNameFromBundle = isFileSystemPageComponent(pageComponent)
@@ -19,7 +26,7 @@ const bundleResource = async ({ bundle, modern, extractor, pageComponent, fetchW
19
26
  const { scripts: baseScripts } = flushFiles(['vendor'], webpackStats, {
20
27
  ignoreDependencies: true,
21
28
  });
22
- const { scripts, styles } = flushFiles([...bundles, ...lazyChunks, 'platform'], webpackStats);
29
+ const { scripts, styles } = flushFiles([...bundles, ...lazyChunks, ...criticalChunks, 'platform'], webpackStats);
23
30
  const genHref = (href) => `${publicPath}${href}`;
24
31
  const result = [];
25
32
  if (process.env.NODE_ENV === 'production' ||
@@ -14,6 +14,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
  var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
15
15
  var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
16
16
 
17
+ let criticalChunks = [];
18
+ try {
19
+ criticalChunks = JSON.parse(process.env.__TRAMVAI_CRITICAL_CHUNKS);
20
+ }
21
+ catch (e) {
22
+ // do nothing
23
+ }
17
24
  const bundleResource = async ({ bundle, modern, extractor, pageComponent, fetchWebpackStats, }) => {
18
25
  // for file-system pages preload page chunk against bundle chunk
19
26
  const chunkNameFromBundle = experiments.isFileSystemPageComponent(pageComponent)
@@ -28,7 +35,7 @@ const bundleResource = async ({ bundle, modern, extractor, pageComponent, fetchW
28
35
  const { scripts: baseScripts } = flushFiles.flushFiles(['vendor'], webpackStats, {
29
36
  ignoreDependencies: true,
30
37
  });
31
- const { scripts, styles } = flushFiles.flushFiles([...bundles, ...lazyChunks, 'platform'], webpackStats);
38
+ const { scripts, styles } = flushFiles.flushFiles([...bundles, ...lazyChunks, ...criticalChunks, 'platform'], webpackStats);
32
39
  const genHref = (href) => `${publicPath}${href}`;
33
40
  const result = [];
34
41
  if (process.env.NODE_ENV === 'production' ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-render",
3
- "version": "2.119.5",
3
+ "version": "2.121.2",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,13 +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.347",
30
- "@tramvai/module-client-hints": "2.119.5",
31
- "@tramvai/module-router": "2.119.5",
32
- "@tramvai/react": "2.119.5",
33
- "@tramvai/safe-strings": "0.5.9",
34
- "@tramvai/tokens-render": "2.119.5",
35
- "@tramvai/experiments": "2.119.5",
29
+ "@tinkoff/user-agent": "0.4.351",
30
+ "@tramvai/module-client-hints": "2.121.2",
31
+ "@tramvai/module-router": "2.121.2",
32
+ "@tramvai/react": "2.121.2",
33
+ "@tramvai/safe-strings": "0.5.10",
34
+ "@tramvai/tokens-render": "2.121.2",
35
+ "@tramvai/experiments": "2.121.2",
36
36
  "@types/loadable__server": "^5.12.6",
37
37
  "node-fetch": "^2.6.1"
38
38
  },
@@ -40,14 +40,14 @@
40
40
  "@tinkoff/dippy": "0.8.15",
41
41
  "@tinkoff/utils": "^2.1.2",
42
42
  "@tinkoff/react-hooks": "0.1.6",
43
- "@tramvai/cli": "2.119.5",
44
- "@tramvai/core": "2.119.5",
45
- "@tramvai/module-common": "2.119.5",
46
- "@tramvai/state": "2.119.5",
47
- "@tramvai/test-helpers": "2.119.5",
48
- "@tramvai/tokens-common": "2.119.5",
49
- "@tramvai/tokens-router": "2.119.5",
50
- "@tramvai/tokens-server-private": "2.119.5",
43
+ "@tramvai/cli": "2.121.2",
44
+ "@tramvai/core": "2.121.2",
45
+ "@tramvai/module-common": "2.121.2",
46
+ "@tramvai/state": "2.121.2",
47
+ "@tramvai/test-helpers": "2.121.2",
48
+ "@tramvai/tokens-common": "2.121.2",
49
+ "@tramvai/tokens-router": "2.121.2",
50
+ "@tramvai/tokens-server-private": "2.121.2",
51
51
  "express": "^4.17.1",
52
52
  "prop-types": "^15.6.2",
53
53
  "react": ">=16.14.0",
package/tests.js CHANGED
@@ -79,6 +79,14 @@ const RESOURCE_INLINER = dippy.createToken('resourceInliner');
79
79
  */
80
80
  dippy.createToken('resourcesRegistryCache');
81
81
 
82
+ let criticalChunks = [];
83
+ try {
84
+ criticalChunks = JSON.parse(process.env.__TRAMVAI_CRITICAL_CHUNKS);
85
+ }
86
+ catch (e) {
87
+ // do nothing
88
+ }
89
+
82
90
  const formatAttributes = (htmlAttrs, target) => {
83
91
  if (!htmlAttrs) {
84
92
  return '';