@lwc/engine-core 7.2.3 → 7.2.5

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
@@ -5856,6 +5856,12 @@ function getVMBeingRendered() {
5856
5856
  function setVMBeingRendered(vm) {
5857
5857
  vmBeingRendered = vm;
5858
5858
  }
5859
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
5860
+ // See W-16614556
5861
+ // TODO [#2826]: freeze the template object
5862
+ function isValidScopeToken(token) {
5863
+ return shared.isString(token) && VALID_SCOPE_TOKEN_REGEX.test(token);
5864
+ }
5859
5865
  function validateSlots(vm) {
5860
5866
  assertNotProd(); // this method should never leak to prod
5861
5867
  const { cmpSlots } = vm;
@@ -6007,6 +6013,11 @@ function buildParseFragmentFn(createFragmentFn) {
6007
6013
  return cached;
6008
6014
  }
6009
6015
  }
6016
+ // See W-16614556
6017
+ if ((hasStyleToken && !isValidScopeToken(stylesheetToken)) ||
6018
+ (hasLegacyToken && !isValidScopeToken(legacyStylesheetToken))) {
6019
+ throw new Error('stylesheet token must be a valid string');
6020
+ }
6010
6021
  // If legacy stylesheet tokens are required, then add them to the rendered string
6011
6022
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
6012
6023
  const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
@@ -7830,7 +7841,13 @@ function setHooks(hooks) {
7830
7841
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7831
7842
  */
7832
7843
  // See @lwc/engine-core/src/framework/template.ts
7833
- const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7844
+ const TEMPLATE_PROPS = [
7845
+ 'slots',
7846
+ 'stylesheetToken',
7847
+ 'stylesheets',
7848
+ 'renderMode',
7849
+ 'legacyStylesheetToken',
7850
+ ];
7834
7851
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7835
7852
  const STYLESHEET_PROPS = [
7836
7853
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
@@ -8123,5 +8140,5 @@ exports.swapTemplate = swapTemplate;
8123
8140
  exports.track = track;
8124
8141
  exports.unwrap = unwrap;
8125
8142
  exports.wire = wire;
8126
- /** version: 7.2.3 */
8143
+ /** version: 7.2.5 */
8127
8144
  //# sourceMappingURL=index.cjs.js.map