@lwc/engine-core 9.0.2 → 9.0.4-alpha.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
@@ -3434,34 +3434,16 @@ function isValidScopeToken(token) {
3434
3434
  * SPDX-License-Identifier: MIT
3435
3435
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3436
3436
  */
3437
- const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
3438
- // In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
3439
- class LegacyWeakMultiMap {
3440
- constructor() {
3441
- this._map = new WeakMap();
3442
- }
3443
- _getValues(key) {
3444
- let values = this._map.get(key);
3445
- if (isUndefined$1(values)) {
3446
- values = new Set();
3447
- this._map.set(key, values);
3448
- }
3449
- return values;
3450
- }
3451
- get(key) {
3452
- return this._getValues(key);
3453
- }
3454
- add(key, vm) {
3455
- const set = this._getValues(key);
3456
- set.add(vm);
3457
- }
3458
- delete(key) {
3459
- this._map.delete(key);
3460
- }
3461
- }
3462
- // This implementation relies on the WeakRef/FinalizationRegistry proposal.
3463
- // For some background, see: https://github.com/tc39/proposal-weakrefs
3464
- class ModernWeakMultiMap {
3437
+ /**
3438
+ * A map where the keys are weakly held and the values are a Set that are also each weakly held.
3439
+ * The goal is to avoid leaking the values, which is what would happen with a WeakMap<K, Set<V>>.
3440
+ *
3441
+ * Note that this is currently only intended to be used in dev/PRODDEBUG environments.
3442
+ *
3443
+ * This implementation relies on WeakRefs and FinalizationRegistry.
3444
+ * For some background, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef
3445
+ */
3446
+ class WeakMultiMap {
3465
3447
  constructor() {
3466
3448
  this._map = new WeakMap();
3467
3449
  this._registry = new FinalizationRegistry((weakRefs) => {
@@ -3497,8 +3479,12 @@ class ModernWeakMultiMap {
3497
3479
  }
3498
3480
  add(key, value) {
3499
3481
  const weakRefs = this._getWeakRefs(key);
3500
- // We could check for duplicate values here, but it doesn't seem worth it.
3501
- // We transform the output into a Set anyway
3482
+ // Skip adding if already present
3483
+ for (const weakRef of weakRefs) {
3484
+ if (weakRef.deref() === value) {
3485
+ return;
3486
+ }
3487
+ }
3502
3488
  ArrayPush$1.call(weakRefs, new WeakRef(value));
3503
3489
  // It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
3504
3490
  // effectively creates a strong reference between the first argument (the "target") and the held value. When
@@ -3513,7 +3499,6 @@ class ModernWeakMultiMap {
3513
3499
  this._map.delete(key);
3514
3500
  }
3515
3501
  }
3516
- const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
3517
3502
 
3518
3503
  /*
3519
3504
  * Copyright (c) 2020, salesforce.com, inc.
@@ -5653,20 +5638,19 @@ function c(sel, Ctor, data, children = EmptyArray) {
5653
5638
  }
5654
5639
  }
5655
5640
  const { key, slotAssignment } = data;
5656
- let elm, aChildren, vm;
5657
5641
  const vnode = {
5658
5642
  type: 3 /* VNodeType.CustomElement */,
5659
5643
  sel,
5660
5644
  data,
5661
5645
  children,
5662
- elm,
5646
+ elm: undefined,
5663
5647
  key,
5664
5648
  slotAssignment,
5665
5649
  ctor: Ctor,
5666
5650
  owner: vmBeingRendered,
5667
5651
  mode: 'open', // TODO [#1294]: this should be defined in Ctor
5668
- aChildren,
5669
- vm,
5652
+ aChildren: undefined,
5653
+ vm: undefined,
5670
5654
  };
5671
5655
  addVNodeToChildLWC(vnode);
5672
5656
  return vnode;
@@ -5768,25 +5752,23 @@ function f(items) {
5768
5752
  }
5769
5753
  // [t]ext node
5770
5754
  function t(text) {
5771
- let key, elm;
5772
5755
  return {
5773
5756
  type: 0 /* VNodeType.Text */,
5774
5757
  sel: '__text__',
5775
5758
  text,
5776
- elm,
5777
- key,
5759
+ elm: undefined,
5760
+ key: undefined,
5778
5761
  owner: getVMBeingRendered(),
5779
5762
  };
5780
5763
  }
5781
5764
  // [co]mment node
5782
5765
  function co(text) {
5783
- let elm, key;
5784
5766
  return {
5785
5767
  type: 1 /* VNodeType.Comment */,
5786
5768
  sel: '__comment__',
5787
5769
  text,
5788
- elm,
5789
- key,
5770
+ elm: undefined,
5771
+ key: undefined,
5790
5772
  owner: getVMBeingRendered(),
5791
5773
  };
5792
5774
  }
@@ -8763,5 +8745,5 @@ function readonly(obj) {
8763
8745
  }
8764
8746
 
8765
8747
  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 };
8766
- /** version: 9.0.2 */
8748
+ /** version: 9.0.4-alpha.0 */
8767
8749
  //# 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": "9.0.2",
7
+ "version": "9.0.4-alpha.0",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -34,6 +34,7 @@
34
34
  "types": "dist/index.d.ts",
35
35
  "files": [
36
36
  "dist/**/*.js",
37
+ "dist/**/*.cjs",
37
38
  "dist/**/*.d.ts"
38
39
  ],
39
40
  "scripts": {
@@ -50,9 +51,9 @@
50
51
  }
51
52
  },
52
53
  "dependencies": {
53
- "@lwc/features": "9.0.2",
54
- "@lwc/shared": "9.0.2",
55
- "@lwc/signals": "9.0.2"
54
+ "@lwc/features": "9.0.4-alpha.0",
55
+ "@lwc/shared": "9.0.4-alpha.0",
56
+ "@lwc/signals": "9.0.4-alpha.0"
56
57
  },
57
58
  "devDependencies": {
58
59
  "observable-membrane": "2.0.0"