@monocle.sh/adonisjs-agent 1.0.0-beta.10 → 1.0.0-beta.11

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.
@@ -1,6 +1,7 @@
1
1
  import { ExceptionReporter } from "./exception_reporter.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { SpanKind, context, trace } from "@opentelemetry/api";
4
+ import { pathToFileURL } from "node:url";
4
5
 
5
6
  //#region src/cli_instrumentation.ts
6
7
  /**
@@ -69,7 +70,7 @@ function shouldTraceCommand(commandName, config) {
69
70
  */
70
71
  async function instrumentCliCommands(config, appRoot) {
71
72
  const tracer = trace.getTracer("@monocle.sh/adonisjs-agent", "1.0.0");
72
- const BaseCommand = (await import(createRequire(appRoot ? `file://${appRoot}/package.json` : import.meta.url).resolve("@adonisjs/core/ace"))).BaseCommand;
73
+ const BaseCommand = (await import(pathToFileURL(createRequire(appRoot ? pathToFileURL(`${appRoot}/package.json`).href : import.meta.url).resolve("@adonisjs/core/ace")).href)).BaseCommand;
73
74
  const originalExec = BaseCommand.prototype.exec;
74
75
  BaseCommand.prototype.exec = async function() {
75
76
  const commandName = this.constructor.commandName;
@@ -2,6 +2,7 @@ import { ExceptionReporter } from "../../exception_reporter.mjs";
2
2
  import { EmailAttributes } from "./types.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { SpanKind, SpanStatusCode, context, trace } from "@opentelemetry/api";
5
+ import { pathToFileURL } from "node:url";
5
6
  import { InstrumentationBase } from "@opentelemetry/instrumentation";
6
7
 
7
8
  //#region src/instrumentations/mail/instrumentation.ts
@@ -116,14 +117,14 @@ var MailInstrumentation = class extends InstrumentationBase {
116
117
  async enable() {
117
118
  if (this.patched) return;
118
119
  const appRoot = this.getConfig().appRoot;
119
- const require = createRequire(appRoot ? `file://${appRoot}/package.json` : import.meta.url);
120
+ const require = createRequire(appRoot ? pathToFileURL(`${appRoot}/package.json`).href : import.meta.url);
120
121
  let mailerPath;
121
122
  try {
122
123
  mailerPath = require.resolve("@adonisjs/mail");
123
124
  } catch {
124
125
  return;
125
126
  }
126
- this.mailerClass = (await import(mailerPath)).Mailer;
127
+ this.mailerClass = (await import(pathToFileURL(mailerPath).href)).Mailer;
127
128
  this.originalSendCompiled = this.mailerClass.prototype.sendCompiled;
128
129
  this.originalSendLaterCompiled = this.mailerClass.prototype.sendLaterCompiled;
129
130
  this.mailerClass.prototype.sendCompiled = this.#createSendCompiledWrapper(this.originalSendCompiled);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monocle.sh/adonisjs-agent",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "Monocle agent for AdonisJS - sends telemetry to Monocle cloud",
5
5
  "keywords": [
6
6
  "adonisjs",