lwc 2.43.0 → 2.45.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 +53 -231
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +52 -231
  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 +8 -28
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +51 -232
  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 +7 -27
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +52 -231
  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 +8 -28
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +51 -232
  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 +7 -27
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  23. package/dist/engine-server/commonjs/es2017/engine-server.js +121 -203
  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 +103 -203
  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,6 +1,28 @@
1
1
  'use strict';
2
2
 
3
+ var parse5 = require('parse5');
4
+
5
+ function _interopNamespaceDefault(e) {
6
+ var n = Object.create(null);
7
+ if (e) {
8
+ Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default') {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ }
18
+ n.default = e;
19
+ return Object.freeze(n);
20
+ }
21
+
22
+ var parse5__namespace = /*#__PURE__*/_interopNamespaceDefault(parse5);
23
+
3
24
  /* proxy-compat-disable */
25
+
4
26
  /**
5
27
  * Copyright (C) 2018 salesforce.com, inc.
6
28
  */
@@ -45,7 +67,7 @@ var assert = /*#__PURE__*/Object.freeze({
45
67
  */
46
68
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
47
69
  const { isArray: isArray$1 } = Array;
48
- 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;
70
+ 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
71
  const { fromCharCode: StringFromCharCode } = String;
50
72
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
51
73
  function isUndefined$1(obj) {
@@ -444,9 +466,9 @@ function htmlEscape(str, attrMode = false) {
444
466
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
445
467
  */
446
468
  // Increment whenever the LWC template compiler changes
447
- const LWC_VERSION = "2.43.0";
469
+ const LWC_VERSION = "2.45.0";
448
470
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
449
- /** version: 2.43.0 */
471
+ /** version: 2.45.0 */
450
472
 
451
473
  /**
452
474
  * Copyright (C) 2018 salesforce.com, inc.
@@ -524,7 +546,7 @@ function setFeatureFlagForTest(name, value) {
524
546
  setFeatureFlag(name, value);
525
547
  }
526
548
  }
527
- /** version: 2.43.0 */
549
+ /** version: 2.45.0 */
528
550
 
529
551
  /*
530
552
  * Copyright (c) 2020, salesforce.com, inc.
@@ -620,16 +642,9 @@ function applyAriaReflection(prototype = Element.prototype) {
620
642
  }
621
643
  }
622
644
  }
623
- /** version: 2.43.0 */
645
+ /** version: 2.45.0 */
624
646
 
625
647
  /* proxy-compat-disable */
626
- /**
627
- * Report to the current dispatcher, if there is one.
628
- * @param reportingEventId
629
- * @param payload - data to report
630
- */
631
- function report(reportingEventId, payload) {
632
- }
633
648
 
634
649
  /*
635
650
  * Copyright (c) 2018, salesforce.com, inc.
@@ -856,101 +871,6 @@ const defaultDefHTMLPropertyNames = [
856
871
  'tabIndex',
857
872
  'title',
858
873
  ];
859
- function offsetPropertyErrorMessage(name) {
860
- 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.`;
861
- }
862
- // Global HTML Attributes & Properties
863
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
864
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
865
- //
866
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
867
- // for e.g. "dropzone" should suffice.
868
- const globalHTMLProperties = {
869
- accessKey: {
870
- attribute: 'accesskey',
871
- },
872
- accessKeyLabel: {
873
- readOnly: true,
874
- },
875
- className: {
876
- attribute: 'class',
877
- 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.',
878
- },
879
- contentEditable: {
880
- attribute: 'contenteditable',
881
- },
882
- dataset: {
883
- readOnly: true,
884
- 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.",
885
- },
886
- dir: {
887
- attribute: 'dir',
888
- },
889
- draggable: {
890
- attribute: 'draggable',
891
- },
892
- dropzone: {
893
- attribute: 'dropzone',
894
- readOnly: true,
895
- },
896
- hidden: {
897
- attribute: 'hidden',
898
- },
899
- id: {
900
- attribute: 'id',
901
- },
902
- inputMode: {
903
- attribute: 'inputmode',
904
- },
905
- lang: {
906
- attribute: 'lang',
907
- },
908
- slot: {
909
- attribute: 'slot',
910
- error: 'Using the `slot` property is an anti-pattern.',
911
- },
912
- spellcheck: {
913
- attribute: 'spellcheck',
914
- },
915
- style: {
916
- attribute: 'style',
917
- },
918
- tabIndex: {
919
- attribute: 'tabindex',
920
- },
921
- title: {
922
- attribute: 'title',
923
- },
924
- translate: {
925
- attribute: 'translate',
926
- },
927
- // additional "global attributes" that are not present in the link above.
928
- isContentEditable: {
929
- readOnly: true,
930
- },
931
- offsetHeight: {
932
- readOnly: true,
933
- error: offsetPropertyErrorMessage('offsetHeight'),
934
- },
935
- offsetLeft: {
936
- readOnly: true,
937
- error: offsetPropertyErrorMessage('offsetLeft'),
938
- },
939
- offsetParent: {
940
- readOnly: true,
941
- },
942
- offsetTop: {
943
- readOnly: true,
944
- error: offsetPropertyErrorMessage('offsetTop'),
945
- },
946
- offsetWidth: {
947
- readOnly: true,
948
- error: offsetPropertyErrorMessage('offsetWidth'),
949
- },
950
- role: {
951
- attribute: 'role',
952
- },
953
- };
954
874
  let controlledElement = null;
955
875
  let controlledAttributeName;
956
876
  function isAttributeLocked(elm, attrName) {
@@ -1135,8 +1055,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
1135
1055
  }),
1136
1056
  addEventListener: generateDataDescriptor({
1137
1057
  value(type, listener, options) {
1138
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1139
- // programmatically into its Component's shadow root
1058
+ // TODO [#1824]: Potentially relax this restriction
1140
1059
  if (!isUndefined$1(options)) {
1141
1060
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
1142
1061
  }
@@ -1182,8 +1101,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
1182
1101
  }),
1183
1102
  addEventListener: generateDataDescriptor({
1184
1103
  value(type, listener, options) {
1185
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1186
- // programmatically into a lighting element node
1104
+ // TODO [#1824]: Potentially relax this restriction
1187
1105
  if (!isUndefined$1(options)) {
1188
1106
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
1189
1107
  }
@@ -1211,7 +1129,7 @@ function getComponentRestrictionsDescriptors() {
1211
1129
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1212
1130
  assertNotProd(); // this method should never leak to prod
1213
1131
  const originalDispatchEvent = proto.dispatchEvent;
1214
- const descriptors = {
1132
+ return {
1215
1133
  dispatchEvent: generateDataDescriptor({
1216
1134
  value(event) {
1217
1135
  const vm = getAssociatedVM(this);
@@ -1229,32 +1147,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1229
1147
  },
1230
1148
  }),
1231
1149
  };
1232
- forEach.call(getOwnPropertyNames$1(globalHTMLProperties), (propName) => {
1233
- if (propName in proto) {
1234
- return; // no need to redefine something that we are already exposing
1235
- }
1236
- descriptors[propName] = generateAccessorDescriptor({
1237
- get() {
1238
- const { error, attribute } = globalHTMLProperties[propName];
1239
- const msg = [];
1240
- msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
1241
- if (error) {
1242
- msg.push(error);
1243
- }
1244
- else if (attribute) {
1245
- msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
1246
- }
1247
- logError(msg.join('\n'), getAssociatedVM(this));
1248
- },
1249
- set() {
1250
- const { readOnly } = globalHTMLProperties[propName];
1251
- if (readOnly) {
1252
- logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
1253
- }
1254
- },
1255
- });
1256
- });
1257
- return descriptors;
1258
1150
  }
1259
1151
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
1260
1152
  // that all components will work fine in IE11 and other browsers without shadow dom support.
@@ -2579,12 +2471,7 @@ function createPublicPropertyDescriptor(key) {
2579
2471
  }
2580
2472
  function createPublicAccessorDescriptor(key, descriptor) {
2581
2473
  const { get, set, enumerable, configurable } = descriptor;
2582
- if (!isFunction$1(get)) {
2583
- if (process.env.NODE_ENV !== 'production') {
2584
- assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2585
- }
2586
- throw new Error();
2587
- }
2474
+ assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
2588
2475
  return {
2589
2476
  get() {
2590
2477
  if (process.env.NODE_ENV !== 'production') {
@@ -2704,64 +2591,64 @@ function getClassDescriptorType(descriptor) {
2704
2591
  }
2705
2592
  }
2706
2593
  function validateObservedField(Ctor, fieldName, descriptor) {
2594
+ assertNotProd(); // this method should never leak to prod
2707
2595
  if (!isUndefined$1(descriptor)) {
2708
2596
  const type = getClassDescriptorType(descriptor);
2709
2597
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2710
- // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2711
- // This branch is only here for backward compatibility reasons.
2712
- if (type === "accessor" /* DescriptorType.Accessor */) {
2713
- logError(message);
2714
- }
2715
- else {
2716
- assert.fail(message);
2717
- }
2598
+ // TODO [#3408]: this should throw, not log
2599
+ logError(message);
2718
2600
  }
2719
2601
  }
2720
2602
  function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2603
+ assertNotProd(); // this method should never leak to prod
2721
2604
  if (!isUndefined$1(descriptor)) {
2722
2605
  const type = getClassDescriptorType(descriptor);
2723
- assert.fail(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2606
+ // TODO [#3408]: this should throw, not log
2607
+ logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2724
2608
  }
2725
2609
  }
2726
2610
  function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2611
+ assertNotProd(); // this method should never leak to prod
2727
2612
  if (!isUndefined$1(descriptor)) {
2728
2613
  const type = getClassDescriptorType(descriptor);
2729
- assert.fail(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2614
+ // TODO [#3408]: this should throw, not log
2615
+ logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2730
2616
  }
2731
2617
  }
2732
2618
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2619
+ assertNotProd(); // this method should never leak to prod
2733
2620
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2734
- assert.fail(`Invalid @wire ${methodName} method.`);
2621
+ // TODO [#3441]: This line of code does not seem possible to reach.
2622
+ logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2735
2623
  }
2736
2624
  }
2737
2625
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2626
+ assertNotProd(); // this method should never leak to prod
2738
2627
  if (!isUndefined$1(descriptor)) {
2739
2628
  const type = getClassDescriptorType(descriptor);
2740
2629
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2741
- // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
2742
- // This branch is only here for backward compatibility reasons.
2743
- if (type === "accessor" /* DescriptorType.Accessor */) {
2744
- logError(message);
2745
- }
2746
- else {
2747
- assert.fail(message);
2748
- }
2630
+ // TODO [#3408]: this should throw, not log
2631
+ logError(message);
2749
2632
  }
2750
2633
  }
2751
2634
  function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2752
- if (isUndefined$1(descriptor)) {
2753
- assert.fail(`Invalid @api get ${fieldName} accessor.`);
2754
- }
2755
- else if (isFunction$1(descriptor.set)) {
2756
- 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.`);
2635
+ assertNotProd(); // this method should never leak to prod
2636
+ if (isFunction$1(descriptor.set)) {
2637
+ if (!isFunction$1(descriptor.get)) {
2638
+ // TODO [#3441]: This line of code does not seem possible to reach.
2639
+ logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2640
+ }
2757
2641
  }
2758
2642
  else if (!isFunction$1(descriptor.get)) {
2759
- assert.fail(`Missing @api get ${fieldName} accessor.`);
2643
+ // TODO [#3441]: This line of code does not seem possible to reach.
2644
+ logError(`Missing @api get ${fieldName} accessor.`);
2760
2645
  }
2761
2646
  }
2762
2647
  function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
2648
+ assertNotProd(); // this method should never leak to prod
2763
2649
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2764
- assert.fail(`Invalid @api ${methodName} method.`);
2650
+ // TODO [#3441]: This line of code does not seem possible to reach.
2651
+ logError(`Invalid @api ${methodName} method.`);
2765
2652
  }
2766
2653
  }
2767
2654
  /**
@@ -2784,13 +2671,14 @@ function registerDecorators(Ctor, meta) {
2784
2671
  apiFieldsConfig[fieldName] = propConfig.config;
2785
2672
  descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2786
2673
  if (propConfig.config > 0) {
2674
+ if (isUndefined$1(descriptor)) {
2675
+ // TODO [#3441]: This line of code does not seem possible to reach.
2676
+ throw new Error();
2677
+ }
2787
2678
  // accessor declaration
2788
2679
  if (process.env.NODE_ENV !== 'production') {
2789
2680
  validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
2790
2681
  }
2791
- if (isUndefined$1(descriptor)) {
2792
- throw new Error();
2793
- }
2794
2682
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2795
2683
  }
2796
2684
  else {
@@ -2830,7 +2718,10 @@ function registerDecorators(Ctor, meta) {
2830
2718
  descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2831
2719
  if (method === 1) {
2832
2720
  if (process.env.NODE_ENV !== 'production') {
2833
- assert.isTrue(adapter, `@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2721
+ if (!adapter) {
2722
+ // TODO [#3408]: this should throw, not log
2723
+ logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2724
+ }
2834
2725
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2835
2726
  }
2836
2727
  if (isUndefined$1(descriptor)) {
@@ -2841,7 +2732,10 @@ function registerDecorators(Ctor, meta) {
2841
2732
  }
2842
2733
  else {
2843
2734
  if (process.env.NODE_ENV !== 'production') {
2844
- assert.isTrue(adapter, `@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2735
+ if (!adapter) {
2736
+ // TODO [#3408]: this should throw, not log
2737
+ logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2738
+ }
2845
2739
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2846
2740
  }
2847
2741
  descriptor = internalWireFieldDecorator(fieldOrMethodName);
@@ -3541,15 +3435,6 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3541
3435
  // the stylesheet, while internally, we have a replacement for it.
3542
3436
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3543
3437
  }
3544
- // Check that this stylesheet was generated by our compiler
3545
- if (!isStylesheetRegistered(stylesheet)) {
3546
- if (process.env.NODE_ENV !== 'production') {
3547
- logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
3548
- }
3549
- report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
3550
- tagName: vm.tagName.toLowerCase(),
3551
- });
3552
- }
3553
3438
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3554
3439
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
3555
3440
  !isScopedCss &&
@@ -3638,18 +3523,6 @@ function createStylesheet(vm, stylesheets) {
3638
3523
  }
3639
3524
  return null;
3640
3525
  }
3641
- const signedStylesheetSet = new Set();
3642
- /**
3643
- * INTERNAL: This function can only be invoked by compiled code. The compiler
3644
- * will prevent this function from being imported by userland code.
3645
- */
3646
- function registerStylesheet(stylesheet) {
3647
- signedStylesheetSet.add(stylesheet);
3648
- return stylesheet;
3649
- }
3650
- function isStylesheetRegistered(stylesheet) {
3651
- return signedStylesheetSet.has(stylesheet);
3652
- }
3653
3526
 
3654
3527
  /*
3655
3528
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6362,12 +6235,12 @@ function readonly(obj) {
6362
6235
  if (process.env.NODE_ENV !== 'production') {
6363
6236
  // TODO [#1292]: Remove the readonly decorator
6364
6237
  if (arguments.length !== 1) {
6365
- 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.');
6238
+ 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.');
6366
6239
  }
6367
6240
  }
6368
6241
  return getReadOnlyProxy(obj);
6369
6242
  }
6370
- /* version: 2.43.0 */
6243
+ /* version: 2.45.0 */
6371
6244
 
6372
6245
  /*
6373
6246
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6777,6 +6650,38 @@ const renderer = {
6777
6650
  registerContextConsumer,
6778
6651
  };
6779
6652
 
6653
+ /*
6654
+ * Copyright (c) 2023, salesforce.com, inc.
6655
+ * All rights reserved.
6656
+ * SPDX-License-Identifier: MIT
6657
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6658
+ */
6659
+ function isSingleStyleNodeContainingSingleTextNode(node) {
6660
+ if (node.childNodes.length !== 1) {
6661
+ return false;
6662
+ }
6663
+ const style = node.childNodes[0];
6664
+ if (style.nodeName !== 'style' || style.childNodes.length !== 1) {
6665
+ return false;
6666
+ }
6667
+ const textNode = style.childNodes[0];
6668
+ return textNode.nodeName === '#text';
6669
+ }
6670
+ // The text content inside `<style>` is a special case. It is _only_ rendered by the LWC engine itself; <style> tags
6671
+ // are disallowed inside of templates. Also, we want to avoid over-escaping, since CSS containing strings like
6672
+ // `&amp;` and `&quot;` is not valid CSS (even when inside a `<style>` element).
6673
+ //
6674
+ // However, to avoid XSS attacks, we still need to check for things like `</style><script>alert("pwned")</script>`,
6675
+ // since a user could use that inside of a *.css file to break out of a <style> element.
6676
+ // See: https://github.com/salesforce/lwc/issues/3439
6677
+ function validateStyleTextContents(contents) {
6678
+ // If parse5 parses this as more than one `<style>` tag, then it is unsafe to be rendered as-is
6679
+ const fragment = parse5__namespace.parseFragment(`<style>${contents}</style>`);
6680
+ if (!isSingleStyleNodeContainingSingleTextNode(fragment)) {
6681
+ throw new Error('CSS contains unsafe characters and cannot be serialized inside a style element');
6682
+ }
6683
+ }
6684
+
6780
6685
  /*
6781
6686
  * Copyright (c) 2020, salesforce.com, inc.
6782
6687
  * All rights reserved.
@@ -6788,12 +6693,12 @@ function serializeAttributes(attributes) {
6788
6693
  .map((attr) => attr.value.length ? `${attr.name}="${htmlEscape(attr.value, true)}"` : attr.name)
6789
6694
  .join(' ');
6790
6695
  }
6791
- function serializeChildNodes(children) {
6696
+ function serializeChildNodes(children, tagName) {
6792
6697
  return children
6793
6698
  .map((child) => {
6794
6699
  switch (child[HostTypeKey]) {
6795
6700
  case HostNodeType.Text:
6796
- return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6701
+ return serializeTextContent(child[HostValueKey], tagName);
6797
6702
  case HostNodeType.Comment:
6798
6703
  return `<!--${htmlEscape(child[HostValueKey])}-->`;
6799
6704
  case HostNodeType.Raw:
@@ -6830,12 +6735,26 @@ function serializeElement(element) {
6830
6735
  if (element[HostShadowRootKey]) {
6831
6736
  output += serializeShadowRoot(element[HostShadowRootKey]);
6832
6737
  }
6833
- output += serializeChildNodes(element[HostChildrenKey]);
6738
+ output += serializeChildNodes(element[HostChildrenKey], tagName);
6834
6739
  if (!isVoidElement(tagName, namespace) || hasChildren) {
6835
6740
  output += `</${tagName}>`;
6836
6741
  }
6837
6742
  return output;
6838
6743
  }
6744
+ function serializeTextContent(contents, tagName) {
6745
+ if (contents === '') {
6746
+ return '\u200D'; // Special serialization for empty text nodes
6747
+ }
6748
+ if (tagName === 'style') {
6749
+ // Special validation for <style> tags since their content must be served unescaped, and we need to validate
6750
+ // that the contents are safe to serialize unescaped.
6751
+ // TODO [#3454]: move this validation to compilation
6752
+ validateStyleTextContents(contents);
6753
+ // If we haven't thrown an error during validation, then the content is safe to serialize unescaped
6754
+ return contents;
6755
+ }
6756
+ return htmlEscape(contents);
6757
+ }
6839
6758
 
6840
6759
  /*
6841
6760
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6902,7 +6821,7 @@ seal(LightningElement.prototype);
6902
6821
  function createElement() {
6903
6822
  throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
6904
6823
  }
6905
- /* version: 2.43.0 */
6824
+ /* version: 2.45.0 */
6906
6825
 
6907
6826
  exports.LightningElement = LightningElement;
6908
6827
  exports.api = api$1;
@@ -6917,7 +6836,6 @@ exports.readonly = readonly;
6917
6836
  exports.register = register;
6918
6837
  exports.registerComponent = registerComponent;
6919
6838
  exports.registerDecorators = registerDecorators;
6920
- exports.registerStylesheet = registerStylesheet;
6921
6839
  exports.registerTemplate = registerTemplate;
6922
6840
  exports.renderComponent = renderComponent;
6923
6841
  exports.renderer = renderer;