assemblerjs 1.1.13 → 1.1.15

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/dist/index39.mjs CHANGED
@@ -1,164 +1,30 @@
1
- function o(o) {
2
- if (o === undefined) return 'undefined';
3
- if (o === null) return 'null';
4
- if (typeof o === 'function') {
5
- if (o.name) return o.name;
6
- if (o.constructor?.name && o.constructor.name !== 'Function') {
7
- return o.constructor.name;
1
+ class PointcutMatcher {
2
+ static parse(t) {
3
+ const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
4
+ if (!e) {
5
+ throw new Error(`Invalid pointcut expression: ${t}`);
8
6
  }
9
- return 'AnonymousFunction';
7
+ const [, c, r] = e;
8
+ return new ExecutionPointcutMatcher(c, r);
10
9
  }
11
- if (typeof o === 'object') {
12
- if (o.name && typeof o.name === 'string') {
13
- return o.name;
14
- }
15
- const e = o.constructor?.name;
16
- if (e && e !== 'Object') {
17
- return e;
18
- }
19
- return '[Object]';
20
- }
21
- return String(o);
22
10
  }
23
- let NoOpDebugLogger = class NoOpDebugLogger {
24
- configure(o) {}
25
- log(o, e, t) {}
26
- logBuildStart(o) {}
27
- logBuildEnd(o, e) {}
28
- logRegistration(o) {}
29
- logHook(o, e, t) {}
30
- logPhaseStart(o, e) {}
31
- logPhaseEnd(o, e, t) {}
32
- logResolution(o, e, t) {}
33
- logConstruction(o) {}
34
- };
35
- let ActiveDebugLogger = class ActiveDebugLogger {
36
- configure(o) {
37
- this.options = {
38
- ...this.options,
39
- ...o,
40
- logPhases: {
41
- ...this.options.logPhases,
42
- ...o.logPhases || {}
43
- }
44
- };
45
- }
46
- logBuildStart(o) {
47
- this.log('info', 'Build started', {
48
- entry: o.name
49
- });
50
- }
51
- logBuildEnd(o, e) {
52
- const t = {
53
- entry: o.name
54
- };
55
- if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
56
- this.log('info', 'Build completed', t);
57
- }
58
- logRegistration(e) {
59
- if (!this.shouldLog('registration')) return;
60
- this.log('info', 'Registration', {
61
- identifier: o(e.identifier),
62
- isSingleton: e.isSingleton,
63
- dependencies: e.dependencies.map((e)=>o(e)),
64
- tags: e.tags
65
- });
66
- }
67
- logHook(e, t, n) {
68
- if (!this.shouldLog('hooks')) return;
69
- const s = this.options.logTimings ? performance.now() : 0;
70
- this.log('info', `Hook: ${e}`, {
71
- target: o(t),
72
- config: n
73
- });
74
- if (this.options.logTimings) {
75
- return ()=>{
76
- const o = performance.now() - s;
77
- this.log('info', `Hook: ${e} completed`, {
78
- duration: `${o.toFixed(2)}ms`
79
- });
80
- };
81
- }
82
- }
83
- logPhaseStart(o, e) {
84
- this.log('info', `Phase: ${o} started`, e);
85
- }
86
- logPhaseEnd(o, e, t) {
87
- const n = e !== undefined ? {
88
- duration: `${e.toFixed(2)}ms`
89
- } : {};
90
- if (t) {
91
- Object.assign(n, t);
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);
16
+ }
17
+ patternToRegex(t) {
18
+ if (t === '*') {
19
+ return /.*/;
92
20
  }
93
- this.log('info', `Phase: ${o} ended`, Object.keys(n).length > 0 ? n : undefined);
21
+ const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
22
+ return new RegExp(`^${e}$`);
94
23
  }
95
- logResolution(o, e, t) {
96
- if (!this.shouldLog('resolution')) return;
97
- this.log('info', `Resolving: ${o}`, {
98
- strategy: `${e} strategy`,
99
- cache: t ? 'hit' : 'miss'
100
- });
101
- }
102
- logConstruction(o) {
103
- if (!this.shouldLog('construction')) return;
104
- this.log('info', `Constructing: ${o}`);
105
- }
106
- shouldLog(o) {
107
- return !this.options.logPhases || this.options.logPhases[o] !== false;
108
- }
109
- log(o, e, t) {
110
- if (this.options.logger) {
111
- this.options.logger(o, e, t);
112
- } else {
113
- const n = `[Assembler:${o}]`;
114
- const s = this.options.useColors !== false ? this.colorize(o, n) : n;
115
- if (t) {
116
- console.log(`${s} ${e}`, t);
117
- } else {
118
- console.log(`${s} ${e}`);
119
- }
120
- }
121
- }
122
- colorize(o, e) {
123
- const t = {
124
- info: '\x1b[36m',
125
- warn: '\x1b[33m',
126
- error: '\x1b[31m',
127
- reset: '\x1b[0m'
128
- };
129
- const n = t[o] || t.info;
130
- return `${n}${e}${t.reset}`;
131
- }
132
- constructor(){
133
- this.options = {
134
- enabled: true,
135
- logPhases: {
136
- registration: true,
137
- resolution: true,
138
- construction: true,
139
- hooks: true,
140
- cache: true
141
- },
142
- logTimings: false,
143
- logDependencyTree: true,
144
- useColors: true
145
- };
24
+ constructor(t, e){
25
+ this.classRegex = this.patternToRegex(t);
26
+ this.methodRegex = this.patternToRegex(e);
146
27
  }
147
28
  };
148
- class DebugLogger {
149
- static getInstance() {
150
- return DebugLogger.instance;
151
- }
152
- static enable(o) {
153
- DebugLogger.instance = new ActiveDebugLogger();
154
- if (o) {
155
- DebugLogger.instance.configure(o);
156
- }
157
- }
158
- static disable() {
159
- DebugLogger.instance = new NoOpDebugLogger();
160
- }
161
- }
162
- DebugLogger.instance = new NoOpDebugLogger();
163
29
 
164
- export { DebugLogger };
30
+ export { PointcutMatcher };
package/dist/index4.js CHANGED
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const core = require('@assemblerjs/core');
6
- const injectableManager = require('./index34.js');
7
- const objectManager = require('./index35.js');
8
- const hookManager = require('./index36.js');
9
- const assemblerBuilder = require('./index37.js');
10
- const contextProvider = require('./index38.js');
11
- const debugLogger = require('./index39.js');
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');
11
+ const debugLogger = require('./index37.js');
12
12
  const eventManager = require('./index6.js');
13
13
 
14
14
  class Assembler extends eventManager.EventManager {
package/dist/index4.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { clearInstance } from '@assemblerjs/core';
2
- import { InjectableManager } from './index34.mjs';
3
- import { ObjectManager } from './index35.mjs';
4
- import { HookManager } from './index36.mjs';
5
- import { AssemblerBuilder } from './index37.mjs';
6
- import { ContextProvider } from './index38.mjs';
7
- import { DebugLogger } from './index39.mjs';
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';
7
+ import { DebugLogger } from './index37.mjs';
8
8
  import { EventManager } from './index6.mjs';
9
9
 
10
10
  class Assembler extends EventManager {