@jsenv/core 27.0.0-alpha.81 → 27.0.0-alpha.84

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 (81) hide show
  1. package/dist/babel_helpers/applyDecs/applyDecs.js +756 -0
  2. package/dist/babel_helpers/construct/construct.js +1 -1
  3. package/dist/babel_helpers/extends/extends.js +1 -1
  4. package/dist/babel_helpers/get/get.js +1 -1
  5. package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +1 -1
  6. package/dist/babel_helpers/identity/identity.js +3 -0
  7. package/dist/babel_helpers/setPrototypeOf/setPrototypeOf.js +2 -2
  8. package/dist/js/event_source_client.js +206 -2
  9. package/dist/main.js +934 -90
  10. package/dist/s.js.map +2 -1
  11. package/package.json +9 -9
  12. package/src/build/build.js +5 -5
  13. package/src/build/build_urls_generator.js +1 -2
  14. package/src/build/inject_global_version_mappings.js +2 -2
  15. package/src/build/inject_service_worker_urls.js +2 -2
  16. package/src/build/resync_ressource_hints.js +1 -1
  17. package/src/build/start_build_server.js +33 -26
  18. package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +1 -2
  19. package/src/dev/plugins/toolbar/client/util/fetching.js +1 -1
  20. package/src/dev/plugins/toolbar/jsenv_plugin_toolbar.js +1 -1
  21. package/src/dev/start_dev_server.js +38 -30
  22. package/src/execute/runtimes/browsers/from_playwright.js +5 -4
  23. package/src/execute/runtimes/node/node_process.js +2 -2
  24. package/src/helpers/command/command.js +73 -0
  25. package/src/helpers/event_source/event_source.js +197 -0
  26. package/src/helpers/event_source/sse_service.js +53 -0
  27. package/src/helpers/worker_reload.js +57 -0
  28. package/src/omega/compat/runtime_compat.js +2 -1
  29. package/src/omega/kitchen.js +2 -1
  30. package/src/omega/server/user_agent.js +2 -1
  31. package/src/omega/url_graph/sort_by_dependencies.js +27 -0
  32. package/src/omega/url_graph/url_info_transformations.js +24 -14
  33. package/src/plugins/autoreload/dev_sse/client/event_source_client.js +1 -1
  34. package/src/plugins/autoreload/dev_sse/client/reload.js +1 -1
  35. package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_client.js +1 -1
  36. package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_server.js +1 -1
  37. package/src/plugins/bundling/css/bundle_css.js +5 -4
  38. package/src/plugins/bundling/js_module/bundle_js_module.js +2 -2
  39. package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +2 -2
  40. package/src/plugins/file_urls/jsenv_plugin_file_urls.js +1 -2
  41. package/src/plugins/html_supervisor/jsenv_plugin_html_supervisor.js +1 -1
  42. package/src/plugins/import_meta_hot/html_hot_dependencies.js +2 -2
  43. package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +4 -3
  44. package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +2 -2
  45. package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -3
  46. package/src/plugins/inject_globals/inject_globals.js +2 -2
  47. package/src/plugins/inline/jsenv_plugin_data_urls.js +1 -1
  48. package/src/plugins/inline/jsenv_plugin_html_inline_content.js +3 -3
  49. package/src/plugins/inline/jsenv_plugin_js_inline_content.js +4 -4
  50. package/src/plugins/minification/css/minify_css.js +1 -1
  51. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +2 -4
  52. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +5 -5
  53. package/src/plugins/transpilation/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +1 -1
  54. package/src/plugins/transpilation/babel/helpers/babel_plugin_babel_helpers_as_jsenv_imports.js +2 -3
  55. package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +1 -1
  56. package/src/plugins/transpilation/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +1 -2
  57. package/src/plugins/transpilation/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +1 -2
  58. package/src/plugins/transpilation/css_parcel/jsenv_plugin_css_parcel.js +1 -1
  59. package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +1 -1
  60. package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +2 -1
  61. package/src/plugins/url_analysis/css/css_urls.js +3 -3
  62. package/src/plugins/url_analysis/html/html_urls.js +2 -2
  63. package/src/plugins/url_analysis/js/js_urls.js +3 -2
  64. package/src/test/coverage/babel_plugin_instrument.js +82 -0
  65. package/src/test/coverage/coverage_reporter_html_directory.js +36 -0
  66. package/src/test/coverage/coverage_reporter_json_file.js +22 -0
  67. package/src/test/coverage/coverage_reporter_text_log.js +19 -0
  68. package/src/test/coverage/empty_coverage_factory.js +52 -0
  69. package/src/test/coverage/file_by_file_coverage.js +25 -0
  70. package/src/test/coverage/istanbul_coverage_composition.js +28 -0
  71. package/src/test/coverage/istanbul_coverage_map_from_coverage.js +16 -0
  72. package/src/test/coverage/list_files_not_covered.js +15 -0
  73. package/src/test/coverage/missing_coverage.js +41 -0
  74. package/src/test/coverage/report_to_coverage.js +196 -0
  75. package/src/test/coverage/v8_and_istanbul.js +37 -0
  76. package/src/test/coverage/v8_coverage_composition.js +24 -0
  77. package/src/test/coverage/v8_coverage_from_directory.js +87 -0
  78. package/src/test/coverage/v8_coverage_to_istanbul.js +99 -0
  79. package/src/test/execute_plan.js +2 -2
  80. package/src/test/execute_test_plan.js +3 -3
  81. package/dist/babel_helpers/readme.md +0 -8
@@ -0,0 +1,756 @@
1
+ /* @minVersion 7.16.6 */
2
+
3
+ /**
4
+ Enums are used in this file, but not assigned to vars to avoid non-hoistable values
5
+
6
+ CONSTRUCTOR = 0;
7
+ PUBLIC = 1;
8
+ PRIVATE = 2;
9
+
10
+ FIELD = 0;
11
+ ACCESSOR = 1;
12
+ METHOD = 2;
13
+ GETTER = 3;
14
+ SETTER = 4;
15
+
16
+ STATIC = 5;
17
+ */
18
+ function createMetadataMethodsForProperty(metadataMap, kind, property) {
19
+ return {
20
+ getMetadata(key) {
21
+ if (typeof key !== "symbol") {
22
+ throw new TypeError("Metadata keys must be symbols, received: " + key);
23
+ }
24
+
25
+ var metadataForKey = metadataMap[key];
26
+ if (metadataForKey === void 0) return void 0;
27
+
28
+ if (kind === 1
29
+ /* PUBLIC */
30
+ ) {
31
+ var pub = metadataForKey.public;
32
+
33
+ if (pub !== void 0) {
34
+ return pub[property];
35
+ }
36
+ } else if (kind === 2
37
+ /* PRIVATE */
38
+ ) {
39
+ var priv = metadataForKey.private;
40
+
41
+ if (priv !== void 0) {
42
+ return priv.get(property);
43
+ }
44
+ } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) {
45
+ return metadataForKey.constructor;
46
+ }
47
+ },
48
+
49
+ setMetadata(key, value) {
50
+ if (typeof key !== "symbol") {
51
+ throw new TypeError("Metadata keys must be symbols, received: " + key);
52
+ }
53
+
54
+ var metadataForKey = metadataMap[key];
55
+
56
+ if (metadataForKey === void 0) {
57
+ metadataForKey = metadataMap[key] = {};
58
+ }
59
+
60
+ if (kind === 1
61
+ /* PUBLIC */
62
+ ) {
63
+ var pub = metadataForKey.public;
64
+
65
+ if (pub === void 0) {
66
+ pub = metadataForKey.public = {};
67
+ }
68
+
69
+ pub[property] = value;
70
+ } else if (kind === 2
71
+ /* PRIVATE */
72
+ ) {
73
+ var priv = metadataForKey.priv;
74
+
75
+ if (priv === void 0) {
76
+ priv = metadataForKey.private = new Map();
77
+ }
78
+
79
+ priv.set(property, value);
80
+ } else {
81
+ metadataForKey.constructor = value;
82
+ }
83
+ }
84
+
85
+ };
86
+ }
87
+
88
+ function convertMetadataMapToFinal(obj, metadataMap) {
89
+ var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];
90
+ var metadataKeys = Object.getOwnPropertySymbols(metadataMap);
91
+ if (metadataKeys.length === 0) return;
92
+
93
+ for (var i = 0; i < metadataKeys.length; i++) {
94
+ var key = metadataKeys[i];
95
+ var metaForKey = metadataMap[key];
96
+ var parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null;
97
+ var pub = metaForKey.public;
98
+ var parentPub = parentMetaForKey ? parentMetaForKey.public : null;
99
+
100
+ if (pub && parentPub) {
101
+ Object.setPrototypeOf(pub, parentPub);
102
+ }
103
+
104
+ var priv = metaForKey.private;
105
+
106
+ if (priv) {
107
+ var privArr = Array.from(priv.values());
108
+ var parentPriv = parentMetaForKey ? parentMetaForKey.private : null;
109
+
110
+ if (parentPriv) {
111
+ privArr = privArr.concat(parentPriv);
112
+ }
113
+
114
+ metaForKey.private = privArr;
115
+ }
116
+
117
+ if (parentMetaForKey) {
118
+ Object.setPrototypeOf(metaForKey, parentMetaForKey);
119
+ }
120
+ }
121
+
122
+ if (parentMetadataMap) {
123
+ Object.setPrototypeOf(metadataMap, parentMetadataMap);
124
+ }
125
+
126
+ obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
127
+ }
128
+
129
+ function createAddInitializerMethod(initializers) {
130
+ return function addInitializer(initializer) {
131
+ assertValidInitializer(initializer);
132
+ initializers.push(initializer);
133
+ };
134
+ }
135
+
136
+ function memberDecCtx(base, name, desc, metadataMap, initializers, kind, isStatic, isPrivate) {
137
+ var kindStr;
138
+
139
+ switch (kind) {
140
+ case 1
141
+ /* ACCESSOR */
142
+ :
143
+ kindStr = "accessor";
144
+ break;
145
+
146
+ case 2
147
+ /* METHOD */
148
+ :
149
+ kindStr = "method";
150
+ break;
151
+
152
+ case 3
153
+ /* GETTER */
154
+ :
155
+ kindStr = "getter";
156
+ break;
157
+
158
+ case 4
159
+ /* SETTER */
160
+ :
161
+ kindStr = "setter";
162
+ break;
163
+
164
+ default:
165
+ kindStr = "field";
166
+ }
167
+
168
+ var ctx = {
169
+ kind: kindStr,
170
+ name: isPrivate ? "#" + name : name,
171
+ isStatic: isStatic,
172
+ isPrivate: isPrivate
173
+ };
174
+
175
+ if (kind !== 0
176
+ /* FIELD */
177
+ ) {
178
+ ctx.addInitializer = createAddInitializerMethod(initializers);
179
+ }
180
+
181
+ var metadataKind, metadataName;
182
+
183
+ if (isPrivate) {
184
+ metadataKind = 2
185
+ /* PRIVATE */
186
+ ;
187
+ metadataName = Symbol(name);
188
+ var access = {};
189
+
190
+ if (kind === 0
191
+ /* FIELD */
192
+ ) {
193
+ access.get = desc.get;
194
+ access.set = desc.set;
195
+ } else if (kind === 2
196
+ /* METHOD */
197
+ ) {
198
+ access.get = function () {
199
+ return desc.value;
200
+ };
201
+ } else {
202
+ // replace with values that will go through the final getter and setter
203
+ if (kind === 1
204
+ /* ACCESSOR */
205
+ || kind === 3
206
+ /* GETTER */
207
+ ) {
208
+ access.get = function () {
209
+ return desc.get.call(this);
210
+ };
211
+ }
212
+
213
+ if (kind === 1
214
+ /* ACCESSOR */
215
+ || kind === 4
216
+ /* SETTER */
217
+ ) {
218
+ access.set = function (v) {
219
+ desc.set.call(this, v);
220
+ };
221
+ }
222
+ }
223
+
224
+ ctx.access = access;
225
+ } else {
226
+ metadataKind = 1
227
+ /* PUBLIC */
228
+ ;
229
+ metadataName = name;
230
+ }
231
+
232
+ return Object.assign(ctx, createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName));
233
+ }
234
+
235
+ function assertValidInitializer(initializer) {
236
+ if (typeof initializer !== "function") {
237
+ throw new Error("initializers must be functions");
238
+ }
239
+ }
240
+
241
+ function assertValidReturnValue(kind, value) {
242
+ var type = typeof value;
243
+
244
+ if (kind === 1
245
+ /* ACCESSOR */
246
+ ) {
247
+ if (type !== "object" || value === null) {
248
+ throw new Error("accessor decorators must return an object with get, set, or initializer properties or void 0");
249
+ }
250
+ } else if (type !== "function") {
251
+ if (kind === 0
252
+ /* FIELD */
253
+ ) {
254
+ throw new Error("field decorators must return a initializer function or void 0");
255
+ } else {
256
+ throw new Error("method decorators must return a function or void 0");
257
+ }
258
+ }
259
+ }
260
+
261
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
262
+ var decs = decInfo[0];
263
+ var desc, initializer, value;
264
+
265
+ if (isPrivate) {
266
+ if (kind === 0
267
+ /* FIELD */
268
+ || kind === 1
269
+ /* ACCESSOR */
270
+ ) {
271
+ desc = {
272
+ get: decInfo[3],
273
+ set: decInfo[4]
274
+ };
275
+ } else if (kind === 3
276
+ /* GETTER */
277
+ ) {
278
+ desc = {
279
+ get: decInfo[3]
280
+ };
281
+ } else if (kind === 4
282
+ /* SETTER */
283
+ ) {
284
+ desc = {
285
+ set: decInfo[3]
286
+ };
287
+ } else {
288
+ desc = {
289
+ value: decInfo[3]
290
+ };
291
+ }
292
+ } else if (kind !== 0
293
+ /* FIELD */
294
+ ) {
295
+ desc = Object.getOwnPropertyDescriptor(base, name);
296
+ }
297
+
298
+ if (kind === 1
299
+ /* ACCESSOR */
300
+ ) {
301
+ value = {
302
+ get: desc.get,
303
+ set: desc.set
304
+ };
305
+ } else if (kind === 2
306
+ /* METHOD */
307
+ ) {
308
+ value = desc.value;
309
+ } else if (kind === 3
310
+ /* GETTER */
311
+ ) {
312
+ value = desc.get;
313
+ } else if (kind === 4
314
+ /* SETTER */
315
+ ) {
316
+ value = desc.set;
317
+ }
318
+
319
+ var ctx = memberDecCtx(base, name, desc, metadataMap, initializers, kind, isStatic, isPrivate);
320
+ var newValue, get, set;
321
+
322
+ if (typeof decs === "function") {
323
+ newValue = decs(value, ctx);
324
+
325
+ if (newValue !== void 0) {
326
+ assertValidReturnValue(kind, newValue);
327
+
328
+ if (kind === 0
329
+ /* FIELD */
330
+ ) {
331
+ initializer = newValue;
332
+ } else if (kind === 1
333
+ /* ACCESSOR */
334
+ ) {
335
+ initializer = newValue.initializer;
336
+ get = newValue.get || value.get;
337
+ set = newValue.set || value.set;
338
+ value = {
339
+ get: get,
340
+ set: set
341
+ };
342
+ } else {
343
+ value = newValue;
344
+ }
345
+ }
346
+ } else {
347
+ for (var i = 0; i < decs.length; i++) {
348
+ var dec = decs[i];
349
+ newValue = dec(value, ctx);
350
+
351
+ if (newValue !== void 0) {
352
+ assertValidReturnValue(kind, newValue);
353
+ var newInit;
354
+
355
+ if (kind === 0
356
+ /* FIELD */
357
+ ) {
358
+ newInit = newValue;
359
+ } else if (kind === 1
360
+ /* ACCESSOR */
361
+ ) {
362
+ newInit = newValue.initializer;
363
+ get = newValue.get || value.get;
364
+ set = newValue.set || value.set;
365
+ value = {
366
+ get: get,
367
+ set: set
368
+ };
369
+ } else {
370
+ value = newValue;
371
+ }
372
+
373
+ if (newInit !== void 0) {
374
+ if (initializer === void 0) {
375
+ initializer = newInit;
376
+ } else if (typeof initializer === "function") {
377
+ initializer = [initializer, newInit];
378
+ } else {
379
+ initializer.push(newInit);
380
+ }
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ if (kind === 0
387
+ /* FIELD */
388
+ || kind === 1
389
+ /* ACCESSOR */
390
+ ) {
391
+ if (initializer === void 0) {
392
+ // If the initializer was void 0, sub in a dummy initializer
393
+ initializer = function (instance, init) {
394
+ return init;
395
+ };
396
+ } else if (typeof initializer !== "function") {
397
+ var ownInitializers = initializer;
398
+
399
+ initializer = function (instance, init) {
400
+ var value = init;
401
+
402
+ for (var i = 0; i < ownInitializers.length; i++) {
403
+ value = ownInitializers[i].call(instance, value);
404
+ }
405
+
406
+ return value;
407
+ };
408
+ } else {
409
+ var originalInitializer = initializer;
410
+
411
+ initializer = function (instance, init) {
412
+ return originalInitializer.call(instance, init);
413
+ };
414
+ }
415
+
416
+ ret.push(initializer);
417
+ }
418
+
419
+ if (kind !== 0
420
+ /* FIELD */
421
+ ) {
422
+ if (kind === 1
423
+ /* ACCESSOR */
424
+ ) {
425
+ desc.get = value.get;
426
+ desc.set = value.set;
427
+ } else if (kind === 2
428
+ /* METHOD */
429
+ ) {
430
+ desc.value = value;
431
+ } else if (kind === 3
432
+ /* GETTER */
433
+ ) {
434
+ desc.get = value;
435
+ } else if (kind === 4
436
+ /* SETTER */
437
+ ) {
438
+ desc.set = value;
439
+ }
440
+
441
+ if (isPrivate) {
442
+ if (kind === 1
443
+ /* ACCESSOR */
444
+ ) {
445
+ ret.push(function (instance, args) {
446
+ return value.get.call(instance, args);
447
+ });
448
+ ret.push(function (instance, args) {
449
+ return value.set.call(instance, args);
450
+ });
451
+ } else if (kind === 2
452
+ /* METHOD */
453
+ ) {
454
+ ret.push(value);
455
+ } else {
456
+ ret.push(function (instance, args) {
457
+ return value.call(instance, args);
458
+ });
459
+ }
460
+ } else {
461
+ Object.defineProperty(base, name, desc);
462
+ }
463
+ }
464
+ }
465
+
466
+ function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
467
+ var protoInitializers;
468
+ var staticInitializers;
469
+ var existingProtoNonFields = new Map();
470
+ var existingStaticNonFields = new Map();
471
+
472
+ for (var i = 0; i < decInfos.length; i++) {
473
+ var decInfo = decInfos[i]; // skip computed property names
474
+
475
+ if (!Array.isArray(decInfo)) continue;
476
+ var kind = decInfo[1];
477
+ var name = decInfo[2];
478
+ var isPrivate = decInfo.length > 3;
479
+ var isStatic = kind >= 5;
480
+ /* STATIC */
481
+
482
+ var base;
483
+ var metadataMap;
484
+ var initializers;
485
+
486
+ if (isStatic) {
487
+ base = Class;
488
+ metadataMap = staticMetadataMap;
489
+ kind = kind - 5
490
+ /* STATIC */
491
+ ;
492
+
493
+ if (!staticInitializers) {
494
+ staticInitializers = [];
495
+ }
496
+
497
+ initializers = staticInitializers;
498
+ } else {
499
+ base = Class.prototype;
500
+ metadataMap = protoMetadataMap;
501
+
502
+ if (!protoInitializers) {
503
+ protoInitializers = [];
504
+ }
505
+
506
+ initializers = protoInitializers;
507
+ }
508
+
509
+ if (kind !== 0
510
+ /* FIELD */
511
+ && !isPrivate) {
512
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
513
+ var existingKind = existingNonFields.get(name) || 0;
514
+
515
+ if (existingKind === true || existingKind === 3
516
+ /* GETTER */
517
+ && kind !== 4
518
+ /* SETTER */
519
+ || existingKind === 4
520
+ /* SETTER */
521
+ && kind !== 3
522
+ /* GETTER */
523
+ ) {
524
+ 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);
525
+ } else if (!existingKind && kind > 2
526
+ /* METHOD */
527
+ ) {
528
+ existingNonFields.set(name, kind);
529
+ } else {
530
+ existingNonFields.set(name, true);
531
+ }
532
+ }
533
+
534
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
535
+ }
536
+
537
+ if (protoInitializers) {
538
+ pushInitializers(ret, protoInitializers);
539
+ }
540
+
541
+ if (staticInitializers) {
542
+ pushInitializers(ret, staticInitializers);
543
+ }
544
+ }
545
+
546
+ function pushInitializers(ret, initializers) {
547
+ if (initializers.length > 0) {
548
+ // Slice the array, which means that `addInitializer` can no longer add
549
+ // additional initializers to the array
550
+ initializers = initializers.slice();
551
+ ret.push(function (instance) {
552
+ for (var i = 0; i < initializers.length; i++) {
553
+ initializers[i].call(instance, instance);
554
+ }
555
+
556
+ return instance;
557
+ });
558
+ } else {
559
+ ret.push(function (instance) {
560
+ return instance;
561
+ });
562
+ }
563
+ }
564
+
565
+ function applyClassDecs(ret, targetClass, metadataMap, classDecs) {
566
+ var initializers = [];
567
+ var newClass = targetClass;
568
+ var name = targetClass.name;
569
+ var ctx = Object.assign({
570
+ kind: "class",
571
+ name: name,
572
+ addInitializer: createAddInitializerMethod(initializers)
573
+ }, createMetadataMethodsForProperty(metadataMap, 0
574
+ /* CONSTRUCTOR */
575
+ , name));
576
+
577
+ for (var i = 0; i < classDecs.length; i++) {
578
+ newClass = classDecs[i](newClass, ctx) || newClass;
579
+ }
580
+
581
+ ret.push(newClass);
582
+
583
+ if (initializers.length > 0) {
584
+ ret.push(function () {
585
+ for (var i = 0; i < initializers.length; i++) {
586
+ initializers[i].call(newClass, newClass);
587
+ }
588
+ });
589
+ } else {
590
+ ret.push(function () {});
591
+ }
592
+ }
593
+ /**
594
+ Basic usage:
595
+
596
+ applyDecs(
597
+ Class,
598
+ [
599
+ // member decorators
600
+ [
601
+ dec, // dec or array of decs
602
+ 0, // kind of value being decorated
603
+ 'prop', // name of public prop on class containing the value being decorated,
604
+ '#p', // the name of the private property (if is private, void 0 otherwise),
605
+ ]
606
+ ],
607
+ [
608
+ // class decorators
609
+ dec1, dec2
610
+ ]
611
+ )
612
+ ```
613
+
614
+ Fully transpiled example:
615
+
616
+ ```js
617
+ @dec
618
+ class Class {
619
+ @dec
620
+ a = 123;
621
+
622
+ @dec
623
+ #a = 123;
624
+
625
+ @dec
626
+ @dec2
627
+ accessor b = 123;
628
+
629
+ @dec
630
+ accessor #b = 123;
631
+
632
+ @dec
633
+ c() { console.log('c'); }
634
+
635
+ @dec
636
+ #c() { console.log('privC'); }
637
+
638
+ @dec
639
+ get d() { console.log('d'); }
640
+
641
+ @dec
642
+ get #d() { console.log('privD'); }
643
+
644
+ @dec
645
+ set e(v) { console.log('e'); }
646
+
647
+ @dec
648
+ set #e(v) { console.log('privE'); }
649
+ }
650
+
651
+
652
+ // becomes
653
+ let initializeInstance;
654
+ let initializeClass;
655
+
656
+ let initA;
657
+ let initPrivA;
658
+
659
+ let initB;
660
+ let initPrivB, getPrivB, setPrivB;
661
+
662
+ let privC;
663
+ let privD;
664
+ let privE;
665
+
666
+ let Class;
667
+ class _Class {
668
+ static {
669
+ let ret = applyDecs(
670
+ this,
671
+ [
672
+ [dec, 0, 'a'],
673
+ [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
674
+ [[dec, dec2], 1, 'b'],
675
+ [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
676
+ [dec, 2, 'c'],
677
+ [dec, 2, 'c', () => console.log('privC')],
678
+ [dec, 3, 'd'],
679
+ [dec, 3, 'd', () => console.log('privD')],
680
+ [dec, 4, 'e'],
681
+ [dec, 4, 'e', () => console.log('privE')],
682
+ ],
683
+ [
684
+ dec
685
+ ]
686
+ )
687
+
688
+ initA = ret[0];
689
+
690
+ initPrivA = ret[1];
691
+
692
+ initB = ret[2];
693
+
694
+ initPrivB = ret[3];
695
+ getPrivB = ret[4];
696
+ setPrivB = ret[5];
697
+
698
+ privC = ret[6];
699
+
700
+ privD = ret[7];
701
+
702
+ privE = ret[8];
703
+
704
+ initializeInstance = ret[9];
705
+
706
+ Class = ret[10]
707
+
708
+ initializeClass = ret[11];
709
+ }
710
+
711
+ a = (initializeInstance(this), initA(this, 123));
712
+
713
+ #a = initPrivA(this, 123);
714
+
715
+ #bData = initB(this, 123);
716
+ get b() { return this.#bData }
717
+ set b(v) { this.#bData = v }
718
+
719
+ #privBData = initPrivB(this, 123);
720
+ get #b() { return getPrivB(this); }
721
+ set #b(v) { setPrivB(this, v); }
722
+
723
+ c() { console.log('c'); }
724
+
725
+ #c(...args) { return privC(this, ...args) }
726
+
727
+ get d() { console.log('d'); }
728
+
729
+ get #d() { return privD(this); }
730
+
731
+ set e(v) { console.log('e'); }
732
+
733
+ set #e(v) { privE(this, v); }
734
+ }
735
+
736
+ initializeClass(Class);
737
+ */
738
+
739
+
740
+ export default function applyDecs(targetClass, memberDecs, classDecs) {
741
+ var ret = [];
742
+ var staticMetadataMap = {};
743
+
744
+ if (memberDecs) {
745
+ var protoMetadataMap = {};
746
+ applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs);
747
+ convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap);
748
+ }
749
+
750
+ if (classDecs) {
751
+ applyClassDecs(ret, targetClass, staticMetadataMap, classDecs);
752
+ }
753
+
754
+ convertMetadataMapToFinal(targetClass, staticMetadataMap);
755
+ return ret;
756
+ }