@contrast/esm-hooks 2.19.0 → 2.19.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.
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright: 2024 Contrast Security, Inc
1
+ Copyright: 2025 Contrast Security, Inc
2
2
  Contact: support@contrastsecurity.com
3
3
  License: Commercial
4
4
 
package/lib/common.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/lib/hooks.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -152,25 +152,40 @@ async function load(url, context, nextLoad) {
152
152
  };
153
153
 
154
154
  const { source } = await nextLoad(url, context);
155
- const rewriteResult = await loaderAgent.rewriter.rewrite(
156
- Buffer.isBuffer(source) ? BufferPrototypeToString.call(source) : source.toString(),
157
- rewriteOptions
158
- );
159
-
160
- if (process.env.CSI_EXPOSE_CORE) {
161
- // only do this in testing scenarios (todo: compose this functionality into test agents instead)
162
- loaderAgent.esmHooks.portClient.sendStatus('rewriting file during ESM load hook', rewriteOptions);
163
- }
164
155
 
165
- if (loaderAgent.config.agent.node.rewrite.cache.enable) {
166
- await loaderAgent.rewriter.cache.write(filename, rewriteResult);
167
- }
156
+ try {
157
+ const rewriteResult = await loaderAgent.rewriter.rewrite(
158
+ Buffer.isBuffer(source) ? BufferPrototypeToString.call(source) : source.toString(),
159
+ rewriteOptions
160
+ );
168
161
 
169
- return {
170
- source: rewriteResult.code,
171
- format: 'module',
172
- shortCircuit: true,
173
- };
162
+ if (process.env.CSI_EXPOSE_CORE) {
163
+ // only do this in testing scenarios (todo: compose this functionality into test agents instead)
164
+ loaderAgent.esmHooks.portClient.sendStatus('rewriting file during ESM load hook', rewriteOptions);
165
+ }
166
+
167
+ if (loaderAgent.config.agent.node.rewrite.cache.enable) {
168
+ await loaderAgent.rewriter.cache.write(filename, rewriteResult);
169
+ }
170
+
171
+ return {
172
+ source: rewriteResult.code,
173
+ format: 'module',
174
+ shortCircuit: true,
175
+ };
176
+ } catch (err) {
177
+ loaderAgent.logger.warn(
178
+ { err },
179
+ 'Failed to rewrite code for %s, continuing with original code.',
180
+ filename,
181
+ );
182
+
183
+ return {
184
+ source,
185
+ format: 'module',
186
+ shortCircuit: true,
187
+ };
188
+ }
174
189
  }
175
190
 
176
191
  /**
package/lib/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2024 Contrast Security, Inc
2
+ * Copyright: 2025 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/esm-hooks",
3
- "version": "2.19.0",
3
+ "version": "2.19.2",
4
4
  "type": "module",
5
5
  "description": "Support for loading and instrumenting ECMAScript modules",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -19,11 +19,11 @@
19
19
  "test": "../scripts/test.sh"
20
20
  },
21
21
  "dependencies": {
22
- "@contrast/common": "1.29.0",
23
- "@contrast/config": "1.40.0",
24
- "@contrast/core": "1.45.0",
22
+ "@contrast/common": "1.29.1",
23
+ "@contrast/config": "1.40.1",
24
+ "@contrast/core": "1.45.1",
25
25
  "@contrast/find-package-json": "^1.1.0",
26
- "@contrast/logger": "1.18.0",
27
- "@contrast/rewriter": "1.21.0"
26
+ "@contrast/logger": "1.18.1",
27
+ "@contrast/rewriter": "1.21.2"
28
28
  }
29
29
  }