@adonisjs/events 10.1.0-next.0 → 10.1.0-next.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/README.md CHANGED
@@ -21,8 +21,8 @@ In order to ensure that the AdonisJS community is welcoming to all, please revie
21
21
  ## License
22
22
  AdonisJS events is open-sourced software licensed under the [MIT license](LICENSE.md).
23
23
 
24
- [gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/events/test.yml?style=for-the-badge
25
- [gh-workflow-url]: https://github.com/adonisjs/events/actions/workflows/test.yml "Github action"
24
+ [gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/events/checks.yml?style=for-the-badge
25
+ [gh-workflow-url]: https://github.com/adonisjs/events/actions/workflows/checks.yml "Github action"
26
26
 
27
27
  [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
28
28
  [typescript-url]: "typescript"
@@ -1,3 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/tracing_channels.ts
8
+ var tracing_channels_exports = {};
9
+ __export(tracing_channels_exports, {
10
+ eventDispatch: () => eventDispatch
11
+ });
12
+ import diagnostics_channel from "diagnostics_channel";
13
+ var eventDispatch = diagnostics_channel.tracingChannel("adonisjs:event.dispatch");
14
+
1
15
  // src/emitter.ts
2
16
  import is2 from "@sindresorhus/is";
3
17
  import Emittery from "emittery";
@@ -308,7 +322,16 @@ var Emitter = class {
308
322
  }
309
323
  try {
310
324
  const normalizedEvent = this.#resolveEvent(event);
311
- await this.#transport.emit(normalizedEvent, data);
325
+ await eventDispatch.tracePromise(
326
+ this.#transport.emit,
327
+ {
328
+ event,
329
+ data
330
+ },
331
+ this.#transport,
332
+ normalizedEvent,
333
+ data
334
+ );
312
335
  } catch (error) {
313
336
  if (this.#errorHandler) {
314
337
  this.#errorHandler(event, error, data);
@@ -325,7 +348,16 @@ var Emitter = class {
325
348
  }
326
349
  try {
327
350
  const normalizedEvent = this.#resolveEvent(event);
328
- await this.#transport.emitSerial(normalizedEvent, data);
351
+ await eventDispatch.tracePromise(
352
+ this.#transport.emitSerial,
353
+ {
354
+ event,
355
+ data
356
+ },
357
+ this.#transport,
358
+ normalizedEvent,
359
+ data
360
+ );
329
361
  } catch (error) {
330
362
  if (this.#errorHandler) {
331
363
  this.#errorHandler(event, error, data);
@@ -427,5 +459,6 @@ var Emitter = class {
427
459
  };
428
460
 
429
461
  export {
462
+ tracing_channels_exports,
430
463
  Emitter
431
464
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Emitter
3
- } from "../chunk-26H7HMEN.js";
3
+ } from "../chunk-X4QBBFBR.js";
4
4
 
5
5
  // factories/emitter.ts
6
6
  var EmitterFactory = class {
package/build/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { Emitter } from './src/emitter.js';
2
2
  export { BaseEvent } from './src/base_event.js';
3
+ export * as tracingChannels from './src/tracing_channels.ts';
package/build/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- Emitter
3
- } from "./chunk-26H7HMEN.js";
2
+ Emitter,
3
+ tracing_channels_exports
4
+ } from "./chunk-X4QBBFBR.js";
4
5
 
5
6
  // src/base_event.ts
6
7
  import { RuntimeException } from "@poppinss/utils/exception";
@@ -32,5 +33,6 @@ var BaseEvent = class {
32
33
  };
33
34
  export {
34
35
  BaseEvent,
35
- Emitter
36
+ Emitter,
37
+ tracing_channels_exports as tracingChannels
36
38
  };
@@ -0,0 +1,6 @@
1
+ import diagnostics_channel from 'node:diagnostics_channel';
2
+ import { type EventDispatchData } from './types.ts';
3
+ /**
4
+ * Traces event.emit method calls
5
+ */
6
+ export declare const eventDispatch: diagnostics_channel.TracingChannel<"adonisjs:event.dispatch", EventDispatchData>;
@@ -74,3 +74,10 @@ export interface EmitterLike<EventsList extends Record<string | symbol | number,
74
74
  */
75
75
  hasListeners(event?: keyof EventsList | Constructor<any>): boolean;
76
76
  }
77
+ /**
78
+ * Data shared via the event.dispatch tracing channel
79
+ */
80
+ export type EventDispatchData = {
81
+ event: AllowedEventTypes;
82
+ data: unknown;
83
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/events",
3
3
  "description": "An implementation of the event emitter built on top of emittery",
4
- "version": "10.1.0-next.0",
4
+ "version": "10.1.0-next.1",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -36,10 +36,10 @@
36
36
  "quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts"
37
37
  },
38
38
  "devDependencies": {
39
- "@adonisjs/application": "^9.0.0-next.1",
39
+ "@adonisjs/application": "^9.0.0-next.2",
40
40
  "@adonisjs/config": "^5.0.3",
41
41
  "@adonisjs/eslint-config": "^3.0.0-next.0",
42
- "@adonisjs/fold": "^10.2.0",
42
+ "@adonisjs/fold": "^11.0.0-next.0",
43
43
  "@adonisjs/prettier-config": "^1.4.5",
44
44
  "@adonisjs/tsconfig": "^2.0.0-next.0",
45
45
  "@japa/assert": "^4.1.1",
@@ -64,8 +64,8 @@
64
64
  "emittery": "^1.2.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@adonisjs/application": "^9.0.0-next.1",
68
- "@adonisjs/fold": "^10.0.1"
67
+ "@adonisjs/application": "^9.0.0-next.2",
68
+ "@adonisjs/fold": "^11.0.0-next.0"
69
69
  },
70
70
  "homepage": "https://github.com/adonisjs/events#readme",
71
71
  "repository": {