@adonisjs/events 8.0.0-0 → 8.1.1-0
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/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/src/debug.d.ts +3 -0
- package/build/src/debug.js +2 -0
- package/build/src/emitter.d.ts +2 -2
- package/build/src/emitter.js +6 -1
- package/package.json +15 -10
package/build/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Emitter } from './src/emitter.js';
|
|
1
|
+
export { Emitter as default } from './src/emitter.js';
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Emitter } from './src/emitter.js';
|
|
1
|
+
export { Emitter as default } from './src/emitter.js';
|
package/build/src/emitter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventsBuffer } from './events_buffer.js';
|
|
2
|
-
import type { EventsListItem } from './types.js';
|
|
3
1
|
import { type Application } from '@adonisjs/application';
|
|
2
|
+
import type { EventsListItem } from './types.js';
|
|
3
|
+
import { EventsBuffer } from './events_buffer.js';
|
|
4
4
|
export declare class Emitter<EventsList extends Record<string | symbol | number, any>> {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(app: Application);
|
package/build/src/emitter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Emittery from 'emittery';
|
|
2
|
+
import { moduleExpression } from '@adonisjs/fold';
|
|
3
|
+
import debug from './debug.js';
|
|
2
4
|
import { EventsBuffer } from './events_buffer.js';
|
|
3
|
-
import { moduleExpression } from '@adonisjs/application';
|
|
4
5
|
export class Emitter {
|
|
5
6
|
#transport = new Emittery();
|
|
6
7
|
#eventsBuffer;
|
|
@@ -56,6 +57,7 @@ export class Emitter {
|
|
|
56
57
|
}
|
|
57
58
|
async emit(event, data) {
|
|
58
59
|
if (this.#eventsToFake.has(event) || this.#eventsToFake.has('*')) {
|
|
60
|
+
debug('faking emit. event: "%s", data: %O', event, data);
|
|
59
61
|
this.#eventsBuffer.events.push({ name: event, data });
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
@@ -110,14 +112,17 @@ export class Emitter {
|
|
|
110
112
|
this.restore();
|
|
111
113
|
this.#eventsBuffer = new EventsBuffer();
|
|
112
114
|
if (!events) {
|
|
115
|
+
debug('faking all events');
|
|
113
116
|
this.#eventsToFake.add('*');
|
|
114
117
|
}
|
|
115
118
|
else {
|
|
119
|
+
debug('faking events: %O', events);
|
|
116
120
|
events.forEach((event) => this.#eventsToFake.add(event));
|
|
117
121
|
}
|
|
118
122
|
return this.#eventsBuffer;
|
|
119
123
|
}
|
|
120
124
|
restore() {
|
|
125
|
+
debug('restoring existing fakes');
|
|
121
126
|
this.#eventsToFake.clear();
|
|
122
127
|
this.#eventsBuffer?.flush();
|
|
123
128
|
this.#eventsBuffer = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/events",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1-0",
|
|
4
4
|
"description": "An implementation of the event emitter built on top of emittery",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"pretest": "npm run lint",
|
|
21
|
-
"test": "c8 npm run vscode:test",
|
|
21
|
+
"test": "cross-env NODE_DEBUG=adonisjs:events c8 npm run vscode:test",
|
|
22
22
|
"clean": "del-cli build",
|
|
23
23
|
"compile": "npm run lint && npm run clean && tsc",
|
|
24
24
|
"build": "npm run compile",
|
|
@@ -37,29 +37,34 @@
|
|
|
37
37
|
"author": "virk,adonisjs",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@adonisjs/application": "^6.
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
40
|
+
"@adonisjs/application": "^6.1.2-0",
|
|
41
|
+
"@adonisjs/config": "^4.1.1-0",
|
|
42
|
+
"@adonisjs/env": "^4.0.3-0",
|
|
43
|
+
"@adonisjs/fold": "^9.4.1-0",
|
|
44
|
+
"@adonisjs/logger": "^5.0.2-0",
|
|
45
|
+
"@commitlint/cli": "^17.3.0",
|
|
46
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
43
47
|
"@japa/assert": "^1.3.6",
|
|
44
48
|
"@japa/expect-type": "^1.0.2",
|
|
45
49
|
"@japa/run-failed-tests": "^1.1.0",
|
|
46
50
|
"@japa/runner": "^2.2.2",
|
|
47
51
|
"@japa/spec-reporter": "^1.3.2",
|
|
48
52
|
"@poppinss/dev-utils": "^2.0.1",
|
|
49
|
-
"@swc/core": "^1.3.
|
|
53
|
+
"@swc/core": "^1.3.21",
|
|
50
54
|
"@types/fs-extra": "^9.0.13",
|
|
51
|
-
"@types/node": "^18.11.
|
|
55
|
+
"@types/node": "^18.11.10",
|
|
52
56
|
"c8": "^7.12.0",
|
|
57
|
+
"cross-env": "^7.0.3",
|
|
53
58
|
"del-cli": "^5.0.0",
|
|
54
59
|
"eslint": "^8.28.0",
|
|
55
60
|
"eslint-config-prettier": "^8.3.0",
|
|
56
61
|
"eslint-plugin-adonis": "^3.0.3",
|
|
57
62
|
"eslint-plugin-prettier": "^4.2.1",
|
|
58
|
-
"fs-extra": "^
|
|
63
|
+
"fs-extra": "^11.1.0",
|
|
59
64
|
"github-label-sync": "^2.0.1",
|
|
60
65
|
"husky": "^8.0.2",
|
|
61
66
|
"np": "^7.6.2",
|
|
62
|
-
"prettier": "^2.
|
|
67
|
+
"prettier": "^2.8.0",
|
|
63
68
|
"ts-node": "^10.9.1",
|
|
64
69
|
"typescript": "^4.9.3"
|
|
65
70
|
},
|
|
@@ -67,7 +72,7 @@
|
|
|
67
72
|
"emittery": "^1.0.1"
|
|
68
73
|
},
|
|
69
74
|
"peerDependencies": {
|
|
70
|
-
"@adonisjs/
|
|
75
|
+
"@adonisjs/fold": "^9.4.1-0"
|
|
71
76
|
},
|
|
72
77
|
"repository": {
|
|
73
78
|
"type": "git",
|