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,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.43.0";
448
+ const LWC_VERSION = "2.45.0";
446
449
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
447
- /** version: 2.43.0 */
450
+ /** version: 2.45.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.43.0 */
528
+ /** version: 2.45.0 */
526
529
 
527
530
  /*
528
531
  * Copyright (c) 2020, salesforce.com, inc.
@@ -618,16 +621,9 @@ function applyAriaReflection(prototype = Element.prototype) {
618
621
  }
619
622
  }
620
623
  }
621
- /** version: 2.43.0 */
624
+ /** version: 2.45.0 */
622
625
 
623
626
  /* proxy-compat-disable */
624
- /**
625
- * Report to the current dispatcher, if there is one.
626
- * @param reportingEventId
627
- * @param payload - data to report
628
- */
629
- function report(reportingEventId, payload) {
630
- }
631
627
 
632
628
  /*
633
629
  * Copyright (c) 2018, salesforce.com, inc.
@@ -854,101 +850,6 @@ const defaultDefHTMLPropertyNames = [
854
850
  'tabIndex',
855
851
  'title',
856
852
  ];
857
- function offsetPropertyErrorMessage(name) {
858
- 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.`;
859
- }
860
- // Global HTML Attributes & Properties
861
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
862
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
863
- //
864
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
865
- // for e.g. "dropzone" should suffice.
866
- const globalHTMLProperties = {
867
- accessKey: {
868
- attribute: 'accesskey',
869
- },
870
- accessKeyLabel: {
871
- readOnly: true,
872
- },
873
- className: {
874
- attribute: 'class',
875
- 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.',
876
- },
877
- contentEditable: {
878
- attribute: 'contenteditable',
879
- },
880
- dataset: {
881
- readOnly: true,
882
- 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.",
883
- },
884
- dir: {
885
- attribute: 'dir',
886
- },
887
- draggable: {
888
- attribute: 'draggable',
889
- },
890
- dropzone: {
891
- attribute: 'dropzone',
892
- readOnly: true,
893
- },
894
- hidden: {
895
- attribute: 'hidden',
896
- },
897
- id: {
898
- attribute: 'id',
899
- },
900
- inputMode: {
901
- attribute: 'inputmode',
902
- },
903
- lang: {
904
- attribute: 'lang',
905
- },
906
- slot: {
907
- attribute: 'slot',
908
- error: 'Using the `slot` property is an anti-pattern.',
909
- },
910
- spellcheck: {
911
- attribute: 'spellcheck',
912
- },
913
- style: {
914
- attribute: 'style',
915
- },
916
- tabIndex: {
917
- attribute: 'tabindex',
918
- },
919
- title: {
920
- attribute: 'title',
921
- },
922
- translate: {
923
- attribute: 'translate',
924
- },
925
- // additional "global attributes" that are not present in the link above.
926
- isContentEditable: {
927
- readOnly: true,
928
- },
929
- offsetHeight: {
930
- readOnly: true,
931
- error: offsetPropertyErrorMessage('offsetHeight'),
932
- },
933
- offsetLeft: {
934
- readOnly: true,
935
- error: offsetPropertyErrorMessage('offsetLeft'),
936
- },
937
- offsetParent: {
938
- readOnly: true,
939
- },
940
- offsetTop: {
941
- readOnly: true,
942
- error: offsetPropertyErrorMessage('offsetTop'),
943
- },
944
- offsetWidth: {
945
- readOnly: true,
946
- error: offsetPropertyErrorMessage('offsetWidth'),
947
- },
948
- role: {
949
- attribute: 'role',
950
- },
951
- };
952
853
  let controlledElement = null;
953
854
  let controlledAttributeName;
954
855
  function isAttributeLocked(elm, attrName) {
@@ -1133,8 +1034,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
1133
1034
  }),
1134
1035
  addEventListener: generateDataDescriptor({
1135
1036
  value(type, listener, options) {
1136
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1137
- // programmatically into its Component's shadow root
1037
+ // TODO [#1824]: Potentially relax this restriction
1138
1038
  if (!isUndefined$1(options)) {
1139
1039
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
1140
1040
  }
@@ -1180,8 +1080,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
1180
1080
  }),
1181
1081
  addEventListener: generateDataDescriptor({
1182
1082
  value(type, listener, options) {
1183
- // TODO [#420]: this is triggered when the component author attempts to add a listener
1184
- // programmatically into a lighting element node
1083
+ // TODO [#1824]: Potentially relax this restriction
1185
1084
  if (!isUndefined$1(options)) {
1186
1085
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
1187
1086
  }
@@ -1209,7 +1108,7 @@ function getComponentRestrictionsDescriptors() {
1209
1108
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1210
1109
  assertNotProd(); // this method should never leak to prod
1211
1110
  const originalDispatchEvent = proto.dispatchEvent;
1212
- const descriptors = {
1111
+ return {
1213
1112
  dispatchEvent: generateDataDescriptor({
1214
1113
  value(event) {
1215
1114
  const vm = getAssociatedVM(this);
@@ -1227,32 +1126,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1227
1126
  },
1228
1127
  }),
1229
1128
  };
1230
- forEach.call(getOwnPropertyNames$1(globalHTMLProperties), (propName) => {
1231
- if (propName in proto) {
1232
- return; // no need to redefine something that we are already exposing
1233
- }
1234
- descriptors[propName] = generateAccessorDescriptor({
1235
- get() {
1236
- const { error, attribute } = globalHTMLProperties[propName];
1237
- const msg = [];
1238
- msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
1239
- if (error) {
1240
- msg.push(error);
1241
- }
1242
- else if (attribute) {
1243
- msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
1244
- }
1245
- logError(msg.join('\n'), getAssociatedVM(this));
1246
- },
1247
- set() {
1248
- const { readOnly } = globalHTMLProperties[propName];
1249
- if (readOnly) {
1250
- logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
1251
- }
1252
- },
1253
- });
1254
- });
1255
- return descriptors;
1256
1129
  }
1257
1130
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
1258
1131
  // that all components will work fine in IE11 and other browsers without shadow dom support.
@@ -2577,12 +2450,7 @@ function createPublicPropertyDescriptor(key) {
2577
2450
  }
2578
2451
  function createPublicAccessorDescriptor(key, descriptor) {
2579
2452
  const { get, set, enumerable, configurable } = descriptor;
2580
- if (!isFunction$1(get)) {
2581
- if (process.env.NODE_ENV !== 'production') {
2582
- assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2583
- }
2584
- throw new Error();
2585
- }
2453
+ assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
2586
2454
  return {
2587
2455
  get() {
2588
2456
  if (process.env.NODE_ENV !== 'production') {
@@ -2702,64 +2570,64 @@ function getClassDescriptorType(descriptor) {
2702
2570
  }
2703
2571
  }
2704
2572
  function validateObservedField(Ctor, fieldName, descriptor) {
2573
+ assertNotProd(); // this method should never leak to prod
2705
2574
  if (!isUndefined$1(descriptor)) {
2706
2575
  const type = getClassDescriptorType(descriptor);
2707
2576
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2708
- // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2709
- // This branch is only here for backward compatibility reasons.
2710
- if (type === "accessor" /* DescriptorType.Accessor */) {
2711
- logError(message);
2712
- }
2713
- else {
2714
- assert.fail(message);
2715
- }
2577
+ // TODO [#3408]: this should throw, not log
2578
+ logError(message);
2716
2579
  }
2717
2580
  }
2718
2581
  function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2582
+ assertNotProd(); // this method should never leak to prod
2719
2583
  if (!isUndefined$1(descriptor)) {
2720
2584
  const type = getClassDescriptorType(descriptor);
2721
- assert.fail(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2585
+ // TODO [#3408]: this should throw, not log
2586
+ logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2722
2587
  }
2723
2588
  }
2724
2589
  function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2590
+ assertNotProd(); // this method should never leak to prod
2725
2591
  if (!isUndefined$1(descriptor)) {
2726
2592
  const type = getClassDescriptorType(descriptor);
2727
- assert.fail(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2593
+ // TODO [#3408]: this should throw, not log
2594
+ logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2728
2595
  }
2729
2596
  }
2730
2597
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2598
+ assertNotProd(); // this method should never leak to prod
2731
2599
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2732
- assert.fail(`Invalid @wire ${methodName} method.`);
2600
+ // TODO [#3441]: This line of code does not seem possible to reach.
2601
+ logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2733
2602
  }
2734
2603
  }
2735
2604
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2605
+ assertNotProd(); // this method should never leak to prod
2736
2606
  if (!isUndefined$1(descriptor)) {
2737
2607
  const type = getClassDescriptorType(descriptor);
2738
2608
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2739
- // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
2740
- // This branch is only here for backward compatibility reasons.
2741
- if (type === "accessor" /* DescriptorType.Accessor */) {
2742
- logError(message);
2743
- }
2744
- else {
2745
- assert.fail(message);
2746
- }
2609
+ // TODO [#3408]: this should throw, not log
2610
+ logError(message);
2747
2611
  }
2748
2612
  }
2749
2613
  function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2750
- if (isUndefined$1(descriptor)) {
2751
- assert.fail(`Invalid @api get ${fieldName} accessor.`);
2752
- }
2753
- else if (isFunction$1(descriptor.set)) {
2754
- 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.`);
2614
+ assertNotProd(); // this method should never leak to prod
2615
+ if (isFunction$1(descriptor.set)) {
2616
+ if (!isFunction$1(descriptor.get)) {
2617
+ // TODO [#3441]: This line of code does not seem possible to reach.
2618
+ logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2619
+ }
2755
2620
  }
2756
2621
  else if (!isFunction$1(descriptor.get)) {
2757
- assert.fail(`Missing @api get ${fieldName} accessor.`);
2622
+ // TODO [#3441]: This line of code does not seem possible to reach.
2623
+ logError(`Missing @api get ${fieldName} accessor.`);
2758
2624
  }
2759
2625
  }
2760
2626
  function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
2627
+ assertNotProd(); // this method should never leak to prod
2761
2628
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2762
- assert.fail(`Invalid @api ${methodName} method.`);
2629
+ // TODO [#3441]: This line of code does not seem possible to reach.
2630
+ logError(`Invalid @api ${methodName} method.`);
2763
2631
  }
2764
2632
  }
2765
2633
  /**
@@ -2782,13 +2650,14 @@ function registerDecorators(Ctor, meta) {
2782
2650
  apiFieldsConfig[fieldName] = propConfig.config;
2783
2651
  descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2784
2652
  if (propConfig.config > 0) {
2653
+ if (isUndefined$1(descriptor)) {
2654
+ // TODO [#3441]: This line of code does not seem possible to reach.
2655
+ throw new Error();
2656
+ }
2785
2657
  // accessor declaration
2786
2658
  if (process.env.NODE_ENV !== 'production') {
2787
2659
  validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
2788
2660
  }
2789
- if (isUndefined$1(descriptor)) {
2790
- throw new Error();
2791
- }
2792
2661
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2793
2662
  }
2794
2663
  else {
@@ -2828,7 +2697,10 @@ function registerDecorators(Ctor, meta) {
2828
2697
  descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2829
2698
  if (method === 1) {
2830
2699
  if (process.env.NODE_ENV !== 'production') {
2831
- assert.isTrue(adapter, `@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2700
+ if (!adapter) {
2701
+ // TODO [#3408]: this should throw, not log
2702
+ logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2703
+ }
2832
2704
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2833
2705
  }
2834
2706
  if (isUndefined$1(descriptor)) {
@@ -2839,7 +2711,10 @@ function registerDecorators(Ctor, meta) {
2839
2711
  }
2840
2712
  else {
2841
2713
  if (process.env.NODE_ENV !== 'production') {
2842
- assert.isTrue(adapter, `@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2714
+ if (!adapter) {
2715
+ // TODO [#3408]: this should throw, not log
2716
+ logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2717
+ }
2843
2718
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2844
2719
  }
2845
2720
  descriptor = internalWireFieldDecorator(fieldOrMethodName);
@@ -3539,15 +3414,6 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3539
3414
  // the stylesheet, while internally, we have a replacement for it.
3540
3415
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3541
3416
  }
3542
- // Check that this stylesheet was generated by our compiler
3543
- if (!isStylesheetRegistered(stylesheet)) {
3544
- if (process.env.NODE_ENV !== 'production') {
3545
- logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
3546
- }
3547
- report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
3548
- tagName: vm.tagName.toLowerCase(),
3549
- });
3550
- }
3551
3417
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3552
3418
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
3553
3419
  !isScopedCss &&
@@ -3636,18 +3502,6 @@ function createStylesheet(vm, stylesheets) {
3636
3502
  }
3637
3503
  return null;
3638
3504
  }
3639
- const signedStylesheetSet = new Set();
3640
- /**
3641
- * INTERNAL: This function can only be invoked by compiled code. The compiler
3642
- * will prevent this function from being imported by userland code.
3643
- */
3644
- function registerStylesheet(stylesheet) {
3645
- signedStylesheetSet.add(stylesheet);
3646
- return stylesheet;
3647
- }
3648
- function isStylesheetRegistered(stylesheet) {
3649
- return signedStylesheetSet.has(stylesheet);
3650
- }
3651
3505
 
3652
3506
  /*
3653
3507
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6360,12 +6214,12 @@ function readonly(obj) {
6360
6214
  if (process.env.NODE_ENV !== 'production') {
6361
6215
  // TODO [#1292]: Remove the readonly decorator
6362
6216
  if (arguments.length !== 1) {
6363
- 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.');
6217
+ 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.');
6364
6218
  }
6365
6219
  }
6366
6220
  return getReadOnlyProxy(obj);
6367
6221
  }
6368
- /* version: 2.43.0 */
6222
+ /* version: 2.45.0 */
6369
6223
 
6370
6224
  /*
6371
6225
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6775,6 +6629,38 @@ const renderer = {
6775
6629
  registerContextConsumer,
6776
6630
  };
6777
6631
 
6632
+ /*
6633
+ * Copyright (c) 2023, salesforce.com, inc.
6634
+ * All rights reserved.
6635
+ * SPDX-License-Identifier: MIT
6636
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6637
+ */
6638
+ function isSingleStyleNodeContainingSingleTextNode(node) {
6639
+ if (node.childNodes.length !== 1) {
6640
+ return false;
6641
+ }
6642
+ const style = node.childNodes[0];
6643
+ if (style.nodeName !== 'style' || style.childNodes.length !== 1) {
6644
+ return false;
6645
+ }
6646
+ const textNode = style.childNodes[0];
6647
+ return textNode.nodeName === '#text';
6648
+ }
6649
+ // The text content inside `<style>` is a special case. It is _only_ rendered by the LWC engine itself; <style> tags
6650
+ // are disallowed inside of templates. Also, we want to avoid over-escaping, since CSS containing strings like
6651
+ // `&amp;` and `&quot;` is not valid CSS (even when inside a `<style>` element).
6652
+ //
6653
+ // However, to avoid XSS attacks, we still need to check for things like `</style><script>alert("pwned")</script>`,
6654
+ // since a user could use that inside of a *.css file to break out of a <style> element.
6655
+ // See: https://github.com/salesforce/lwc/issues/3439
6656
+ function validateStyleTextContents(contents) {
6657
+ // If parse5 parses this as more than one `<style>` tag, then it is unsafe to be rendered as-is
6658
+ const fragment = parse5.parseFragment(`<style>${contents}</style>`);
6659
+ if (!isSingleStyleNodeContainingSingleTextNode(fragment)) {
6660
+ throw new Error('CSS contains unsafe characters and cannot be serialized inside a style element');
6661
+ }
6662
+ }
6663
+
6778
6664
  /*
6779
6665
  * Copyright (c) 2020, salesforce.com, inc.
6780
6666
  * All rights reserved.
@@ -6786,12 +6672,12 @@ function serializeAttributes(attributes) {
6786
6672
  .map((attr) => attr.value.length ? `${attr.name}="${htmlEscape(attr.value, true)}"` : attr.name)
6787
6673
  .join(' ');
6788
6674
  }
6789
- function serializeChildNodes(children) {
6675
+ function serializeChildNodes(children, tagName) {
6790
6676
  return children
6791
6677
  .map((child) => {
6792
6678
  switch (child[HostTypeKey]) {
6793
6679
  case HostNodeType.Text:
6794
- return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6680
+ return serializeTextContent(child[HostValueKey], tagName);
6795
6681
  case HostNodeType.Comment:
6796
6682
  return `<!--${htmlEscape(child[HostValueKey])}-->`;
6797
6683
  case HostNodeType.Raw:
@@ -6828,12 +6714,26 @@ function serializeElement(element) {
6828
6714
  if (element[HostShadowRootKey]) {
6829
6715
  output += serializeShadowRoot(element[HostShadowRootKey]);
6830
6716
  }
6831
- output += serializeChildNodes(element[HostChildrenKey]);
6717
+ output += serializeChildNodes(element[HostChildrenKey], tagName);
6832
6718
  if (!isVoidElement(tagName, namespace) || hasChildren) {
6833
6719
  output += `</${tagName}>`;
6834
6720
  }
6835
6721
  return output;
6836
6722
  }
6723
+ function serializeTextContent(contents, tagName) {
6724
+ if (contents === '') {
6725
+ return '\u200D'; // Special serialization for empty text nodes
6726
+ }
6727
+ if (tagName === 'style') {
6728
+ // Special validation for <style> tags since their content must be served unescaped, and we need to validate
6729
+ // that the contents are safe to serialize unescaped.
6730
+ // TODO [#3454]: move this validation to compilation
6731
+ validateStyleTextContents(contents);
6732
+ // If we haven't thrown an error during validation, then the content is safe to serialize unescaped
6733
+ return contents;
6734
+ }
6735
+ return htmlEscape(contents);
6736
+ }
6837
6737
 
6838
6738
  /*
6839
6739
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6900,7 +6800,7 @@ seal(LightningElement.prototype);
6900
6800
  function createElement() {
6901
6801
  throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
6902
6802
  }
6903
- /* version: 2.43.0 */
6803
+ /* version: 2.45.0 */
6904
6804
 
6905
- 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 };
6805
+ 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 };
6906
6806
  //# sourceMappingURL=engine-server.js.map