@lwc/engine-core 8.20.4 → 8.20.6

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.cjs.js CHANGED
@@ -611,12 +611,23 @@ function componentValueObserved(vm, key, target = {}) {
611
611
  if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS &&
612
612
  shared.isObject(target) &&
613
613
  !shared.isNull(target) &&
614
- shared.isTrustedSignal(target) &&
615
614
  process.env.IS_BROWSER &&
616
615
  // Only subscribe if a template is being rendered by the engine
617
616
  tro.isObserving()) {
618
- // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
619
- subscribeToSignal(component, target, tro.notify.bind(tro));
617
+ /**
618
+ * The legacy validation behavior was that this check should only
619
+ * be performed for runtimes that have provided a trustedSignals set.
620
+ * However, this resulted in a bug as all object values were
621
+ * being considered signals in environments where the trustedSignals
622
+ * set had not been defined. The runtime flag has been added as a killswitch
623
+ * in case the fix needs to be reverted.
624
+ */
625
+ if (lwcRuntimeFlags.ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION
626
+ ? shared.legacyIsTrustedSignal(target)
627
+ : shared.isTrustedSignal(target)) {
628
+ // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
629
+ subscribeToSignal(component, target, tro.notify.bind(tro));
630
+ }
620
631
  }
621
632
  }
622
633
  function createReactiveObserver(callback) {
@@ -6822,42 +6833,72 @@ class ContextBinding {
6822
6833
  }
6823
6834
  _ContextBinding_renderer = new WeakMap(), _ContextBinding_providedContextVarieties = new WeakMap(), _ContextBinding_elm = new WeakMap();
6824
6835
  function connectContext(vm) {
6836
+ /**
6837
+ * If ENABLE_LEGACY_CONTEXT_CONNECTION is true, enumerates directly on the component
6838
+ * which can result in the component lifecycle observing properties that are not typically observed.
6839
+ * See PR #5536 for more information.
6840
+ */
6841
+ if (lwcRuntimeFlags.ENABLE_LEGACY_CONTEXT_CONNECTION) {
6842
+ connect(vm, shared.keys(shared.getPrototypeOf(vm.component)), vm.component);
6843
+ }
6844
+ else {
6845
+ // Non-decorated objects
6846
+ connect(vm, shared.keys(vm.cmpFields), vm.cmpFields);
6847
+ // Decorated objects like @api context
6848
+ connect(vm, shared.keys(vm.cmpProps), vm.cmpProps);
6849
+ }
6850
+ }
6851
+ function disconnectContext(vm) {
6852
+ /**
6853
+ * If ENABLE_LEGACY_CONTEXT_CONNECTION is true, enumerates directly on the component
6854
+ * which can result in the component lifecycle observing properties that are not typically observed.
6855
+ * See PR #5536 for more information.
6856
+ */
6857
+ if (lwcRuntimeFlags.ENABLE_LEGACY_CONTEXT_CONNECTION) {
6858
+ connect(vm, shared.keys(shared.getPrototypeOf(vm.component)), vm.component);
6859
+ }
6860
+ else {
6861
+ // Non-decorated objects
6862
+ disconnect(vm, shared.keys(vm.cmpFields), vm.cmpFields);
6863
+ // Decorated objects like @api context
6864
+ disconnect(vm, shared.keys(vm.cmpProps), vm.cmpProps);
6865
+ }
6866
+ }
6867
+ function connect(vm, enumerableKeys, contextContainer) {
6825
6868
  const contextKeys = shared.getContextKeys();
6826
6869
  if (shared.isUndefined(contextKeys)) {
6827
6870
  return;
6828
6871
  }
6829
6872
  const { connectContext } = contextKeys;
6830
6873
  const { component } = vm;
6831
- const enumerableKeys = shared.keys(shared.getPrototypeOf(component));
6832
- const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(component[enumerableKey]));
6874
+ const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(contextContainer[enumerableKey]));
6833
6875
  if (contextfulKeys.length === 0) {
6834
6876
  return;
6835
6877
  }
6836
6878
  const providedContextVarieties = new Map();
6837
6879
  try {
6838
6880
  for (let i = 0; i < contextfulKeys.length; i++) {
6839
- component[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6881
+ contextContainer[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6840
6882
  }
6841
6883
  }
6842
6884
  catch (err) {
6843
6885
  logWarnOnce(`Attempted to connect to trusted context but received the following error: ${err.message}`);
6844
6886
  }
6845
6887
  }
6846
- function disconnectContext(vm) {
6888
+ function disconnect(vm, enumerableKeys, contextContainer) {
6847
6889
  const contextKeys = shared.getContextKeys();
6848
6890
  if (!contextKeys) {
6849
6891
  return;
6850
6892
  }
6851
6893
  const { disconnectContext } = contextKeys;
6852
6894
  const { component } = vm;
6853
- const enumerableKeys = shared.keys(shared.getPrototypeOf(component));
6854
- const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(component[enumerableKey]));
6895
+ const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(contextContainer[enumerableKey]));
6855
6896
  if (contextfulKeys.length === 0) {
6856
6897
  return;
6857
6898
  }
6858
6899
  try {
6859
6900
  for (let i = 0; i < contextfulKeys.length; i++) {
6860
- component[contextfulKeys[i]][disconnectContext](component);
6901
+ contextContainer[contextfulKeys[i]][disconnectContext](component);
6861
6902
  }
6862
6903
  }
6863
6904
  catch (err) {
@@ -8741,5 +8782,5 @@ exports.swapTemplate = swapTemplate;
8741
8782
  exports.track = track;
8742
8783
  exports.unwrap = unwrap;
8743
8784
  exports.wire = wire;
8744
- /** version: 8.20.4 */
8785
+ /** version: 8.20.6 */
8745
8786
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2025 Salesforce, Inc.
3
3
  */
4
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, toString, isString, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, AriaAttrNameToPropNameMap, forEach, REFLECTIVE_GLOBAL_PROPERTY_SET, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, defineProperties, assign, freeze, assert, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, isTrue, KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, ArraySome, KEY__SHADOW_RESOLVER, normalizeClass, sanitizeHtmlContent, StringReplace, isNumber, ArraySort, ArrayFrom, StringCharAt, htmlEscape, LOWEST_API_VERSION, getContextKeys, isTrustedContext, ContextEventName, ArrayUnshift, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SHADOW_TOKEN, ID_REFERENCING_ATTRIBUTES_SET, StringSplit, arrayEvery, parseStyleText, 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, toString, isString, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, ArrayIndexOf, ArrayPop, isFalse, legacyIsTrustedSignal, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, AriaAttrNameToPropNameMap, forEach, REFLECTIVE_GLOBAL_PROPERTY_SET, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, defineProperties, assign, freeze, assert, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, isTrue, KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, ArraySome, KEY__SHADOW_RESOLVER, normalizeClass, sanitizeHtmlContent, StringReplace, isNumber, ArraySort, ArrayFrom, StringCharAt, htmlEscape, LOWEST_API_VERSION, getContextKeys, isTrustedContext, ContextEventName, ArrayUnshift, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SHADOW_TOKEN, ID_REFERENCING_ATTRIBUTES_SET, StringSplit, arrayEvery, parseStyleText, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
5
5
  export { addTrustedContext, isTrustedSignal, setContextKeys, setHooks, setTrustedContextSet, setTrustedSignalSet } from '@lwc/shared';
6
6
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
7
7
  export { SignalBaseClass } from '@lwc/signals';
@@ -608,12 +608,23 @@ function componentValueObserved(vm, key, target = {}) {
608
608
  if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS &&
609
609
  isObject(target) &&
610
610
  !isNull(target) &&
611
- isTrustedSignal(target) &&
612
611
  process.env.IS_BROWSER &&
613
612
  // Only subscribe if a template is being rendered by the engine
614
613
  tro.isObserving()) {
615
- // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
616
- subscribeToSignal(component, target, tro.notify.bind(tro));
614
+ /**
615
+ * The legacy validation behavior was that this check should only
616
+ * be performed for runtimes that have provided a trustedSignals set.
617
+ * However, this resulted in a bug as all object values were
618
+ * being considered signals in environments where the trustedSignals
619
+ * set had not been defined. The runtime flag has been added as a killswitch
620
+ * in case the fix needs to be reverted.
621
+ */
622
+ if (lwcRuntimeFlags.ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION
623
+ ? legacyIsTrustedSignal(target)
624
+ : isTrustedSignal(target)) {
625
+ // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
626
+ subscribeToSignal(component, target, tro.notify.bind(tro));
627
+ }
617
628
  }
618
629
  }
619
630
  function createReactiveObserver(callback) {
@@ -6819,42 +6830,72 @@ class ContextBinding {
6819
6830
  }
6820
6831
  _ContextBinding_renderer = new WeakMap(), _ContextBinding_providedContextVarieties = new WeakMap(), _ContextBinding_elm = new WeakMap();
6821
6832
  function connectContext(vm) {
6833
+ /**
6834
+ * If ENABLE_LEGACY_CONTEXT_CONNECTION is true, enumerates directly on the component
6835
+ * which can result in the component lifecycle observing properties that are not typically observed.
6836
+ * See PR #5536 for more information.
6837
+ */
6838
+ if (lwcRuntimeFlags.ENABLE_LEGACY_CONTEXT_CONNECTION) {
6839
+ connect(vm, keys(getPrototypeOf$1(vm.component)), vm.component);
6840
+ }
6841
+ else {
6842
+ // Non-decorated objects
6843
+ connect(vm, keys(vm.cmpFields), vm.cmpFields);
6844
+ // Decorated objects like @api context
6845
+ connect(vm, keys(vm.cmpProps), vm.cmpProps);
6846
+ }
6847
+ }
6848
+ function disconnectContext(vm) {
6849
+ /**
6850
+ * If ENABLE_LEGACY_CONTEXT_CONNECTION is true, enumerates directly on the component
6851
+ * which can result in the component lifecycle observing properties that are not typically observed.
6852
+ * See PR #5536 for more information.
6853
+ */
6854
+ if (lwcRuntimeFlags.ENABLE_LEGACY_CONTEXT_CONNECTION) {
6855
+ connect(vm, keys(getPrototypeOf$1(vm.component)), vm.component);
6856
+ }
6857
+ else {
6858
+ // Non-decorated objects
6859
+ disconnect(vm, keys(vm.cmpFields), vm.cmpFields);
6860
+ // Decorated objects like @api context
6861
+ disconnect(vm, keys(vm.cmpProps), vm.cmpProps);
6862
+ }
6863
+ }
6864
+ function connect(vm, enumerableKeys, contextContainer) {
6822
6865
  const contextKeys = getContextKeys();
6823
6866
  if (isUndefined$1(contextKeys)) {
6824
6867
  return;
6825
6868
  }
6826
6869
  const { connectContext } = contextKeys;
6827
6870
  const { component } = vm;
6828
- const enumerableKeys = keys(getPrototypeOf$1(component));
6829
- const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(component[enumerableKey]));
6871
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(contextContainer[enumerableKey]));
6830
6872
  if (contextfulKeys.length === 0) {
6831
6873
  return;
6832
6874
  }
6833
6875
  const providedContextVarieties = new Map();
6834
6876
  try {
6835
6877
  for (let i = 0; i < contextfulKeys.length; i++) {
6836
- component[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6878
+ contextContainer[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6837
6879
  }
6838
6880
  }
6839
6881
  catch (err) {
6840
6882
  logWarnOnce(`Attempted to connect to trusted context but received the following error: ${err.message}`);
6841
6883
  }
6842
6884
  }
6843
- function disconnectContext(vm) {
6885
+ function disconnect(vm, enumerableKeys, contextContainer) {
6844
6886
  const contextKeys = getContextKeys();
6845
6887
  if (!contextKeys) {
6846
6888
  return;
6847
6889
  }
6848
6890
  const { disconnectContext } = contextKeys;
6849
6891
  const { component } = vm;
6850
- const enumerableKeys = keys(getPrototypeOf$1(component));
6851
- const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(component[enumerableKey]));
6892
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(contextContainer[enumerableKey]));
6852
6893
  if (contextfulKeys.length === 0) {
6853
6894
  return;
6854
6895
  }
6855
6896
  try {
6856
6897
  for (let i = 0; i < contextfulKeys.length; i++) {
6857
- component[contextfulKeys[i]][disconnectContext](component);
6898
+ contextContainer[contextfulKeys[i]][disconnectContext](component);
6858
6899
  }
6859
6900
  }
6860
6901
  catch (err) {
@@ -8667,5 +8708,5 @@ function readonly(obj) {
8667
8708
  }
8668
8709
 
8669
8710
  export { BaseBridgeElement, 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, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8670
- /** version: 8.20.4 */
8711
+ /** version: 8.20.6 */
8671
8712
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/engine-core",
7
- "version": "8.20.4",
7
+ "version": "8.20.6",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,11 +46,11 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/features": "8.20.4",
50
- "@lwc/shared": "8.20.4",
51
- "@lwc/signals": "8.20.4"
49
+ "@lwc/features": "8.20.6",
50
+ "@lwc/shared": "8.20.6",
51
+ "@lwc/signals": "8.20.6"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"
55
55
  }
56
- }
56
+ }