@lwc/engine-core 6.6.6 → 6.7.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.cjs.js +26 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3449,12 +3449,25 @@ function swapTemplate(oldTpl, newTpl) {
|
|
|
3449
3449
|
}
|
|
3450
3450
|
function swapComponent(oldComponent, newComponent) {
|
|
3451
3451
|
if (process.env.NODE_ENV !== 'production') {
|
|
3452
|
-
|
|
3452
|
+
const isOldCtorAComponent = isComponentConstructor(oldComponent);
|
|
3453
|
+
const isNewCtorAComponent = isComponentConstructor(newComponent);
|
|
3454
|
+
if (isOldCtorAComponent && isNewCtorAComponent) {
|
|
3453
3455
|
swappedComponentMap.set(oldComponent, newComponent);
|
|
3454
3456
|
return rehydrateHotComponent(oldComponent);
|
|
3455
3457
|
}
|
|
3458
|
+
else if (isOldCtorAComponent === false && isNewCtorAComponent === true) {
|
|
3459
|
+
throw new TypeError(`Invalid Component: Attempting to swap a non-component with a component`);
|
|
3460
|
+
}
|
|
3461
|
+
else if (isOldCtorAComponent === true && isNewCtorAComponent === false) {
|
|
3462
|
+
throw new TypeError(`Invalid Component: Attempting to swap a component with a non-component`);
|
|
3463
|
+
}
|
|
3456
3464
|
else {
|
|
3457
|
-
|
|
3465
|
+
// The dev-server relies on the presence of registerComponent() as a way to determine a
|
|
3466
|
+
// component module. However, the compiler cannot definitively add registerComponent()
|
|
3467
|
+
// transformation only to a component constructor. Hence the dev-server may attempt to
|
|
3468
|
+
// hot swap javascript modules that look like a component and should not cause the app
|
|
3469
|
+
// to fail. To allow that, this api ignores such hot swap attempts.
|
|
3470
|
+
return false;
|
|
3458
3471
|
}
|
|
3459
3472
|
}
|
|
3460
3473
|
return false;
|
|
@@ -7632,6 +7645,7 @@ function haveCompatibleStaticParts(vnode, renderer) {
|
|
|
7632
7645
|
if (isUndefined$1(parts)) {
|
|
7633
7646
|
return true;
|
|
7634
7647
|
}
|
|
7648
|
+
const shouldValidateAttr = (data, attrName) => attrName in data;
|
|
7635
7649
|
// The validation here relies on 2 key invariants:
|
|
7636
7650
|
// 1. It's never the case that `parts` is undefined on the server but defined on the client (or vice-versa)
|
|
7637
7651
|
// 2. It's never the case that `parts` has one length on the server but another on the client
|
|
@@ -7643,8 +7657,15 @@ function haveCompatibleStaticParts(vnode, renderer) {
|
|
|
7643
7657
|
}
|
|
7644
7658
|
const { data } = part;
|
|
7645
7659
|
const hasMatchingAttrs = validateAttrs(vnode, elm, data, renderer, () => true);
|
|
7646
|
-
|
|
7647
|
-
|
|
7660
|
+
// Explicitly skip hydration validation when static parts don't contain `style` or `className`.
|
|
7661
|
+
// This means the style/class attributes are either static or don't exist on the element and
|
|
7662
|
+
// cannot be affected by hydration.
|
|
7663
|
+
const hasMatchingStyleAttr = shouldValidateAttr(data, 'style')
|
|
7664
|
+
? validateStyleAttr(vnode, elm, data, renderer)
|
|
7665
|
+
: true;
|
|
7666
|
+
const hasMatchingClass = shouldValidateAttr(data, 'className')
|
|
7667
|
+
? validateClassAttr(vnode, elm, data, renderer)
|
|
7668
|
+
: true;
|
|
7648
7669
|
if (isFalse(hasMatchingAttrs && hasMatchingStyleAttr && hasMatchingClass)) {
|
|
7649
7670
|
return false;
|
|
7650
7671
|
}
|
|
@@ -7930,5 +7951,5 @@ function readonly(obj) {
|
|
|
7930
7951
|
}
|
|
7931
7952
|
|
|
7932
7953
|
export { 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, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7933
|
-
/** version: 6.
|
|
7954
|
+
/** version: 6.7.0 */
|
|
7934
7955
|
//# sourceMappingURL=index.js.map
|