lwc 2.42.0 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +85 -225
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +85 -224
  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 +35 -20
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +85 -226
  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 +36 -21
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +85 -224
  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 +35 -20
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +85 -226
  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 +36 -21
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  23. package/dist/engine-server/commonjs/es2017/engine-server.js +152 -182
  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 +133 -183
  27. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
  28. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +89 -74
  29. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
  30. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +89 -74
  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 +85 -70
  34. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +88 -71
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
  37. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  38. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +84 -67
  39. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
  40. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +89 -74
  41. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
  42. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  43. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +85 -70
  44. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
  45. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +88 -71
  46. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
  47. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  48. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +84 -67
  49. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
  50. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  51. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
  52. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  53. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
  54. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  55. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
  56. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  57. package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
  58. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  59. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
  60. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  61. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
  62. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  63. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
  64. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  65. package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
  66. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  67. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
  68. package/package.json +7 -7
@@ -1,4 +1,7 @@
1
+ import * as parse5 from 'parse5';
2
+
1
3
  /* proxy-compat-disable */
4
+
2
5
  /**
3
6
  * Copyright (C) 2018 salesforce.com, inc.
4
7
  */
@@ -43,7 +46,7 @@ var assert = /*#__PURE__*/Object.freeze({
43
46
  */
44
47
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
45
48
  const { isArray: isArray$1 } = Array;
46
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, 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, 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;
47
50
  const { fromCharCode: StringFromCharCode } = String;
48
51
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
49
52
  function isUndefined$1(obj) {
@@ -442,9 +445,9 @@ function htmlEscape(str, attrMode = false) {
442
445
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
443
446
  */
444
447
  // Increment whenever the LWC template compiler changes
445
- const LWC_VERSION = "2.42.0";
448
+ const LWC_VERSION = "2.44.0";
446
449
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
447
- /** version: 2.42.0 */
450
+ /** version: 2.44.0 */
448
451
 
449
452
  /**
450
453
  * Copyright (C) 2018 salesforce.com, inc.
@@ -522,7 +525,7 @@ function setFeatureFlagForTest(name, value) {
522
525
  setFeatureFlag(name, value);
523
526
  }
524
527
  }
525
- /** version: 2.42.0 */
528
+ /** version: 2.44.0 */
526
529
 
527
530
  /*
528
531
  * Copyright (c) 2020, salesforce.com, inc.
@@ -618,9 +621,16 @@ function applyAriaReflection(prototype = Element.prototype) {
618
621
  }
619
622
  }
620
623
  }
621
- /** version: 2.42.0 */
624
+ /** version: 2.44.0 */
622
625
 
623
626
  /* proxy-compat-disable */
627
+ /**
628
+ * Report to the current dispatcher, if there is one.
629
+ * @param reportingEventId
630
+ * @param payload - data to report
631
+ */
632
+ function report(reportingEventId, payload) {
633
+ }
624
634
 
625
635
  /*
626
636
  * Copyright (c) 2018, salesforce.com, inc.
@@ -847,101 +857,6 @@ const defaultDefHTMLPropertyNames = [
847
857
  'tabIndex',
848
858
  'title',
849
859
  ];
850
- function offsetPropertyErrorMessage(name) {
851
- return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
852
- }
853
- // Global HTML Attributes & Properties
854
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
855
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
856
- //
857
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
858
- // for e.g. "dropzone" should suffice.
859
- const globalHTMLProperties = {
860
- accessKey: {
861
- attribute: 'accesskey',
862
- },
863
- accessKeyLabel: {
864
- readOnly: true,
865
- },
866
- className: {
867
- attribute: 'class',
868
- error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.',
869
- },
870
- contentEditable: {
871
- attribute: 'contenteditable',
872
- },
873
- dataset: {
874
- readOnly: true,
875
- error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.",
876
- },
877
- dir: {
878
- attribute: 'dir',
879
- },
880
- draggable: {
881
- attribute: 'draggable',
882
- },
883
- dropzone: {
884
- attribute: 'dropzone',
885
- readOnly: true,
886
- },
887
- hidden: {
888
- attribute: 'hidden',
889
- },
890
- id: {
891
- attribute: 'id',
892
- },
893
- inputMode: {
894
- attribute: 'inputmode',
895
- },
896
- lang: {
897
- attribute: 'lang',
898
- },
899
- slot: {
900
- attribute: 'slot',
901
- error: 'Using the `slot` property is an anti-pattern.',
902
- },
903
- spellcheck: {
904
- attribute: 'spellcheck',
905
- },
906
- style: {
907
- attribute: 'style',
908
- },
909
- tabIndex: {
910
- attribute: 'tabindex',
911
- },
912
- title: {
913
- attribute: 'title',
914
- },
915
- translate: {
916
- attribute: 'translate',
917
- },
918
- // additional "global attributes" that are not present in the link above.
919
- isContentEditable: {
920
- readOnly: true,
921
- },
922
- offsetHeight: {
923
- readOnly: true,
924
- error: offsetPropertyErrorMessage('offsetHeight'),
925
- },
926
- offsetLeft: {
927
- readOnly: true,
928
- error: offsetPropertyErrorMessage('offsetLeft'),
929
- },
930
- offsetParent: {
931
- readOnly: true,
932
- },
933
- offsetTop: {
934
- readOnly: true,
935
- error: offsetPropertyErrorMessage('offsetTop'),
936
- },
937
- offsetWidth: {
938
- readOnly: true,
939
- error: offsetPropertyErrorMessage('offsetWidth'),
940
- },
941
- role: {
942
- attribute: 'role',
943
- },
944
- };
945
860
  let controlledElement = null;
946
861
  let controlledAttributeName;
947
862
  function isAttributeLocked(elm, attrName) {
@@ -1126,8 +1041,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
1126
1041
  }),
1127
1042
  addEventListener: generateDataDescriptor({
1128
1043
  value(type, listener, options) {
1129
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1130
- // programmatically into its Component's shadow root
1044
+ // TODO [#1824]: Potentially relax this restriction
1131
1045
  if (!isUndefined$1(options)) {
1132
1046
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
1133
1047
  }
@@ -1173,8 +1087,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
1173
1087
  }),
1174
1088
  addEventListener: generateDataDescriptor({
1175
1089
  value(type, listener, options) {
1176
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1177
- // programmatically into a lighting element node
1090
+ // TODO [#1824]: Potentially relax this restriction
1178
1091
  if (!isUndefined$1(options)) {
1179
1092
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
1180
1093
  }
@@ -1202,7 +1115,7 @@ function getComponentRestrictionsDescriptors() {
1202
1115
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1203
1116
  assertNotProd(); // this method should never leak to prod
1204
1117
  const originalDispatchEvent = proto.dispatchEvent;
1205
- const descriptors = {
1118
+ return {
1206
1119
  dispatchEvent: generateDataDescriptor({
1207
1120
  value(event) {
1208
1121
  const vm = getAssociatedVM(this);
@@ -1220,32 +1133,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1220
1133
  },
1221
1134
  }),
1222
1135
  };
1223
- forEach.call(getOwnPropertyNames$1(globalHTMLProperties), (propName) => {
1224
- if (propName in proto) {
1225
- return; // no need to redefine something that we are already exposing
1226
- }
1227
- descriptors[propName] = generateAccessorDescriptor({
1228
- get() {
1229
- const { error, attribute } = globalHTMLProperties[propName];
1230
- const msg = [];
1231
- msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
1232
- if (error) {
1233
- msg.push(error);
1234
- }
1235
- else if (attribute) {
1236
- msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
1237
- }
1238
- logError(msg.join('\n'), getAssociatedVM(this));
1239
- },
1240
- set() {
1241
- const { readOnly } = globalHTMLProperties[propName];
1242
- if (readOnly) {
1243
- logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
1244
- }
1245
- },
1246
- });
1247
- });
1248
- return descriptors;
1249
1136
  }
1250
1137
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
1251
1138
  // that all components will work fine in IE11 and other browsers without shadow dom support.
@@ -2570,12 +2457,7 @@ function createPublicPropertyDescriptor(key) {
2570
2457
  }
2571
2458
  function createPublicAccessorDescriptor(key, descriptor) {
2572
2459
  const { get, set, enumerable, configurable } = descriptor;
2573
- if (!isFunction$1(get)) {
2574
- if (process.env.NODE_ENV !== 'production') {
2575
- assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2576
- }
2577
- throw new Error();
2578
- }
2460
+ assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
2579
2461
  return {
2580
2462
  get() {
2581
2463
  if (process.env.NODE_ENV !== 'production') {
@@ -2695,64 +2577,64 @@ function getClassDescriptorType(descriptor) {
2695
2577
  }
2696
2578
  }
2697
2579
  function validateObservedField(Ctor, fieldName, descriptor) {
2580
+ assertNotProd(); // this method should never leak to prod
2698
2581
  if (!isUndefined$1(descriptor)) {
2699
2582
  const type = getClassDescriptorType(descriptor);
2700
2583
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2701
- // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2702
- // This branch is only here for backward compatibility reasons.
2703
- if (type === "accessor" /* DescriptorType.Accessor */) {
2704
- logError(message);
2705
- }
2706
- else {
2707
- assert.fail(message);
2708
- }
2584
+ // TODO [#3408]: this should throw, not log
2585
+ logError(message);
2709
2586
  }
2710
2587
  }
2711
2588
  function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2589
+ assertNotProd(); // this method should never leak to prod
2712
2590
  if (!isUndefined$1(descriptor)) {
2713
2591
  const type = getClassDescriptorType(descriptor);
2714
- assert.fail(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2592
+ // TODO [#3408]: this should throw, not log
2593
+ logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2715
2594
  }
2716
2595
  }
2717
2596
  function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2597
+ assertNotProd(); // this method should never leak to prod
2718
2598
  if (!isUndefined$1(descriptor)) {
2719
2599
  const type = getClassDescriptorType(descriptor);
2720
- assert.fail(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2600
+ // TODO [#3408]: this should throw, not log
2601
+ logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2721
2602
  }
2722
2603
  }
2723
2604
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2605
+ assertNotProd(); // this method should never leak to prod
2724
2606
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2725
- assert.fail(`Invalid @wire ${methodName} method.`);
2607
+ // TODO [#3441]: This line of code does not seem possible to reach.
2608
+ logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2726
2609
  }
2727
2610
  }
2728
2611
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2612
+ assertNotProd(); // this method should never leak to prod
2729
2613
  if (!isUndefined$1(descriptor)) {
2730
2614
  const type = getClassDescriptorType(descriptor);
2731
2615
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2732
- // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
2733
- // This branch is only here for backward compatibility reasons.
2734
- if (type === "accessor" /* DescriptorType.Accessor */) {
2735
- logError(message);
2736
- }
2737
- else {
2738
- assert.fail(message);
2739
- }
2616
+ // TODO [#3408]: this should throw, not log
2617
+ logError(message);
2740
2618
  }
2741
2619
  }
2742
2620
  function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2743
- if (isUndefined$1(descriptor)) {
2744
- assert.fail(`Invalid @api get ${fieldName} accessor.`);
2745
- }
2746
- else if (isFunction$1(descriptor.set)) {
2747
- assert.isTrue(isFunction$1(descriptor.get), `Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2621
+ assertNotProd(); // this method should never leak to prod
2622
+ if (isFunction$1(descriptor.set)) {
2623
+ if (!isFunction$1(descriptor.get)) {
2624
+ // TODO [#3441]: This line of code does not seem possible to reach.
2625
+ logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2626
+ }
2748
2627
  }
2749
2628
  else if (!isFunction$1(descriptor.get)) {
2750
- assert.fail(`Missing @api get ${fieldName} accessor.`);
2629
+ // TODO [#3441]: This line of code does not seem possible to reach.
2630
+ logError(`Missing @api get ${fieldName} accessor.`);
2751
2631
  }
2752
2632
  }
2753
2633
  function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
2634
+ assertNotProd(); // this method should never leak to prod
2754
2635
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2755
- assert.fail(`Invalid @api ${methodName} method.`);
2636
+ // TODO [#3441]: This line of code does not seem possible to reach.
2637
+ logError(`Invalid @api ${methodName} method.`);
2756
2638
  }
2757
2639
  }
2758
2640
  /**
@@ -2775,13 +2657,14 @@ function registerDecorators(Ctor, meta) {
2775
2657
  apiFieldsConfig[fieldName] = propConfig.config;
2776
2658
  descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2777
2659
  if (propConfig.config > 0) {
2660
+ if (isUndefined$1(descriptor)) {
2661
+ // TODO [#3441]: This line of code does not seem possible to reach.
2662
+ throw new Error();
2663
+ }
2778
2664
  // accessor declaration
2779
2665
  if (process.env.NODE_ENV !== 'production') {
2780
2666
  validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
2781
2667
  }
2782
- if (isUndefined$1(descriptor)) {
2783
- throw new Error();
2784
- }
2785
2668
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2786
2669
  }
2787
2670
  else {
@@ -2821,7 +2704,10 @@ function registerDecorators(Ctor, meta) {
2821
2704
  descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2822
2705
  if (method === 1) {
2823
2706
  if (process.env.NODE_ENV !== 'production') {
2824
- assert.isTrue(adapter, `@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2707
+ if (!adapter) {
2708
+ // TODO [#3408]: this should throw, not log
2709
+ logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2710
+ }
2825
2711
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2826
2712
  }
2827
2713
  if (isUndefined$1(descriptor)) {
@@ -2832,7 +2718,10 @@ function registerDecorators(Ctor, meta) {
2832
2718
  }
2833
2719
  else {
2834
2720
  if (process.env.NODE_ENV !== 'production') {
2835
- assert.isTrue(adapter, `@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2721
+ if (!adapter) {
2722
+ // TODO [#3408]: this should throw, not log
2723
+ logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2724
+ }
2836
2725
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2837
2726
  }
2838
2727
  descriptor = internalWireFieldDecorator(fieldOrMethodName);
@@ -3532,6 +3421,15 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3532
3421
  // the stylesheet, while internally, we have a replacement for it.
3533
3422
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3534
3423
  }
3424
+ // Check that this stylesheet was generated by our compiler
3425
+ if (!isStylesheetRegistered(stylesheet)) {
3426
+ if (process.env.NODE_ENV !== 'production') {
3427
+ logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
3428
+ }
3429
+ report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
3430
+ tagName: vm.tagName.toLowerCase(),
3431
+ });
3432
+ }
3535
3433
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3536
3434
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
3537
3435
  !isScopedCss &&
@@ -3620,6 +3518,18 @@ function createStylesheet(vm, stylesheets) {
3620
3518
  }
3621
3519
  return null;
3622
3520
  }
3521
+ const signedStylesheetSet = new Set();
3522
+ /**
3523
+ * INTERNAL: This function can only be invoked by compiled code. The compiler
3524
+ * will prevent this function from being imported by userland code.
3525
+ */
3526
+ function registerStylesheet(stylesheet) {
3527
+ signedStylesheetSet.add(stylesheet);
3528
+ return stylesheet;
3529
+ }
3530
+ function isStylesheetRegistered(stylesheet) {
3531
+ return signedStylesheetSet.has(stylesheet);
3532
+ }
3623
3533
 
3624
3534
  /*
3625
3535
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5277,18 +5187,12 @@ function getVMBeingRendered() {
5277
5187
  function setVMBeingRendered(vm) {
5278
5188
  vmBeingRendered = vm;
5279
5189
  }
5280
- function validateSlots(vm, html) {
5190
+ function validateSlots(vm) {
5281
5191
  assertNotProd(); // this method should never leak to prod
5282
5192
  const { cmpSlots } = vm;
5283
- const { slots = EmptyArray } = html;
5284
5193
  for (const slotName in cmpSlots.slotAssignments) {
5285
5194
  // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
5286
5195
  assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
5287
- if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
5288
- // TODO [#1297]: this should never really happen because the compiler should always validate
5289
- // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
5290
- logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
5291
- }
5292
5196
  }
5293
5197
  }
5294
5198
  function validateLightDomTemplate(template, vm) {
@@ -5402,7 +5306,7 @@ function evaluateTemplate(vm, html) {
5402
5306
  }
5403
5307
  if (process.env.NODE_ENV !== 'production') {
5404
5308
  // validating slots in every rendering since the allocated content might change over time
5405
- validateSlots(vm, html);
5309
+ validateSlots(vm);
5406
5310
  // add the VM to the list of host VMs that can be re-rendered if html is swapped
5407
5311
  setActiveVM(vm);
5408
5312
  }
@@ -6338,12 +6242,12 @@ function readonly(obj) {
6338
6242
  if (process.env.NODE_ENV !== 'production') {
6339
6243
  // TODO [#1292]: Remove the readonly decorator
6340
6244
  if (arguments.length !== 1) {
6341
- assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6245
+ logError('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6342
6246
  }
6343
6247
  }
6344
6248
  return getReadOnlyProxy(obj);
6345
6249
  }
6346
- /* version: 2.42.0 */
6250
+ /* version: 2.44.0 */
6347
6251
 
6348
6252
  /*
6349
6253
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6753,6 +6657,38 @@ const renderer = {
6753
6657
  registerContextConsumer,
6754
6658
  };
6755
6659
 
6660
+ /*
6661
+ * Copyright (c) 2023, salesforce.com, inc.
6662
+ * All rights reserved.
6663
+ * SPDX-License-Identifier: MIT
6664
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6665
+ */
6666
+ function isSingleStyleNodeContainingSingleTextNode(node) {
6667
+ if (node.childNodes.length !== 1) {
6668
+ return false;
6669
+ }
6670
+ const style = node.childNodes[0];
6671
+ if (style.nodeName !== 'style' || style.childNodes.length !== 1) {
6672
+ return false;
6673
+ }
6674
+ const textNode = style.childNodes[0];
6675
+ return textNode.nodeName === '#text';
6676
+ }
6677
+ // The text content inside `<style>` is a special case. It is _only_ rendered by the LWC engine itself; <style> tags
6678
+ // are disallowed inside of templates. Also, we want to avoid over-escaping, since CSS containing strings like
6679
+ // `&amp;` and `&quot;` is not valid CSS (even when inside a `<style>` element).
6680
+ //
6681
+ // However, to avoid XSS attacks, we still need to check for things like `</style><script>alert("pwned")</script>`,
6682
+ // since a user could use that inside of a *.css file to break out of a <style> element.
6683
+ // See: https://github.com/salesforce/lwc/issues/3439
6684
+ function validateStyleTextContents(contents) {
6685
+ // If parse5 parses this as more than one `<style>` tag, then it is unsafe to be rendered as-is
6686
+ const fragment = parse5.parseFragment(`<style>${contents}</style>`);
6687
+ if (!isSingleStyleNodeContainingSingleTextNode(fragment)) {
6688
+ throw new Error('CSS contains unsafe characters and cannot be serialized inside a style element');
6689
+ }
6690
+ }
6691
+
6756
6692
  /*
6757
6693
  * Copyright (c) 2020, salesforce.com, inc.
6758
6694
  * All rights reserved.
@@ -6764,12 +6700,12 @@ function serializeAttributes(attributes) {
6764
6700
  .map((attr) => attr.value.length ? `${attr.name}="${htmlEscape(attr.value, true)}"` : attr.name)
6765
6701
  .join(' ');
6766
6702
  }
6767
- function serializeChildNodes(children) {
6703
+ function serializeChildNodes(children, tagName) {
6768
6704
  return children
6769
6705
  .map((child) => {
6770
6706
  switch (child[HostTypeKey]) {
6771
6707
  case HostNodeType.Text:
6772
- return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6708
+ return serializeTextContent(child[HostValueKey], tagName);
6773
6709
  case HostNodeType.Comment:
6774
6710
  return `<!--${htmlEscape(child[HostValueKey])}-->`;
6775
6711
  case HostNodeType.Raw:
@@ -6806,12 +6742,26 @@ function serializeElement(element) {
6806
6742
  if (element[HostShadowRootKey]) {
6807
6743
  output += serializeShadowRoot(element[HostShadowRootKey]);
6808
6744
  }
6809
- output += serializeChildNodes(element[HostChildrenKey]);
6745
+ output += serializeChildNodes(element[HostChildrenKey], tagName);
6810
6746
  if (!isVoidElement(tagName, namespace) || hasChildren) {
6811
6747
  output += `</${tagName}>`;
6812
6748
  }
6813
6749
  return output;
6814
6750
  }
6751
+ function serializeTextContent(contents, tagName) {
6752
+ if (contents === '') {
6753
+ return '\u200D'; // Special serialization for empty text nodes
6754
+ }
6755
+ if (tagName === 'style') {
6756
+ // Special validation for <style> tags since their content must be served unescaped, and we need to validate
6757
+ // that the contents are safe to serialize unescaped.
6758
+ // TODO [#3454]: move this validation to compilation
6759
+ validateStyleTextContents(contents);
6760
+ // If we haven't thrown an error during validation, then the content is safe to serialize unescaped
6761
+ return contents;
6762
+ }
6763
+ return htmlEscape(contents);
6764
+ }
6815
6765
 
6816
6766
  /*
6817
6767
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6878,7 +6828,7 @@ seal(LightningElement.prototype);
6878
6828
  function createElement() {
6879
6829
  throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
6880
6830
  }
6881
- /* version: 2.42.0 */
6831
+ /* version: 2.44.0 */
6882
6832
 
6883
- export { LightningElement, api$1 as api, createContextProvider, createElement, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
6833
+ export { LightningElement, api$1 as api, createContextProvider, createElement, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerStylesheet, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
6884
6834
  //# sourceMappingURL=engine-server.js.map