assemblerjs 1.0.0 → 1.0.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 +21 -48
- package/dist/index12.js +1 -1
- package/dist/index12.mjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index18.mjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.mjs +1 -1
- package/dist/index2.js +3 -3
- package/dist/index2.mjs +3 -3
- package/dist/index20.js +1 -1
- package/dist/index20.mjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index21.mjs +1 -1
- package/dist/index22.js +2 -2
- package/dist/index22.mjs +2 -2
- package/dist/index23.js +33 -56
- package/dist/index23.mjs +32 -56
- package/dist/index24.js +15 -32
- package/dist/index24.mjs +13 -32
- package/dist/index25.js +11 -63
- package/dist/index25.mjs +9 -63
- package/dist/index26.js +91 -28
- package/dist/index26.mjs +89 -28
- package/dist/index27.js +62 -30
- package/dist/index27.mjs +62 -30
- package/dist/index28.js +27 -36
- package/dist/index28.mjs +27 -35
- package/dist/index29.js +66 -15
- package/dist/index29.mjs +66 -13
- package/dist/index3.js +2 -2
- package/dist/index3.mjs +2 -2
- package/dist/index30.js +31 -13
- package/dist/index30.mjs +31 -11
- package/dist/index31.js +29 -92
- package/dist/index31.mjs +29 -90
- package/dist/index33.js +49 -29
- package/dist/index33.mjs +49 -28
- package/dist/index35.js +29 -49
- package/dist/index35.mjs +28 -49
- package/dist/index36.js +5 -5
- package/dist/index36.mjs +5 -5
- package/dist/index38.js +1 -1
- package/dist/index38.mjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index39.mjs +1 -1
- package/dist/index4.js +5 -5
- package/dist/index4.mjs +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ A modern, type-safe, and lightweight [Dependency Injection](https://en.wikipedia
|
|
|
13
13
|

|
|
14
14
|

|
|
15
15
|
|
|
16
|
-
[→ Full Benchmarks](
|
|
16
|
+
[→ Full Benchmarks](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/performance/benchmarks.md)
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -100,69 +100,42 @@ app.start(); // Output: "App started!"
|
|
|
100
100
|
|
|
101
101
|
Comprehensive documentation is available at:
|
|
102
102
|
|
|
103
|
-
**[→ Full Documentation](
|
|
103
|
+
**[→ Full Documentation](https://github.com/benoitlahoz/assemblerjs/tree/main/docs/assemblerjs)**
|
|
104
104
|
|
|
105
105
|
### Quick Links
|
|
106
106
|
|
|
107
107
|
#### Getting Started
|
|
108
|
-
- [Installation](
|
|
109
|
-
- [Quick Start Guide](
|
|
110
|
-
- [TypeScript Setup](
|
|
108
|
+
- [Installation](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/getting-started/installation.md)
|
|
109
|
+
- [Quick Start Guide](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/getting-started/quick-start.md)
|
|
110
|
+
- [TypeScript Setup](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/getting-started/typescript-setup.md)
|
|
111
111
|
|
|
112
112
|
#### Core Concepts
|
|
113
|
-
- [Assemblage](
|
|
114
|
-
- [Dependency Injection](
|
|
115
|
-
- [Abstraction Pattern](
|
|
116
|
-
- [Lifecycle Hooks](
|
|
113
|
+
- [Assemblage](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/core-concepts/assemblage.md) - Building blocks
|
|
114
|
+
- [Dependency Injection](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/core-concepts/dependency-injection.md) - DI patterns
|
|
115
|
+
- [Abstraction Pattern](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/core-concepts/abstraction-pattern.md) - Interface-based design
|
|
116
|
+
- [Lifecycle Hooks](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/core-concepts/lifecycle-hooks.md) - Initialization & cleanup
|
|
117
117
|
|
|
118
118
|
#### Decorators
|
|
119
|
-
- [Parameter Decorators](
|
|
120
|
-
- [Custom Parameter Decorators](
|
|
121
|
-
- [Custom Class Decorators](
|
|
119
|
+
- [Parameter Decorators](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/decorators/parameter-decorators.md) - Built-in decorators
|
|
120
|
+
- [Custom Parameter Decorators](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/decorators/custom-parameter.md) - Create your own
|
|
121
|
+
- [Custom Class Decorators](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/decorators/custom-class.md) - Type-safe class decorators
|
|
122
122
|
|
|
123
123
|
#### Features
|
|
124
|
-
- [Event System](
|
|
125
|
-
- [Tags](
|
|
126
|
-
- [Singleton vs Transient](
|
|
124
|
+
- [Event System](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/features/events.md) - Event-driven architecture
|
|
125
|
+
- [Tags](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/features/tags.md) - Group assemblages
|
|
126
|
+
- [Singleton vs Transient](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/features/singleton-transient.md) - Instance lifecycle
|
|
127
127
|
|
|
128
128
|
#### API Reference
|
|
129
|
-
- [Assembler API](
|
|
130
|
-
- [AssemblerContext API](
|
|
131
|
-
- [Types](
|
|
129
|
+
- [Assembler API](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/api/assembler.md) - Container methods
|
|
130
|
+
- [AssemblerContext API](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/api/context.md) - Context interface
|
|
131
|
+
- [Types](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/api/types.md) - TypeScript types
|
|
132
132
|
|
|
133
133
|
#### Guides
|
|
134
|
-
- [Advanced Examples](
|
|
135
|
-
- [Tree-Shaking](
|
|
134
|
+
- [Advanced Examples](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/guides/advanced-examples.md) - Real-world patterns
|
|
135
|
+
- [Tree-Shaking](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/guides/tree-shaking.md) - Bundle optimization
|
|
136
136
|
|
|
137
137
|
#### Performance
|
|
138
|
-
- [Benchmarks](
|
|
139
|
-
|
|
140
|
-
## Requirements
|
|
141
|
-
|
|
142
|
-
- **Node.js:** ≥ 18.12.0
|
|
143
|
-
- **TypeScript:** ≥ 5.0 (with decorator support)
|
|
144
|
-
- **reflect-metadata:** Required for dependency injection
|
|
145
|
-
|
|
146
|
-
## For Contributors
|
|
147
|
-
|
|
148
|
-
### Architecture
|
|
149
|
-
|
|
150
|
-
This package is part of the `assemblerjs` monorepo and depends on:
|
|
151
|
-
|
|
152
|
-
- **`@assemblerjs/core`** - Internal utilities package
|
|
153
|
-
|
|
154
|
-
### Development
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# Install dependencies from workspace root
|
|
158
|
-
yarn install
|
|
159
|
-
|
|
160
|
-
# Build the package
|
|
161
|
-
npx nx build assemblerjs
|
|
162
|
-
|
|
163
|
-
# Run tests
|
|
164
|
-
npx nx test assemblerjs
|
|
165
|
-
```
|
|
138
|
+
- [Benchmarks](https://github.com/benoitlahoz/assemblerjs/blob/main/docs/assemblerjs/performance/benchmarks.md) - Performance metrics & best practices
|
|
166
139
|
|
|
167
140
|
## Tree-Shaking & Bundle Optimization
|
|
168
141
|
|
package/dist/index12.js
CHANGED
package/dist/index12.mjs
CHANGED
package/dist/index13.js
CHANGED
package/dist/index13.mjs
CHANGED
package/dist/index18.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index25.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index13.js');
|
|
7
7
|
const helpers = require('./index21.js');
|
|
8
8
|
const resolverStore = require('./index32.js');
|
package/dist/index18.mjs
CHANGED
package/dist/index19.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index25.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index13.js');
|
|
7
7
|
const helpers = require('./index21.js');
|
|
8
8
|
const resolverStore = require('./index32.js');
|
package/dist/index19.mjs
CHANGED
package/dist/index2.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const constants = require('./
|
|
6
|
-
const reflection = require('./
|
|
7
|
-
const schema = require('./
|
|
5
|
+
const constants = require('./index24.js');
|
|
6
|
+
const reflection = require('./index25.js');
|
|
7
|
+
const schema = require('./index26.js');
|
|
8
8
|
|
|
9
9
|
const Assemblage = (e)=>{
|
|
10
10
|
return (r)=>{
|
package/dist/index2.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReflectFlags, ReflectValue } from './
|
|
2
|
-
import { defineCustomMetadata } from './
|
|
3
|
-
import { validateDefinition } from './
|
|
1
|
+
import { ReflectFlags, ReflectValue } from './index24.mjs';
|
|
2
|
+
import { defineCustomMetadata } from './index25.mjs';
|
|
3
|
+
import { validateDefinition } from './index26.mjs';
|
|
4
4
|
|
|
5
5
|
const Assemblage = (e)=>{
|
|
6
6
|
return (r)=>{
|
package/dist/index20.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index25.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index13.js');
|
|
7
7
|
const helpers = require('./index21.js');
|
|
8
8
|
const resolverStore = require('./index32.js');
|
package/dist/index20.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getParamTypes, getOwnCustomMetadata } from './
|
|
1
|
+
import { getParamTypes, getOwnCustomMetadata } from './index25.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index13.mjs';
|
|
3
3
|
import { getParamValueKey } from './index21.mjs';
|
|
4
4
|
import { ResolverStore } from './index32.mjs';
|
package/dist/index21.js
CHANGED
package/dist/index21.mjs
CHANGED
package/dist/index22.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const constants = require('./
|
|
6
|
-
const reflection = require('./
|
|
5
|
+
const constants = require('./index24.js');
|
|
6
|
+
const reflection = require('./index25.js');
|
|
7
7
|
const helpers = require('./index21.js');
|
|
8
8
|
const parameterDecoratorFactory = require('./index13.js');
|
|
9
9
|
const decorator = require('./index2.js');
|
package/dist/index22.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReflectParamTypes, ReflectValue } from './
|
|
2
|
-
import { getOwnCustomMetadata, defineCustomMetadata } from './
|
|
1
|
+
import { ReflectParamTypes, ReflectValue } from './index24.mjs';
|
|
2
|
+
import { getOwnCustomMetadata, defineCustomMetadata } from './index25.mjs';
|
|
3
3
|
import { getDecoratedParametersIndexes, getParamValueKey, getParamIndexKey } from './index21.mjs';
|
|
4
4
|
import { ParameterDecoratorFactory } from './index13.mjs';
|
|
5
5
|
import { decorateAssemblage } from './index2.mjs';
|
package/dist/index23.js
CHANGED
|
@@ -2,68 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const resolutionStrategies = require('./index33.js');
|
|
7
|
-
const use = require('./index34.js');
|
|
8
|
-
const inject = require('./index35.js');
|
|
9
|
-
const injectable = require('./index36.js');
|
|
5
|
+
const eventManager = require('./index6.js');
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new Error(`An assemblage is already registered with identifier '${o.identifier.name}'.`);
|
|
7
|
+
const registerEvents = (t, n)=>{
|
|
8
|
+
const o = 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);
|
|
20
15
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
has(e) {
|
|
27
|
-
return this.injectables.has(e);
|
|
28
|
-
}
|
|
29
|
-
require(e, t) {
|
|
30
|
-
if (!this.injectables.has(e)) {
|
|
31
|
-
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
16
|
+
for (const e of t.events){
|
|
17
|
+
n.on(e, (...n)=>{
|
|
18
|
+
t.privateContext.emit(e, ...n);
|
|
19
|
+
});
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} else {
|
|
37
|
-
return this.transientStrategy.resolve(i, t);
|
|
21
|
+
} else {
|
|
22
|
+
for (const e of t.events){
|
|
23
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
38
24
|
}
|
|
39
25
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (const i of e){
|
|
48
|
-
for (const [e, s] of this.injectables){
|
|
49
|
-
if (s.tags.includes(i)) t.push(s.build());
|
|
50
|
-
}
|
|
26
|
+
};
|
|
27
|
+
const unregisterEvents = (t, n)=>{
|
|
28
|
+
const o = t.concrete.prototype instanceof eventManager.EventManager;
|
|
29
|
+
if (o) {
|
|
30
|
+
const e = n;
|
|
31
|
+
for (const n of t.events){
|
|
32
|
+
e.off(n);
|
|
51
33
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
for (const
|
|
56
|
-
t.
|
|
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
|
+
}
|
|
57
41
|
}
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
return this.injectables.size;
|
|
61
|
-
}
|
|
62
|
-
constructor(){
|
|
63
|
-
this.injectables = new Map();
|
|
64
|
-
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
65
|
-
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
43
|
+
};
|
|
68
44
|
|
|
69
|
-
exports.
|
|
45
|
+
exports.registerEvents = registerEvents;
|
|
46
|
+
exports.unregisterEvents = unregisterEvents;
|
package/dist/index23.mjs
CHANGED
|
@@ -1,65 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SingletonStrategy, TransientStrategy } from './index33.mjs';
|
|
3
|
-
import { resolveInstanceInjectionTuple } from './index34.mjs';
|
|
4
|
-
import { resolveInjectionTuple } from './index35.mjs';
|
|
5
|
-
import { Injectable } from './index36.mjs';
|
|
1
|
+
import { EventManager } from './index6.mjs';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new Error(`An assemblage is already registered with identifier '${o.identifier.name}'.`);
|
|
3
|
+
const registerEvents = (t, n)=>{
|
|
4
|
+
const o = t.concrete.prototype instanceof EventManager;
|
|
5
|
+
if (o) {
|
|
6
|
+
const e = n;
|
|
7
|
+
const o = e.channels;
|
|
8
|
+
for (const n of t.events){
|
|
9
|
+
if (!o.has(n)) e.addChannels(n);
|
|
10
|
+
if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
|
|
16
11
|
}
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
has(e) {
|
|
23
|
-
return this.injectables.has(e);
|
|
24
|
-
}
|
|
25
|
-
require(e, t) {
|
|
26
|
-
if (!this.injectables.has(e)) {
|
|
27
|
-
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
12
|
+
for (const e of t.events){
|
|
13
|
+
n.on(e, (...n)=>{
|
|
14
|
+
t.privateContext.emit(e, ...n);
|
|
15
|
+
});
|
|
28
16
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
return this.transientStrategy.resolve(i, t);
|
|
17
|
+
} else {
|
|
18
|
+
for (const e of t.events){
|
|
19
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
34
20
|
}
|
|
35
21
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (const i of e){
|
|
44
|
-
for (const [e, s] of this.injectables){
|
|
45
|
-
if (s.tags.includes(i)) t.push(s.build());
|
|
46
|
-
}
|
|
22
|
+
};
|
|
23
|
+
const unregisterEvents = (t, n)=>{
|
|
24
|
+
const o = t.concrete.prototype instanceof EventManager;
|
|
25
|
+
if (o) {
|
|
26
|
+
const e = n;
|
|
27
|
+
for (const n of t.events){
|
|
28
|
+
e.off(n);
|
|
47
29
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for (const
|
|
52
|
-
t.
|
|
30
|
+
e.removeChannels(...t.events);
|
|
31
|
+
t.privateContext.removeChannels(...t.events);
|
|
32
|
+
} else {
|
|
33
|
+
for (const e of t.events){
|
|
34
|
+
if (t.privateContext.events.has(e)) {
|
|
35
|
+
t.privateContext.removeChannels(e);
|
|
36
|
+
}
|
|
53
37
|
}
|
|
54
38
|
}
|
|
55
|
-
|
|
56
|
-
return this.injectables.size;
|
|
57
|
-
}
|
|
58
|
-
constructor(){
|
|
59
|
-
this.injectables = new Map();
|
|
60
|
-
this.singletonStrategy = new SingletonStrategy();
|
|
61
|
-
this.transientStrategy = new TransientStrategy();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
39
|
+
};
|
|
64
40
|
|
|
65
|
-
export {
|
|
41
|
+
export { registerEvents, unregisterEvents };
|
package/dist/index24.js
CHANGED
|
@@ -2,36 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (!this.objects.has(e)) {
|
|
18
|
-
throw new Error(`Injected object with identifier '${String(e)}' has not been registered.`);
|
|
19
|
-
}
|
|
20
|
-
return this.objects.get(e);
|
|
21
|
-
}
|
|
22
|
-
addGlobal(e, t) {
|
|
23
|
-
if (this.globals.has(e)) {
|
|
24
|
-
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
25
|
-
}
|
|
26
|
-
this.globals.set(e, t);
|
|
27
|
-
}
|
|
28
|
-
global(e) {
|
|
29
|
-
return this.globals.get(e);
|
|
30
|
-
}
|
|
31
|
-
constructor(){
|
|
32
|
-
this.objects = new Map();
|
|
33
|
-
this.globals = new Map();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
5
|
+
const ReflectParamTypes = 'design:paramtypes';
|
|
6
|
+
const ReflectPrefix = '__';
|
|
7
|
+
const ReflectSuffix = '__';
|
|
8
|
+
exports.ReflectFlags = void 0;
|
|
9
|
+
(function(e) {
|
|
10
|
+
e["IsAssemblage"] = "is_assemblage";
|
|
11
|
+
})(exports.ReflectFlags || (exports.ReflectFlags = {}));
|
|
12
|
+
exports.ReflectValue = void 0;
|
|
13
|
+
(function(e) {
|
|
14
|
+
e["AssemblageDefinition"] = "assemblage:definition.value";
|
|
15
|
+
e["AssemblageContext"] = "assemblage:context.value";
|
|
16
|
+
})(exports.ReflectValue || (exports.ReflectValue = {}));
|
|
36
17
|
|
|
37
|
-
exports.
|
|
18
|
+
exports.ReflectParamTypes = ReflectParamTypes;
|
|
19
|
+
exports.ReflectPrefix = ReflectPrefix;
|
|
20
|
+
exports.ReflectSuffix = ReflectSuffix;
|
package/dist/index24.mjs
CHANGED
|
@@ -1,33 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!this.objects.has(e)) {
|
|
14
|
-
throw new Error(`Injected object with identifier '${String(e)}' has not been registered.`);
|
|
15
|
-
}
|
|
16
|
-
return this.objects.get(e);
|
|
17
|
-
}
|
|
18
|
-
addGlobal(e, t) {
|
|
19
|
-
if (this.globals.has(e)) {
|
|
20
|
-
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
21
|
-
}
|
|
22
|
-
this.globals.set(e, t);
|
|
23
|
-
}
|
|
24
|
-
global(e) {
|
|
25
|
-
return this.globals.get(e);
|
|
26
|
-
}
|
|
27
|
-
constructor(){
|
|
28
|
-
this.objects = new Map();
|
|
29
|
-
this.globals = new Map();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
const ReflectParamTypes = 'design:paramtypes';
|
|
2
|
+
const ReflectPrefix = '__';
|
|
3
|
+
const ReflectSuffix = '__';
|
|
4
|
+
var ReflectFlags;
|
|
5
|
+
(function(e) {
|
|
6
|
+
e["IsAssemblage"] = "is_assemblage";
|
|
7
|
+
})(ReflectFlags || (ReflectFlags = {}));
|
|
8
|
+
var ReflectValue;
|
|
9
|
+
(function(e) {
|
|
10
|
+
e["AssemblageDefinition"] = "assemblage:definition.value";
|
|
11
|
+
e["AssemblageContext"] = "assemblage:context.value";
|
|
12
|
+
})(ReflectValue || (ReflectValue = {}));
|
|
32
13
|
|
|
33
|
-
export {
|
|
14
|
+
export { ReflectFlags, ReflectParamTypes, ReflectPrefix, ReflectSuffix, ReflectValue };
|
package/dist/index25.js
CHANGED
|
@@ -2,70 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const constants = require('./index24.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.initCache.push({
|
|
10
|
-
instance: e,
|
|
11
|
-
configuration: t
|
|
12
|
-
});
|
|
13
|
-
return this.initCache;
|
|
14
|
-
}
|
|
15
|
-
callInitHooks(e) {
|
|
16
|
-
for (const t of this.initCache){
|
|
17
|
-
HookManager.callHookImmediate(t.instance, 'onInit', e, t.configuration);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
callInitedHooks(e) {
|
|
21
|
-
for (const t of [
|
|
22
|
-
...this.initCache
|
|
23
|
-
].reverse()){
|
|
24
|
-
HookManager.callHookImmediate(t.instance, 'onInited', e, t.configuration);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
clearCache() {
|
|
28
|
-
this.initCache.length = 0;
|
|
29
|
-
}
|
|
30
|
-
getCache() {
|
|
31
|
-
return this.initCache;
|
|
32
|
-
}
|
|
33
|
-
constructor(){
|
|
34
|
-
this.initCache = [];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
HookManager.callHook = (t, i, o, n)=>{
|
|
38
|
-
return new Promise((a, c)=>{
|
|
39
|
-
const r = t[i];
|
|
40
|
-
if (r) {
|
|
41
|
-
if (core.isAsync(r)) {
|
|
42
|
-
r.bind(t)(o, n).then(()=>{
|
|
43
|
-
a();
|
|
44
|
-
}).catch((e)=>{
|
|
45
|
-
c(e);
|
|
46
|
-
});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
r.bind(t)(o, n);
|
|
51
|
-
a();
|
|
52
|
-
} catch (e) {
|
|
53
|
-
c(e);
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
a();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
7
|
+
const defineCustomMetadata = (t, o, n)=>{
|
|
8
|
+
Reflect.defineMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o, n);
|
|
59
9
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
a.bind(t)(o, n);
|
|
68
|
-
}
|
|
10
|
+
const getOwnCustomMetadata = (t, o)=>{
|
|
11
|
+
return Reflect.getOwnMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
|
|
12
|
+
};
|
|
13
|
+
const getParamTypes = (e)=>{
|
|
14
|
+
return Reflect.getMetadata(constants.ReflectParamTypes, e) || [];
|
|
69
15
|
};
|
|
70
16
|
|
|
71
|
-
exports.
|
|
17
|
+
exports.defineCustomMetadata = defineCustomMetadata;
|
|
18
|
+
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
19
|
+
exports.getParamTypes = getParamTypes;
|