@lwc/template-compiler 8.11.0 → 8.12.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/README.md CHANGED
@@ -45,26 +45,26 @@ const { code, warnings } = compile(`<template><h1>Hello World!</h1></template>`,
45
45
 
46
46
  **Parameters:**
47
47
 
48
- - `source` (string, required) - the HTML template source to compile.
49
- - `filename` (string, required) - the source filename with extension.
50
- - `options` (object, required) - the options to used to compile the HTML template source.
48
+ - `source` (string, required) - the HTML template source to compile.
49
+ - `filename` (string, required) - the source filename with extension.
50
+ - `options` (object, required) - the options to used to compile the HTML template source.
51
51
 
52
52
  **Options:**
53
53
 
54
- - `name` (type: `string`, optional, `undefined` by default) - name of the component, e.g. `foo` in `x/foo`.
55
- - `namespace` (type: `string`, optional, `undefined` by default) - namespace of the component, e.g. `x` in `x/foo`.
56
- - `experimentalComputedMemberExpression` (boolean, optional, `false` by default) - set to `true` to enable computed member expression in the template, eg: `{list[0].name}`.
57
- - `experimentalComplexExpressions` (boolean, optional, `false` by default) - set to `true` to enable use of (a subset of) JavaScript expressions in place of template bindings.
58
- - `experimentalDynamicDirective` (boolean, optional, `false` by default) - set to `true` to allow the usage of `lwc:dynamic` directives in the template.
59
- - `enableDynamicComponents` (boolean, optional, `false` by default) - set to `true` to enable `lwc:is` directive in the template.
60
- - `preserveHtmlComments` (boolean, optional, `false` by default) - set to `true` to disable the default behavior of stripping HTML comments.
61
- - `enableStaticContentOptimization` (boolean, optional, `true` by default) - set to `false` to disable static content optimizations.
62
- - `enableLwcSpread` (boolean, optional, `true` by default) - Deprecated. Ignored by template-compiler. `lwc:spread` is always enabled.
63
- - `customRendererConfig` (CustomRendererConfig, optional) - specifies a configuration to use to match elements. Matched elements will get a custom renderer hook in the generated template.
64
- - `instrumentation` (InstrumentationObject, optional) - instrumentation object to gather metrics and non-error logs for internal use. See the `@lwc/errors` package for details on the interface.
65
- - `disableSyntheticShadowSupport` (type: `boolean`, default: `false`) - Set to true if synthetic shadow DOM support is not needed, which can result in smaller/faster output.
66
-
67
- - Example 1: Config to match `<use>` elements under the `svg` namespace and have `href` attribute set.
54
+ - `name` (type: `string`, optional, `undefined` by default) - name of the component, e.g. `foo` in `x/foo`.
55
+ - `namespace` (type: `string`, optional, `undefined` by default) - namespace of the component, e.g. `x` in `x/foo`.
56
+ - `experimentalComputedMemberExpression` (boolean, optional, `false` by default) - set to `true` to enable computed member expression in the template, eg: `{list[0].name}`.
57
+ - `experimentalComplexExpressions` (boolean, optional, `false` by default) - set to `true` to enable use of (a subset of) JavaScript expressions in place of template bindings.
58
+ - `experimentalDynamicDirective` (boolean, optional, `false` by default) - set to `true` to allow the usage of `lwc:dynamic` directives in the template.
59
+ - `enableDynamicComponents` (boolean, optional, `false` by default) - set to `true` to enable `lwc:is` directive in the template.
60
+ - `preserveHtmlComments` (boolean, optional, `false` by default) - set to `true` to disable the default behavior of stripping HTML comments.
61
+ - `enableStaticContentOptimization` (boolean, optional, `true` by default) - set to `false` to disable static content optimizations.
62
+ - `enableLwcSpread` (boolean, optional, `true` by default) - Deprecated. Ignored by template-compiler. `lwc:spread` is always enabled.
63
+ - `customRendererConfig` (CustomRendererConfig, optional) - specifies a configuration to use to match elements. Matched elements will get a custom renderer hook in the generated template.
64
+ - `instrumentation` (InstrumentationObject, optional) - instrumentation object to gather metrics and non-error logs for internal use. See the `@lwc/errors` package for details on the interface.
65
+ - `disableSyntheticShadowSupport` (type: `boolean`, default: `false`) - Set to true if synthetic shadow DOM support is not needed, which can result in smaller/faster output.
66
+
67
+ - Example 1: Config to match `<use>` elements under the `svg` namespace and have `href` attribute set.
68
68
 
69
69
  ```
70
70
  {
@@ -81,7 +81,7 @@ const { code, warnings } = compile(`<template><h1>Hello World!</h1></template>`,
81
81
  }
82
82
  ```
83
83
 
84
- - Example 2: Config to match `<script>` elements regardless of the attribute set. _Note:_ When `attributes` is not specified, attribute matching is skipped.
84
+ - Example 2: Config to match `<script>` elements regardless of the attribute set. _Note:_ When `attributes` is not specified, attribute matching is skipped.
85
85
  ```
86
86
  {
87
87
  customRendererConfig: {
@@ -95,14 +95,14 @@ const { code, warnings } = compile(`<template><h1>Hello World!</h1></template>`,
95
95
  }
96
96
  ```
97
97
 
98
- - `apiVersion` (type: `number`, optional) - API version to associate with the compiled template.
98
+ - `apiVersion` (type: `number`, optional) - API version to associate with the compiled template.
99
99
 
100
100
  **Return:**
101
101
  The method returns an object with the following fields:
102
102
 
103
- - `code` (string) - the compiled template.
104
- - `warnings` (array) - the list of warnings produced when compiling the template. Each warning has the following fields:
105
- - message (string) - the warning message.
106
- - level (string) - the severity of the warning: `info`, `warning`, `error`.
107
- - start (number) - the start index in the source code producing the warning.
108
- - length (number) - the character length in the source code producing the warning.
103
+ - `code` (string) - the compiled template.
104
+ - `warnings` (array) - the list of warnings produced when compiling the template. Each warning has the following fields:
105
+ - message (string) - the warning message.
106
+ - level (string) - the severity of the warning: `info`, `warning`, `error`.
107
+ - start (number) - the start index in the source code producing the warning.
108
+ - length (number) - the character length in the source code producing the warning.
package/dist/index.cjs.js CHANGED
@@ -12229,9 +12229,12 @@ function parseScopedSlotFragment(ctx, parse5Elm, parse5ElmLocation, parent, pars
12229
12229
  if (ctx.findInCurrentElementScope(isElementDirective)) {
12230
12230
  ctx.throwAtLocation(errors.ParserDiagnostics.SCOPED_SLOTDATA_CANNOT_BE_COMBINED_WITH_OTHER_DIRECTIVE, sourceLocation(parse5ElmLocation));
12231
12231
  }
12232
+ function isComponentOrLwcComponent(node) {
12233
+ return isComponent(node) || isLwcComponent(node);
12234
+ }
12232
12235
  // <template lwc:slot-data> element should always be the direct child of a custom element
12233
12236
  // The only exception is, a conditional block as parent
12234
- const parentCmp = ctx.findAncestor(isComponent, ({ current }) => current && isConditionalBlock(current));
12237
+ const parentCmp = ctx.findAncestor(isComponentOrLwcComponent, ({ current }) => current && isConditionalBlock(current));
12235
12238
  if (!parentCmp) {
12236
12239
  ctx.throwAtLocation(errors.ParserDiagnostics.INVALID_PARENT_OF_LWC_SLOT_DATA, sourceLocation(parse5ElmLocation));
12237
12240
  }
@@ -14711,5 +14714,5 @@ exports.generateScopeTokens = generateScopeTokens;
14711
14714
  exports.kebabcaseToCamelcase = kebabcaseToCamelcase;
14712
14715
  exports.parse = parse;
14713
14716
  exports.toPropertyName = toPropertyName;
14714
- /** version: 8.11.0 */
14717
+ /** version: 8.12.0 */
14715
14718
  //# sourceMappingURL=index.cjs.js.map