@lwc/engine-core 7.1.3 → 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
@@ -5802,6 +5802,12 @@ function getVMBeingRendered() {
5802
5802
  function setVMBeingRendered(vm) {
5803
5803
  vmBeingRendered = vm;
5804
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
+ }
5805
5811
  function validateSlots(vm) {
5806
5812
  assertNotProd(); // this method should never leak to prod
5807
5813
  const { cmpSlots } = vm;
@@ -5972,6 +5978,11 @@ function buildParseFragmentFn(createFragmentFn) {
5972
5978
  return cached;
5973
5979
  }
5974
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
+ }
5975
5986
  // If legacy stylesheet tokens are required, then add them to the rendered string
5976
5987
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
5977
5988
  const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
@@ -7789,7 +7800,13 @@ function setHooks(hooks) {
7789
7800
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7790
7801
  */
7791
7802
  // See @lwc/engine-core/src/framework/template.ts
7792
- const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7803
+ const TEMPLATE_PROPS = [
7804
+ 'slots',
7805
+ 'stylesheetToken',
7806
+ 'stylesheets',
7807
+ 'renderMode',
7808
+ 'legacyStylesheetToken',
7809
+ ];
7793
7810
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7794
7811
  const STYLESHEET_PROPS = [
7795
7812
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
@@ -8082,5 +8099,5 @@ exports.swapTemplate = swapTemplate;
8082
8099
  exports.track = track;
8083
8100
  exports.unwrap = unwrap;
8084
8101
  exports.wire = wire;
8085
- /** version: 7.1.3 */
8102
+ /** version: 7.1.4 */
8086
8103
  //# sourceMappingURL=index.cjs.js.map