@lwc/engine-core 2.35.0 → 2.35.2
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/engine-core.cjs.js +31 -74
- package/dist/engine-core.js +32 -75
- package/package.json +4 -4
- package/types/framework/utils.d.ts +1 -0
- package/types/framework/vm.d.ts +0 -2
package/dist/engine-core.cjs.js
CHANGED
|
@@ -12,8 +12,7 @@ var ariaReflection = require('@lwc/aria-reflection');
|
|
|
12
12
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
13
13
|
*/
|
|
14
14
|
// Only used in LWC's Karma tests
|
|
15
|
-
|
|
16
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
15
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
17
16
|
window.addEventListener('test-dummy-flag', () => {
|
|
18
17
|
let hasFlag = false;
|
|
19
18
|
if (features.lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
@@ -154,8 +153,8 @@ function addErrorComponentStack(vm, error) {
|
|
|
154
153
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
155
154
|
*/
|
|
156
155
|
const alreadyLoggedMessages = new Set();
|
|
157
|
-
//
|
|
158
|
-
if (process.env.NODE_ENV
|
|
156
|
+
// Only used in LWC's Karma tests
|
|
157
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
159
158
|
// @ts-ignore
|
|
160
159
|
window.__lwcResetAlreadyLoggedMessages = () => {
|
|
161
160
|
alreadyLoggedMessages.clear();
|
|
@@ -418,6 +417,14 @@ function setRefVNode(vm, ref, vnode) {
|
|
|
418
417
|
refVNodes[ref] = vnode;
|
|
419
418
|
}
|
|
420
419
|
}
|
|
420
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
421
|
+
function assertNotProd() {
|
|
422
|
+
/* istanbul ignore if */
|
|
423
|
+
if (process.env.NODE_ENV === 'production') {
|
|
424
|
+
// this method should never leak to prod
|
|
425
|
+
throw new ReferenceError();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
421
428
|
|
|
422
429
|
/*
|
|
423
430
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -623,27 +630,18 @@ function generateAccessorDescriptor(options) {
|
|
|
623
630
|
}
|
|
624
631
|
let isDomMutationAllowed = false;
|
|
625
632
|
function unlockDomMutation() {
|
|
626
|
-
|
|
627
|
-
// this method should never leak to prod
|
|
628
|
-
throw new ReferenceError();
|
|
629
|
-
}
|
|
633
|
+
assertNotProd(); // this method should never leak to prod
|
|
630
634
|
isDomMutationAllowed = true;
|
|
631
635
|
}
|
|
632
636
|
function lockDomMutation() {
|
|
633
|
-
|
|
634
|
-
// this method should never leak to prod
|
|
635
|
-
throw new ReferenceError();
|
|
636
|
-
}
|
|
637
|
+
assertNotProd(); // this method should never leak to prod
|
|
637
638
|
isDomMutationAllowed = false;
|
|
638
639
|
}
|
|
639
640
|
function logMissingPortalError(name, type) {
|
|
640
641
|
return logError(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
|
|
641
642
|
}
|
|
642
643
|
function patchElementWithRestrictions(elm, options) {
|
|
643
|
-
|
|
644
|
-
// this method should never leak to prod
|
|
645
|
-
throw new ReferenceError();
|
|
646
|
-
}
|
|
644
|
+
assertNotProd(); // this method should never leak to prod
|
|
647
645
|
const originalOuterHTMLDescriptor = shared.getPropertyDescriptor(elm, 'outerHTML');
|
|
648
646
|
const descriptors = {
|
|
649
647
|
outerHTML: generateAccessorDescriptor({
|
|
@@ -724,10 +722,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
724
722
|
shared.defineProperties(elm, descriptors);
|
|
725
723
|
}
|
|
726
724
|
function getShadowRootRestrictionsDescriptors(sr) {
|
|
727
|
-
|
|
728
|
-
// this method should never leak to prod
|
|
729
|
-
throw new ReferenceError();
|
|
730
|
-
}
|
|
725
|
+
assertNotProd(); // this method should never leak to prod
|
|
731
726
|
// Disallowing properties in dev mode only to avoid people doing the wrong
|
|
732
727
|
// thing when using the real shadow root, because if that's the case,
|
|
733
728
|
// the component will not work when running with synthetic shadow.
|
|
@@ -768,10 +763,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
768
763
|
// Custom Elements Restrictions:
|
|
769
764
|
// -----------------------------
|
|
770
765
|
function getCustomElementRestrictionsDescriptors(elm) {
|
|
771
|
-
|
|
772
|
-
// this method should never leak to prod
|
|
773
|
-
throw new ReferenceError();
|
|
774
|
-
}
|
|
766
|
+
assertNotProd(); // this method should never leak to prod
|
|
775
767
|
const originalAddEventListener = elm.addEventListener;
|
|
776
768
|
const originalInnerHTMLDescriptor = shared.getPropertyDescriptor(elm, 'innerHTML');
|
|
777
769
|
const originalOuterHTMLDescriptor = shared.getPropertyDescriptor(elm, 'outerHTML');
|
|
@@ -816,10 +808,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
816
808
|
};
|
|
817
809
|
}
|
|
818
810
|
function getComponentRestrictionsDescriptors() {
|
|
819
|
-
|
|
820
|
-
// this method should never leak to prod
|
|
821
|
-
throw new ReferenceError();
|
|
822
|
-
}
|
|
811
|
+
assertNotProd(); // this method should never leak to prod
|
|
823
812
|
return {
|
|
824
813
|
tagName: generateAccessorDescriptor({
|
|
825
814
|
get() {
|
|
@@ -833,10 +822,7 @@ function getComponentRestrictionsDescriptors() {
|
|
|
833
822
|
};
|
|
834
823
|
}
|
|
835
824
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
836
|
-
|
|
837
|
-
// this method should never leak to prod
|
|
838
|
-
throw new ReferenceError();
|
|
839
|
-
}
|
|
825
|
+
assertNotProd(); // this method should never leak to prod
|
|
840
826
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
841
827
|
const descriptors = {
|
|
842
828
|
dispatchEvent: generateDataDescriptor({
|
|
@@ -1550,7 +1536,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1550
1536
|
}
|
|
1551
1537
|
};
|
|
1552
1538
|
}
|
|
1553
|
-
const EMPTY_REFS = shared.freeze(shared.create(null));
|
|
1554
1539
|
const refsCache = new WeakMap();
|
|
1555
1540
|
/**
|
|
1556
1541
|
* This class is the base class for any LWC element.
|
|
@@ -1838,7 +1823,6 @@ LightningElement.prototype = {
|
|
|
1838
1823
|
}
|
|
1839
1824
|
const {
|
|
1840
1825
|
refVNodes,
|
|
1841
|
-
hasRefVNodes,
|
|
1842
1826
|
cmpTemplate
|
|
1843
1827
|
} = vm;
|
|
1844
1828
|
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
@@ -1852,15 +1836,9 @@ LightningElement.prototype = {
|
|
|
1852
1836
|
// were introduced, we return undefined if the template has no refs defined
|
|
1853
1837
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1854
1838
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1855
|
-
// Note
|
|
1856
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1857
|
-
if (!hasRefVNodes) {
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1861
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1839
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
1862
1840
|
if (shared.isNull(refVNodes)) {
|
|
1863
|
-
return
|
|
1841
|
+
return;
|
|
1864
1842
|
}
|
|
1865
1843
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1866
1844
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -2677,8 +2655,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2677
2655
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2678
2656
|
*/
|
|
2679
2657
|
let warned = false;
|
|
2680
|
-
//
|
|
2681
|
-
if (process.env.NODE_ENV
|
|
2658
|
+
// Only used in LWC's Karma tests
|
|
2659
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
2682
2660
|
// @ts-ignore
|
|
2683
2661
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2684
2662
|
warned = false;
|
|
@@ -2974,10 +2952,7 @@ function rehydrateHotComponent(Ctor) {
|
|
|
2974
2952
|
return canRefreshAllInstances;
|
|
2975
2953
|
}
|
|
2976
2954
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2977
|
-
|
|
2978
|
-
// this method should never leak to prod
|
|
2979
|
-
throw new ReferenceError();
|
|
2980
|
-
}
|
|
2955
|
+
assertNotProd(); // this method should never leak to prod
|
|
2981
2956
|
const visited = new Set();
|
|
2982
2957
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2983
2958
|
visited.add(tpl);
|
|
@@ -2986,10 +2961,7 @@ function getTemplateOrSwappedTemplate(tpl) {
|
|
|
2986
2961
|
return tpl;
|
|
2987
2962
|
}
|
|
2988
2963
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2989
|
-
|
|
2990
|
-
// this method should never leak to prod
|
|
2991
|
-
throw new ReferenceError();
|
|
2992
|
-
}
|
|
2964
|
+
assertNotProd(); // this method should never leak to prod
|
|
2993
2965
|
const visited = new Set();
|
|
2994
2966
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2995
2967
|
visited.add(Ctor);
|
|
@@ -2998,10 +2970,7 @@ function getComponentOrSwappedComponent(Ctor) {
|
|
|
2998
2970
|
return Ctor;
|
|
2999
2971
|
}
|
|
3000
2972
|
function getStyleOrSwappedStyle(style) {
|
|
3001
|
-
|
|
3002
|
-
// this method should never leak to prod
|
|
3003
|
-
throw new ReferenceError();
|
|
3004
|
-
}
|
|
2973
|
+
assertNotProd(); // this method should never leak to prod
|
|
3005
2974
|
const visited = new Set();
|
|
3006
2975
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3007
2976
|
visited.add(style);
|
|
@@ -3010,10 +2979,7 @@ function getStyleOrSwappedStyle(style) {
|
|
|
3010
2979
|
return style;
|
|
3011
2980
|
}
|
|
3012
2981
|
function setActiveVM(vm) {
|
|
3013
|
-
|
|
3014
|
-
// this method should never leak to prod
|
|
3015
|
-
throw new ReferenceError();
|
|
3016
|
-
}
|
|
2982
|
+
assertNotProd(); // this method should never leak to prod
|
|
3017
2983
|
// tracking active component
|
|
3018
2984
|
const Ctor = vm.def.ctor;
|
|
3019
2985
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -3056,10 +3022,7 @@ function setActiveVM(vm) {
|
|
|
3056
3022
|
}
|
|
3057
3023
|
}
|
|
3058
3024
|
function removeActiveVM(vm) {
|
|
3059
|
-
|
|
3060
|
-
// this method should never leak to prod
|
|
3061
|
-
throw new ReferenceError();
|
|
3062
|
-
}
|
|
3025
|
+
assertNotProd(); // this method should never leak to prod
|
|
3063
3026
|
// tracking inactive component
|
|
3064
3027
|
const Ctor = vm.def.ctor;
|
|
3065
3028
|
let list = activeComponents.get(Ctor);
|
|
@@ -5236,10 +5199,7 @@ function setVMBeingRendered(vm) {
|
|
|
5236
5199
|
vmBeingRendered = vm;
|
|
5237
5200
|
}
|
|
5238
5201
|
function validateSlots(vm, html) {
|
|
5239
|
-
|
|
5240
|
-
// this method should never leak to prod
|
|
5241
|
-
throw new ReferenceError();
|
|
5242
|
-
}
|
|
5202
|
+
assertNotProd(); // this method should never leak to prod
|
|
5243
5203
|
const { cmpSlots } = vm;
|
|
5244
5204
|
const { slots = EmptyArray } = html;
|
|
5245
5205
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
@@ -5373,9 +5333,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5373
5333
|
setActiveVM(vm);
|
|
5374
5334
|
}
|
|
5375
5335
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
5376
|
-
|
|
5377
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
5378
|
-
vm.refVNodes = hasRefVNodes ? shared.create(null) : null;
|
|
5336
|
+
vm.refVNodes = html.hasRefs ? shared.create(null) : null;
|
|
5379
5337
|
// right before producing the vnodes, we clear up all internal references
|
|
5380
5338
|
// to custom elements from the template.
|
|
5381
5339
|
vm.velements = [];
|
|
@@ -5562,7 +5520,7 @@ function markComponentAsDirty(vm) {
|
|
|
5562
5520
|
const cmpEventListenerMap = new WeakMap();
|
|
5563
5521
|
function getWrappedComponentsListener(vm, listener) {
|
|
5564
5522
|
if (!shared.isFunction(listener)) {
|
|
5565
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
5523
|
+
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
5566
5524
|
}
|
|
5567
5525
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
5568
5526
|
if (shared.isUndefined(wrappedListener)) {
|
|
@@ -5707,7 +5665,6 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5707
5665
|
mode,
|
|
5708
5666
|
owner,
|
|
5709
5667
|
refVNodes: null,
|
|
5710
|
-
hasRefVNodes: false,
|
|
5711
5668
|
children: EmptyArray,
|
|
5712
5669
|
aChildren: EmptyArray,
|
|
5713
5670
|
velements: EmptyArray,
|
|
@@ -7017,4 +6974,4 @@ exports.swapTemplate = swapTemplate;
|
|
|
7017
6974
|
exports.track = track;
|
|
7018
6975
|
exports.unwrap = unwrap;
|
|
7019
6976
|
exports.wire = wire;
|
|
7020
|
-
/* version: 2.35.
|
|
6977
|
+
/* version: 2.35.2 */
|
package/dist/engine-core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* proxy-compat-disable */
|
|
2
2
|
import { lwcRuntimeFlags } from '@lwc/features';
|
|
3
3
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
4
|
-
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isFunction as isFunction$1, hasOwnProperty as hasOwnProperty$1, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject,
|
|
4
|
+
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isFunction as isFunction$1, hasOwnProperty as hasOwnProperty$1, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, assert, freeze, KEY__SYNTHETIC_MODE, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, isArray as isArray$1, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, htmlAttributeToProperty, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, globalThis as globalThis$1, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift } from '@lwc/shared';
|
|
5
5
|
import { applyAriaReflection } from '@lwc/aria-reflection';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -11,8 +11,7 @@ import { applyAriaReflection } from '@lwc/aria-reflection';
|
|
|
11
11
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
12
12
|
*/
|
|
13
13
|
// Only used in LWC's Karma tests
|
|
14
|
-
|
|
15
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
14
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
16
15
|
window.addEventListener('test-dummy-flag', () => {
|
|
17
16
|
let hasFlag = false;
|
|
18
17
|
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
@@ -153,8 +152,8 @@ function addErrorComponentStack(vm, error) {
|
|
|
153
152
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
154
153
|
*/
|
|
155
154
|
const alreadyLoggedMessages = new Set();
|
|
156
|
-
//
|
|
157
|
-
if (process.env.NODE_ENV
|
|
155
|
+
// Only used in LWC's Karma tests
|
|
156
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
158
157
|
// @ts-ignore
|
|
159
158
|
window.__lwcResetAlreadyLoggedMessages = () => {
|
|
160
159
|
alreadyLoggedMessages.clear();
|
|
@@ -417,6 +416,14 @@ function setRefVNode(vm, ref, vnode) {
|
|
|
417
416
|
refVNodes[ref] = vnode;
|
|
418
417
|
}
|
|
419
418
|
}
|
|
419
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
420
|
+
function assertNotProd() {
|
|
421
|
+
/* istanbul ignore if */
|
|
422
|
+
if (process.env.NODE_ENV === 'production') {
|
|
423
|
+
// this method should never leak to prod
|
|
424
|
+
throw new ReferenceError();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
420
427
|
|
|
421
428
|
/*
|
|
422
429
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -622,27 +629,18 @@ function generateAccessorDescriptor(options) {
|
|
|
622
629
|
}
|
|
623
630
|
let isDomMutationAllowed = false;
|
|
624
631
|
function unlockDomMutation() {
|
|
625
|
-
|
|
626
|
-
// this method should never leak to prod
|
|
627
|
-
throw new ReferenceError();
|
|
628
|
-
}
|
|
632
|
+
assertNotProd(); // this method should never leak to prod
|
|
629
633
|
isDomMutationAllowed = true;
|
|
630
634
|
}
|
|
631
635
|
function lockDomMutation() {
|
|
632
|
-
|
|
633
|
-
// this method should never leak to prod
|
|
634
|
-
throw new ReferenceError();
|
|
635
|
-
}
|
|
636
|
+
assertNotProd(); // this method should never leak to prod
|
|
636
637
|
isDomMutationAllowed = false;
|
|
637
638
|
}
|
|
638
639
|
function logMissingPortalError(name, type) {
|
|
639
640
|
return logError(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
|
|
640
641
|
}
|
|
641
642
|
function patchElementWithRestrictions(elm, options) {
|
|
642
|
-
|
|
643
|
-
// this method should never leak to prod
|
|
644
|
-
throw new ReferenceError();
|
|
645
|
-
}
|
|
643
|
+
assertNotProd(); // this method should never leak to prod
|
|
646
644
|
const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
647
645
|
const descriptors = {
|
|
648
646
|
outerHTML: generateAccessorDescriptor({
|
|
@@ -723,10 +721,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
723
721
|
defineProperties(elm, descriptors);
|
|
724
722
|
}
|
|
725
723
|
function getShadowRootRestrictionsDescriptors(sr) {
|
|
726
|
-
|
|
727
|
-
// this method should never leak to prod
|
|
728
|
-
throw new ReferenceError();
|
|
729
|
-
}
|
|
724
|
+
assertNotProd(); // this method should never leak to prod
|
|
730
725
|
// Disallowing properties in dev mode only to avoid people doing the wrong
|
|
731
726
|
// thing when using the real shadow root, because if that's the case,
|
|
732
727
|
// the component will not work when running with synthetic shadow.
|
|
@@ -767,10 +762,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
767
762
|
// Custom Elements Restrictions:
|
|
768
763
|
// -----------------------------
|
|
769
764
|
function getCustomElementRestrictionsDescriptors(elm) {
|
|
770
|
-
|
|
771
|
-
// this method should never leak to prod
|
|
772
|
-
throw new ReferenceError();
|
|
773
|
-
}
|
|
765
|
+
assertNotProd(); // this method should never leak to prod
|
|
774
766
|
const originalAddEventListener = elm.addEventListener;
|
|
775
767
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
776
768
|
const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
@@ -815,10 +807,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
815
807
|
};
|
|
816
808
|
}
|
|
817
809
|
function getComponentRestrictionsDescriptors() {
|
|
818
|
-
|
|
819
|
-
// this method should never leak to prod
|
|
820
|
-
throw new ReferenceError();
|
|
821
|
-
}
|
|
810
|
+
assertNotProd(); // this method should never leak to prod
|
|
822
811
|
return {
|
|
823
812
|
tagName: generateAccessorDescriptor({
|
|
824
813
|
get() {
|
|
@@ -832,10 +821,7 @@ function getComponentRestrictionsDescriptors() {
|
|
|
832
821
|
};
|
|
833
822
|
}
|
|
834
823
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
835
|
-
|
|
836
|
-
// this method should never leak to prod
|
|
837
|
-
throw new ReferenceError();
|
|
838
|
-
}
|
|
824
|
+
assertNotProd(); // this method should never leak to prod
|
|
839
825
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
840
826
|
const descriptors = {
|
|
841
827
|
dispatchEvent: generateDataDescriptor({
|
|
@@ -1549,7 +1535,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1549
1535
|
}
|
|
1550
1536
|
};
|
|
1551
1537
|
}
|
|
1552
|
-
const EMPTY_REFS = freeze(create(null));
|
|
1553
1538
|
const refsCache = new WeakMap();
|
|
1554
1539
|
/**
|
|
1555
1540
|
* This class is the base class for any LWC element.
|
|
@@ -1837,7 +1822,6 @@ LightningElement.prototype = {
|
|
|
1837
1822
|
}
|
|
1838
1823
|
const {
|
|
1839
1824
|
refVNodes,
|
|
1840
|
-
hasRefVNodes,
|
|
1841
1825
|
cmpTemplate
|
|
1842
1826
|
} = vm;
|
|
1843
1827
|
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
@@ -1851,15 +1835,9 @@ LightningElement.prototype = {
|
|
|
1851
1835
|
// were introduced, we return undefined if the template has no refs defined
|
|
1852
1836
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1853
1837
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1854
|
-
// Note
|
|
1855
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1856
|
-
if (!hasRefVNodes) {
|
|
1857
|
-
return;
|
|
1858
|
-
}
|
|
1859
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1860
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1838
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
1861
1839
|
if (isNull(refVNodes)) {
|
|
1862
|
-
return
|
|
1840
|
+
return;
|
|
1863
1841
|
}
|
|
1864
1842
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1865
1843
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -2676,8 +2654,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2676
2654
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2677
2655
|
*/
|
|
2678
2656
|
let warned = false;
|
|
2679
|
-
//
|
|
2680
|
-
if (process.env.NODE_ENV
|
|
2657
|
+
// Only used in LWC's Karma tests
|
|
2658
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
2681
2659
|
// @ts-ignore
|
|
2682
2660
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2683
2661
|
warned = false;
|
|
@@ -2973,10 +2951,7 @@ function rehydrateHotComponent(Ctor) {
|
|
|
2973
2951
|
return canRefreshAllInstances;
|
|
2974
2952
|
}
|
|
2975
2953
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2976
|
-
|
|
2977
|
-
// this method should never leak to prod
|
|
2978
|
-
throw new ReferenceError();
|
|
2979
|
-
}
|
|
2954
|
+
assertNotProd(); // this method should never leak to prod
|
|
2980
2955
|
const visited = new Set();
|
|
2981
2956
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2982
2957
|
visited.add(tpl);
|
|
@@ -2985,10 +2960,7 @@ function getTemplateOrSwappedTemplate(tpl) {
|
|
|
2985
2960
|
return tpl;
|
|
2986
2961
|
}
|
|
2987
2962
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2988
|
-
|
|
2989
|
-
// this method should never leak to prod
|
|
2990
|
-
throw new ReferenceError();
|
|
2991
|
-
}
|
|
2963
|
+
assertNotProd(); // this method should never leak to prod
|
|
2992
2964
|
const visited = new Set();
|
|
2993
2965
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2994
2966
|
visited.add(Ctor);
|
|
@@ -2997,10 +2969,7 @@ function getComponentOrSwappedComponent(Ctor) {
|
|
|
2997
2969
|
return Ctor;
|
|
2998
2970
|
}
|
|
2999
2971
|
function getStyleOrSwappedStyle(style) {
|
|
3000
|
-
|
|
3001
|
-
// this method should never leak to prod
|
|
3002
|
-
throw new ReferenceError();
|
|
3003
|
-
}
|
|
2972
|
+
assertNotProd(); // this method should never leak to prod
|
|
3004
2973
|
const visited = new Set();
|
|
3005
2974
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3006
2975
|
visited.add(style);
|
|
@@ -3009,10 +2978,7 @@ function getStyleOrSwappedStyle(style) {
|
|
|
3009
2978
|
return style;
|
|
3010
2979
|
}
|
|
3011
2980
|
function setActiveVM(vm) {
|
|
3012
|
-
|
|
3013
|
-
// this method should never leak to prod
|
|
3014
|
-
throw new ReferenceError();
|
|
3015
|
-
}
|
|
2981
|
+
assertNotProd(); // this method should never leak to prod
|
|
3016
2982
|
// tracking active component
|
|
3017
2983
|
const Ctor = vm.def.ctor;
|
|
3018
2984
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -3055,10 +3021,7 @@ function setActiveVM(vm) {
|
|
|
3055
3021
|
}
|
|
3056
3022
|
}
|
|
3057
3023
|
function removeActiveVM(vm) {
|
|
3058
|
-
|
|
3059
|
-
// this method should never leak to prod
|
|
3060
|
-
throw new ReferenceError();
|
|
3061
|
-
}
|
|
3024
|
+
assertNotProd(); // this method should never leak to prod
|
|
3062
3025
|
// tracking inactive component
|
|
3063
3026
|
const Ctor = vm.def.ctor;
|
|
3064
3027
|
let list = activeComponents.get(Ctor);
|
|
@@ -5235,10 +5198,7 @@ function setVMBeingRendered(vm) {
|
|
|
5235
5198
|
vmBeingRendered = vm;
|
|
5236
5199
|
}
|
|
5237
5200
|
function validateSlots(vm, html) {
|
|
5238
|
-
|
|
5239
|
-
// this method should never leak to prod
|
|
5240
|
-
throw new ReferenceError();
|
|
5241
|
-
}
|
|
5201
|
+
assertNotProd(); // this method should never leak to prod
|
|
5242
5202
|
const { cmpSlots } = vm;
|
|
5243
5203
|
const { slots = EmptyArray } = html;
|
|
5244
5204
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
@@ -5372,9 +5332,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5372
5332
|
setActiveVM(vm);
|
|
5373
5333
|
}
|
|
5374
5334
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
5375
|
-
|
|
5376
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
5377
|
-
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5335
|
+
vm.refVNodes = html.hasRefs ? create(null) : null;
|
|
5378
5336
|
// right before producing the vnodes, we clear up all internal references
|
|
5379
5337
|
// to custom elements from the template.
|
|
5380
5338
|
vm.velements = [];
|
|
@@ -5561,7 +5519,7 @@ function markComponentAsDirty(vm) {
|
|
|
5561
5519
|
const cmpEventListenerMap = new WeakMap();
|
|
5562
5520
|
function getWrappedComponentsListener(vm, listener) {
|
|
5563
5521
|
if (!isFunction$1(listener)) {
|
|
5564
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
5522
|
+
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
5565
5523
|
}
|
|
5566
5524
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
5567
5525
|
if (isUndefined$1(wrappedListener)) {
|
|
@@ -5706,7 +5664,6 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5706
5664
|
mode,
|
|
5707
5665
|
owner,
|
|
5708
5666
|
refVNodes: null,
|
|
5709
|
-
hasRefVNodes: false,
|
|
5710
5667
|
children: EmptyArray,
|
|
5711
5668
|
aChildren: EmptyArray,
|
|
5712
5669
|
velements: EmptyArray,
|
|
@@ -6979,4 +6936,4 @@ function getComponentConstructor(elm) {
|
|
|
6979
6936
|
}
|
|
6980
6937
|
|
|
6981
6938
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6982
|
-
/* version: 2.35.
|
|
6939
|
+
/* version: 2.35.2 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/engine-core",
|
|
3
|
-
"version": "2.35.
|
|
3
|
+
"version": "2.35.2",
|
|
4
4
|
"description": "Core LWC engine APIs.",
|
|
5
5
|
"homepage": "https://lwc.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"types/"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lwc/aria-reflection": "2.35.
|
|
28
|
-
"@lwc/features": "2.35.
|
|
29
|
-
"@lwc/shared": "2.35.
|
|
27
|
+
"@lwc/aria-reflection": "2.35.2",
|
|
28
|
+
"@lwc/features": "2.35.2",
|
|
29
|
+
"@lwc/shared": "2.35.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"observable-membrane": "2.0.0"
|
|
@@ -17,4 +17,5 @@ export declare function cloneAndOmitKey(object: {
|
|
|
17
17
|
};
|
|
18
18
|
export declare function flattenStylesheets(stylesheets: TemplateStylesheetFactories): StylesheetFactory[];
|
|
19
19
|
export declare function setRefVNode(vm: VM, ref: string, vnode: VBaseElement): void;
|
|
20
|
+
export declare function assertNotProd(): void;
|
|
20
21
|
export {};
|
package/types/framework/vm.d.ts
CHANGED
|
@@ -70,8 +70,6 @@ export interface VM<N = HostNode, E = HostElement> {
|
|
|
70
70
|
readonly owner: VM<N, E> | null;
|
|
71
71
|
/** References to elements rendered using lwc:ref (template refs) */
|
|
72
72
|
refVNodes: RefVNodes | null;
|
|
73
|
-
/** Whether this template has any references to elements (template refs) */
|
|
74
|
-
hasRefVNodes: boolean;
|
|
75
73
|
/** Whether or not the VM was hydrated */
|
|
76
74
|
readonly hydrated: boolean;
|
|
77
75
|
/** Rendering operations associated with the VM */
|