@jsenv/core 40.3.2 → 40.3.3

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