lwc 2.35.0 → 2.35.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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +48 -121
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +48 -121
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +87 -61
  5. package/dist/engine-dom/iife/es5/engine-dom.js +48 -119
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +89 -60
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +48 -121
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +87 -61
  11. package/dist/engine-dom/umd/es5/engine-dom.js +48 -119
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +89 -60
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +45 -134
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +45 -134
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +9 -40
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +9 -40
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +8 -38
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +9 -38
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +8 -36
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +9 -40
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +8 -38
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +9 -38
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +8 -36
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -203,39 +203,11 @@ var LWC = (function (exports) {
203
203
  * SPDX-License-Identifier: MIT
204
204
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
205
205
  */
206
- // Inspired from: https://mathiasbynens.be/notes/globalthis
207
- var _globalThis = /*@__PURE__*/function () {
208
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
209
- if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object') {
210
- return globalThis;
211
- }
212
- var _globalThis;
213
- try {
214
- // eslint-disable-next-line no-extend-native
215
- Object.defineProperty(Object.prototype, '__magic__', {
216
- get: function get() {
217
- return this;
218
- },
219
- configurable: true
220
- });
221
- // __magic__ is undefined in Safari 10 and IE10 and older.
222
- // @ts-ignore
223
- // eslint-disable-next-line no-undef
224
- _globalThis = __magic__;
225
- // @ts-ignore
226
- delete Object.prototype.__magic__;
227
- } catch (ex) {
228
- // In IE8, Object.defineProperty only works on DOM objects.
229
- } finally {
230
- // If the magic above fails for some reason we assume that we are in a legacy browser.
231
- // Assume `window` exists in this case.
232
- if (typeof _globalThis === 'undefined') {
233
- // @ts-ignore
234
- _globalThis = window;
235
- }
236
- }
237
- return _globalThis;
238
- }();
206
+ // See browser support for globalThis:
207
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
208
+ /* istanbul ignore next */
209
+ // @ts-ignore
210
+ var _globalThis = (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object' ? globalThis : window;
239
211
 
240
212
  /*
241
213
  * Copyright (c) 2018, salesforce.com, inc.
@@ -338,7 +310,7 @@ var LWC = (function (exports) {
338
310
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
339
311
  return propertyName;
340
312
  }
341
- /** version: 2.35.0 */
313
+ /** version: 2.35.1 */
342
314
 
343
315
  /**
344
316
  * Copyright (C) 2018 salesforce.com, inc.
@@ -390,6 +362,7 @@ var LWC = (function (exports) {
390
362
  console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
391
363
  return;
392
364
  }
365
+ // This may seem redundant, but `"production" === 'test-karma-lwc'` is replaced by Karma tests
393
366
  {
394
367
  // Disallow the same flag to be set more than once in production
395
368
  var runtimeValue = lwcRuntimeFlags[name];
@@ -409,7 +382,7 @@ var LWC = (function (exports) {
409
382
  */
410
383
  function setFeatureFlagForTest(name, value) {
411
384
  }
412
- /** version: 2.35.0 */
385
+ /** version: 2.35.1 */
413
386
 
414
387
  /**
415
388
  * Copyright (C) 2018 salesforce.com, inc.
@@ -473,7 +446,7 @@ var LWC = (function (exports) {
473
446
  }
474
447
  }
475
448
  }
476
- /** version: 2.35.0 */
449
+ /** version: 2.35.1 */
477
450
 
478
451
  /*
479
452
  * Copyright (c) 2018, salesforce.com, inc.
@@ -865,6 +838,14 @@ var LWC = (function (exports) {
865
838
  refVNodes[ref] = vnode;
866
839
  }
867
840
  }
841
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
842
+ function assertNotProd() {
843
+ /* istanbul ignore if */
844
+ {
845
+ // this method should never leak to prod
846
+ throw new ReferenceError();
847
+ }
848
+ }
868
849
 
869
850
  /*
870
851
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1562,7 +1543,6 @@ var LWC = (function (exports) {
1562
1543
  }
1563
1544
  };
1564
1545
  }
1565
- var EMPTY_REFS = freeze(create(null));
1566
1546
  var refsCache = new WeakMap();
1567
1547
  /**
1568
1548
  * This class is the base class for any LWC element.
@@ -1729,22 +1709,15 @@ var LWC = (function (exports) {
1729
1709
  // based on `this.refs.bar`.
1730
1710
  return;
1731
1711
  }
1732
- var refVNodes = vm.refVNodes,
1733
- hasRefVNodes = vm.hasRefVNodes;
1712
+ var refVNodes = vm.refVNodes;
1734
1713
  vm.cmpTemplate;
1735
1714
  // For backwards compatibility with component written before template refs
1736
1715
  // were introduced, we return undefined if the template has no refs defined
1737
1716
  // anywhere. This fixes components that may want to add an expando called `refs`
1738
1717
  // and are checking if it exists with `if (this.refs)` before adding it.
1739
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
1740
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
1741
- if (!hasRefVNodes) {
1742
- return;
1743
- }
1744
- // For templates that are using `lwc:ref`, if there are no refs currently available
1745
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
1718
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
1746
1719
  if (isNull(refVNodes)) {
1747
- return EMPTY_REFS;
1720
+ return;
1748
1721
  }
1749
1722
  // The refNodes can be cached based on the refVNodes, since the refVNodes
1750
1723
  // are recreated from scratch every time the template is rendered.
@@ -2570,10 +2543,60 @@ var LWC = (function (exports) {
2570
2543
  }
2571
2544
  freeze(BaseBridgeElement);
2572
2545
  seal(BaseBridgeElement.prototype);
2546
+ var swappedStyleMap = new WeakMap();
2547
+ var activeTemplates = new WeakMap();
2548
+ var activeComponents = new WeakMap();
2549
+ var activeStyles = new WeakMap();
2550
+ function getStyleOrSwappedStyle(style) {
2551
+ assertNotProd(); // this method should never leak to prod
2552
+ var visited = new Set();
2553
+ while (swappedStyleMap.has(style) && !visited.has(style)) {
2554
+ visited.add(style);
2555
+ style = swappedStyleMap.get(style);
2556
+ }
2557
+ return style;
2558
+ }
2573
2559
  function setActiveVM(vm) {
2574
- {
2575
- // this method should never leak to prod
2576
- throw new ReferenceError();
2560
+ assertNotProd(); // this method should never leak to prod
2561
+ // tracking active component
2562
+ var Ctor = vm.def.ctor;
2563
+ var componentVMs = activeComponents.get(Ctor);
2564
+ if (isUndefined$1(componentVMs)) {
2565
+ componentVMs = new Set();
2566
+ activeComponents.set(Ctor, componentVMs);
2567
+ }
2568
+ // this will allow us to keep track of the hot components
2569
+ componentVMs.add(vm);
2570
+ // tracking active template
2571
+ var tpl = vm.cmpTemplate;
2572
+ if (tpl) {
2573
+ var templateVMs = activeTemplates.get(tpl);
2574
+ if (isUndefined$1(templateVMs)) {
2575
+ templateVMs = new Set();
2576
+ activeTemplates.set(tpl, templateVMs);
2577
+ }
2578
+ // this will allow us to keep track of the templates that are
2579
+ // being used by a hot component
2580
+ templateVMs.add(vm);
2581
+ // tracking active styles associated to template
2582
+ var stylesheets = tpl.stylesheets;
2583
+ if (!isUndefined$1(stylesheets)) {
2584
+ flattenStylesheets(stylesheets).forEach(function (stylesheet) {
2585
+ // this is necessary because we don't hold the list of styles
2586
+ // in the vm, we only hold the selected (already swapped template)
2587
+ // but the styles attached to the template might not be the actual
2588
+ // active ones, but the swapped versions of those.
2589
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
2590
+ var stylesheetVMs = activeStyles.get(stylesheet);
2591
+ if (isUndefined$1(stylesheetVMs)) {
2592
+ stylesheetVMs = new Set();
2593
+ activeStyles.set(stylesheet, stylesheetVMs);
2594
+ }
2595
+ // this will allow us to keep track of the stylesheet that are
2596
+ // being used by a hot component
2597
+ stylesheetVMs.add(vm);
2598
+ });
2599
+ }
2577
2600
  }
2578
2601
  }
2579
2602
  function swapTemplate(oldTpl, newTpl) {
@@ -4353,9 +4376,18 @@ var LWC = (function (exports) {
4353
4376
  vmBeingRendered = vm;
4354
4377
  }
4355
4378
  function validateSlots(vm, html) {
4356
- {
4357
- // this method should never leak to prod
4358
- throw new ReferenceError();
4379
+ assertNotProd(); // this method should never leak to prod
4380
+ var cmpSlots = vm.cmpSlots;
4381
+ var _html$slots = html.slots,
4382
+ slots = _html$slots === void 0 ? EmptyArray : _html$slots;
4383
+ for (var slotName in cmpSlots.slotAssignments) {
4384
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4385
+ assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), "Slots can only be set to an array, instead received ".concat(toString$1(cmpSlots.slotAssignments[slotName]), " for slot \"").concat(slotName, "\" in ").concat(vm, "."));
4386
+ if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
4387
+ // TODO [#1297]: this should never really happen because the compiler should always validate
4388
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4389
+ logError("Ignoring unknown provided slot name \"".concat(slotName, "\" in ").concat(vm, ". Check for a typo on the slot attribute."), vm);
4390
+ }
4359
4391
  }
4360
4392
  }
4361
4393
  function validateLightDomTemplate(template, vm) {
@@ -4479,9 +4511,7 @@ var LWC = (function (exports) {
4479
4511
  }
4480
4512
  if ("production" !== 'production') ;
4481
4513
  // reset the refs; they will be set during the tmpl() instantiation
4482
- var hasRefVNodes = Boolean(html.hasRefs);
4483
- vm.hasRefVNodes = hasRefVNodes;
4484
- vm.refVNodes = hasRefVNodes ? create(null) : null;
4514
+ vm.refVNodes = html.hasRefs ? create(null) : null;
4485
4515
  // right before producing the vnodes, we clear up all internal references
4486
4516
  // to custom elements from the template.
4487
4517
  vm.velements = [];
@@ -4643,7 +4673,7 @@ var LWC = (function (exports) {
4643
4673
  var cmpEventListenerMap = new WeakMap();
4644
4674
  function getWrappedComponentsListener(vm, listener) {
4645
4675
  if (!isFunction$1(listener)) {
4646
- throw new TypeError(); // avoiding problems with non-valid listeners
4676
+ throw new TypeError('Expected an EventListener but received ' + _typeof(listener)); // avoiding problems with non-valid listeners
4647
4677
  }
4648
4678
 
4649
4679
  var wrappedListener = cmpEventListenerMap.get(listener);
@@ -4774,7 +4804,6 @@ var LWC = (function (exports) {
4774
4804
  mode: mode,
4775
4805
  owner: owner,
4776
4806
  refVNodes: null,
4777
- hasRefVNodes: false,
4778
4807
  children: EmptyArray,
4779
4808
  aChildren: EmptyArray,
4780
4809
  velements: EmptyArray,
@@ -6750,7 +6779,7 @@ var LWC = (function (exports) {
6750
6779
  function isNull(obj) {
6751
6780
  return obj === null;
6752
6781
  }
6753
- /** version: 2.35.0 */
6782
+ /** version: 2.35.1 */
6754
6783
 
6755
6784
  /*
6756
6785
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7309,7 +7338,7 @@ var LWC = (function (exports) {
7309
7338
  });
7310
7339
  freeze(LightningElement);
7311
7340
  seal(LightningElement.prototype);
7312
- /* version: 2.35.0 */
7341
+ /* version: 2.35.1 */
7313
7342
 
7314
7343
  exports.LightningElement = LightningElement;
7315
7344
  exports.__unstable__ProfilerControl = profilerControl;
@@ -208,41 +208,11 @@
208
208
  * SPDX-License-Identifier: MIT
209
209
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
210
210
  */
211
- // Inspired from: https://mathiasbynens.be/notes/globalthis
212
- const _globalThis = /*@__PURE__*/ (function () {
213
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
214
- if (typeof globalThis === 'object') {
215
- return globalThis;
216
- }
217
- let _globalThis;
218
- try {
219
- // eslint-disable-next-line no-extend-native
220
- Object.defineProperty(Object.prototype, '__magic__', {
221
- get: function () {
222
- return this;
223
- },
224
- configurable: true,
225
- });
226
- // __magic__ is undefined in Safari 10 and IE10 and older.
227
- // @ts-ignore
228
- // eslint-disable-next-line no-undef
229
- _globalThis = __magic__;
230
- // @ts-ignore
231
- delete Object.prototype.__magic__;
232
- }
233
- catch (ex) {
234
- // In IE8, Object.defineProperty only works on DOM objects.
235
- }
236
- finally {
237
- // If the magic above fails for some reason we assume that we are in a legacy browser.
238
- // Assume `window` exists in this case.
239
- if (typeof _globalThis === 'undefined') {
240
- // @ts-ignore
241
- _globalThis = window;
242
- }
243
- }
244
- return _globalThis;
245
- })();
211
+ // See browser support for globalThis:
212
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
213
+ /* istanbul ignore next */
214
+ // @ts-ignore
215
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
246
216
 
247
217
  /*
248
218
  * Copyright (c) 2018, salesforce.com, inc.
@@ -365,9 +335,9 @@
365
335
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
366
336
  */
367
337
  // Increment whenever the LWC template compiler changes
368
- const LWC_VERSION = "2.35.0";
338
+ const LWC_VERSION = "2.35.1";
369
339
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.35.0 */
340
+ /** version: 2.35.1 */
371
341
 
372
342
  /**
373
343
  * Copyright (C) 2018 salesforce.com, inc.
@@ -420,7 +390,8 @@
420
390
  console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
421
391
  return;
422
392
  }
423
- if (process.env.NODE_ENV !== 'production') {
393
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
394
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
424
395
  // Allow the same flag to be set more than once outside of production to enable testing
425
396
  lwcRuntimeFlags[name] = value;
426
397
  }
@@ -440,11 +411,12 @@
440
411
  * purposes. It is a no-op when invoked in production mode.
441
412
  */
442
413
  function setFeatureFlagForTest(name, value) {
443
- if (process.env.NODE_ENV !== 'production') {
414
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
415
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
444
416
  setFeatureFlag(name, value);
445
417
  }
446
418
  }
447
- /** version: 2.35.0 */
419
+ /** version: 2.35.1 */
448
420
 
449
421
  /**
450
422
  * Copyright (C) 2018 salesforce.com, inc.
@@ -508,7 +480,7 @@
508
480
  }
509
481
  }
510
482
  }
511
- /** version: 2.35.0 */
483
+ /** version: 2.35.1 */
512
484
 
513
485
  /*
514
486
  * Copyright (c) 2018, salesforce.com, inc.
@@ -529,8 +501,7 @@
529
501
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
530
502
  */
531
503
  // Only used in LWC's Karma tests
532
- // @ts-ignore
533
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
504
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
534
505
  window.addEventListener('test-dummy-flag', () => {
535
506
  let hasFlag = false;
536
507
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -554,8 +525,7 @@
554
525
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
555
526
  */
556
527
  // Only used in LWC's Karma tests
557
- // @ts-ignore
558
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
528
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
559
529
  window.addEventListener('test-dummy-flag', () => {
560
530
  let hasFlag = false;
561
531
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -696,8 +666,8 @@
696
666
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
697
667
  */
698
668
  const alreadyLoggedMessages = new Set();
699
- // @ts-ignore
700
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
669
+ // Only used in LWC's Karma tests
670
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
701
671
  // @ts-ignore
702
672
  window.__lwcResetAlreadyLoggedMessages = () => {
703
673
  alreadyLoggedMessages.clear();
@@ -946,6 +916,14 @@
946
916
  refVNodes[ref] = vnode;
947
917
  }
948
918
  }
919
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
920
+ function assertNotProd() {
921
+ /* istanbul ignore if */
922
+ if (process.env.NODE_ENV === 'production') {
923
+ // this method should never leak to prod
924
+ throw new ReferenceError();
925
+ }
926
+ }
949
927
 
950
928
  /*
951
929
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1151,27 +1129,18 @@
1151
1129
  }
1152
1130
  let isDomMutationAllowed = false;
1153
1131
  function unlockDomMutation() {
1154
- if (process.env.NODE_ENV === 'production') {
1155
- // this method should never leak to prod
1156
- throw new ReferenceError();
1157
- }
1132
+ assertNotProd(); // this method should never leak to prod
1158
1133
  isDomMutationAllowed = true;
1159
1134
  }
1160
1135
  function lockDomMutation() {
1161
- if (process.env.NODE_ENV === 'production') {
1162
- // this method should never leak to prod
1163
- throw new ReferenceError();
1164
- }
1136
+ assertNotProd(); // this method should never leak to prod
1165
1137
  isDomMutationAllowed = false;
1166
1138
  }
1167
1139
  function logMissingPortalError(name, type) {
1168
1140
  return logError(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
1169
1141
  }
1170
1142
  function patchElementWithRestrictions(elm, options) {
1171
- if (process.env.NODE_ENV === 'production') {
1172
- // this method should never leak to prod
1173
- throw new ReferenceError();
1174
- }
1143
+ assertNotProd(); // this method should never leak to prod
1175
1144
  const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
1176
1145
  const descriptors = {
1177
1146
  outerHTML: generateAccessorDescriptor({
@@ -1252,10 +1221,7 @@
1252
1221
  defineProperties(elm, descriptors);
1253
1222
  }
1254
1223
  function getShadowRootRestrictionsDescriptors(sr) {
1255
- if (process.env.NODE_ENV === 'production') {
1256
- // this method should never leak to prod
1257
- throw new ReferenceError();
1258
- }
1224
+ assertNotProd(); // this method should never leak to prod
1259
1225
  // Disallowing properties in dev mode only to avoid people doing the wrong
1260
1226
  // thing when using the real shadow root, because if that's the case,
1261
1227
  // the component will not work when running with synthetic shadow.
@@ -1296,10 +1262,7 @@
1296
1262
  // Custom Elements Restrictions:
1297
1263
  // -----------------------------
1298
1264
  function getCustomElementRestrictionsDescriptors(elm) {
1299
- if (process.env.NODE_ENV === 'production') {
1300
- // this method should never leak to prod
1301
- throw new ReferenceError();
1302
- }
1265
+ assertNotProd(); // this method should never leak to prod
1303
1266
  const originalAddEventListener = elm.addEventListener;
1304
1267
  const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1305
1268
  const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
@@ -1344,10 +1307,7 @@
1344
1307
  };
1345
1308
  }
1346
1309
  function getComponentRestrictionsDescriptors() {
1347
- if (process.env.NODE_ENV === 'production') {
1348
- // this method should never leak to prod
1349
- throw new ReferenceError();
1350
- }
1310
+ assertNotProd(); // this method should never leak to prod
1351
1311
  return {
1352
1312
  tagName: generateAccessorDescriptor({
1353
1313
  get() {
@@ -1361,10 +1321,7 @@
1361
1321
  };
1362
1322
  }
1363
1323
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1364
- if (process.env.NODE_ENV === 'production') {
1365
- // this method should never leak to prod
1366
- throw new ReferenceError();
1367
- }
1324
+ assertNotProd(); // this method should never leak to prod
1368
1325
  const originalDispatchEvent = proto.dispatchEvent;
1369
1326
  const descriptors = {
1370
1327
  dispatchEvent: generateDataDescriptor({
@@ -2078,7 +2035,6 @@
2078
2035
  }
2079
2036
  };
2080
2037
  }
2081
- const EMPTY_REFS = freeze(create(null));
2082
2038
  const refsCache = new WeakMap();
2083
2039
  /**
2084
2040
  * This class is the base class for any LWC element.
@@ -2366,7 +2322,6 @@
2366
2322
  }
2367
2323
  const {
2368
2324
  refVNodes,
2369
- hasRefVNodes,
2370
2325
  cmpTemplate
2371
2326
  } = vm;
2372
2327
  // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
@@ -2380,15 +2335,9 @@
2380
2335
  // were introduced, we return undefined if the template has no refs defined
2381
2336
  // anywhere. This fixes components that may want to add an expando called `refs`
2382
2337
  // and are checking if it exists with `if (this.refs)` before adding it.
2383
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
2384
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
2385
- if (!hasRefVNodes) {
2386
- return;
2387
- }
2388
- // For templates that are using `lwc:ref`, if there are no refs currently available
2389
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
2338
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
2390
2339
  if (isNull(refVNodes)) {
2391
- return EMPTY_REFS;
2340
+ return;
2392
2341
  }
2393
2342
  // The refNodes can be cached based on the refVNodes, since the refVNodes
2394
2343
  // are recreated from scratch every time the template is rendered.
@@ -3203,8 +3152,8 @@
3203
3152
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3204
3153
  */
3205
3154
  let warned = false;
3206
- // @ts-ignore
3207
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
3155
+ // Only used in LWC's Karma tests
3156
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
3208
3157
  // @ts-ignore
3209
3158
  window.__lwcResetWarnedOnVersionMismatch = () => {
3210
3159
  warned = false;
@@ -3500,10 +3449,7 @@
3500
3449
  return canRefreshAllInstances;
3501
3450
  }
3502
3451
  function getTemplateOrSwappedTemplate(tpl) {
3503
- if (process.env.NODE_ENV === 'production') {
3504
- // this method should never leak to prod
3505
- throw new ReferenceError();
3506
- }
3452
+ assertNotProd(); // this method should never leak to prod
3507
3453
  const visited = new Set();
3508
3454
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3509
3455
  visited.add(tpl);
@@ -3512,10 +3458,7 @@
3512
3458
  return tpl;
3513
3459
  }
3514
3460
  function getComponentOrSwappedComponent(Ctor) {
3515
- if (process.env.NODE_ENV === 'production') {
3516
- // this method should never leak to prod
3517
- throw new ReferenceError();
3518
- }
3461
+ assertNotProd(); // this method should never leak to prod
3519
3462
  const visited = new Set();
3520
3463
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3521
3464
  visited.add(Ctor);
@@ -3524,10 +3467,7 @@
3524
3467
  return Ctor;
3525
3468
  }
3526
3469
  function getStyleOrSwappedStyle(style) {
3527
- if (process.env.NODE_ENV === 'production') {
3528
- // this method should never leak to prod
3529
- throw new ReferenceError();
3530
- }
3470
+ assertNotProd(); // this method should never leak to prod
3531
3471
  const visited = new Set();
3532
3472
  while (swappedStyleMap.has(style) && !visited.has(style)) {
3533
3473
  visited.add(style);
@@ -3536,10 +3476,7 @@
3536
3476
  return style;
3537
3477
  }
3538
3478
  function setActiveVM(vm) {
3539
- if (process.env.NODE_ENV === 'production') {
3540
- // this method should never leak to prod
3541
- throw new ReferenceError();
3542
- }
3479
+ assertNotProd(); // this method should never leak to prod
3543
3480
  // tracking active component
3544
3481
  const Ctor = vm.def.ctor;
3545
3482
  let componentVMs = activeComponents.get(Ctor);
@@ -3582,10 +3519,7 @@
3582
3519
  }
3583
3520
  }
3584
3521
  function removeActiveVM(vm) {
3585
- if (process.env.NODE_ENV === 'production') {
3586
- // this method should never leak to prod
3587
- throw new ReferenceError();
3588
- }
3522
+ assertNotProd(); // this method should never leak to prod
3589
3523
  // tracking inactive component
3590
3524
  const Ctor = vm.def.ctor;
3591
3525
  let list = activeComponents.get(Ctor);
@@ -5758,10 +5692,7 @@
5758
5692
  vmBeingRendered = vm;
5759
5693
  }
5760
5694
  function validateSlots(vm, html) {
5761
- if (process.env.NODE_ENV === 'production') {
5762
- // this method should never leak to prod
5763
- throw new ReferenceError();
5764
- }
5695
+ assertNotProd(); // this method should never leak to prod
5765
5696
  const { cmpSlots } = vm;
5766
5697
  const { slots = EmptyArray } = html;
5767
5698
  for (const slotName in cmpSlots.slotAssignments) {
@@ -5895,9 +5826,7 @@
5895
5826
  setActiveVM(vm);
5896
5827
  }
5897
5828
  // reset the refs; they will be set during the tmpl() instantiation
5898
- const hasRefVNodes = Boolean(html.hasRefs);
5899
- vm.hasRefVNodes = hasRefVNodes;
5900
- vm.refVNodes = hasRefVNodes ? create(null) : null;
5829
+ vm.refVNodes = html.hasRefs ? create(null) : null;
5901
5830
  // right before producing the vnodes, we clear up all internal references
5902
5831
  // to custom elements from the template.
5903
5832
  vm.velements = [];
@@ -6084,7 +6013,7 @@
6084
6013
  const cmpEventListenerMap = new WeakMap();
6085
6014
  function getWrappedComponentsListener(vm, listener) {
6086
6015
  if (!isFunction$1(listener)) {
6087
- throw new TypeError(); // avoiding problems with non-valid listeners
6016
+ throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
6088
6017
  }
6089
6018
  let wrappedListener = cmpEventListenerMap.get(listener);
6090
6019
  if (isUndefined$1(wrappedListener)) {
@@ -6229,7 +6158,6 @@
6229
6158
  mode,
6230
6159
  owner,
6231
6160
  refVNodes: null,
6232
- hasRefVNodes: false,
6233
6161
  children: EmptyArray,
6234
6162
  aChildren: EmptyArray,
6235
6163
  velements: EmptyArray,
@@ -7497,7 +7425,7 @@
7497
7425
  }
7498
7426
  return ctor;
7499
7427
  }
7500
- /* version: 2.35.0 */
7428
+ /* version: 2.35.1 */
7501
7429
 
7502
7430
  /*
7503
7431
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7605,8 +7533,7 @@
7605
7533
  // Test utilities
7606
7534
  //
7607
7535
  // Only used in LWC's Karma tests
7608
- // @ts-ignore
7609
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7536
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
7610
7537
  // @ts-ignore
7611
7538
  window.__lwcResetGlobalStylesheets = () => {
7612
7539
  stylesheetCache.clear();
@@ -8472,7 +8399,7 @@
8472
8399
  function isNull(obj) {
8473
8400
  return obj === null;
8474
8401
  }
8475
- /** version: 2.35.0 */
8402
+ /** version: 2.35.1 */
8476
8403
 
8477
8404
  /*
8478
8405
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9033,7 +8960,7 @@
9033
8960
  });
9034
8961
  freeze(LightningElement);
9035
8962
  seal(LightningElement.prototype);
9036
- /* version: 2.35.0 */
8963
+ /* version: 2.35.1 */
9037
8964
 
9038
8965
  exports.LightningElement = LightningElement;
9039
8966
  exports.__unstable__ProfilerControl = profilerControl;