@lwc/template-compiler 2.23.6 → 2.25.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.
@@ -59,36 +59,36 @@ export interface EventListener extends BaseNode {
59
59
  name: string;
60
60
  handler: Expression;
61
61
  }
62
- export interface Directive extends BaseNode {
62
+ export interface Directive<T extends keyof typeof ElementDirectiveName | keyof typeof RootDirectiveName> extends BaseNode {
63
63
  type: 'Directive';
64
- name: string;
64
+ name: T;
65
65
  value: Expression | Literal;
66
66
  }
67
- export interface KeyDirective extends Directive {
68
- name: 'Key';
67
+ export interface KeyDirective extends Directive<'Key'> {
69
68
  value: Expression;
70
69
  }
71
- export interface DynamicDirective extends Directive {
72
- name: 'Dynamic';
70
+ export interface DynamicDirective extends Directive<'Dynamic'> {
73
71
  value: Expression;
74
72
  }
75
- export interface DomDirective extends Directive {
76
- name: 'Dom';
73
+ export interface DomDirective extends Directive<'Dom'> {
77
74
  value: Literal<'manual'>;
78
75
  }
79
- export interface InnerHTMLDirective extends Directive {
80
- name: `InnerHTML`;
76
+ export interface SpreadDirective extends Directive<'Spread'> {
77
+ value: Expression;
78
+ }
79
+ export interface InnerHTMLDirective extends Directive<'InnerHTML'> {
81
80
  value: Expression | Literal<string>;
82
81
  }
83
- export interface RenderModeDirective extends Directive {
84
- name: 'RenderMode';
82
+ export interface RenderModeDirective extends Directive<'RenderMode'> {
85
83
  value: Literal<LWCDirectiveRenderMode>;
86
84
  }
87
- export interface PreserveCommentsDirective extends Directive {
88
- name: 'PreserveComments';
85
+ export interface PreserveCommentsDirective extends Directive<'PreserveComments'> {
89
86
  value: Literal<boolean>;
90
87
  }
91
- export declare type ElementDirective = KeyDirective | DynamicDirective | DomDirective | InnerHTMLDirective;
88
+ export interface RefDirective extends Directive<'Ref'> {
89
+ value: Literal<string>;
90
+ }
91
+ export declare type ElementDirective = KeyDirective | DynamicDirective | DomDirective | InnerHTMLDirective | RefDirective | SpreadDirective;
92
92
  export declare type RootDirective = RenderModeDirective | PreserveCommentsDirective;
93
93
  export interface Text extends BaseNode {
94
94
  type: 'Text';
@@ -132,11 +132,36 @@ export interface Root extends BaseParentNode {
132
132
  interface DirectiveParentNode extends BaseParentNode {
133
133
  directiveLocation: SourceLocation;
134
134
  }
135
+ /**
136
+ * Node representing the if:true and if:false directives
137
+ */
135
138
  export interface If extends DirectiveParentNode {
136
139
  type: 'If';
137
140
  modifier: string;
138
141
  condition: Expression;
139
142
  }
143
+ /**
144
+ * Node representing the lwc:if directive
145
+ */
146
+ export interface IfBlock extends DirectiveParentNode {
147
+ type: 'IfBlock';
148
+ condition: Expression;
149
+ else?: ElseifBlock | ElseBlock;
150
+ }
151
+ /**
152
+ * Node representing the lwc:elseif directive
153
+ */
154
+ export interface ElseifBlock extends DirectiveParentNode {
155
+ type: 'ElseifBlock';
156
+ condition: Expression;
157
+ else?: ElseifBlock | ElseBlock;
158
+ }
159
+ /**
160
+ * Node representing the lwc:else directive
161
+ */
162
+ export interface ElseBlock extends DirectiveParentNode {
163
+ type: 'ElseBlock';
164
+ }
140
165
  export interface ForEach extends DirectiveParentNode {
141
166
  type: 'ForEach';
142
167
  expression: Expression;
@@ -149,7 +174,19 @@ export interface ForOf extends DirectiveParentNode {
149
174
  iterator: Identifier;
150
175
  }
151
176
  export declare type ForBlock = ForEach | ForOf;
152
- export declare type ParentNode = Root | ForBlock | If | BaseElement;
153
- export declare type ChildNode = ForBlock | If | BaseElement | Comment | Text;
154
- export declare type Node = Root | ForBlock | If | BaseElement | Comment | Text;
177
+ export declare type ParentNode = Root | ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement;
178
+ export declare type ChildNode = ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement | Comment | Text;
179
+ export declare type Node = Root | ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement | Comment | Text;
180
+ export declare enum ElementDirectiveName {
181
+ Dom = "lwc:dom",
182
+ Dynamic = "lwc:dynamic",
183
+ InnerHTML = "lwc:inner-html",
184
+ Ref = "lwc:ref",
185
+ Spread = "lwc:spread",
186
+ Key = "key"
187
+ }
188
+ export declare enum RootDirectiveName {
189
+ PreserveComments = "lwc:preserve-comments",
190
+ RenderMode = "lwc:render-mode"
191
+ }
155
192
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/template-compiler",
3
- "version": "2.23.6",
3
+ "version": "2.25.0",
4
4
  "description": "Template compiler package",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "//": "Currently can't upgrade: estree-walker to v3.0.0 because it dropped CommonJS support: https://git.io/JXguS, parse5 dropped cjs support in v7.0.0 https://github.com/inikulin/parse5/releases/tag/v7.0.0",
27
27
  "dependencies": {
28
- "@lwc/errors": "2.23.6",
29
- "@lwc/shared": "2.23.6",
28
+ "@lwc/errors": "2.25.0",
29
+ "@lwc/shared": "2.25.0",
30
30
  "acorn": "~8.8.0",
31
31
  "astring": "~1.8.3",
32
32
  "estree-walker": "~2.0.2",