@jsenv/core 40.3.2 → 40.4.0

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 (123) hide show
  1. package/dist/build/browserslist_index/browserslist_index.js +4951 -0
  2. package/dist/build/build.js +228 -83
  3. package/dist/build/jsenv_core_node_modules.js +709 -0
  4. package/dist/build/jsenv_core_packages.js +10915 -0
  5. package/dist/start_build_server/jsenv_core_node_modules.js +685 -0
  6. package/dist/start_build_server/jsenv_core_packages.js +1550 -0
  7. package/dist/start_build_server/start_build_server.js +2 -9
  8. package/dist/start_dev_server/jsenv_core_node_modules.js +685 -0
  9. package/dist/start_dev_server/jsenv_core_packages.js +6185 -0
  10. package/dist/start_dev_server/start_dev_server.js +109 -75
  11. package/package.json +20 -20
  12. package/src/build/build.js +79 -0
  13. package/src/build/build_specifier_manager.js +2 -2
  14. package/src/build/build_urls_generator.js +42 -5
  15. package/src/kitchen/errors.js +6 -1
  16. package/src/kitchen/kitchen.js +95 -7
  17. package/src/plugins/package_side_effects/jsenv_plugin_package_side_effects.js +5 -65
  18. package/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +0 -112
  19. package/dist/babel_helpers/AwaitValue/AwaitValue.js +0 -3
  20. package/dist/babel_helpers/OverloadYield/OverloadYield.js +0 -11
  21. package/dist/babel_helpers/applyDecoratedDescriptor/applyDecoratedDescriptor.js +0 -32
  22. package/dist/babel_helpers/applyDecs/applyDecs.js +0 -813
  23. package/dist/babel_helpers/applyDecs2203/applyDecs2203.js +0 -635
  24. package/dist/babel_helpers/applyDecs2203R/applyDecs2203R.js +0 -654
  25. package/dist/babel_helpers/applyDecs2301/applyDecs2301.js +0 -721
  26. package/dist/babel_helpers/applyDecs2305/applyDecs2305.js +0 -531
  27. package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +0 -7
  28. package/dist/babel_helpers/arrayWithHoles/arrayWithHoles.js +0 -4
  29. package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +0 -6
  30. package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +0 -9
  31. package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -55
  32. package/dist/babel_helpers/asyncIterator/asyncIterator.js +0 -68
  33. package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +0 -34
  34. package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -5
  35. package/dist/babel_helpers/callSuper/callSuper.js +0 -25
  36. package/dist/babel_helpers/checkInRHS/checkInRHS.js +0 -11
  37. package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -23
  38. package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -6
  39. package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -13
  40. package/dist/babel_helpers/classCallCheck/classCallCheck.js +0 -5
  41. package/dist/babel_helpers/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -8
  42. package/dist/babel_helpers/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -11
  43. package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -13
  44. package/dist/babel_helpers/classNameTDZError/classNameTDZError.js +0 -6
  45. package/dist/babel_helpers/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -7
  46. package/dist/babel_helpers/classPrivateFieldGet/classPrivateFieldGet.js +0 -7
  47. package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -6
  48. package/dist/babel_helpers/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -5
  49. package/dist/babel_helpers/classPrivateFieldSet/classPrivateFieldSet.js +0 -8
  50. package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +0 -6
  51. package/dist/babel_helpers/classPrivateMethodSet/classPrivateMethodSet.js +0 -3
  52. package/dist/babel_helpers/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -13
  53. package/dist/babel_helpers/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -15
  54. package/dist/babel_helpers/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -10
  55. package/dist/babel_helpers/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -3
  56. package/dist/babel_helpers/construct/construct.js +0 -20
  57. package/dist/babel_helpers/createClass/createClass.js +0 -17
  58. package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -61
  59. package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -24
  60. package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +0 -50
  61. package/dist/babel_helpers/createSuper/createSuper.js +0 -22
  62. package/dist/babel_helpers/decorate/decorate.js +0 -488
  63. package/dist/babel_helpers/defaults/defaults.js +0 -11
  64. package/dist/babel_helpers/defineAccessor/defineAccessor.js +0 -6
  65. package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +0 -23
  66. package/dist/babel_helpers/defineProperty/defineProperty.js +0 -21
  67. package/dist/babel_helpers/dispose/dispose.js +0 -45
  68. package/dist/babel_helpers/extends/extends.js +0 -14
  69. package/dist/babel_helpers/get/get.js +0 -19
  70. package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +0 -4
  71. package/dist/babel_helpers/identity/identity.js +0 -3
  72. package/dist/babel_helpers/importDeferProxy/importDeferProxy.js +0 -31
  73. package/dist/babel_helpers/inherits/inherits.js +0 -19
  74. package/dist/babel_helpers/inheritsLoose/inheritsLoose.js +0 -7
  75. package/dist/babel_helpers/initializerDefineProperty/initializerDefineProperty.js +0 -12
  76. package/dist/babel_helpers/initializerWarningHelper/initializerWarningHelper.js +0 -6
  77. package/dist/babel_helpers/instanceof/instanceof.js +0 -10
  78. package/dist/babel_helpers/interopRequireDefault/interopRequireDefault.js +0 -3
  79. package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +0 -47
  80. package/dist/babel_helpers/isNativeFunction/isNativeFunction.js +0 -9
  81. package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -19
  82. package/dist/babel_helpers/iterableToArray/iterableToArray.js +0 -7
  83. package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +0 -54
  84. package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -16
  85. package/dist/babel_helpers/jsx/jsx.js +0 -50
  86. package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +0 -10
  87. package/dist/babel_helpers/newArrowCheck/newArrowCheck.js +0 -5
  88. package/dist/babel_helpers/nonIterableRest/nonIterableRest.js +0 -5
  89. package/dist/babel_helpers/nonIterableSpread/nonIterableSpread.js +0 -5
  90. package/dist/babel_helpers/nullishReceiverError/nullishReceiverError.js +0 -3
  91. package/dist/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -3
  92. package/dist/babel_helpers/objectSpread/objectSpread.js +0 -23
  93. package/dist/babel_helpers/objectSpread2/objectSpread2.js +0 -43
  94. package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +0 -19
  95. package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -13
  96. package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +0 -12
  97. package/dist/babel_helpers/readOnlyError/readOnlyError.js +0 -4
  98. package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +0 -698
  99. package/dist/babel_helpers/set/set.js +0 -47
  100. package/dist/babel_helpers/setFunctionName/setFunctionName.js +0 -19
  101. package/dist/babel_helpers/setPrototypeOf/setPrototypeOf.js +0 -7
  102. package/dist/babel_helpers/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -8
  103. package/dist/babel_helpers/slicedToArray/slicedToArray.js +0 -10
  104. package/dist/babel_helpers/slicedToArrayLoose/slicedToArrayLoose.js +0 -13
  105. package/dist/babel_helpers/superPropBase/superPropBase.js +0 -10
  106. package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -10
  107. package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -7
  108. package/dist/babel_helpers/tdz/tdz.js +0 -4
  109. package/dist/babel_helpers/temporalRef/temporalRef.js +0 -6
  110. package/dist/babel_helpers/temporalUndefined/temporalUndefined.js +0 -3
  111. package/dist/babel_helpers/toArray/toArray.js +0 -10
  112. package/dist/babel_helpers/toConsumableArray/toConsumableArray.js +0 -10
  113. package/dist/babel_helpers/toPrimitive/toPrimitive.js +0 -14
  114. package/dist/babel_helpers/toPropertyKey/toPropertyKey.js +0 -10
  115. package/dist/babel_helpers/typeof/typeof.js +0 -15
  116. package/dist/babel_helpers/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -12
  117. package/dist/babel_helpers/using/using.js +0 -23
  118. package/dist/babel_helpers/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -8
  119. package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +0 -30
  120. package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +0 -79
  121. package/dist/babel_helpers/writeOnlyError/writeOnlyError.js +0 -3
  122. package/dist/jsenv_core_node_modules.js +0 -2045
  123. package/dist/jsenv_core_packages.js +0 -23833
@@ -1,635 +0,0 @@
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
-
34
- function memberDec(
35
- dec,
36
- name,
37
- desc,
38
- initializers,
39
- kind,
40
- isStatic,
41
- isPrivate,
42
- value,
43
- ) {
44
- var kindStr;
45
-
46
- switch (kind) {
47
- case 1 /* ACCESSOR */:
48
- kindStr = "accessor";
49
- break;
50
- case 2 /* METHOD */:
51
- kindStr = "method";
52
- break;
53
- case 3 /* GETTER */:
54
- kindStr = "getter";
55
- break;
56
- case 4 /* SETTER */:
57
- kindStr = "setter";
58
- break;
59
- default:
60
- kindStr = "field";
61
- }
62
-
63
- var ctx = {
64
- kind: kindStr,
65
- name: isPrivate ? "#" + name : name,
66
- static: isStatic,
67
- private: isPrivate,
68
- };
69
-
70
- var decoratorFinishedRef = { v: false };
71
-
72
- if (kind !== 0 /* FIELD */) {
73
- ctx.addInitializer = createAddInitializerMethod(
74
- initializers,
75
- decoratorFinishedRef,
76
- );
77
- }
78
-
79
- var get, set;
80
- if (kind === 0 /* FIELD */) {
81
- if (isPrivate) {
82
- get = desc.get;
83
- set = desc.set;
84
- } else {
85
- get = function () {
86
- return this[name];
87
- };
88
- set = function (v) {
89
- this[name] = v;
90
- };
91
- }
92
- } else if (kind === 2 /* METHOD */) {
93
- get = function () {
94
- return desc.value;
95
- };
96
- } else {
97
- // replace with values that will go through the final getter and setter
98
- if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
99
- get = function () {
100
- return desc.get.call(this);
101
- };
102
- }
103
-
104
- if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
105
- set = function (v) {
106
- desc.set.call(this, v);
107
- };
108
- }
109
- }
110
- ctx.access =
111
- get && set ? { get: get, set: set } : get ? { get: get } : { set: set };
112
-
113
- try {
114
- return dec(value, ctx);
115
- } finally {
116
- decoratorFinishedRef.v = true;
117
- }
118
- }
119
-
120
- function assertNotFinished(decoratorFinishedRef, fnName) {
121
- if (decoratorFinishedRef.v) {
122
- throw new Error(
123
- "attempted to call " + fnName + " after decoration was finished",
124
- );
125
- }
126
- }
127
-
128
- function assertCallable(fn, hint) {
129
- if (typeof fn !== "function") {
130
- throw new TypeError(hint + " must be a function");
131
- }
132
- }
133
-
134
- function assertValidReturnValue(kind, value) {
135
- var type = typeof value;
136
-
137
- if (kind === 1 /* ACCESSOR */) {
138
- if (type !== "object" || value === null) {
139
- throw new TypeError(
140
- "accessor decorators must return an object with get, set, or init properties or void 0",
141
- );
142
- }
143
- if (value.get !== undefined) {
144
- assertCallable(value.get, "accessor.get");
145
- }
146
- if (value.set !== undefined) {
147
- assertCallable(value.set, "accessor.set");
148
- }
149
- if (value.init !== undefined) {
150
- assertCallable(value.init, "accessor.init");
151
- }
152
- } else if (type !== "function") {
153
- var hint;
154
- if (kind === 0 /* FIELD */) {
155
- hint = "field";
156
- } else if (kind === 10 /* CLASS */) {
157
- hint = "class";
158
- } else {
159
- hint = "method";
160
- }
161
- throw new TypeError(
162
- hint + " decorators must return a function or void 0",
163
- );
164
- }
165
- }
166
-
167
- function applyMemberDec(
168
- ret,
169
- base,
170
- decInfo,
171
- name,
172
- kind,
173
- isStatic,
174
- isPrivate,
175
- initializers,
176
- ) {
177
- var decs = decInfo[0];
178
-
179
- var desc, init, value;
180
-
181
- if (isPrivate) {
182
- if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
183
- desc = {
184
- get: decInfo[3],
185
- set: decInfo[4],
186
- };
187
- } else if (kind === 3 /* GETTER */) {
188
- desc = {
189
- get: decInfo[3],
190
- };
191
- } else if (kind === 4 /* SETTER */) {
192
- desc = {
193
- set: decInfo[3],
194
- };
195
- } else {
196
- desc = {
197
- value: decInfo[3],
198
- };
199
- }
200
- } else if (kind !== 0 /* FIELD */) {
201
- desc = Object.getOwnPropertyDescriptor(base, name);
202
- }
203
-
204
- if (kind === 1 /* ACCESSOR */) {
205
- value = {
206
- get: desc.get,
207
- set: desc.set,
208
- };
209
- } else if (kind === 2 /* METHOD */) {
210
- value = desc.value;
211
- } else if (kind === 3 /* GETTER */) {
212
- value = desc.get;
213
- } else if (kind === 4 /* SETTER */) {
214
- value = desc.set;
215
- }
216
-
217
- var newValue, get, set;
218
-
219
- if (typeof decs === "function") {
220
- newValue = memberDec(
221
- decs,
222
- name,
223
- desc,
224
- initializers,
225
- kind,
226
- isStatic,
227
- isPrivate,
228
- value,
229
- );
230
-
231
- if (newValue !== void 0) {
232
- assertValidReturnValue(kind, newValue);
233
-
234
- if (kind === 0 /* FIELD */) {
235
- init = newValue;
236
- } else if (kind === 1 /* ACCESSOR */) {
237
- init = newValue.init;
238
- get = newValue.get || value.get;
239
- set = newValue.set || value.set;
240
-
241
- value = { get: get, set: set };
242
- } else {
243
- value = newValue;
244
- }
245
- }
246
- } else {
247
- for (var i = decs.length - 1; i >= 0; i--) {
248
- var dec = decs[i];
249
-
250
- newValue = memberDec(
251
- dec,
252
- name,
253
- desc,
254
- initializers,
255
- kind,
256
- isStatic,
257
- isPrivate,
258
- value,
259
- );
260
-
261
- if (newValue !== void 0) {
262
- assertValidReturnValue(kind, newValue);
263
- var newInit;
264
-
265
- if (kind === 0 /* FIELD */) {
266
- newInit = newValue;
267
- } else if (kind === 1 /* ACCESSOR */) {
268
- newInit = newValue.init;
269
- get = newValue.get || value.get;
270
- set = newValue.set || value.set;
271
-
272
- value = { get: get, set: set };
273
- } else {
274
- value = newValue;
275
- }
276
-
277
- if (newInit !== void 0) {
278
- if (init === void 0) {
279
- init = newInit;
280
- } else if (typeof init === "function") {
281
- init = [init, newInit];
282
- } else {
283
- init.push(newInit);
284
- }
285
- }
286
- }
287
- }
288
- }
289
-
290
- if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
291
- if (init === void 0) {
292
- // If the initializer was void 0, sub in a dummy initializer
293
- init = function (instance, init) {
294
- return init;
295
- };
296
- } else if (typeof init !== "function") {
297
- var ownInitializers = init;
298
-
299
- init = function (instance, init) {
300
- var value = init;
301
-
302
- for (var i = 0; i < ownInitializers.length; i++) {
303
- value = ownInitializers[i].call(instance, value);
304
- }
305
-
306
- return value;
307
- };
308
- } else {
309
- var originalInitializer = init;
310
-
311
- init = function (instance, init) {
312
- return originalInitializer.call(instance, init);
313
- };
314
- }
315
-
316
- ret.push(init);
317
- }
318
-
319
- if (kind !== 0 /* FIELD */) {
320
- if (kind === 1 /* ACCESSOR */) {
321
- desc.get = value.get;
322
- desc.set = value.set;
323
- } else if (kind === 2 /* METHOD */) {
324
- desc.value = value;
325
- } else if (kind === 3 /* GETTER */) {
326
- desc.get = value;
327
- } else if (kind === 4 /* SETTER */) {
328
- desc.set = value;
329
- }
330
-
331
- if (isPrivate) {
332
- if (kind === 1 /* ACCESSOR */) {
333
- ret.push(function (instance, args) {
334
- return value.get.call(instance, args);
335
- });
336
- ret.push(function (instance, args) {
337
- return value.set.call(instance, args);
338
- });
339
- } else if (kind === 2 /* METHOD */) {
340
- ret.push(value);
341
- } else {
342
- ret.push(function (instance, args) {
343
- return value.call(instance, args);
344
- });
345
- }
346
- } else {
347
- Object.defineProperty(base, name, desc);
348
- }
349
- }
350
- }
351
-
352
- function applyMemberDecs(ret, Class, decInfos) {
353
- var protoInitializers;
354
- var staticInitializers;
355
-
356
- var existingProtoNonFields = new Map();
357
- var existingStaticNonFields = new Map();
358
-
359
- for (var i = 0; i < decInfos.length; i++) {
360
- var decInfo = decInfos[i];
361
-
362
- // skip computed property names
363
- if (!Array.isArray(decInfo)) continue;
364
-
365
- var kind = decInfo[1];
366
- var name = decInfo[2];
367
- var isPrivate = decInfo.length > 3;
368
-
369
- var isStatic = kind >= 5; /* STATIC */
370
- var base;
371
- var initializers;
372
-
373
- if (isStatic) {
374
- base = Class;
375
- kind = kind - 5 /* STATIC */;
376
- // initialize staticInitializers when we see a non-field static member
377
- if (kind !== 0 /* FIELD */) {
378
- staticInitializers = staticInitializers || [];
379
- initializers = staticInitializers;
380
- }
381
- } else {
382
- base = Class.prototype;
383
- // initialize protoInitializers when we see a non-field member
384
- if (kind !== 0 /* FIELD */) {
385
- protoInitializers = protoInitializers || [];
386
- initializers = protoInitializers;
387
- }
388
- }
389
-
390
- if (kind !== 0 /* FIELD */ && !isPrivate) {
391
- var existingNonFields = isStatic
392
- ? existingStaticNonFields
393
- : existingProtoNonFields;
394
-
395
- var existingKind = existingNonFields.get(name) || 0;
396
-
397
- if (
398
- existingKind === true ||
399
- (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ ||
400
- (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */
401
- ) {
402
- throw new Error(
403
- "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: " +
404
- name,
405
- );
406
- } else if (!existingKind && kind > 2 /* METHOD */) {
407
- existingNonFields.set(name, kind);
408
- } else {
409
- existingNonFields.set(name, true);
410
- }
411
- }
412
-
413
- applyMemberDec(
414
- ret,
415
- base,
416
- decInfo,
417
- name,
418
- kind,
419
- isStatic,
420
- isPrivate,
421
- initializers,
422
- );
423
- }
424
-
425
- pushInitializers(ret, protoInitializers);
426
- pushInitializers(ret, staticInitializers);
427
- }
428
-
429
- function pushInitializers(ret, initializers) {
430
- if (initializers) {
431
- ret.push(function (instance) {
432
- for (var i = 0; i < initializers.length; i++) {
433
- initializers[i].call(instance);
434
- }
435
- return instance;
436
- });
437
- }
438
- }
439
-
440
- function applyClassDecs(ret, targetClass, classDecs) {
441
- if (classDecs.length > 0) {
442
- var initializers = [];
443
- var newClass = targetClass;
444
- var name = targetClass.name;
445
-
446
- for (var i = classDecs.length - 1; i >= 0; i--) {
447
- var decoratorFinishedRef = { v: false };
448
-
449
- try {
450
- var nextNewClass = classDecs[i](newClass, {
451
- kind: "class",
452
- name: name,
453
- addInitializer: createAddInitializerMethod(
454
- initializers,
455
- decoratorFinishedRef,
456
- ),
457
- });
458
- } finally {
459
- decoratorFinishedRef.v = true;
460
- }
461
-
462
- if (nextNewClass !== undefined) {
463
- assertValidReturnValue(10 /* CLASS */, nextNewClass);
464
- newClass = nextNewClass;
465
- }
466
- }
467
-
468
- ret.push(newClass, function () {
469
- for (var i = 0; i < initializers.length; i++) {
470
- initializers[i].call(newClass);
471
- }
472
- });
473
- }
474
- }
475
-
476
- /**
477
- Basic usage:
478
-
479
- applyDecs(
480
- Class,
481
- [
482
- // member decorators
483
- [
484
- dec, // dec or array of decs
485
- 0, // kind of value being decorated
486
- 'prop', // name of public prop on class containing the value being decorated,
487
- '#p', // the name of the private property (if is private, void 0 otherwise),
488
- ]
489
- ],
490
- [
491
- // class decorators
492
- dec1, dec2
493
- ]
494
- )
495
- ```
496
-
497
- Fully transpiled example:
498
-
499
- ```js
500
- @dec
501
- class Class {
502
- @dec
503
- a = 123;
504
-
505
- @dec
506
- #a = 123;
507
-
508
- @dec
509
- @dec2
510
- accessor b = 123;
511
-
512
- @dec
513
- accessor #b = 123;
514
-
515
- @dec
516
- c() { console.log('c'); }
517
-
518
- @dec
519
- #c() { console.log('privC'); }
520
-
521
- @dec
522
- get d() { console.log('d'); }
523
-
524
- @dec
525
- get #d() { console.log('privD'); }
526
-
527
- @dec
528
- set e(v) { console.log('e'); }
529
-
530
- @dec
531
- set #e(v) { console.log('privE'); }
532
- }
533
-
534
-
535
- // becomes
536
- let initializeInstance;
537
- let initializeClass;
538
-
539
- let initA;
540
- let initPrivA;
541
-
542
- let initB;
543
- let initPrivB, getPrivB, setPrivB;
544
-
545
- let privC;
546
- let privD;
547
- let privE;
548
-
549
- let Class;
550
- class _Class {
551
- static {
552
- let ret = applyDecs(
553
- this,
554
- [
555
- [dec, 0, 'a'],
556
- [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
557
- [[dec, dec2], 1, 'b'],
558
- [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
559
- [dec, 2, 'c'],
560
- [dec, 2, 'c', () => console.log('privC')],
561
- [dec, 3, 'd'],
562
- [dec, 3, 'd', () => console.log('privD')],
563
- [dec, 4, 'e'],
564
- [dec, 4, 'e', () => console.log('privE')],
565
- ],
566
- [
567
- dec
568
- ]
569
- )
570
-
571
- initA = ret[0];
572
-
573
- initPrivA = ret[1];
574
-
575
- initB = ret[2];
576
-
577
- initPrivB = ret[3];
578
- getPrivB = ret[4];
579
- setPrivB = ret[5];
580
-
581
- privC = ret[6];
582
-
583
- privD = ret[7];
584
-
585
- privE = ret[8];
586
-
587
- initializeInstance = ret[9];
588
-
589
- Class = ret[10]
590
-
591
- initializeClass = ret[11];
592
- }
593
-
594
- a = (initializeInstance(this), initA(this, 123));
595
-
596
- #a = initPrivA(this, 123);
597
-
598
- #bData = initB(this, 123);
599
- get b() { return this.#bData }
600
- set b(v) { this.#bData = v }
601
-
602
- #privBData = initPrivB(this, 123);
603
- get #b() { return getPrivB(this); }
604
- set #b(v) { setPrivB(this, v); }
605
-
606
- c() { console.log('c'); }
607
-
608
- #c(...args) { return privC(this, ...args) }
609
-
610
- get d() { console.log('d'); }
611
-
612
- get #d() { return privD(this); }
613
-
614
- set e(v) { console.log('e'); }
615
-
616
- set #e(v) { privE(this, v); }
617
- }
618
-
619
- initializeClass(Class);
620
- */
621
-
622
- return function applyDecs2203Impl(targetClass, memberDecs, classDecs) {
623
- var ret = [];
624
- applyMemberDecs(ret, targetClass, memberDecs);
625
- applyClassDecs(ret, targetClass, classDecs);
626
- return ret;
627
- };
628
- }
629
-
630
- var applyDecs2203Impl;
631
-
632
- export default function applyDecs2203(targetClass, memberDecs, classDecs) {
633
- applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory();
634
- return applyDecs2203Impl(targetClass, memberDecs, classDecs);
635
- }