assemblerjs 1.1.25 → 1.1.26

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.
Files changed (71) hide show
  1. package/README.md +1 -0
  2. package/dist/index.d.ts +24 -0
  3. package/dist/index11.js +2 -2
  4. package/dist/index11.mjs +2 -2
  5. package/dist/index13.js +1 -1
  6. package/dist/index13.mjs +1 -1
  7. package/dist/index14.js +85 -61
  8. package/dist/index14.mjs +85 -61
  9. package/dist/index17.js +1 -1
  10. package/dist/index17.mjs +1 -1
  11. package/dist/index18.js +1 -1
  12. package/dist/index18.mjs +1 -1
  13. package/dist/index19.js +1 -1
  14. package/dist/index19.mjs +1 -1
  15. package/dist/index2.js +2 -2
  16. package/dist/index2.mjs +2 -2
  17. package/dist/index20.js +1 -1
  18. package/dist/index20.mjs +1 -1
  19. package/dist/index21.js +1 -1
  20. package/dist/index21.mjs +1 -1
  21. package/dist/index22.js +1 -1
  22. package/dist/index22.mjs +1 -1
  23. package/dist/index23.js +3 -3
  24. package/dist/index23.mjs +3 -3
  25. package/dist/index24.js +3 -3
  26. package/dist/index24.mjs +3 -3
  27. package/dist/index25.js +2 -2
  28. package/dist/index25.mjs +2 -2
  29. package/dist/index26.js +1 -1
  30. package/dist/index26.mjs +1 -1
  31. package/dist/index27.js +1 -1
  32. package/dist/index27.mjs +1 -1
  33. package/dist/index3.js +1 -1
  34. package/dist/index3.mjs +1 -1
  35. package/dist/index30.js +15 -38
  36. package/dist/index30.mjs +12 -37
  37. package/dist/index31.js +100 -151
  38. package/dist/index31.mjs +98 -150
  39. package/dist/index32.js +143 -35
  40. package/dist/index32.mjs +142 -35
  41. package/dist/index33.js +41 -70
  42. package/dist/index33.mjs +41 -70
  43. package/dist/index34.js +73 -49
  44. package/dist/index34.mjs +73 -49
  45. package/dist/index35.js +53 -29
  46. package/dist/index35.mjs +53 -29
  47. package/dist/index36.js +26 -170
  48. package/dist/index36.mjs +26 -170
  49. package/dist/index37.js +160 -48
  50. package/dist/index37.mjs +160 -48
  51. package/dist/index38.js +61 -15
  52. package/dist/index38.mjs +61 -12
  53. package/dist/index39.js +38 -20
  54. package/dist/index39.mjs +37 -20
  55. package/dist/index4.js +7 -7
  56. package/dist/index4.mjs +7 -7
  57. package/dist/index40.js +18 -103
  58. package/dist/index40.mjs +18 -101
  59. package/dist/index42.js +49 -29
  60. package/dist/index42.mjs +49 -28
  61. package/dist/index44.js +29 -49
  62. package/dist/index44.mjs +28 -49
  63. package/dist/index45.js +5 -5
  64. package/dist/index45.mjs +5 -5
  65. package/dist/index49.js +1 -1
  66. package/dist/index49.mjs +1 -1
  67. package/dist/index50.js +1 -1
  68. package/dist/index50.mjs +1 -1
  69. package/dist/index51.js +1 -1
  70. package/dist/index51.mjs +1 -1
  71. package/package.json +1 -1
package/dist/index37.js CHANGED
@@ -2,68 +2,180 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- let AbstractCycleDetector = class AbstractCycleDetector {
6
- };
7
- let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
8
- detect() {
9
- return [];
5
+ function e(e) {
6
+ if (e === undefined) return 'undefined';
7
+ if (e === null) return 'null';
8
+ if (typeof e === 'function') {
9
+ if (e.name) return e.name;
10
+ if (e.constructor?.name && e.constructor.name !== 'Function') {
11
+ return e.constructor.name;
12
+ }
13
+ return 'AnonymousFunction';
14
+ }
15
+ if (typeof e === 'object') {
16
+ const o = e.constructor?.name;
17
+ if (o && o !== 'Object') {
18
+ return o;
19
+ }
20
+ if (e.name && typeof e.name === 'string') {
21
+ return e.name;
22
+ }
23
+ return '[Object]';
10
24
  }
25
+ return String(e);
26
+ }
27
+ let NoOpDebugLogger = class NoOpDebugLogger {
28
+ configure(e) {}
29
+ log(e, o, t) {}
30
+ logBuildStart(e) {}
31
+ logBuildEnd(e, o) {}
32
+ logRegistration(e) {}
33
+ logHook(e, o, t) {}
34
+ logPhaseStart(e, o) {}
35
+ logPhaseEnd(e, o, t) {}
36
+ logResolution(e, o, t) {}
37
+ logConstruction(e) {}
38
+ logInjection(e, o) {}
11
39
  };
12
- let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
13
- detect(e, t) {
14
- const c = [];
15
- const s = new Set();
16
- for (const [n] of e){
17
- if (s.has(n)) continue;
18
- const r = [];
19
- const o = new Set();
20
- if (this.hasCycleDFS(n, r, o, s, e)) {
21
- const e = r.findIndex((e)=>e === n);
22
- if (e >= 0) {
23
- const s = r.slice(e).map((e)=>t(e));
24
- c.push({
25
- cycle: s,
26
- path: s.join(' → ')
27
- });
28
- }
40
+ let ActiveDebugLogger = class ActiveDebugLogger {
41
+ configure(e) {
42
+ this.options = {
43
+ ...this.options,
44
+ ...e,
45
+ logPhases: {
46
+ ...this.options.logPhases,
47
+ ...e.logPhases || {}
29
48
  }
30
- }
31
- return c;
49
+ };
50
+ }
51
+ logBuildStart(e) {
52
+ this.log('info', 'Build started', {
53
+ entry: e.name
54
+ });
55
+ }
56
+ logBuildEnd(e, o) {
57
+ const t = {
58
+ entry: e.name
59
+ };
60
+ if (o !== undefined) t.duration = `${o.toFixed(2)}ms`;
61
+ this.log('info', 'Build completed', t);
32
62
  }
33
- hasCycleDFS(e, t, c, s, n) {
34
- if (c.has(e)) {
35
- t.push(e);
36
- return true;
63
+ logRegistration(o) {
64
+ if (!this.shouldLog('registration')) return;
65
+ this.log('info', 'Registration', {
66
+ identifier: e(o.identifier),
67
+ isSingleton: o.isSingleton,
68
+ dependencies: o.dependencies.map((o)=>e(o)),
69
+ tags: o.tags
70
+ });
71
+ }
72
+ logHook(o, t, n) {
73
+ if (!this.shouldLog('hooks')) return;
74
+ const i = this.options.logTimings ? performance.now() : 0;
75
+ this.log('info', `Hook: ${o}`, {
76
+ target: e(t),
77
+ config: n
78
+ });
79
+ if (this.options.logTimings) {
80
+ return ()=>{
81
+ const e = performance.now() - i;
82
+ this.log('info', `Hook: ${o} completed`, {
83
+ duration: `${e.toFixed(2)}ms`
84
+ });
85
+ };
37
86
  }
38
- if (s.has(e)) {
39
- return false;
87
+ }
88
+ logPhaseStart(e, o) {
89
+ this.log('info', `Phase: ${e} started`, o);
90
+ }
91
+ logPhaseEnd(e, o, t) {
92
+ const n = o !== undefined ? {
93
+ duration: `${o.toFixed(2)}ms`
94
+ } : {};
95
+ if (t) {
96
+ Object.assign(n, t);
40
97
  }
41
- t.push(e);
42
- c.add(e);
43
- const r = n.get(e);
44
- if (r?.dependencies && r.dependencies.length > 0) {
45
- for (const e of r.dependencies){
46
- if (this.hasCycleDFS(e, t, c, s, n)) {
47
- return true;
48
- }
98
+ this.log('info', `Phase: ${e} ended`, Object.keys(n).length > 0 ? n : undefined);
99
+ }
100
+ logResolution(e, o, t) {
101
+ if (!this.shouldLog('resolution')) return;
102
+ this.log('info', `Resolving: ${e}`, {
103
+ strategy: `${o} strategy`,
104
+ cache: t ? 'hit' : 'miss'
105
+ });
106
+ }
107
+ logConstruction(e) {
108
+ if (!this.shouldLog('construction')) return;
109
+ this.log('info', `Constructing: ${e}`);
110
+ }
111
+ logInjection(e, o) {
112
+ if (!this.shouldLog(e === 'use' ? 'injectionUse' : 'injectionGlobal')) return;
113
+ this.log('info', `Injecting: @${e === 'use' ? 'Use' : 'Global'}`, o);
114
+ }
115
+ shouldLog(e) {
116
+ return !this.options.logPhases || this.options.logPhases[e] !== false;
117
+ }
118
+ log(e, o, t) {
119
+ if (this.options.logger) {
120
+ this.options.logger(e, o, t);
121
+ } else {
122
+ const n = `[Assembler:${e}]`;
123
+ const i = this.options.useColors !== false ? this.colorize(e, n) : n;
124
+ if (t) {
125
+ console.log(`${i} ${o}`, t);
126
+ } else {
127
+ console.log(`${i} ${o}`);
49
128
  }
50
129
  }
51
- c.delete(e);
52
- s.add(e);
53
- return false;
130
+ }
131
+ colorize(e, o) {
132
+ const t = {
133
+ info: '\x1b[36m',
134
+ warn: '\x1b[33m',
135
+ error: '\x1b[31m',
136
+ reset: '\x1b[0m'
137
+ };
138
+ const n = t[e] || t.info;
139
+ return `${n}${o}${t.reset}`;
140
+ }
141
+ constructor(){
142
+ this.options = {
143
+ enabled: true,
144
+ logPhases: {
145
+ registration: true,
146
+ registrationUse: true,
147
+ registrationGlobals: true,
148
+ resolution: true,
149
+ construction: true,
150
+ hooks: true,
151
+ cache: true,
152
+ injectionUse: true,
153
+ injectionGlobal: true
154
+ },
155
+ logTimings: false,
156
+ logDependencyTree: true,
157
+ useColors: true
158
+ };
54
159
  }
55
160
  };
56
- class CycleDetector {
161
+ class DebugLogger {
57
162
  static getInstance() {
58
- return CycleDetector.instance;
163
+ return DebugLogger.instance;
59
164
  }
60
- static enable() {
61
- CycleDetector.instance = new ActiveCycleDetector();
165
+ static enable(e) {
166
+ if (e?.enabled === false) {
167
+ DebugLogger.instance = new NoOpDebugLogger();
168
+ return;
169
+ }
170
+ DebugLogger.instance = new ActiveDebugLogger();
171
+ if (e) {
172
+ DebugLogger.instance.configure(e);
173
+ }
62
174
  }
63
175
  static disable() {
64
- CycleDetector.instance = new NoOpCycleDetector();
176
+ DebugLogger.instance = new NoOpDebugLogger();
65
177
  }
66
178
  }
67
- CycleDetector.instance = new NoOpCycleDetector();
179
+ DebugLogger.instance = new NoOpDebugLogger();
68
180
 
69
- exports.CycleDetector = CycleDetector;
181
+ exports.DebugLogger = DebugLogger;
package/dist/index37.mjs CHANGED
@@ -1,65 +1,177 @@
1
- let AbstractCycleDetector = class AbstractCycleDetector {
2
- };
3
- let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
4
- detect() {
5
- return [];
1
+ function e(e) {
2
+ if (e === undefined) return 'undefined';
3
+ if (e === null) return 'null';
4
+ if (typeof e === 'function') {
5
+ if (e.name) return e.name;
6
+ if (e.constructor?.name && e.constructor.name !== 'Function') {
7
+ return e.constructor.name;
8
+ }
9
+ return 'AnonymousFunction';
10
+ }
11
+ if (typeof e === 'object') {
12
+ const o = e.constructor?.name;
13
+ if (o && o !== 'Object') {
14
+ return o;
15
+ }
16
+ if (e.name && typeof e.name === 'string') {
17
+ return e.name;
18
+ }
19
+ return '[Object]';
6
20
  }
21
+ return String(e);
22
+ }
23
+ let NoOpDebugLogger = class NoOpDebugLogger {
24
+ configure(e) {}
25
+ log(e, o, t) {}
26
+ logBuildStart(e) {}
27
+ logBuildEnd(e, o) {}
28
+ logRegistration(e) {}
29
+ logHook(e, o, t) {}
30
+ logPhaseStart(e, o) {}
31
+ logPhaseEnd(e, o, t) {}
32
+ logResolution(e, o, t) {}
33
+ logConstruction(e) {}
34
+ logInjection(e, o) {}
7
35
  };
8
- let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
9
- detect(e, t) {
10
- const c = [];
11
- const s = new Set();
12
- for (const [n] of e){
13
- if (s.has(n)) continue;
14
- const r = [];
15
- const o = new Set();
16
- if (this.hasCycleDFS(n, r, o, s, e)) {
17
- const e = r.findIndex((e)=>e === n);
18
- if (e >= 0) {
19
- const s = r.slice(e).map((e)=>t(e));
20
- c.push({
21
- cycle: s,
22
- path: s.join(' → ')
23
- });
24
- }
36
+ let ActiveDebugLogger = class ActiveDebugLogger {
37
+ configure(e) {
38
+ this.options = {
39
+ ...this.options,
40
+ ...e,
41
+ logPhases: {
42
+ ...this.options.logPhases,
43
+ ...e.logPhases || {}
25
44
  }
26
- }
27
- return c;
45
+ };
46
+ }
47
+ logBuildStart(e) {
48
+ this.log('info', 'Build started', {
49
+ entry: e.name
50
+ });
51
+ }
52
+ logBuildEnd(e, o) {
53
+ const t = {
54
+ entry: e.name
55
+ };
56
+ if (o !== undefined) t.duration = `${o.toFixed(2)}ms`;
57
+ this.log('info', 'Build completed', t);
28
58
  }
29
- hasCycleDFS(e, t, c, s, n) {
30
- if (c.has(e)) {
31
- t.push(e);
32
- return true;
59
+ logRegistration(o) {
60
+ if (!this.shouldLog('registration')) return;
61
+ this.log('info', 'Registration', {
62
+ identifier: e(o.identifier),
63
+ isSingleton: o.isSingleton,
64
+ dependencies: o.dependencies.map((o)=>e(o)),
65
+ tags: o.tags
66
+ });
67
+ }
68
+ logHook(o, t, n) {
69
+ if (!this.shouldLog('hooks')) return;
70
+ const i = this.options.logTimings ? performance.now() : 0;
71
+ this.log('info', `Hook: ${o}`, {
72
+ target: e(t),
73
+ config: n
74
+ });
75
+ if (this.options.logTimings) {
76
+ return ()=>{
77
+ const e = performance.now() - i;
78
+ this.log('info', `Hook: ${o} completed`, {
79
+ duration: `${e.toFixed(2)}ms`
80
+ });
81
+ };
33
82
  }
34
- if (s.has(e)) {
35
- return false;
83
+ }
84
+ logPhaseStart(e, o) {
85
+ this.log('info', `Phase: ${e} started`, o);
86
+ }
87
+ logPhaseEnd(e, o, t) {
88
+ const n = o !== undefined ? {
89
+ duration: `${o.toFixed(2)}ms`
90
+ } : {};
91
+ if (t) {
92
+ Object.assign(n, t);
36
93
  }
37
- t.push(e);
38
- c.add(e);
39
- const r = n.get(e);
40
- if (r?.dependencies && r.dependencies.length > 0) {
41
- for (const e of r.dependencies){
42
- if (this.hasCycleDFS(e, t, c, s, n)) {
43
- return true;
44
- }
94
+ this.log('info', `Phase: ${e} ended`, Object.keys(n).length > 0 ? n : undefined);
95
+ }
96
+ logResolution(e, o, t) {
97
+ if (!this.shouldLog('resolution')) return;
98
+ this.log('info', `Resolving: ${e}`, {
99
+ strategy: `${o} strategy`,
100
+ cache: t ? 'hit' : 'miss'
101
+ });
102
+ }
103
+ logConstruction(e) {
104
+ if (!this.shouldLog('construction')) return;
105
+ this.log('info', `Constructing: ${e}`);
106
+ }
107
+ logInjection(e, o) {
108
+ if (!this.shouldLog(e === 'use' ? 'injectionUse' : 'injectionGlobal')) return;
109
+ this.log('info', `Injecting: @${e === 'use' ? 'Use' : 'Global'}`, o);
110
+ }
111
+ shouldLog(e) {
112
+ return !this.options.logPhases || this.options.logPhases[e] !== false;
113
+ }
114
+ log(e, o, t) {
115
+ if (this.options.logger) {
116
+ this.options.logger(e, o, t);
117
+ } else {
118
+ const n = `[Assembler:${e}]`;
119
+ const i = this.options.useColors !== false ? this.colorize(e, n) : n;
120
+ if (t) {
121
+ console.log(`${i} ${o}`, t);
122
+ } else {
123
+ console.log(`${i} ${o}`);
45
124
  }
46
125
  }
47
- c.delete(e);
48
- s.add(e);
49
- return false;
126
+ }
127
+ colorize(e, o) {
128
+ const t = {
129
+ info: '\x1b[36m',
130
+ warn: '\x1b[33m',
131
+ error: '\x1b[31m',
132
+ reset: '\x1b[0m'
133
+ };
134
+ const n = t[e] || t.info;
135
+ return `${n}${o}${t.reset}`;
136
+ }
137
+ constructor(){
138
+ this.options = {
139
+ enabled: true,
140
+ logPhases: {
141
+ registration: true,
142
+ registrationUse: true,
143
+ registrationGlobals: true,
144
+ resolution: true,
145
+ construction: true,
146
+ hooks: true,
147
+ cache: true,
148
+ injectionUse: true,
149
+ injectionGlobal: true
150
+ },
151
+ logTimings: false,
152
+ logDependencyTree: true,
153
+ useColors: true
154
+ };
50
155
  }
51
156
  };
52
- class CycleDetector {
157
+ class DebugLogger {
53
158
  static getInstance() {
54
- return CycleDetector.instance;
159
+ return DebugLogger.instance;
55
160
  }
56
- static enable() {
57
- CycleDetector.instance = new ActiveCycleDetector();
161
+ static enable(e) {
162
+ if (e?.enabled === false) {
163
+ DebugLogger.instance = new NoOpDebugLogger();
164
+ return;
165
+ }
166
+ DebugLogger.instance = new ActiveDebugLogger();
167
+ if (e) {
168
+ DebugLogger.instance.configure(e);
169
+ }
58
170
  }
59
171
  static disable() {
60
- CycleDetector.instance = new NoOpCycleDetector();
172
+ DebugLogger.instance = new NoOpDebugLogger();
61
173
  }
62
174
  }
63
- CycleDetector.instance = new NoOpCycleDetector();
175
+ DebugLogger.instance = new NoOpDebugLogger();
64
176
 
65
- export { CycleDetector };
177
+ export { DebugLogger };
package/dist/index38.js CHANGED
@@ -2,22 +2,68 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const constants = require('./index29.js');
6
-
7
- const defineCustomMetadata = (t, o, n)=>{
8
- Reflect.defineMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o, n);
9
- };
10
- const getCustomMetadata = (t, o)=>{
11
- return Reflect.getMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
5
+ let AbstractCycleDetector = class AbstractCycleDetector {
12
6
  };
13
- const getOwnCustomMetadata = (t, o)=>{
14
- return Reflect.getOwnMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
7
+ let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
8
+ detect() {
9
+ return [];
10
+ }
15
11
  };
16
- const getParamTypes = (e)=>{
17
- return Reflect.getMetadata(constants.ReflectParamTypes, e) || [];
12
+ let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
13
+ detect(e, t) {
14
+ const c = [];
15
+ const s = new Set();
16
+ for (const [n] of e){
17
+ if (s.has(n)) continue;
18
+ const r = [];
19
+ const o = new Set();
20
+ if (this.hasCycleDFS(n, r, o, s, e)) {
21
+ const e = r.findIndex((e)=>e === n);
22
+ if (e >= 0) {
23
+ const s = r.slice(e).map((e)=>t(e));
24
+ c.push({
25
+ cycle: s,
26
+ path: s.join(' → ')
27
+ });
28
+ }
29
+ }
30
+ }
31
+ return c;
32
+ }
33
+ hasCycleDFS(e, t, c, s, n) {
34
+ if (c.has(e)) {
35
+ t.push(e);
36
+ return true;
37
+ }
38
+ if (s.has(e)) {
39
+ return false;
40
+ }
41
+ t.push(e);
42
+ c.add(e);
43
+ const r = n.get(e);
44
+ if (r?.dependencies && r.dependencies.length > 0) {
45
+ for (const e of r.dependencies){
46
+ if (this.hasCycleDFS(e, t, c, s, n)) {
47
+ return true;
48
+ }
49
+ }
50
+ }
51
+ c.delete(e);
52
+ s.add(e);
53
+ return false;
54
+ }
18
55
  };
56
+ class CycleDetector {
57
+ static getInstance() {
58
+ return CycleDetector.instance;
59
+ }
60
+ static enable() {
61
+ CycleDetector.instance = new ActiveCycleDetector();
62
+ }
63
+ static disable() {
64
+ CycleDetector.instance = new NoOpCycleDetector();
65
+ }
66
+ }
67
+ CycleDetector.instance = new NoOpCycleDetector();
19
68
 
20
- exports.defineCustomMetadata = defineCustomMetadata;
21
- exports.getCustomMetadata = getCustomMetadata;
22
- exports.getOwnCustomMetadata = getOwnCustomMetadata;
23
- exports.getParamTypes = getParamTypes;
69
+ exports.CycleDetector = CycleDetector;
package/dist/index38.mjs CHANGED
@@ -1,16 +1,65 @@
1
- import { ReflectPrefix, ReflectSuffix, ReflectParamTypes } from './index29.mjs';
2
-
3
- const defineCustomMetadata = (t, o, n)=>{
4
- Reflect.defineMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o, n);
5
- };
6
- const getCustomMetadata = (t, o)=>{
7
- return Reflect.getMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
1
+ let AbstractCycleDetector = class AbstractCycleDetector {
8
2
  };
9
- const getOwnCustomMetadata = (t, o)=>{
10
- return Reflect.getOwnMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
3
+ let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
4
+ detect() {
5
+ return [];
6
+ }
11
7
  };
12
- const getParamTypes = (e)=>{
13
- return Reflect.getMetadata(ReflectParamTypes, e) || [];
8
+ let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
9
+ detect(e, t) {
10
+ const c = [];
11
+ const s = new Set();
12
+ for (const [n] of e){
13
+ if (s.has(n)) continue;
14
+ const r = [];
15
+ const o = new Set();
16
+ if (this.hasCycleDFS(n, r, o, s, e)) {
17
+ const e = r.findIndex((e)=>e === n);
18
+ if (e >= 0) {
19
+ const s = r.slice(e).map((e)=>t(e));
20
+ c.push({
21
+ cycle: s,
22
+ path: s.join(' → ')
23
+ });
24
+ }
25
+ }
26
+ }
27
+ return c;
28
+ }
29
+ hasCycleDFS(e, t, c, s, n) {
30
+ if (c.has(e)) {
31
+ t.push(e);
32
+ return true;
33
+ }
34
+ if (s.has(e)) {
35
+ return false;
36
+ }
37
+ t.push(e);
38
+ c.add(e);
39
+ const r = n.get(e);
40
+ if (r?.dependencies && r.dependencies.length > 0) {
41
+ for (const e of r.dependencies){
42
+ if (this.hasCycleDFS(e, t, c, s, n)) {
43
+ return true;
44
+ }
45
+ }
46
+ }
47
+ c.delete(e);
48
+ s.add(e);
49
+ return false;
50
+ }
14
51
  };
52
+ class CycleDetector {
53
+ static getInstance() {
54
+ return CycleDetector.instance;
55
+ }
56
+ static enable() {
57
+ CycleDetector.instance = new ActiveCycleDetector();
58
+ }
59
+ static disable() {
60
+ CycleDetector.instance = new NoOpCycleDetector();
61
+ }
62
+ }
63
+ CycleDetector.instance = new NoOpCycleDetector();
15
64
 
16
- export { defineCustomMetadata, getCustomMetadata, getOwnCustomMetadata, getParamTypes };
65
+ export { CycleDetector };
package/dist/index39.js CHANGED
@@ -2,27 +2,45 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- class ResolverStore {
6
- static register(e, r) {
7
- this.resolvers.set(e, r);
8
- }
9
- static getResolver(e) {
10
- const r = this.resolvers.get(e);
11
- if (!r) {
12
- throw new Error(`No resolver found for decorator type: ${e}`);
5
+ const eventManager = require('./index6.js');
6
+
7
+ const registerEvents = (t, n)=>{
8
+ const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
9
+ if (o) {
10
+ const e = n;
11
+ const o = e.channels;
12
+ for (const n of t.events){
13
+ if (!o.has(n)) e.addChannels(n);
14
+ if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
15
+ }
16
+ for (const e of t.events){
17
+ n.on(e, (...n)=>{
18
+ t.privateContext.emit(e, ...n);
19
+ });
20
+ }
21
+ } else {
22
+ for (const e of t.events){
23
+ if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
13
24
  }
14
- return new r();
15
- }
16
- static hasResolver(e) {
17
- return this.resolvers.has(e);
18
- }
19
- static getRegisteredTypes() {
20
- return Array.from(this.resolvers.keys());
21
25
  }
22
- static clear() {
23
- this.resolvers.clear();
26
+ };
27
+ const unregisterEvents = (t, n)=>{
28
+ const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
29
+ if (o) {
30
+ const e = n;
31
+ for (const n of t.events){
32
+ e.off(n);
33
+ }
34
+ e.removeChannels(...t.events);
35
+ t.privateContext.removeChannels(...t.events);
36
+ } else {
37
+ for (const e of t.events){
38
+ if (t.privateContext.events.has(e)) {
39
+ t.privateContext.removeChannels(e);
40
+ }
41
+ }
24
42
  }
25
- }
26
- ResolverStore.resolvers = new Map();
43
+ };
27
44
 
28
- exports.ResolverStore = ResolverStore;
45
+ exports.registerEvents = registerEvents;
46
+ exports.unregisterEvents = unregisterEvents;