@newrelic/browser-agent 1.310.1-rc.7 → 1.310.1-rc.8
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/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/util/stringify.js +22 -7
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/util/stringify.js +22 -7
- package/dist/types/common/util/stringify.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/util/stringify.js +24 -7
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.310.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.310.1-rc.8";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.310.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.310.1-rc.8";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -6,23 +6,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.stringify = stringify;
|
|
7
7
|
var _contextualEe = require("../event-emitter/contextual-ee");
|
|
8
8
|
/**
|
|
9
|
-
* Copyright 2020-
|
|
9
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
10
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns a function for use as a replacer parameter in JSON.stringify() to handle circular references.
|
|
15
|
+
* Uses an array to track the current ancestor chain, allowing the same object to appear
|
|
16
|
+
* multiple times in the structure as long as it's not a circular reference.
|
|
15
17
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value MDN - Cyclical object value}
|
|
16
|
-
* @returns {Function} A function that filters out
|
|
18
|
+
* @returns {Function} A function that filters out circular references while allowing duplicate references.
|
|
17
19
|
*/
|
|
18
20
|
const getCircularReplacer = () => {
|
|
19
|
-
const
|
|
20
|
-
return (key, value)
|
|
21
|
-
if (
|
|
22
|
-
|
|
21
|
+
const stack = [];
|
|
22
|
+
return function (key, value) {
|
|
23
|
+
if (stack.length > 0) {
|
|
24
|
+
// Find where we are in the stack
|
|
25
|
+
const thisPos = stack.indexOf(this);
|
|
26
|
+
if (~thisPos) {
|
|
27
|
+
// We're still in the stack, trim it
|
|
28
|
+
stack.splice(thisPos + 1);
|
|
29
|
+
} else {
|
|
30
|
+
// We're not in the stack, add ourselves
|
|
31
|
+
stack.push(this);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check if value is in the current ancestor chain
|
|
35
|
+
if (~stack.indexOf(value)) {
|
|
23
36
|
return;
|
|
24
37
|
}
|
|
25
|
-
|
|
38
|
+
} else {
|
|
39
|
+
// First call, initialize with root
|
|
40
|
+
stack.push(value);
|
|
26
41
|
}
|
|
27
42
|
return value;
|
|
28
43
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,17 +7,32 @@ import { ee } from '../event-emitter/contextual-ee';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns a function for use as a replacer parameter in JSON.stringify() to handle circular references.
|
|
10
|
+
* Uses an array to track the current ancestor chain, allowing the same object to appear
|
|
11
|
+
* multiple times in the structure as long as it's not a circular reference.
|
|
10
12
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value MDN - Cyclical object value}
|
|
11
|
-
* @returns {Function} A function that filters out
|
|
13
|
+
* @returns {Function} A function that filters out circular references while allowing duplicate references.
|
|
12
14
|
*/
|
|
13
15
|
const getCircularReplacer = () => {
|
|
14
|
-
const
|
|
15
|
-
return (key, value)
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
const stack = [];
|
|
17
|
+
return function (key, value) {
|
|
18
|
+
if (stack.length > 0) {
|
|
19
|
+
// Find where we are in the stack
|
|
20
|
+
const thisPos = stack.indexOf(this);
|
|
21
|
+
if (~thisPos) {
|
|
22
|
+
// We're still in the stack, trim it
|
|
23
|
+
stack.splice(thisPos + 1);
|
|
24
|
+
} else {
|
|
25
|
+
// We're not in the stack, add ourselves
|
|
26
|
+
stack.push(this);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Check if value is in the current ancestor chain
|
|
30
|
+
if (~stack.indexOf(value)) {
|
|
18
31
|
return;
|
|
19
32
|
}
|
|
20
|
-
|
|
33
|
+
} else {
|
|
34
|
+
// First call, initialize with root
|
|
35
|
+
stack.push(value);
|
|
21
36
|
}
|
|
22
37
|
return value;
|
|
23
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../src/common/util/stringify.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../src/common/util/stringify.js"],"names":[],"mappings":"AA0CA;;;;;GAKG;AACH,+BAHW,GAAC,GACC,MAAM,CAclB"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,18 +7,35 @@ import { ee } from '../event-emitter/contextual-ee'
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns a function for use as a replacer parameter in JSON.stringify() to handle circular references.
|
|
10
|
+
* Uses an array to track the current ancestor chain, allowing the same object to appear
|
|
11
|
+
* multiple times in the structure as long as it's not a circular reference.
|
|
10
12
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value MDN - Cyclical object value}
|
|
11
|
-
* @returns {Function} A function that filters out
|
|
13
|
+
* @returns {Function} A function that filters out circular references while allowing duplicate references.
|
|
12
14
|
*/
|
|
13
15
|
const getCircularReplacer = () => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const stack = []
|
|
17
|
+
|
|
18
|
+
return function (key, value) {
|
|
19
|
+
if (stack.length > 0) {
|
|
20
|
+
// Find where we are in the stack
|
|
21
|
+
const thisPos = stack.indexOf(this)
|
|
22
|
+
if (~thisPos) {
|
|
23
|
+
// We're still in the stack, trim it
|
|
24
|
+
stack.splice(thisPos + 1)
|
|
25
|
+
} else {
|
|
26
|
+
// We're not in the stack, add ourselves
|
|
27
|
+
stack.push(this)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Check if value is in the current ancestor chain
|
|
31
|
+
if (~stack.indexOf(value)) {
|
|
18
32
|
return
|
|
19
33
|
}
|
|
20
|
-
|
|
34
|
+
} else {
|
|
35
|
+
// First call, initialize with root
|
|
36
|
+
stack.push(value)
|
|
21
37
|
}
|
|
38
|
+
|
|
22
39
|
return value
|
|
23
40
|
}
|
|
24
41
|
}
|