@lwc/ssr-runtime 8.12.0 → 8.12.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -328,14 +328,14 @@ function isObject(obj) {
328
328
  function isString(obj) {
329
329
  return typeof obj === 'string';
330
330
  }
331
- const OtS$1 = {}.toString;
331
+ const OtS = {}.toString;
332
332
  /**
333
333
  * Converts the argument to a string, safely accounting for objects with "null" prototype.
334
334
  * Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
335
335
  * @param obj Value to convert to a string.
336
336
  * @returns String representation of the value.
337
337
  */
338
- function toString$1(obj) {
338
+ function toString(obj) {
339
339
  if (obj?.toString) {
340
340
  // Arrays might hold objects with "null" prototype So using
341
341
  // Array.prototype.toString directly will cause an error Iterate through
@@ -351,13 +351,13 @@ function toString$1(obj) {
351
351
  // 4. Array#toString converts recursive references to arrays to ''
352
352
  // Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
353
353
  // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
354
- return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
354
+ return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
355
355
  }
356
356
  return obj.toString();
357
357
  }
358
358
  else if (typeof obj === 'object') {
359
359
  // This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
360
- return OtS$1.call(obj);
360
+ return OtS.call(obj);
361
361
  }
362
362
  else {
363
363
  return String(obj);
@@ -649,7 +649,7 @@ function setHooks(hooks) {
649
649
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
650
650
  */
651
651
  const DEFAULT_SSR_MODE = 'sync';
652
- /** version: 8.12.0 */
652
+ /** version: 8.12.1 */
653
653
 
654
654
  /*
655
655
  * Copyright (c) 2024, Salesforce, Inc.
@@ -733,18 +733,6 @@ class ClassList {
733
733
  const { isArray } = Array;
734
734
  const { prototype: ObjectDotPrototype, getPrototypeOf, create: ObjectCreate, defineProperty: ObjectDefineProperty, isExtensible, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, preventExtensions, hasOwnProperty, } = Object;
735
735
  const { push: ArrayPush, concat: ArrayConcat } = Array.prototype;
736
- const OtS = {}.toString;
737
- function toString(obj) {
738
- if (obj && obj.toString) {
739
- return obj.toString();
740
- }
741
- else if (typeof obj === 'object') {
742
- return OtS.call(obj);
743
- }
744
- else {
745
- return obj + '';
746
- }
747
- }
748
736
  function isUndefined(obj) {
749
737
  return obj === undefined;
750
738
  }
@@ -982,10 +970,6 @@ class ReactiveProxyHandler extends BaseProxyHandler {
982
970
  return true;
983
971
  }
984
972
  setPrototypeOf(shadowTarget, prototype) {
985
- /* istanbul ignore else */
986
- if (process.env.NODE_ENV !== 'production') {
987
- throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
988
- }
989
973
  }
990
974
  preventExtensions(shadowTarget) {
991
975
  if (isExtensible(shadowTarget)) {
@@ -1049,147 +1033,31 @@ class ReadOnlyHandler extends BaseProxyHandler {
1049
1033
  if (!isUndefined(wrappedSetter)) {
1050
1034
  return wrappedSetter;
1051
1035
  }
1052
- const handler = this;
1053
1036
  const set = function (v) {
1054
- /* istanbul ignore else */
1055
- if (process.env.NODE_ENV !== 'production') {
1056
- const { originalTarget } = handler;
1057
- throw new Error(`Invalid mutation: Cannot invoke a setter on "${originalTarget}". "${originalTarget}" is read-only.`);
1058
- }
1059
1037
  };
1060
1038
  setterMap.set(originalSet, set);
1061
1039
  return set;
1062
1040
  }
1063
1041
  set(shadowTarget, key, value) {
1064
- /* istanbul ignore else */
1065
- if (process.env.NODE_ENV !== 'production') {
1066
- const { originalTarget } = this;
1067
- const msg = isArray(originalTarget)
1068
- ? `Invalid mutation: Cannot mutate array at index ${key.toString()}. Array is read-only.`
1069
- : `Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`;
1070
- throw new Error(msg);
1071
- }
1072
1042
  /* istanbul ignore next */
1073
1043
  return false;
1074
1044
  }
1075
1045
  deleteProperty(shadowTarget, key) {
1076
- /* istanbul ignore else */
1077
- if (process.env.NODE_ENV !== 'production') {
1078
- const { originalTarget } = this;
1079
- throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
1080
- }
1081
1046
  /* istanbul ignore next */
1082
1047
  return false;
1083
1048
  }
1084
1049
  setPrototypeOf(shadowTarget, prototype) {
1085
- /* istanbul ignore else */
1086
- if (process.env.NODE_ENV !== 'production') {
1087
- const { originalTarget } = this;
1088
- throw new Error(`Invalid prototype mutation: Cannot set prototype on "${originalTarget}". "${originalTarget}" prototype is read-only.`);
1089
- }
1090
1050
  }
1091
1051
  preventExtensions(shadowTarget) {
1092
- /* istanbul ignore else */
1093
- if (process.env.NODE_ENV !== 'production') {
1094
- const { originalTarget } = this;
1095
- throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
1096
- }
1097
1052
  /* istanbul ignore next */
1098
1053
  return false;
1099
1054
  }
1100
1055
  defineProperty(shadowTarget, key, descriptor) {
1101
- /* istanbul ignore else */
1102
- if (process.env.NODE_ENV !== 'production') {
1103
- const { originalTarget } = this;
1104
- throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
1105
- }
1106
1056
  /* istanbul ignore next */
1107
1057
  return false;
1108
1058
  }
1109
1059
  }
1110
1060
 
1111
- function extract(objectOrArray) {
1112
- if (isArray(objectOrArray)) {
1113
- return objectOrArray.map((item) => {
1114
- const original = unwrap(item);
1115
- if (original !== item) {
1116
- return extract(original);
1117
- }
1118
- return item;
1119
- });
1120
- }
1121
- const obj = ObjectCreate(getPrototypeOf(objectOrArray));
1122
- const names = getOwnPropertyNames(objectOrArray);
1123
- return ArrayConcat.call(names, getOwnPropertySymbols(objectOrArray)).reduce((seed, key) => {
1124
- const item = objectOrArray[key];
1125
- const original = unwrap(item);
1126
- if (original !== item) {
1127
- seed[key] = extract(original);
1128
- }
1129
- else {
1130
- seed[key] = item;
1131
- }
1132
- return seed;
1133
- }, obj);
1134
- }
1135
- const formatter = {
1136
- header: (plainOrProxy) => {
1137
- const originalTarget = unwrap(plainOrProxy);
1138
- // if originalTarget is falsy or not unwrappable, exit
1139
- if (!originalTarget || originalTarget === plainOrProxy) {
1140
- return null;
1141
- }
1142
- const obj = extract(plainOrProxy);
1143
- return ['object', { object: obj }];
1144
- },
1145
- hasBody: () => {
1146
- return false;
1147
- },
1148
- body: () => {
1149
- return null;
1150
- },
1151
- };
1152
- // Inspired from paulmillr/es6-shim
1153
- // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
1154
- /* istanbul ignore next */
1155
- function getGlobal() {
1156
- // the only reliable means to get the global object is `Function('return this')()`
1157
- // However, this causes CSP violations in Chrome apps.
1158
- if (typeof globalThis !== 'undefined') {
1159
- return globalThis;
1160
- }
1161
- if (typeof self !== 'undefined') {
1162
- return self;
1163
- }
1164
- if (typeof window !== 'undefined') {
1165
- return window;
1166
- }
1167
- if (typeof global !== 'undefined') {
1168
- return global;
1169
- }
1170
- // Gracefully degrade if not able to locate the global object
1171
- return {};
1172
- }
1173
- function init() {
1174
- /* istanbul ignore if */
1175
- if (process.env.NODE_ENV === 'production') {
1176
- // this method should never leak to prod
1177
- throw new ReferenceError();
1178
- }
1179
- const global = getGlobal();
1180
- // Custom Formatter for Dev Tools. To enable this, open Chrome Dev Tools
1181
- // - Go to Settings,
1182
- // - Under console, select "Enable custom formatters"
1183
- // For more information, https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview
1184
- const devtoolsFormatters = global.devtoolsFormatters || [];
1185
- ArrayPush.call(devtoolsFormatters, formatter);
1186
- global.devtoolsFormatters = devtoolsFormatters;
1187
- }
1188
-
1189
- /* istanbul ignore else */
1190
- if (process.env.NODE_ENV !== 'production') {
1191
- init();
1192
- }
1193
1061
  function defaultValueIsObservable(value) {
1194
1062
  // intentionally checking for null
1195
1063
  if (value === null) {
@@ -1467,7 +1335,7 @@ const ariaDescriptor = (attrName) => ({
1467
1335
  this.removeAttribute(attrName);
1468
1336
  }
1469
1337
  else {
1470
- this.setAttribute(attrName, toString$1(newValue));
1338
+ this.setAttribute(attrName, toString(newValue));
1471
1339
  }
1472
1340
  }
1473
1341
  },
@@ -1485,7 +1353,7 @@ const tabIndexDescriptor = () => ({
1485
1353
  const num = Number(newValue);
1486
1354
  const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
1487
1355
  if (normalizedValue !== currentValue) {
1488
- this.setAttribute('tabindex', toString$1(newValue));
1356
+ this.setAttribute('tabindex', toString(newValue));
1489
1357
  }
1490
1358
  },
1491
1359
  });
@@ -1544,24 +1412,24 @@ class LightningElement {
1544
1412
  return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
1545
1413
  }
1546
1414
  setAttribute(attrName, attrValue) {
1547
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1415
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1548
1416
  const normalizedValue = String(attrValue);
1549
1417
  __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
1550
1418
  mutationTracker.add(this, normalizedName);
1551
1419
  }
1552
1420
  getAttribute(attrName) {
1553
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1421
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1554
1422
  if (hasOwnProperty$1.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
1555
1423
  return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
1556
1424
  }
1557
1425
  return null;
1558
1426
  }
1559
1427
  hasAttribute(attrName) {
1560
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1428
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1561
1429
  return hasOwnProperty$1.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
1562
1430
  }
1563
1431
  removeAttribute(attrName) {
1564
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1432
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1565
1433
  delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
1566
1434
  // Track mutations for removal of non-existing attributes
1567
1435
  mutationTracker.add(this, normalizedName);
@@ -1934,5 +1802,5 @@ function createContextProvider(adapter) {
1934
1802
  }
1935
1803
 
1936
1804
  export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, filterProperties, freezeTemplate, getComponentDef, getReadOnlyProxy, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, massageTextContent, mutationTracker, normalizeClass, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1937
- /** version: 8.12.0 */
1805
+ /** version: 8.12.1 */
1938
1806
  //# sourceMappingURL=index.js.map