@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.cjs.js CHANGED
@@ -332,14 +332,14 @@ function isObject(obj) {
332
332
  function isString(obj) {
333
333
  return typeof obj === 'string';
334
334
  }
335
- const OtS$1 = {}.toString;
335
+ const OtS = {}.toString;
336
336
  /**
337
337
  * Converts the argument to a string, safely accounting for objects with "null" prototype.
338
338
  * Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
339
339
  * @param obj Value to convert to a string.
340
340
  * @returns String representation of the value.
341
341
  */
342
- function toString$1(obj) {
342
+ function toString(obj) {
343
343
  if (obj?.toString) {
344
344
  // Arrays might hold objects with "null" prototype So using
345
345
  // Array.prototype.toString directly will cause an error Iterate through
@@ -355,13 +355,13 @@ function toString$1(obj) {
355
355
  // 4. Array#toString converts recursive references to arrays to ''
356
356
  // Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
357
357
  // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
358
- return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
358
+ return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
359
359
  }
360
360
  return obj.toString();
361
361
  }
362
362
  else if (typeof obj === 'object') {
363
363
  // This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
364
- return OtS$1.call(obj);
364
+ return OtS.call(obj);
365
365
  }
366
366
  else {
367
367
  return String(obj);
@@ -653,7 +653,7 @@ function setHooks(hooks) {
653
653
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
654
654
  */
655
655
  const DEFAULT_SSR_MODE = 'sync';
656
- /** version: 8.12.0 */
656
+ /** version: 8.12.1 */
657
657
 
658
658
  /*
659
659
  * Copyright (c) 2024, Salesforce, Inc.
@@ -737,18 +737,6 @@ class ClassList {
737
737
  const { isArray } = Array;
738
738
  const { prototype: ObjectDotPrototype, getPrototypeOf, create: ObjectCreate, defineProperty: ObjectDefineProperty, isExtensible, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, preventExtensions, hasOwnProperty, } = Object;
739
739
  const { push: ArrayPush, concat: ArrayConcat } = Array.prototype;
740
- const OtS = {}.toString;
741
- function toString(obj) {
742
- if (obj && obj.toString) {
743
- return obj.toString();
744
- }
745
- else if (typeof obj === 'object') {
746
- return OtS.call(obj);
747
- }
748
- else {
749
- return obj + '';
750
- }
751
- }
752
740
  function isUndefined(obj) {
753
741
  return obj === undefined;
754
742
  }
@@ -986,10 +974,6 @@ class ReactiveProxyHandler extends BaseProxyHandler {
986
974
  return true;
987
975
  }
988
976
  setPrototypeOf(shadowTarget, prototype) {
989
- /* istanbul ignore else */
990
- if (process.env.NODE_ENV !== 'production') {
991
- throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
992
- }
993
977
  }
994
978
  preventExtensions(shadowTarget) {
995
979
  if (isExtensible(shadowTarget)) {
@@ -1053,147 +1037,31 @@ class ReadOnlyHandler extends BaseProxyHandler {
1053
1037
  if (!isUndefined(wrappedSetter)) {
1054
1038
  return wrappedSetter;
1055
1039
  }
1056
- const handler = this;
1057
1040
  const set = function (v) {
1058
- /* istanbul ignore else */
1059
- if (process.env.NODE_ENV !== 'production') {
1060
- const { originalTarget } = handler;
1061
- throw new Error(`Invalid mutation: Cannot invoke a setter on "${originalTarget}". "${originalTarget}" is read-only.`);
1062
- }
1063
1041
  };
1064
1042
  setterMap.set(originalSet, set);
1065
1043
  return set;
1066
1044
  }
1067
1045
  set(shadowTarget, key, value) {
1068
- /* istanbul ignore else */
1069
- if (process.env.NODE_ENV !== 'production') {
1070
- const { originalTarget } = this;
1071
- const msg = isArray(originalTarget)
1072
- ? `Invalid mutation: Cannot mutate array at index ${key.toString()}. Array is read-only.`
1073
- : `Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`;
1074
- throw new Error(msg);
1075
- }
1076
1046
  /* istanbul ignore next */
1077
1047
  return false;
1078
1048
  }
1079
1049
  deleteProperty(shadowTarget, key) {
1080
- /* istanbul ignore else */
1081
- if (process.env.NODE_ENV !== 'production') {
1082
- const { originalTarget } = this;
1083
- throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
1084
- }
1085
1050
  /* istanbul ignore next */
1086
1051
  return false;
1087
1052
  }
1088
1053
  setPrototypeOf(shadowTarget, prototype) {
1089
- /* istanbul ignore else */
1090
- if (process.env.NODE_ENV !== 'production') {
1091
- const { originalTarget } = this;
1092
- throw new Error(`Invalid prototype mutation: Cannot set prototype on "${originalTarget}". "${originalTarget}" prototype is read-only.`);
1093
- }
1094
1054
  }
1095
1055
  preventExtensions(shadowTarget) {
1096
- /* istanbul ignore else */
1097
- if (process.env.NODE_ENV !== 'production') {
1098
- const { originalTarget } = this;
1099
- throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
1100
- }
1101
1056
  /* istanbul ignore next */
1102
1057
  return false;
1103
1058
  }
1104
1059
  defineProperty(shadowTarget, key, descriptor) {
1105
- /* istanbul ignore else */
1106
- if (process.env.NODE_ENV !== 'production') {
1107
- const { originalTarget } = this;
1108
- throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
1109
- }
1110
1060
  /* istanbul ignore next */
1111
1061
  return false;
1112
1062
  }
1113
1063
  }
1114
1064
 
1115
- function extract(objectOrArray) {
1116
- if (isArray(objectOrArray)) {
1117
- return objectOrArray.map((item) => {
1118
- const original = unwrap(item);
1119
- if (original !== item) {
1120
- return extract(original);
1121
- }
1122
- return item;
1123
- });
1124
- }
1125
- const obj = ObjectCreate(getPrototypeOf(objectOrArray));
1126
- const names = getOwnPropertyNames(objectOrArray);
1127
- return ArrayConcat.call(names, getOwnPropertySymbols(objectOrArray)).reduce((seed, key) => {
1128
- const item = objectOrArray[key];
1129
- const original = unwrap(item);
1130
- if (original !== item) {
1131
- seed[key] = extract(original);
1132
- }
1133
- else {
1134
- seed[key] = item;
1135
- }
1136
- return seed;
1137
- }, obj);
1138
- }
1139
- const formatter = {
1140
- header: (plainOrProxy) => {
1141
- const originalTarget = unwrap(plainOrProxy);
1142
- // if originalTarget is falsy or not unwrappable, exit
1143
- if (!originalTarget || originalTarget === plainOrProxy) {
1144
- return null;
1145
- }
1146
- const obj = extract(plainOrProxy);
1147
- return ['object', { object: obj }];
1148
- },
1149
- hasBody: () => {
1150
- return false;
1151
- },
1152
- body: () => {
1153
- return null;
1154
- },
1155
- };
1156
- // Inspired from paulmillr/es6-shim
1157
- // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
1158
- /* istanbul ignore next */
1159
- function getGlobal() {
1160
- // the only reliable means to get the global object is `Function('return this')()`
1161
- // However, this causes CSP violations in Chrome apps.
1162
- if (typeof globalThis !== 'undefined') {
1163
- return globalThis;
1164
- }
1165
- if (typeof self !== 'undefined') {
1166
- return self;
1167
- }
1168
- if (typeof window !== 'undefined') {
1169
- return window;
1170
- }
1171
- if (typeof global !== 'undefined') {
1172
- return global;
1173
- }
1174
- // Gracefully degrade if not able to locate the global object
1175
- return {};
1176
- }
1177
- function init() {
1178
- /* istanbul ignore if */
1179
- if (process.env.NODE_ENV === 'production') {
1180
- // this method should never leak to prod
1181
- throw new ReferenceError();
1182
- }
1183
- const global = getGlobal();
1184
- // Custom Formatter for Dev Tools. To enable this, open Chrome Dev Tools
1185
- // - Go to Settings,
1186
- // - Under console, select "Enable custom formatters"
1187
- // For more information, https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview
1188
- const devtoolsFormatters = global.devtoolsFormatters || [];
1189
- ArrayPush.call(devtoolsFormatters, formatter);
1190
- global.devtoolsFormatters = devtoolsFormatters;
1191
- }
1192
-
1193
- /* istanbul ignore else */
1194
- if (process.env.NODE_ENV !== 'production') {
1195
- init();
1196
- }
1197
1065
  function defaultValueIsObservable(value) {
1198
1066
  // intentionally checking for null
1199
1067
  if (value === null) {
@@ -1471,7 +1339,7 @@ const ariaDescriptor = (attrName) => ({
1471
1339
  this.removeAttribute(attrName);
1472
1340
  }
1473
1341
  else {
1474
- this.setAttribute(attrName, toString$1(newValue));
1342
+ this.setAttribute(attrName, toString(newValue));
1475
1343
  }
1476
1344
  }
1477
1345
  },
@@ -1489,7 +1357,7 @@ const tabIndexDescriptor = () => ({
1489
1357
  const num = Number(newValue);
1490
1358
  const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
1491
1359
  if (normalizedValue !== currentValue) {
1492
- this.setAttribute('tabindex', toString$1(newValue));
1360
+ this.setAttribute('tabindex', toString(newValue));
1493
1361
  }
1494
1362
  },
1495
1363
  });
@@ -1548,24 +1416,24 @@ class LightningElement {
1548
1416
  return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
1549
1417
  }
1550
1418
  setAttribute(attrName, attrValue) {
1551
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1419
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1552
1420
  const normalizedValue = String(attrValue);
1553
1421
  __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
1554
1422
  mutationTracker.add(this, normalizedName);
1555
1423
  }
1556
1424
  getAttribute(attrName) {
1557
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1425
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1558
1426
  if (hasOwnProperty$1.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
1559
1427
  return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
1560
1428
  }
1561
1429
  return null;
1562
1430
  }
1563
1431
  hasAttribute(attrName) {
1564
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1432
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1565
1433
  return hasOwnProperty$1.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
1566
1434
  }
1567
1435
  removeAttribute(attrName) {
1568
- const normalizedName = StringToLowerCase.call(toString$1(attrName));
1436
+ const normalizedName = StringToLowerCase.call(toString(attrName));
1569
1437
  delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
1570
1438
  // Track mutations for removal of non-existing attributes
1571
1439
  mutationTracker.add(this, normalizedName);
@@ -1984,5 +1852,5 @@ exports.track = track;
1984
1852
  exports.unwrap = unwrap$1;
1985
1853
  exports.validateStyleTextContents = validateStyleTextContents;
1986
1854
  exports.wire = wire;
1987
- /** version: 8.12.0 */
1855
+ /** version: 8.12.1 */
1988
1856
  //# sourceMappingURL=index.cjs.js.map