@lwc/engine-core 9.0.3 → 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/framework/weak-multimap.d.ts +4 -16
- package/dist/index.cjs +24 -42
- package/dist/index.js +24 -42
- package/package.json +4 -4
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
* The goal is to avoid leaking the values, which is what would happen with a WeakMap<K, Set<V>>.
|
|
4
4
|
*
|
|
5
5
|
* Note that this is currently only intended to be used in dev/PRODDEBUG environments.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* This implementation relies on WeakRefs and FinalizationRegistry.
|
|
8
|
+
* For some background, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef
|
|
7
9
|
*/
|
|
8
|
-
export
|
|
9
|
-
get(key: T): ReadonlySet<V>;
|
|
10
|
-
add(key: T, vm: V): void;
|
|
11
|
-
delete(key: T): void;
|
|
12
|
-
}
|
|
13
|
-
declare class LegacyWeakMultiMap<K extends object, V extends object> implements WeakMultiMap<K, V> {
|
|
14
|
-
private _map;
|
|
15
|
-
private _getValues;
|
|
16
|
-
get(key: K): ReadonlySet<V>;
|
|
17
|
-
add(key: K, vm: V): void;
|
|
18
|
-
delete(key: K): void;
|
|
19
|
-
}
|
|
20
|
-
declare class ModernWeakMultiMap<K extends object, V extends object> implements WeakMultiMap<K, V> {
|
|
10
|
+
export declare class WeakMultiMap<K extends object, V extends object> {
|
|
21
11
|
private _map;
|
|
22
12
|
private _registry;
|
|
23
13
|
private _getWeakRefs;
|
|
@@ -25,6 +15,4 @@ declare class ModernWeakMultiMap<K extends object, V extends object> implements
|
|
|
25
15
|
add(key: K, value: V): void;
|
|
26
16
|
delete(key: K): void;
|
|
27
17
|
}
|
|
28
|
-
export declare const WeakMultiMap: typeof LegacyWeakMultiMap | typeof ModernWeakMultiMap;
|
|
29
|
-
export {};
|
|
30
18
|
//# sourceMappingURL=weak-multimap.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -3437,34 +3437,16 @@ function isValidScopeToken(token) {
|
|
|
3437
3437
|
* SPDX-License-Identifier: MIT
|
|
3438
3438
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3439
3439
|
*/
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
this._map.set(key, values);
|
|
3451
|
-
}
|
|
3452
|
-
return values;
|
|
3453
|
-
}
|
|
3454
|
-
get(key) {
|
|
3455
|
-
return this._getValues(key);
|
|
3456
|
-
}
|
|
3457
|
-
add(key, vm) {
|
|
3458
|
-
const set = this._getValues(key);
|
|
3459
|
-
set.add(vm);
|
|
3460
|
-
}
|
|
3461
|
-
delete(key) {
|
|
3462
|
-
this._map.delete(key);
|
|
3463
|
-
}
|
|
3464
|
-
}
|
|
3465
|
-
// This implementation relies on the WeakRef/FinalizationRegistry proposal.
|
|
3466
|
-
// For some background, see: https://github.com/tc39/proposal-weakrefs
|
|
3467
|
-
class ModernWeakMultiMap {
|
|
3440
|
+
/**
|
|
3441
|
+
* A map where the keys are weakly held and the values are a Set that are also each weakly held.
|
|
3442
|
+
* The goal is to avoid leaking the values, which is what would happen with a WeakMap<K, Set<V>>.
|
|
3443
|
+
*
|
|
3444
|
+
* Note that this is currently only intended to be used in dev/PRODDEBUG environments.
|
|
3445
|
+
*
|
|
3446
|
+
* This implementation relies on WeakRefs and FinalizationRegistry.
|
|
3447
|
+
* For some background, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef
|
|
3448
|
+
*/
|
|
3449
|
+
class WeakMultiMap {
|
|
3468
3450
|
constructor() {
|
|
3469
3451
|
this._map = new WeakMap();
|
|
3470
3452
|
this._registry = new FinalizationRegistry((weakRefs) => {
|
|
@@ -3500,8 +3482,12 @@ class ModernWeakMultiMap {
|
|
|
3500
3482
|
}
|
|
3501
3483
|
add(key, value) {
|
|
3502
3484
|
const weakRefs = this._getWeakRefs(key);
|
|
3503
|
-
//
|
|
3504
|
-
|
|
3485
|
+
// Skip adding if already present
|
|
3486
|
+
for (const weakRef of weakRefs) {
|
|
3487
|
+
if (weakRef.deref() === value) {
|
|
3488
|
+
return;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3505
3491
|
shared.ArrayPush.call(weakRefs, new WeakRef(value));
|
|
3506
3492
|
// It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
|
|
3507
3493
|
// effectively creates a strong reference between the first argument (the "target") and the held value. When
|
|
@@ -3516,7 +3502,6 @@ class ModernWeakMultiMap {
|
|
|
3516
3502
|
this._map.delete(key);
|
|
3517
3503
|
}
|
|
3518
3504
|
}
|
|
3519
|
-
const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
|
|
3520
3505
|
|
|
3521
3506
|
/*
|
|
3522
3507
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -5656,20 +5641,19 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
5656
5641
|
}
|
|
5657
5642
|
}
|
|
5658
5643
|
const { key, slotAssignment } = data;
|
|
5659
|
-
let elm, aChildren, vm;
|
|
5660
5644
|
const vnode = {
|
|
5661
5645
|
type: 3 /* VNodeType.CustomElement */,
|
|
5662
5646
|
sel,
|
|
5663
5647
|
data,
|
|
5664
5648
|
children,
|
|
5665
|
-
elm,
|
|
5649
|
+
elm: undefined,
|
|
5666
5650
|
key,
|
|
5667
5651
|
slotAssignment,
|
|
5668
5652
|
ctor: Ctor,
|
|
5669
5653
|
owner: vmBeingRendered,
|
|
5670
5654
|
mode: 'open', // TODO [#1294]: this should be defined in Ctor
|
|
5671
|
-
aChildren,
|
|
5672
|
-
vm,
|
|
5655
|
+
aChildren: undefined,
|
|
5656
|
+
vm: undefined,
|
|
5673
5657
|
};
|
|
5674
5658
|
addVNodeToChildLWC(vnode);
|
|
5675
5659
|
return vnode;
|
|
@@ -5771,25 +5755,23 @@ function f(items) {
|
|
|
5771
5755
|
}
|
|
5772
5756
|
// [t]ext node
|
|
5773
5757
|
function t(text) {
|
|
5774
|
-
let key, elm;
|
|
5775
5758
|
return {
|
|
5776
5759
|
type: 0 /* VNodeType.Text */,
|
|
5777
5760
|
sel: '__text__',
|
|
5778
5761
|
text,
|
|
5779
|
-
elm,
|
|
5780
|
-
key,
|
|
5762
|
+
elm: undefined,
|
|
5763
|
+
key: undefined,
|
|
5781
5764
|
owner: getVMBeingRendered(),
|
|
5782
5765
|
};
|
|
5783
5766
|
}
|
|
5784
5767
|
// [co]mment node
|
|
5785
5768
|
function co(text) {
|
|
5786
|
-
let elm, key;
|
|
5787
5769
|
return {
|
|
5788
5770
|
type: 1 /* VNodeType.Comment */,
|
|
5789
5771
|
sel: '__comment__',
|
|
5790
5772
|
text,
|
|
5791
|
-
elm,
|
|
5792
|
-
key,
|
|
5773
|
+
elm: undefined,
|
|
5774
|
+
key: undefined,
|
|
5793
5775
|
owner: getVMBeingRendered(),
|
|
5794
5776
|
};
|
|
5795
5777
|
}
|
|
@@ -8837,5 +8819,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8837
8819
|
exports.track = track;
|
|
8838
8820
|
exports.unwrap = unwrap;
|
|
8839
8821
|
exports.wire = wire;
|
|
8840
|
-
/** version: 9.0.
|
|
8822
|
+
/** version: 9.0.4-alpha.0 */
|
|
8841
8823
|
//# sourceMappingURL=index.cjs.map
|
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
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
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
|
-
//
|
|
3501
|
-
|
|
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.
|
|
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.
|
|
7
|
+
"version": "9.0.4-alpha.0",
|
|
8
8
|
"description": "Core LWC engine APIs.",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"lwc"
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@lwc/features": "9.0.
|
|
55
|
-
"@lwc/shared": "9.0.
|
|
56
|
-
"@lwc/signals": "9.0.
|
|
54
|
+
"@lwc/features": "9.0.4-alpha.0",
|
|
55
|
+
"@lwc/shared": "9.0.4-alpha.0",
|
|
56
|
+
"@lwc/signals": "9.0.4-alpha.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"observable-membrane": "2.0.0"
|