@jsenv/core 36.2.1 → 36.3.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.
Files changed (124) hide show
  1. package/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +45 -35
  2. package/dist/babel_helpers/AwaitValue/AwaitValue.js +3 -3
  3. package/dist/babel_helpers/applyDecoratedDescriptor/applyDecoratedDescriptor.js +13 -13
  4. package/dist/babel_helpers/applyDecs/applyDecs.js +227 -42
  5. package/dist/babel_helpers/applyDecs2203/applyDecs2203.js +559 -418
  6. package/dist/babel_helpers/applyDecs2203R/applyDecs2203R.js +235 -87
  7. package/dist/babel_helpers/applyDecs2301/applyDecs2301.js +591 -456
  8. package/dist/babel_helpers/applyDecs2305/applyDecs2305.js +681 -0
  9. package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +5 -5
  10. package/dist/babel_helpers/arrayWithHoles/arrayWithHoles.js +3 -3
  11. package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +4 -4
  12. package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +4 -4
  13. package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +12 -4
  14. package/dist/babel_helpers/asyncIterator/asyncIterator.js +13 -11
  15. package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +18 -17
  16. package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +2 -1
  17. package/dist/babel_helpers/checkInRHS/checkInRHS.js +8 -5
  18. package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +7 -7
  19. package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +3 -3
  20. package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +4 -4
  21. package/dist/babel_helpers/classCallCheck/classCallCheck.js +2 -2
  22. package/dist/babel_helpers/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +2 -2
  23. package/dist/babel_helpers/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +2 -2
  24. package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +3 -3
  25. package/dist/babel_helpers/classNameTDZError/classNameTDZError.js +2 -2
  26. package/dist/babel_helpers/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +6 -5
  27. package/dist/babel_helpers/classPrivateFieldGet/classPrivateFieldGet.js +6 -5
  28. package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +3 -3
  29. package/dist/babel_helpers/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +3 -3
  30. package/dist/babel_helpers/classPrivateFieldSet/classPrivateFieldSet.js +7 -6
  31. package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +3 -3
  32. package/dist/babel_helpers/classPrivateMethodSet/classPrivateMethodSet.js +2 -2
  33. package/dist/babel_helpers/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +8 -7
  34. package/dist/babel_helpers/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +15 -9
  35. package/dist/babel_helpers/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +5 -4
  36. package/dist/babel_helpers/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +2 -2
  37. package/dist/babel_helpers/construct/construct.js +10 -9
  38. package/dist/babel_helpers/createClass/createClass.js +2 -3
  39. package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +30 -29
  40. package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +18 -16
  41. package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +23 -17
  42. package/dist/babel_helpers/createSuper/createSuper.js +14 -12
  43. package/dist/babel_helpers/decorate/decorate.js +242 -210
  44. package/dist/babel_helpers/defaults/defaults.js +6 -6
  45. package/dist/babel_helpers/defineAccessor/defineAccessor.js +1 -4
  46. package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +12 -12
  47. package/dist/babel_helpers/defineProperty/defineProperty.js +7 -6
  48. package/dist/babel_helpers/extends/extends.js +5 -4
  49. package/dist/babel_helpers/get/get.js +2 -1
  50. package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +4 -3
  51. package/dist/babel_helpers/inherits/inherits.js +3 -4
  52. package/dist/babel_helpers/inheritsLoose/inheritsLoose.js +6 -5
  53. package/dist/babel_helpers/initializerDefineProperty/initializerDefineProperty.js +4 -4
  54. package/dist/babel_helpers/initializerWarningHelper/initializerWarningHelper.js +5 -2
  55. package/dist/babel_helpers/instanceof/instanceof.js +3 -3
  56. package/dist/babel_helpers/interopRequireDefault/interopRequireDefault.js +2 -4
  57. package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +19 -21
  58. package/dist/babel_helpers/isNativeFunction/isNativeFunction.js +2 -2
  59. package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +7 -7
  60. package/dist/babel_helpers/iterableToArray/iterableToArray.js +6 -2
  61. package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +6 -1
  62. package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +6 -2
  63. package/dist/babel_helpers/jsx/jsx.js +14 -7
  64. package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +6 -5
  65. package/dist/babel_helpers/newArrowCheck/newArrowCheck.js +2 -2
  66. package/dist/babel_helpers/nonIterableRest/nonIterableRest.js +5 -3
  67. package/dist/babel_helpers/nonIterableSpread/nonIterableSpread.js +5 -3
  68. package/dist/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +2 -2
  69. package/dist/babel_helpers/objectSpread/objectSpread.js +15 -12
  70. package/dist/babel_helpers/objectSpread2/objectSpread2.js +7 -2
  71. package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +15 -13
  72. package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +11 -11
  73. package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +7 -6
  74. package/dist/babel_helpers/readOnlyError/readOnlyError.js +2 -2
  75. package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +124 -73
  76. package/dist/babel_helpers/set/set.js +23 -20
  77. package/dist/babel_helpers/setPrototypeOf/setPrototypeOf.js +6 -5
  78. package/dist/babel_helpers/skipFirstGeneratorNext/skipFirstGeneratorNext.js +5 -5
  79. package/dist/babel_helpers/slicedToArray/slicedToArray.js +10 -5
  80. package/dist/babel_helpers/slicedToArrayLoose/slicedToArrayLoose.js +12 -6
  81. package/dist/babel_helpers/superPropBase/superPropBase.js +6 -5
  82. package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +7 -7
  83. package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +4 -4
  84. package/dist/babel_helpers/tdz/tdz.js +2 -2
  85. package/dist/babel_helpers/temporalRef/temporalRef.js +5 -4
  86. package/dist/babel_helpers/temporalUndefined/temporalUndefined.js +1 -1
  87. package/dist/babel_helpers/toArray/toArray.js +10 -5
  88. package/dist/babel_helpers/toConsumableArray/toConsumableArray.js +10 -5
  89. package/dist/babel_helpers/toPrimitive/toPrimitive.js +7 -7
  90. package/dist/babel_helpers/toPropertyKey/toPropertyKey.js +5 -4
  91. package/dist/babel_helpers/typeof/typeof.js +14 -5
  92. package/dist/babel_helpers/unsupportedIterableToArray/unsupportedIterableToArray.js +10 -8
  93. package/dist/babel_helpers/wrapAsyncGenerator/wrapAsyncGenerator.js +5 -4
  94. package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +17 -15
  95. package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +19 -8
  96. package/dist/babel_helpers/writeOnlyError/writeOnlyError.js +2 -2
  97. package/dist/js/autoreload.js +148 -133
  98. package/dist/js/import_meta_hot.js +19 -13
  99. package/dist/js/inline_content.js +1 -3
  100. package/dist/js/new_stylesheet.js +119 -60
  101. package/dist/js/regenerator_runtime.js +204 -102
  102. package/dist/js/ribbon.js +11 -6
  103. package/dist/js/server_events_client.js +122 -98
  104. package/dist/js/ws.js +968 -265
  105. package/dist/jsenv_core.js +8513 -6162
  106. package/package.json +13 -12
  107. package/src/build/build.js +497 -486
  108. package/src/build/version_mappings_injection.js +21 -44
  109. package/src/kitchen/errors.js +2 -2
  110. package/src/kitchen/fetched_content_compliance.js +6 -2
  111. package/src/kitchen/kitchen.js +285 -80
  112. package/src/kitchen/prepend_content.js +135 -0
  113. package/src/kitchen/url_graph/url_graph_visitor.js +99 -0
  114. package/src/kitchen/url_graph/url_info_transformations.js +140 -21
  115. package/src/kitchen/url_graph.js +59 -29
  116. package/src/plugins/autoreload/jsenv_plugin_hmr.js +1 -2
  117. package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +2 -2
  118. package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -2
  119. package/src/plugins/inlining/jsenv_plugin_inlining_as_data_url.js +1 -1
  120. package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +44 -23
  121. package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +2 -1
  122. package/dist/js/global_this_js_classic.js +0 -24
  123. package/dist/js/global_this_js_module.js +0 -20
  124. package/src/build/graph_utils.js +0 -34
@@ -23,13 +23,21 @@
23
23
  CLASS = 10; // only used in assertValidReturnValue
24
24
  */
25
25
 
26
- function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
26
+ function old_createMetadataMethodsForProperty(
27
+ metadataMap,
28
+ kind,
29
+ property,
30
+ decoratorFinishedRef
31
+ ) {
27
32
  return {
28
33
  getMetadata: function (key) {
29
34
  old_assertNotFinished(decoratorFinishedRef, "getMetadata");
30
35
  old_assertMetadataKey(key);
36
+
31
37
  var metadataForKey = metadataMap[key];
38
+
32
39
  if (metadataForKey === void 0) return void 0;
40
+
33
41
  if (kind === 1 /* PUBLIC */) {
34
42
  var pub = metadataForKey.public;
35
43
  if (pub !== void 0) {
@@ -47,59 +55,79 @@ function old_createMetadataMethodsForProperty(metadataMap, kind, property, decor
47
55
  setMetadata: function (key, value) {
48
56
  old_assertNotFinished(decoratorFinishedRef, "setMetadata");
49
57
  old_assertMetadataKey(key);
58
+
50
59
  var metadataForKey = metadataMap[key];
60
+
51
61
  if (metadataForKey === void 0) {
52
62
  metadataForKey = metadataMap[key] = {};
53
63
  }
64
+
54
65
  if (kind === 1 /* PUBLIC */) {
55
66
  var pub = metadataForKey.public;
67
+
56
68
  if (pub === void 0) {
57
69
  pub = metadataForKey.public = {};
58
70
  }
71
+
59
72
  pub[property] = value;
60
73
  } else if (kind === 2 /* PRIVATE */) {
61
74
  var priv = metadataForKey.priv;
75
+
62
76
  if (priv === void 0) {
63
77
  priv = metadataForKey.private = new Map();
64
78
  }
79
+
65
80
  priv.set(property, value);
66
81
  } else {
67
82
  metadataForKey.constructor = value;
68
83
  }
69
- }
84
+ },
70
85
  };
71
86
  }
87
+
72
88
  function old_convertMetadataMapToFinal(obj, metadataMap) {
73
89
  var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];
74
90
  var metadataKeys = Object.getOwnPropertySymbols(metadataMap);
91
+
75
92
  if (metadataKeys.length === 0) return;
93
+
76
94
  for (var i = 0; i < metadataKeys.length; i++) {
77
95
  var key = metadataKeys[i];
78
96
  var metaForKey = metadataMap[key];
79
97
  var parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null;
98
+
80
99
  var pub = metaForKey.public;
81
100
  var parentPub = parentMetaForKey ? parentMetaForKey.public : null;
101
+
82
102
  if (pub && parentPub) {
83
103
  Object.setPrototypeOf(pub, parentPub);
84
104
  }
105
+
85
106
  var priv = metaForKey.private;
107
+
86
108
  if (priv) {
87
109
  var privArr = Array.from(priv.values());
88
110
  var parentPriv = parentMetaForKey ? parentMetaForKey.private : null;
111
+
89
112
  if (parentPriv) {
90
113
  privArr = privArr.concat(parentPriv);
91
114
  }
115
+
92
116
  metaForKey.private = privArr;
93
117
  }
118
+
94
119
  if (parentMetaForKey) {
95
120
  Object.setPrototypeOf(metaForKey, parentMetaForKey);
96
121
  }
97
122
  }
123
+
98
124
  if (parentMetadataMap) {
99
125
  Object.setPrototypeOf(metadataMap, parentMetadataMap);
100
126
  }
127
+
101
128
  obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
102
129
  }
130
+
103
131
  function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
104
132
  return function addInitializer(initializer) {
105
133
  old_assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -107,8 +135,20 @@ function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
107
135
  initializers.push(initializer);
108
136
  };
109
137
  }
110
- function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
138
+
139
+ function old_memberDec(
140
+ dec,
141
+ name,
142
+ desc,
143
+ metadataMap,
144
+ initializers,
145
+ kind,
146
+ isStatic,
147
+ isPrivate,
148
+ value
149
+ ) {
111
150
  var kindStr;
151
+
112
152
  switch (kind) {
113
153
  case 1 /* ACCESSOR */:
114
154
  kindStr = "accessor";
@@ -125,23 +165,31 @@ function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStati
125
165
  default:
126
166
  kindStr = "field";
127
167
  }
168
+
128
169
  var ctx = {
129
170
  kind: kindStr,
130
171
  name: isPrivate ? "#" + name : name,
131
172
  isStatic: isStatic,
132
- isPrivate: isPrivate
133
- };
134
- var decoratorFinishedRef = {
135
- v: false
173
+ isPrivate: isPrivate,
136
174
  };
175
+
176
+ var decoratorFinishedRef = { v: false };
177
+
137
178
  if (kind !== 0 /* FIELD */) {
138
- ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef);
179
+ ctx.addInitializer = old_createAddInitializerMethod(
180
+ initializers,
181
+ decoratorFinishedRef
182
+ );
139
183
  }
184
+
140
185
  var metadataKind, metadataName;
186
+
141
187
  if (isPrivate) {
142
188
  metadataKind = 2 /* PRIVATE */;
143
189
  metadataName = Symbol(name);
190
+
144
191
  var access = {};
192
+
145
193
  if (kind === 0 /* FIELD */) {
146
194
  access.get = desc.get;
147
195
  access.set = desc.set;
@@ -156,43 +204,66 @@ function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStati
156
204
  return desc.get.call(this);
157
205
  };
158
206
  }
207
+
159
208
  if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
160
209
  access.set = function (v) {
161
210
  desc.set.call(this, v);
162
211
  };
163
212
  }
164
213
  }
214
+
165
215
  ctx.access = access;
166
216
  } else {
167
217
  metadataKind = 1 /* PUBLIC */;
168
218
  metadataName = name;
169
219
  }
220
+
170
221
  try {
171
- return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
222
+ return dec(
223
+ value,
224
+ Object.assign(
225
+ ctx,
226
+ old_createMetadataMethodsForProperty(
227
+ metadataMap,
228
+ metadataKind,
229
+ metadataName,
230
+ decoratorFinishedRef
231
+ )
232
+ )
233
+ );
172
234
  } finally {
173
235
  decoratorFinishedRef.v = true;
174
236
  }
175
237
  }
238
+
176
239
  function old_assertNotFinished(decoratorFinishedRef, fnName) {
177
240
  if (decoratorFinishedRef.v) {
178
- throw new Error("attempted to call " + fnName + " after decoration was finished");
241
+ throw new Error(
242
+ "attempted to call " + fnName + " after decoration was finished"
243
+ );
179
244
  }
180
245
  }
246
+
181
247
  function old_assertMetadataKey(key) {
182
248
  if (typeof key !== "symbol") {
183
249
  throw new TypeError("Metadata keys must be symbols, received: " + key);
184
250
  }
185
251
  }
252
+
186
253
  function old_assertCallable(fn, hint) {
187
254
  if (typeof fn !== "function") {
188
255
  throw new TypeError(hint + " must be a function");
189
256
  }
190
257
  }
258
+
191
259
  function old_assertValidReturnValue(kind, value) {
192
260
  var type = typeof value;
261
+
193
262
  if (kind === 1 /* ACCESSOR */) {
194
263
  if (type !== "object" || value === null) {
195
- throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
264
+ throw new TypeError(
265
+ "accessor decorators must return an object with get, set, or init properties or void 0"
266
+ );
196
267
  }
197
268
  if (value.get !== undefined) {
198
269
  old_assertCallable(value.get, "accessor.get");
@@ -218,42 +289,61 @@ function old_assertValidReturnValue(kind, value) {
218
289
  throw new TypeError(hint + " decorators must return a function or void 0");
219
290
  }
220
291
  }
292
+
221
293
  function old_getInit(desc) {
222
294
  var initializer;
223
- if ((initializer = desc.init) == null && (initializer = desc.initializer) && typeof console !== "undefined") {
295
+ if (
296
+ (initializer = desc.init) == null &&
297
+ (initializer = desc.initializer) &&
298
+ typeof console !== "undefined"
299
+ ) {
224
300
  console.warn(".initializer has been renamed to .init as of March 2022");
225
301
  }
226
302
  return initializer;
227
303
  }
228
- function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
304
+
305
+ function old_applyMemberDec(
306
+ ret,
307
+ base,
308
+ decInfo,
309
+ name,
310
+ kind,
311
+ isStatic,
312
+ isPrivate,
313
+ metadataMap,
314
+ initializers
315
+ ) {
229
316
  var decs = decInfo[0];
317
+
230
318
  var desc, initializer, value;
319
+
231
320
  if (isPrivate) {
232
321
  if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
233
322
  desc = {
234
323
  get: decInfo[3],
235
- set: decInfo[4]
324
+ set: decInfo[4],
236
325
  };
237
326
  } else if (kind === 3 /* GETTER */) {
238
327
  desc = {
239
- get: decInfo[3]
328
+ get: decInfo[3],
240
329
  };
241
330
  } else if (kind === 4 /* SETTER */) {
242
331
  desc = {
243
- set: decInfo[3]
332
+ set: decInfo[3],
244
333
  };
245
334
  } else {
246
335
  desc = {
247
- value: decInfo[3]
336
+ value: decInfo[3],
248
337
  };
249
338
  }
250
339
  } else if (kind !== 0 /* FIELD */) {
251
340
  desc = Object.getOwnPropertyDescriptor(base, name);
252
341
  }
342
+
253
343
  if (kind === 1 /* ACCESSOR */) {
254
344
  value = {
255
345
  get: desc.get,
256
- set: desc.set
346
+ set: desc.set,
257
347
  };
258
348
  } else if (kind === 2 /* METHOD */) {
259
349
  value = desc.value;
@@ -262,21 +352,33 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
262
352
  } else if (kind === 4 /* SETTER */) {
263
353
  value = desc.set;
264
354
  }
355
+
265
356
  var newValue, get, set;
357
+
266
358
  if (typeof decs === "function") {
267
- newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
359
+ newValue = old_memberDec(
360
+ decs,
361
+ name,
362
+ desc,
363
+ metadataMap,
364
+ initializers,
365
+ kind,
366
+ isStatic,
367
+ isPrivate,
368
+ value
369
+ );
370
+
268
371
  if (newValue !== void 0) {
269
372
  old_assertValidReturnValue(kind, newValue);
373
+
270
374
  if (kind === 0 /* FIELD */) {
271
375
  initializer = newValue;
272
376
  } else if (kind === 1 /* ACCESSOR */) {
273
377
  initializer = old_getInit(newValue);
274
378
  get = newValue.get || value.get;
275
379
  set = newValue.set || value.set;
276
- value = {
277
- get: get,
278
- set: set
279
- };
380
+
381
+ value = { get: get, set: set };
280
382
  } else {
281
383
  value = newValue;
282
384
  }
@@ -284,23 +386,35 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
284
386
  } else {
285
387
  for (var i = decs.length - 1; i >= 0; i--) {
286
388
  var dec = decs[i];
287
- newValue = old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
389
+
390
+ newValue = old_memberDec(
391
+ dec,
392
+ name,
393
+ desc,
394
+ metadataMap,
395
+ initializers,
396
+ kind,
397
+ isStatic,
398
+ isPrivate,
399
+ value
400
+ );
401
+
288
402
  if (newValue !== void 0) {
289
403
  old_assertValidReturnValue(kind, newValue);
290
404
  var newInit;
405
+
291
406
  if (kind === 0 /* FIELD */) {
292
407
  newInit = newValue;
293
408
  } else if (kind === 1 /* ACCESSOR */) {
294
409
  newInit = old_getInit(newValue);
295
410
  get = newValue.get || value.get;
296
411
  set = newValue.set || value.set;
297
- value = {
298
- get: get,
299
- set: set
300
- };
412
+
413
+ value = { get: get, set: set };
301
414
  } else {
302
415
  value = newValue;
303
416
  }
417
+
304
418
  if (newInit !== void 0) {
305
419
  if (initializer === void 0) {
306
420
  initializer = newInit;
@@ -313,6 +427,7 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
313
427
  }
314
428
  }
315
429
  }
430
+
316
431
  if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
317
432
  if (initializer === void 0) {
318
433
  // If the initializer was void 0, sub in a dummy initializer
@@ -321,21 +436,27 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
321
436
  };
322
437
  } else if (typeof initializer !== "function") {
323
438
  var ownInitializers = initializer;
439
+
324
440
  initializer = function (instance, init) {
325
441
  var value = init;
442
+
326
443
  for (var i = 0; i < ownInitializers.length; i++) {
327
444
  value = ownInitializers[i].call(instance, value);
328
445
  }
446
+
329
447
  return value;
330
448
  };
331
449
  } else {
332
450
  var originalInitializer = initializer;
451
+
333
452
  initializer = function (instance, init) {
334
453
  return originalInitializer.call(instance, init);
335
454
  };
336
455
  }
456
+
337
457
  ret.push(initializer);
338
458
  }
459
+
339
460
  if (kind !== 0 /* FIELD */) {
340
461
  if (kind === 1 /* ACCESSOR */) {
341
462
  desc.get = value.get;
@@ -347,6 +468,7 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
347
468
  } else if (kind === 4 /* SETTER */) {
348
469
  desc.set = value;
349
470
  }
471
+
350
472
  if (isPrivate) {
351
473
  if (kind === 1 /* ACCESSOR */) {
352
474
  ret.push(function (instance, args) {
@@ -367,23 +489,35 @@ function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate,
367
489
  }
368
490
  }
369
491
  }
370
- function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
492
+
493
+ function old_applyMemberDecs(
494
+ ret,
495
+ Class,
496
+ protoMetadataMap,
497
+ staticMetadataMap,
498
+ decInfos
499
+ ) {
371
500
  var protoInitializers;
372
501
  var staticInitializers;
502
+
373
503
  var existingProtoNonFields = new Map();
374
504
  var existingStaticNonFields = new Map();
505
+
375
506
  for (var i = 0; i < decInfos.length; i++) {
376
507
  var decInfo = decInfos[i];
377
508
 
378
509
  // skip computed property names
379
510
  if (!Array.isArray(decInfo)) continue;
511
+
380
512
  var kind = decInfo[1];
381
513
  var name = decInfo[2];
382
514
  var isPrivate = decInfo.length > 3;
515
+
383
516
  var isStatic = kind >= 5; /* STATIC */
384
517
  var base;
385
518
  var metadataMap;
386
519
  var initializers;
520
+
387
521
  if (isStatic) {
388
522
  base = Class;
389
523
  metadataMap = staticMetadataMap;
@@ -402,22 +536,47 @@ function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, de
402
536
  initializers = protoInitializers;
403
537
  }
404
538
  }
539
+
405
540
  if (kind !== 0 /* FIELD */ && !isPrivate) {
406
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
541
+ var existingNonFields = isStatic
542
+ ? existingStaticNonFields
543
+ : existingProtoNonFields;
544
+
407
545
  var existingKind = existingNonFields.get(name) || 0;
408
- if (existingKind === true || existingKind === 3 /* GETTER */ && kind !== 4 /* SETTER */ || existingKind === 4 /* SETTER */ && kind !== 3 /* GETTER */) {
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);
546
+
547
+ if (
548
+ existingKind === true ||
549
+ (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ ||
550
+ (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */
551
+ ) {
552
+ throw new Error(
553
+ "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: " +
554
+ name
555
+ );
410
556
  } else if (!existingKind && kind > 2 /* METHOD */) {
411
557
  existingNonFields.set(name, kind);
412
558
  } else {
413
559
  existingNonFields.set(name, true);
414
560
  }
415
561
  }
416
- old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
562
+
563
+ old_applyMemberDec(
564
+ ret,
565
+ base,
566
+ decInfo,
567
+ name,
568
+ kind,
569
+ isStatic,
570
+ isPrivate,
571
+ metadataMap,
572
+ initializers
573
+ );
417
574
  }
575
+
418
576
  old_pushInitializers(ret, protoInitializers);
419
577
  old_pushInitializers(ret, staticInitializers);
420
578
  }
579
+
421
580
  function old_pushInitializers(ret, initializers) {
422
581
  if (initializers) {
423
582
  ret.push(function (instance) {
@@ -428,30 +587,44 @@ function old_pushInitializers(ret, initializers) {
428
587
  });
429
588
  }
430
589
  }
590
+
431
591
  function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
432
592
  if (classDecs.length > 0) {
433
593
  var initializers = [];
434
594
  var newClass = targetClass;
435
595
  var name = targetClass.name;
596
+
436
597
  for (var i = classDecs.length - 1; i >= 0; i--) {
437
- var decoratorFinishedRef = {
438
- v: false
439
- };
598
+ var decoratorFinishedRef = { v: false };
599
+
440
600
  try {
441
- var ctx = Object.assign({
442
- kind: "class",
443
- name: name,
444
- addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef)
445
- }, old_createMetadataMethodsForProperty(metadataMap, 0 /* CONSTRUCTOR */, name, decoratorFinishedRef));
601
+ var ctx = Object.assign(
602
+ {
603
+ kind: "class",
604
+ name: name,
605
+ addInitializer: old_createAddInitializerMethod(
606
+ initializers,
607
+ decoratorFinishedRef
608
+ ),
609
+ },
610
+ old_createMetadataMethodsForProperty(
611
+ metadataMap,
612
+ 0 /* CONSTRUCTOR */,
613
+ name,
614
+ decoratorFinishedRef
615
+ )
616
+ );
446
617
  var nextNewClass = classDecs[i](newClass, ctx);
447
618
  } finally {
448
619
  decoratorFinishedRef.v = true;
449
620
  }
621
+
450
622
  if (nextNewClass !== undefined) {
451
623
  old_assertValidReturnValue(10 /* CLASS */, nextNewClass);
452
624
  newClass = nextNewClass;
453
625
  }
454
626
  }
627
+
455
628
  ret.push(newClass, function () {
456
629
  for (var i = 0; i < initializers.length; i++) {
457
630
  initializers[i].call(newClass);
@@ -608,10 +781,22 @@ function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
608
781
  export default function applyDecs(targetClass, memberDecs, classDecs) {
609
782
  var ret = [];
610
783
  var staticMetadataMap = {};
784
+
611
785
  var protoMetadataMap = {};
612
- old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs);
786
+
787
+ old_applyMemberDecs(
788
+ ret,
789
+ targetClass,
790
+ protoMetadataMap,
791
+ staticMetadataMap,
792
+ memberDecs
793
+ );
794
+
613
795
  old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap);
796
+
614
797
  old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs);
798
+
615
799
  old_convertMetadataMapToFinal(targetClass, staticMetadataMap);
800
+
616
801
  return ret;
617
802
  }