From c58d968f9fef959c324900ac1d4a9c26952ee325 Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Thu, 21 Aug 2025 11:05:57 -0400 Subject: [PATCH] chore: Updated `@apm-js-collab/code-transformer` to `v.0.7.0` to get `moduleVersion` emitted over tracing channel events --- .snapshots/7f8b6c257a075df56e54361c8433cb48/0.json | 2 +- .snapshots/814238ad8cda0e2502409f2591339137/0.json | 2 +- .snapshots/e9d3709e54638f0a8fb975da4ec13452/0.json | 2 +- .snapshots/f9e55bce8f9e3f3009403bfd870b4e79/0.json | 2 +- hook.mjs | 2 +- index.js | 2 +- package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.snapshots/7f8b6c257a075df56e54361c8433cb48/0.json b/.snapshots/7f8b6c257a075df56e54361c8433cb48/0.json index 05067bf..1240cbb 100644 --- a/.snapshots/7f8b6c257a075df56e54361c8433cb48/0.json +++ b/.snapshots/7f8b6c257a075df56e54361c8433cb48/0.json @@ -1 +1 @@ -"const { tracingChannel: tr_ch_apm_tracingChannel } = require(\"diagnostics_channel\");\nconst tr_ch_apm$unitTestCjs = tr_ch_apm_tracingChannel(\"orchestrion:pkg-1:unitTestCjs\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestCjs.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestCjs.tracePromise(__apm$traced, {\n arguments,\n self: this\n });\n }\n}\nmodule.exports = Foo;\n" \ No newline at end of file +"const { tracingChannel: tr_ch_apm_tracingChannel } = require(\"diagnostics_channel\");\nconst tr_ch_apm$unitTestCjs = tr_ch_apm_tracingChannel(\"orchestrion:pkg-1:unitTestCjs\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestCjs.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestCjs.tracePromise(__apm$traced, {\n arguments,\n self: this,\n moduleVersion: \"1.0.0\"\n });\n }\n}\nmodule.exports = Foo;\n" \ No newline at end of file diff --git a/.snapshots/814238ad8cda0e2502409f2591339137/0.json b/.snapshots/814238ad8cda0e2502409f2591339137/0.json index 05067bf..1240cbb 100644 --- a/.snapshots/814238ad8cda0e2502409f2591339137/0.json +++ b/.snapshots/814238ad8cda0e2502409f2591339137/0.json @@ -1 +1 @@ -"const { tracingChannel: tr_ch_apm_tracingChannel } = require(\"diagnostics_channel\");\nconst tr_ch_apm$unitTestCjs = tr_ch_apm_tracingChannel(\"orchestrion:pkg-1:unitTestCjs\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestCjs.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestCjs.tracePromise(__apm$traced, {\n arguments,\n self: this\n });\n }\n}\nmodule.exports = Foo;\n" \ No newline at end of file +"const { tracingChannel: tr_ch_apm_tracingChannel } = require(\"diagnostics_channel\");\nconst tr_ch_apm$unitTestCjs = tr_ch_apm_tracingChannel(\"orchestrion:pkg-1:unitTestCjs\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestCjs.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestCjs.tracePromise(__apm$traced, {\n arguments,\n self: this,\n moduleVersion: \"1.0.0\"\n });\n }\n}\nmodule.exports = Foo;\n" \ No newline at end of file diff --git a/.snapshots/e9d3709e54638f0a8fb975da4ec13452/0.json b/.snapshots/e9d3709e54638f0a8fb975da4ec13452/0.json index 6106f16..ba2845e 100644 --- a/.snapshots/e9d3709e54638f0a8fb975da4ec13452/0.json +++ b/.snapshots/e9d3709e54638f0a8fb975da4ec13452/0.json @@ -1 +1 @@ -"import { tracingChannel as tr_ch_apm_tracingChannel } from \"diagnostics_channel\";\nconst tr_ch_apm$unitTestEsm = tr_ch_apm_tracingChannel(\"orchestrion:esm-pkg:unitTestEsm\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestEsm.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestEsm.tracePromise(__apm$traced, {\n arguments,\n self: this\n });\n }\n}\nexport default Foo;\n" \ No newline at end of file +"import { tracingChannel as tr_ch_apm_tracingChannel } from \"diagnostics_channel\";\nconst tr_ch_apm$unitTestEsm = tr_ch_apm_tracingChannel(\"orchestrion:esm-pkg:unitTestEsm\");\nclass Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTestEsm.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTestEsm.tracePromise(__apm$traced, {\n arguments,\n self: this,\n moduleVersion: \"1.0.0\"\n });\n }\n}\nexport default Foo;\n" \ No newline at end of file diff --git a/.snapshots/f9e55bce8f9e3f3009403bfd870b4e79/0.json b/.snapshots/f9e55bce8f9e3f3009403bfd870b4e79/0.json index 91a1b5a..2d653d1 100644 --- a/.snapshots/f9e55bce8f9e3f3009403bfd870b4e79/0.json +++ b/.snapshots/f9e55bce8f9e3f3009403bfd870b4e79/0.json @@ -1 +1 @@ -"class Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTest.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTest.tracePromise(__apm$traced, {\n arguments,\n self: this\n });\n }\n}" \ No newline at end of file +"class Foo {\n constructor(){\n this.name = 'foo';\n }\n doStuff() {\n const __apm$original_args = arguments;\n const __apm$traced = async ()=>{\n const __apm$wrapped = async ()=>{\n return 'doing stuff';\n };\n return __apm$wrapped.apply(null, __apm$original_args);\n };\n if (!tr_ch_apm$unitTest.hasSubscribers) return __apm$traced();\n return tr_ch_apm$unitTest.tracePromise(__apm$traced, {\n arguments,\n self: this,\n moduleVersion: \"1.0.0\"\n });\n }\n}" \ No newline at end of file diff --git a/hook.mjs b/hook.mjs index fa070df..6195207 100644 --- a/hook.mjs +++ b/hook.mjs @@ -47,7 +47,7 @@ export async function load(url, context, nextLoad) { const transformer = transformers.get(url) try { const transformedCode = transformer.transform(code.toString('utf8'), 'unknown') - result.source = transformedCode + result.source = transformedCode?.code result.shortCircuit = true } catch(err) { debug('Error transforming module %s: %o', url, err) diff --git a/index.js b/index.js index 448988d..5c862a7 100644 --- a/index.js +++ b/index.js @@ -40,7 +40,7 @@ class ModulePatch { const transformer = self.transformers.get(filename) try { const transformedCode = transformer.transform(content, 'unknown') - args[0] = transformedCode + args[0] = transformedCode?.code } catch (error) { debug('Error transforming module %s: %o', filename, error) } finally { diff --git a/package.json b/package.json index d952cea..2c8f0a7 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lib" ], "dependencies": { - "@apm-js-collab/code-transformer": "^0.6.0", + "@apm-js-collab/code-transformer": "^0.7.0", "debug": "^4.4.1", "module-details-from-path": "^1.0.4" },