@lwc/engine-core 6.2.1 → 6.3.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
@@ -128,7 +128,7 @@ function addErrorComponentStack(vm, error) {
128
128
  }
129
129
 
130
130
  /*
131
- * Copyright (c) 2018, salesforce.com, inc.
131
+ * Copyright (c) 2024, Salesforce, Inc.
132
132
  * All rights reserved.
133
133
  * SPDX-License-Identifier: MIT
134
134
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -136,7 +136,6 @@ function addErrorComponentStack(vm, error) {
136
136
  const alreadyLoggedMessages = new Set();
137
137
  // Only used in LWC's Karma tests
138
138
  if (process.env.NODE_ENV === 'test-karma-lwc') {
139
- // @ts-ignore
140
139
  window.__lwcResetAlreadyLoggedMessages = () => {
141
140
  alreadyLoggedMessages.clear();
142
141
  };
@@ -794,7 +793,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
794
793
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
795
794
  }
796
795
  // Typescript does not like it when you treat the `arguments` object as an array
797
- // @ts-ignore type-mismatch
796
+ // @ts-expect-error type-mismatch
798
797
  return originalAddEventListener.apply(this, arguments);
799
798
  },
800
799
  }),
@@ -843,7 +842,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
843
842
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
844
843
  }
845
844
  // Typescript does not like it when you treat the `arguments` object as an array
846
- // @ts-ignore type-mismatch
845
+ // @ts-expect-error type-mismatch
847
846
  return originalAddEventListener.apply(this, arguments);
848
847
  },
849
848
  }),
@@ -1595,7 +1594,7 @@ const refsCache = new WeakMap();
1595
1594
  * This class is the base class for any LWC element.
1596
1595
  * Some elements directly extends this class, others implement it via inheritance.
1597
1596
  */
1598
- // @ts-ignore
1597
+ // @ts-expect-error When exported, it will conform, but we need to build it first!
1599
1598
  const LightningElement = function () {
1600
1599
  // This should be as performant as possible, while any initialization should be done lazily
1601
1600
  if (isNull(vmBeingConstructed)) {
@@ -1737,7 +1736,7 @@ function createElementInternalsProxy(elementInternals, isFormAssociated) {
1737
1736
  });
1738
1737
  return elementInternalsProxy;
1739
1738
  }
1740
- // @ts-ignore
1739
+ // Type assertion because we need to build the prototype before it satisfies the interface.
1741
1740
  LightningElement.prototype = {
1742
1741
  constructor: LightningElement,
1743
1742
  dispatchEvent(event) {
@@ -1939,6 +1938,9 @@ LightningElement.prototype = {
1939
1938
  if (process.env.NODE_ENV !== 'production') {
1940
1939
  warnIfInvokedDuringConstruction(vm, 'childNodes');
1941
1940
  }
1941
+ // getChildNodes returns a NodeList, which has `item(index: number): Node | null`.
1942
+ // NodeListOf<T> extends NodeList, but claims to not return null. That seems inaccurate,
1943
+ // but these are built-in types, so ultimately not our problem.
1942
1944
  return renderer.getChildNodes(vm.elm);
1943
1945
  },
1944
1946
  get firstChild() {
@@ -2178,7 +2180,7 @@ function createConfigWatcher(component, configCallback, callbackWhenConfigIsRead
2178
2180
  ro.observe(() => (config = configCallback(component)));
2179
2181
  // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
2180
2182
  // TODO: dev-mode validation of config based on the adapter.configSchema
2181
- // @ts-ignore it is assigned in the observe() callback
2183
+ // @ts-expect-error it is assigned in the observe() callback
2182
2184
  callbackWhenConfigIsReady(config);
2183
2185
  };
2184
2186
  return {
@@ -2254,7 +2256,7 @@ function createConnector(vm, name, wireDef) {
2254
2256
  });
2255
2257
  }
2256
2258
  return {
2257
- // @ts-ignore the boundary protection executes sync, connector is always defined
2259
+ // @ts-expect-error the boundary protection executes sync, connector is always defined
2258
2260
  connector,
2259
2261
  computeConfigAndUpdate,
2260
2262
  resetConfigWatcher: () => ro.reset(),
@@ -2733,7 +2735,6 @@ function getDecoratorsMeta(Ctor) {
2733
2735
  let warned = false;
2734
2736
  // Only used in LWC's Karma tests
2735
2737
  if (process.env.NODE_ENV === 'test-karma-lwc') {
2736
- // @ts-ignore
2737
2738
  window.__lwcResetWarnedOnVersionMismatch = () => {
2738
2739
  warned = false;
2739
2740
  };
@@ -2851,7 +2852,7 @@ function createAttributeChangedCallback(attributeToPropMap, superAttributeChange
2851
2852
  if (!isUndefined$1(superAttributeChangedCallback)) {
2852
2853
  // delegate unknown attributes to the super.
2853
2854
  // Typescript does not like it when you treat the `arguments` object as an array
2854
- // @ts-ignore type-mismatch
2855
+ // @ts-expect-error type-mismatch
2855
2856
  superAttributeChangedCallback.apply(this, arguments);
2856
2857
  }
2857
2858
  return;
@@ -5604,9 +5605,27 @@ function validateLightDomTemplate(template, vm) {
5604
5605
  }
5605
5606
  }
5606
5607
  }
5608
+ // This should be a no-op outside of LWC's Karma tests, where it's not needed
5609
+ let registerFragmentCache = noop;
5610
+ // Only used in LWC's Karma tests
5611
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
5612
+ // Keep track of fragmentCaches, so we can clear them in LWC's Karma tests
5613
+ const fragmentCaches = [];
5614
+ registerFragmentCache = (fragmentCache) => {
5615
+ fragmentCaches.push(fragmentCache);
5616
+ };
5617
+ window.__lwcResetFragmentCaches = () => {
5618
+ for (const fragmentCache of fragmentCaches) {
5619
+ for (const key of keys(fragmentCache)) {
5620
+ delete fragmentCache[key];
5621
+ }
5622
+ }
5623
+ };
5624
+ }
5607
5625
  function buildParseFragmentFn(createFragmentFn) {
5608
5626
  return (strings, ...keys) => {
5609
5627
  const cache = create(null);
5628
+ registerFragmentCache(cache);
5610
5629
  return function () {
5611
5630
  const { context: { hasScopedStyles, stylesheetToken, legacyStylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
5612
5631
  const hasStyleToken = !isUndefined$1(stylesheetToken);
@@ -5619,11 +5638,6 @@ function buildParseFragmentFn(createFragmentFn) {
5619
5638
  if (hasStyleToken && isSyntheticShadow) {
5620
5639
  cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
5621
5640
  }
5622
- if (hasLegacyToken) {
5623
- // This isn't strictly required for prod, but it's required for our karma tests
5624
- // since the lwcRuntimeFlag may change over time
5625
- cacheKey |= 4 /* FragmentCache.HAS_LEGACY_SCOPE_TOKEN */;
5626
- }
5627
5641
  if (!isUndefined$1(cache[cacheKey])) {
5628
5642
  return cache[cacheKey];
5629
5643
  }
@@ -6813,7 +6827,6 @@ function enableDetection() {
6813
6827
  throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6814
6828
  }
6815
6829
  }
6816
- // @ts-ignore
6817
6830
  const { get, set } = descriptor;
6818
6831
  // It's important for this defineProperty call to happen _after_ ARIA accessors are applied to the
6819
6832
  // BaseBridgeElement and LightningElement prototypes. Otherwise, we will log/report for access of non-standard
@@ -7424,7 +7437,7 @@ function warnOnArrayMutation(stylesheets) {
7424
7437
  const originalArrayMethod = getOriginalArrayMethod(prop);
7425
7438
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7426
7439
  reportTemplateViolation('stylesheets');
7427
- // @ts-ignore
7440
+ // @ts-expect-error can't properly determine the right `this`
7428
7441
  return originalArrayMethod.apply(this, arguments);
7429
7442
  };
7430
7443
  }
@@ -7610,5 +7623,5 @@ function readonly(obj) {
7610
7623
  }
7611
7624
 
7612
7625
  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 };
7613
- /** version: 6.2.1 */
7626
+ /** version: 6.3.0 */
7614
7627
  //# sourceMappingURL=index.js.map