@lwc/engine-core 6.1.0 → 6.1.1

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
@@ -409,6 +409,25 @@ function assertNotProd() {
409
409
  throw new ReferenceError();
410
410
  }
411
411
  }
412
+ // Temporary fix for when the LWC v5 compiler is used in conjunction with a v6+ engine
413
+ // The old compiler format used the "slot" attribute in the `data` bag, whereas the new
414
+ // format uses the special `slotAssignment` key.
415
+ // This should be removed when the LWC v5 compiler is not used anywhere where it could be mismatched
416
+ // with another LWC engine version.
417
+ // TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
418
+ function applyTemporaryCompilerV5SlotFix(data) {
419
+ if (lwcRuntimeFlags.DISABLE_TEMPORARY_V5_COMPILER_SUPPORT) {
420
+ return data;
421
+ }
422
+ const { attrs } = data;
423
+ if (!isUndefined$1(attrs)) {
424
+ const { slot } = attrs;
425
+ if (!isUndefined$1(slot) && !isNull(slot)) {
426
+ return Object.assign(Object.assign({}, data), { attrs: cloneAndOmitKey(attrs, 'slot'), slotAssignment: String(slot) });
427
+ }
428
+ }
429
+ return data;
430
+ }
412
431
 
413
432
  /*
414
433
  * Copyright (c) 2020, salesforce.com, inc.
@@ -3143,10 +3162,15 @@ function createComponentDef(Ctor) {
3143
3162
  logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3144
3163
  }
3145
3164
  if (!isUndefined$1(ctorShadowSupportMode) &&
3165
+ ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3146
3166
  ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
3147
3167
  ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
3148
3168
  logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
3149
3169
  }
3170
+ // TODO [#3971]: Completely remove shadowSupportMode "any"
3171
+ if (ctorShadowSupportMode === "any" /* ShadowSupportMode.Any */) {
3172
+ logWarn(`Invalid value 'any' for static property shadowSupportMode. 'any' is deprecated and will be removed in a future release--use 'native' instead.`);
3173
+ }
3150
3174
  if (!isUndefined$1(ctorRenderMode) &&
3151
3175
  ctorRenderMode !== 'light' &&
3152
3176
  ctorRenderMode !== 'shadow') {
@@ -4815,6 +4839,8 @@ function h(sel, data, children = EmptyArray) {
4815
4839
  }
4816
4840
  });
4817
4841
  }
4842
+ // TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
4843
+ data = applyTemporaryCompilerV5SlotFix(data);
4818
4844
  const { key, slotAssignment } = data;
4819
4845
  const vnode = {
4820
4846
  type: 2 /* VNodeType.Element */,
@@ -4851,6 +4877,8 @@ function s(slotName, data, children, slotset) {
4851
4877
  }
4852
4878
  const vmBeingRendered = getVMBeingRendered();
4853
4879
  const { renderMode, apiVersion } = vmBeingRendered;
4880
+ // TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
4881
+ data = applyTemporaryCompilerV5SlotFix(data);
4854
4882
  if (!isUndefined$1(slotset) &&
4855
4883
  !isUndefined$1(slotset.slotAssignments) &&
4856
4884
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
@@ -4954,6 +4982,8 @@ function c(sel, Ctor, data, children = EmptyArray) {
4954
4982
  });
4955
4983
  }
4956
4984
  }
4985
+ // TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
4986
+ data = applyTemporaryCompilerV5SlotFix(data);
4957
4987
  const { key, slotAssignment } = data;
4958
4988
  let elm, aChildren, vm;
4959
4989
  const vnode = {
@@ -5885,7 +5915,7 @@ function createVM(elm, ctor, renderer, options) {
5885
5915
  vm.debugInfo = create(null);
5886
5916
  }
5887
5917
  vm.stylesheets = computeStylesheets(vm, def.ctor);
5888
- const computedShadowMode = computeShadowMode(def, vm.owner, renderer);
5918
+ const computedShadowMode = computeShadowMode(def, vm.owner, renderer, hydrated);
5889
5919
  if (lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
5890
5920
  vm.shadowMode = 0 /* ShadowMode.Native */;
5891
5921
  vm.shadowMigrateMode = computedShadowMode === 1 /* ShadowMode.Synthetic */;
@@ -5972,16 +6002,21 @@ function computeShadowAndRenderMode(Ctor, renderer) {
5972
6002
  const def = getComponentInternalDef(Ctor);
5973
6003
  const { renderMode } = def;
5974
6004
  // Assume null `owner` - this is what happens in hydration cases anyway
5975
- const shadowMode = computeShadowMode(def, /* owner */ null, renderer);
6005
+ // Also assume we are not in hydration mode for this exported API
6006
+ const shadowMode = computeShadowMode(def, /* owner */ null, renderer, false);
5976
6007
  return { renderMode, shadowMode };
5977
6008
  }
5978
- function computeShadowMode(def, owner, renderer) {
6009
+ function computeShadowMode(def, owner, renderer, hydrated) {
5979
6010
  // Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
5980
6011
  // on, but components running in actual native shadow mode
5981
6012
  if (process.env.NODE_ENV !== 'production' &&
5982
6013
  lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
5983
6014
  return 0 /* ShadowMode.Native */;
5984
6015
  }
6016
+ if (isTrue(hydrated)) {
6017
+ // hydration only supports native shadow
6018
+ return 0 /* ShadowMode.Native */;
6019
+ }
5985
6020
  const { isSyntheticShadowDefined } = renderer;
5986
6021
  let shadowMode;
5987
6022
  if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
@@ -7394,5 +7429,5 @@ function readonly(obj) {
7394
7429
  }
7395
7430
 
7396
7431
  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, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7397
- /** version: 6.1.0 */
7432
+ /** version: 6.1.1 */
7398
7433
  //# sourceMappingURL=index.js.map