@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.js CHANGED
@@ -5798,6 +5798,12 @@ function getVMBeingRendered() {
5798
5798
  function setVMBeingRendered(vm) {
5799
5799
  vmBeingRendered = vm;
5800
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
+ }
5801
5807
  function validateSlots(vm) {
5802
5808
  assertNotProd(); // this method should never leak to prod
5803
5809
  const { cmpSlots } = vm;
@@ -5968,6 +5974,11 @@ function buildParseFragmentFn(createFragmentFn) {
5968
5974
  return cached;
5969
5975
  }
5970
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
+ }
5971
5982
  // If legacy stylesheet tokens are required, then add them to the rendered string
5972
5983
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
5973
5984
  const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
@@ -7785,7 +7796,13 @@ function setHooks(hooks) {
7785
7796
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7786
7797
  */
7787
7798
  // See @lwc/engine-core/src/framework/template.ts
7788
- const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7799
+ const TEMPLATE_PROPS = [
7800
+ 'slots',
7801
+ 'stylesheetToken',
7802
+ 'stylesheets',
7803
+ 'renderMode',
7804
+ 'legacyStylesheetToken',
7805
+ ];
7789
7806
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7790
7807
  const STYLESHEET_PROPS = [
7791
7808
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
@@ -8035,5 +8052,5 @@ function readonly(obj) {
8035
8052
  }
8036
8053
 
8037
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 };
8038
- /** version: 7.1.3 */
8055
+ /** version: 7.1.4 */
8039
8056
  //# sourceMappingURL=index.js.map