@lwc/engine-core 7.0.5 → 7.1.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.
@@ -49,5 +49,7 @@ export interface RendererAPI {
49
49
  ownerDocument(elm: E): Document;
50
50
  registerContextConsumer: (element: E, adapterContextToken: string, subscriptionPayload: WireContextSubscriptionPayload) => void;
51
51
  attachInternals: (elm: E) => ElementInternals;
52
+ startTrackingMutations: (elm: E) => void;
53
+ stopTrackingMutations: (elm: E) => void;
52
54
  }
53
55
  export {};
package/dist/index.cjs.js CHANGED
@@ -6695,7 +6695,14 @@ function runConnectedCallback(vm) {
6695
6695
  const { connectedCallback } = vm.def;
6696
6696
  if (!shared.isUndefined(connectedCallback)) {
6697
6697
  logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
6698
+ if (!process.env.IS_BROWSER) {
6699
+ // Track host element mutations in SSR mode to add the `data-lwc-host-mutated` attribute if necessary
6700
+ vm.renderer.startTrackingMutations(vm.elm);
6701
+ }
6698
6702
  invokeComponentCallback(vm, connectedCallback);
6703
+ if (!process.env.IS_BROWSER) {
6704
+ vm.renderer.stopTrackingMutations(vm.elm);
6705
+ }
6699
6706
  logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
6700
6707
  }
6701
6708
  // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
@@ -7266,7 +7273,12 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
7266
7273
  // The validationOptOut static property can be an array of attribute names.
7267
7274
  // Any attribute names specified in that array will not be validated, and the
7268
7275
  // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
7269
- function getValidationPredicate(optOutStaticProp) {
7276
+ function getValidationPredicate(elm, renderer, optOutStaticProp) {
7277
+ // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself,
7278
+ // which does the same thing as an explicit `static validationOptOut = true`.
7279
+ if (renderer.getAttribute(elm, 'data-lwc-host-mutated') === '') {
7280
+ return (_attrName) => false;
7281
+ }
7270
7282
  if (shared.isUndefined(optOutStaticProp)) {
7271
7283
  return (_attrName) => true;
7272
7284
  }
@@ -7384,7 +7396,7 @@ function hydrateElement(elm, vnode, renderer) {
7384
7396
  }
7385
7397
  function hydrateCustomElement(elm, vnode, renderer) {
7386
7398
  const { validationOptOut } = vnode.ctor;
7387
- const shouldValidateAttr = getValidationPredicate(validationOptOut);
7399
+ const shouldValidateAttr = getValidationPredicate(elm, renderer, validationOptOut);
7388
7400
  // The validationOptOut static property can be an array of attribute names.
7389
7401
  // Any attribute names specified in that array will not be validated, and the
7390
7402
  // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
@@ -8072,5 +8084,5 @@ exports.swapTemplate = swapTemplate;
8072
8084
  exports.track = track;
8073
8085
  exports.unwrap = unwrap;
8074
8086
  exports.wire = wire;
8075
- /** version: 7.0.5 */
8087
+ /** version: 7.1.0 */
8076
8088
  //# sourceMappingURL=index.cjs.js.map