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