@lwc/template-compiler 3.8.0 → 4.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.
@@ -1,3 +1,4 @@
1
+ import { APIVersion } from '@lwc/shared';
1
2
  import * as t from '../shared/estree';
2
3
  import { ChildNode, Expression, ComplexExpression, Literal, LWCDirectiveRenderMode, Root, EventListener, RefDirective, StaticElement } from '../shared/types';
3
4
  import State from '../state';
@@ -45,6 +46,7 @@ export default class CodeGen {
45
46
  slotNames: Set<string>;
46
47
  memorizedIds: t.Identifier[];
47
48
  referencedComponents: Set<string>;
49
+ apiVersion: APIVersion;
48
50
  constructor({ root, state, scopeFragmentId, }: {
49
51
  root: Root;
50
52
  state: State;
package/dist/index.cjs.js CHANGED
@@ -12327,8 +12327,10 @@ function shouldFlatten(codeGen, children) {
12327
12327
  return (
12328
12328
  // ForBlock will generate a list of iterable vnodes
12329
12329
  isForBlock(child) ||
12330
- // light DOM slots
12331
- (isSlot(child) && codeGen.renderMode === exports.LWCDirectiveRenderMode.light) ||
12330
+ // light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
12331
+ (!shared.isAPIFeatureEnabled(2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */, codeGen.apiVersion) &&
12332
+ isSlot(child) &&
12333
+ codeGen.renderMode === exports.LWCDirectiveRenderMode.light) ||
12332
12334
  // If node is only a control flow node and does not map to a stand alone element.
12333
12335
  // Search children to determine if it should be flattened.
12334
12336
  (isIf(child) && shouldFlatten(codeGen, child.children)));
@@ -12811,6 +12813,7 @@ class CodeGen {
12811
12813
  this.scopeFragmentId = scopeFragmentId;
12812
12814
  this.scope = this.createScope();
12813
12815
  this.state = state;
12816
+ this.apiVersion = shared.getAPIVersionFromNumber(state.config.apiVersion);
12814
12817
  }
12815
12818
  generateKey() {
12816
12819
  return this.currentKey++;
@@ -13839,5 +13842,5 @@ function compile(source, config) {
13839
13842
  exports.compile = compile;
13840
13843
  exports.default = compile;
13841
13844
  exports.parse = parse;
13842
- /** version: 3.8.0 */
13845
+ /** version: 4.0.0 */
13843
13846
  //# sourceMappingURL=index.cjs.js.map