@contrast/agent 5.4.2 → 5.4.4
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/lib/start-agent.js +29 -31
- package/package.json +3 -3
package/lib/start-agent.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const process = require('process');
|
|
19
|
-
const
|
|
19
|
+
const { isMainThread } = require('node:worker_threads');
|
|
20
20
|
const semver = require('semver');
|
|
21
21
|
const _agentify = require('@contrast/agentify');
|
|
22
22
|
const {
|
|
@@ -117,37 +117,35 @@ function checkImportVsLoaderVsNodeVersion() {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async function startAgent({ type = 'cjs' } = {}) {
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
if (isMainThread) {
|
|
121
|
+
const core = initCore();
|
|
122
|
+
const agentify = _agentify(core);
|
|
123
|
+
|
|
124
|
+
return agentify(loadFeatures, {
|
|
125
|
+
installOrder: [
|
|
126
|
+
'reporter',
|
|
127
|
+
'startupValidation',
|
|
128
|
+
'contrastMethods',
|
|
129
|
+
'deadzones',
|
|
130
|
+
'scopes',
|
|
131
|
+
'sources',
|
|
132
|
+
'architectureComponents',
|
|
133
|
+
'assess',
|
|
134
|
+
'protect',
|
|
135
|
+
'depHooks',
|
|
136
|
+
'routeCoverage',
|
|
137
|
+
'libraryAnalysis',
|
|
138
|
+
'heapSnapshots',
|
|
139
|
+
'metrics',
|
|
140
|
+
'rewriteHooks',
|
|
141
|
+
'functionHooks',
|
|
142
|
+
'esmHooks',
|
|
143
|
+
],
|
|
144
|
+
type
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
console.warn('Not in main thread. Thread continuing without instrumentation.');
|
|
124
148
|
}
|
|
125
|
-
|
|
126
|
-
const core = initCore();
|
|
127
|
-
const agentify = _agentify(core);
|
|
128
|
-
|
|
129
|
-
return agentify(loadFeatures, {
|
|
130
|
-
installOrder: [
|
|
131
|
-
'reporter',
|
|
132
|
-
'startupValidation',
|
|
133
|
-
'contrastMethods',
|
|
134
|
-
'deadzones',
|
|
135
|
-
'scopes',
|
|
136
|
-
'sources',
|
|
137
|
-
'architectureComponents',
|
|
138
|
-
'assess',
|
|
139
|
-
'protect',
|
|
140
|
-
'depHooks',
|
|
141
|
-
'routeCoverage',
|
|
142
|
-
'libraryAnalysis',
|
|
143
|
-
'heapSnapshots',
|
|
144
|
-
'metrics',
|
|
145
|
-
'rewriteHooks',
|
|
146
|
-
'functionHooks',
|
|
147
|
-
'esmHooks',
|
|
148
|
-
],
|
|
149
|
-
type
|
|
150
|
-
});
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
module.exports = { startAgent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agent",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.4",
|
|
4
4
|
"description": "Assess and Protect agents for Node.js",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"test": "../scripts/test.sh"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@contrast/agentify": "1.22.
|
|
24
|
+
"@contrast/agentify": "1.22.3",
|
|
25
25
|
"@contrast/architecture-components": "1.17.0",
|
|
26
26
|
"@contrast/assess": "1.26.1",
|
|
27
27
|
"@contrast/library-analysis": "1.18.0",
|
|
28
|
-
"@contrast/protect": "1.34.
|
|
28
|
+
"@contrast/protect": "1.34.3",
|
|
29
29
|
"@contrast/route-coverage": "1.17.0",
|
|
30
30
|
"@contrast/telemetry": "1.5.3",
|
|
31
31
|
"semver": "^7.3.7"
|