assemblerjs 1.1.2 → 1.1.4

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 (80) hide show
  1. package/dist/index.d.ts +29 -3
  2. package/dist/index11.js +2 -2
  3. package/dist/index11.mjs +2 -2
  4. package/dist/index13.js +2 -2
  5. package/dist/index13.mjs +2 -2
  6. package/dist/index16.js +1 -1
  7. package/dist/index16.mjs +1 -1
  8. package/dist/index17.js +1 -1
  9. package/dist/index17.mjs +1 -1
  10. package/dist/index18.js +1 -1
  11. package/dist/index18.mjs +1 -1
  12. package/dist/index19.js +1 -1
  13. package/dist/index19.mjs +1 -1
  14. package/dist/index2.js +2 -2
  15. package/dist/index2.mjs +2 -2
  16. package/dist/index20.js +1 -1
  17. package/dist/index20.mjs +1 -1
  18. package/dist/index21.js +1 -1
  19. package/dist/index21.mjs +1 -1
  20. package/dist/index22.js +2 -2
  21. package/dist/index22.mjs +2 -2
  22. package/dist/index23.js +2 -2
  23. package/dist/index23.mjs +2 -2
  24. package/dist/index24.js +2 -2
  25. package/dist/index24.mjs +2 -2
  26. package/dist/index25.js +1 -1
  27. package/dist/index25.mjs +1 -1
  28. package/dist/index26.js +1 -1
  29. package/dist/index26.mjs +1 -1
  30. package/dist/index27.js +1 -1
  31. package/dist/index27.mjs +1 -1
  32. package/dist/index29.js +15 -38
  33. package/dist/index29.mjs +12 -37
  34. package/dist/index3.js +1 -1
  35. package/dist/index3.mjs +1 -1
  36. package/dist/index30.js +100 -58
  37. package/dist/index30.mjs +98 -58
  38. package/dist/index31.js +63 -20
  39. package/dist/index31.mjs +63 -20
  40. package/dist/index32.js +23 -57
  41. package/dist/index32.mjs +23 -57
  42. package/dist/index33.js +75 -27
  43. package/dist/index33.mjs +75 -27
  44. package/dist/index34.js +39 -29
  45. package/dist/index34.mjs +39 -29
  46. package/dist/index35.js +32 -18
  47. package/dist/index35.mjs +32 -15
  48. package/dist/index36.js +128 -101
  49. package/dist/index36.mjs +128 -99
  50. package/dist/index37.js +35 -100
  51. package/dist/index37.mjs +34 -100
  52. package/dist/index38.js +18 -24
  53. package/dist/index38.mjs +18 -24
  54. package/dist/index39.js +101 -18
  55. package/dist/index39.mjs +101 -18
  56. package/dist/index4.js +23 -10
  57. package/dist/index4.mjs +23 -10
  58. package/dist/index40.js +25 -25
  59. package/dist/index40.mjs +25 -24
  60. package/dist/index41.js +44 -18
  61. package/dist/index41.mjs +44 -17
  62. package/dist/index42.js +18 -44
  63. package/dist/index42.mjs +17 -44
  64. package/dist/index43.js +26 -191
  65. package/dist/index43.mjs +25 -191
  66. package/dist/index44.js +192 -940
  67. package/dist/index44.mjs +192 -940
  68. package/dist/index45.js +942 -2
  69. package/dist/index45.mjs +942 -2
  70. package/dist/index46.js +2 -2
  71. package/dist/index46.mjs +2 -2
  72. package/dist/index47.js +2 -14
  73. package/dist/index47.mjs +2 -14
  74. package/dist/index48.js +9 -34
  75. package/dist/index48.mjs +9 -34
  76. package/dist/index49.js +32 -55
  77. package/dist/index49.mjs +32 -54
  78. package/dist/index50.js +67 -0
  79. package/dist/index50.mjs +62 -0
  80. package/package.json +1 -1
package/dist/index44.js CHANGED
@@ -2,946 +2,198 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const _commonjsHelpers = require('./index45.js');
6
- const Reflect = require('./index46.js');
5
+ const core = require('@assemblerjs/core');
6
+ const constants = require('./index28.js');
7
+ const reflection = require('./index29.js');
8
+ const injectableBuilder = require('./index49.js');
9
+ const dependencies = require('./index50.js');
10
+ const helpers = require('./index37.js');
11
+ const hookManager = require('./index33.js');
12
+ const helpers$1 = require('./index3.js');
13
+ const use = require('./index42.js');
14
+ const schema = require('./index30.js');
15
+ const decorators = require('./index11.js');
16
+ const transversalManager = require('./index13.js');
7
17
 
8
- /*! *****************************************************************************
9
- Copyright (C) Microsoft. All rights reserved.
10
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11
- this file except in compliance with the License. You may obtain a copy of the
12
- License at http://www.apache.org/licenses/LICENSE-2.0
13
-
14
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17
- MERCHANTABLITY OR NON-INFRINGEMENT.
18
-
19
- See the Apache Version 2.0 License for specific language governing permissions
20
- and limitations under the License.
21
- ***************************************************************************** */
22
-
23
- var hasRequired_Reflect;
24
-
25
- function require_Reflect () {
26
- if (hasRequired_Reflect) return Reflect.__exports;
27
- hasRequired_Reflect = 1;
28
- var e;
29
- (function(e) {
30
- (function(t) {
31
- var r = typeof globalThis === "object" ? globalThis : typeof _commonjsHelpers.commonjsGlobal === "object" ? _commonjsHelpers.commonjsGlobal : typeof self === "object" ? self : typeof this === "object" ? this : f();
32
- var n = i(e);
33
- if (typeof r.Reflect !== "undefined") {
34
- n = i(r.Reflect, n);
35
- }
36
- t(n, r);
37
- if (typeof r.Reflect === "undefined") {
38
- r.Reflect = e;
39
- }
40
- function i(e, t) {
41
- return function(r, n) {
42
- Object.defineProperty(e, r, {
43
- configurable: true,
44
- writable: true,
45
- value: n
46
- });
47
- if (t) t(r, n);
48
- };
49
- }
50
- function a() {
51
- try {
52
- return Function("return this;")();
53
- } catch (e) {}
54
- }
55
- function u() {
56
- try {
57
- return (0, eval)("(function() { return this; })()");
58
- } catch (e) {}
59
- }
60
- function f() {
61
- return a() || u();
62
- }
63
- })(function(e, t) {
64
- var r = Object.prototype.hasOwnProperty;
65
- var n = typeof Symbol === "function";
66
- var i = n && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
67
- var a = n && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
68
- var u = typeof Object.create === "function";
69
- var f = ({
70
- __proto__: []
71
- }) instanceof Array;
72
- var o = !u && !f;
73
- var s = {
74
- create: u ? function() {
75
- return el(Object.create(null));
76
- } : f ? function() {
77
- return el({
78
- __proto__: null
79
- });
80
- } : function() {
81
- return el({});
82
- },
83
- has: o ? function(e, t) {
84
- return r.call(e, t);
85
- } : function(e, t) {
86
- return t in e;
87
- },
88
- get: o ? function(e, t) {
89
- return r.call(e, t) ? e[t] : undefined;
90
- } : function(e, t) {
91
- return e[t];
92
- }
93
- };
94
- var c = Object.getPrototypeOf(Function);
95
- var l = typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : eo();
96
- var d = typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : es();
97
- var h = typeof WeakMap === "function" ? WeakMap : ec();
98
- var y = n ? Symbol.for("@reflect-metadata:registry") : undefined;
99
- var v = ei();
100
- var p = ea(v);
101
- function w(e, t, r, n) {
102
- if (!D(r)) {
103
- if (!B(e)) throw new TypeError();
104
- if (!G(t)) throw new TypeError();
105
- if (!G(n) && !D(n) && !C(n)) throw new TypeError();
106
- if (C(n)) n = undefined;
107
- r = q(r);
108
- return j(e, t, r, n);
109
- } else {
110
- if (!B(e)) throw new TypeError();
111
- if (!N(t)) throw new TypeError();
112
- return P(e, t);
113
- }
114
- }
115
- e("decorate", w);
116
- function _(e, t) {
117
- function r(r, n) {
118
- if (!G(r)) throw new TypeError();
119
- if (!D(n) && !Q(n)) throw new TypeError();
120
- A(e, t, r, n);
121
- }
122
- return r;
123
- }
124
- e("metadata", _);
125
- function g(e, t, r, n) {
126
- if (!G(r)) throw new TypeError();
127
- if (!D(n)) n = q(n);
128
- return A(e, t, r, n);
129
- }
130
- e("defineMetadata", g);
131
- function b(e, t, r) {
132
- if (!G(t)) throw new TypeError();
133
- if (!D(r)) r = q(r);
134
- return x(e, t, r);
135
- }
136
- e("hasMetadata", b);
137
- function O(e, t, r) {
138
- if (!G(t)) throw new TypeError();
139
- if (!D(r)) r = q(r);
140
- return R(e, t, r);
141
- }
142
- e("hasOwnMetadata", O);
143
- function k(e, t, r) {
144
- if (!G(t)) throw new TypeError();
145
- if (!D(r)) r = q(r);
146
- return S(e, t, r);
147
- }
148
- e("getMetadata", k);
149
- function M(e, t, r) {
150
- if (!G(t)) throw new TypeError();
151
- if (!D(r)) r = q(r);
152
- return K(e, t, r);
153
- }
154
- e("getOwnMetadata", M);
155
- function m(e, t) {
156
- if (!G(e)) throw new TypeError();
157
- if (!D(t)) t = q(t);
158
- return I(e, t);
159
- }
160
- e("getMetadataKeys", m);
161
- function E(e, t) {
162
- if (!G(e)) throw new TypeError();
163
- if (!D(t)) t = q(t);
164
- return F(e, t);
165
- }
166
- e("getOwnMetadataKeys", E);
167
- function T(e, t, r) {
168
- if (!G(t)) throw new TypeError();
169
- if (!D(r)) r = q(r);
170
- if (!G(t)) throw new TypeError();
171
- if (!D(r)) r = q(r);
172
- var n = ef(t, r, false);
173
- if (D(n)) return false;
174
- return n.OrdinaryDeleteMetadata(e, t, r);
175
- }
176
- e("deleteMetadata", T);
177
- function P(e, t) {
178
- for(var r = e.length - 1; r >= 0; --r){
179
- var n = e[r];
180
- var i = n(t);
181
- if (!D(i) && !C(i)) {
182
- if (!N(i)) throw new TypeError();
183
- t = i;
184
- }
185
- }
186
- return t;
187
- }
188
- function j(e, t, r, n) {
189
- for(var i = e.length - 1; i >= 0; --i){
190
- var a = e[i];
191
- var u = a(t, r, n);
192
- if (!D(u) && !C(u)) {
193
- if (!G(u)) throw new TypeError();
194
- n = u;
195
- }
196
- }
197
- return n;
198
- }
199
- function x(e, t, r) {
200
- var n = R(e, t, r);
201
- if (n) return true;
202
- var i = er(t);
203
- if (!C(i)) return x(e, i, r);
204
- return false;
205
- }
206
- function R(e, t, r) {
207
- var n = ef(t, r, false);
208
- if (D(n)) return false;
209
- return V(n.OrdinaryHasOwnMetadata(e, t, r));
210
- }
211
- function S(e, t, r) {
212
- var n = R(e, t, r);
213
- if (n) return K(e, t, r);
214
- var i = er(t);
215
- if (!C(i)) return S(e, i, r);
216
- return undefined;
217
- }
218
- function K(e, t, r) {
219
- var n = ef(t, r, false);
220
- if (D(n)) return;
221
- return n.OrdinaryGetOwnMetadata(e, t, r);
222
- }
223
- function A(e, t, r, n) {
224
- var i = ef(r, n, true);
225
- i.OrdinaryDefineOwnMetadata(e, t, r, n);
226
- }
227
- function I(e, t) {
228
- var r = F(e, t);
229
- var n = er(e);
230
- if (n === null) return r;
231
- var i = I(n, t);
232
- if (i.length <= 0) return r;
233
- if (r.length <= 0) return i;
234
- var a = new d();
235
- var u = [];
236
- for(var f = 0, o = r; f < o.length; f++){
237
- var s = o[f];
238
- var c = a.has(s);
239
- if (!c) {
240
- a.add(s);
241
- u.push(s);
242
- }
243
- }
244
- for(var l = 0, h = i; l < h.length; l++){
245
- var s = h[l];
246
- var c = a.has(s);
247
- if (!c) {
248
- a.add(s);
249
- u.push(s);
250
- }
251
- }
252
- return u;
253
- }
254
- function F(e, t) {
255
- var r = ef(e, t, false);
256
- if (!r) {
257
- return [];
258
- }
259
- return r.OrdinaryOwnMetadataKeys(e, t);
260
- }
261
- function z(e) {
262
- if (e === null) return 1;
263
- switch(typeof e){
264
- case "undefined":
265
- return 0;
266
- case "boolean":
267
- return 2;
268
- case "string":
269
- return 3;
270
- case "symbol":
271
- return 4;
272
- case "number":
273
- return 5;
274
- case "object":
275
- return e === null ? 1 : 6;
276
- default:
277
- return 6;
278
- }
279
- }
280
- function D(e) {
281
- return e === undefined;
282
- }
283
- function C(e) {
284
- return e === null;
285
- }
286
- function W(e) {
287
- return typeof e === "symbol";
288
- }
289
- function G(e) {
290
- return typeof e === "object" ? e !== null : typeof e === "function";
291
- }
292
- function H(e, t) {
293
- switch(z(e)){
294
- case 0:
295
- return e;
296
- case 1:
297
- return e;
298
- case 2:
299
- return e;
300
- case 3:
301
- return e;
302
- case 4:
303
- return e;
304
- case 5:
305
- return e;
306
- }
307
- var r = "string" ;
308
- var n = Y(e, i);
309
- if (n !== undefined) {
310
- var a = n.call(e, r);
311
- if (G(a)) throw new TypeError();
312
- return a;
313
- }
314
- return U(e);
315
- }
316
- function U(e, t) {
317
- var i, n, a; {
318
- var r = e.toString;
319
- if (J(r)) {
320
- var n = r.call(e);
321
- if (!G(n)) return n;
322
- }
323
- var i = e.valueOf;
324
- if (J(i)) {
325
- var n = i.call(e);
326
- if (!G(n)) return n;
327
- }
328
- }
329
- throw new TypeError();
330
- }
331
- function V(e) {
332
- return !!e;
333
- }
334
- function L(e) {
335
- return "" + e;
336
- }
337
- function q(e) {
338
- var t = H(e);
339
- if (W(t)) return t;
340
- return L(t);
341
- }
342
- function B(e) {
343
- return Array.isArray ? Array.isArray(e) : e instanceof Object ? e instanceof Array : Object.prototype.toString.call(e) === "[object Array]";
344
- }
345
- function J(e) {
346
- return typeof e === "function";
347
- }
348
- function N(e) {
349
- return typeof e === "function";
350
- }
351
- function Q(e) {
352
- switch(z(e)){
353
- case 3:
354
- return true;
355
- case 4:
356
- return true;
357
- default:
358
- return false;
359
- }
360
- }
361
- function X(e, t) {
362
- return e === t || e !== e && t !== t;
363
- }
364
- function Y(e, t) {
365
- var r = e[t];
366
- if (r === undefined || r === null) return undefined;
367
- if (!J(r)) throw new TypeError();
368
- return r;
369
- }
370
- function Z(e) {
371
- var t = Y(e, a);
372
- if (!J(t)) throw new TypeError();
373
- var r = t.call(e);
374
- if (!G(r)) throw new TypeError();
375
- return r;
376
- }
377
- function $(e) {
378
- return e.value;
379
- }
380
- function ee(e) {
381
- var t = e.next();
382
- return t.done ? false : t;
383
- }
384
- function et(e) {
385
- var t = e["return"];
386
- if (t) t.call(e);
387
- }
388
- function er(e) {
389
- var t = Object.getPrototypeOf(e);
390
- if (typeof e !== "function" || e === c) return t;
391
- if (t !== c) return t;
392
- var r = e.prototype;
393
- var n = r && Object.getPrototypeOf(r);
394
- if (n == null || n === Object.prototype) return t;
395
- var i = n.constructor;
396
- if (typeof i !== "function") return t;
397
- if (i === e) return t;
398
- return i;
399
- }
400
- function en() {
401
- var e;
402
- if (!D(y) && typeof t.Reflect !== "undefined" && !(y in t.Reflect) && typeof t.Reflect.defineMetadata === "function") {
403
- e = eu(t.Reflect);
404
- }
405
- var r;
406
- var n;
407
- var i;
408
- var a = new h();
409
- var u = {
410
- registerProvider: f,
411
- getProvider: s,
412
- setProvider: v
413
- };
414
- return u;
415
- function f(t) {
416
- if (!Object.isExtensible(u)) {
417
- throw new Error("Cannot add provider to a frozen registry.");
418
- }
419
- switch(true){
420
- case e === t:
421
- break;
422
- case D(r):
423
- r = t;
424
- break;
425
- case r === t:
426
- break;
427
- case D(n):
428
- n = t;
429
- break;
430
- case n === t:
431
- break;
432
- default:
433
- if (i === undefined) i = new d();
434
- i.add(t);
435
- break;
436
- }
437
- }
438
- function o(t, a) {
439
- if (!D(r)) {
440
- if (r.isProviderFor(t, a)) return r;
441
- if (!D(n)) {
442
- if (n.isProviderFor(t, a)) return r;
443
- if (!D(i)) {
444
- var u = Z(i);
445
- while(true){
446
- var f = ee(u);
447
- if (!f) {
448
- return undefined;
449
- }
450
- var o = $(f);
451
- if (o.isProviderFor(t, a)) {
452
- et(u);
453
- return o;
454
- }
455
- }
456
- }
457
- }
458
- }
459
- if (!D(e) && e.isProviderFor(t, a)) {
460
- return e;
461
- }
462
- return undefined;
463
- }
464
- function s(e, t) {
465
- var r = a.get(e);
466
- var n;
467
- if (!D(r)) {
468
- n = r.get(t);
469
- }
470
- if (!D(n)) {
471
- return n;
472
- }
473
- n = o(e, t);
474
- if (!D(n)) {
475
- if (D(r)) {
476
- r = new l();
477
- a.set(e, r);
478
- }
479
- r.set(t, n);
480
- }
481
- return n;
482
- }
483
- function c(e) {
484
- if (D(e)) throw new TypeError();
485
- return r === e || n === e || !D(i) && i.has(e);
486
- }
487
- function v(e, t, r) {
488
- if (!c(r)) {
489
- throw new Error("Metadata provider not registered.");
490
- }
491
- var n = s(e, t);
492
- if (n !== r) {
493
- if (!D(n)) {
494
- return false;
495
- }
496
- var i = a.get(e);
497
- if (D(i)) {
498
- i = new l();
499
- a.set(e, i);
500
- }
501
- i.set(t, r);
502
- }
503
- return true;
504
- }
505
- }
506
- function ei() {
507
- var e;
508
- if (!D(y) && G(t.Reflect) && Object.isExtensible(t.Reflect)) {
509
- e = t.Reflect[y];
510
- }
511
- if (D(e)) {
512
- e = en();
513
- }
514
- if (!D(y) && G(t.Reflect) && Object.isExtensible(t.Reflect)) {
515
- Object.defineProperty(t.Reflect, y, {
516
- enumerable: false,
517
- configurable: false,
518
- writable: false,
519
- value: e
520
- });
521
- }
522
- return e;
523
- }
524
- function ea(e) {
525
- var t = new h();
526
- var r = {
527
- isProviderFor: function(e, r) {
528
- var n = t.get(e);
529
- if (D(n)) return false;
530
- return n.has(r);
531
- },
532
- OrdinaryDefineOwnMetadata: u,
533
- OrdinaryHasOwnMetadata: i,
534
- OrdinaryGetOwnMetadata: a,
535
- OrdinaryOwnMetadataKeys: f,
536
- OrdinaryDeleteMetadata: o
537
- };
538
- v.registerProvider(r);
539
- return r;
540
- function n(n, i, a) {
541
- var u = t.get(n);
542
- var f = false;
543
- if (D(u)) {
544
- if (!a) return undefined;
545
- u = new l();
546
- t.set(n, u);
547
- f = true;
548
- }
549
- var o = u.get(i);
550
- if (D(o)) {
551
- if (!a) return undefined;
552
- o = new l();
553
- u.set(i, o);
554
- if (!e.setProvider(n, i, r)) {
555
- u.delete(i);
556
- if (f) {
557
- t.delete(n);
558
- }
559
- throw new Error("Wrong provider for target.");
560
- }
561
- }
562
- return o;
563
- }
564
- function i(e, t, r) {
565
- var i = n(t, r, false);
566
- if (D(i)) return false;
567
- return V(i.has(e));
568
- }
569
- function a(e, t, r) {
570
- var i = n(t, r, false);
571
- if (D(i)) return undefined;
572
- return i.get(e);
573
- }
574
- function u(e, t, r, i) {
575
- var a = n(r, i, true);
576
- a.set(e, t);
577
- }
578
- function f(e, t) {
579
- var r = [];
580
- var i = n(e, t, false);
581
- if (D(i)) return r;
582
- var a = i.keys();
583
- var u = Z(a);
584
- var f = 0;
585
- while(true){
586
- var o = ee(u);
587
- if (!o) {
588
- r.length = f;
589
- return r;
590
- }
591
- var s = $(o);
592
- try {
593
- r[f] = s;
594
- } catch (e) {
595
- try {
596
- et(u);
597
- } finally{
598
- throw e;
599
- }
600
- }
601
- f++;
602
- }
603
- }
604
- function o(e, r, i) {
605
- var a = n(r, i, false);
606
- if (D(a)) return false;
607
- if (!a.delete(e)) return false;
608
- if (a.size === 0) {
609
- var u = t.get(r);
610
- if (!D(u)) {
611
- u.delete(i);
612
- if (u.size === 0) {
613
- t.delete(u);
614
- }
615
- }
616
- }
617
- return true;
618
- }
619
- }
620
- function eu(e) {
621
- var t = e.defineMetadata, r = e.hasOwnMetadata, n = e.getOwnMetadata, i = e.getOwnMetadataKeys, a = e.deleteMetadata;
622
- var u = new h();
623
- var f = {
624
- isProviderFor: function(e, t) {
625
- var r = u.get(e);
626
- if (!D(r) && r.has(t)) {
627
- return true;
628
- }
629
- if (i(e, t).length) {
630
- if (D(r)) {
631
- r = new d();
632
- u.set(e, r);
633
- }
634
- r.add(t);
635
- return true;
636
- }
637
- return false;
638
- },
639
- OrdinaryDefineOwnMetadata: t,
640
- OrdinaryHasOwnMetadata: r,
641
- OrdinaryGetOwnMetadata: n,
642
- OrdinaryOwnMetadataKeys: i,
643
- OrdinaryDeleteMetadata: a
644
- };
645
- return f;
646
- }
647
- function ef(e, t, r) {
648
- var n = v.getProvider(e, t);
649
- if (!D(n)) {
650
- return n;
651
- }
652
- if (r) {
653
- if (v.setProvider(e, t, p)) {
654
- return p;
655
- }
656
- throw new Error("Illegal state.");
657
- }
658
- return undefined;
659
- }
660
- function eo() {
661
- var e = {};
662
- var t = [];
663
- var r = function() {
664
- function e(e, t, r) {
665
- this._index = 0;
666
- this._keys = e;
667
- this._values = t;
668
- this._selector = r;
669
- }
670
- e.prototype["@@iterator"] = function() {
671
- return this;
672
- };
673
- e.prototype[a] = function() {
674
- return this;
675
- };
676
- e.prototype.next = function() {
677
- var e = this._index;
678
- if (e >= 0 && e < this._keys.length) {
679
- var r = this._selector(this._keys[e], this._values[e]);
680
- if (e + 1 >= this._keys.length) {
681
- this._index = -1;
682
- this._keys = t;
683
- this._values = t;
684
- } else {
685
- this._index++;
686
- }
687
- return {
688
- value: r,
689
- done: false
690
- };
691
- }
692
- return {
693
- value: undefined,
694
- done: true
695
- };
696
- };
697
- e.prototype.throw = function(e) {
698
- if (this._index >= 0) {
699
- this._index = -1;
700
- this._keys = t;
701
- this._values = t;
702
- }
703
- throw e;
704
- };
705
- e.prototype.return = function(e) {
706
- if (this._index >= 0) {
707
- this._index = -1;
708
- this._keys = t;
709
- this._values = t;
710
- }
711
- return {
712
- value: e,
713
- done: true
714
- };
715
- };
716
- return e;
717
- }();
718
- var n = function() {
719
- function t() {
720
- this._keys = [];
721
- this._values = [];
722
- this._cacheKey = e;
723
- this._cacheIndex = -2;
724
- }
725
- Object.defineProperty(t.prototype, "size", {
726
- get: function() {
727
- return this._keys.length;
728
- },
729
- enumerable: true,
730
- configurable: true
731
- });
732
- t.prototype.has = function(e) {
733
- return this._find(e, false) >= 0;
734
- };
735
- t.prototype.get = function(e) {
736
- var t = this._find(e, false);
737
- return t >= 0 ? this._values[t] : undefined;
738
- };
739
- t.prototype.set = function(e, t) {
740
- var r = this._find(e, true);
741
- this._values[r] = t;
742
- return this;
743
- };
744
- t.prototype.delete = function(t) {
745
- var r = this._find(t, false);
746
- if (r >= 0) {
747
- var n = this._keys.length;
748
- for(var i = r + 1; i < n; i++){
749
- this._keys[i - 1] = this._keys[i];
750
- this._values[i - 1] = this._values[i];
751
- }
752
- this._keys.length--;
753
- this._values.length--;
754
- if (X(t, this._cacheKey)) {
755
- this._cacheKey = e;
756
- this._cacheIndex = -2;
757
- }
758
- return true;
759
- }
760
- return false;
761
- };
762
- t.prototype.clear = function() {
763
- this._keys.length = 0;
764
- this._values.length = 0;
765
- this._cacheKey = e;
766
- this._cacheIndex = -2;
767
- };
768
- t.prototype.keys = function() {
769
- return new r(this._keys, this._values, i);
770
- };
771
- t.prototype.values = function() {
772
- return new r(this._keys, this._values, u);
773
- };
774
- t.prototype.entries = function() {
775
- return new r(this._keys, this._values, f);
776
- };
777
- t.prototype["@@iterator"] = function() {
778
- return this.entries();
779
- };
780
- t.prototype[a] = function() {
781
- return this.entries();
782
- };
783
- t.prototype._find = function(e, t) {
784
- if (!X(this._cacheKey, e)) {
785
- this._cacheIndex = -1;
786
- for(var r = 0; r < this._keys.length; r++){
787
- if (X(this._keys[r], e)) {
788
- this._cacheIndex = r;
789
- break;
790
- }
791
- }
792
- }
793
- if (this._cacheIndex < 0 && t) {
794
- this._cacheIndex = this._keys.length;
795
- this._keys.push(e);
796
- this._values.push(undefined);
797
- }
798
- return this._cacheIndex;
799
- };
800
- return t;
801
- }();
802
- return n;
803
- function i(e, t) {
804
- return e;
805
- }
806
- function u(e, t) {
807
- return t;
808
- }
809
- function f(e, t) {
810
- return [
811
- e,
812
- t
813
- ];
814
- }
815
- }
816
- function es() {
817
- var e = function() {
818
- function e() {
819
- this._map = new l();
820
- }
821
- Object.defineProperty(e.prototype, "size", {
822
- get: function() {
823
- return this._map.size;
824
- },
825
- enumerable: true,
826
- configurable: true
827
- });
828
- e.prototype.has = function(e) {
829
- return this._map.has(e);
830
- };
831
- e.prototype.add = function(e) {
832
- return this._map.set(e, e), this;
833
- };
834
- e.prototype.delete = function(e) {
835
- return this._map.delete(e);
836
- };
837
- e.prototype.clear = function() {
838
- this._map.clear();
839
- };
840
- e.prototype.keys = function() {
841
- return this._map.keys();
842
- };
843
- e.prototype.values = function() {
844
- return this._map.keys();
845
- };
846
- e.prototype.entries = function() {
847
- return this._map.entries();
848
- };
849
- e.prototype["@@iterator"] = function() {
850
- return this.keys();
851
- };
852
- e.prototype[a] = function() {
853
- return this.keys();
854
- };
855
- return e;
856
- }();
857
- return e;
858
- }
859
- function ec() {
860
- var e = 16;
861
- var t = s.create();
862
- var n = i();
863
- return function() {
864
- function e() {
865
- this._key = i();
866
- }
867
- e.prototype.has = function(e) {
868
- var t = a(e, false);
869
- return t !== undefined ? s.has(t, this._key) : false;
870
- };
871
- e.prototype.get = function(e) {
872
- var t = a(e, false);
873
- return t !== undefined ? s.get(t, this._key) : undefined;
874
- };
875
- e.prototype.set = function(e, t) {
876
- var r = a(e, true);
877
- r[this._key] = t;
878
- return this;
879
- };
880
- e.prototype.delete = function(e) {
881
- var t = a(e, false);
882
- return t !== undefined ? delete t[this._key] : false;
883
- };
884
- e.prototype.clear = function() {
885
- this._key = i();
886
- };
887
- return e;
888
- }();
889
- function i() {
890
- var e;
891
- do e = "@@WeakMap@@" + o();
892
- while (s.has(t, e))
893
- t[e] = true;
894
- return e;
895
- }
896
- function a(e, t) {
897
- if (!r.call(e, n)) {
898
- if (!t) return undefined;
899
- Object.defineProperty(e, n, {
900
- value: s.create()
901
- });
902
- }
903
- return e[n];
904
- }
905
- function u(e, t) {
906
- for(var r = 0; r < t; ++r)e[r] = Math.random() * 0xff | 0;
907
- return e;
908
- }
909
- function f(e) {
910
- if (typeof Uint8Array === "function") {
911
- var t = new Uint8Array(e);
912
- if (typeof crypto !== "undefined") {
913
- crypto.getRandomValues(t);
914
- } else if (typeof msCrypto !== "undefined") {
915
- msCrypto.getRandomValues(t);
916
- } else {
917
- u(t, e);
918
- }
919
- return t;
920
- }
921
- return u(new Array(e), e);
922
- }
923
- function o() {
924
- var t = f(e);
925
- t[6] = t[6] & 0x4f | 0x40;
926
- t[8] = t[8] & 0xbf | 0x80;
927
- var r = "";
928
- for(var n = 0; n < e; ++n){
929
- var i = t[n];
930
- if (n === 4 || n === 6 || n === 8) r += "-";
931
- if (i < 16) r += "0";
932
- r += i.toString(16).toLowerCase();
933
- }
934
- return r;
935
- }
936
- }
937
- function el(e) {
938
- e.__ = undefined;
939
- delete e.__;
940
- return e;
941
- }
942
- });
943
- })(e || (e = {}));
944
- return Reflect.__exports;
18
+ class Injectable {
19
+ static of(t, e, s) {
20
+ return new Injectable(t, e, s);
21
+ }
22
+ resolveTransversalToInjection(t) {
23
+ if (t.length === 1) {
24
+ return [
25
+ t[0]
26
+ ];
27
+ } else if (t.length === 2) {
28
+ const s = t[1];
29
+ if (core.isClass(s)) {
30
+ return [
31
+ t[0],
32
+ t[1]
33
+ ];
34
+ } else {
35
+ return [
36
+ t[0],
37
+ t[1]
38
+ ];
39
+ }
40
+ } else {
41
+ return [
42
+ t[0],
43
+ t[1],
44
+ t[2]
45
+ ];
46
+ }
47
+ }
48
+ dispose() {
49
+ if (this.singletonInstance) {
50
+ helpers.unregisterEvents(this, this.singletonInstance);
51
+ hookManager.HookManager.callHook(this.singletonInstance, 'onDispose', this.publicContext, this.mergedConfiguration || this.configuration);
52
+ core.clearInstance(this.singletonInstance, this.concrete);
53
+ }
54
+ core.clearInstance(this, Injectable);
55
+ }
56
+ build(t) {
57
+ return this.builder.build(t);
58
+ }
59
+ setSingletonInstance(t, e) {
60
+ this.singletonInstance = t;
61
+ if (e) {
62
+ this.mergedConfiguration = e;
63
+ }
64
+ }
65
+ get definition() {
66
+ if (!this.cachedDefinition) {
67
+ if (!this.concrete) {
68
+ this.cachedDefinition = {};
69
+ } else {
70
+ this.cachedDefinition = schema.getDefinition(this.concrete) || {};
71
+ }
72
+ }
73
+ return this.cachedDefinition;
74
+ }
75
+ get isSingleton() {
76
+ return this.definition.singleton ?? false;
77
+ }
78
+ get dependencies() {
79
+ return this.dependenciesIds;
80
+ }
81
+ get singleton() {
82
+ return this.singletonInstance;
83
+ }
84
+ get injections() {
85
+ if (this.cachedInjections === undefined) {
86
+ this.cachedInjections = this.definition.inject || [];
87
+ }
88
+ return this.cachedInjections;
89
+ }
90
+ get objects() {
91
+ if (this.cachedObjects === undefined) {
92
+ this.cachedObjects = this.definition.use || [];
93
+ }
94
+ return this.cachedObjects;
95
+ }
96
+ get transversals() {
97
+ if (this.cachedTransversals === undefined) {
98
+ this.cachedTransversals = this.definition.engage || [];
99
+ }
100
+ return this.cachedTransversals;
101
+ }
102
+ get tags() {
103
+ if (this.cachedTags === undefined) {
104
+ this.cachedTags = this.definition.tags || [];
105
+ }
106
+ return Array.isArray(this.cachedTags) ? this.cachedTags : [
107
+ this.cachedTags
108
+ ];
109
+ }
110
+ get globals() {
111
+ if (this.cachedGlobals === undefined) {
112
+ this.cachedGlobals = this.definition.global;
113
+ }
114
+ return this.cachedGlobals;
115
+ }
116
+ get events() {
117
+ if (this.cachedEvents === undefined) {
118
+ this.cachedEvents = this.definition.events || [];
119
+ }
120
+ return this.cachedEvents;
121
+ }
122
+ constructor(t, e, o){
123
+ this.privateContext = e;
124
+ this.publicContext = o;
125
+ this.dependenciesIds = [];
126
+ this.identifier = t.identifier;
127
+ this.concrete = t.concrete;
128
+ this.factory = t.factory;
129
+ this.configuration = t.configuration;
130
+ if (process.env.NODE_ENV !== 'production' && this.concrete && !helpers$1.isAssemblage(this.concrete)) {
131
+ throw new Error(`Class '${this.concrete.name}' is not an Assemblage.`);
132
+ }
133
+ this.builder = new injectableBuilder.InjectableBuilder(this);
134
+ if (this.concrete) {
135
+ reflection.defineCustomMetadata(constants.ReflectValue.AssemblageContext, this.publicContext, this.concrete);
136
+ for (const t of this.transversals){
137
+ const e = this.resolveTransversalToInjection(t);
138
+ this.privateContext.register(e);
139
+ }
140
+ for (const t of this.injections){
141
+ const [e] = t;
142
+ if (decorators.isTransversal(e)) {
143
+ this.privateContext.register(t);
144
+ }
145
+ }
146
+ for (const t of this.injections){
147
+ const [e] = t;
148
+ if (!decorators.isTransversal(e)) {
149
+ this.privateContext.register(t);
150
+ }
151
+ }
152
+ for (const t of this.objects){
153
+ const [e, s] = t;
154
+ const i = use.isFactory(s);
155
+ if (typeof e === 'string' || typeof e === 'symbol') {
156
+ const t = i ? s() : s;
157
+ this.privateContext.use(e, t);
158
+ continue;
159
+ }
160
+ if (this.isSingleton && i) {
161
+ const t = s();
162
+ this.privateContext.register([
163
+ e,
164
+ t
165
+ ], true);
166
+ } else {
167
+ this.privateContext.register(t, true);
168
+ }
169
+ }
170
+ const t = transversalManager.TransversalManager.getInstance(this.publicContext);
171
+ for (const e of this.transversals){
172
+ t.registerTransversal(e, this.privateContext);
173
+ }
174
+ for (const e of this.injections){
175
+ const [s] = e;
176
+ if (decorators.isTransversal(s)) {
177
+ const i = e.length > 1 ? e : [
178
+ s
179
+ ];
180
+ t.registerTransversal(i, this.privateContext);
181
+ }
182
+ }
183
+ this.dependenciesIds = this.concrete ? dependencies.resolveDependencies(this.concrete) : [];
184
+ if (this.globals) {
185
+ for(const t in this.globals){
186
+ this.privateContext.addGlobal(t, this.globals[t]);
187
+ }
188
+ }
189
+ }
190
+ if (t.instance) {
191
+ this.singletonInstance = t.instance;
192
+ } else if (t.factory) {
193
+ const e = t.factory();
194
+ this.singletonInstance = e;
195
+ }
196
+ }
945
197
  }
946
198
 
947
- exports.__require = require_Reflect;
199
+ exports.Injectable = Injectable;