@lwc/engine-core 8.3.0 → 8.5.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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2024 Salesforce, Inc.
3
3
  */
4
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isArray as isArray$1, isFunction as isFunction$1, keys, ArrayFilter, isObject, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, assert, freeze, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, ArraySplice, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, StringTrim, ArraySort, ArrayFrom, htmlEscape, StringCharAt, ArrayUnshift, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, StringSplit, parseStyleText, arrayEvery, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
4
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, assert, freeze, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, StringTrim, ArraySort, ArrayFrom, htmlEscape, StringCharAt, ArrayUnshift, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, StringSplit, parseStyleText, arrayEvery, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
5
5
  export { setTrustedSignalSet } from '@lwc/shared';
6
6
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
7
7
 
@@ -228,18 +228,6 @@ function cloneAndOmitKey(object, keyToOmit) {
228
228
  }
229
229
  return result;
230
230
  }
231
- function flattenStylesheets(stylesheets) {
232
- const list = [];
233
- for (const stylesheet of stylesheets) {
234
- if (!isArray$1(stylesheet)) {
235
- list.push(stylesheet);
236
- }
237
- else {
238
- list.push(...flattenStylesheets(stylesheet));
239
- }
240
- }
241
- return list;
242
- }
243
231
  // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
244
232
  function assertNotProd() {
245
233
  /* istanbul ignore if */
@@ -293,6 +281,16 @@ function toPrettyMemberNotation(parent, child) {
293
281
  return `${toString$1(parent)}[${JSON.stringify(child)}]`;
294
282
  }
295
283
  }
284
+ function safelyCallGetter(target, key) {
285
+ // Arbitrary getters can throw. We don't want to throw an error just due to dev-mode-only mutation tracking
286
+ // (which is only used for performance debugging) so ignore errors here.
287
+ try {
288
+ return target[key];
289
+ }
290
+ catch (_err) {
291
+ /* ignore */
292
+ }
293
+ }
296
294
  /**
297
295
  * Flush all the logs we've written so far and return the current logs.
298
296
  */
@@ -361,7 +359,7 @@ function trackTargetForMutationLogging(key, target) {
361
359
  // Deeply traverse arrays and objects to track every object within
362
360
  if (isArray$1(target)) {
363
361
  for (let i = 0; i < target.length; i++) {
364
- trackTargetForMutationLogging(toPrettyMemberNotation(key, i), target[i]);
362
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, i), safelyCallGetter(target, i));
365
363
  }
366
364
  }
367
365
  else {
@@ -370,10 +368,10 @@ function trackTargetForMutationLogging(key, target) {
370
368
  // https://github.com/salesforce/observable-membrane/blob/b85417f/src/base-handler.ts#L142-L143
371
369
  // Note this code path is very hot, hence doing two separate for-loops rather than creating a new array.
372
370
  for (const prop of getOwnPropertyNames$1(target)) {
373
- trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
371
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
374
372
  }
375
373
  for (const prop of getOwnPropertySymbols$1(target)) {
376
- trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
374
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
377
375
  }
378
376
  }
379
377
  }
@@ -666,8 +664,9 @@ for (const [propName, attrName] of entries(AriaPropNameToAttrNameMap)) {
666
664
  return this.getAttribute(attrName);
667
665
  },
668
666
  set(newValue) {
669
- // TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
670
- // Our historical behavior is to only treat null as removing the attribute
667
+ // TODO [#3284]: According to the spec, IDL nullable type values
668
+ // (null and undefined) should remove the attribute; however, we
669
+ // only do so in the case of null for historical reasons.
671
670
  // See also https://github.com/w3c/aria/issues/1858
672
671
  if (isNull(newValue)) {
673
672
  this.removeAttribute(attrName);
@@ -8005,7 +8004,10 @@ function validateClassAttr(vnode, elm, data, renderer) {
8005
8004
  let nodesAreCompatible = true;
8006
8005
  let readableVnodeClassname;
8007
8006
  const elmClassName = getAttribute(elm, 'class');
8008
- if (!isUndefined$1(className) && String(className) !== elmClassName) {
8007
+ if (!isUndefined$1(className) &&
8008
+ String(className) !== elmClassName &&
8009
+ // No mismatch if SSR `class` attribute is missing and CSR `class` is the empty string
8010
+ !(className === '' && isNull(elmClassName))) {
8009
8011
  // className is used when class is bound to an expr.
8010
8012
  nodesAreCompatible = false;
8011
8013
  // stringify for pretty-printing
@@ -8443,5 +8445,5 @@ function readonly(obj) {
8443
8445
  }
8444
8446
 
8445
8447
  export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8446
- /** version: 8.3.0 */
8448
+ /** version: 8.5.0 */
8447
8449
  //# sourceMappingURL=index.js.map