lwc 2.45.0 → 2.45.2

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 (66) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +158 -83
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +158 -83
  4. package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
  5. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  6. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +75 -18
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +162 -79
  9. package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
  10. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  11. package/dist/engine-dom/iife/es5/engine-dom_debug.js +83 -16
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +158 -83
  14. package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
  15. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  16. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +75 -18
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +162 -79
  19. package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
  20. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  21. package/dist/engine-dom/umd/es5/engine-dom_debug.js +83 -16
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  23. package/dist/engine-server/commonjs/es2017/engine-server.js +102 -75
  24. package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
  25. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  26. package/dist/engine-server/esm/es2017/engine-server.js +102 -75
  27. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
  28. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +4 -4
  29. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
  30. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
  31. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
  32. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  33. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
  34. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
  37. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  38. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
  39. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +4 -4
  40. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
  41. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  42. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
  43. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
  44. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  45. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
  46. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  47. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
  48. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  49. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
  50. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  51. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
  52. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  53. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
  54. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  55. package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
  56. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  57. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
  58. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  59. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
  60. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  61. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
  62. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  63. package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
  64. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  65. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
  66. package/package.json +7 -7
@@ -46,7 +46,16 @@ var LWC = (function (exports) {
46
46
  */
47
47
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
48
48
  const { isArray: isArray$1 } = Array;
49
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
49
+ const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
50
+ // The type of the return value of Array.prototype.every is `this is T[]`. However, once this
51
+ // Array method is pulled out of the prototype, the function is now referencing `this` where
52
+ // `this` is meaningless, resulting in a TypeScript compilation error.
53
+ //
54
+ // Exposing this helper function is the closest we can get to preserving the usage patterns
55
+ // of Array.prototype methods used elsewhere in the codebase.
56
+ function arrayEvery(arr, predicate) {
57
+ return ArrayEvery.call(arr, predicate);
58
+ }
50
59
  const { fromCharCode: StringFromCharCode } = String;
51
60
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
52
61
  function isUndefined$1(obj) {
@@ -332,9 +341,9 @@ var LWC = (function (exports) {
332
341
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
333
342
  */
334
343
  // Increment whenever the LWC template compiler changes
335
- const LWC_VERSION = "2.45.0";
344
+ const LWC_VERSION = "2.45.2";
336
345
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
337
- /** version: 2.45.0 */
346
+ /** version: 2.45.2 */
338
347
 
339
348
  /**
340
349
  * Copyright (C) 2018 salesforce.com, inc.
@@ -412,7 +421,7 @@ var LWC = (function (exports) {
412
421
  setFeatureFlag(name, value);
413
422
  }
414
423
  }
415
- /** version: 2.45.0 */
424
+ /** version: 2.45.2 */
416
425
 
417
426
  /**
418
427
  * Copyright (C) 2018 salesforce.com, inc.
@@ -476,7 +485,7 @@ var LWC = (function (exports) {
476
485
  }
477
486
  }
478
487
  }
479
- /** version: 2.45.0 */
488
+ /** version: 2.45.2 */
480
489
 
481
490
  /*
482
491
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1003,8 +1012,9 @@ var LWC = (function (exports) {
1003
1012
  get() {
1004
1013
  return originalOuterHTMLDescriptor.get.call(this);
1005
1014
  },
1006
- set(_value) {
1007
- throw new TypeError(`Invalid attempt to set outerHTML on Element.`);
1015
+ set(value) {
1016
+ logError(`Invalid attempt to set outerHTML on Element.`);
1017
+ return originalOuterHTMLDescriptor.set.call(this, value);
1008
1018
  },
1009
1019
  }),
1010
1020
  };
@@ -1089,16 +1099,18 @@ var LWC = (function (exports) {
1089
1099
  get() {
1090
1100
  return originalInnerHTMLDescriptor.get.call(this);
1091
1101
  },
1092
- set(_value) {
1093
- throw new TypeError(`Invalid attempt to set innerHTML on ShadowRoot.`);
1102
+ set(value) {
1103
+ logError(`Invalid attempt to set innerHTML on ShadowRoot.`);
1104
+ return originalInnerHTMLDescriptor.set.call(this, value);
1094
1105
  },
1095
1106
  }),
1096
1107
  textContent: generateAccessorDescriptor({
1097
1108
  get() {
1098
1109
  return originalTextContentDescriptor.get.call(this);
1099
1110
  },
1100
- set(_value) {
1101
- throw new TypeError(`Invalid attempt to set textContent on ShadowRoot.`);
1111
+ set(value) {
1112
+ logError(`Invalid attempt to set textContent on ShadowRoot.`);
1113
+ return originalTextContentDescriptor.set.call(this, value);
1102
1114
  },
1103
1115
  }),
1104
1116
  addEventListener: generateDataDescriptor({
@@ -1127,24 +1139,27 @@ var LWC = (function (exports) {
1127
1139
  get() {
1128
1140
  return originalInnerHTMLDescriptor.get.call(this);
1129
1141
  },
1130
- set(_value) {
1131
- throw new TypeError(`Invalid attempt to set innerHTML on HTMLElement.`);
1142
+ set(value) {
1143
+ logError(`Invalid attempt to set innerHTML on HTMLElement.`);
1144
+ return originalInnerHTMLDescriptor.set.call(this, value);
1132
1145
  },
1133
1146
  }),
1134
1147
  outerHTML: generateAccessorDescriptor({
1135
1148
  get() {
1136
1149
  return originalOuterHTMLDescriptor.get.call(this);
1137
1150
  },
1138
- set(_value) {
1139
- throw new TypeError(`Invalid attempt to set outerHTML on HTMLElement.`);
1151
+ set(value) {
1152
+ logError(`Invalid attempt to set outerHTML on HTMLElement.`);
1153
+ return originalOuterHTMLDescriptor.set.call(this, value);
1140
1154
  },
1141
1155
  }),
1142
1156
  textContent: generateAccessorDescriptor({
1143
1157
  get() {
1144
1158
  return originalTextContentDescriptor.get.call(this);
1145
1159
  },
1146
- set(_value) {
1147
- throw new TypeError(`Invalid attempt to set textContent on HTMLElement.`);
1160
+ set(value) {
1161
+ logError(`Invalid attempt to set textContent on HTMLElement.`);
1162
+ return originalTextContentDescriptor.set.call(this, value);
1148
1163
  },
1149
1164
  }),
1150
1165
  addEventListener: generateDataDescriptor({
@@ -1160,20 +1175,6 @@ var LWC = (function (exports) {
1160
1175
  }),
1161
1176
  };
1162
1177
  }
1163
- function getComponentRestrictionsDescriptors() {
1164
- assertNotProd(); // this method should never leak to prod
1165
- return {
1166
- tagName: generateAccessorDescriptor({
1167
- get() {
1168
- throw new Error(`Usage of property \`tagName\` is disallowed because the component itself does` +
1169
- ` not know which tagName will be used to create the element, therefore writing` +
1170
- ` code that check for that value is error prone.`);
1171
- },
1172
- configurable: true,
1173
- enumerable: false, // no enumerable properties on component
1174
- }),
1175
- };
1176
- }
1177
1178
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1178
1179
  assertNotProd(); // this method should never leak to prod
1179
1180
  const originalDispatchEvent = proto.dispatchEvent;
@@ -1206,9 +1207,6 @@ var LWC = (function (exports) {
1206
1207
  const elmProto = getPrototypeOf$1(elm);
1207
1208
  setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
1208
1209
  }
1209
- function patchComponentWithRestrictions(cmp) {
1210
- defineProperties(cmp, getComponentRestrictionsDescriptors());
1211
- }
1212
1210
  function patchLightningElementPrototypeWithRestrictions(proto) {
1213
1211
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1214
1212
  }
@@ -1819,16 +1817,10 @@ var LWC = (function (exports) {
1819
1817
  function createBridgeToElementDescriptor(propName, descriptor) {
1820
1818
  const { get, set, enumerable, configurable } = descriptor;
1821
1819
  if (!isFunction$1(get)) {
1822
- if (process.env.NODE_ENV !== 'production') {
1823
- assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
1824
- }
1825
- throw new TypeError();
1820
+ throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
1826
1821
  }
1827
1822
  if (!isFunction$1(set)) {
1828
- if (process.env.NODE_ENV !== 'production') {
1829
- assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
1830
- }
1831
- throw new TypeError();
1823
+ throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
1832
1824
  }
1833
1825
  return {
1834
1826
  enumerable,
@@ -1848,10 +1840,18 @@ var LWC = (function (exports) {
1848
1840
  const vm = getAssociatedVM(this);
1849
1841
  if (process.env.NODE_ENV !== 'production') {
1850
1842
  const vmBeingRendered = getVMBeingRendered();
1851
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
1852
- assert.invariant(!isUpdatingTemplate, `When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
1853
- assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1854
- assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1843
+ if (isInvokingRender) {
1844
+ logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
1845
+ }
1846
+ if (isUpdatingTemplate) {
1847
+ logError(`When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
1848
+ }
1849
+ if (isBeingConstructed(vm)) {
1850
+ logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1851
+ }
1852
+ if (isObject(newValue) && !isNull(newValue)) {
1853
+ logError(`Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1854
+ }
1855
1855
  }
1856
1856
  updateComponentValue(vm, propName, newValue);
1857
1857
  return set.call(vm.elm, newValue);
@@ -1904,7 +1904,6 @@ var LWC = (function (exports) {
1904
1904
  // Adding extra guard rails in DEV mode.
1905
1905
  if (process.env.NODE_ENV !== 'production') {
1906
1906
  patchCustomElementWithRestrictions(elm);
1907
- patchComponentWithRestrictions(component);
1908
1907
  }
1909
1908
  return this;
1910
1909
  };
@@ -1940,9 +1939,15 @@ var LWC = (function (exports) {
1940
1939
  const { elm, renderer: { addEventListener }, } = vm;
1941
1940
  if (process.env.NODE_ENV !== 'production') {
1942
1941
  const vmBeingRendered = getVMBeingRendered();
1943
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
1944
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
1945
- assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
1942
+ if (isInvokingRender) {
1943
+ logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
1944
+ }
1945
+ if (isUpdatingTemplate) {
1946
+ logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
1947
+ }
1948
+ if (!isFunction$1(listener)) {
1949
+ logError(`Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
1950
+ }
1946
1951
  }
1947
1952
  const wrappedListener = getWrappedComponentsListener(vm, listener);
1948
1953
  addEventListener(elm, type, wrappedListener, options);
@@ -1992,7 +1997,9 @@ var LWC = (function (exports) {
1992
1997
  const vm = getAssociatedVM(this);
1993
1998
  const { elm, renderer: { setAttribute }, } = vm;
1994
1999
  if (process.env.NODE_ENV !== 'production') {
1995
- assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2000
+ if (isBeingConstructed(vm)) {
2001
+ logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2002
+ }
1996
2003
  }
1997
2004
  unlockAttribute(elm, name);
1998
2005
  setAttribute(elm, name, value);
@@ -2002,7 +2009,9 @@ var LWC = (function (exports) {
2002
2009
  const vm = getAssociatedVM(this);
2003
2010
  const { elm, renderer: { setAttribute }, } = vm;
2004
2011
  if (process.env.NODE_ENV !== 'production') {
2005
- assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2012
+ if (isBeingConstructed(vm)) {
2013
+ logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2014
+ }
2006
2015
  }
2007
2016
  unlockAttribute(elm, name);
2008
2017
  setAttribute(elm, name, value, namespace);
@@ -2025,9 +2034,9 @@ var LWC = (function (exports) {
2025
2034
  const vm = getAssociatedVM(this);
2026
2035
  const { elm, renderer: { getClassList }, } = vm;
2027
2036
  if (process.env.NODE_ENV !== 'production') {
2028
- // TODO [#1290]: this still fails in dev but works in production, eventually, we should
2029
- // just throw in all modes
2030
- assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
2037
+ if (isBeingConstructed(vm)) {
2038
+ logError(`Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
2039
+ }
2031
2040
  }
2032
2041
  return getClassList(elm);
2033
2042
  },
@@ -2533,8 +2542,12 @@ var LWC = (function (exports) {
2533
2542
  const vm = getAssociatedVM(this);
2534
2543
  if (process.env.NODE_ENV !== 'production') {
2535
2544
  const vmBeingRendered = getVMBeingRendered();
2536
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2537
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2545
+ if (isInvokingRender) {
2546
+ logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
2547
+ }
2548
+ if (isUpdatingTemplate) {
2549
+ logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
2550
+ }
2538
2551
  }
2539
2552
  vm.cmpProps[key] = newValue;
2540
2553
  componentValueMutated(vm, key);
@@ -2558,14 +2571,18 @@ var LWC = (function (exports) {
2558
2571
  const vm = getAssociatedVM(this);
2559
2572
  if (process.env.NODE_ENV !== 'production') {
2560
2573
  const vmBeingRendered = getVMBeingRendered();
2561
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2562
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2574
+ if (isInvokingRender) {
2575
+ logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
2576
+ }
2577
+ if (isUpdatingTemplate) {
2578
+ logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
2579
+ }
2563
2580
  }
2564
2581
  if (set) {
2565
2582
  set.call(this, newValue);
2566
2583
  }
2567
2584
  else if (process.env.NODE_ENV !== 'production') {
2568
- assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
2585
+ logError(`Invalid attempt to set a new value for property "${toString$1(key)}" that does not has a setter decorated with @api.`, vm);
2569
2586
  }
2570
2587
  },
2571
2588
  enumerable,
@@ -2599,8 +2616,12 @@ var LWC = (function (exports) {
2599
2616
  const vm = getAssociatedVM(this);
2600
2617
  if (process.env.NODE_ENV !== 'production') {
2601
2618
  const vmBeingRendered = getVMBeingRendered();
2602
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2603
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2619
+ if (isInvokingRender) {
2620
+ logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2621
+ }
2622
+ if (isUpdatingTemplate) {
2623
+ logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2624
+ }
2604
2625
  }
2605
2626
  const reactiveOrAnyValue = getReactiveProxy(newValue);
2606
2627
  updateComponentValue(vm, key, reactiveOrAnyValue);
@@ -3377,13 +3398,20 @@ var LWC = (function (exports) {
3377
3398
  const ctorName = Ctor.name;
3378
3399
  // Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
3379
3400
  // assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
3380
- assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3381
- if (!isUndefined$1(ctorShadowSupportMode)) {
3382
- assert.invariant(ctorShadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
3383
- ctorShadowSupportMode === "reset" /* ShadowSupportMode.Default */, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
3401
+ if (!Ctor.constructor) {
3402
+ // This error seems impossible to hit, due to an earlier check in `isComponentConstructor()`.
3403
+ // But we keep it here just in case.
3404
+ logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3405
+ }
3406
+ if (!isUndefined$1(ctorShadowSupportMode) &&
3407
+ ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3408
+ ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */) {
3409
+ logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
3384
3410
  }
3385
- if (!isUndefined$1(ctorRenderMode)) {
3386
- assert.invariant(ctorRenderMode === 'light' || ctorRenderMode === 'shadow', `Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
3411
+ if (!isUndefined$1(ctorRenderMode) &&
3412
+ ctorRenderMode !== 'light' &&
3413
+ ctorRenderMode !== 'shadow') {
3414
+ logError(`Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
3387
3415
  }
3388
3416
  }
3389
3417
  const decoratorsMeta = getDecoratorsMeta(Ctor);
@@ -5160,7 +5188,7 @@ var LWC = (function (exports) {
5160
5188
  return compilerKey + ':' + obj;
5161
5189
  case 'object':
5162
5190
  if (process.env.NODE_ENV !== 'production') {
5163
- assert.fail(`Invalid key value "${obj}" in ${getVMBeingRendered()}. Key must be a string or number.`);
5191
+ logError(`Invalid key value "${obj}" in ${getVMBeingRendered()}. Key must be a string or number.`);
5164
5192
  }
5165
5193
  }
5166
5194
  }
@@ -5450,13 +5478,19 @@ var LWC = (function (exports) {
5450
5478
  }
5451
5479
  }
5452
5480
  function validateLightDomTemplate(template, vm) {
5453
- if (template === defaultEmptyTemplate)
5481
+ assertNotProd(); // should never leak to prod mode
5482
+ if (template === defaultEmptyTemplate) {
5454
5483
  return;
5484
+ }
5455
5485
  if (vm.renderMode === 0 /* RenderMode.Light */) {
5456
- assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
5486
+ if (template.renderMode !== 'light') {
5487
+ logError(`Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
5488
+ }
5457
5489
  }
5458
5490
  else {
5459
- assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
5491
+ if (!isUndefined$1(template.renderMode)) {
5492
+ logError(`Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
5493
+ }
5460
5494
  }
5461
5495
  }
5462
5496
  function buildParseFragmentFn(createFragmentFn) {
@@ -5589,7 +5623,9 @@ var LWC = (function (exports) {
5589
5623
  logOperationEnd(1 /* OperationId.Render */, vm);
5590
5624
  });
5591
5625
  if (process.env.NODE_ENV !== 'production') {
5592
- assert.invariant(isArray$1(vnodes), `Compiler should produce html functions that always return an array.`);
5626
+ if (!isArray$1(vnodes)) {
5627
+ logError(`Compiler should produce html functions that always return an array.`);
5628
+ }
5593
5629
  }
5594
5630
  return vnodes;
5595
5631
  }
@@ -6678,6 +6714,27 @@ var LWC = (function (exports) {
6678
6714
  }
6679
6715
  return false;
6680
6716
  }
6717
+ // The validationOptOut static property can be an array of attribute names.
6718
+ // Any attribute names specified in that array will not be validated, and the
6719
+ // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
6720
+ function getValidationPredicate(optOutStaticProp) {
6721
+ if (isUndefined$1(optOutStaticProp)) {
6722
+ return (_attrName) => true;
6723
+ }
6724
+ // If validationOptOut is true, no attributes will be checked for correctness
6725
+ // and the runtime will assume VDOM attrs and DOM attrs are in sync.
6726
+ if (isTrue(optOutStaticProp)) {
6727
+ return (_attrName) => false;
6728
+ }
6729
+ // If validationOptOut is an array of strings, attributes specified in the
6730
+ // array will be "opted out". Attributes not specified in the array will still
6731
+ // be validated.
6732
+ if (isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString)) {
6733
+ return (attrName) => !ArrayIncludes.call(optOutStaticProp, attrName);
6734
+ }
6735
+ logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
6736
+ return (_attrName) => true;
6737
+ }
6681
6738
  function hydrateText(node, vnode, renderer) {
6682
6739
  var _a;
6683
6740
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
@@ -6756,8 +6813,19 @@ var LWC = (function (exports) {
6756
6813
  return elm;
6757
6814
  }
6758
6815
  function hydrateCustomElement(elm, vnode, renderer) {
6816
+ const { validationOptOut } = vnode.ctor;
6817
+ const shouldValidateAttr = getValidationPredicate(validationOptOut);
6818
+ // The validationOptOut static property can be an array of attribute names.
6819
+ // Any attribute names specified in that array will not be validated, and the
6820
+ // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
6821
+ //
6822
+ // If validationOptOut is true, no attributes will be checked for correctness
6823
+ // and the runtime will assume VDOM attrs and DOM attrs are in sync.
6824
+ //
6825
+ // Therefore, if validationOptOut is falsey or an array of strings, we need to
6826
+ // examine some or all of the custom element's attributes.
6759
6827
  if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
6760
- !isMatchingElement(vnode, elm, renderer)) {
6828
+ !isMatchingElement(vnode, elm, renderer, shouldValidateAttr)) {
6761
6829
  return handleMismatch(elm, vnode, renderer);
6762
6830
  }
6763
6831
  const { sel, mode, ctor, owner } = vnode;
@@ -6851,7 +6919,7 @@ var LWC = (function (exports) {
6851
6919
  }
6852
6920
  return true;
6853
6921
  }
6854
- function isMatchingElement(vnode, elm, renderer) {
6922
+ function isMatchingElement(vnode, elm, renderer, shouldValidateAttr = () => true) {
6855
6923
  const { getProperty } = renderer;
6856
6924
  if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
6857
6925
  if (process.env.NODE_ENV !== 'production') {
@@ -6859,10 +6927,14 @@ var LWC = (function (exports) {
6859
6927
  }
6860
6928
  return false;
6861
6929
  }
6862
- const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
6863
- const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
6864
- const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
6865
- return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
6930
+ const hasCompatibleAttrs = validateAttrs(vnode, elm, renderer, shouldValidateAttr);
6931
+ const hasCompatibleClass = shouldValidateAttr('class')
6932
+ ? validateClassAttr(vnode, elm, renderer)
6933
+ : true;
6934
+ const hasCompatibleStyle = shouldValidateAttr('style')
6935
+ ? validateStyleAttr(vnode, elm, renderer)
6936
+ : true;
6937
+ return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
6866
6938
  }
6867
6939
  function attributeValuesAreEqual(vnodeValue, value) {
6868
6940
  const vnodeValueAsString = String(vnodeValue);
@@ -6877,12 +6949,15 @@ var LWC = (function (exports) {
6877
6949
  // In all other cases, the two values are not considered equal
6878
6950
  return false;
6879
6951
  }
6880
- function validateAttrs(vnode, elm, renderer) {
6952
+ function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
6881
6953
  const { data: { attrs = {} }, } = vnode;
6882
6954
  let nodesAreCompatible = true;
6883
6955
  // Validate attributes, though we could always recovery from those by running the update mods.
6884
6956
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6885
6957
  for (const [attrName, attrValue] of Object.entries(attrs)) {
6958
+ if (!shouldValidateAttr(attrName)) {
6959
+ continue;
6960
+ }
6886
6961
  const { owner } = vnode;
6887
6962
  const { getAttribute } = renderer;
6888
6963
  const elmAttrValue = getAttribute(elm, attrName);
@@ -7306,7 +7381,7 @@ var LWC = (function (exports) {
7306
7381
  }
7307
7382
  return getReadOnlyProxy(obj);
7308
7383
  }
7309
- /* version: 2.45.0 */
7384
+ /* version: 2.45.2 */
7310
7385
 
7311
7386
  /*
7312
7387
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7734,7 +7809,7 @@ var LWC = (function (exports) {
7734
7809
  function isNull(obj) {
7735
7810
  return obj === null;
7736
7811
  }
7737
- /** version: 2.45.0 */
7812
+ /** version: 2.45.2 */
7738
7813
 
7739
7814
  /*
7740
7815
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8353,7 +8428,7 @@ var LWC = (function (exports) {
8353
8428
  });
8354
8429
  }));
8355
8430
  }
8356
- /* version: 2.45.0 */
8431
+ /* version: 2.45.2 */
8357
8432
 
8358
8433
  exports.LightningElement = LightningElement;
8359
8434
  exports.__unstable__ProfilerControl = profilerControl;