assemblerjs 1.1.1 → 1.1.3

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 (64) hide show
  1. package/dist/index.d.ts +53 -8
  2. package/dist/index13.js +1 -1
  3. package/dist/index13.mjs +1 -1
  4. package/dist/index18.js +1 -1
  5. package/dist/index18.mjs +1 -1
  6. package/dist/index19.js +1 -1
  7. package/dist/index19.mjs +1 -1
  8. package/dist/index20.js +1 -1
  9. package/dist/index20.mjs +1 -1
  10. package/dist/index21.js +1 -1
  11. package/dist/index21.mjs +1 -1
  12. package/dist/index22.js +1 -1
  13. package/dist/index22.mjs +1 -1
  14. package/dist/index23.js +1 -1
  15. package/dist/index23.mjs +1 -1
  16. package/dist/index24.js +1 -1
  17. package/dist/index24.mjs +1 -1
  18. package/dist/index27.js +1 -1
  19. package/dist/index27.mjs +1 -1
  20. package/dist/index30.js +8 -2
  21. package/dist/index30.mjs +8 -2
  22. package/dist/index31.js +38 -20
  23. package/dist/index31.mjs +37 -20
  24. package/dist/index32.js +17 -58
  25. package/dist/index32.mjs +17 -58
  26. package/dist/index33.js +57 -20
  27. package/dist/index33.mjs +57 -20
  28. package/dist/index34.js +23 -57
  29. package/dist/index34.mjs +23 -57
  30. package/dist/index35.js +75 -27
  31. package/dist/index35.mjs +75 -27
  32. package/dist/index36.js +39 -29
  33. package/dist/index36.mjs +39 -29
  34. package/dist/index37.js +30 -39
  35. package/dist/index37.mjs +30 -38
  36. package/dist/index38.js +125 -97
  37. package/dist/index38.mjs +125 -97
  38. package/dist/index39.js +101 -24
  39. package/dist/index39.mjs +101 -24
  40. package/dist/index4.js +21 -8
  41. package/dist/index4.mjs +21 -8
  42. package/dist/index40.js +28 -48
  43. package/dist/index40.mjs +28 -48
  44. package/dist/index41.js +43 -3
  45. package/dist/index41.mjs +43 -3
  46. package/dist/index42.js +22 -28
  47. package/dist/index42.mjs +21 -27
  48. package/dist/index43.js +26 -169
  49. package/dist/index43.mjs +25 -169
  50. package/dist/index44.js +192 -940
  51. package/dist/index44.mjs +192 -940
  52. package/dist/index45.js +942 -2
  53. package/dist/index45.mjs +942 -2
  54. package/dist/index46.js +2 -2
  55. package/dist/index46.mjs +2 -2
  56. package/dist/index47.js +2 -14
  57. package/dist/index47.mjs +2 -14
  58. package/dist/index48.js +9 -23
  59. package/dist/index48.mjs +9 -23
  60. package/dist/index49.js +32 -55
  61. package/dist/index49.mjs +32 -54
  62. package/dist/index50.js +67 -0
  63. package/dist/index50.mjs +62 -0
  64. package/package.json +1 -1
package/dist/index38.mjs CHANGED
@@ -1,107 +1,135 @@
1
- import { TransversalManager } from './index13.mjs';
2
- import { getAffectedMethods } from './index12.mjs';
3
-
4
- class TransversalWeaver {
5
- static weave(n, r, o) {
6
- const c = TransversalManager.getInstance(o);
7
- const s = c.getAspectsForTarget(r);
8
- const a = Object.getPrototypeOf(n);
9
- const f = Object.getOwnPropertyNames(a).some((t)=>{
10
- if (t === 'constructor') return false;
11
- const n = Object.getOwnPropertyDescriptor(a, t);
12
- if (!n) return false;
13
- const r = n.value && typeof n.value === 'function';
14
- const o = n.get && typeof n.get === 'function';
15
- if (!r && !o) return false;
16
- const c = getAffectedMethods(a, t);
17
- return c.length > 0;
18
- });
19
- if (s.length === 0 && !f) {
20
- return n;
21
- }
22
- return new Proxy(n, {
23
- get (t, e, n) {
24
- const r = Reflect.get(t, e, n);
25
- if (typeof r !== 'function') {
26
- return r;
27
- }
28
- return function(...n) {
29
- const o = String(e);
30
- const a = {
31
- target: t,
32
- methodName: o,
33
- args: n
34
- };
35
- const f = c.getAdvicesForJoinPoint(a, s, t, e);
36
- return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
37
- };
1
+ let NoOpDebugLogger = class NoOpDebugLogger {
2
+ configure(o) {}
3
+ logBuildStart(o) {}
4
+ logBuildEnd(o, e) {}
5
+ logRegistration(o) {}
6
+ logHook(o, e, t) {}
7
+ logPhaseStart(o, e) {}
8
+ logPhaseEnd(o, e) {}
9
+ logResolution(o, e, t) {}
10
+ logConstruction(o) {}
11
+ };
12
+ let ActiveDebugLogger = class ActiveDebugLogger {
13
+ configure(o) {
14
+ this.options = {
15
+ ...this.options,
16
+ ...o,
17
+ logPhases: {
18
+ ...this.options.logPhases,
19
+ ...o.logPhases || {}
38
20
  }
21
+ };
22
+ }
23
+ logBuildStart(o) {
24
+ this.log('info', 'Build started', {
25
+ entry: o.name
39
26
  });
40
27
  }
41
- static executeAdviceChain(t, e, n, r, o) {
42
- const c = t.filter((t)=>t.type === 'before');
43
- const s = t.filter((t)=>t.type === 'around');
44
- const a = t.filter((t)=>t.type === 'after');
45
- try {
46
- for (const t of c){
47
- const e = {
48
- ...o,
49
- config: t.config
50
- };
51
- t.method.call(t.transversalInstance, e);
52
- }
53
- let t;
54
- if (s.length > 0) {
55
- t = this.buildAroundChain(s, e, n, r, o);
56
- } else {
57
- t = e.apply(n, r);
58
- }
59
- if (t instanceof Promise) {
60
- return t.then((t)=>{
61
- for (const e of a){
62
- const n = {
63
- ...o,
64
- result: t
65
- };
66
- e.method.call(e.transversalInstance, n);
67
- }
68
- return t;
69
- }).catch((t)=>{
70
- o.error = t;
71
- throw t;
28
+ logBuildEnd(o, e) {
29
+ const t = {
30
+ entry: o.name
31
+ };
32
+ if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
33
+ this.log('info', 'Build completed', t);
34
+ }
35
+ logRegistration(o) {
36
+ if (!this.shouldLog('registration')) return;
37
+ this.log('info', 'Registration', {
38
+ identifier: o.identifier?.name || String(o.identifier),
39
+ isSingleton: o.isSingleton,
40
+ dependencies: o.dependencies.map((o)=>o?.name || String(o)),
41
+ tags: o.tags
42
+ });
43
+ }
44
+ logHook(o, e, t) {
45
+ if (!this.shouldLog('hooks')) return;
46
+ const s = this.options.logTimings ? performance.now() : 0;
47
+ this.log('info', `Hook: ${o}`, {
48
+ target: e.constructor?.name || e.name,
49
+ config: t
50
+ });
51
+ if (this.options.logTimings) {
52
+ return ()=>{
53
+ const e = performance.now() - s;
54
+ this.log('info', `Hook: ${o} completed`, {
55
+ duration: `${e.toFixed(2)}ms`
72
56
  });
73
- }
74
- for (const e of a){
75
- const n = {
76
- ...o,
77
- result: t,
78
- config: e.config
79
- };
80
- e.method.call(e.transversalInstance, n);
81
- }
82
- return t;
83
- } catch (t) {
84
- o.error = t;
85
- throw t;
57
+ };
86
58
  }
87
59
  }
88
- static buildAroundChain(t, e, n, r, o) {
89
- let c = 0;
90
- const s = ()=>{
91
- if (c < t.length) {
92
- const e = t[c++];
93
- const n = {
94
- ...o,
95
- proceed: s,
96
- config: e.config
97
- };
98
- return e.method.call(e.transversalInstance, n);
99
- } else {
100
- return e.apply(n, r);
101
- }
60
+ logPhaseStart(o, e) {
61
+ this.log('info', `Phase: ${o} started`, e);
62
+ }
63
+ logPhaseEnd(o, e) {
64
+ const t = e !== undefined ? {
65
+ duration: `${e.toFixed(2)}ms`
66
+ } : undefined;
67
+ this.log('info', `Phase: ${o} ended`, t);
68
+ }
69
+ logResolution(o, e, t) {
70
+ if (!this.shouldLog('resolution')) return;
71
+ this.log('info', `Resolving: ${o}`, {
72
+ strategy: `${e} strategy`,
73
+ cache: t ? 'hit' : 'miss'
74
+ });
75
+ }
76
+ logConstruction(o) {
77
+ if (!this.shouldLog('construction')) return;
78
+ this.log('info', `Constructing: ${o}`);
79
+ }
80
+ shouldLog(o) {
81
+ return !this.options.logPhases || this.options.logPhases[o] !== false;
82
+ }
83
+ log(o, e, t) {
84
+ if (this.options.logger) {
85
+ this.options.logger(o, e, t);
86
+ } else {
87
+ const s = `[Assembler:${o}]`;
88
+ const i = this.options.useColors !== false ? this.colorize(o, s) : s;
89
+ const n = t ? ` ${JSON.stringify(t)}` : '';
90
+ console.log(`${i} ${e}${n}`);
91
+ }
92
+ }
93
+ colorize(o, e) {
94
+ const t = {
95
+ info: '\x1b[36m',
96
+ warn: '\x1b[33m',
97
+ error: '\x1b[31m',
98
+ reset: '\x1b[0m'
99
+ };
100
+ const s = t[o] || t.info;
101
+ return `${s}${e}${t.reset}`;
102
+ }
103
+ constructor(){
104
+ this.options = {
105
+ enabled: true,
106
+ logPhases: {
107
+ registration: true,
108
+ resolution: true,
109
+ construction: true,
110
+ hooks: true,
111
+ cache: true
112
+ },
113
+ logTimings: false,
114
+ logDependencyTree: true,
115
+ useColors: true
102
116
  };
103
- return s();
117
+ }
118
+ };
119
+ class DebugLogger {
120
+ static getInstance() {
121
+ return DebugLogger.instance;
122
+ }
123
+ static enable(o) {
124
+ DebugLogger.instance = new ActiveDebugLogger();
125
+ if (o) {
126
+ DebugLogger.instance.configure(o);
127
+ }
128
+ }
129
+ static disable() {
130
+ DebugLogger.instance = new NoOpDebugLogger();
104
131
  }
105
132
  }
133
+ DebugLogger.instance = new NoOpDebugLogger();
106
134
 
107
- export { TransversalWeaver };
135
+ export { DebugLogger };
package/dist/index39.js CHANGED
@@ -2,33 +2,110 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- class PointcutMatcher {
6
- static parse(t) {
7
- const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
8
- if (!e) {
9
- throw new Error(`Invalid pointcut expression: ${t}`);
5
+ const transversalManager = require('./index13.js');
6
+ const affect = require('./index12.js');
7
+
8
+ class TransversalWeaver {
9
+ static weave(n, r, o) {
10
+ const c = transversalManager.TransversalManager.getInstance(o);
11
+ const s = c.getAspectsForTarget(r);
12
+ const a = Object.getPrototypeOf(n);
13
+ const f = Object.getOwnPropertyNames(a).some((t)=>{
14
+ if (t === 'constructor') return false;
15
+ const n = Object.getOwnPropertyDescriptor(a, t);
16
+ if (!n) return false;
17
+ const r = n.value && typeof n.value === 'function';
18
+ const o = n.get && typeof n.get === 'function';
19
+ if (!r && !o) return false;
20
+ const c = affect.getAffectedMethods(a, t);
21
+ return c.length > 0;
22
+ });
23
+ if (s.length === 0 && !f) {
24
+ return n;
10
25
  }
11
- const [, c, r] = e;
12
- return new ExecutionPointcutMatcher(c, r);
13
- }
14
- }
15
- let ExecutionPointcutMatcher = class ExecutionPointcutMatcher {
16
- matches(t) {
17
- const e = t.target.constructor.name;
18
- const c = t.methodName;
19
- return this.classRegex.test(e) && this.methodRegex.test(c);
26
+ return new Proxy(n, {
27
+ get (t, e, n) {
28
+ const r = Reflect.get(t, e, n);
29
+ if (typeof r !== 'function') {
30
+ return r;
31
+ }
32
+ return function(...n) {
33
+ const o = String(e);
34
+ const a = {
35
+ target: t,
36
+ methodName: o,
37
+ args: n
38
+ };
39
+ const f = c.getAdvicesForJoinPoint(a, s, t, e);
40
+ return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
41
+ };
42
+ }
43
+ });
20
44
  }
21
- patternToRegex(t) {
22
- if (t === '*') {
23
- return /.*/;
45
+ static executeAdviceChain(t, e, n, r, o) {
46
+ const c = t.filter((t)=>t.type === 'before');
47
+ const s = t.filter((t)=>t.type === 'around');
48
+ const a = t.filter((t)=>t.type === 'after');
49
+ try {
50
+ for (const t of c){
51
+ const e = {
52
+ ...o,
53
+ config: t.config
54
+ };
55
+ t.method.call(t.transversalInstance, e);
56
+ }
57
+ let t;
58
+ if (s.length > 0) {
59
+ t = this.buildAroundChain(s, e, n, r, o);
60
+ } else {
61
+ t = e.apply(n, r);
62
+ }
63
+ if (t instanceof Promise) {
64
+ return t.then((t)=>{
65
+ for (const e of a){
66
+ const n = {
67
+ ...o,
68
+ result: t
69
+ };
70
+ e.method.call(e.transversalInstance, n);
71
+ }
72
+ return t;
73
+ }).catch((t)=>{
74
+ o.error = t;
75
+ throw t;
76
+ });
77
+ }
78
+ for (const e of a){
79
+ const n = {
80
+ ...o,
81
+ result: t,
82
+ config: e.config
83
+ };
84
+ e.method.call(e.transversalInstance, n);
85
+ }
86
+ return t;
87
+ } catch (t) {
88
+ o.error = t;
89
+ throw t;
24
90
  }
25
- const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
26
- return new RegExp(`^${e}$`);
27
91
  }
28
- constructor(t, e){
29
- this.classRegex = this.patternToRegex(t);
30
- this.methodRegex = this.patternToRegex(e);
92
+ static buildAroundChain(t, e, n, r, o) {
93
+ let c = 0;
94
+ const s = ()=>{
95
+ if (c < t.length) {
96
+ const e = t[c++];
97
+ const n = {
98
+ ...o,
99
+ proceed: s,
100
+ config: e.config
101
+ };
102
+ return e.method.call(e.transversalInstance, n);
103
+ } else {
104
+ return e.apply(n, r);
105
+ }
106
+ };
107
+ return s();
31
108
  }
32
- };
109
+ }
33
110
 
34
- exports.PointcutMatcher = PointcutMatcher;
111
+ exports.TransversalWeaver = TransversalWeaver;
package/dist/index39.mjs CHANGED
@@ -1,30 +1,107 @@
1
- class PointcutMatcher {
2
- static parse(t) {
3
- const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
4
- if (!e) {
5
- throw new Error(`Invalid pointcut expression: ${t}`);
1
+ import { TransversalManager } from './index13.mjs';
2
+ import { getAffectedMethods } from './index12.mjs';
3
+
4
+ class TransversalWeaver {
5
+ static weave(n, r, o) {
6
+ const c = TransversalManager.getInstance(o);
7
+ const s = c.getAspectsForTarget(r);
8
+ const a = Object.getPrototypeOf(n);
9
+ const f = Object.getOwnPropertyNames(a).some((t)=>{
10
+ if (t === 'constructor') return false;
11
+ const n = Object.getOwnPropertyDescriptor(a, t);
12
+ if (!n) return false;
13
+ const r = n.value && typeof n.value === 'function';
14
+ const o = n.get && typeof n.get === 'function';
15
+ if (!r && !o) return false;
16
+ const c = getAffectedMethods(a, t);
17
+ return c.length > 0;
18
+ });
19
+ if (s.length === 0 && !f) {
20
+ return n;
6
21
  }
7
- const [, c, r] = e;
8
- return new ExecutionPointcutMatcher(c, r);
9
- }
10
- }
11
- let ExecutionPointcutMatcher = class ExecutionPointcutMatcher {
12
- matches(t) {
13
- const e = t.target.constructor.name;
14
- const c = t.methodName;
15
- return this.classRegex.test(e) && this.methodRegex.test(c);
22
+ return new Proxy(n, {
23
+ get (t, e, n) {
24
+ const r = Reflect.get(t, e, n);
25
+ if (typeof r !== 'function') {
26
+ return r;
27
+ }
28
+ return function(...n) {
29
+ const o = String(e);
30
+ const a = {
31
+ target: t,
32
+ methodName: o,
33
+ args: n
34
+ };
35
+ const f = c.getAdvicesForJoinPoint(a, s, t, e);
36
+ return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
37
+ };
38
+ }
39
+ });
16
40
  }
17
- patternToRegex(t) {
18
- if (t === '*') {
19
- return /.*/;
41
+ static executeAdviceChain(t, e, n, r, o) {
42
+ const c = t.filter((t)=>t.type === 'before');
43
+ const s = t.filter((t)=>t.type === 'around');
44
+ const a = t.filter((t)=>t.type === 'after');
45
+ try {
46
+ for (const t of c){
47
+ const e = {
48
+ ...o,
49
+ config: t.config
50
+ };
51
+ t.method.call(t.transversalInstance, e);
52
+ }
53
+ let t;
54
+ if (s.length > 0) {
55
+ t = this.buildAroundChain(s, e, n, r, o);
56
+ } else {
57
+ t = e.apply(n, r);
58
+ }
59
+ if (t instanceof Promise) {
60
+ return t.then((t)=>{
61
+ for (const e of a){
62
+ const n = {
63
+ ...o,
64
+ result: t
65
+ };
66
+ e.method.call(e.transversalInstance, n);
67
+ }
68
+ return t;
69
+ }).catch((t)=>{
70
+ o.error = t;
71
+ throw t;
72
+ });
73
+ }
74
+ for (const e of a){
75
+ const n = {
76
+ ...o,
77
+ result: t,
78
+ config: e.config
79
+ };
80
+ e.method.call(e.transversalInstance, n);
81
+ }
82
+ return t;
83
+ } catch (t) {
84
+ o.error = t;
85
+ throw t;
20
86
  }
21
- const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
22
- return new RegExp(`^${e}$`);
23
87
  }
24
- constructor(t, e){
25
- this.classRegex = this.patternToRegex(t);
26
- this.methodRegex = this.patternToRegex(e);
88
+ static buildAroundChain(t, e, n, r, o) {
89
+ let c = 0;
90
+ const s = ()=>{
91
+ if (c < t.length) {
92
+ const e = t[c++];
93
+ const n = {
94
+ ...o,
95
+ proceed: s,
96
+ config: e.config
97
+ };
98
+ return e.method.call(e.transversalInstance, n);
99
+ } else {
100
+ return e.apply(n, r);
101
+ }
102
+ };
103
+ return s();
27
104
  }
28
- };
105
+ }
29
106
 
30
- export { PointcutMatcher };
107
+ export { TransversalWeaver };
package/dist/index4.js CHANGED
@@ -3,18 +3,31 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const core = require('@assemblerjs/core');
6
- const injectableManager = require('./index32.js');
7
- const objectManager = require('./index33.js');
8
- const hookManager = require('./index34.js');
9
- const assemblerBuilder = require('./index35.js');
10
- const contextProvider = require('./index36.js');
6
+ const injectableManager = require('./index33.js');
7
+ const objectManager = require('./index34.js');
8
+ const hookManager = require('./index35.js');
9
+ const assemblerBuilder = require('./index36.js');
10
+ const contextProvider = require('./index37.js');
11
+ const debugLogger = require('./index38.js');
11
12
  const eventManager = require('./index6.js');
12
13
 
13
14
  class Assembler extends eventManager.EventManager {
15
+ static enableDebug(e) {
16
+ debugLogger.DebugLogger.enable(e);
17
+ }
18
+ static disableDebug() {
19
+ debugLogger.DebugLogger.disable();
20
+ }
14
21
  static build(e, t) {
15
- const r = new Assembler();
16
- const a = new assemblerBuilder.AssemblerBuilder(r);
17
- return a.build(e, t);
22
+ const r = debugLogger.DebugLogger.getInstance();
23
+ const a = performance.now();
24
+ r.logBuildStart(e);
25
+ const n = new Assembler();
26
+ const o = new assemblerBuilder.AssemblerBuilder(n);
27
+ const c = o.build(e, t);
28
+ const l = performance.now() - a;
29
+ r.logBuildEnd(e, l);
30
+ return c;
18
31
  }
19
32
  get hookManager() {
20
33
  return this._hookManager;
package/dist/index4.mjs CHANGED
@@ -1,16 +1,29 @@
1
1
  import { clearInstance } from '@assemblerjs/core';
2
- import { InjectableManager } from './index32.mjs';
3
- import { ObjectManager } from './index33.mjs';
4
- import { HookManager } from './index34.mjs';
5
- import { AssemblerBuilder } from './index35.mjs';
6
- import { ContextProvider } from './index36.mjs';
2
+ import { InjectableManager } from './index33.mjs';
3
+ import { ObjectManager } from './index34.mjs';
4
+ import { HookManager } from './index35.mjs';
5
+ import { AssemblerBuilder } from './index36.mjs';
6
+ import { ContextProvider } from './index37.mjs';
7
+ import { DebugLogger } from './index38.mjs';
7
8
  import { EventManager } from './index6.mjs';
8
9
 
9
10
  class Assembler extends EventManager {
11
+ static enableDebug(e) {
12
+ DebugLogger.enable(e);
13
+ }
14
+ static disableDebug() {
15
+ DebugLogger.disable();
16
+ }
10
17
  static build(e, t) {
11
- const r = new Assembler();
12
- const a = new AssemblerBuilder(r);
13
- return a.build(e, t);
18
+ const r = DebugLogger.getInstance();
19
+ const a = performance.now();
20
+ r.logBuildStart(e);
21
+ const n = new Assembler();
22
+ const o = new AssemblerBuilder(n);
23
+ const c = o.build(e, t);
24
+ const l = performance.now() - a;
25
+ r.logBuildEnd(e, l);
26
+ return c;
14
27
  }
15
28
  get hookManager() {
16
29
  return this._hookManager;
package/dist/index40.js CHANGED
@@ -2,53 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const core = require('@assemblerjs/core');
6
-
7
- const i = (e)=>{
8
- return {
9
- identifier: e[0],
10
- concrete: e[0],
11
- configuration: {}
12
- };
13
- };
14
- const c = (o)=>{
15
- const i = ()=>core.isClass(o[0]) && core.isClass(o[1]);
16
- const c = ()=>core.isClass(o[0]) && core.isObject(o[1]);
17
- const s = ()=>core.pipe(core.conditionally({
18
- if: ()=>i(),
19
- then: ()=>{
20
- return {
21
- identifier: o[0],
22
- concrete: o[1],
23
- configuration: {}
24
- };
25
- }
26
- }), core.conditionally({
27
- if: ()=>c(),
28
- then: ()=>{
29
- return {
30
- identifier: o[0],
31
- concrete: o[0],
32
- configuration: o[1]
33
- };
34
- },
35
- else: (e)=>e
36
- }))();
37
- return s();
38
- };
39
- const s = (e)=>{
40
- return {
41
- identifier: e[0],
42
- concrete: e[1],
43
- configuration: e[2]
44
- };
5
+ class PointcutMatcher {
6
+ static parse(t) {
7
+ const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
8
+ if (!e) {
9
+ throw new Error(`Invalid pointcut expression: ${t}`);
10
+ }
11
+ const [, c, r] = e;
12
+ return new ExecutionPointcutMatcher(c, r);
13
+ }
14
+ }
15
+ let ExecutionPointcutMatcher = class ExecutionPointcutMatcher {
16
+ matches(t) {
17
+ const e = t.target.constructor.name;
18
+ const c = t.methodName;
19
+ return this.classRegex.test(e) && this.methodRegex.test(c);
20
+ }
21
+ patternToRegex(t) {
22
+ if (t === '*') {
23
+ return /.*/;
24
+ }
25
+ const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
26
+ return new RegExp(`^${e}$`);
27
+ }
28
+ constructor(t, e){
29
+ this.classRegex = this.patternToRegex(t);
30
+ this.methodRegex = this.patternToRegex(e);
31
+ }
45
32
  };
46
- const resolveInjectionTuple = (e)=>core.switchCase({
47
- 1: ()=>i(e),
48
- 2: ()=>c(e),
49
- 3: ()=>s(e)
50
- }, ()=>{
51
- throw new Error(`Injection tuple must be of length 1, 2 or 3.`);
52
- })(e.length);
53
33
 
54
- exports.resolveInjectionTuple = resolveInjectionTuple;
34
+ exports.PointcutMatcher = PointcutMatcher;