@jsenv/core 30.3.2 → 30.3.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.
- package/dist/babel_helpers/{applyDecoratorDescriptor/applyDecoratorDescriptor.js → applyDecoratedDescriptor/applyDecoratedDescriptor.js} +3 -4
- package/dist/babel_helpers/applyDecs/applyDecs.js +1 -1
- package/dist/babel_helpers/applyDecs2203/applyDecs2203.js +494 -0
- package/dist/babel_helpers/{applyDecs2023/applyDecs2023.js → applyDecs2203R/applyDecs2203R.js} +17 -10
- package/dist/main.js +4 -4
- package/package.json +6 -6
- package/src/execute/run.js +2 -2
- package/src/execute/runtimes/browsers/chromium.js +1 -1
- package/src/execute/runtimes/browsers/firefox.js +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/* eslint-disable no-void */
|
|
2
1
|
export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
3
2
|
var desc = {};
|
|
4
3
|
Object.keys(descriptor).forEach(function (key) {
|
|
5
4
|
desc[key] = descriptor[key];
|
|
6
5
|
});
|
|
7
|
-
desc.enumerable =
|
|
8
|
-
desc.configurable =
|
|
9
|
-
if (
|
|
6
|
+
desc.enumerable = !!desc.enumerable;
|
|
7
|
+
desc.configurable = !!desc.configurable;
|
|
8
|
+
if ('value' in desc || desc.initializer) {
|
|
10
9
|
desc.writable = true;
|
|
11
10
|
}
|
|
12
11
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/* @minVersion 7.19.0 */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NOTE: This is an old version of the helper, used for 2022-03 decorators.
|
|
5
|
+
* Updates should be done in applyDecs2203R.js.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
Enums are used in this file, but not assigned to vars to avoid non-hoistable values
|
|
10
|
+
|
|
11
|
+
CONSTRUCTOR = 0;
|
|
12
|
+
PUBLIC = 1;
|
|
13
|
+
PRIVATE = 2;
|
|
14
|
+
|
|
15
|
+
FIELD = 0;
|
|
16
|
+
ACCESSOR = 1;
|
|
17
|
+
METHOD = 2;
|
|
18
|
+
GETTER = 3;
|
|
19
|
+
SETTER = 4;
|
|
20
|
+
|
|
21
|
+
STATIC = 5;
|
|
22
|
+
|
|
23
|
+
CLASS = 10; // only used in assertValidReturnValue
|
|
24
|
+
*/
|
|
25
|
+
function applyDecs2203Factory() {
|
|
26
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
27
|
+
return function addInitializer(initializer) {
|
|
28
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
29
|
+
assertCallable(initializer, "An initializer");
|
|
30
|
+
initializers.push(initializer);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
|
|
34
|
+
var kindStr;
|
|
35
|
+
switch (kind) {
|
|
36
|
+
case 1 /* ACCESSOR */:
|
|
37
|
+
kindStr = "accessor";
|
|
38
|
+
break;
|
|
39
|
+
case 2 /* METHOD */:
|
|
40
|
+
kindStr = "method";
|
|
41
|
+
break;
|
|
42
|
+
case 3 /* GETTER */:
|
|
43
|
+
kindStr = "getter";
|
|
44
|
+
break;
|
|
45
|
+
case 4 /* SETTER */:
|
|
46
|
+
kindStr = "setter";
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
kindStr = "field";
|
|
50
|
+
}
|
|
51
|
+
var ctx = {
|
|
52
|
+
kind: kindStr,
|
|
53
|
+
name: isPrivate ? "#" + name : name,
|
|
54
|
+
static: isStatic,
|
|
55
|
+
private: isPrivate
|
|
56
|
+
};
|
|
57
|
+
var decoratorFinishedRef = {
|
|
58
|
+
v: false
|
|
59
|
+
};
|
|
60
|
+
if (kind !== 0 /* FIELD */) {
|
|
61
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
62
|
+
}
|
|
63
|
+
var get, set;
|
|
64
|
+
if (kind === 0 /* FIELD */) {
|
|
65
|
+
if (isPrivate) {
|
|
66
|
+
get = desc.get;
|
|
67
|
+
set = desc.set;
|
|
68
|
+
} else {
|
|
69
|
+
get = function () {
|
|
70
|
+
return this[name];
|
|
71
|
+
};
|
|
72
|
+
set = function (v) {
|
|
73
|
+
this[name] = v;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
} else if (kind === 2 /* METHOD */) {
|
|
77
|
+
get = function () {
|
|
78
|
+
return desc.value;
|
|
79
|
+
};
|
|
80
|
+
} else {
|
|
81
|
+
// replace with values that will go through the final getter and setter
|
|
82
|
+
if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
|
|
83
|
+
get = function () {
|
|
84
|
+
return desc.get.call(this);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
|
|
88
|
+
set = function (v) {
|
|
89
|
+
desc.set.call(this, v);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
ctx.access = get && set ? {
|
|
94
|
+
get: get,
|
|
95
|
+
set: set
|
|
96
|
+
} : get ? {
|
|
97
|
+
get: get
|
|
98
|
+
} : {
|
|
99
|
+
set: set
|
|
100
|
+
};
|
|
101
|
+
try {
|
|
102
|
+
return dec(value, ctx);
|
|
103
|
+
} finally {
|
|
104
|
+
decoratorFinishedRef.v = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
108
|
+
if (decoratorFinishedRef.v) {
|
|
109
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function assertCallable(fn, hint) {
|
|
113
|
+
if (typeof fn !== "function") {
|
|
114
|
+
throw new TypeError(hint + " must be a function");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function assertValidReturnValue(kind, value) {
|
|
118
|
+
var type = typeof value;
|
|
119
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
120
|
+
if (type !== "object" || value === null) {
|
|
121
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
122
|
+
}
|
|
123
|
+
if (value.get !== undefined) {
|
|
124
|
+
assertCallable(value.get, "accessor.get");
|
|
125
|
+
}
|
|
126
|
+
if (value.set !== undefined) {
|
|
127
|
+
assertCallable(value.set, "accessor.set");
|
|
128
|
+
}
|
|
129
|
+
if (value.init !== undefined) {
|
|
130
|
+
assertCallable(value.init, "accessor.init");
|
|
131
|
+
}
|
|
132
|
+
} else if (type !== "function") {
|
|
133
|
+
var hint;
|
|
134
|
+
if (kind === 0 /* FIELD */) {
|
|
135
|
+
hint = "field";
|
|
136
|
+
} else if (kind === 10 /* CLASS */) {
|
|
137
|
+
hint = "class";
|
|
138
|
+
} else {
|
|
139
|
+
hint = "method";
|
|
140
|
+
}
|
|
141
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
|
|
145
|
+
var decs = decInfo[0];
|
|
146
|
+
var desc, init, value;
|
|
147
|
+
if (isPrivate) {
|
|
148
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
149
|
+
desc = {
|
|
150
|
+
get: decInfo[3],
|
|
151
|
+
set: decInfo[4]
|
|
152
|
+
};
|
|
153
|
+
} else if (kind === 3 /* GETTER */) {
|
|
154
|
+
desc = {
|
|
155
|
+
get: decInfo[3]
|
|
156
|
+
};
|
|
157
|
+
} else if (kind === 4 /* SETTER */) {
|
|
158
|
+
desc = {
|
|
159
|
+
set: decInfo[3]
|
|
160
|
+
};
|
|
161
|
+
} else {
|
|
162
|
+
desc = {
|
|
163
|
+
value: decInfo[3]
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
} else if (kind !== 0 /* FIELD */) {
|
|
167
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
168
|
+
}
|
|
169
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
170
|
+
value = {
|
|
171
|
+
get: desc.get,
|
|
172
|
+
set: desc.set
|
|
173
|
+
};
|
|
174
|
+
} else if (kind === 2 /* METHOD */) {
|
|
175
|
+
value = desc.value;
|
|
176
|
+
} else if (kind === 3 /* GETTER */) {
|
|
177
|
+
value = desc.get;
|
|
178
|
+
} else if (kind === 4 /* SETTER */) {
|
|
179
|
+
value = desc.set;
|
|
180
|
+
}
|
|
181
|
+
var newValue, get, set;
|
|
182
|
+
if (typeof decs === "function") {
|
|
183
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value);
|
|
184
|
+
if (newValue !== void 0) {
|
|
185
|
+
assertValidReturnValue(kind, newValue);
|
|
186
|
+
if (kind === 0 /* FIELD */) {
|
|
187
|
+
init = newValue;
|
|
188
|
+
} else if (kind === 1 /* ACCESSOR */) {
|
|
189
|
+
init = newValue.init;
|
|
190
|
+
get = newValue.get || value.get;
|
|
191
|
+
set = newValue.set || value.set;
|
|
192
|
+
value = {
|
|
193
|
+
get: get,
|
|
194
|
+
set: set
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
value = newValue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
for (var i = decs.length - 1; i >= 0; i--) {
|
|
202
|
+
var dec = decs[i];
|
|
203
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value);
|
|
204
|
+
if (newValue !== void 0) {
|
|
205
|
+
assertValidReturnValue(kind, newValue);
|
|
206
|
+
var newInit;
|
|
207
|
+
if (kind === 0 /* FIELD */) {
|
|
208
|
+
newInit = newValue;
|
|
209
|
+
} else if (kind === 1 /* ACCESSOR */) {
|
|
210
|
+
newInit = newValue.init;
|
|
211
|
+
get = newValue.get || value.get;
|
|
212
|
+
set = newValue.set || value.set;
|
|
213
|
+
value = {
|
|
214
|
+
get: get,
|
|
215
|
+
set: set
|
|
216
|
+
};
|
|
217
|
+
} else {
|
|
218
|
+
value = newValue;
|
|
219
|
+
}
|
|
220
|
+
if (newInit !== void 0) {
|
|
221
|
+
if (init === void 0) {
|
|
222
|
+
init = newInit;
|
|
223
|
+
} else if (typeof init === "function") {
|
|
224
|
+
init = [init, newInit];
|
|
225
|
+
} else {
|
|
226
|
+
init.push(newInit);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
233
|
+
if (init === void 0) {
|
|
234
|
+
// If the initializer was void 0, sub in a dummy initializer
|
|
235
|
+
init = function (instance, init) {
|
|
236
|
+
return init;
|
|
237
|
+
};
|
|
238
|
+
} else if (typeof init !== "function") {
|
|
239
|
+
var ownInitializers = init;
|
|
240
|
+
init = function (instance, init) {
|
|
241
|
+
var value = init;
|
|
242
|
+
for (var i = 0; i < ownInitializers.length; i++) {
|
|
243
|
+
value = ownInitializers[i].call(instance, value);
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
var originalInitializer = init;
|
|
249
|
+
init = function (instance, init) {
|
|
250
|
+
return originalInitializer.call(instance, init);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
ret.push(init);
|
|
254
|
+
}
|
|
255
|
+
if (kind !== 0 /* FIELD */) {
|
|
256
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
257
|
+
desc.get = value.get;
|
|
258
|
+
desc.set = value.set;
|
|
259
|
+
} else if (kind === 2 /* METHOD */) {
|
|
260
|
+
desc.value = value;
|
|
261
|
+
} else if (kind === 3 /* GETTER */) {
|
|
262
|
+
desc.get = value;
|
|
263
|
+
} else if (kind === 4 /* SETTER */) {
|
|
264
|
+
desc.set = value;
|
|
265
|
+
}
|
|
266
|
+
if (isPrivate) {
|
|
267
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
268
|
+
ret.push(function (instance, args) {
|
|
269
|
+
return value.get.call(instance, args);
|
|
270
|
+
});
|
|
271
|
+
ret.push(function (instance, args) {
|
|
272
|
+
return value.set.call(instance, args);
|
|
273
|
+
});
|
|
274
|
+
} else if (kind === 2 /* METHOD */) {
|
|
275
|
+
ret.push(value);
|
|
276
|
+
} else {
|
|
277
|
+
ret.push(function (instance, args) {
|
|
278
|
+
return value.call(instance, args);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
Object.defineProperty(base, name, desc);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function applyMemberDecs(ret, Class, decInfos) {
|
|
287
|
+
var protoInitializers;
|
|
288
|
+
var staticInitializers;
|
|
289
|
+
var existingProtoNonFields = new Map();
|
|
290
|
+
var existingStaticNonFields = new Map();
|
|
291
|
+
for (var i = 0; i < decInfos.length; i++) {
|
|
292
|
+
var decInfo = decInfos[i];
|
|
293
|
+
|
|
294
|
+
// skip computed property names
|
|
295
|
+
if (!Array.isArray(decInfo)) continue;
|
|
296
|
+
var kind = decInfo[1];
|
|
297
|
+
var name = decInfo[2];
|
|
298
|
+
var isPrivate = decInfo.length > 3;
|
|
299
|
+
var isStatic = kind >= 5; /* STATIC */
|
|
300
|
+
var base;
|
|
301
|
+
var initializers;
|
|
302
|
+
if (isStatic) {
|
|
303
|
+
base = Class;
|
|
304
|
+
kind = kind - 5 /* STATIC */;
|
|
305
|
+
// initialize staticInitializers when we see a non-field static member
|
|
306
|
+
if (kind !== 0 /* FIELD */) {
|
|
307
|
+
staticInitializers = staticInitializers || [];
|
|
308
|
+
initializers = staticInitializers;
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
base = Class.prototype;
|
|
312
|
+
// initialize protoInitializers when we see a non-field member
|
|
313
|
+
if (kind !== 0 /* FIELD */) {
|
|
314
|
+
protoInitializers = protoInitializers || [];
|
|
315
|
+
initializers = protoInitializers;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (kind !== 0 /* FIELD */ && !isPrivate) {
|
|
319
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
320
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
321
|
+
if (existingKind === true || existingKind === 3 /* GETTER */ && kind !== 4 /* SETTER */ || existingKind === 4 /* SETTER */ && kind !== 3 /* GETTER */) {
|
|
322
|
+
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);
|
|
323
|
+
} else if (!existingKind && kind > 2 /* METHOD */) {
|
|
324
|
+
existingNonFields.set(name, kind);
|
|
325
|
+
} else {
|
|
326
|
+
existingNonFields.set(name, true);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
|
|
330
|
+
}
|
|
331
|
+
pushInitializers(ret, protoInitializers);
|
|
332
|
+
pushInitializers(ret, staticInitializers);
|
|
333
|
+
}
|
|
334
|
+
function pushInitializers(ret, initializers) {
|
|
335
|
+
if (initializers) {
|
|
336
|
+
ret.push(function (instance) {
|
|
337
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
338
|
+
initializers[i].call(instance);
|
|
339
|
+
}
|
|
340
|
+
return instance;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function applyClassDecs(ret, targetClass, classDecs) {
|
|
345
|
+
if (classDecs.length > 0) {
|
|
346
|
+
var initializers = [];
|
|
347
|
+
var newClass = targetClass;
|
|
348
|
+
var name = targetClass.name;
|
|
349
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
350
|
+
var decoratorFinishedRef = {
|
|
351
|
+
v: false
|
|
352
|
+
};
|
|
353
|
+
try {
|
|
354
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
355
|
+
kind: "class",
|
|
356
|
+
name: name,
|
|
357
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
|
|
358
|
+
});
|
|
359
|
+
} finally {
|
|
360
|
+
decoratorFinishedRef.v = true;
|
|
361
|
+
}
|
|
362
|
+
if (nextNewClass !== undefined) {
|
|
363
|
+
assertValidReturnValue(10 /* CLASS */, nextNewClass);
|
|
364
|
+
newClass = nextNewClass;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
ret.push(newClass, function () {
|
|
368
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
369
|
+
initializers[i].call(newClass);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
Basic usage:
|
|
377
|
+
applyDecs(
|
|
378
|
+
Class,
|
|
379
|
+
[
|
|
380
|
+
// member decorators
|
|
381
|
+
[
|
|
382
|
+
dec, // dec or array of decs
|
|
383
|
+
0, // kind of value being decorated
|
|
384
|
+
'prop', // name of public prop on class containing the value being decorated,
|
|
385
|
+
'#p', // the name of the private property (if is private, void 0 otherwise),
|
|
386
|
+
]
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
// class decorators
|
|
390
|
+
dec1, dec2
|
|
391
|
+
]
|
|
392
|
+
)
|
|
393
|
+
```
|
|
394
|
+
Fully transpiled example:
|
|
395
|
+
```js
|
|
396
|
+
@dec
|
|
397
|
+
class Class {
|
|
398
|
+
@dec
|
|
399
|
+
a = 123;
|
|
400
|
+
@dec
|
|
401
|
+
#a = 123;
|
|
402
|
+
@dec
|
|
403
|
+
@dec2
|
|
404
|
+
accessor b = 123;
|
|
405
|
+
@dec
|
|
406
|
+
accessor #b = 123;
|
|
407
|
+
@dec
|
|
408
|
+
c() { console.log('c'); }
|
|
409
|
+
@dec
|
|
410
|
+
#c() { console.log('privC'); }
|
|
411
|
+
@dec
|
|
412
|
+
get d() { console.log('d'); }
|
|
413
|
+
@dec
|
|
414
|
+
get #d() { console.log('privD'); }
|
|
415
|
+
@dec
|
|
416
|
+
set e(v) { console.log('e'); }
|
|
417
|
+
@dec
|
|
418
|
+
set #e(v) { console.log('privE'); }
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// becomes
|
|
422
|
+
let initializeInstance;
|
|
423
|
+
let initializeClass;
|
|
424
|
+
let initA;
|
|
425
|
+
let initPrivA;
|
|
426
|
+
let initB;
|
|
427
|
+
let initPrivB, getPrivB, setPrivB;
|
|
428
|
+
let privC;
|
|
429
|
+
let privD;
|
|
430
|
+
let privE;
|
|
431
|
+
let Class;
|
|
432
|
+
class _Class {
|
|
433
|
+
static {
|
|
434
|
+
let ret = applyDecs(
|
|
435
|
+
this,
|
|
436
|
+
[
|
|
437
|
+
[dec, 0, 'a'],
|
|
438
|
+
[dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
|
|
439
|
+
[[dec, dec2], 1, 'b'],
|
|
440
|
+
[dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
|
|
441
|
+
[dec, 2, 'c'],
|
|
442
|
+
[dec, 2, 'c', () => console.log('privC')],
|
|
443
|
+
[dec, 3, 'd'],
|
|
444
|
+
[dec, 3, 'd', () => console.log('privD')],
|
|
445
|
+
[dec, 4, 'e'],
|
|
446
|
+
[dec, 4, 'e', () => console.log('privE')],
|
|
447
|
+
],
|
|
448
|
+
[
|
|
449
|
+
dec
|
|
450
|
+
]
|
|
451
|
+
)
|
|
452
|
+
initA = ret[0];
|
|
453
|
+
initPrivA = ret[1];
|
|
454
|
+
initB = ret[2];
|
|
455
|
+
initPrivB = ret[3];
|
|
456
|
+
getPrivB = ret[4];
|
|
457
|
+
setPrivB = ret[5];
|
|
458
|
+
privC = ret[6];
|
|
459
|
+
privD = ret[7];
|
|
460
|
+
privE = ret[8];
|
|
461
|
+
initializeInstance = ret[9];
|
|
462
|
+
Class = ret[10]
|
|
463
|
+
initializeClass = ret[11];
|
|
464
|
+
}
|
|
465
|
+
a = (initializeInstance(this), initA(this, 123));
|
|
466
|
+
#a = initPrivA(this, 123);
|
|
467
|
+
#bData = initB(this, 123);
|
|
468
|
+
get b() { return this.#bData }
|
|
469
|
+
set b(v) { this.#bData = v }
|
|
470
|
+
#privBData = initPrivB(this, 123);
|
|
471
|
+
get #b() { return getPrivB(this); }
|
|
472
|
+
set #b(v) { setPrivB(this, v); }
|
|
473
|
+
c() { console.log('c'); }
|
|
474
|
+
#c(...args) { return privC(this, ...args) }
|
|
475
|
+
get d() { console.log('d'); }
|
|
476
|
+
get #d() { return privD(this); }
|
|
477
|
+
set e(v) { console.log('e'); }
|
|
478
|
+
set #e(v) { privE(this, v); }
|
|
479
|
+
}
|
|
480
|
+
initializeClass(Class);
|
|
481
|
+
*/
|
|
482
|
+
|
|
483
|
+
return function applyDecs2203Impl(targetClass, memberDecs, classDecs) {
|
|
484
|
+
var ret = [];
|
|
485
|
+
applyMemberDecs(ret, targetClass, memberDecs);
|
|
486
|
+
applyClassDecs(ret, targetClass, classDecs);
|
|
487
|
+
return ret;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
var applyDecs2203Impl;
|
|
491
|
+
export default function applyDecs2203(targetClass, memberDecs, classDecs) {
|
|
492
|
+
applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory();
|
|
493
|
+
return applyDecs2203Impl(targetClass, memberDecs, classDecs);
|
|
494
|
+
}
|
package/dist/babel_helpers/{applyDecs2023/applyDecs2023.js → applyDecs2203R/applyDecs2203R.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @minVersion 7.
|
|
1
|
+
/* @minVersion 7.20.0 */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
Enums are used in this file, but not assigned to vars to avoid non-hoistable values
|
|
@@ -278,7 +278,8 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, ini
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function applyMemberDecs(
|
|
281
|
+
function applyMemberDecs(Class, decInfos) {
|
|
282
|
+
var ret = [];
|
|
282
283
|
var protoInitializers;
|
|
283
284
|
var staticInitializers;
|
|
284
285
|
var existingProtoNonFields = new Map();
|
|
@@ -325,6 +326,7 @@ function applyMemberDecs(ret, Class, decInfos) {
|
|
|
325
326
|
}
|
|
326
327
|
pushInitializers(ret, protoInitializers);
|
|
327
328
|
pushInitializers(ret, staticInitializers);
|
|
329
|
+
return ret;
|
|
328
330
|
}
|
|
329
331
|
function pushInitializers(ret, initializers) {
|
|
330
332
|
if (initializers) {
|
|
@@ -336,7 +338,7 @@ function pushInitializers(ret, initializers) {
|
|
|
336
338
|
});
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
|
-
function applyClassDecs(
|
|
341
|
+
function applyClassDecs(targetClass, classDecs) {
|
|
340
342
|
if (classDecs.length > 0) {
|
|
341
343
|
var initializers = [];
|
|
342
344
|
var newClass = targetClass;
|
|
@@ -359,12 +361,14 @@ function applyClassDecs(ret, targetClass, classDecs) {
|
|
|
359
361
|
newClass = nextNewClass;
|
|
360
362
|
}
|
|
361
363
|
}
|
|
362
|
-
|
|
364
|
+
return [newClass, function () {
|
|
363
365
|
for (var i = 0; i < initializers.length; i++) {
|
|
364
366
|
initializers[i].call(newClass);
|
|
365
367
|
}
|
|
366
|
-
}
|
|
368
|
+
}];
|
|
367
369
|
}
|
|
370
|
+
// The transformer will not emit assignment when there are no class decorators,
|
|
371
|
+
// so we don't have to return an empty array here.
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
/**
|
|
@@ -512,9 +516,12 @@ function applyClassDecs(ret, targetClass, classDecs) {
|
|
|
512
516
|
|
|
513
517
|
initializeClass(Class);
|
|
514
518
|
*/
|
|
515
|
-
export default function
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
519
|
+
export default function applyDecs2203R(targetClass, memberDecs, classDecs) {
|
|
520
|
+
return {
|
|
521
|
+
e: applyMemberDecs(targetClass, memberDecs),
|
|
522
|
+
// Lazily apply class decorations so that member init locals can be properly bound.
|
|
523
|
+
get c() {
|
|
524
|
+
return applyClassDecs(targetClass, classDecs);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
520
527
|
}
|
package/dist/main.js
CHANGED
|
@@ -23,7 +23,7 @@ import { bundleJsModules } from "@jsenv/plugin-bundling";
|
|
|
23
23
|
import v8, { takeCoverage } from "node:v8";
|
|
24
24
|
import wrapAnsi from "wrap-ansi";
|
|
25
25
|
import stripAnsi from "strip-ansi";
|
|
26
|
-
import
|
|
26
|
+
import { createId } from "@paralleldrive/cuid2";
|
|
27
27
|
import { runInNewContext } from "node:vm";
|
|
28
28
|
import { fork } from "node:child_process";
|
|
29
29
|
|
|
@@ -23384,7 +23384,7 @@ const run = async ({
|
|
|
23384
23384
|
// and they can be read later at "coverageFileUrl"
|
|
23385
23385
|
let coverageFileUrl;
|
|
23386
23386
|
if (coverageEnabled) {
|
|
23387
|
-
coverageFileUrl = new URL(`./${runtime.name}/${
|
|
23387
|
+
coverageFileUrl = new URL(`./${runtime.name}/${createId()}.json`, coverageTempDirectoryUrl).href;
|
|
23388
23388
|
await ensureParentDirectories(coverageFileUrl);
|
|
23389
23389
|
if (coverageEnabled) {
|
|
23390
23390
|
result.coverageFileUrl = coverageFileUrl;
|
|
@@ -25013,7 +25013,7 @@ const registerEvent = ({
|
|
|
25013
25013
|
|
|
25014
25014
|
const chromium = createRuntimeFromPlaywright({
|
|
25015
25015
|
browserName: "chromium",
|
|
25016
|
-
browserVersion: "
|
|
25016
|
+
browserVersion: "110.0.5481.38",
|
|
25017
25017
|
// to update, check https://github.com/microsoft/playwright/releases
|
|
25018
25018
|
coveragePlaywrightAPIAvailable: true
|
|
25019
25019
|
});
|
|
@@ -25021,7 +25021,7 @@ const chromiumIsolatedTab = chromium.isolatedTab;
|
|
|
25021
25021
|
|
|
25022
25022
|
const firefox = createRuntimeFromPlaywright({
|
|
25023
25023
|
browserName: "firefox",
|
|
25024
|
-
browserVersion: "
|
|
25024
|
+
browserVersion: "108.0.2" // to update, check https://github.com/microsoft/playwright/releases
|
|
25025
25025
|
});
|
|
25026
25026
|
|
|
25027
25027
|
const firefoxIsolatedTab = firefox.isolatedTab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "30.3.
|
|
3
|
+
"version": "30.3.4",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
69
69
|
"@jsenv/abort": "4.2.4",
|
|
70
70
|
"@jsenv/ast": "3.0.0",
|
|
71
|
-
"@jsenv/babel-plugins": "1.1.
|
|
72
|
-
"@jsenv/plugin-bundling": "1.1.
|
|
71
|
+
"@jsenv/babel-plugins": "1.1.3",
|
|
72
|
+
"@jsenv/plugin-bundling": "1.1.2",
|
|
73
73
|
"@jsenv/filesystem": "4.1.9",
|
|
74
74
|
"@jsenv/importmap": "1.2.1",
|
|
75
75
|
"@jsenv/integrity": "0.0.1",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"@jsenv/url-meta": "7.0.2",
|
|
82
82
|
"@jsenv/urls": "1.2.8",
|
|
83
83
|
"@jsenv/utils": "2.0.1",
|
|
84
|
+
"@paralleldrive/cuid2": "2.0.1",
|
|
84
85
|
"construct-style-sheets-polyfill": "3.1.0",
|
|
85
|
-
"cuid": "2.1.8",
|
|
86
86
|
"istanbul-lib-coverage": "3.2.0",
|
|
87
87
|
"istanbul-lib-instrument": "5.2.1",
|
|
88
88
|
"istanbul-lib-report": "3.0.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"string-width": "5.1.2",
|
|
94
94
|
"strip-ansi": "7.0.1",
|
|
95
95
|
"v8-to-istanbul": "9.0.1",
|
|
96
|
-
"wrap-ansi": "8.0
|
|
96
|
+
"wrap-ansi": "8.1.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@babel/eslint-parser": "7.19.1",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"eslint-plugin-html": "7.1.0",
|
|
112
112
|
"eslint-plugin-import": "2.27.5",
|
|
113
113
|
"eslint-plugin-react": "7.32.1",
|
|
114
|
-
"playwright": "1.
|
|
114
|
+
"playwright": "1.30.0",
|
|
115
115
|
"prettier": "2.8.3"
|
|
116
116
|
}
|
|
117
117
|
}
|
package/src/execute/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createId } from "@paralleldrive/cuid2"
|
|
2
2
|
import { Abort, raceCallbacks } from "@jsenv/abort"
|
|
3
3
|
import { ensureParentDirectories } from "@jsenv/filesystem"
|
|
4
4
|
|
|
@@ -62,7 +62,7 @@ export const run = async ({
|
|
|
62
62
|
let coverageFileUrl
|
|
63
63
|
if (coverageEnabled) {
|
|
64
64
|
coverageFileUrl = new URL(
|
|
65
|
-
`./${runtime.name}/${
|
|
65
|
+
`./${runtime.name}/${createId()}.json`,
|
|
66
66
|
coverageTempDirectoryUrl,
|
|
67
67
|
).href
|
|
68
68
|
await ensureParentDirectories(coverageFileUrl)
|
|
@@ -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: "110.0.5481.38", // 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: "108.0.2", // to update, check https://github.com/microsoft/playwright/releases
|
|
6
6
|
})
|
|
7
7
|
export const firefoxIsolatedTab = firefox.isolatedTab
|