lwc 2.43.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 +51 -208
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +51 -208
  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 -9
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +50 -209
  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 -8
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +51 -208
  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 -9
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +50 -209
  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 -8
  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 -174
  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 -174
  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.44.0";
446
449
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
447
- /** version: 2.43.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.43.0 */
528
+ /** version: 2.44.0 */
526
529
 
527
530
  /*
528
531
  * Copyright (c) 2020, salesforce.com, inc.
@@ -618,7 +621,7 @@ function applyAriaReflection(prototype = Element.prototype) {
618
621
  }
619
622
  }
620
623
  }
621
- /** version: 2.43.0 */
624
+ /** version: 2.44.0 */
622
625
 
623
626
  /* proxy-compat-disable */
624
627
  /**
@@ -854,101 +857,6 @@ const defaultDefHTMLPropertyNames = [
854
857
  'tabIndex',
855
858
  'title',
856
859
  ];
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
860
  let controlledElement = null;
953
861
  let controlledAttributeName;
954
862
  function isAttributeLocked(elm, attrName) {
@@ -1133,8 +1041,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
1133
1041
  }),
1134
1042
  addEventListener: generateDataDescriptor({
1135
1043
  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
1044
+ // TODO [#1824]: Potentially relax this restriction
1138
1045
  if (!isUndefined$1(options)) {
1139
1046
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
1140
1047
  }
@@ -1180,8 +1087,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
1180
1087
  }),
1181
1088
  addEventListener: generateDataDescriptor({
1182
1089
  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
1090
+ // TODO [#1824]: Potentially relax this restriction
1185
1091
  if (!isUndefined$1(options)) {
1186
1092
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
1187
1093
  }
@@ -1209,7 +1115,7 @@ function getComponentRestrictionsDescriptors() {
1209
1115
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1210
1116
  assertNotProd(); // this method should never leak to prod
1211
1117
  const originalDispatchEvent = proto.dispatchEvent;
1212
- const descriptors = {
1118
+ return {
1213
1119
  dispatchEvent: generateDataDescriptor({
1214
1120
  value(event) {
1215
1121
  const vm = getAssociatedVM(this);
@@ -1227,32 +1133,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1227
1133
  },
1228
1134
  }),
1229
1135
  };
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
1136
  }
1257
1137
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
1258
1138
  // that all components will work fine in IE11 and other browsers without shadow dom support.
@@ -2577,12 +2457,7 @@ function createPublicPropertyDescriptor(key) {
2577
2457
  }
2578
2458
  function createPublicAccessorDescriptor(key, descriptor) {
2579
2459
  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
- }
2460
+ assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
2586
2461
  return {
2587
2462
  get() {
2588
2463
  if (process.env.NODE_ENV !== 'production') {
@@ -2702,64 +2577,64 @@ function getClassDescriptorType(descriptor) {
2702
2577
  }
2703
2578
  }
2704
2579
  function validateObservedField(Ctor, fieldName, descriptor) {
2580
+ assertNotProd(); // this method should never leak to prod
2705
2581
  if (!isUndefined$1(descriptor)) {
2706
2582
  const type = getClassDescriptorType(descriptor);
2707
2583
  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
- }
2584
+ // TODO [#3408]: this should throw, not log
2585
+ logError(message);
2716
2586
  }
2717
2587
  }
2718
2588
  function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2589
+ assertNotProd(); // this method should never leak to prod
2719
2590
  if (!isUndefined$1(descriptor)) {
2720
2591
  const type = getClassDescriptorType(descriptor);
2721
- 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.`);
2722
2594
  }
2723
2595
  }
2724
2596
  function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2597
+ assertNotProd(); // this method should never leak to prod
2725
2598
  if (!isUndefined$1(descriptor)) {
2726
2599
  const type = getClassDescriptorType(descriptor);
2727
- 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.`);
2728
2602
  }
2729
2603
  }
2730
2604
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2605
+ assertNotProd(); // this method should never leak to prod
2731
2606
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2732
- 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.`);
2733
2609
  }
2734
2610
  }
2735
2611
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2612
+ assertNotProd(); // this method should never leak to prod
2736
2613
  if (!isUndefined$1(descriptor)) {
2737
2614
  const type = getClassDescriptorType(descriptor);
2738
2615
  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
- }
2616
+ // TODO [#3408]: this should throw, not log
2617
+ logError(message);
2747
2618
  }
2748
2619
  }
2749
2620
  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.`);
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
+ }
2755
2627
  }
2756
2628
  else if (!isFunction$1(descriptor.get)) {
2757
- 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.`);
2758
2631
  }
2759
2632
  }
2760
2633
  function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
2634
+ assertNotProd(); // this method should never leak to prod
2761
2635
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2762
- 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.`);
2763
2638
  }
2764
2639
  }
2765
2640
  /**
@@ -2782,13 +2657,14 @@ function registerDecorators(Ctor, meta) {
2782
2657
  apiFieldsConfig[fieldName] = propConfig.config;
2783
2658
  descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2784
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
+ }
2785
2664
  // accessor declaration
2786
2665
  if (process.env.NODE_ENV !== 'production') {
2787
2666
  validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
2788
2667
  }
2789
- if (isUndefined$1(descriptor)) {
2790
- throw new Error();
2791
- }
2792
2668
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2793
2669
  }
2794
2670
  else {
@@ -2828,7 +2704,10 @@ function registerDecorators(Ctor, meta) {
2828
2704
  descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2829
2705
  if (method === 1) {
2830
2706
  if (process.env.NODE_ENV !== 'production') {
2831
- 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
+ }
2832
2711
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2833
2712
  }
2834
2713
  if (isUndefined$1(descriptor)) {
@@ -2839,7 +2718,10 @@ function registerDecorators(Ctor, meta) {
2839
2718
  }
2840
2719
  else {
2841
2720
  if (process.env.NODE_ENV !== 'production') {
2842
- 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
+ }
2843
2725
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2844
2726
  }
2845
2727
  descriptor = internalWireFieldDecorator(fieldOrMethodName);
@@ -6360,12 +6242,12 @@ function readonly(obj) {
6360
6242
  if (process.env.NODE_ENV !== 'production') {
6361
6243
  // TODO [#1292]: Remove the readonly decorator
6362
6244
  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.');
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.');
6364
6246
  }
6365
6247
  }
6366
6248
  return getReadOnlyProxy(obj);
6367
6249
  }
6368
- /* version: 2.43.0 */
6250
+ /* version: 2.44.0 */
6369
6251
 
6370
6252
  /*
6371
6253
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6775,6 +6657,38 @@ const renderer = {
6775
6657
  registerContextConsumer,
6776
6658
  };
6777
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
+
6778
6692
  /*
6779
6693
  * Copyright (c) 2020, salesforce.com, inc.
6780
6694
  * All rights reserved.
@@ -6786,12 +6700,12 @@ function serializeAttributes(attributes) {
6786
6700
  .map((attr) => attr.value.length ? `${attr.name}="${htmlEscape(attr.value, true)}"` : attr.name)
6787
6701
  .join(' ');
6788
6702
  }
6789
- function serializeChildNodes(children) {
6703
+ function serializeChildNodes(children, tagName) {
6790
6704
  return children
6791
6705
  .map((child) => {
6792
6706
  switch (child[HostTypeKey]) {
6793
6707
  case HostNodeType.Text:
6794
- return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6708
+ return serializeTextContent(child[HostValueKey], tagName);
6795
6709
  case HostNodeType.Comment:
6796
6710
  return `<!--${htmlEscape(child[HostValueKey])}-->`;
6797
6711
  case HostNodeType.Raw:
@@ -6828,12 +6742,26 @@ function serializeElement(element) {
6828
6742
  if (element[HostShadowRootKey]) {
6829
6743
  output += serializeShadowRoot(element[HostShadowRootKey]);
6830
6744
  }
6831
- output += serializeChildNodes(element[HostChildrenKey]);
6745
+ output += serializeChildNodes(element[HostChildrenKey], tagName);
6832
6746
  if (!isVoidElement(tagName, namespace) || hasChildren) {
6833
6747
  output += `</${tagName}>`;
6834
6748
  }
6835
6749
  return output;
6836
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
+ }
6837
6765
 
6838
6766
  /*
6839
6767
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6900,7 +6828,7 @@ seal(LightningElement.prototype);
6900
6828
  function createElement() {
6901
6829
  throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
6902
6830
  }
6903
- /* version: 2.43.0 */
6831
+ /* version: 2.44.0 */
6904
6832
 
6905
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 };
6906
6834
  //# sourceMappingURL=engine-server.js.map