@jsenv/core 28.3.5 → 28.3.6
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/babel_helpers/AsyncGenerator/AsyncGenerator.js +26 -6
- package/dist/babel_helpers/applyDecs/applyDecs.js +146 -98
- package/dist/babel_helpers/applyDecs2023/applyDecs2023.js +668 -0
- package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +8 -3
- package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +5 -3
- package/dist/babel_helpers/overloadYield/overloadYield.js +11 -0
- package/dist/main.js +2 -2
- package/package.json +12 -12
- package/src/execute/runtimes/browsers/chromium.js +1 -1
- package/src/execute/runtimes/browsers/firefox.js +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* @minVersion 7.0.0-beta.0 */
|
|
2
|
+
import OverloadYield from "../overloadYield/overloadYield.js";
|
|
2
3
|
export default function AsyncGenerator(gen) {
|
|
3
4
|
var front, back;
|
|
4
5
|
|
|
@@ -25,11 +26,30 @@ export default function AsyncGenerator(gen) {
|
|
|
25
26
|
try {
|
|
26
27
|
var result = gen[key](arg);
|
|
27
28
|
var value = result.value;
|
|
28
|
-
var
|
|
29
|
-
Promise.resolve(
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
var overloaded = value instanceof OverloadYield;
|
|
30
|
+
Promise.resolve(overloaded ? value.v : value).then(function (arg) {
|
|
31
|
+
if (overloaded) {
|
|
32
|
+
// Overloaded yield requires calling into the generator twice:
|
|
33
|
+
// - first we get the iterator result wrapped in a promise
|
|
34
|
+
// (the gen[key](arg) call above)
|
|
35
|
+
// - then we await it (the Promise.resolve call above)
|
|
36
|
+
// - then we give the result back to the iterator, so that it can:
|
|
37
|
+
// * if it was an await, use its result
|
|
38
|
+
// * if it was a yield*, possibly return the `done: true` signal
|
|
39
|
+
// so that yield* knows that the iterator is finished.
|
|
40
|
+
// This needs to happen in the second call, because in the
|
|
41
|
+
// first one `done: true` was hidden in the promise and thus
|
|
42
|
+
// not visible to the (sync) yield*.
|
|
43
|
+
// The other part of this implementation is in asyncGeneratorDelegate.
|
|
44
|
+
var nextKey = key === "return" ? "return" : "next";
|
|
45
|
+
|
|
46
|
+
if (!value.k || arg.done) {
|
|
47
|
+
// await or end of yield*
|
|
48
|
+
return resume(nextKey, arg);
|
|
49
|
+
} else {
|
|
50
|
+
// yield*, not done
|
|
51
|
+
arg = gen[nextKey](arg).value;
|
|
52
|
+
}
|
|
33
53
|
}
|
|
34
54
|
|
|
35
55
|
settle(result.done ? "return" : "normal", arg);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/* @minVersion 7.
|
|
1
|
+
/* @minVersion 7.17.8 */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NOTE: This is an old version of the helper, used for 2021-12 decorators.
|
|
5
|
+
* Updates should be done in applyDecs2203.js.
|
|
6
|
+
*/
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
Enums are used in this file, but not assigned to vars to avoid non-hoistable values
|
|
@@ -14,14 +19,14 @@
|
|
|
14
19
|
SETTER = 4;
|
|
15
20
|
|
|
16
21
|
STATIC = 5;
|
|
22
|
+
|
|
23
|
+
CLASS = 10; // only used in assertValidReturnValue
|
|
17
24
|
*/
|
|
18
|
-
function
|
|
25
|
+
function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
|
|
19
26
|
return {
|
|
20
|
-
getMetadata(key) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
27
|
+
getMetadata: function (key) {
|
|
28
|
+
old_assertNotFinished(decoratorFinishedRef, "getMetadata");
|
|
29
|
+
old_assertMetadataKey(key);
|
|
25
30
|
var metadataForKey = metadataMap[key];
|
|
26
31
|
if (metadataForKey === void 0) return void 0;
|
|
27
32
|
|
|
@@ -45,12 +50,9 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
|
|
|
45
50
|
return metadataForKey.constructor;
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
throw new TypeError("Metadata keys must be symbols, received: " + key);
|
|
52
|
-
}
|
|
53
|
-
|
|
53
|
+
setMetadata: function (key, value) {
|
|
54
|
+
old_assertNotFinished(decoratorFinishedRef, "setMetadata");
|
|
55
|
+
old_assertMetadataKey(key);
|
|
54
56
|
var metadataForKey = metadataMap[key];
|
|
55
57
|
|
|
56
58
|
if (metadataForKey === void 0) {
|
|
@@ -81,11 +83,10 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
|
|
|
81
83
|
metadataForKey.constructor = value;
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
|
-
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
function
|
|
89
|
+
function old_convertMetadataMapToFinal(obj, metadataMap) {
|
|
89
90
|
var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
90
91
|
var metadataKeys = Object.getOwnPropertySymbols(metadataMap);
|
|
91
92
|
if (metadataKeys.length === 0) return;
|
|
@@ -126,14 +127,15 @@ function convertMetadataMapToFinal(obj, metadataMap) {
|
|
|
126
127
|
obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
function
|
|
130
|
+
function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
130
131
|
return function addInitializer(initializer) {
|
|
131
|
-
|
|
132
|
+
old_assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
133
|
+
old_assertCallable(initializer, "An initializer");
|
|
132
134
|
initializers.push(initializer);
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
function
|
|
138
|
+
function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
|
|
137
139
|
var kindStr;
|
|
138
140
|
|
|
139
141
|
switch (kind) {
|
|
@@ -171,11 +173,14 @@ function memberDecCtx(base, name, desc, metadataMap, initializers, kind, isStati
|
|
|
171
173
|
isStatic: isStatic,
|
|
172
174
|
isPrivate: isPrivate
|
|
173
175
|
};
|
|
176
|
+
var decoratorFinishedRef = {
|
|
177
|
+
v: false
|
|
178
|
+
};
|
|
174
179
|
|
|
175
180
|
if (kind !== 0
|
|
176
181
|
/* FIELD */
|
|
177
182
|
) {
|
|
178
|
-
ctx.addInitializer =
|
|
183
|
+
ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
var metadataKind, metadataName;
|
|
@@ -229,36 +234,86 @@ function memberDecCtx(base, name, desc, metadataMap, initializers, kind, isStati
|
|
|
229
234
|
metadataName = name;
|
|
230
235
|
}
|
|
231
236
|
|
|
232
|
-
|
|
237
|
+
try {
|
|
238
|
+
return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
|
|
239
|
+
} finally {
|
|
240
|
+
decoratorFinishedRef.v = true;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function old_assertNotFinished(decoratorFinishedRef, fnName) {
|
|
245
|
+
if (decoratorFinishedRef.v) {
|
|
246
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function old_assertMetadataKey(key) {
|
|
251
|
+
if (typeof key !== "symbol") {
|
|
252
|
+
throw new TypeError("Metadata keys must be symbols, received: " + key);
|
|
253
|
+
}
|
|
233
254
|
}
|
|
234
255
|
|
|
235
|
-
function
|
|
236
|
-
if (typeof
|
|
237
|
-
throw new
|
|
256
|
+
function old_assertCallable(fn, hint) {
|
|
257
|
+
if (typeof fn !== "function") {
|
|
258
|
+
throw new TypeError(hint + " must be a function");
|
|
238
259
|
}
|
|
239
260
|
}
|
|
240
261
|
|
|
241
|
-
function
|
|
262
|
+
function old_assertValidReturnValue(kind, value) {
|
|
242
263
|
var type = typeof value;
|
|
243
264
|
|
|
244
265
|
if (kind === 1
|
|
245
266
|
/* ACCESSOR */
|
|
246
267
|
) {
|
|
247
268
|
if (type !== "object" || value === null) {
|
|
248
|
-
throw new
|
|
269
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (value.get !== undefined) {
|
|
273
|
+
old_assertCallable(value.get, "accessor.get");
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (value.set !== undefined) {
|
|
277
|
+
old_assertCallable(value.set, "accessor.set");
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (value.init !== undefined) {
|
|
281
|
+
old_assertCallable(value.init, "accessor.init");
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (value.initializer !== undefined) {
|
|
285
|
+
old_assertCallable(value.initializer, "accessor.initializer");
|
|
249
286
|
}
|
|
250
287
|
} else if (type !== "function") {
|
|
288
|
+
var hint;
|
|
289
|
+
|
|
251
290
|
if (kind === 0
|
|
252
291
|
/* FIELD */
|
|
253
292
|
) {
|
|
254
|
-
|
|
293
|
+
hint = "field";
|
|
294
|
+
} else if (kind === 10
|
|
295
|
+
/* CLASS */
|
|
296
|
+
) {
|
|
297
|
+
hint = "class";
|
|
255
298
|
} else {
|
|
256
|
-
|
|
299
|
+
hint = "method";
|
|
257
300
|
}
|
|
301
|
+
|
|
302
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function old_getInit(desc) {
|
|
307
|
+
var initializer;
|
|
308
|
+
|
|
309
|
+
if ((initializer = desc.init) == null && (initializer = desc.initializer) && typeof console !== "undefined") {
|
|
310
|
+
console.warn(".initializer has been renamed to .init as of March 2022");
|
|
258
311
|
}
|
|
312
|
+
|
|
313
|
+
return initializer;
|
|
259
314
|
}
|
|
260
315
|
|
|
261
|
-
function
|
|
316
|
+
function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
|
|
262
317
|
var decs = decInfo[0];
|
|
263
318
|
var desc, initializer, value;
|
|
264
319
|
|
|
@@ -316,14 +371,13 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, met
|
|
|
316
371
|
value = desc.set;
|
|
317
372
|
}
|
|
318
373
|
|
|
319
|
-
var ctx = memberDecCtx(base, name, desc, metadataMap, initializers, kind, isStatic, isPrivate);
|
|
320
374
|
var newValue, get, set;
|
|
321
375
|
|
|
322
376
|
if (typeof decs === "function") {
|
|
323
|
-
newValue = decs
|
|
377
|
+
newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
|
|
324
378
|
|
|
325
379
|
if (newValue !== void 0) {
|
|
326
|
-
|
|
380
|
+
old_assertValidReturnValue(kind, newValue);
|
|
327
381
|
|
|
328
382
|
if (kind === 0
|
|
329
383
|
/* FIELD */
|
|
@@ -332,7 +386,7 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, met
|
|
|
332
386
|
} else if (kind === 1
|
|
333
387
|
/* ACCESSOR */
|
|
334
388
|
) {
|
|
335
|
-
initializer = newValue
|
|
389
|
+
initializer = old_getInit(newValue);
|
|
336
390
|
get = newValue.get || value.get;
|
|
337
391
|
set = newValue.set || value.set;
|
|
338
392
|
value = {
|
|
@@ -344,12 +398,12 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, met
|
|
|
344
398
|
}
|
|
345
399
|
}
|
|
346
400
|
} else {
|
|
347
|
-
for (var i =
|
|
401
|
+
for (var i = decs.length - 1; i >= 0; i--) {
|
|
348
402
|
var dec = decs[i];
|
|
349
|
-
newValue = dec
|
|
403
|
+
newValue = old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
|
|
350
404
|
|
|
351
405
|
if (newValue !== void 0) {
|
|
352
|
-
|
|
406
|
+
old_assertValidReturnValue(kind, newValue);
|
|
353
407
|
var newInit;
|
|
354
408
|
|
|
355
409
|
if (kind === 0
|
|
@@ -359,7 +413,7 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, met
|
|
|
359
413
|
} else if (kind === 1
|
|
360
414
|
/* ACCESSOR */
|
|
361
415
|
) {
|
|
362
|
-
newInit = newValue
|
|
416
|
+
newInit = old_getInit(newValue);
|
|
363
417
|
get = newValue.get || value.get;
|
|
364
418
|
set = newValue.set || value.set;
|
|
365
419
|
value = {
|
|
@@ -463,7 +517,7 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, met
|
|
|
463
517
|
}
|
|
464
518
|
}
|
|
465
519
|
|
|
466
|
-
function
|
|
520
|
+
function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
|
|
467
521
|
var protoInitializers;
|
|
468
522
|
var staticInitializers;
|
|
469
523
|
var existingProtoNonFields = new Map();
|
|
@@ -488,22 +542,24 @@ function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInf
|
|
|
488
542
|
metadataMap = staticMetadataMap;
|
|
489
543
|
kind = kind - 5
|
|
490
544
|
/* STATIC */
|
|
491
|
-
;
|
|
545
|
+
; // initialize staticInitializers when we see a non-field static member
|
|
492
546
|
|
|
493
|
-
if (
|
|
494
|
-
|
|
547
|
+
if (kind !== 0
|
|
548
|
+
/* FIELD */
|
|
549
|
+
) {
|
|
550
|
+
staticInitializers = staticInitializers || [];
|
|
551
|
+
initializers = staticInitializers;
|
|
495
552
|
}
|
|
496
|
-
|
|
497
|
-
initializers = staticInitializers;
|
|
498
553
|
} else {
|
|
499
554
|
base = Class.prototype;
|
|
500
|
-
metadataMap = protoMetadataMap;
|
|
555
|
+
metadataMap = protoMetadataMap; // initialize protoInitializers when we see a non-field member
|
|
501
556
|
|
|
502
|
-
if (
|
|
503
|
-
|
|
557
|
+
if (kind !== 0
|
|
558
|
+
/* FIELD */
|
|
559
|
+
) {
|
|
560
|
+
protoInitializers = protoInitializers || [];
|
|
561
|
+
initializers = protoInitializers;
|
|
504
562
|
}
|
|
505
|
-
|
|
506
|
-
initializers = protoInitializers;
|
|
507
563
|
}
|
|
508
564
|
|
|
509
565
|
if (kind !== 0
|
|
@@ -531,63 +587,62 @@ function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInf
|
|
|
531
587
|
}
|
|
532
588
|
}
|
|
533
589
|
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (protoInitializers) {
|
|
538
|
-
pushInitializers(ret, protoInitializers);
|
|
590
|
+
old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
|
|
539
591
|
}
|
|
540
592
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
593
|
+
old_pushInitializers(ret, protoInitializers);
|
|
594
|
+
old_pushInitializers(ret, staticInitializers);
|
|
544
595
|
}
|
|
545
596
|
|
|
546
|
-
function
|
|
547
|
-
if (initializers
|
|
548
|
-
// Slice the array, which means that `addInitializer` can no longer add
|
|
549
|
-
// additional initializers to the array
|
|
550
|
-
initializers = initializers.slice();
|
|
597
|
+
function old_pushInitializers(ret, initializers) {
|
|
598
|
+
if (initializers) {
|
|
551
599
|
ret.push(function (instance) {
|
|
552
600
|
for (var i = 0; i < initializers.length; i++) {
|
|
553
|
-
initializers[i].call(instance
|
|
601
|
+
initializers[i].call(instance);
|
|
554
602
|
}
|
|
555
603
|
|
|
556
|
-
return instance;
|
|
557
|
-
});
|
|
558
|
-
} else {
|
|
559
|
-
ret.push(function (instance) {
|
|
560
604
|
return instance;
|
|
561
605
|
});
|
|
562
606
|
}
|
|
563
607
|
}
|
|
564
608
|
|
|
565
|
-
function
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
, name));
|
|
576
|
-
|
|
577
|
-
for (var i = 0; i < classDecs.length; i++) {
|
|
578
|
-
newClass = classDecs[i](newClass, ctx) || newClass;
|
|
579
|
-
}
|
|
609
|
+
function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
|
610
|
+
if (classDecs.length > 0) {
|
|
611
|
+
var initializers = [];
|
|
612
|
+
var newClass = targetClass;
|
|
613
|
+
var name = targetClass.name;
|
|
614
|
+
|
|
615
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
616
|
+
var decoratorFinishedRef = {
|
|
617
|
+
v: false
|
|
618
|
+
};
|
|
580
619
|
|
|
581
|
-
|
|
620
|
+
try {
|
|
621
|
+
var ctx = Object.assign({
|
|
622
|
+
kind: "class",
|
|
623
|
+
name: name,
|
|
624
|
+
addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef)
|
|
625
|
+
}, old_createMetadataMethodsForProperty(metadataMap, 0
|
|
626
|
+
/* CONSTRUCTOR */
|
|
627
|
+
, name, decoratorFinishedRef));
|
|
628
|
+
var nextNewClass = classDecs[i](newClass, ctx);
|
|
629
|
+
} finally {
|
|
630
|
+
decoratorFinishedRef.v = true;
|
|
631
|
+
}
|
|
582
632
|
|
|
583
|
-
|
|
584
|
-
|
|
633
|
+
if (nextNewClass !== undefined) {
|
|
634
|
+
old_assertValidReturnValue(10
|
|
635
|
+
/* CLASS */
|
|
636
|
+
, nextNewClass);
|
|
637
|
+
newClass = nextNewClass;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
ret.push(newClass, function () {
|
|
585
642
|
for (var i = 0; i < initializers.length; i++) {
|
|
586
|
-
initializers[i].call(newClass
|
|
643
|
+
initializers[i].call(newClass);
|
|
587
644
|
}
|
|
588
645
|
});
|
|
589
|
-
} else {
|
|
590
|
-
ret.push(function () {});
|
|
591
646
|
}
|
|
592
647
|
}
|
|
593
648
|
/**
|
|
@@ -740,17 +795,10 @@ function applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
|
|
740
795
|
export default function applyDecs(targetClass, memberDecs, classDecs) {
|
|
741
796
|
var ret = [];
|
|
742
797
|
var staticMetadataMap = {};
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
if (classDecs) {
|
|
751
|
-
applyClassDecs(ret, targetClass, staticMetadataMap, classDecs);
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
convertMetadataMapToFinal(targetClass, staticMetadataMap);
|
|
798
|
+
var protoMetadataMap = {};
|
|
799
|
+
old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs);
|
|
800
|
+
old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap);
|
|
801
|
+
old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs);
|
|
802
|
+
old_convertMetadataMapToFinal(targetClass, staticMetadataMap);
|
|
755
803
|
return ret;
|
|
756
804
|
}
|
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
/* @minVersion 7.19.0 */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Enums are used in this file, but not assigned to vars to avoid non-hoistable values
|
|
5
|
+
|
|
6
|
+
CONSTRUCTOR = 0;
|
|
7
|
+
PUBLIC = 1;
|
|
8
|
+
PRIVATE = 2;
|
|
9
|
+
|
|
10
|
+
FIELD = 0;
|
|
11
|
+
ACCESSOR = 1;
|
|
12
|
+
METHOD = 2;
|
|
13
|
+
GETTER = 3;
|
|
14
|
+
SETTER = 4;
|
|
15
|
+
|
|
16
|
+
STATIC = 5;
|
|
17
|
+
|
|
18
|
+
CLASS = 10; // only used in assertValidReturnValue
|
|
19
|
+
*/
|
|
20
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
21
|
+
return function addInitializer(initializer) {
|
|
22
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
23
|
+
assertCallable(initializer, "An initializer");
|
|
24
|
+
initializers.push(initializer);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
|
|
29
|
+
var kindStr;
|
|
30
|
+
|
|
31
|
+
switch (kind) {
|
|
32
|
+
case 1
|
|
33
|
+
/* ACCESSOR */
|
|
34
|
+
:
|
|
35
|
+
kindStr = "accessor";
|
|
36
|
+
break;
|
|
37
|
+
|
|
38
|
+
case 2
|
|
39
|
+
/* METHOD */
|
|
40
|
+
:
|
|
41
|
+
kindStr = "method";
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
case 3
|
|
45
|
+
/* GETTER */
|
|
46
|
+
:
|
|
47
|
+
kindStr = "getter";
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 4
|
|
51
|
+
/* SETTER */
|
|
52
|
+
:
|
|
53
|
+
kindStr = "setter";
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
kindStr = "field";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var ctx = {
|
|
61
|
+
kind: kindStr,
|
|
62
|
+
name: isPrivate ? "#" + name : name,
|
|
63
|
+
static: isStatic,
|
|
64
|
+
private: isPrivate
|
|
65
|
+
};
|
|
66
|
+
var decoratorFinishedRef = {
|
|
67
|
+
v: false
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (kind !== 0
|
|
71
|
+
/* FIELD */
|
|
72
|
+
) {
|
|
73
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var get, set;
|
|
77
|
+
|
|
78
|
+
if (kind === 0
|
|
79
|
+
/* FIELD */
|
|
80
|
+
) {
|
|
81
|
+
if (isPrivate) {
|
|
82
|
+
get = desc.get;
|
|
83
|
+
set = desc.set;
|
|
84
|
+
} else {
|
|
85
|
+
get = function () {
|
|
86
|
+
return this[name];
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
set = function (v) {
|
|
90
|
+
this[name] = v;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
} else if (kind === 2
|
|
94
|
+
/* METHOD */
|
|
95
|
+
) {
|
|
96
|
+
get = function () {
|
|
97
|
+
return desc.value;
|
|
98
|
+
};
|
|
99
|
+
} else {
|
|
100
|
+
// replace with values that will go through the final getter and setter
|
|
101
|
+
if (kind === 1
|
|
102
|
+
/* ACCESSOR */
|
|
103
|
+
|| kind === 3
|
|
104
|
+
/* GETTER */
|
|
105
|
+
) {
|
|
106
|
+
get = function () {
|
|
107
|
+
return desc.get.call(this);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (kind === 1
|
|
112
|
+
/* ACCESSOR */
|
|
113
|
+
|| kind === 4
|
|
114
|
+
/* SETTER */
|
|
115
|
+
) {
|
|
116
|
+
set = function (v) {
|
|
117
|
+
desc.set.call(this, v);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ctx.access = get && set ? {
|
|
123
|
+
get: get,
|
|
124
|
+
set: set
|
|
125
|
+
} : get ? {
|
|
126
|
+
get: get
|
|
127
|
+
} : {
|
|
128
|
+
set: set
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
return dec(value, ctx);
|
|
133
|
+
} finally {
|
|
134
|
+
decoratorFinishedRef.v = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
139
|
+
if (decoratorFinishedRef.v) {
|
|
140
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function assertCallable(fn, hint) {
|
|
145
|
+
if (typeof fn !== "function") {
|
|
146
|
+
throw new TypeError(hint + " must be a function");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function assertValidReturnValue(kind, value) {
|
|
151
|
+
var type = typeof value;
|
|
152
|
+
|
|
153
|
+
if (kind === 1
|
|
154
|
+
/* ACCESSOR */
|
|
155
|
+
) {
|
|
156
|
+
if (type !== "object" || value === null) {
|
|
157
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (value.get !== undefined) {
|
|
161
|
+
assertCallable(value.get, "accessor.get");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (value.set !== undefined) {
|
|
165
|
+
assertCallable(value.set, "accessor.set");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (value.init !== undefined) {
|
|
169
|
+
assertCallable(value.init, "accessor.init");
|
|
170
|
+
}
|
|
171
|
+
} else if (type !== "function") {
|
|
172
|
+
var hint;
|
|
173
|
+
|
|
174
|
+
if (kind === 0
|
|
175
|
+
/* FIELD */
|
|
176
|
+
) {
|
|
177
|
+
hint = "field";
|
|
178
|
+
} else if (kind === 10
|
|
179
|
+
/* CLASS */
|
|
180
|
+
) {
|
|
181
|
+
hint = "class";
|
|
182
|
+
} else {
|
|
183
|
+
hint = "method";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
|
|
191
|
+
var decs = decInfo[0];
|
|
192
|
+
var desc, init, value;
|
|
193
|
+
|
|
194
|
+
if (isPrivate) {
|
|
195
|
+
if (kind === 0
|
|
196
|
+
/* FIELD */
|
|
197
|
+
|| kind === 1
|
|
198
|
+
/* ACCESSOR */
|
|
199
|
+
) {
|
|
200
|
+
desc = {
|
|
201
|
+
get: decInfo[3],
|
|
202
|
+
set: decInfo[4]
|
|
203
|
+
};
|
|
204
|
+
} else if (kind === 3
|
|
205
|
+
/* GETTER */
|
|
206
|
+
) {
|
|
207
|
+
desc = {
|
|
208
|
+
get: decInfo[3]
|
|
209
|
+
};
|
|
210
|
+
} else if (kind === 4
|
|
211
|
+
/* SETTER */
|
|
212
|
+
) {
|
|
213
|
+
desc = {
|
|
214
|
+
set: decInfo[3]
|
|
215
|
+
};
|
|
216
|
+
} else {
|
|
217
|
+
desc = {
|
|
218
|
+
value: decInfo[3]
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
} else if (kind !== 0
|
|
222
|
+
/* FIELD */
|
|
223
|
+
) {
|
|
224
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (kind === 1
|
|
228
|
+
/* ACCESSOR */
|
|
229
|
+
) {
|
|
230
|
+
value = {
|
|
231
|
+
get: desc.get,
|
|
232
|
+
set: desc.set
|
|
233
|
+
};
|
|
234
|
+
} else if (kind === 2
|
|
235
|
+
/* METHOD */
|
|
236
|
+
) {
|
|
237
|
+
value = desc.value;
|
|
238
|
+
} else if (kind === 3
|
|
239
|
+
/* GETTER */
|
|
240
|
+
) {
|
|
241
|
+
value = desc.get;
|
|
242
|
+
} else if (kind === 4
|
|
243
|
+
/* SETTER */
|
|
244
|
+
) {
|
|
245
|
+
value = desc.set;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var newValue, get, set;
|
|
249
|
+
|
|
250
|
+
if (typeof decs === "function") {
|
|
251
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value);
|
|
252
|
+
|
|
253
|
+
if (newValue !== void 0) {
|
|
254
|
+
assertValidReturnValue(kind, newValue);
|
|
255
|
+
|
|
256
|
+
if (kind === 0
|
|
257
|
+
/* FIELD */
|
|
258
|
+
) {
|
|
259
|
+
init = newValue;
|
|
260
|
+
} else if (kind === 1
|
|
261
|
+
/* ACCESSOR */
|
|
262
|
+
) {
|
|
263
|
+
init = newValue.init;
|
|
264
|
+
get = newValue.get || value.get;
|
|
265
|
+
set = newValue.set || value.set;
|
|
266
|
+
value = {
|
|
267
|
+
get: get,
|
|
268
|
+
set: set
|
|
269
|
+
};
|
|
270
|
+
} else {
|
|
271
|
+
value = newValue;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
for (var i = decs.length - 1; i >= 0; i--) {
|
|
276
|
+
var dec = decs[i];
|
|
277
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value);
|
|
278
|
+
|
|
279
|
+
if (newValue !== void 0) {
|
|
280
|
+
assertValidReturnValue(kind, newValue);
|
|
281
|
+
var newInit;
|
|
282
|
+
|
|
283
|
+
if (kind === 0
|
|
284
|
+
/* FIELD */
|
|
285
|
+
) {
|
|
286
|
+
newInit = newValue;
|
|
287
|
+
} else if (kind === 1
|
|
288
|
+
/* ACCESSOR */
|
|
289
|
+
) {
|
|
290
|
+
newInit = newValue.init;
|
|
291
|
+
get = newValue.get || value.get;
|
|
292
|
+
set = newValue.set || value.set;
|
|
293
|
+
value = {
|
|
294
|
+
get: get,
|
|
295
|
+
set: set
|
|
296
|
+
};
|
|
297
|
+
} else {
|
|
298
|
+
value = newValue;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (newInit !== void 0) {
|
|
302
|
+
if (init === void 0) {
|
|
303
|
+
init = newInit;
|
|
304
|
+
} else if (typeof init === "function") {
|
|
305
|
+
init = [init, newInit];
|
|
306
|
+
} else {
|
|
307
|
+
init.push(newInit);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (kind === 0
|
|
315
|
+
/* FIELD */
|
|
316
|
+
|| kind === 1
|
|
317
|
+
/* ACCESSOR */
|
|
318
|
+
) {
|
|
319
|
+
if (init === void 0) {
|
|
320
|
+
// If the initializer was void 0, sub in a dummy initializer
|
|
321
|
+
init = function (instance, init) {
|
|
322
|
+
return init;
|
|
323
|
+
};
|
|
324
|
+
} else if (typeof init !== "function") {
|
|
325
|
+
var ownInitializers = init;
|
|
326
|
+
|
|
327
|
+
init = function (instance, init) {
|
|
328
|
+
var value = init;
|
|
329
|
+
|
|
330
|
+
for (var i = 0; i < ownInitializers.length; i++) {
|
|
331
|
+
value = ownInitializers[i].call(instance, value);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return value;
|
|
335
|
+
};
|
|
336
|
+
} else {
|
|
337
|
+
var originalInitializer = init;
|
|
338
|
+
|
|
339
|
+
init = function (instance, init) {
|
|
340
|
+
return originalInitializer.call(instance, init);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
ret.push(init);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (kind !== 0
|
|
348
|
+
/* FIELD */
|
|
349
|
+
) {
|
|
350
|
+
if (kind === 1
|
|
351
|
+
/* ACCESSOR */
|
|
352
|
+
) {
|
|
353
|
+
desc.get = value.get;
|
|
354
|
+
desc.set = value.set;
|
|
355
|
+
} else if (kind === 2
|
|
356
|
+
/* METHOD */
|
|
357
|
+
) {
|
|
358
|
+
desc.value = value;
|
|
359
|
+
} else if (kind === 3
|
|
360
|
+
/* GETTER */
|
|
361
|
+
) {
|
|
362
|
+
desc.get = value;
|
|
363
|
+
} else if (kind === 4
|
|
364
|
+
/* SETTER */
|
|
365
|
+
) {
|
|
366
|
+
desc.set = value;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (isPrivate) {
|
|
370
|
+
if (kind === 1
|
|
371
|
+
/* ACCESSOR */
|
|
372
|
+
) {
|
|
373
|
+
ret.push(function (instance, args) {
|
|
374
|
+
return value.get.call(instance, args);
|
|
375
|
+
});
|
|
376
|
+
ret.push(function (instance, args) {
|
|
377
|
+
return value.set.call(instance, args);
|
|
378
|
+
});
|
|
379
|
+
} else if (kind === 2
|
|
380
|
+
/* METHOD */
|
|
381
|
+
) {
|
|
382
|
+
ret.push(value);
|
|
383
|
+
} else {
|
|
384
|
+
ret.push(function (instance, args) {
|
|
385
|
+
return value.call(instance, args);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
Object.defineProperty(base, name, desc);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function applyMemberDecs(ret, Class, decInfos) {
|
|
395
|
+
var protoInitializers;
|
|
396
|
+
var staticInitializers;
|
|
397
|
+
var existingProtoNonFields = new Map();
|
|
398
|
+
var existingStaticNonFields = new Map();
|
|
399
|
+
|
|
400
|
+
for (var i = 0; i < decInfos.length; i++) {
|
|
401
|
+
var decInfo = decInfos[i]; // skip computed property names
|
|
402
|
+
|
|
403
|
+
if (!Array.isArray(decInfo)) continue;
|
|
404
|
+
var kind = decInfo[1];
|
|
405
|
+
var name = decInfo[2];
|
|
406
|
+
var isPrivate = decInfo.length > 3;
|
|
407
|
+
var isStatic = kind >= 5;
|
|
408
|
+
/* STATIC */
|
|
409
|
+
|
|
410
|
+
var base;
|
|
411
|
+
var initializers;
|
|
412
|
+
|
|
413
|
+
if (isStatic) {
|
|
414
|
+
base = Class;
|
|
415
|
+
kind = kind - 5
|
|
416
|
+
/* STATIC */
|
|
417
|
+
; // initialize staticInitializers when we see a non-field static member
|
|
418
|
+
|
|
419
|
+
if (kind !== 0
|
|
420
|
+
/* FIELD */
|
|
421
|
+
) {
|
|
422
|
+
staticInitializers = staticInitializers || [];
|
|
423
|
+
initializers = staticInitializers;
|
|
424
|
+
}
|
|
425
|
+
} else {
|
|
426
|
+
base = Class.prototype; // initialize protoInitializers when we see a non-field member
|
|
427
|
+
|
|
428
|
+
if (kind !== 0
|
|
429
|
+
/* FIELD */
|
|
430
|
+
) {
|
|
431
|
+
protoInitializers = protoInitializers || [];
|
|
432
|
+
initializers = protoInitializers;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (kind !== 0
|
|
437
|
+
/* FIELD */
|
|
438
|
+
&& !isPrivate) {
|
|
439
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
440
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
441
|
+
|
|
442
|
+
if (existingKind === true || existingKind === 3
|
|
443
|
+
/* GETTER */
|
|
444
|
+
&& kind !== 4
|
|
445
|
+
/* SETTER */
|
|
446
|
+
|| existingKind === 4
|
|
447
|
+
/* SETTER */
|
|
448
|
+
&& kind !== 3
|
|
449
|
+
/* GETTER */
|
|
450
|
+
) {
|
|
451
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
452
|
+
} else if (!existingKind && kind > 2
|
|
453
|
+
/* METHOD */
|
|
454
|
+
) {
|
|
455
|
+
existingNonFields.set(name, kind);
|
|
456
|
+
} else {
|
|
457
|
+
existingNonFields.set(name, true);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
pushInitializers(ret, protoInitializers);
|
|
465
|
+
pushInitializers(ret, staticInitializers);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function pushInitializers(ret, initializers) {
|
|
469
|
+
if (initializers) {
|
|
470
|
+
ret.push(function (instance) {
|
|
471
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
472
|
+
initializers[i].call(instance);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return instance;
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function applyClassDecs(ret, targetClass, classDecs) {
|
|
481
|
+
if (classDecs.length > 0) {
|
|
482
|
+
var initializers = [];
|
|
483
|
+
var newClass = targetClass;
|
|
484
|
+
var name = targetClass.name;
|
|
485
|
+
|
|
486
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
487
|
+
var decoratorFinishedRef = {
|
|
488
|
+
v: false
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
try {
|
|
492
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
493
|
+
kind: "class",
|
|
494
|
+
name: name,
|
|
495
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
|
|
496
|
+
});
|
|
497
|
+
} finally {
|
|
498
|
+
decoratorFinishedRef.v = true;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (nextNewClass !== undefined) {
|
|
502
|
+
assertValidReturnValue(10
|
|
503
|
+
/* CLASS */
|
|
504
|
+
, nextNewClass);
|
|
505
|
+
newClass = nextNewClass;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
ret.push(newClass, function () {
|
|
510
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
511
|
+
initializers[i].call(newClass);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
Basic usage:
|
|
518
|
+
|
|
519
|
+
applyDecs(
|
|
520
|
+
Class,
|
|
521
|
+
[
|
|
522
|
+
// member decorators
|
|
523
|
+
[
|
|
524
|
+
dec, // dec or array of decs
|
|
525
|
+
0, // kind of value being decorated
|
|
526
|
+
'prop', // name of public prop on class containing the value being decorated,
|
|
527
|
+
'#p', // the name of the private property (if is private, void 0 otherwise),
|
|
528
|
+
]
|
|
529
|
+
],
|
|
530
|
+
[
|
|
531
|
+
// class decorators
|
|
532
|
+
dec1, dec2
|
|
533
|
+
]
|
|
534
|
+
)
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Fully transpiled example:
|
|
538
|
+
|
|
539
|
+
```js
|
|
540
|
+
@dec
|
|
541
|
+
class Class {
|
|
542
|
+
@dec
|
|
543
|
+
a = 123;
|
|
544
|
+
|
|
545
|
+
@dec
|
|
546
|
+
#a = 123;
|
|
547
|
+
|
|
548
|
+
@dec
|
|
549
|
+
@dec2
|
|
550
|
+
accessor b = 123;
|
|
551
|
+
|
|
552
|
+
@dec
|
|
553
|
+
accessor #b = 123;
|
|
554
|
+
|
|
555
|
+
@dec
|
|
556
|
+
c() { console.log('c'); }
|
|
557
|
+
|
|
558
|
+
@dec
|
|
559
|
+
#c() { console.log('privC'); }
|
|
560
|
+
|
|
561
|
+
@dec
|
|
562
|
+
get d() { console.log('d'); }
|
|
563
|
+
|
|
564
|
+
@dec
|
|
565
|
+
get #d() { console.log('privD'); }
|
|
566
|
+
|
|
567
|
+
@dec
|
|
568
|
+
set e(v) { console.log('e'); }
|
|
569
|
+
|
|
570
|
+
@dec
|
|
571
|
+
set #e(v) { console.log('privE'); }
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
// becomes
|
|
576
|
+
let initializeInstance;
|
|
577
|
+
let initializeClass;
|
|
578
|
+
|
|
579
|
+
let initA;
|
|
580
|
+
let initPrivA;
|
|
581
|
+
|
|
582
|
+
let initB;
|
|
583
|
+
let initPrivB, getPrivB, setPrivB;
|
|
584
|
+
|
|
585
|
+
let privC;
|
|
586
|
+
let privD;
|
|
587
|
+
let privE;
|
|
588
|
+
|
|
589
|
+
let Class;
|
|
590
|
+
class _Class {
|
|
591
|
+
static {
|
|
592
|
+
let ret = applyDecs(
|
|
593
|
+
this,
|
|
594
|
+
[
|
|
595
|
+
[dec, 0, 'a'],
|
|
596
|
+
[dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
|
|
597
|
+
[[dec, dec2], 1, 'b'],
|
|
598
|
+
[dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
|
|
599
|
+
[dec, 2, 'c'],
|
|
600
|
+
[dec, 2, 'c', () => console.log('privC')],
|
|
601
|
+
[dec, 3, 'd'],
|
|
602
|
+
[dec, 3, 'd', () => console.log('privD')],
|
|
603
|
+
[dec, 4, 'e'],
|
|
604
|
+
[dec, 4, 'e', () => console.log('privE')],
|
|
605
|
+
],
|
|
606
|
+
[
|
|
607
|
+
dec
|
|
608
|
+
]
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
initA = ret[0];
|
|
612
|
+
|
|
613
|
+
initPrivA = ret[1];
|
|
614
|
+
|
|
615
|
+
initB = ret[2];
|
|
616
|
+
|
|
617
|
+
initPrivB = ret[3];
|
|
618
|
+
getPrivB = ret[4];
|
|
619
|
+
setPrivB = ret[5];
|
|
620
|
+
|
|
621
|
+
privC = ret[6];
|
|
622
|
+
|
|
623
|
+
privD = ret[7];
|
|
624
|
+
|
|
625
|
+
privE = ret[8];
|
|
626
|
+
|
|
627
|
+
initializeInstance = ret[9];
|
|
628
|
+
|
|
629
|
+
Class = ret[10]
|
|
630
|
+
|
|
631
|
+
initializeClass = ret[11];
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
a = (initializeInstance(this), initA(this, 123));
|
|
635
|
+
|
|
636
|
+
#a = initPrivA(this, 123);
|
|
637
|
+
|
|
638
|
+
#bData = initB(this, 123);
|
|
639
|
+
get b() { return this.#bData }
|
|
640
|
+
set b(v) { this.#bData = v }
|
|
641
|
+
|
|
642
|
+
#privBData = initPrivB(this, 123);
|
|
643
|
+
get #b() { return getPrivB(this); }
|
|
644
|
+
set #b(v) { setPrivB(this, v); }
|
|
645
|
+
|
|
646
|
+
c() { console.log('c'); }
|
|
647
|
+
|
|
648
|
+
#c(...args) { return privC(this, ...args) }
|
|
649
|
+
|
|
650
|
+
get d() { console.log('d'); }
|
|
651
|
+
|
|
652
|
+
get #d() { return privD(this); }
|
|
653
|
+
|
|
654
|
+
set e(v) { console.log('e'); }
|
|
655
|
+
|
|
656
|
+
set #e(v) { privE(this, v); }
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
initializeClass(Class);
|
|
660
|
+
*/
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
export default function applyDecs2203(targetClass, memberDecs, classDecs) {
|
|
664
|
+
var ret = [];
|
|
665
|
+
applyMemberDecs(ret, targetClass, memberDecs);
|
|
666
|
+
applyClassDecs(ret, targetClass, classDecs);
|
|
667
|
+
return ret;
|
|
668
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* @minVersion 7.0.0-beta.0 */
|
|
2
|
+
import OverloadYield from "../overloadYield/overloadYield.js";
|
|
3
|
+
export default function _asyncGeneratorDelegate(inner) {
|
|
2
4
|
var iter = {},
|
|
3
|
-
|
|
5
|
+
// See the comment in AsyncGenerator to understand what this is.
|
|
6
|
+
waiting = false;
|
|
4
7
|
|
|
5
8
|
function pump(key, value) {
|
|
6
9
|
waiting = true;
|
|
@@ -9,7 +12,9 @@ export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
|
9
12
|
});
|
|
10
13
|
return {
|
|
11
14
|
done: false,
|
|
12
|
-
value:
|
|
15
|
+
value: new OverloadYield(value,
|
|
16
|
+
/* kind: delegate */
|
|
17
|
+
1)
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default function (value) {
|
|
3
|
-
return new
|
|
1
|
+
import OverloadYield from "../overloadYield/overloadYield.js";
|
|
2
|
+
export default function _awaitAsyncGenerator(value) {
|
|
3
|
+
return new OverloadYield(value,
|
|
4
|
+
/* kind: await */
|
|
5
|
+
0);
|
|
4
6
|
}
|
package/dist/main.js
CHANGED
|
@@ -28464,7 +28464,7 @@ const registerEvent = ({
|
|
|
28464
28464
|
|
|
28465
28465
|
const chromium = createRuntimeFromPlaywright({
|
|
28466
28466
|
browserName: "chromium",
|
|
28467
|
-
browserVersion: "
|
|
28467
|
+
browserVersion: "105.0.5195.19",
|
|
28468
28468
|
// to update, check https://github.com/microsoft/playwright/releases
|
|
28469
28469
|
coveragePlaywrightAPIAvailable: true
|
|
28470
28470
|
});
|
|
@@ -28472,7 +28472,7 @@ const chromiumIsolatedTab = chromium.isolatedTab;
|
|
|
28472
28472
|
|
|
28473
28473
|
const firefox = createRuntimeFromPlaywright({
|
|
28474
28474
|
browserName: "firefox",
|
|
28475
|
-
browserVersion: "
|
|
28475
|
+
browserVersion: "103.0" // to update, check https://github.com/microsoft/playwright/releases
|
|
28476
28476
|
|
|
28477
28477
|
});
|
|
28478
28478
|
const firefoxIsolatedTab = firefox.isolatedTab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "28.3.
|
|
3
|
+
"version": "28.3.6",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/plugin-proposal-dynamic-import": "7.18.6",
|
|
64
|
-
"@babel/plugin-transform-modules-systemjs": "7.
|
|
64
|
+
"@babel/plugin-transform-modules-systemjs": "7.19.0",
|
|
65
65
|
"@babel/plugin-transform-modules-umd": "7.18.6",
|
|
66
66
|
"@c88/v8-coverage": "0.1.1",
|
|
67
|
-
"@financial-times/polyfill-useragent-normaliser": "
|
|
67
|
+
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
68
68
|
"@jsenv/abort": "4.2.4",
|
|
69
|
-
"@jsenv/ast": "1.2.
|
|
70
|
-
"@jsenv/babel-plugins": "1.0.
|
|
69
|
+
"@jsenv/ast": "1.2.2",
|
|
70
|
+
"@jsenv/babel-plugins": "1.0.7",
|
|
71
71
|
"@jsenv/filesystem": "4.1.3",
|
|
72
72
|
"@jsenv/importmap": "1.2.1",
|
|
73
73
|
"@jsenv/integrity": "0.0.1",
|
|
74
74
|
"@jsenv/log": "3.3.0",
|
|
75
75
|
"@jsenv/node-esm-resolution": "0.1.0",
|
|
76
76
|
"@jsenv/server": "14.1.3",
|
|
77
|
-
"@jsenv/sourcemap": "1.0.
|
|
77
|
+
"@jsenv/sourcemap": "1.0.5",
|
|
78
78
|
"@jsenv/uneval": "1.6.0",
|
|
79
79
|
"@jsenv/url-meta": "7.0.0",
|
|
80
80
|
"@jsenv/urls": "1.2.7",
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"istanbul-lib-instrument": "5.2.0",
|
|
88
88
|
"istanbul-lib-report": "3.0.0",
|
|
89
89
|
"istanbul-reports": "3.1.5",
|
|
90
|
-
"launch-editor": "2.
|
|
90
|
+
"launch-editor": "2.6.0",
|
|
91
91
|
"pidtree": "0.6.0",
|
|
92
|
-
"rollup": "2.
|
|
92
|
+
"rollup": "2.79.0",
|
|
93
93
|
"string-width": "5.1.2",
|
|
94
94
|
"strip-ansi": "7.0.1",
|
|
95
|
-
"terser": "5.
|
|
95
|
+
"terser": "5.15.0",
|
|
96
96
|
"v8-to-istanbul": "9.0.1",
|
|
97
97
|
"wrap-ansi": "8.0.1"
|
|
98
98
|
},
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"@jsenv/https-local": "3.0.1",
|
|
106
106
|
"@jsenv/package-workspace": "0.5.0",
|
|
107
107
|
"@jsenv/performance-impact": "3.0.1",
|
|
108
|
-
"eslint": "8.
|
|
108
|
+
"eslint": "8.23.0",
|
|
109
109
|
"eslint-plugin-html": "7.1.0",
|
|
110
110
|
"eslint-plugin-import": "2.26.0",
|
|
111
|
-
"eslint-plugin-react": "7.
|
|
112
|
-
"playwright": "1.
|
|
111
|
+
"eslint-plugin-react": "7.31.7",
|
|
112
|
+
"playwright": "1.25.1",
|
|
113
113
|
"prettier": "2.7.1"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -2,7 +2,7 @@ import { createRuntimeFromPlaywright } from "./from_playwright.js"
|
|
|
2
2
|
|
|
3
3
|
export const chromium = createRuntimeFromPlaywright({
|
|
4
4
|
browserName: "chromium",
|
|
5
|
-
browserVersion: "
|
|
5
|
+
browserVersion: "105.0.5195.19", // to update, check https://github.com/microsoft/playwright/releases
|
|
6
6
|
coveragePlaywrightAPIAvailable: true,
|
|
7
7
|
})
|
|
8
8
|
export const chromiumIsolatedTab = chromium.isolatedTab
|
|
@@ -2,6 +2,6 @@ import { createRuntimeFromPlaywright } from "./from_playwright.js"
|
|
|
2
2
|
|
|
3
3
|
export const firefox = createRuntimeFromPlaywright({
|
|
4
4
|
browserName: "firefox",
|
|
5
|
-
browserVersion: "
|
|
5
|
+
browserVersion: "103.0", // to update, check https://github.com/microsoft/playwright/releases
|
|
6
6
|
})
|
|
7
7
|
export const firefoxIsolatedTab = firefox.isolatedTab
|