@lwc/engine-core 8.22.4 → 8.22.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
@@ -140,7 +140,7 @@ function addErrorComponentStack(vm, error) {
140
140
  */
141
141
  const alreadyLoggedMessages = new Set();
142
142
  // Only used in LWC's Karma tests
143
- if (process.env.NODE_ENV === 'test-karma-lwc') {
143
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
144
144
  window.__lwcResetAlreadyLoggedMessages = () => {
145
145
  alreadyLoggedMessages.clear();
146
146
  };
@@ -332,7 +332,7 @@ function logMutation(reactiveObserver, target, key) {
332
332
  // because the unit tests just create Reactive Observers on-the-fly.
333
333
  // Note we could explicitly target Vitest with `process.env.NODE_ENV === 'test'`, but then that would also
334
334
  // affect our downstream consumers' Jest/Vitest tests, and we don't want to throw an error just for a logger.
335
- if (process.env.NODE_ENV === 'test-karma-lwc') {
335
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
336
336
  throw new Error('The VM should always be defined except possibly in unit tests');
337
337
  }
338
338
  }
@@ -2826,7 +2826,7 @@ function getDecoratorsMeta(Ctor) {
2826
2826
  */
2827
2827
  let warned = false;
2828
2828
  // Only used in LWC's Karma tests
2829
- if (process.env.NODE_ENV === 'test-karma-lwc') {
2829
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
2830
2830
  window.__lwcResetWarnedOnVersionMismatch = () => {
2831
2831
  warned = false;
2832
2832
  };
@@ -3107,7 +3107,7 @@ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
3107
3107
  let stylesheetsToCssContent = /*@__PURE__@*/ new WeakMap();
3108
3108
  let cssContentToAbortControllers = /*@__PURE__@*/ new Map();
3109
3109
  // Only used in LWC's Karma tests
3110
- if (process.env.NODE_ENV === 'test-karma-lwc') {
3110
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
3111
3111
  // Used to reset the global state between test runs
3112
3112
  window.__lwcResetStylesheetCache = () => {
3113
3113
  stylesheetsToCssContent = new WeakMap();
@@ -3509,7 +3509,7 @@ let activeComponents =
3509
3509
  /*@__PURE__@*/ new WeakMultiMap();
3510
3510
  let activeStyles = /*@__PURE__@*/ new WeakMultiMap();
3511
3511
  // Only used in LWC's Karma tests
3512
- if (process.env.NODE_ENV === 'test-karma-lwc') {
3512
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
3513
3513
  // Used to reset the global state between test runs
3514
3514
  window.__lwcResetHotSwaps = () => {
3515
3515
  swappedTemplateMap = new WeakMap();
@@ -6189,7 +6189,7 @@ const MAX_CACHE_KEY = 3;
6189
6189
  // Also note that this array only needs to be large enough to account for the maximum possible cache key
6190
6190
  const fragmentCache = shared.ArrayFrom({ length: MAX_CACHE_KEY + 1 }, () => new WeakMap());
6191
6191
  // Only used in LWC's Karma tests
6192
- if (process.env.NODE_ENV === 'test-karma-lwc') {
6192
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
6193
6193
  window.__lwcResetFragmentCache = () => {
6194
6194
  for (let i = 0; i < fragmentCache.length; i++) {
6195
6195
  fragmentCache[i] = new WeakMap();
@@ -6833,42 +6833,72 @@ class ContextBinding {
6833
6833
  }
6834
6834
  _ContextBinding_renderer = new WeakMap(), _ContextBinding_providedContextVarieties = new WeakMap(), _ContextBinding_elm = new WeakMap();
6835
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) {
6836
6868
  const contextKeys = shared.getContextKeys();
6837
6869
  if (shared.isUndefined(contextKeys)) {
6838
6870
  return;
6839
6871
  }
6840
6872
  const { connectContext } = contextKeys;
6841
6873
  const { component } = vm;
6842
- const enumerableKeys = shared.keys(shared.getPrototypeOf(component));
6843
- const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(component[enumerableKey]));
6874
+ const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(contextContainer[enumerableKey]));
6844
6875
  if (contextfulKeys.length === 0) {
6845
6876
  return;
6846
6877
  }
6847
6878
  const providedContextVarieties = new Map();
6848
6879
  try {
6849
6880
  for (let i = 0; i < contextfulKeys.length; i++) {
6850
- component[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6881
+ contextContainer[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6851
6882
  }
6852
6883
  }
6853
6884
  catch (err) {
6854
6885
  logWarnOnce(`Attempted to connect to trusted context but received the following error: ${err.message}`);
6855
6886
  }
6856
6887
  }
6857
- function disconnectContext(vm) {
6888
+ function disconnect(vm, enumerableKeys, contextContainer) {
6858
6889
  const contextKeys = shared.getContextKeys();
6859
6890
  if (!contextKeys) {
6860
6891
  return;
6861
6892
  }
6862
6893
  const { disconnectContext } = contextKeys;
6863
6894
  const { component } = vm;
6864
- const enumerableKeys = shared.keys(shared.getPrototypeOf(component));
6865
- const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(component[enumerableKey]));
6895
+ const contextfulKeys = shared.ArrayFilter.call(enumerableKeys, (enumerableKey) => shared.isTrustedContext(contextContainer[enumerableKey]));
6866
6896
  if (contextfulKeys.length === 0) {
6867
6897
  return;
6868
6898
  }
6869
6899
  try {
6870
6900
  for (let i = 0; i < contextfulKeys.length; i++) {
6871
- component[contextfulKeys[i]][disconnectContext](component);
6901
+ contextContainer[contextfulKeys[i]][disconnectContext](component);
6872
6902
  }
6873
6903
  }
6874
6904
  catch (err) {
@@ -7107,7 +7137,7 @@ function computeShadowMode(def, owner, renderer, hydrated) {
7107
7137
  if (
7108
7138
  // Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
7109
7139
  // on, but components running in actual native shadow mode
7110
- (process.env.NODE_ENV === 'test-karma-lwc' &&
7140
+ (process.env.NODE_ENV === 'test-lwc-integration' &&
7111
7141
  process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST) ||
7112
7142
  // If synthetic shadow is explicitly disabled, use pure-native
7113
7143
  lwcRuntimeFlags.DISABLE_SYNTHETIC_SHADOW ||
@@ -8759,5 +8789,5 @@ exports.swapTemplate = swapTemplate;
8759
8789
  exports.track = track;
8760
8790
  exports.unwrap = unwrap;
8761
8791
  exports.wire = wire;
8762
- /** version: 8.22.4 */
8792
+ /** version: 8.22.6 */
8763
8793
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -137,7 +137,7 @@ function addErrorComponentStack(vm, error) {
137
137
  */
138
138
  const alreadyLoggedMessages = new Set();
139
139
  // Only used in LWC's Karma tests
140
- if (process.env.NODE_ENV === 'test-karma-lwc') {
140
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
141
141
  window.__lwcResetAlreadyLoggedMessages = () => {
142
142
  alreadyLoggedMessages.clear();
143
143
  };
@@ -329,7 +329,7 @@ function logMutation(reactiveObserver, target, key) {
329
329
  // because the unit tests just create Reactive Observers on-the-fly.
330
330
  // Note we could explicitly target Vitest with `process.env.NODE_ENV === 'test'`, but then that would also
331
331
  // affect our downstream consumers' Jest/Vitest tests, and we don't want to throw an error just for a logger.
332
- if (process.env.NODE_ENV === 'test-karma-lwc') {
332
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
333
333
  throw new Error('The VM should always be defined except possibly in unit tests');
334
334
  }
335
335
  }
@@ -2823,7 +2823,7 @@ function getDecoratorsMeta(Ctor) {
2823
2823
  */
2824
2824
  let warned = false;
2825
2825
  // Only used in LWC's Karma tests
2826
- if (process.env.NODE_ENV === 'test-karma-lwc') {
2826
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
2827
2827
  window.__lwcResetWarnedOnVersionMismatch = () => {
2828
2828
  warned = false;
2829
2829
  };
@@ -3104,7 +3104,7 @@ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
3104
3104
  let stylesheetsToCssContent = /*@__PURE__@*/ new WeakMap();
3105
3105
  let cssContentToAbortControllers = /*@__PURE__@*/ new Map();
3106
3106
  // Only used in LWC's Karma tests
3107
- if (process.env.NODE_ENV === 'test-karma-lwc') {
3107
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
3108
3108
  // Used to reset the global state between test runs
3109
3109
  window.__lwcResetStylesheetCache = () => {
3110
3110
  stylesheetsToCssContent = new WeakMap();
@@ -3506,7 +3506,7 @@ let activeComponents =
3506
3506
  /*@__PURE__@*/ new WeakMultiMap();
3507
3507
  let activeStyles = /*@__PURE__@*/ new WeakMultiMap();
3508
3508
  // Only used in LWC's Karma tests
3509
- if (process.env.NODE_ENV === 'test-karma-lwc') {
3509
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
3510
3510
  // Used to reset the global state between test runs
3511
3511
  window.__lwcResetHotSwaps = () => {
3512
3512
  swappedTemplateMap = new WeakMap();
@@ -6186,7 +6186,7 @@ const MAX_CACHE_KEY = 3;
6186
6186
  // Also note that this array only needs to be large enough to account for the maximum possible cache key
6187
6187
  const fragmentCache = ArrayFrom({ length: MAX_CACHE_KEY + 1 }, () => new WeakMap());
6188
6188
  // Only used in LWC's Karma tests
6189
- if (process.env.NODE_ENV === 'test-karma-lwc') {
6189
+ if (process.env.NODE_ENV === 'test-lwc-integration') {
6190
6190
  window.__lwcResetFragmentCache = () => {
6191
6191
  for (let i = 0; i < fragmentCache.length; i++) {
6192
6192
  fragmentCache[i] = new WeakMap();
@@ -6830,42 +6830,72 @@ class ContextBinding {
6830
6830
  }
6831
6831
  _ContextBinding_renderer = new WeakMap(), _ContextBinding_providedContextVarieties = new WeakMap(), _ContextBinding_elm = new WeakMap();
6832
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) {
6833
6865
  const contextKeys = getContextKeys();
6834
6866
  if (isUndefined$1(contextKeys)) {
6835
6867
  return;
6836
6868
  }
6837
6869
  const { connectContext } = contextKeys;
6838
6870
  const { component } = vm;
6839
- const enumerableKeys = keys(getPrototypeOf$1(component));
6840
- const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(component[enumerableKey]));
6871
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(contextContainer[enumerableKey]));
6841
6872
  if (contextfulKeys.length === 0) {
6842
6873
  return;
6843
6874
  }
6844
6875
  const providedContextVarieties = new Map();
6845
6876
  try {
6846
6877
  for (let i = 0; i < contextfulKeys.length; i++) {
6847
- component[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6878
+ contextContainer[contextfulKeys[i]][connectContext](new ContextBinding(vm, component, providedContextVarieties));
6848
6879
  }
6849
6880
  }
6850
6881
  catch (err) {
6851
6882
  logWarnOnce(`Attempted to connect to trusted context but received the following error: ${err.message}`);
6852
6883
  }
6853
6884
  }
6854
- function disconnectContext(vm) {
6885
+ function disconnect(vm, enumerableKeys, contextContainer) {
6855
6886
  const contextKeys = getContextKeys();
6856
6887
  if (!contextKeys) {
6857
6888
  return;
6858
6889
  }
6859
6890
  const { disconnectContext } = contextKeys;
6860
6891
  const { component } = vm;
6861
- const enumerableKeys = keys(getPrototypeOf$1(component));
6862
- const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(component[enumerableKey]));
6892
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(contextContainer[enumerableKey]));
6863
6893
  if (contextfulKeys.length === 0) {
6864
6894
  return;
6865
6895
  }
6866
6896
  try {
6867
6897
  for (let i = 0; i < contextfulKeys.length; i++) {
6868
- component[contextfulKeys[i]][disconnectContext](component);
6898
+ contextContainer[contextfulKeys[i]][disconnectContext](component);
6869
6899
  }
6870
6900
  }
6871
6901
  catch (err) {
@@ -7104,7 +7134,7 @@ function computeShadowMode(def, owner, renderer, hydrated) {
7104
7134
  if (
7105
7135
  // Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
7106
7136
  // on, but components running in actual native shadow mode
7107
- (process.env.NODE_ENV === 'test-karma-lwc' &&
7137
+ (process.env.NODE_ENV === 'test-lwc-integration' &&
7108
7138
  process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST) ||
7109
7139
  // If synthetic shadow is explicitly disabled, use pure-native
7110
7140
  lwcRuntimeFlags.DISABLE_SYNTHETIC_SHADOW ||
@@ -8685,5 +8715,5 @@ function readonly(obj) {
8685
8715
  }
8686
8716
 
8687
8717
  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 };
8688
- /** version: 8.22.4 */
8718
+ /** version: 8.22.6 */
8689
8719
  //# 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.22.4",
7
+ "version": "8.22.6",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,9 +46,9 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/features": "8.22.4",
50
- "@lwc/shared": "8.22.4",
51
- "@lwc/signals": "8.22.4"
49
+ "@lwc/features": "8.22.6",
50
+ "@lwc/shared": "8.22.6",
51
+ "@lwc/signals": "8.22.6"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"