@atlaspack/query 2.14.1-dev.144 → 2.14.1-dev.146
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/CHANGELOG.md +86 -0
- package/lib/index.js +38 -55
- package/package.json +5 -5
- package/src/index.js +42 -61
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# @atlaspack/query
|
|
2
2
|
|
|
3
|
+
## 2.14.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`1b52b99`](https://github.com/atlassian-labs/atlaspack/commit/1b52b99db4298b04c1a6eb0f97994d75a2d436f9)]:
|
|
8
|
+
- @atlaspack/graph@3.5.0
|
|
9
|
+
- @atlaspack/core@2.18.1
|
|
10
|
+
|
|
11
|
+
## 2.14.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196), [`0b2f6f5`](https://github.com/atlassian-labs/atlaspack/commit/0b2f6f55794d3ff6e2f5a41f963e7e5dd8ad9f8d), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
|
|
16
|
+
- @atlaspack/core@2.18.0
|
|
17
|
+
- @atlaspack/cache@3.2.5
|
|
18
|
+
|
|
19
|
+
## 2.14.9
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`1940859`](https://github.com/atlassian-labs/atlaspack/commit/194085942f0e86532e9d039fc3f8039badce4594), [`15b6155`](https://github.com/atlassian-labs/atlaspack/commit/15b61556e9114203ebbc9de94b864118ca764598), [`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`d04de26`](https://github.com/atlassian-labs/atlaspack/commit/d04de26af684d7abfba5091fbe3df16a12cd0ebc)]:
|
|
24
|
+
- @atlaspack/core@2.17.4
|
|
25
|
+
- @atlaspack/cache@3.2.4
|
|
26
|
+
- @atlaspack/graph@3.4.7
|
|
27
|
+
|
|
28
|
+
## 2.14.8
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`3a3e8e7`](https://github.com/atlassian-labs/atlaspack/commit/3a3e8e7be9e2dffd7304436d792f0f595d59665a), [`15c1e3c`](https://github.com/atlassian-labs/atlaspack/commit/15c1e3c0628bae4c768d76cf3afc53d6d0d7ce7c)]:
|
|
33
|
+
- @atlaspack/core@2.17.3
|
|
34
|
+
- @atlaspack/cache@3.2.3
|
|
35
|
+
- @atlaspack/graph@3.4.6
|
|
36
|
+
|
|
37
|
+
## 2.14.7
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies []:
|
|
42
|
+
- @atlaspack/cache@3.2.2
|
|
43
|
+
- @atlaspack/core@2.17.2
|
|
44
|
+
- @atlaspack/graph@3.4.5
|
|
45
|
+
|
|
46
|
+
## 2.14.6
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies []:
|
|
51
|
+
- @atlaspack/cache@3.2.1
|
|
52
|
+
- @atlaspack/core@2.17.1
|
|
53
|
+
- @atlaspack/graph@3.4.4
|
|
54
|
+
|
|
55
|
+
## 2.14.5
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [[`2e90c9b`](https://github.com/atlassian-labs/atlaspack/commit/2e90c9bd07d7eb52645f9d84ccbb7f82685cbc8c), [`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7), [`e2ba0f6`](https://github.com/atlassian-labs/atlaspack/commit/e2ba0f69702656f3d1ce95ab1454e35062b13b39), [`d2c50c2`](https://github.com/atlassian-labs/atlaspack/commit/d2c50c2c020888b33bb25b8690d9320c2b69e2a6)]:
|
|
60
|
+
- @atlaspack/core@2.17.0
|
|
61
|
+
- @atlaspack/cache@3.2.0
|
|
62
|
+
- @atlaspack/graph@3.4.3
|
|
63
|
+
|
|
64
|
+
## 2.14.4
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [[`cb9da16`](https://github.com/atlassian-labs/atlaspack/commit/cb9da16fb2648e7f53c64df0313f60d5fb8970cc)]:
|
|
69
|
+
- @atlaspack/cache@3.1.0
|
|
70
|
+
- @atlaspack/core@2.16.1
|
|
71
|
+
|
|
72
|
+
## 2.14.3
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [[`90150df`](https://github.com/atlassian-labs/atlaspack/commit/90150dfb68236e1d1c11813108ecabd92cff9366)]:
|
|
77
|
+
- @atlaspack/core@2.16.0
|
|
78
|
+
- @atlaspack/cache@3.0.1
|
|
79
|
+
|
|
80
|
+
## 2.14.2
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [[`8f4e6c1`](https://github.com/atlassian-labs/atlaspack/commit/8f4e6c1b0e7c1fd48624afda48c1dcc599f1460f)]:
|
|
85
|
+
- @atlaspack/cache@3.0.0
|
|
86
|
+
- @atlaspack/core@2.15.1
|
|
87
|
+
- @atlaspack/graph@3.4.2
|
|
88
|
+
|
|
3
89
|
## 2.14.1
|
|
4
90
|
|
|
5
91
|
### Patch Changes
|
package/lib/index.js
CHANGED
|
@@ -4,20 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.loadGraphs = loadGraphs;
|
|
7
|
-
function _fs() {
|
|
8
|
-
const data = _interopRequireDefault(require("fs"));
|
|
9
|
-
_fs = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _path() {
|
|
15
|
-
const data = _interopRequireDefault(require("path"));
|
|
16
|
-
_path = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
7
|
function _v() {
|
|
22
8
|
const data = _interopRequireDefault(require("v8"));
|
|
23
9
|
_v = function () {
|
|
@@ -55,51 +41,47 @@ const {
|
|
|
55
41
|
} = require('./deep-imports.js');
|
|
56
42
|
async function loadGraphs(cacheDir) {
|
|
57
43
|
let cacheInfo = new Map();
|
|
58
|
-
|
|
44
|
+
const cache = new LMDBLiteCache(cacheDir);
|
|
45
|
+
let requestGraphBlob;
|
|
46
|
+
let requestGraphKey;
|
|
47
|
+
let bundleGraphBlob;
|
|
48
|
+
let assetGraphBlob;
|
|
49
|
+
for (let key of cache.keys()) {
|
|
50
|
+
if (key.startsWith('Asset/')) {
|
|
51
|
+
continue;
|
|
52
|
+
} else if (key.startsWith('PackagerRunner/')) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (key.startsWith('RequestTracker/') && key.endsWith('/RequestGraph')) {
|
|
56
|
+
requestGraphBlob = key;
|
|
57
|
+
requestGraphKey = key.split('/').slice(0, -1).join('/');
|
|
58
|
+
}
|
|
59
|
+
if (key.startsWith('BundleGraph/')) {
|
|
60
|
+
bundleGraphBlob = key;
|
|
61
|
+
}
|
|
62
|
+
if (key.startsWith('AssetGraph/')) {
|
|
63
|
+
assetGraphBlob = key;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log({
|
|
59
67
|
requestGraphBlob,
|
|
60
68
|
bundleGraphBlob,
|
|
61
69
|
assetGraphBlob
|
|
62
|
-
}
|
|
63
|
-
let files = _fs().default.readdirSync(cacheDir);
|
|
64
|
-
let result = {};
|
|
65
|
-
let blobsToFind = [{
|
|
66
|
-
name: 'requestGraphBlob',
|
|
67
|
-
check: basename => basename.startsWith('requestGraph-') && !basename.startsWith('requestGraph-nodes')
|
|
68
|
-
}, {
|
|
69
|
-
name: 'bundleGraphBlob',
|
|
70
|
-
check: basename => basename.endsWith('BundleGraph-0')
|
|
71
|
-
}, {
|
|
72
|
-
name: 'assetGraphBlob',
|
|
73
|
-
check: basename => basename.endsWith('AssetGraph-0')
|
|
74
|
-
}];
|
|
75
|
-
for (let file of files) {
|
|
76
|
-
let basename = _path().default.basename(file);
|
|
77
|
-
let match = blobsToFind.find(({
|
|
78
|
-
check
|
|
79
|
-
}) => check(basename));
|
|
80
|
-
if (match) {
|
|
81
|
-
let stat = _fs().default.statSync(_path().default.join(cacheDir, file));
|
|
82
|
-
if (!match.mtime || stat.mtime > match.mtime) {
|
|
83
|
-
match.mtime = stat.mtime;
|
|
84
|
-
result[match.name] = file;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
}();
|
|
90
|
-
const cache = new LMDBLiteCache(cacheDir);
|
|
70
|
+
});
|
|
91
71
|
|
|
92
72
|
// Get requestTracker
|
|
93
73
|
let requestTracker;
|
|
94
|
-
if (requestGraphBlob) {
|
|
74
|
+
if (requestGraphBlob != null && requestGraphKey != null) {
|
|
95
75
|
try {
|
|
96
76
|
var _cacheInfo$get;
|
|
97
|
-
let requestGraphKey = requestGraphBlob.slice(0, -'-0'.length);
|
|
98
77
|
let date = Date.now();
|
|
78
|
+
const buffer = await cache.getBlob(requestGraphBlob);
|
|
79
|
+
const deserializer = new (_v().default.Deserializer)(buffer);
|
|
80
|
+
console.log('Wire format version stored', deserializer.getWireFormatVersion());
|
|
99
81
|
let {
|
|
100
82
|
requestGraph,
|
|
101
83
|
bufferLength
|
|
102
|
-
} = await readAndDeserializeRequestGraph(cache,
|
|
84
|
+
} = await readAndDeserializeRequestGraph(cache, requestGraphBlob, requestGraphKey);
|
|
103
85
|
requestTracker = new RequestTracker({
|
|
104
86
|
graph: requestGraph,
|
|
105
87
|
// $FlowFixMe
|
|
@@ -111,16 +93,16 @@ async function loadGraphs(cacheDir) {
|
|
|
111
93
|
cacheInfo.set('RequestGraph', [bufferLength]);
|
|
112
94
|
(_cacheInfo$get = cacheInfo.get('RequestGraph')) === null || _cacheInfo$get === void 0 || _cacheInfo$get.push(timeToDeserialize);
|
|
113
95
|
} catch (e) {
|
|
114
|
-
console.
|
|
96
|
+
console.error('Error loading Request Graph\n', e);
|
|
115
97
|
}
|
|
116
98
|
}
|
|
117
99
|
|
|
118
100
|
// Get bundleGraph
|
|
119
101
|
let bundleGraph;
|
|
120
|
-
if (bundleGraphBlob) {
|
|
102
|
+
if (bundleGraphBlob != null) {
|
|
121
103
|
try {
|
|
122
104
|
var _cacheInfo$get2;
|
|
123
|
-
let file = await cache.
|
|
105
|
+
let file = await cache.getBlob(bundleGraphBlob);
|
|
124
106
|
let timeToDeserialize = Date.now();
|
|
125
107
|
let obj = _v().default.deserialize(file);
|
|
126
108
|
(0, _assert().default)(obj.bundleGraph != null);
|
|
@@ -129,16 +111,17 @@ async function loadGraphs(cacheDir) {
|
|
|
129
111
|
cacheInfo.set('BundleGraph', [Buffer.byteLength(file)]);
|
|
130
112
|
(_cacheInfo$get2 = cacheInfo.get('BundleGraph')) === null || _cacheInfo$get2 === void 0 || _cacheInfo$get2.push(timeToDeserialize);
|
|
131
113
|
} catch (e) {
|
|
132
|
-
console.
|
|
114
|
+
console.error('Error loading Bundle Graph\n', e);
|
|
133
115
|
}
|
|
134
116
|
}
|
|
135
117
|
|
|
136
118
|
// Get assetGraph
|
|
137
119
|
let assetGraph;
|
|
138
|
-
if (assetGraphBlob) {
|
|
120
|
+
if (assetGraphBlob != null) {
|
|
139
121
|
try {
|
|
140
122
|
var _cacheInfo$get3;
|
|
141
|
-
|
|
123
|
+
// TODO: this should be reviewed when `cachePerformanceImprovements` flag is removed, as we'll be writing files to LMDB cache instead of large blobs
|
|
124
|
+
let file = await cache.getBlob(assetGraphBlob);
|
|
142
125
|
let timeToDeserialize = Date.now();
|
|
143
126
|
let obj = _v().default.deserialize(file);
|
|
144
127
|
(0, _assert().default)(obj.assetGraph != null);
|
|
@@ -147,7 +130,7 @@ async function loadGraphs(cacheDir) {
|
|
|
147
130
|
cacheInfo.set('AssetGraph', [Buffer.byteLength(file)]);
|
|
148
131
|
(_cacheInfo$get3 = cacheInfo.get('AssetGraph')) === null || _cacheInfo$get3 === void 0 || _cacheInfo$get3.push(timeToDeserialize);
|
|
149
132
|
} catch (e) {
|
|
150
|
-
console.
|
|
133
|
+
console.error('Error loading Asset Graph\n', e);
|
|
151
134
|
}
|
|
152
135
|
}
|
|
153
136
|
function getSubRequests(id) {
|
|
@@ -169,7 +152,7 @@ async function loadGraphs(cacheDir) {
|
|
|
169
152
|
bundleInfo = (0, _nullthrows().default)(writeBundlesRequest.result);
|
|
170
153
|
}
|
|
171
154
|
} catch (e) {
|
|
172
|
-
console.
|
|
155
|
+
console.error('Error loading bundleInfo\n', e);
|
|
173
156
|
}
|
|
174
157
|
return {
|
|
175
158
|
assetGraph,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/query",
|
|
3
|
-
"version": "2.14.1-dev.
|
|
3
|
+
"version": "2.14.1-dev.146+33cba81e9",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "src/index.js",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@atlaspack/cache": "2.13.3-dev.
|
|
22
|
-
"@atlaspack/core": "2.14.1-dev.
|
|
23
|
-
"@atlaspack/graph": "3.4.1-dev.
|
|
21
|
+
"@atlaspack/cache": "2.13.3-dev.146+33cba81e9",
|
|
22
|
+
"@atlaspack/core": "2.14.1-dev.146+33cba81e9",
|
|
23
|
+
"@atlaspack/graph": "3.4.1-dev.146+33cba81e9",
|
|
24
24
|
"nullthrows": "^1.1.1",
|
|
25
25
|
"table": "^6.8.1",
|
|
26
26
|
"v8-compile-cache": "^2.0.0"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"rimraf": "^5.0.5"
|
|
32
32
|
},
|
|
33
33
|
"type": "commonjs",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "33cba81e98b6eb098014f5a19d7932821b95f075"
|
|
35
35
|
}
|
package/src/index.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import type {ContentKey, NodeId} from '@atlaspack/graph';
|
|
4
4
|
import type {PackagedBundleInfo} from '@atlaspack/core/src/types';
|
|
5
5
|
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import path from 'path';
|
|
8
6
|
import v8 from 'v8';
|
|
9
7
|
import nullthrows from 'nullthrows';
|
|
10
8
|
import invariant from 'assert';
|
|
@@ -27,65 +25,51 @@ export async function loadGraphs(cacheDir: string): Promise<{|
|
|
|
27
25
|
bundleInfo: ?Map<ContentKey, PackagedBundleInfo>,
|
|
28
26
|
cacheInfo: ?Map<string, Array<string | number>>,
|
|
29
27
|
|}> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
check: (basename) =>
|
|
43
|
-
basename.startsWith('requestGraph-') &&
|
|
44
|
-
!basename.startsWith('requestGraph-nodes'),
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'bundleGraphBlob',
|
|
48
|
-
check: (basename) => basename.endsWith('BundleGraph-0'),
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'assetGraphBlob',
|
|
52
|
-
check: (basename) => basename.endsWith('AssetGraph-0'),
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
for (let file of files) {
|
|
57
|
-
let basename = path.basename(file);
|
|
58
|
-
let match = blobsToFind.find(({check}) => check(basename));
|
|
59
|
-
|
|
60
|
-
if (match) {
|
|
61
|
-
let stat = fs.statSync(path.join(cacheDir, file));
|
|
62
|
-
|
|
63
|
-
if (!match.mtime || stat.mtime > match.mtime) {
|
|
64
|
-
match.mtime = stat.mtime;
|
|
65
|
-
result[match.name] = file;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
28
|
+
let cacheInfo: Map<string, Array<string | number>> = new Map();
|
|
29
|
+
const cache = new LMDBLiteCache(cacheDir);
|
|
30
|
+
|
|
31
|
+
let requestGraphBlob;
|
|
32
|
+
let requestGraphKey;
|
|
33
|
+
let bundleGraphBlob;
|
|
34
|
+
let assetGraphBlob;
|
|
35
|
+
for (let key of cache.keys()) {
|
|
36
|
+
if (key.startsWith('Asset/')) {
|
|
37
|
+
continue;
|
|
38
|
+
} else if (key.startsWith('PackagerRunner/')) {
|
|
39
|
+
continue;
|
|
68
40
|
}
|
|
69
41
|
|
|
70
|
-
|
|
42
|
+
if (key.startsWith('RequestTracker/') && key.endsWith('/RequestGraph')) {
|
|
43
|
+
requestGraphBlob = key;
|
|
44
|
+
requestGraphKey = key.split('/').slice(0, -1).join('/');
|
|
45
|
+
}
|
|
46
|
+
if (key.startsWith('BundleGraph/')) {
|
|
47
|
+
bundleGraphBlob = key;
|
|
48
|
+
}
|
|
49
|
+
if (key.startsWith('AssetGraph/')) {
|
|
50
|
+
assetGraphBlob = key;
|
|
51
|
+
}
|
|
71
52
|
}
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let {requestGraphBlob, bundleGraphBlob, assetGraphBlob} =
|
|
76
|
-
getMostRecentCacheBlobs();
|
|
77
|
-
const cache = new LMDBLiteCache(cacheDir);
|
|
54
|
+
console.log({requestGraphBlob, bundleGraphBlob, assetGraphBlob});
|
|
78
55
|
|
|
79
56
|
// Get requestTracker
|
|
80
57
|
let requestTracker;
|
|
81
|
-
if (requestGraphBlob) {
|
|
58
|
+
if (requestGraphBlob != null && requestGraphKey != null) {
|
|
82
59
|
try {
|
|
83
|
-
let requestGraphKey = requestGraphBlob.slice(0, -'-0'.length);
|
|
84
60
|
let date = Date.now();
|
|
61
|
+
|
|
62
|
+
const buffer = await cache.getBlob(requestGraphBlob);
|
|
63
|
+
const deserializer = new v8.Deserializer(buffer);
|
|
64
|
+
console.log(
|
|
65
|
+
'Wire format version stored',
|
|
66
|
+
deserializer.getWireFormatVersion(),
|
|
67
|
+
);
|
|
68
|
+
|
|
85
69
|
let {requestGraph, bufferLength} = await readAndDeserializeRequestGraph(
|
|
86
70
|
cache,
|
|
71
|
+
requestGraphBlob,
|
|
87
72
|
requestGraphKey,
|
|
88
|
-
requestGraphKey.replace('requestGraph-', ''),
|
|
89
73
|
);
|
|
90
74
|
|
|
91
75
|
requestTracker = new RequestTracker({
|
|
@@ -99,17 +83,15 @@ export async function loadGraphs(cacheDir: string): Promise<{|
|
|
|
99
83
|
cacheInfo.set('RequestGraph', [bufferLength]);
|
|
100
84
|
cacheInfo.get('RequestGraph')?.push(timeToDeserialize);
|
|
101
85
|
} catch (e) {
|
|
102
|
-
console.
|
|
86
|
+
console.error('Error loading Request Graph\n', e);
|
|
103
87
|
}
|
|
104
88
|
}
|
|
105
89
|
|
|
106
90
|
// Get bundleGraph
|
|
107
91
|
let bundleGraph;
|
|
108
|
-
if (bundleGraphBlob) {
|
|
92
|
+
if (bundleGraphBlob != null) {
|
|
109
93
|
try {
|
|
110
|
-
let file = await cache.
|
|
111
|
-
path.basename(bundleGraphBlob).slice(0, -'-0'.length),
|
|
112
|
-
);
|
|
94
|
+
let file = await cache.getBlob(bundleGraphBlob);
|
|
113
95
|
|
|
114
96
|
let timeToDeserialize = Date.now();
|
|
115
97
|
let obj = v8.deserialize(file);
|
|
@@ -120,17 +102,16 @@ export async function loadGraphs(cacheDir: string): Promise<{|
|
|
|
120
102
|
cacheInfo.set('BundleGraph', [Buffer.byteLength(file)]);
|
|
121
103
|
cacheInfo.get('BundleGraph')?.push(timeToDeserialize);
|
|
122
104
|
} catch (e) {
|
|
123
|
-
console.
|
|
105
|
+
console.error('Error loading Bundle Graph\n', e);
|
|
124
106
|
}
|
|
125
107
|
}
|
|
126
108
|
|
|
127
109
|
// Get assetGraph
|
|
128
110
|
let assetGraph;
|
|
129
|
-
if (assetGraphBlob) {
|
|
111
|
+
if (assetGraphBlob != null) {
|
|
130
112
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
113
|
+
// TODO: this should be reviewed when `cachePerformanceImprovements` flag is removed, as we'll be writing files to LMDB cache instead of large blobs
|
|
114
|
+
let file = await cache.getBlob(assetGraphBlob);
|
|
134
115
|
|
|
135
116
|
let timeToDeserialize = Date.now();
|
|
136
117
|
let obj = v8.deserialize(file);
|
|
@@ -141,7 +122,7 @@ export async function loadGraphs(cacheDir: string): Promise<{|
|
|
|
141
122
|
cacheInfo.set('AssetGraph', [Buffer.byteLength(file)]);
|
|
142
123
|
cacheInfo.get('AssetGraph')?.push(timeToDeserialize);
|
|
143
124
|
} catch (e) {
|
|
144
|
-
console.
|
|
125
|
+
console.error('Error loading Asset Graph\n', e);
|
|
145
126
|
}
|
|
146
127
|
}
|
|
147
128
|
|
|
@@ -178,7 +159,7 @@ export async function loadGraphs(cacheDir: string): Promise<{|
|
|
|
178
159
|
>);
|
|
179
160
|
}
|
|
180
161
|
} catch (e) {
|
|
181
|
-
console.
|
|
162
|
+
console.error('Error loading bundleInfo\n', e);
|
|
182
163
|
}
|
|
183
164
|
|
|
184
165
|
return {assetGraph, bundleGraph, requestTracker, bundleInfo, cacheInfo};
|