newrelic 13.2.0 → 13.2.1

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/NEWS.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### v13.2.1 (2025-08-21)
2
+
3
+ #### Code refactoring
4
+
5
+ * Updated agent to use `@apm-js-collab/tracing-hooks` for the CJS/ESM registration for tracing channel based instrumentation ([#3324](https://github.com/newrelic/node-newrelic/pull/3324)) ([4b2c14f](https://github.com/newrelic/node-newrelic/commit/4b2c14f35d5c658160ad9420ca562f73ae55bbc0))
6
+
7
+ #### Documentation
8
+
9
+ * Updated compatibility report ([#3330](https://github.com/newrelic/node-newrelic/pull/3330)) ([2831a89](https://github.com/newrelic/node-newrelic/commit/2831a895e0278a05bed8e9f81245c7f9ae515eca))
10
+
1
11
  ### v13.2.0 (2025-08-20)
2
12
 
3
13
  #### Features
@@ -14,6 +14,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
14
14
 
15
15
  **[dependencies](#dependencies)**
16
16
 
17
+ * [@apm-js-collab/tracing-hooks](#apm-js-collabtracing-hooks)
17
18
  * [@grpc/grpc-js](#grpcgrpc-js)
18
19
  * [@grpc/proto-loader](#grpcproto-loader)
19
20
  * [@newrelic/security-agent](#newrelicsecurity-agent)
@@ -95,6 +96,216 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
95
96
 
96
97
  ## dependencies
97
98
 
99
+ ### @apm-js-collab/tracing-hooks
100
+
101
+ This product includes source derived from [@apm-js-collab/tracing-hooks](https://github.com/apm-js-collab/tracing-hooks) ([v0.1.1](https://github.com/apm-js-collab/tracing-hooks/tree/v0.1.1)), distributed under the [Apache-2.0 License](https://github.com/apm-js-collab/tracing-hooks/blob/v0.1.1/LICENSE):
102
+
103
+ ```
104
+
105
+ Apache License
106
+ Version 2.0, January 2004
107
+ http://www.apache.org/licenses/
108
+
109
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
110
+
111
+ 1. Definitions.
112
+
113
+ "License" shall mean the terms and conditions for use, reproduction,
114
+ and distribution as defined by Sections 1 through 9 of this document.
115
+
116
+ "Licensor" shall mean the copyright owner or entity authorized by
117
+ the copyright owner that is granting the License.
118
+
119
+ "Legal Entity" shall mean the union of the acting entity and all
120
+ other entities that control, are controlled by, or are under common
121
+ control with that entity. For the purposes of this definition,
122
+ "control" means (i) the power, direct or indirect, to cause the
123
+ direction or management of such entity, whether by contract or
124
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
125
+ outstanding shares, or (iii) beneficial ownership of such entity.
126
+
127
+ "You" (or "Your") shall mean an individual or Legal Entity
128
+ exercising permissions granted by this License.
129
+
130
+ "Source" form shall mean the preferred form for making modifications,
131
+ including but not limited to software source code, documentation
132
+ source, and configuration files.
133
+
134
+ "Object" form shall mean any form resulting from mechanical
135
+ transformation or translation of a Source form, including but
136
+ not limited to compiled object code, generated documentation,
137
+ and conversions to other media types.
138
+
139
+ "Work" shall mean the work of authorship, whether in Source or
140
+ Object form, made available under the License, as indicated by a
141
+ copyright notice that is included in or attached to the work
142
+ (an example is provided in the Appendix below).
143
+
144
+ "Derivative Works" shall mean any work, whether in Source or Object
145
+ form, that is based on (or derived from) the Work and for which the
146
+ editorial revisions, annotations, elaborations, or other modifications
147
+ represent, as a whole, an original work of authorship. For the purposes
148
+ of this License, Derivative Works shall not include works that remain
149
+ separable from, or merely link (or bind by name) to the interfaces of,
150
+ the Work and Derivative Works thereof.
151
+
152
+ "Contribution" shall mean any work of authorship, including
153
+ the original version of the Work and any modifications or additions
154
+ to that Work or Derivative Works thereof, that is intentionally
155
+ submitted to Licensor for inclusion in the Work by the copyright owner
156
+ or by an individual or Legal Entity authorized to submit on behalf of
157
+ the copyright owner. For the purposes of this definition, "submitted"
158
+ means any form of electronic, verbal, or written communication sent
159
+ to the Licensor or its representatives, including but not limited to
160
+ communication on electronic mailing lists, source code control systems,
161
+ and issue tracking systems that are managed by, or on behalf of, the
162
+ Licensor for the purpose of discussing and improving the Work, but
163
+ excluding communication that is conspicuously marked or otherwise
164
+ designated in writing by the copyright owner as "Not a Contribution."
165
+
166
+ "Contributor" shall mean Licensor and any individual or Legal Entity
167
+ on behalf of whom a Contribution has been received by Licensor and
168
+ subsequently incorporated within the Work.
169
+
170
+ 2. Grant of Copyright License. Subject to the terms and conditions of
171
+ this License, each Contributor hereby grants to You a perpetual,
172
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
173
+ copyright license to reproduce, prepare Derivative Works of,
174
+ publicly display, publicly perform, sublicense, and distribute the
175
+ Work and such Derivative Works in Source or Object form.
176
+
177
+ 3. Grant of Patent License. Subject to the terms and conditions of
178
+ this License, each Contributor hereby grants to You a perpetual,
179
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
180
+ (except as stated in this section) patent license to make, have made,
181
+ use, offer to sell, sell, import, and otherwise transfer the Work,
182
+ where such license applies only to those patent claims licensable
183
+ by such Contributor that are necessarily infringed by their
184
+ Contribution(s) alone or by combination of their Contribution(s)
185
+ with the Work to which such Contribution(s) was submitted. If You
186
+ institute patent litigation against any entity (including a
187
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
188
+ or a Contribution incorporated within the Work constitutes direct
189
+ or contributory patent infringement, then any patent licenses
190
+ granted to You under this License for that Work shall terminate
191
+ as of the date such litigation is filed.
192
+
193
+ 4. Redistribution. You may reproduce and distribute copies of the
194
+ Work or Derivative Works thereof in any medium, with or without
195
+ modifications, and in Source or Object form, provided that You
196
+ meet the following conditions:
197
+
198
+ (a) You must give any other recipients of the Work or
199
+ Derivative Works a copy of this License; and
200
+
201
+ (b) You must cause any modified files to carry prominent notices
202
+ stating that You changed the files; and
203
+
204
+ (c) You must retain, in the Source form of any Derivative Works
205
+ that You distribute, all copyright, patent, trademark, and
206
+ attribution notices from the Source form of the Work,
207
+ excluding those notices that do not pertain to any part of
208
+ the Derivative Works; and
209
+
210
+ (d) If the Work includes a "NOTICE" text file as part of its
211
+ distribution, then any Derivative Works that You distribute must
212
+ include a readable copy of the attribution notices contained
213
+ within such NOTICE file, excluding those notices that do not
214
+ pertain to any part of the Derivative Works, in at least one
215
+ of the following places: within a NOTICE text file distributed
216
+ as part of the Derivative Works; within the Source form or
217
+ documentation, if provided along with the Derivative Works; or,
218
+ within a display generated by the Derivative Works, if and
219
+ wherever such third-party notices normally appear. The contents
220
+ of the NOTICE file are for informational purposes only and
221
+ do not modify the License. You may add Your own attribution
222
+ notices within Derivative Works that You distribute, alongside
223
+ or as an addendum to the NOTICE text from the Work, provided
224
+ that such additional attribution notices cannot be construed
225
+ as modifying the License.
226
+
227
+ You may add Your own copyright statement to Your modifications and
228
+ may provide additional or different license terms and conditions
229
+ for use, reproduction, or distribution of Your modifications, or
230
+ for any such Derivative Works as a whole, provided Your use,
231
+ reproduction, and distribution of the Work otherwise complies with
232
+ the conditions stated in this License.
233
+
234
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
235
+ any Contribution intentionally submitted for inclusion in the Work
236
+ by You to the Licensor shall be under the terms and conditions of
237
+ this License, without any additional terms or conditions.
238
+ Notwithstanding the above, nothing herein shall supersede or modify
239
+ the terms of any separate license agreement you may have executed
240
+ with Licensor regarding such Contributions.
241
+
242
+ 6. Trademarks. This License does not grant permission to use the trade
243
+ names, trademarks, service marks, or product names of the Licensor,
244
+ except as required for reasonable and customary use in describing the
245
+ origin of the Work and reproducing the content of the NOTICE file.
246
+
247
+ 7. Disclaimer of Warranty. Unless required by applicable law or
248
+ agreed to in writing, Licensor provides the Work (and each
249
+ Contributor provides its Contributions) on an "AS IS" BASIS,
250
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
251
+ implied, including, without limitation, any warranties or conditions
252
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
253
+ PARTICULAR PURPOSE. You are solely responsible for determining the
254
+ appropriateness of using or redistributing the Work and assume any
255
+ risks associated with Your exercise of permissions under this License.
256
+
257
+ 8. Limitation of Liability. In no event and under no legal theory,
258
+ whether in tort (including negligence), contract, or otherwise,
259
+ unless required by applicable law (such as deliberate and grossly
260
+ negligent acts) or agreed to in writing, shall any Contributor be
261
+ liable to You for damages, including any direct, indirect, special,
262
+ incidental, or consequential damages of any character arising as a
263
+ result of this License or out of the use or inability to use the
264
+ Work (including but not limited to damages for loss of goodwill,
265
+ work stoppage, computer failure or malfunction, or any and all
266
+ other commercial damages or losses), even if such Contributor
267
+ has been advised of the possibility of such damages.
268
+
269
+ 9. Accepting Warranty or Additional Liability. While redistributing
270
+ the Work or Derivative Works thereof, You may choose to offer,
271
+ and charge a fee for, acceptance of support, warranty, indemnity,
272
+ or other liability obligations and/or rights consistent with this
273
+ License. However, in accepting such obligations, You may act only
274
+ on Your own behalf and on Your sole responsibility, not on behalf
275
+ of any other Contributor, and only if You agree to indemnify,
276
+ defend, and hold each Contributor harmless for any liability
277
+ incurred by, or claims asserted against, such Contributor by reason
278
+ of your accepting any such warranty or additional liability.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ APPENDIX: How to apply the Apache License to your work.
283
+
284
+ To apply the Apache License to your work, attach the following
285
+ boilerplate notice, with the fields enclosed by brackets "[]"
286
+ replaced with your own identifying information. (Don't include
287
+ the brackets!) The text should be enclosed in the appropriate
288
+ comment syntax for the file format. We also recommend that a
289
+ file or class name and description of purpose be included on the
290
+ same "printed page" as the copyright notice for easier
291
+ identification within third-party archives.
292
+
293
+ Copyright 2025-present Datadog, Inc.
294
+
295
+ Licensed under the Apache License, Version 2.0 (the "License");
296
+ you may not use this file except in compliance with the License.
297
+ You may obtain a copy of the License at
298
+
299
+ http://www.apache.org/licenses/LICENSE-2.0
300
+
301
+ Unless required by applicable law or agreed to in writing, software
302
+ distributed under the License is distributed on an "AS IS" BASIS,
303
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304
+ See the License for the specific language governing permissions and
305
+ limitations under the License.
306
+
307
+ ```
308
+
98
309
  ### @grpc/grpc-js
99
310
 
100
311
  This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.4](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.4/LICENSE):
@@ -515,7 +726,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
515
726
 
516
727
  ### @newrelic/security-agent
517
728
 
518
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.2](https://github.com/newrelic/csec-node-agent/tree/v2.4.2)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.2/LICENSE):
729
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.3](https://github.com/newrelic/csec-node-agent/tree/v2.4.3)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.3/LICENSE):
519
730
 
520
731
  ```
521
732
  ## New Relic Software License v1.0
@@ -2322,7 +2533,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2322
2533
 
2323
2534
  ### import-in-the-middle
2324
2535
 
2325
- This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.0](https://github.com/nodejs/import-in-the-middle/tree/v1.14.0)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.0/LICENSE):
2536
+ This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.2](https://github.com/nodejs/import-in-the-middle/tree/v1.14.2)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.2/LICENSE):
2326
2537
 
2327
2538
  ```
2328
2539
  Apache License
@@ -2753,7 +2964,7 @@ SOFTWARE.
2753
2964
 
2754
2965
  ### @aws-sdk/client-s3
2755
2966
 
2756
- This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
2967
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.872.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.872.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.872.0/LICENSE):
2757
2968
 
2758
2969
  ```
2759
2970
  Apache License
@@ -2962,7 +3173,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
2962
3173
 
2963
3174
  ### @aws-sdk/s3-request-presigner
2964
3175
 
2965
- This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
3176
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.872.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.872.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.872.0/LICENSE):
2966
3177
 
2967
3178
  ```
2968
3179
  Apache License
@@ -4790,7 +5001,7 @@ SOFTWARE.
4790
5001
 
4791
5002
  ### eslint-plugin-jsdoc
4792
5003
 
4793
- This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.7.1](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.7.1)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.7.1/LICENSE):
5004
+ This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.8.0](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.8.0)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.8.0/LICENSE):
4794
5005
 
4795
5006
  ```
4796
5007
  Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
@@ -4822,7 +5033,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4822
5033
 
4823
5034
  ### eslint
4824
5035
 
4825
- This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.28.0](https://github.com/eslint/eslint/tree/v9.28.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.28.0/LICENSE):
5036
+ This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.33.0](https://github.com/eslint/eslint/tree/v9.33.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.33.0/LICENSE):
4826
5037
 
4827
5038
  ```
4828
5039
  Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
@@ -5149,7 +5360,7 @@ THE SOFTWARE.
5149
5360
 
5150
5361
  ### koa
5151
5362
 
5152
- This product includes source derived from [koa](https://github.com/koajs/koa) ([v2.16.1](https://github.com/koajs/koa/tree/v2.16.1)), distributed under the [MIT License](https://github.com/koajs/koa/blob/v2.16.1/LICENSE):
5363
+ This product includes source derived from [koa](https://github.com/koajs/koa) ([v2.16.2](https://github.com/koajs/koa/tree/v2.16.2)), distributed under the [MIT License](https://github.com/koajs/koa/blob/v2.16.2/LICENSE):
5153
5364
 
5154
5365
  ```
5155
5366
  (The MIT License)
@@ -5435,7 +5646,7 @@ SOFTWARE.
5435
5646
 
5436
5647
  ### protobufjs
5437
5648
 
5438
- This product includes source derived from [protobufjs](https://github.com/protobufjs/protobuf.js) ([v7.5.3](https://github.com/protobufjs/protobuf.js/tree/v7.5.3)), distributed under the [BSD-3-Clause License](https://github.com/protobufjs/protobuf.js/blob/v7.5.3/LICENSE):
5649
+ This product includes source derived from [protobufjs](https://github.com/protobufjs/protobuf.js) ([v7.5.4](https://github.com/protobufjs/protobuf.js/tree/v7.5.4)), distributed under the [BSD-3-Clause License](https://github.com/protobufjs/protobuf.js/blob/v7.5.4/LICENSE):
5439
5650
 
5440
5651
  ```
5441
5652
  This license applies to all parts of protobuf.js except those files
package/esm-loader.mjs CHANGED
@@ -5,10 +5,15 @@
5
5
 
6
6
  // eslint-disable-next-line n/no-unsupported-features/node-builtins
7
7
  import { register } from 'node:module'
8
+ import subscriptions from './lib/subscriber-configs.js'
9
+ import createSubscriberConfigs from './lib/subscribers/create-config.js'
8
10
  // Exclusions must be regexes
9
11
  const exclusions = [/@openai\/agents.*/]
12
+ const { packages, instrumentations } = createSubscriberConfigs(subscriptions)
10
13
 
11
- register('./esm-rewriter.mjs', import.meta.url)
14
+ register('@apm-js-collab/tracing-hooks/hook.mjs', import.meta.url, {
15
+ data: { instrumentations, packages }
16
+ })
12
17
  register('import-in-the-middle/hook.mjs', import.meta.url, {
13
18
  data: { exclude: exclusions }
14
19
  })
package/lib/shimmer.js CHANGED
@@ -25,7 +25,7 @@ const symbols = require('./symbols')
25
25
  const { unsubscribe } = require('./instrumentation/undici')
26
26
  const subscriptions = require('./subscriber-configs')
27
27
  const createSubscriberConfigs = require('./subscribers/create-config')
28
- const ModulePatch = require('./patch-module')
28
+ const ModulePatch = require('@apm-js-collab/tracing-hooks')
29
29
 
30
30
  /**
31
31
  * Unwrapping is only likely to be used by test code, and is a fairly drastic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "13.2.0",
3
+ "version": "13.2.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -201,7 +201,7 @@
201
201
  "#test/assert": "./test/lib/custom-assertions/index.js"
202
202
  },
203
203
  "dependencies": {
204
- "@apm-js-collab/code-transformer": "^0.6.0",
204
+ "@apm-js-collab/tracing-hooks": "^0.1.0",
205
205
  "@grpc/grpc-js": "^1.13.2",
206
206
  "@grpc/proto-loader": "^0.7.5",
207
207
  "@newrelic/security-agent": "^2.4.2",
@@ -272,8 +272,7 @@
272
272
  "self-cert": "^2.0.0",
273
273
  "should": "*",
274
274
  "sinon": "^5.1.1",
275
- "superagent": "^9.0.1",
276
- "testdouble": "^3.20.2"
275
+ "superagent": "^9.0.1"
277
276
  },
278
277
  "repository": {
279
278
  "type": "git",
@@ -1,70 +0,0 @@
1
- /*
2
- * Copyright 2025 New Relic Corporation. All rights reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- const { create } = require('@apm-js-collab/code-transformer')
7
- const Module = require('node:module')
8
- const parse = require('module-details-from-path')
9
- const getPackageVersion = require('./util/get-package-version')
10
- const logger = require('./logger').child({ component: 'ModulePatch' })
11
-
12
- class ModulePatch {
13
- constructor({ packages = new Set(), instrumentations = [] } = {}) {
14
- this.packages = packages
15
- this.instrumentator = create(instrumentations)
16
- this.transformers = new Map()
17
- this.resolve = Module._resolveFilename
18
- this.compile = Module.prototype._compile
19
- }
20
-
21
- /**
22
- * Patches the Node.js module class methods that are responsible for resolving filePaths and compiling code.
23
- * If a module is found that has an instrumentator, it will transform the code before compiling it
24
- * with tracing channel methods.
25
- */
26
- patch() {
27
- const self = this
28
- Module._resolveFilename = function wrappedResolveFileName() {
29
- const resolvedName = self.resolve.apply(this, arguments)
30
- const resolvedModule = parse(resolvedName)
31
- if (resolvedModule && self.packages.has(resolvedModule.name)) {
32
- const version = getPackageVersion(resolvedModule.basedir, resolvedModule.name)
33
- const transformer = self.instrumentator.getTransformer(resolvedModule.name, version, resolvedModule.path)
34
- if (transformer) {
35
- self.transformers.set(resolvedName, transformer)
36
- }
37
- }
38
- return resolvedName
39
- }
40
-
41
- Module.prototype._compile = function wrappedCompile(...args) {
42
- const [content, filename] = args
43
- if (self.transformers.has(filename)) {
44
- const transformer = self.transformers.get(filename)
45
- try {
46
- const transformedCode = transformer.transform(content, 'unknown')
47
- args[0] = transformedCode
48
- } catch (error) {
49
- logger.error({ error }, `Error transforming module ${filename}`)
50
- } finally {
51
- transformer.free()
52
- }
53
- }
54
-
55
- return self.compile.apply(this, args)
56
- }
57
- }
58
-
59
- /**
60
- * Clears all the transformers and restores the original Module methods that were wrapped.
61
- * **Note**: This is intended to be used in testing only.
62
- */
63
- unpatch() {
64
- this.transformers.clear()
65
- Module._resolveFilename = this.resolve
66
- Module.prototype._compile = this.compile
67
- }
68
- }
69
-
70
- module.exports = ModulePatch