@jsenv/core 29.1.19 → 29.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +3 -16
- package/dist/babel_helpers/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -5
- package/dist/babel_helpers/applyDecs/applyDecs.js +54 -241
- package/dist/babel_helpers/applyDecs2023/applyDecs2023.js +47 -195
- package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +0 -2
- package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +2 -1
- package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +0 -1
- package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +4 -14
- package/dist/babel_helpers/asyncIterator/asyncIterator.js +5 -20
- package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +2 -8
- package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +1 -3
- package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -4
- package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -1
- package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -1
- package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -1
- package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -1
- package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +0 -1
- package/dist/babel_helpers/construct/construct.js +5 -5
- package/dist/babel_helpers/createClass/createClass.js +0 -1
- package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +5 -9
- package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +2 -3
- package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +2 -8
- package/dist/babel_helpers/createSuper/createSuper.js +2 -4
- package/dist/babel_helpers/decorate/decorate.js +60 -311
- package/dist/babel_helpers/defaults/defaults.js +0 -3
- package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +2 -5
- package/dist/babel_helpers/defineProperty/defineProperty.js +0 -1
- package/dist/babel_helpers/extends/extends.js +0 -3
- package/dist/babel_helpers/get/get.js +0 -3
- package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +2 -1
- package/dist/babel_helpers/inherits/inherits.js +2 -3
- package/dist/babel_helpers/instanceof/instanceof.js +0 -1
- package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +0 -10
- package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +6 -6
- package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +0 -5
- package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +2 -5
- package/dist/babel_helpers/jsx/jsx.js +2 -8
- package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +2 -3
- package/dist/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +1 -1
- package/dist/babel_helpers/objectSpread/objectSpread.js +4 -6
- package/dist/babel_helpers/objectSpread2/objectSpread2.js +3 -8
- package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +0 -3
- package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -2
- package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +0 -1
- package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +634 -0
- package/dist/babel_helpers/set/set.js +2 -12
- package/dist/babel_helpers/superPropBase/superPropBase.js +0 -1
- package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -1
- package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -1
- package/dist/babel_helpers/toPrimitive/toPrimitive.js +1 -5
- package/dist/babel_helpers/typeof/typeof.js +0 -2
- package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +0 -7
- package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +5 -19
- package/dist/controllable_child_process.mjs +17 -27
- package/dist/controllable_worker_thread.mjs +4 -16
- package/dist/js/autoreload.js +13 -56
- package/dist/js/execute_using_dynamic_import.js +40 -164
- package/dist/js/global_this.js +2 -10
- package/dist/js/import_meta_hot.js +3 -9
- package/dist/js/new_stylesheet.js +0 -59
- package/dist/js/regenerator_runtime.js +80 -156
- package/dist/js/s.js +25 -113
- package/dist/js/s.js.map +10 -10
- package/dist/js/script_type_module_supervisor.js +4 -13
- package/dist/js/server_events_client.js +10 -38
- package/dist/js/supervisor.js +25 -167
- package/dist/js/v8_coverage.js +29 -92
- package/dist/js/ws.js +239 -717
- package/dist/main.js +761 -4155
- package/package.json +6 -6
- package/src/plugins/import_meta_url/client/import_meta_url_browser.js +1 -2
- package/src/plugins/import_meta_url/client/import_meta_url_commonjs.mjs +1 -1
- package/src/plugins/plugins.js +1 -1
- package/src/plugins/transpilation/as_js_classic/helpers-string.js +1 -0
- package/src/plugins/transpilation/babel/global_this/client/global_this.js +0 -2
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
CLASS = 10; // only used in assertValidReturnValue
|
|
24
24
|
*/
|
|
25
|
+
|
|
25
26
|
function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
|
|
26
27
|
return {
|
|
27
28
|
getMetadata: function (key) {
|
|
@@ -29,20 +30,13 @@ function old_createMetadataMethodsForProperty(metadataMap, kind, property, decor
|
|
|
29
30
|
old_assertMetadataKey(key);
|
|
30
31
|
var metadataForKey = metadataMap[key];
|
|
31
32
|
if (metadataForKey === void 0) return void 0;
|
|
32
|
-
|
|
33
|
-
if (kind === 1
|
|
34
|
-
/* PUBLIC */
|
|
35
|
-
) {
|
|
33
|
+
if (kind === 1 /* PUBLIC */) {
|
|
36
34
|
var pub = metadataForKey.public;
|
|
37
|
-
|
|
38
35
|
if (pub !== void 0) {
|
|
39
36
|
return pub[property];
|
|
40
37
|
}
|
|
41
|
-
} else if (kind === 2
|
|
42
|
-
/* PRIVATE */
|
|
43
|
-
) {
|
|
38
|
+
} else if (kind === 2 /* PRIVATE */) {
|
|
44
39
|
var priv = metadataForKey.private;
|
|
45
|
-
|
|
46
40
|
if (priv !== void 0) {
|
|
47
41
|
return priv.get(property);
|
|
48
42
|
}
|
|
@@ -54,30 +48,20 @@ function old_createMetadataMethodsForProperty(metadataMap, kind, property, decor
|
|
|
54
48
|
old_assertNotFinished(decoratorFinishedRef, "setMetadata");
|
|
55
49
|
old_assertMetadataKey(key);
|
|
56
50
|
var metadataForKey = metadataMap[key];
|
|
57
|
-
|
|
58
51
|
if (metadataForKey === void 0) {
|
|
59
52
|
metadataForKey = metadataMap[key] = {};
|
|
60
53
|
}
|
|
61
|
-
|
|
62
|
-
if (kind === 1
|
|
63
|
-
/* PUBLIC */
|
|
64
|
-
) {
|
|
54
|
+
if (kind === 1 /* PUBLIC */) {
|
|
65
55
|
var pub = metadataForKey.public;
|
|
66
|
-
|
|
67
56
|
if (pub === void 0) {
|
|
68
57
|
pub = metadataForKey.public = {};
|
|
69
58
|
}
|
|
70
|
-
|
|
71
59
|
pub[property] = value;
|
|
72
|
-
} else if (kind === 2
|
|
73
|
-
/* PRIVATE */
|
|
74
|
-
) {
|
|
60
|
+
} else if (kind === 2 /* PRIVATE */) {
|
|
75
61
|
var priv = metadataForKey.priv;
|
|
76
|
-
|
|
77
62
|
if (priv === void 0) {
|
|
78
63
|
priv = metadataForKey.private = new Map();
|
|
79
64
|
}
|
|
80
|
-
|
|
81
65
|
priv.set(property, value);
|
|
82
66
|
} else {
|
|
83
67
|
metadataForKey.constructor = value;
|
|
@@ -85,48 +69,37 @@ function old_createMetadataMethodsForProperty(metadataMap, kind, property, decor
|
|
|
85
69
|
}
|
|
86
70
|
};
|
|
87
71
|
}
|
|
88
|
-
|
|
89
72
|
function old_convertMetadataMapToFinal(obj, metadataMap) {
|
|
90
73
|
var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
91
74
|
var metadataKeys = Object.getOwnPropertySymbols(metadataMap);
|
|
92
75
|
if (metadataKeys.length === 0) return;
|
|
93
|
-
|
|
94
76
|
for (var i = 0; i < metadataKeys.length; i++) {
|
|
95
77
|
var key = metadataKeys[i];
|
|
96
78
|
var metaForKey = metadataMap[key];
|
|
97
79
|
var parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null;
|
|
98
80
|
var pub = metaForKey.public;
|
|
99
81
|
var parentPub = parentMetaForKey ? parentMetaForKey.public : null;
|
|
100
|
-
|
|
101
82
|
if (pub && parentPub) {
|
|
102
83
|
Object.setPrototypeOf(pub, parentPub);
|
|
103
84
|
}
|
|
104
|
-
|
|
105
85
|
var priv = metaForKey.private;
|
|
106
|
-
|
|
107
86
|
if (priv) {
|
|
108
87
|
var privArr = Array.from(priv.values());
|
|
109
88
|
var parentPriv = parentMetaForKey ? parentMetaForKey.private : null;
|
|
110
|
-
|
|
111
89
|
if (parentPriv) {
|
|
112
90
|
privArr = privArr.concat(parentPriv);
|
|
113
91
|
}
|
|
114
|
-
|
|
115
92
|
metaForKey.private = privArr;
|
|
116
93
|
}
|
|
117
|
-
|
|
118
94
|
if (parentMetaForKey) {
|
|
119
95
|
Object.setPrototypeOf(metaForKey, parentMetaForKey);
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
|
-
|
|
123
98
|
if (parentMetadataMap) {
|
|
124
99
|
Object.setPrototypeOf(metadataMap, parentMetadataMap);
|
|
125
100
|
}
|
|
126
|
-
|
|
127
101
|
obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
|
|
128
102
|
}
|
|
129
|
-
|
|
130
103
|
function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
131
104
|
return function addInitializer(initializer) {
|
|
132
105
|
old_assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
@@ -134,39 +107,24 @@ function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
|
134
107
|
initializers.push(initializer);
|
|
135
108
|
};
|
|
136
109
|
}
|
|
137
|
-
|
|
138
110
|
function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
|
|
139
111
|
var kindStr;
|
|
140
|
-
|
|
141
112
|
switch (kind) {
|
|
142
|
-
case 1
|
|
143
|
-
/* ACCESSOR */
|
|
144
|
-
:
|
|
113
|
+
case 1 /* ACCESSOR */:
|
|
145
114
|
kindStr = "accessor";
|
|
146
115
|
break;
|
|
147
|
-
|
|
148
|
-
case 2
|
|
149
|
-
/* METHOD */
|
|
150
|
-
:
|
|
116
|
+
case 2 /* METHOD */:
|
|
151
117
|
kindStr = "method";
|
|
152
118
|
break;
|
|
153
|
-
|
|
154
|
-
case 3
|
|
155
|
-
/* GETTER */
|
|
156
|
-
:
|
|
119
|
+
case 3 /* GETTER */:
|
|
157
120
|
kindStr = "getter";
|
|
158
121
|
break;
|
|
159
|
-
|
|
160
|
-
case 4
|
|
161
|
-
/* SETTER */
|
|
162
|
-
:
|
|
122
|
+
case 4 /* SETTER */:
|
|
163
123
|
kindStr = "setter";
|
|
164
124
|
break;
|
|
165
|
-
|
|
166
125
|
default:
|
|
167
126
|
kindStr = "field";
|
|
168
127
|
}
|
|
169
|
-
|
|
170
128
|
var ctx = {
|
|
171
129
|
kind: kindStr,
|
|
172
130
|
name: isPrivate ? "#" + name : name,
|
|
@@ -176,166 +134,111 @@ function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStati
|
|
|
176
134
|
var decoratorFinishedRef = {
|
|
177
135
|
v: false
|
|
178
136
|
};
|
|
179
|
-
|
|
180
|
-
if (kind !== 0
|
|
181
|
-
/* FIELD */
|
|
182
|
-
) {
|
|
137
|
+
if (kind !== 0 /* FIELD */) {
|
|
183
138
|
ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
184
139
|
}
|
|
185
|
-
|
|
186
140
|
var metadataKind, metadataName;
|
|
187
|
-
|
|
188
141
|
if (isPrivate) {
|
|
189
|
-
metadataKind = 2
|
|
190
|
-
/* PRIVATE */
|
|
191
|
-
;
|
|
142
|
+
metadataKind = 2 /* PRIVATE */;
|
|
192
143
|
metadataName = Symbol(name);
|
|
193
144
|
var access = {};
|
|
194
|
-
|
|
195
|
-
if (kind === 0
|
|
196
|
-
/* FIELD */
|
|
197
|
-
) {
|
|
145
|
+
if (kind === 0 /* FIELD */) {
|
|
198
146
|
access.get = desc.get;
|
|
199
147
|
access.set = desc.set;
|
|
200
|
-
} else if (kind === 2
|
|
201
|
-
/* METHOD */
|
|
202
|
-
) {
|
|
148
|
+
} else if (kind === 2 /* METHOD */) {
|
|
203
149
|
access.get = function () {
|
|
204
150
|
return desc.value;
|
|
205
151
|
};
|
|
206
152
|
} else {
|
|
207
153
|
// replace with values that will go through the final getter and setter
|
|
208
|
-
if (kind === 1
|
|
209
|
-
/* ACCESSOR */
|
|
210
|
-
|| kind === 3
|
|
211
|
-
/* GETTER */
|
|
212
|
-
) {
|
|
154
|
+
if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
|
|
213
155
|
access.get = function () {
|
|
214
156
|
return desc.get.call(this);
|
|
215
157
|
};
|
|
216
158
|
}
|
|
217
|
-
|
|
218
|
-
if (kind === 1
|
|
219
|
-
/* ACCESSOR */
|
|
220
|
-
|| kind === 4
|
|
221
|
-
/* SETTER */
|
|
222
|
-
) {
|
|
159
|
+
if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
|
|
223
160
|
access.set = function (v) {
|
|
224
161
|
desc.set.call(this, v);
|
|
225
162
|
};
|
|
226
163
|
}
|
|
227
164
|
}
|
|
228
|
-
|
|
229
165
|
ctx.access = access;
|
|
230
166
|
} else {
|
|
231
|
-
metadataKind = 1
|
|
232
|
-
/* PUBLIC */
|
|
233
|
-
;
|
|
167
|
+
metadataKind = 1 /* PUBLIC */;
|
|
234
168
|
metadataName = name;
|
|
235
169
|
}
|
|
236
|
-
|
|
237
170
|
try {
|
|
238
171
|
return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
|
|
239
172
|
} finally {
|
|
240
173
|
decoratorFinishedRef.v = true;
|
|
241
174
|
}
|
|
242
175
|
}
|
|
243
|
-
|
|
244
176
|
function old_assertNotFinished(decoratorFinishedRef, fnName) {
|
|
245
177
|
if (decoratorFinishedRef.v) {
|
|
246
178
|
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
247
179
|
}
|
|
248
180
|
}
|
|
249
|
-
|
|
250
181
|
function old_assertMetadataKey(key) {
|
|
251
182
|
if (typeof key !== "symbol") {
|
|
252
183
|
throw new TypeError("Metadata keys must be symbols, received: " + key);
|
|
253
184
|
}
|
|
254
185
|
}
|
|
255
|
-
|
|
256
186
|
function old_assertCallable(fn, hint) {
|
|
257
187
|
if (typeof fn !== "function") {
|
|
258
188
|
throw new TypeError(hint + " must be a function");
|
|
259
189
|
}
|
|
260
190
|
}
|
|
261
|
-
|
|
262
191
|
function old_assertValidReturnValue(kind, value) {
|
|
263
192
|
var type = typeof value;
|
|
264
|
-
|
|
265
|
-
if (kind === 1
|
|
266
|
-
/* ACCESSOR */
|
|
267
|
-
) {
|
|
193
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
268
194
|
if (type !== "object" || value === null) {
|
|
269
195
|
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
270
196
|
}
|
|
271
|
-
|
|
272
197
|
if (value.get !== undefined) {
|
|
273
198
|
old_assertCallable(value.get, "accessor.get");
|
|
274
199
|
}
|
|
275
|
-
|
|
276
200
|
if (value.set !== undefined) {
|
|
277
201
|
old_assertCallable(value.set, "accessor.set");
|
|
278
202
|
}
|
|
279
|
-
|
|
280
203
|
if (value.init !== undefined) {
|
|
281
204
|
old_assertCallable(value.init, "accessor.init");
|
|
282
205
|
}
|
|
283
|
-
|
|
284
206
|
if (value.initializer !== undefined) {
|
|
285
207
|
old_assertCallable(value.initializer, "accessor.initializer");
|
|
286
208
|
}
|
|
287
209
|
} else if (type !== "function") {
|
|
288
210
|
var hint;
|
|
289
|
-
|
|
290
|
-
if (kind === 0
|
|
291
|
-
/* FIELD */
|
|
292
|
-
) {
|
|
211
|
+
if (kind === 0 /* FIELD */) {
|
|
293
212
|
hint = "field";
|
|
294
|
-
} else if (kind === 10
|
|
295
|
-
/* CLASS */
|
|
296
|
-
) {
|
|
213
|
+
} else if (kind === 10 /* CLASS */) {
|
|
297
214
|
hint = "class";
|
|
298
215
|
} else {
|
|
299
216
|
hint = "method";
|
|
300
217
|
}
|
|
301
|
-
|
|
302
218
|
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
303
219
|
}
|
|
304
220
|
}
|
|
305
|
-
|
|
306
221
|
function old_getInit(desc) {
|
|
307
222
|
var initializer;
|
|
308
|
-
|
|
309
223
|
if ((initializer = desc.init) == null && (initializer = desc.initializer) && typeof console !== "undefined") {
|
|
310
224
|
console.warn(".initializer has been renamed to .init as of March 2022");
|
|
311
225
|
}
|
|
312
|
-
|
|
313
226
|
return initializer;
|
|
314
227
|
}
|
|
315
|
-
|
|
316
228
|
function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
|
|
317
229
|
var decs = decInfo[0];
|
|
318
230
|
var desc, initializer, value;
|
|
319
|
-
|
|
320
231
|
if (isPrivate) {
|
|
321
|
-
if (kind === 0
|
|
322
|
-
/* FIELD */
|
|
323
|
-
|| kind === 1
|
|
324
|
-
/* ACCESSOR */
|
|
325
|
-
) {
|
|
232
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
326
233
|
desc = {
|
|
327
234
|
get: decInfo[3],
|
|
328
235
|
set: decInfo[4]
|
|
329
236
|
};
|
|
330
|
-
} else if (kind === 3
|
|
331
|
-
/* GETTER */
|
|
332
|
-
) {
|
|
237
|
+
} else if (kind === 3 /* GETTER */) {
|
|
333
238
|
desc = {
|
|
334
239
|
get: decInfo[3]
|
|
335
240
|
};
|
|
336
|
-
} else if (kind === 4
|
|
337
|
-
/* SETTER */
|
|
338
|
-
) {
|
|
241
|
+
} else if (kind === 4 /* SETTER */) {
|
|
339
242
|
desc = {
|
|
340
243
|
set: decInfo[3]
|
|
341
244
|
};
|
|
@@ -344,48 +247,29 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
344
247
|
value: decInfo[3]
|
|
345
248
|
};
|
|
346
249
|
}
|
|
347
|
-
} else if (kind !== 0
|
|
348
|
-
/* FIELD */
|
|
349
|
-
) {
|
|
250
|
+
} else if (kind !== 0 /* FIELD */) {
|
|
350
251
|
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
351
252
|
}
|
|
352
|
-
|
|
353
|
-
if (kind === 1
|
|
354
|
-
/* ACCESSOR */
|
|
355
|
-
) {
|
|
253
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
356
254
|
value = {
|
|
357
255
|
get: desc.get,
|
|
358
256
|
set: desc.set
|
|
359
257
|
};
|
|
360
|
-
} else if (kind === 2
|
|
361
|
-
/* METHOD */
|
|
362
|
-
) {
|
|
258
|
+
} else if (kind === 2 /* METHOD */) {
|
|
363
259
|
value = desc.value;
|
|
364
|
-
} else if (kind === 3
|
|
365
|
-
/* GETTER */
|
|
366
|
-
) {
|
|
260
|
+
} else if (kind === 3 /* GETTER */) {
|
|
367
261
|
value = desc.get;
|
|
368
|
-
} else if (kind === 4
|
|
369
|
-
/* SETTER */
|
|
370
|
-
) {
|
|
262
|
+
} else if (kind === 4 /* SETTER */) {
|
|
371
263
|
value = desc.set;
|
|
372
264
|
}
|
|
373
|
-
|
|
374
265
|
var newValue, get, set;
|
|
375
|
-
|
|
376
266
|
if (typeof decs === "function") {
|
|
377
267
|
newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
|
|
378
|
-
|
|
379
268
|
if (newValue !== void 0) {
|
|
380
269
|
old_assertValidReturnValue(kind, newValue);
|
|
381
|
-
|
|
382
|
-
if (kind === 0
|
|
383
|
-
/* FIELD */
|
|
384
|
-
) {
|
|
270
|
+
if (kind === 0 /* FIELD */) {
|
|
385
271
|
initializer = newValue;
|
|
386
|
-
} else if (kind === 1
|
|
387
|
-
/* ACCESSOR */
|
|
388
|
-
) {
|
|
272
|
+
} else if (kind === 1 /* ACCESSOR */) {
|
|
389
273
|
initializer = old_getInit(newValue);
|
|
390
274
|
get = newValue.get || value.get;
|
|
391
275
|
set = newValue.set || value.set;
|
|
@@ -401,18 +285,12 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
401
285
|
for (var i = decs.length - 1; i >= 0; i--) {
|
|
402
286
|
var dec = decs[i];
|
|
403
287
|
newValue = old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
|
|
404
|
-
|
|
405
288
|
if (newValue !== void 0) {
|
|
406
289
|
old_assertValidReturnValue(kind, newValue);
|
|
407
290
|
var newInit;
|
|
408
|
-
|
|
409
|
-
if (kind === 0
|
|
410
|
-
/* FIELD */
|
|
411
|
-
) {
|
|
291
|
+
if (kind === 0 /* FIELD */) {
|
|
412
292
|
newInit = newValue;
|
|
413
|
-
} else if (kind === 1
|
|
414
|
-
/* ACCESSOR */
|
|
415
|
-
) {
|
|
293
|
+
} else if (kind === 1 /* ACCESSOR */) {
|
|
416
294
|
newInit = old_getInit(newValue);
|
|
417
295
|
get = newValue.get || value.get;
|
|
418
296
|
set = newValue.set || value.set;
|
|
@@ -423,7 +301,6 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
423
301
|
} else {
|
|
424
302
|
value = newValue;
|
|
425
303
|
}
|
|
426
|
-
|
|
427
304
|
if (newInit !== void 0) {
|
|
428
305
|
if (initializer === void 0) {
|
|
429
306
|
initializer = newInit;
|
|
@@ -436,12 +313,7 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
436
313
|
}
|
|
437
314
|
}
|
|
438
315
|
}
|
|
439
|
-
|
|
440
|
-
if (kind === 0
|
|
441
|
-
/* FIELD */
|
|
442
|
-
|| kind === 1
|
|
443
|
-
/* ACCESSOR */
|
|
444
|
-
) {
|
|
316
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
445
317
|
if (initializer === void 0) {
|
|
446
318
|
// If the initializer was void 0, sub in a dummy initializer
|
|
447
319
|
initializer = function (instance, init) {
|
|
@@ -449,62 +321,41 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
449
321
|
};
|
|
450
322
|
} else if (typeof initializer !== "function") {
|
|
451
323
|
var ownInitializers = initializer;
|
|
452
|
-
|
|
453
324
|
initializer = function (instance, init) {
|
|
454
325
|
var value = init;
|
|
455
|
-
|
|
456
326
|
for (var i = 0; i < ownInitializers.length; i++) {
|
|
457
327
|
value = ownInitializers[i].call(instance, value);
|
|
458
328
|
}
|
|
459
|
-
|
|
460
329
|
return value;
|
|
461
330
|
};
|
|
462
331
|
} else {
|
|
463
332
|
var originalInitializer = initializer;
|
|
464
|
-
|
|
465
333
|
initializer = function (instance, init) {
|
|
466
334
|
return originalInitializer.call(instance, init);
|
|
467
335
|
};
|
|
468
336
|
}
|
|
469
|
-
|
|
470
337
|
ret.push(initializer);
|
|
471
338
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
/* FIELD */
|
|
475
|
-
) {
|
|
476
|
-
if (kind === 1
|
|
477
|
-
/* ACCESSOR */
|
|
478
|
-
) {
|
|
339
|
+
if (kind !== 0 /* FIELD */) {
|
|
340
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
479
341
|
desc.get = value.get;
|
|
480
342
|
desc.set = value.set;
|
|
481
|
-
} else if (kind === 2
|
|
482
|
-
/* METHOD */
|
|
483
|
-
) {
|
|
343
|
+
} else if (kind === 2 /* METHOD */) {
|
|
484
344
|
desc.value = value;
|
|
485
|
-
} else if (kind === 3
|
|
486
|
-
/* GETTER */
|
|
487
|
-
) {
|
|
345
|
+
} else if (kind === 3 /* GETTER */) {
|
|
488
346
|
desc.get = value;
|
|
489
|
-
} else if (kind === 4
|
|
490
|
-
/* SETTER */
|
|
491
|
-
) {
|
|
347
|
+
} else if (kind === 4 /* SETTER */) {
|
|
492
348
|
desc.set = value;
|
|
493
349
|
}
|
|
494
|
-
|
|
495
350
|
if (isPrivate) {
|
|
496
|
-
if (kind === 1
|
|
497
|
-
/* ACCESSOR */
|
|
498
|
-
) {
|
|
351
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
499
352
|
ret.push(function (instance, args) {
|
|
500
353
|
return value.get.call(instance, args);
|
|
501
354
|
});
|
|
502
355
|
ret.push(function (instance, args) {
|
|
503
356
|
return value.set.call(instance, args);
|
|
504
357
|
});
|
|
505
|
-
} else if (kind === 2
|
|
506
|
-
/* METHOD */
|
|
507
|
-
) {
|
|
358
|
+
} else if (kind === 2 /* METHOD */) {
|
|
508
359
|
ret.push(value);
|
|
509
360
|
} else {
|
|
510
361
|
ret.push(function (instance, args) {
|
|
@@ -516,128 +367,91 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
|
|
|
516
367
|
}
|
|
517
368
|
}
|
|
518
369
|
}
|
|
519
|
-
|
|
520
370
|
function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
|
|
521
371
|
var protoInitializers;
|
|
522
372
|
var staticInitializers;
|
|
523
373
|
var existingProtoNonFields = new Map();
|
|
524
374
|
var existingStaticNonFields = new Map();
|
|
525
|
-
|
|
526
375
|
for (var i = 0; i < decInfos.length; i++) {
|
|
527
|
-
var decInfo = decInfos[i];
|
|
376
|
+
var decInfo = decInfos[i];
|
|
528
377
|
|
|
378
|
+
// skip computed property names
|
|
529
379
|
if (!Array.isArray(decInfo)) continue;
|
|
530
380
|
var kind = decInfo[1];
|
|
531
381
|
var name = decInfo[2];
|
|
532
382
|
var isPrivate = decInfo.length > 3;
|
|
533
|
-
var isStatic = kind >= 5;
|
|
534
|
-
/* STATIC */
|
|
535
|
-
|
|
383
|
+
var isStatic = kind >= 5; /* STATIC */
|
|
536
384
|
var base;
|
|
537
385
|
var metadataMap;
|
|
538
386
|
var initializers;
|
|
539
|
-
|
|
540
387
|
if (isStatic) {
|
|
541
388
|
base = Class;
|
|
542
389
|
metadataMap = staticMetadataMap;
|
|
543
|
-
kind = kind - 5
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
if (kind !== 0
|
|
548
|
-
/* FIELD */
|
|
549
|
-
) {
|
|
390
|
+
kind = kind - 5 /* STATIC */;
|
|
391
|
+
// initialize staticInitializers when we see a non-field static member
|
|
392
|
+
if (kind !== 0 /* FIELD */) {
|
|
550
393
|
staticInitializers = staticInitializers || [];
|
|
551
394
|
initializers = staticInitializers;
|
|
552
395
|
}
|
|
553
396
|
} else {
|
|
554
397
|
base = Class.prototype;
|
|
555
|
-
metadataMap = protoMetadataMap;
|
|
556
|
-
|
|
557
|
-
if (kind !== 0
|
|
558
|
-
/* FIELD */
|
|
559
|
-
) {
|
|
398
|
+
metadataMap = protoMetadataMap;
|
|
399
|
+
// initialize protoInitializers when we see a non-field member
|
|
400
|
+
if (kind !== 0 /* FIELD */) {
|
|
560
401
|
protoInitializers = protoInitializers || [];
|
|
561
402
|
initializers = protoInitializers;
|
|
562
403
|
}
|
|
563
404
|
}
|
|
564
|
-
|
|
565
|
-
if (kind !== 0
|
|
566
|
-
/* FIELD */
|
|
567
|
-
&& !isPrivate) {
|
|
405
|
+
if (kind !== 0 /* FIELD */ && !isPrivate) {
|
|
568
406
|
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
569
407
|
var existingKind = existingNonFields.get(name) || 0;
|
|
570
|
-
|
|
571
|
-
if (existingKind === true || existingKind === 3
|
|
572
|
-
/* GETTER */
|
|
573
|
-
&& kind !== 4
|
|
574
|
-
/* SETTER */
|
|
575
|
-
|| existingKind === 4
|
|
576
|
-
/* SETTER */
|
|
577
|
-
&& kind !== 3
|
|
578
|
-
/* GETTER */
|
|
579
|
-
) {
|
|
408
|
+
if (existingKind === true || existingKind === 3 /* GETTER */ && kind !== 4 /* SETTER */ || existingKind === 4 /* SETTER */ && kind !== 3 /* GETTER */) {
|
|
580
409
|
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);
|
|
581
|
-
} else if (!existingKind && kind > 2
|
|
582
|
-
/* METHOD */
|
|
583
|
-
) {
|
|
410
|
+
} else if (!existingKind && kind > 2 /* METHOD */) {
|
|
584
411
|
existingNonFields.set(name, kind);
|
|
585
412
|
} else {
|
|
586
413
|
existingNonFields.set(name, true);
|
|
587
414
|
}
|
|
588
415
|
}
|
|
589
|
-
|
|
590
416
|
old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
|
|
591
417
|
}
|
|
592
|
-
|
|
593
418
|
old_pushInitializers(ret, protoInitializers);
|
|
594
419
|
old_pushInitializers(ret, staticInitializers);
|
|
595
420
|
}
|
|
596
|
-
|
|
597
421
|
function old_pushInitializers(ret, initializers) {
|
|
598
422
|
if (initializers) {
|
|
599
423
|
ret.push(function (instance) {
|
|
600
424
|
for (var i = 0; i < initializers.length; i++) {
|
|
601
425
|
initializers[i].call(instance);
|
|
602
426
|
}
|
|
603
|
-
|
|
604
427
|
return instance;
|
|
605
428
|
});
|
|
606
429
|
}
|
|
607
430
|
}
|
|
608
|
-
|
|
609
431
|
function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
|
610
432
|
if (classDecs.length > 0) {
|
|
611
433
|
var initializers = [];
|
|
612
434
|
var newClass = targetClass;
|
|
613
435
|
var name = targetClass.name;
|
|
614
|
-
|
|
615
436
|
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
616
437
|
var decoratorFinishedRef = {
|
|
617
438
|
v: false
|
|
618
439
|
};
|
|
619
|
-
|
|
620
440
|
try {
|
|
621
441
|
var ctx = Object.assign({
|
|
622
442
|
kind: "class",
|
|
623
443
|
name: name,
|
|
624
444
|
addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef)
|
|
625
|
-
}, old_createMetadataMethodsForProperty(metadataMap, 0
|
|
626
|
-
/* CONSTRUCTOR */
|
|
627
|
-
, name, decoratorFinishedRef));
|
|
445
|
+
}, old_createMetadataMethodsForProperty(metadataMap, 0 /* CONSTRUCTOR */, name, decoratorFinishedRef));
|
|
628
446
|
var nextNewClass = classDecs[i](newClass, ctx);
|
|
629
447
|
} finally {
|
|
630
448
|
decoratorFinishedRef.v = true;
|
|
631
449
|
}
|
|
632
|
-
|
|
633
450
|
if (nextNewClass !== undefined) {
|
|
634
|
-
old_assertValidReturnValue(10
|
|
635
|
-
/* CLASS */
|
|
636
|
-
, nextNewClass);
|
|
451
|
+
old_assertValidReturnValue(10 /* CLASS */, nextNewClass);
|
|
637
452
|
newClass = nextNewClass;
|
|
638
453
|
}
|
|
639
454
|
}
|
|
640
|
-
|
|
641
455
|
ret.push(newClass, function () {
|
|
642
456
|
for (var i = 0; i < initializers.length; i++) {
|
|
643
457
|
initializers[i].call(newClass);
|
|
@@ -645,6 +459,7 @@ function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
|
|
645
459
|
});
|
|
646
460
|
}
|
|
647
461
|
}
|
|
462
|
+
|
|
648
463
|
/**
|
|
649
464
|
Basic usage:
|
|
650
465
|
|
|
@@ -790,8 +605,6 @@ function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
|
|
|
790
605
|
|
|
791
606
|
initializeClass(Class);
|
|
792
607
|
*/
|
|
793
|
-
|
|
794
|
-
|
|
795
608
|
export default function applyDecs(targetClass, memberDecs, classDecs) {
|
|
796
609
|
var ret = [];
|
|
797
610
|
var staticMetadataMap = {};
|