@lwc/engine-core 8.0.0-alpha.1 → 8.0.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 CHANGED
@@ -5858,6 +5858,12 @@ function getVMBeingRendered() {
5858
5858
  function setVMBeingRendered(vm) {
5859
5859
  vmBeingRendered = vm;
5860
5860
  }
5861
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
5862
+ // See W-16614556
5863
+ // TODO [#2826]: freeze the template object
5864
+ function isValidScopeToken(token) {
5865
+ return shared.isString(token) && VALID_SCOPE_TOKEN_REGEX.test(token);
5866
+ }
5861
5867
  function validateSlots(vm) {
5862
5868
  assertNotProd(); // this method should never leak to prod
5863
5869
  const { cmpSlots } = vm;
@@ -6010,9 +6016,9 @@ function buildParseFragmentFn(createFragmentFn) {
6010
6016
  }
6011
6017
  }
6012
6018
  // See W-16614556
6013
- if ((hasStyleToken && !shared.isString(stylesheetToken)) ||
6014
- (hasLegacyToken && !shared.isString(legacyStylesheetToken))) {
6015
- throw new Error('stylesheet token must be a string');
6019
+ if ((hasStyleToken && !isValidScopeToken(stylesheetToken)) ||
6020
+ (hasLegacyToken && !isValidScopeToken(legacyStylesheetToken))) {
6021
+ throw new Error('stylesheet token must be a valid string');
6016
6022
  }
6017
6023
  // If legacy stylesheet tokens are required, then add them to the rendered string
6018
6024
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
@@ -8136,5 +8142,5 @@ exports.swapTemplate = swapTemplate;
8136
8142
  exports.track = track;
8137
8143
  exports.unwrap = unwrap;
8138
8144
  exports.wire = wire;
8139
- /** version: 8.0.0-alpha.1 */
8145
+ /** version: 8.0.0 */
8140
8146
  //# sourceMappingURL=index.cjs.js.map