@lwc/engine-core 7.1.2 → 7.1.4

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.js CHANGED
@@ -5255,16 +5255,7 @@ function s(slotName, data, children, slotset) {
5255
5255
  // to the vnode because the current way the diffing algo works, it will replace the original reference
5256
5256
  // to the host element with a new one. This means the new element will be mounted and immediately unmounted.
5257
5257
  // Creating a copy of the vnode to preserve a reference to the previous host element.
5258
- if (isUndefined$1(vnode.elm)) {
5259
- // vnode.elm is undefined during initial render.
5260
- // We don't need to clone at this point because it doesn't need to be unmounted.
5261
- vnode.slotAssignment = data.slotAssignment;
5262
- }
5263
- else {
5264
- // Clone when the vnode.elm is defined to ensure we don't lose reference to the previous element.
5265
- // This is specifically for slot forwarding.
5266
- clonedVNode = { ...vnode, slotAssignment: data.slotAssignment };
5267
- }
5258
+ clonedVNode = { ...vnode, slotAssignment: data.slotAssignment };
5268
5259
  }
5269
5260
  // If the slot content is standard type, the content is static, no additional
5270
5261
  // processing needed on the vnode
@@ -5807,6 +5798,12 @@ function getVMBeingRendered() {
5807
5798
  function setVMBeingRendered(vm) {
5808
5799
  vmBeingRendered = vm;
5809
5800
  }
5801
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
5802
+ // See W-16614556
5803
+ // TODO [#2826]: freeze the template object
5804
+ function isValidScopeToken(token) {
5805
+ return isString(token) && VALID_SCOPE_TOKEN_REGEX.test(token);
5806
+ }
5810
5807
  function validateSlots(vm) {
5811
5808
  assertNotProd(); // this method should never leak to prod
5812
5809
  const { cmpSlots } = vm;
@@ -5977,6 +5974,11 @@ function buildParseFragmentFn(createFragmentFn) {
5977
5974
  return cached;
5978
5975
  }
5979
5976
  }
5977
+ // See W-16614556
5978
+ if ((hasStyleToken && !isValidScopeToken(stylesheetToken)) ||
5979
+ (hasLegacyToken && !isValidScopeToken(legacyStylesheetToken))) {
5980
+ throw new Error('stylesheet token must be a valid string');
5981
+ }
5980
5982
  // If legacy stylesheet tokens are required, then add them to the rendered string
5981
5983
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
5982
5984
  const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
@@ -7794,7 +7796,13 @@ function setHooks(hooks) {
7794
7796
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7795
7797
  */
7796
7798
  // See @lwc/engine-core/src/framework/template.ts
7797
- const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7799
+ const TEMPLATE_PROPS = [
7800
+ 'slots',
7801
+ 'stylesheetToken',
7802
+ 'stylesheets',
7803
+ 'renderMode',
7804
+ 'legacyStylesheetToken',
7805
+ ];
7798
7806
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7799
7807
  const STYLESHEET_PROPS = [
7800
7808
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
@@ -8044,5 +8052,5 @@ function readonly(obj) {
8044
8052
  }
8045
8053
 
8046
8054
  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 };
8047
- /** version: 7.1.2 */
8055
+ /** version: 7.1.4 */
8048
8056
  //# sourceMappingURL=index.js.map