@lwc/engine-core 2.41.3 → 2.43.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/engine-core.cjs.js +35 -17
- package/dist/engine-core.cjs.js.map +1 -1
- package/dist/engine-core.js +35 -18
- package/dist/engine-core.js.map +1 -1
- package/package.json +4 -4
- package/types/framework/main.d.ts +1 -0
- package/types/framework/reporting.d.ts +3 -1
- package/types/framework/stylesheet.d.ts +5 -0
package/dist/engine-core.cjs.js
CHANGED
|
@@ -3265,6 +3265,15 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3265
3265
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3266
3266
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3267
3267
|
}
|
|
3268
|
+
// Check that this stylesheet was generated by our compiler
|
|
3269
|
+
if (!isStylesheetRegistered(stylesheet)) {
|
|
3270
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3271
|
+
logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
|
|
3272
|
+
}
|
|
3273
|
+
report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
|
|
3274
|
+
tagName: vm.tagName.toLowerCase(),
|
|
3275
|
+
});
|
|
3276
|
+
}
|
|
3268
3277
|
const isScopedCss = stylesheet[shared.KEY__SCOPED_CSS];
|
|
3269
3278
|
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
|
|
3270
3279
|
!isScopedCss &&
|
|
@@ -3385,6 +3394,18 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3385
3394
|
}
|
|
3386
3395
|
return null;
|
|
3387
3396
|
}
|
|
3397
|
+
const signedStylesheetSet = new Set();
|
|
3398
|
+
/**
|
|
3399
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3400
|
+
* will prevent this function from being imported by userland code.
|
|
3401
|
+
*/
|
|
3402
|
+
function registerStylesheet(stylesheet) {
|
|
3403
|
+
signedStylesheetSet.add(stylesheet);
|
|
3404
|
+
return stylesheet;
|
|
3405
|
+
}
|
|
3406
|
+
function isStylesheetRegistered(stylesheet) {
|
|
3407
|
+
return signedStylesheetSet.has(stylesheet);
|
|
3408
|
+
}
|
|
3388
3409
|
|
|
3389
3410
|
/*
|
|
3390
3411
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5094,18 +5115,12 @@ function getVMBeingRendered() {
|
|
|
5094
5115
|
function setVMBeingRendered(vm) {
|
|
5095
5116
|
vmBeingRendered = vm;
|
|
5096
5117
|
}
|
|
5097
|
-
function validateSlots(vm
|
|
5118
|
+
function validateSlots(vm) {
|
|
5098
5119
|
assertNotProd(); // this method should never leak to prod
|
|
5099
5120
|
const { cmpSlots } = vm;
|
|
5100
|
-
const { slots = EmptyArray } = html;
|
|
5101
5121
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
5102
5122
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5103
5123
|
shared.assert.isTrue(shared.isArray(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${shared.toString(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
5104
|
-
if (slotName !== '' && shared.ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5105
|
-
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5106
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5107
|
-
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
5108
|
-
}
|
|
5109
5124
|
}
|
|
5110
5125
|
}
|
|
5111
5126
|
function validateLightDomTemplate(template, vm) {
|
|
@@ -5224,7 +5239,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5224
5239
|
}
|
|
5225
5240
|
if (process.env.NODE_ENV !== 'production') {
|
|
5226
5241
|
// validating slots in every rendering since the allocated content might change over time
|
|
5227
|
-
validateSlots(vm
|
|
5242
|
+
validateSlots(vm);
|
|
5228
5243
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5229
5244
|
setActiveVM(vm);
|
|
5230
5245
|
}
|
|
@@ -6210,7 +6225,7 @@ function checkAndReportViolation(elm, prop, isSetter, setValue) {
|
|
|
6210
6225
|
const vm = findVM(elm);
|
|
6211
6226
|
if (process.env.NODE_ENV !== 'production') {
|
|
6212
6227
|
logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` +
|
|
6213
|
-
(shared.isUndefined(vm) ? '' : `owned by <${vm.
|
|
6228
|
+
(shared.isUndefined(vm) ? '' : `owned by <${vm.tagName.toLowerCase()}> `) +
|
|
6214
6229
|
`uses non-standard property "${prop}". This will be removed in a future version of LWC. ` +
|
|
6215
6230
|
`See https://sfdc.co/deprecated-aria`);
|
|
6216
6231
|
}
|
|
@@ -6579,7 +6594,7 @@ function validateAttrs(vnode, elm, renderer) {
|
|
|
6579
6594
|
function validateClassAttr(vnode, elm, renderer) {
|
|
6580
6595
|
const { data, owner } = vnode;
|
|
6581
6596
|
let { className, classMap } = data;
|
|
6582
|
-
const { getProperty, getClassList } = renderer;
|
|
6597
|
+
const { getProperty, getClassList, getAttribute } = renderer;
|
|
6583
6598
|
const scopedToken = getScopeTokenClass(owner);
|
|
6584
6599
|
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
6585
6600
|
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
@@ -6609,11 +6624,12 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6609
6624
|
}
|
|
6610
6625
|
let nodesAreCompatible = true;
|
|
6611
6626
|
let readableVnodeClassname;
|
|
6612
|
-
const elmClassName =
|
|
6627
|
+
const elmClassName = getAttribute(elm, 'class');
|
|
6613
6628
|
if (!shared.isUndefined(className) && String(className) !== elmClassName) {
|
|
6614
6629
|
// className is used when class is bound to an expr.
|
|
6615
6630
|
nodesAreCompatible = false;
|
|
6616
|
-
|
|
6631
|
+
// stringify for pretty-printing
|
|
6632
|
+
readableVnodeClassname = JSON.stringify(className);
|
|
6617
6633
|
}
|
|
6618
6634
|
else if (!shared.isUndefined(classMap)) {
|
|
6619
6635
|
// classMap is used when class is set to static value.
|
|
@@ -6626,19 +6642,20 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6626
6642
|
nodesAreCompatible = false;
|
|
6627
6643
|
}
|
|
6628
6644
|
}
|
|
6629
|
-
|
|
6645
|
+
// stringify for pretty-printing
|
|
6646
|
+
readableVnodeClassname = JSON.stringify(computedClassName.trim());
|
|
6630
6647
|
if (classList.length > shared.keys(classMap).length) {
|
|
6631
6648
|
nodesAreCompatible = false;
|
|
6632
6649
|
}
|
|
6633
6650
|
}
|
|
6634
|
-
else if (shared.isUndefined(className) && elmClassName
|
|
6651
|
+
else if (shared.isUndefined(className) && !shared.isNull(elmClassName)) {
|
|
6635
6652
|
// SSR contains a className but client-side VDOM does not
|
|
6636
6653
|
nodesAreCompatible = false;
|
|
6637
|
-
readableVnodeClassname = '';
|
|
6654
|
+
readableVnodeClassname = '""';
|
|
6638
6655
|
}
|
|
6639
6656
|
if (!nodesAreCompatible) {
|
|
6640
6657
|
if (process.env.NODE_ENV !== 'production') {
|
|
6641
|
-
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected
|
|
6658
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected ${readableVnodeClassname} but found ${JSON.stringify(elmClassName)}`, vnode.owner);
|
|
6642
6659
|
}
|
|
6643
6660
|
}
|
|
6644
6661
|
return nodesAreCompatible;
|
|
@@ -7014,6 +7031,7 @@ exports.readonly = readonly;
|
|
|
7014
7031
|
exports.register = register;
|
|
7015
7032
|
exports.registerComponent = registerComponent;
|
|
7016
7033
|
exports.registerDecorators = registerDecorators;
|
|
7034
|
+
exports.registerStylesheet = registerStylesheet;
|
|
7017
7035
|
exports.registerTemplate = registerTemplate;
|
|
7018
7036
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7019
7037
|
exports.setHooks = setHooks;
|
|
@@ -7023,5 +7041,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7023
7041
|
exports.track = track;
|
|
7024
7042
|
exports.unwrap = unwrap;
|
|
7025
7043
|
exports.wire = wire;
|
|
7026
|
-
/* version: 2.
|
|
7044
|
+
/* version: 2.43.0 */
|
|
7027
7045
|
//# sourceMappingURL=engine-core.cjs.js.map
|