posthog-node 5.47.6 → 5.47.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.
- package/dist/entrypoints/index.node.d.ts.map +1 -1
- package/dist/entrypoints/index.node.js +1 -1
- package/dist/entrypoints/index.node.mjs +1 -1
- package/dist/extensions/error-tracking/modifiers/context-lines.node.d.ts +6 -2
- package/dist/extensions/error-tracking/modifiers/context-lines.node.d.ts.map +1 -1
- package/dist/extensions/error-tracking/modifiers/context-lines.node.js +88 -24
- package/dist/extensions/error-tracking/modifiers/context-lines.node.mjs +85 -24
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/entrypoints/index.node.ts +5 -1
- package/src/extensions/error-tracking/modifiers/context-lines.node.ts +131 -28
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C,YAAY,IAAI,MAAM;IAItB,SAAS,CAAC,iBAAiB,IAAI,cAAc;cAI1B,4BAA4B,IAAI,iBAAiB,CAAC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C,YAAY,IAAI,MAAM;IAItB,SAAS,CAAC,iBAAiB,IAAI,cAAc;cAI1B,4BAA4B,IAAI,iBAAiB,CAAC,sBAAsB;CAiB5F"}
|
|
@@ -99,7 +99,7 @@ var __webpack_exports__ = {};
|
|
|
99
99
|
new _posthog_core__WEBPACK_IMPORTED_MODULE_5__.ErrorTracking.PrimitiveCoercer()
|
|
100
100
|
], _posthog_core__WEBPACK_IMPORTED_MODULE_5__.ErrorTracking.createStackParser("node:javascript", _posthog_core__WEBPACK_IMPORTED_MODULE_5__.ErrorTracking.nodeStackLineParser), [
|
|
101
101
|
(0, _extensions_error_tracking_modifiers_module_node__WEBPACK_IMPORTED_MODULE_1__.createModulerModifier)(),
|
|
102
|
-
_extensions_error_tracking_modifiers_context_lines_node__WEBPACK_IMPORTED_MODULE_2__.addSourceContext,
|
|
102
|
+
(frames)=>(0, _extensions_error_tracking_modifiers_context_lines_node__WEBPACK_IMPORTED_MODULE_2__.addSourceContext)(frames, void 0, this._logger),
|
|
103
103
|
(0, _extensions_error_tracking_modifiers_relative_path_node__WEBPACK_IMPORTED_MODULE_3__.createRelativePathModifier)()
|
|
104
104
|
]);
|
|
105
105
|
}
|
|
@@ -21,7 +21,7 @@ class PostHog extends PostHogBackendClient {
|
|
|
21
21
|
new ErrorTracking.PrimitiveCoercer()
|
|
22
22
|
], ErrorTracking.createStackParser("node:javascript", ErrorTracking.nodeStackLineParser), [
|
|
23
23
|
createModulerModifier(),
|
|
24
|
-
addSourceContext,
|
|
24
|
+
(frames)=>addSourceContext(frames, void 0, this._logger),
|
|
25
25
|
createRelativePathModifier()
|
|
26
26
|
]);
|
|
27
27
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ErrorTracking as CoreErrorTracking } from '@posthog/core';
|
|
1
|
+
import { ErrorTracking as CoreErrorTracking, type Logger } from '@posthog/core';
|
|
2
|
+
import { type FileHandle } from 'node:fs/promises';
|
|
2
3
|
export declare const MAX_CONTEXTLINES_COLNO: number;
|
|
3
4
|
export declare const MAX_CONTEXTLINES_LINENO: number;
|
|
4
|
-
export declare
|
|
5
|
+
export declare const MAX_CONTEXTLINES_FILE_SIZE: number;
|
|
6
|
+
type OpenSourceFile = (path: string, flags: number) => Promise<FileHandle>;
|
|
7
|
+
export declare function addSourceContext(frames: CoreErrorTracking.StackFrame[], openSourceFile?: OpenSourceFile, logger?: Pick<Logger, 'debug'>): Promise<CoreErrorTracking.StackFrame[]>;
|
|
8
|
+
export {};
|
|
5
9
|
//# sourceMappingURL=context-lines.node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-lines.node.d.ts","sourceRoot":"","sources":["../../../../src/extensions/error-tracking/modifiers/context-lines.node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"context-lines.node.d.ts","sourceRoot":"","sources":["../../../../src/extensions/error-tracking/modifiers/context-lines.node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAUxD,eAAO,MAAM,sBAAsB,EAAE,MAAa,CAAA;AAClD,eAAO,MAAM,uBAAuB,EAAE,MAAc,CAAA;AACpD,eAAO,MAAM,0BAA0B,EAAE,MAAyB,CAAA;AAGlE,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;AAE1E,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,iBAAiB,CAAC,UAAU,EAAE,EACtC,cAAc,GAAE,cAAqB,EACrC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAC,CAqFzC"}
|
|
@@ -24,24 +24,33 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
27
|
+
MAX_CONTEXTLINES_FILE_SIZE: ()=>MAX_CONTEXTLINES_FILE_SIZE,
|
|
28
28
|
MAX_CONTEXTLINES_COLNO: ()=>MAX_CONTEXTLINES_COLNO,
|
|
29
|
-
addSourceContext: ()=>addSourceContext
|
|
29
|
+
addSourceContext: ()=>addSourceContext,
|
|
30
|
+
MAX_CONTEXTLINES_LINENO: ()=>MAX_CONTEXTLINES_LINENO
|
|
30
31
|
});
|
|
31
32
|
const core_namespaceObject = require("@posthog/core");
|
|
32
33
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
34
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
35
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
33
36
|
const external_node_readline_namespaceObject = require("node:readline");
|
|
34
37
|
const LRU_FILE_CONTENTS_CACHE = new core_namespaceObject.ErrorTracking.ReduceableCache(25);
|
|
35
38
|
const LRU_FILE_CONTENTS_FS_READ_FAILED = new core_namespaceObject.ErrorTracking.ReduceableCache(20);
|
|
36
39
|
const DEFAULT_LINES_OF_CONTEXT = 7;
|
|
37
40
|
const MAX_CONTEXTLINES_COLNO = 1000;
|
|
38
41
|
const MAX_CONTEXTLINES_LINENO = 10000;
|
|
39
|
-
|
|
42
|
+
const MAX_CONTEXTLINES_FILE_SIZE = 10485760;
|
|
43
|
+
async function addSourceContext(frames, openSourceFile = promises_namespaceObject.open, logger) {
|
|
40
44
|
const filesToLines = {};
|
|
45
|
+
let basePath;
|
|
46
|
+
try {
|
|
47
|
+
basePath = process.cwd();
|
|
48
|
+
} catch {}
|
|
41
49
|
for(let i = frames.length - 1; i >= 0; i--){
|
|
42
50
|
const frame = frames[i];
|
|
43
51
|
const filename = frame?.filename;
|
|
44
52
|
if (!frame || 'string' != typeof filename || 'number' != typeof frame.lineno || shouldSkipContextLinesForFile(filename) || shouldSkipContextLinesForFrame(frame)) continue;
|
|
53
|
+
if (!(0, external_node_path_namespaceObject.isAbsolute)(filename) && void 0 === basePath) continue;
|
|
45
54
|
const filesToLinesOutput = filesToLines[filename];
|
|
46
55
|
if (!filesToLinesOutput) filesToLines[filename] = [];
|
|
47
56
|
filesToLines[filename].push(frame.lineno);
|
|
@@ -50,45 +59,87 @@ async function addSourceContext(frames) {
|
|
|
50
59
|
if (0 == files.length) return frames;
|
|
51
60
|
const readlinePromises = [];
|
|
52
61
|
for (const file of files){
|
|
53
|
-
|
|
62
|
+
const cacheKey = makeSourceCacheKey(file, basePath);
|
|
63
|
+
if (void 0 === cacheKey) continue;
|
|
64
|
+
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(cacheKey)) continue;
|
|
54
65
|
const filesToLineRanges = filesToLines[file];
|
|
55
66
|
if (!filesToLineRanges) continue;
|
|
56
67
|
filesToLineRanges.sort((a, b)=>a - b);
|
|
57
68
|
const ranges = makeLineReaderRanges(filesToLineRanges);
|
|
58
|
-
if (ranges.every((r)=>rangeExistsInContentCache(
|
|
59
|
-
const cache = emplace(LRU_FILE_CONTENTS_CACHE,
|
|
60
|
-
readlinePromises.push(getContextLinesFromFile(file, ranges, cache));
|
|
69
|
+
if (ranges.every((r)=>rangeExistsInContentCache(cacheKey, r))) continue;
|
|
70
|
+
const cache = emplace(LRU_FILE_CONTENTS_CACHE, cacheKey, {});
|
|
71
|
+
readlinePromises.push(getContextLinesFromFile(file, ranges, cache, cacheKey, openSourceFile, logger));
|
|
61
72
|
}
|
|
62
73
|
await Promise.all(readlinePromises).catch(()=>{});
|
|
63
|
-
if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE);
|
|
74
|
+
if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE, basePath);
|
|
64
75
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
65
76
|
return frames;
|
|
66
77
|
}
|
|
67
|
-
function
|
|
78
|
+
async function openRegularSourceFile(path, openSourceFile, logger) {
|
|
79
|
+
let fileHandle;
|
|
80
|
+
let isValid = false;
|
|
81
|
+
try {
|
|
82
|
+
fileHandle = await openSourceFile(path, external_node_fs_namespaceObject.constants.O_RDONLY | external_node_fs_namespaceObject.constants.O_NONBLOCK);
|
|
83
|
+
const fileStat = await fileHandle.stat();
|
|
84
|
+
if (!fileStat.isFile()) return;
|
|
85
|
+
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
|
|
86
|
+
isValid = true;
|
|
87
|
+
return fileHandle;
|
|
88
|
+
} catch {
|
|
89
|
+
return;
|
|
90
|
+
} finally{
|
|
91
|
+
if (fileHandle && !isValid) await fileHandle.close().catch(()=>{});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function getContextLinesFromFile(path, ranges, output, cacheKey, openSourceFile, logger) {
|
|
95
|
+
const fileHandle = await openRegularSourceFile(path, openSourceFile, logger);
|
|
96
|
+
if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
97
|
+
const openedFileHandle = fileHandle;
|
|
68
98
|
return new Promise((resolve)=>{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
let finished = false;
|
|
100
|
+
function destroyStreamAndResolve(stream) {
|
|
101
|
+
if (finished) return;
|
|
102
|
+
finished = true;
|
|
103
|
+
stream?.destroy();
|
|
104
|
+
openedFileHandle.close().then(resolve, resolve);
|
|
105
|
+
}
|
|
106
|
+
let stream;
|
|
107
|
+
try {
|
|
108
|
+
stream = openedFileHandle.createReadStream({
|
|
109
|
+
autoClose: false,
|
|
110
|
+
start: 0,
|
|
111
|
+
end: MAX_CONTEXTLINES_FILE_SIZE - 1
|
|
112
|
+
});
|
|
113
|
+
} catch {
|
|
114
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
115
|
+
destroyStreamAndResolve();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let lineReaded;
|
|
119
|
+
try {
|
|
120
|
+
lineReaded = (0, external_node_readline_namespaceObject.createInterface)({
|
|
121
|
+
input: stream
|
|
122
|
+
});
|
|
123
|
+
} catch {
|
|
124
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
125
|
+
destroyStreamAndResolve(stream);
|
|
126
|
+
return;
|
|
76
127
|
}
|
|
77
128
|
let lineNumber = 0;
|
|
78
129
|
let currentRangeIndex = 0;
|
|
79
130
|
const range = ranges[currentRangeIndex];
|
|
80
|
-
if (void 0 === range) return void destroyStreamAndResolve();
|
|
131
|
+
if (void 0 === range) return void destroyStreamAndResolve(stream);
|
|
81
132
|
let rangeStart = range[0];
|
|
82
133
|
let rangeEnd = range[1];
|
|
83
134
|
function onStreamError() {
|
|
84
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
135
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
85
136
|
lineReaded.close();
|
|
86
137
|
lineReaded.removeAllListeners();
|
|
87
|
-
destroyStreamAndResolve();
|
|
138
|
+
destroyStreamAndResolve(stream);
|
|
88
139
|
}
|
|
89
140
|
stream.on('error', onStreamError);
|
|
90
141
|
lineReaded.on('error', onStreamError);
|
|
91
|
-
lineReaded.on('close', destroyStreamAndResolve);
|
|
142
|
+
lineReaded.on('close', ()=>destroyStreamAndResolve(stream));
|
|
92
143
|
lineReaded.on('line', (line)=>{
|
|
93
144
|
lineNumber++;
|
|
94
145
|
if (lineNumber < rangeStart) return;
|
|
@@ -112,9 +163,10 @@ function getContextLinesFromFile(path, ranges, output) {
|
|
|
112
163
|
});
|
|
113
164
|
});
|
|
114
165
|
}
|
|
115
|
-
function addSourceContextToFrames(frames, cache) {
|
|
166
|
+
function addSourceContextToFrames(frames, cache, basePath) {
|
|
116
167
|
for (const frame of frames)if (frame.filename && void 0 === frame.context_line && 'number' == typeof frame.lineno) {
|
|
117
|
-
const
|
|
168
|
+
const cacheKey = makeSourceCacheKey(frame.filename, basePath);
|
|
169
|
+
const contents = void 0 === cacheKey ? void 0 : cache.get(cacheKey);
|
|
118
170
|
if (void 0 === contents) continue;
|
|
119
171
|
addContextToFrame(frame.lineno, frame, contents);
|
|
120
172
|
}
|
|
@@ -150,8 +202,18 @@ function shouldSkipContextLinesForFrame(frame) {
|
|
|
150
202
|
if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
|
|
151
203
|
return false;
|
|
152
204
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
205
|
+
function makeSourceCacheKey(path, basePath) {
|
|
206
|
+
if ((0, external_node_path_namespaceObject.isAbsolute)(path)) return JSON.stringify([
|
|
207
|
+
null,
|
|
208
|
+
path
|
|
209
|
+
]);
|
|
210
|
+
return void 0 === basePath ? void 0 : JSON.stringify([
|
|
211
|
+
basePath,
|
|
212
|
+
path
|
|
213
|
+
]);
|
|
214
|
+
}
|
|
215
|
+
function rangeExistsInContentCache(cacheKey, range) {
|
|
216
|
+
const contents = LRU_FILE_CONTENTS_CACHE.get(cacheKey);
|
|
155
217
|
if (void 0 === contents) return false;
|
|
156
218
|
for(let i = range[0]; i <= range[1]; i++)if (void 0 === contents[i]) return false;
|
|
157
219
|
return true;
|
|
@@ -215,10 +277,12 @@ function snipLine(line, colno) {
|
|
|
215
277
|
return newLine;
|
|
216
278
|
}
|
|
217
279
|
exports.MAX_CONTEXTLINES_COLNO = __webpack_exports__.MAX_CONTEXTLINES_COLNO;
|
|
280
|
+
exports.MAX_CONTEXTLINES_FILE_SIZE = __webpack_exports__.MAX_CONTEXTLINES_FILE_SIZE;
|
|
218
281
|
exports.MAX_CONTEXTLINES_LINENO = __webpack_exports__.MAX_CONTEXTLINES_LINENO;
|
|
219
282
|
exports.addSourceContext = __webpack_exports__.addSourceContext;
|
|
220
283
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
221
284
|
"MAX_CONTEXTLINES_COLNO",
|
|
285
|
+
"MAX_CONTEXTLINES_FILE_SIZE",
|
|
222
286
|
"MAX_CONTEXTLINES_LINENO",
|
|
223
287
|
"addSourceContext"
|
|
224
288
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { ErrorTracking } from "@posthog/core";
|
|
2
|
-
import {
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { open as promises_open } from "node:fs/promises";
|
|
4
|
+
import { isAbsolute } from "node:path";
|
|
3
5
|
import { createInterface } from "node:readline";
|
|
4
6
|
const LRU_FILE_CONTENTS_CACHE = new ErrorTracking.ReduceableCache(25);
|
|
5
7
|
const LRU_FILE_CONTENTS_FS_READ_FAILED = new ErrorTracking.ReduceableCache(20);
|
|
6
8
|
const DEFAULT_LINES_OF_CONTEXT = 7;
|
|
7
9
|
const MAX_CONTEXTLINES_COLNO = 1000;
|
|
8
10
|
const MAX_CONTEXTLINES_LINENO = 10000;
|
|
9
|
-
|
|
11
|
+
const MAX_CONTEXTLINES_FILE_SIZE = 10485760;
|
|
12
|
+
async function addSourceContext(frames, openSourceFile = promises_open, logger) {
|
|
10
13
|
const filesToLines = {};
|
|
14
|
+
let basePath;
|
|
15
|
+
try {
|
|
16
|
+
basePath = process.cwd();
|
|
17
|
+
} catch {}
|
|
11
18
|
for(let i = frames.length - 1; i >= 0; i--){
|
|
12
19
|
const frame = frames[i];
|
|
13
20
|
const filename = frame?.filename;
|
|
14
21
|
if (!frame || 'string' != typeof filename || 'number' != typeof frame.lineno || shouldSkipContextLinesForFile(filename) || shouldSkipContextLinesForFrame(frame)) continue;
|
|
22
|
+
if (!isAbsolute(filename) && void 0 === basePath) continue;
|
|
15
23
|
const filesToLinesOutput = filesToLines[filename];
|
|
16
24
|
if (!filesToLinesOutput) filesToLines[filename] = [];
|
|
17
25
|
filesToLines[filename].push(frame.lineno);
|
|
@@ -20,45 +28,87 @@ async function addSourceContext(frames) {
|
|
|
20
28
|
if (0 == files.length) return frames;
|
|
21
29
|
const readlinePromises = [];
|
|
22
30
|
for (const file of files){
|
|
23
|
-
|
|
31
|
+
const cacheKey = makeSourceCacheKey(file, basePath);
|
|
32
|
+
if (void 0 === cacheKey) continue;
|
|
33
|
+
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(cacheKey)) continue;
|
|
24
34
|
const filesToLineRanges = filesToLines[file];
|
|
25
35
|
if (!filesToLineRanges) continue;
|
|
26
36
|
filesToLineRanges.sort((a, b)=>a - b);
|
|
27
37
|
const ranges = makeLineReaderRanges(filesToLineRanges);
|
|
28
|
-
if (ranges.every((r)=>rangeExistsInContentCache(
|
|
29
|
-
const cache = emplace(LRU_FILE_CONTENTS_CACHE,
|
|
30
|
-
readlinePromises.push(getContextLinesFromFile(file, ranges, cache));
|
|
38
|
+
if (ranges.every((r)=>rangeExistsInContentCache(cacheKey, r))) continue;
|
|
39
|
+
const cache = emplace(LRU_FILE_CONTENTS_CACHE, cacheKey, {});
|
|
40
|
+
readlinePromises.push(getContextLinesFromFile(file, ranges, cache, cacheKey, openSourceFile, logger));
|
|
31
41
|
}
|
|
32
42
|
await Promise.all(readlinePromises).catch(()=>{});
|
|
33
|
-
if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE);
|
|
43
|
+
if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE, basePath);
|
|
34
44
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
35
45
|
return frames;
|
|
36
46
|
}
|
|
37
|
-
function
|
|
47
|
+
async function openRegularSourceFile(path, openSourceFile, logger) {
|
|
48
|
+
let fileHandle;
|
|
49
|
+
let isValid = false;
|
|
50
|
+
try {
|
|
51
|
+
fileHandle = await openSourceFile(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
52
|
+
const fileStat = await fileHandle.stat();
|
|
53
|
+
if (!fileStat.isFile()) return;
|
|
54
|
+
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
|
|
55
|
+
isValid = true;
|
|
56
|
+
return fileHandle;
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
} finally{
|
|
60
|
+
if (fileHandle && !isValid) await fileHandle.close().catch(()=>{});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function getContextLinesFromFile(path, ranges, output, cacheKey, openSourceFile, logger) {
|
|
64
|
+
const fileHandle = await openRegularSourceFile(path, openSourceFile, logger);
|
|
65
|
+
if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
66
|
+
const openedFileHandle = fileHandle;
|
|
38
67
|
return new Promise((resolve)=>{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
let finished = false;
|
|
69
|
+
function destroyStreamAndResolve(stream) {
|
|
70
|
+
if (finished) return;
|
|
71
|
+
finished = true;
|
|
72
|
+
stream?.destroy();
|
|
73
|
+
openedFileHandle.close().then(resolve, resolve);
|
|
74
|
+
}
|
|
75
|
+
let stream;
|
|
76
|
+
try {
|
|
77
|
+
stream = openedFileHandle.createReadStream({
|
|
78
|
+
autoClose: false,
|
|
79
|
+
start: 0,
|
|
80
|
+
end: MAX_CONTEXTLINES_FILE_SIZE - 1
|
|
81
|
+
});
|
|
82
|
+
} catch {
|
|
83
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
84
|
+
destroyStreamAndResolve();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let lineReaded;
|
|
88
|
+
try {
|
|
89
|
+
lineReaded = createInterface({
|
|
90
|
+
input: stream
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
94
|
+
destroyStreamAndResolve(stream);
|
|
95
|
+
return;
|
|
46
96
|
}
|
|
47
97
|
let lineNumber = 0;
|
|
48
98
|
let currentRangeIndex = 0;
|
|
49
99
|
const range = ranges[currentRangeIndex];
|
|
50
|
-
if (void 0 === range) return void destroyStreamAndResolve();
|
|
100
|
+
if (void 0 === range) return void destroyStreamAndResolve(stream);
|
|
51
101
|
let rangeStart = range[0];
|
|
52
102
|
let rangeEnd = range[1];
|
|
53
103
|
function onStreamError() {
|
|
54
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
104
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
55
105
|
lineReaded.close();
|
|
56
106
|
lineReaded.removeAllListeners();
|
|
57
|
-
destroyStreamAndResolve();
|
|
107
|
+
destroyStreamAndResolve(stream);
|
|
58
108
|
}
|
|
59
109
|
stream.on('error', onStreamError);
|
|
60
110
|
lineReaded.on('error', onStreamError);
|
|
61
|
-
lineReaded.on('close', destroyStreamAndResolve);
|
|
111
|
+
lineReaded.on('close', ()=>destroyStreamAndResolve(stream));
|
|
62
112
|
lineReaded.on('line', (line)=>{
|
|
63
113
|
lineNumber++;
|
|
64
114
|
if (lineNumber < rangeStart) return;
|
|
@@ -82,9 +132,10 @@ function getContextLinesFromFile(path, ranges, output) {
|
|
|
82
132
|
});
|
|
83
133
|
});
|
|
84
134
|
}
|
|
85
|
-
function addSourceContextToFrames(frames, cache) {
|
|
135
|
+
function addSourceContextToFrames(frames, cache, basePath) {
|
|
86
136
|
for (const frame of frames)if (frame.filename && void 0 === frame.context_line && 'number' == typeof frame.lineno) {
|
|
87
|
-
const
|
|
137
|
+
const cacheKey = makeSourceCacheKey(frame.filename, basePath);
|
|
138
|
+
const contents = void 0 === cacheKey ? void 0 : cache.get(cacheKey);
|
|
88
139
|
if (void 0 === contents) continue;
|
|
89
140
|
addContextToFrame(frame.lineno, frame, contents);
|
|
90
141
|
}
|
|
@@ -120,8 +171,18 @@ function shouldSkipContextLinesForFrame(frame) {
|
|
|
120
171
|
if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
|
|
121
172
|
return false;
|
|
122
173
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
174
|
+
function makeSourceCacheKey(path, basePath) {
|
|
175
|
+
if (isAbsolute(path)) return JSON.stringify([
|
|
176
|
+
null,
|
|
177
|
+
path
|
|
178
|
+
]);
|
|
179
|
+
return void 0 === basePath ? void 0 : JSON.stringify([
|
|
180
|
+
basePath,
|
|
181
|
+
path
|
|
182
|
+
]);
|
|
183
|
+
}
|
|
184
|
+
function rangeExistsInContentCache(cacheKey, range) {
|
|
185
|
+
const contents = LRU_FILE_CONTENTS_CACHE.get(cacheKey);
|
|
125
186
|
if (void 0 === contents) return false;
|
|
126
187
|
for(let i = range[0]; i <= range[1]; i++)if (void 0 === contents[i]) return false;
|
|
127
188
|
return true;
|
|
@@ -184,4 +245,4 @@ function snipLine(line, colno) {
|
|
|
184
245
|
if (end < lineLength) newLine += '...';
|
|
185
246
|
return newLine;
|
|
186
247
|
}
|
|
187
|
-
export { MAX_CONTEXTLINES_COLNO, MAX_CONTEXTLINES_LINENO, addSourceContext };
|
|
248
|
+
export { MAX_CONTEXTLINES_COLNO, MAX_CONTEXTLINES_FILE_SIZE, MAX_CONTEXTLINES_LINENO, addSourceContext };
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.47.
|
|
1
|
+
export declare const version = "5.47.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
version: ()=>version
|
|
28
28
|
});
|
|
29
|
-
const version = '5.47.
|
|
29
|
+
const version = '5.47.7';
|
|
30
30
|
exports.version = __webpack_exports__.version;
|
|
31
31
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
32
32
|
"version"
|
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '5.47.
|
|
1
|
+
const version = '5.47.7';
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -27,7 +27,11 @@ export class PostHog extends PostHogBackendClient {
|
|
|
27
27
|
new CoreErrorTracking.PrimitiveCoercer(),
|
|
28
28
|
],
|
|
29
29
|
CoreErrorTracking.createStackParser('node:javascript', CoreErrorTracking.nodeStackLineParser),
|
|
30
|
-
[
|
|
30
|
+
[
|
|
31
|
+
createModulerModifier(),
|
|
32
|
+
(frames) => addSourceContext(frames, undefined, this._logger),
|
|
33
|
+
createRelativePathModifier(),
|
|
34
|
+
]
|
|
31
35
|
)
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright (c) 2012 Functional Software, Inc. dba Sentry
|
|
3
3
|
// Licensed under the MIT License: https://github.com/getsentry/sentry-javascript/blob/develop/LICENSE
|
|
4
4
|
|
|
5
|
-
import { ErrorTracking as CoreErrorTracking } from '@posthog/core'
|
|
6
|
-
import {
|
|
5
|
+
import { ErrorTracking as CoreErrorTracking, type Logger } from '@posthog/core'
|
|
6
|
+
import { constants, type ReadStream } from 'node:fs'
|
|
7
|
+
import { open, type FileHandle } from 'node:fs/promises'
|
|
8
|
+
import { isAbsolute } from 'node:path'
|
|
7
9
|
import { createInterface } from 'node:readline'
|
|
8
10
|
|
|
9
11
|
const LRU_FILE_CONTENTS_CACHE = new CoreErrorTracking.ReduceableCache<string, Record<number, string>>(25)
|
|
@@ -14,15 +16,25 @@ const DEFAULT_LINES_OF_CONTEXT = 7
|
|
|
14
16
|
// Exported for testing purposes.
|
|
15
17
|
export const MAX_CONTEXTLINES_COLNO: number = 1000
|
|
16
18
|
export const MAX_CONTEXTLINES_LINENO: number = 10000
|
|
19
|
+
export const MAX_CONTEXTLINES_FILE_SIZE: number = 10 * 1024 * 1024
|
|
17
20
|
|
|
18
21
|
type ReadlineRange = [start: number, end: number]
|
|
22
|
+
type OpenSourceFile = (path: string, flags: number) => Promise<FileHandle>
|
|
19
23
|
|
|
20
24
|
export async function addSourceContext(
|
|
21
|
-
frames: CoreErrorTracking.StackFrame[]
|
|
25
|
+
frames: CoreErrorTracking.StackFrame[],
|
|
26
|
+
openSourceFile: OpenSourceFile = open,
|
|
27
|
+
logger?: Pick<Logger, 'debug'>
|
|
22
28
|
): Promise<CoreErrorTracking.StackFrame[]> {
|
|
23
29
|
// keep a lookup map of which files we've already enqueued to read,
|
|
24
30
|
// so we don't enqueue the same file multiple times which would cause multiple i/o reads
|
|
25
31
|
const filesToLines: Record<string, number[]> = {}
|
|
32
|
+
let basePath: string | undefined
|
|
33
|
+
try {
|
|
34
|
+
basePath = process.cwd()
|
|
35
|
+
} catch {
|
|
36
|
+
// Absolute source paths can still be processed when the working directory was removed.
|
|
37
|
+
}
|
|
26
38
|
|
|
27
39
|
// Maps preserve insertion order, so we iterate in reverse, starting at the
|
|
28
40
|
// outermost frame and closer to where the exception has occurred (poor mans priority)
|
|
@@ -40,6 +52,9 @@ export async function addSourceContext(
|
|
|
40
52
|
continue
|
|
41
53
|
}
|
|
42
54
|
|
|
55
|
+
if (!isAbsolute(filename) && basePath === undefined) {
|
|
56
|
+
continue
|
|
57
|
+
}
|
|
43
58
|
const filesToLinesOutput = filesToLines[filename]
|
|
44
59
|
if (!filesToLinesOutput) {
|
|
45
60
|
filesToLines[filename] = []
|
|
@@ -54,8 +69,13 @@ export async function addSourceContext(
|
|
|
54
69
|
|
|
55
70
|
const readlinePromises: Promise<void>[] = []
|
|
56
71
|
for (const file of files) {
|
|
72
|
+
const cacheKey = makeSourceCacheKey(file, basePath)
|
|
73
|
+
if (cacheKey === undefined) {
|
|
74
|
+
continue
|
|
75
|
+
}
|
|
76
|
+
|
|
57
77
|
// If we failed to read this before, dont try reading it again.
|
|
58
|
-
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(
|
|
78
|
+
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(cacheKey)) {
|
|
59
79
|
continue
|
|
60
80
|
}
|
|
61
81
|
|
|
@@ -68,12 +88,12 @@ export async function addSourceContext(
|
|
|
68
88
|
filesToLineRanges.sort((a, b) => a - b)
|
|
69
89
|
// Check if the contents are already in the cache and if we can avoid reading the file again.
|
|
70
90
|
const ranges = makeLineReaderRanges(filesToLineRanges)
|
|
71
|
-
if (ranges.every((r) => rangeExistsInContentCache(
|
|
91
|
+
if (ranges.every((r) => rangeExistsInContentCache(cacheKey, r))) {
|
|
72
92
|
continue
|
|
73
93
|
}
|
|
74
94
|
|
|
75
|
-
const cache = emplace(LRU_FILE_CONTENTS_CACHE,
|
|
76
|
-
readlinePromises.push(getContextLinesFromFile(file, ranges, cache))
|
|
95
|
+
const cache = emplace(LRU_FILE_CONTENTS_CACHE, cacheKey, {})
|
|
96
|
+
readlinePromises.push(getContextLinesFromFile(file, ranges, cache, cacheKey, openSourceFile, logger))
|
|
77
97
|
}
|
|
78
98
|
|
|
79
99
|
// The promise rejections are caught in order to prevent them from short circuiting Promise.all
|
|
@@ -82,7 +102,7 @@ export async function addSourceContext(
|
|
|
82
102
|
// Perform the same loop as above, but this time we can assume all files are in the cache
|
|
83
103
|
// and attempt to add source context to frames.
|
|
84
104
|
if (frames && frames.length > 0) {
|
|
85
|
-
addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE)
|
|
105
|
+
addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE, basePath)
|
|
86
106
|
}
|
|
87
107
|
|
|
88
108
|
// Once we're finished processing an exception reduce the files held in the cache
|
|
@@ -92,25 +112,99 @@ export async function addSourceContext(
|
|
|
92
112
|
return frames
|
|
93
113
|
}
|
|
94
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Opens a bounded regular file without blocking on special files such as FIFOs.
|
|
117
|
+
* File validation and content reads use the same descriptor so path replacement cannot change what is read.
|
|
118
|
+
*/
|
|
119
|
+
async function openRegularSourceFile(
|
|
120
|
+
path: string,
|
|
121
|
+
openSourceFile: OpenSourceFile,
|
|
122
|
+
logger?: Pick<Logger, 'debug'>
|
|
123
|
+
): Promise<FileHandle | undefined> {
|
|
124
|
+
let fileHandle: FileHandle | undefined
|
|
125
|
+
let isValid = false
|
|
126
|
+
try {
|
|
127
|
+
fileHandle = await openSourceFile(path, constants.O_RDONLY | constants.O_NONBLOCK)
|
|
128
|
+
const fileStat = await fileHandle.stat()
|
|
129
|
+
if (!fileStat.isFile()) {
|
|
130
|
+
return undefined
|
|
131
|
+
}
|
|
132
|
+
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) {
|
|
133
|
+
logger?.debug(
|
|
134
|
+
`Skipping source context for oversized file ${path}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`
|
|
135
|
+
)
|
|
136
|
+
return undefined
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
isValid = true
|
|
140
|
+
return fileHandle
|
|
141
|
+
} catch {
|
|
142
|
+
return undefined
|
|
143
|
+
} finally {
|
|
144
|
+
if (fileHandle && !isValid) {
|
|
145
|
+
await fileHandle.close().catch(() => {})
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
95
150
|
/**
|
|
96
151
|
* Extracts lines from a file and stores them in a cache.
|
|
97
152
|
*/
|
|
98
|
-
function getContextLinesFromFile(
|
|
153
|
+
async function getContextLinesFromFile(
|
|
154
|
+
path: string,
|
|
155
|
+
ranges: ReadlineRange[],
|
|
156
|
+
output: Record<number, string>,
|
|
157
|
+
cacheKey: string,
|
|
158
|
+
openSourceFile: OpenSourceFile,
|
|
159
|
+
logger?: Pick<Logger, 'debug'>
|
|
160
|
+
): Promise<void> {
|
|
161
|
+
const fileHandle = await openRegularSourceFile(path, openSourceFile, logger)
|
|
162
|
+
if (fileHandle === undefined) {
|
|
163
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1)
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
const openedFileHandle = fileHandle
|
|
167
|
+
|
|
99
168
|
return new Promise((resolve) => {
|
|
169
|
+
let finished = false
|
|
170
|
+
|
|
171
|
+
// We need to explicitly destroy the stream and close its descriptor to prevent memory leaks,
|
|
172
|
+
// removing the listeners on the readline interface is not enough.
|
|
173
|
+
// Otherwise, repeated exception captures can keep opening the same files without closing them.
|
|
174
|
+
function destroyStreamAndResolve(stream?: ReadStream): void {
|
|
175
|
+
if (finished) {
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
finished = true
|
|
179
|
+
stream?.destroy()
|
|
180
|
+
void openedFileHandle.close().then(resolve, resolve)
|
|
181
|
+
}
|
|
182
|
+
|
|
100
183
|
// It is important *not* to have any async code between createInterface and the 'line' event listener
|
|
101
184
|
// as it will cause the 'line' event to
|
|
102
185
|
// be emitted before the listener is attached.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
186
|
+
let stream: ReadStream
|
|
187
|
+
try {
|
|
188
|
+
stream = openedFileHandle.createReadStream({
|
|
189
|
+
autoClose: false,
|
|
190
|
+
start: 0,
|
|
191
|
+
end: MAX_CONTEXTLINES_FILE_SIZE - 1,
|
|
192
|
+
})
|
|
193
|
+
} catch {
|
|
194
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1)
|
|
195
|
+
destroyStreamAndResolve()
|
|
196
|
+
return
|
|
197
|
+
}
|
|
107
198
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
199
|
+
let lineReaded: ReturnType<typeof createInterface>
|
|
200
|
+
try {
|
|
201
|
+
lineReaded = createInterface({
|
|
202
|
+
input: stream,
|
|
203
|
+
})
|
|
204
|
+
} catch {
|
|
205
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1)
|
|
206
|
+
destroyStreamAndResolve(stream)
|
|
207
|
+
return
|
|
114
208
|
}
|
|
115
209
|
|
|
116
210
|
// Init at zero and increment at the start of the loop because lines are 1 indexed.
|
|
@@ -119,7 +213,7 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
119
213
|
const range = ranges[currentRangeIndex]
|
|
120
214
|
if (range === undefined) {
|
|
121
215
|
// We should never reach this point, but if we do, we should resolve the promise to prevent it from hanging.
|
|
122
|
-
destroyStreamAndResolve()
|
|
216
|
+
destroyStreamAndResolve(stream)
|
|
123
217
|
return
|
|
124
218
|
}
|
|
125
219
|
let rangeStart = range[0]
|
|
@@ -128,18 +222,18 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
128
222
|
// We use this inside Promise.all, so we need to resolve the promise even if there is an error
|
|
129
223
|
// to prevent Promise.all from short circuiting the rest.
|
|
130
224
|
function onStreamError(): void {
|
|
131
|
-
// Mark file
|
|
132
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
225
|
+
// Mark the file as failed to prevent repeated read attempts.
|
|
226
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1)
|
|
133
227
|
lineReaded.close()
|
|
134
228
|
lineReaded.removeAllListeners()
|
|
135
|
-
destroyStreamAndResolve()
|
|
229
|
+
destroyStreamAndResolve(stream)
|
|
136
230
|
}
|
|
137
231
|
|
|
138
232
|
// We need to handle the error event to prevent the process from crashing in < Node 16
|
|
139
233
|
// https://github.com/nodejs/node/pull/31603
|
|
140
234
|
stream.on('error', onStreamError)
|
|
141
235
|
lineReaded.on('error', onStreamError)
|
|
142
|
-
lineReaded.on('close', destroyStreamAndResolve)
|
|
236
|
+
lineReaded.on('close', () => destroyStreamAndResolve(stream))
|
|
143
237
|
|
|
144
238
|
lineReaded.on('line', (line) => {
|
|
145
239
|
lineNumber++
|
|
@@ -175,12 +269,14 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
175
269
|
/** Adds context lines to frames */
|
|
176
270
|
function addSourceContextToFrames(
|
|
177
271
|
frames: CoreErrorTracking.StackFrame[],
|
|
178
|
-
cache: CoreErrorTracking.ReduceableCache<string, Record<number, string
|
|
272
|
+
cache: CoreErrorTracking.ReduceableCache<string, Record<number, string>>,
|
|
273
|
+
basePath: string | undefined
|
|
179
274
|
): void {
|
|
180
275
|
for (const frame of frames) {
|
|
181
276
|
// Only add context if we have a filename and it hasn't already been added
|
|
182
277
|
if (frame.filename && frame.context_line === undefined && typeof frame.lineno === 'number') {
|
|
183
|
-
const
|
|
278
|
+
const cacheKey = makeSourceCacheKey(frame.filename, basePath)
|
|
279
|
+
const contents = cacheKey === undefined ? undefined : cache.get(cacheKey)
|
|
184
280
|
if (contents === undefined) {
|
|
185
281
|
continue
|
|
186
282
|
}
|
|
@@ -280,11 +376,18 @@ function shouldSkipContextLinesForFrame(frame: CoreErrorTracking.StackFrame): bo
|
|
|
280
376
|
return false
|
|
281
377
|
}
|
|
282
378
|
|
|
379
|
+
function makeSourceCacheKey(path: string, basePath: string | undefined): string | undefined {
|
|
380
|
+
if (isAbsolute(path)) {
|
|
381
|
+
return JSON.stringify([null, path])
|
|
382
|
+
}
|
|
383
|
+
return basePath === undefined ? undefined : JSON.stringify([basePath, path])
|
|
384
|
+
}
|
|
385
|
+
|
|
283
386
|
/**
|
|
284
387
|
* Checks if we have all the contents that we need in the cache.
|
|
285
388
|
*/
|
|
286
|
-
function rangeExistsInContentCache(
|
|
287
|
-
const contents = LRU_FILE_CONTENTS_CACHE.get(
|
|
389
|
+
function rangeExistsInContentCache(cacheKey: string, range: ReadlineRange): boolean {
|
|
390
|
+
const contents = LRU_FILE_CONTENTS_CACHE.get(cacheKey)
|
|
288
391
|
if (contents === undefined) {
|
|
289
392
|
return false
|
|
290
393
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.47.
|
|
1
|
+
export const version = '5.47.7'
|