@lwc/engine-core 2.42.0 → 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.js
CHANGED
|
@@ -3263,6 +3263,15 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3263
3263
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3264
3264
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3265
3265
|
}
|
|
3266
|
+
// Check that this stylesheet was generated by our compiler
|
|
3267
|
+
if (!isStylesheetRegistered(stylesheet)) {
|
|
3268
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3269
|
+
logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
|
|
3270
|
+
}
|
|
3271
|
+
report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
|
|
3272
|
+
tagName: vm.tagName.toLowerCase(),
|
|
3273
|
+
});
|
|
3274
|
+
}
|
|
3266
3275
|
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3267
3276
|
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
|
|
3268
3277
|
!isScopedCss &&
|
|
@@ -3383,6 +3392,18 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3383
3392
|
}
|
|
3384
3393
|
return null;
|
|
3385
3394
|
}
|
|
3395
|
+
const signedStylesheetSet = new Set();
|
|
3396
|
+
/**
|
|
3397
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3398
|
+
* will prevent this function from being imported by userland code.
|
|
3399
|
+
*/
|
|
3400
|
+
function registerStylesheet(stylesheet) {
|
|
3401
|
+
signedStylesheetSet.add(stylesheet);
|
|
3402
|
+
return stylesheet;
|
|
3403
|
+
}
|
|
3404
|
+
function isStylesheetRegistered(stylesheet) {
|
|
3405
|
+
return signedStylesheetSet.has(stylesheet);
|
|
3406
|
+
}
|
|
3386
3407
|
|
|
3387
3408
|
/*
|
|
3388
3409
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5092,18 +5113,12 @@ function getVMBeingRendered() {
|
|
|
5092
5113
|
function setVMBeingRendered(vm) {
|
|
5093
5114
|
vmBeingRendered = vm;
|
|
5094
5115
|
}
|
|
5095
|
-
function validateSlots(vm
|
|
5116
|
+
function validateSlots(vm) {
|
|
5096
5117
|
assertNotProd(); // this method should never leak to prod
|
|
5097
5118
|
const { cmpSlots } = vm;
|
|
5098
|
-
const { slots = EmptyArray } = html;
|
|
5099
5119
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
5100
5120
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5101
5121
|
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
5102
|
-
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5103
|
-
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5104
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5105
|
-
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
5106
|
-
}
|
|
5107
5122
|
}
|
|
5108
5123
|
}
|
|
5109
5124
|
function validateLightDomTemplate(template, vm) {
|
|
@@ -5222,7 +5237,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5222
5237
|
}
|
|
5223
5238
|
if (process.env.NODE_ENV !== 'production') {
|
|
5224
5239
|
// validating slots in every rendering since the allocated content might change over time
|
|
5225
|
-
validateSlots(vm
|
|
5240
|
+
validateSlots(vm);
|
|
5226
5241
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5227
5242
|
setActiveVM(vm);
|
|
5228
5243
|
}
|
|
@@ -6208,7 +6223,7 @@ function checkAndReportViolation(elm, prop, isSetter, setValue) {
|
|
|
6208
6223
|
const vm = findVM(elm);
|
|
6209
6224
|
if (process.env.NODE_ENV !== 'production') {
|
|
6210
6225
|
logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` +
|
|
6211
|
-
(isUndefined$1(vm) ? '' : `owned by <${vm.
|
|
6226
|
+
(isUndefined$1(vm) ? '' : `owned by <${vm.tagName.toLowerCase()}> `) +
|
|
6212
6227
|
`uses non-standard property "${prop}". This will be removed in a future version of LWC. ` +
|
|
6213
6228
|
`See https://sfdc.co/deprecated-aria`);
|
|
6214
6229
|
}
|
|
@@ -6577,7 +6592,7 @@ function validateAttrs(vnode, elm, renderer) {
|
|
|
6577
6592
|
function validateClassAttr(vnode, elm, renderer) {
|
|
6578
6593
|
const { data, owner } = vnode;
|
|
6579
6594
|
let { className, classMap } = data;
|
|
6580
|
-
const { getProperty, getClassList } = renderer;
|
|
6595
|
+
const { getProperty, getClassList, getAttribute } = renderer;
|
|
6581
6596
|
const scopedToken = getScopeTokenClass(owner);
|
|
6582
6597
|
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
6583
6598
|
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
@@ -6607,11 +6622,12 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6607
6622
|
}
|
|
6608
6623
|
let nodesAreCompatible = true;
|
|
6609
6624
|
let readableVnodeClassname;
|
|
6610
|
-
const elmClassName =
|
|
6625
|
+
const elmClassName = getAttribute(elm, 'class');
|
|
6611
6626
|
if (!isUndefined$1(className) && String(className) !== elmClassName) {
|
|
6612
6627
|
// className is used when class is bound to an expr.
|
|
6613
6628
|
nodesAreCompatible = false;
|
|
6614
|
-
|
|
6629
|
+
// stringify for pretty-printing
|
|
6630
|
+
readableVnodeClassname = JSON.stringify(className);
|
|
6615
6631
|
}
|
|
6616
6632
|
else if (!isUndefined$1(classMap)) {
|
|
6617
6633
|
// classMap is used when class is set to static value.
|
|
@@ -6624,19 +6640,20 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6624
6640
|
nodesAreCompatible = false;
|
|
6625
6641
|
}
|
|
6626
6642
|
}
|
|
6627
|
-
|
|
6643
|
+
// stringify for pretty-printing
|
|
6644
|
+
readableVnodeClassname = JSON.stringify(computedClassName.trim());
|
|
6628
6645
|
if (classList.length > keys(classMap).length) {
|
|
6629
6646
|
nodesAreCompatible = false;
|
|
6630
6647
|
}
|
|
6631
6648
|
}
|
|
6632
|
-
else if (isUndefined$1(className) && elmClassName
|
|
6649
|
+
else if (isUndefined$1(className) && !isNull(elmClassName)) {
|
|
6633
6650
|
// SSR contains a className but client-side VDOM does not
|
|
6634
6651
|
nodesAreCompatible = false;
|
|
6635
|
-
readableVnodeClassname = '';
|
|
6652
|
+
readableVnodeClassname = '""';
|
|
6636
6653
|
}
|
|
6637
6654
|
if (!nodesAreCompatible) {
|
|
6638
6655
|
if (process.env.NODE_ENV !== 'production') {
|
|
6639
|
-
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected
|
|
6656
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected ${readableVnodeClassname} but found ${JSON.stringify(elmClassName)}`, vnode.owner);
|
|
6640
6657
|
}
|
|
6641
6658
|
}
|
|
6642
6659
|
return nodesAreCompatible;
|
|
@@ -6983,6 +7000,6 @@ function readonly(obj) {
|
|
|
6983
7000
|
return getReadOnlyProxy(obj);
|
|
6984
7001
|
}
|
|
6985
7002
|
|
|
6986
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6987
|
-
/* version: 2.
|
|
7003
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerStylesheet, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7004
|
+
/* version: 2.43.0 */
|
|
6988
7005
|
//# sourceMappingURL=engine-core.js.map
|