@lwc/template-compiler 3.1.2 → 4.0.0-alpha.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, Element, Expression, ComplexExpression, Literal, LWCDirectiveRenderMode, Root, EventListener, RefDirective } 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
@@ -3889,8 +3889,10 @@ function shouldFlatten(codeGen, children) {
3889
3889
  return (
3890
3890
  // ForBlock will generate a list of iterable vnodes
3891
3891
  isForBlock(child) ||
3892
- // light DOM slots
3893
- (isSlot(child) && codeGen.renderMode === exports.LWCDirectiveRenderMode.light) ||
3892
+ // light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
3893
+ (!shared.isAPIFeatureEnabled(2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */, codeGen.apiVersion) &&
3894
+ isSlot(child) &&
3895
+ codeGen.renderMode === exports.LWCDirectiveRenderMode.light) ||
3894
3896
  // If node is only a control flow node and does not map to a stand alone element.
3895
3897
  // Search children to determine if it should be flattened.
3896
3898
  (isIf(child) && shouldFlatten(codeGen, child.children)));
@@ -4377,6 +4379,7 @@ class CodeGen {
4377
4379
  this.scopeFragmentId = scopeFragmentId;
4378
4380
  this.scope = this.createScope();
4379
4381
  this.state = state;
4382
+ this.apiVersion = shared.getAPIVersionFromNumber(state.config.apiVersion);
4380
4383
  }
4381
4384
  generateKey() {
4382
4385
  return this.currentKey++;
@@ -5365,5 +5368,5 @@ function compile(source, config) {
5365
5368
  exports.compile = compile;
5366
5369
  exports.default = compile;
5367
5370
  exports.parse = parse;
5368
- /** version: 3.1.2 */
5371
+ /** version: 4.0.0-alpha.0 */
5369
5372
  //# sourceMappingURL=index.cjs.js.map