@lwc/template-compiler 2.26.0 → 2.27.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 +1 -0
- package/dist/commonjs/codegen/codegen.js +10 -0
- package/dist/commonjs/codegen/codegen.js.map +1 -1
- package/dist/commonjs/codegen/index.js +17 -0
- package/dist/commonjs/codegen/index.js.map +1 -1
- package/dist/commonjs/config.js +4 -2
- package/dist/commonjs/config.js.map +1 -1
- package/dist/commonjs/parser/index.js +150 -32
- package/dist/commonjs/parser/index.js.map +1 -1
- package/dist/commonjs/parser/parser.js +4 -0
- package/dist/commonjs/parser/parser.js.map +1 -1
- package/dist/commonjs/shared/ast.js +44 -3
- package/dist/commonjs/shared/ast.js.map +1 -1
- package/dist/commonjs/shared/renderer-hooks.js +3 -13
- package/dist/commonjs/shared/renderer-hooks.js.map +1 -1
- package/dist/commonjs/shared/types.js +13 -1
- package/dist/commonjs/shared/types.js.map +1 -1
- package/dist/types/codegen/codegen.d.ts +7 -0
- package/dist/types/config.d.ts +4 -0
- package/dist/types/parser/parser.d.ts +4 -0
- package/dist/types/shared/ast.d.ts +8 -2
- package/dist/types/shared/renderer-hooks.d.ts +1 -5
- package/dist/types/shared/types.d.ts +36 -17
- package/package.json +3 -3
|
@@ -88,7 +88,13 @@ export interface PreserveCommentsDirective extends Directive<'PreserveComments'>
|
|
|
88
88
|
export interface RefDirective extends Directive<'Ref'> {
|
|
89
89
|
value: Literal<string>;
|
|
90
90
|
}
|
|
91
|
-
export
|
|
91
|
+
export interface SlotBindDirective extends Directive<'SlotBind'> {
|
|
92
|
+
value: Expression;
|
|
93
|
+
}
|
|
94
|
+
export interface SlotDataDirective extends Directive<'SlotData'> {
|
|
95
|
+
value: Identifier;
|
|
96
|
+
}
|
|
97
|
+
export declare type ElementDirective = KeyDirective | DynamicDirective | DomDirective | InnerHTMLDirective | RefDirective | SlotBindDirective | SlotDataDirective | SpreadDirective;
|
|
92
98
|
export declare type RootDirective = RenderModeDirective | PreserveCommentsDirective;
|
|
93
99
|
export interface Text extends BaseNode {
|
|
94
100
|
type: 'Text';
|
|
@@ -129,59 +135,72 @@ export interface Root extends BaseParentNode {
|
|
|
129
135
|
location: ElementSourceLocation;
|
|
130
136
|
directives: RootDirective[];
|
|
131
137
|
}
|
|
132
|
-
|
|
138
|
+
export declare enum TemplateDirectiveName {
|
|
139
|
+
If = "if:true",
|
|
140
|
+
IfBlock = "lwc:if",
|
|
141
|
+
ElseifBlock = "lwc:elseif",
|
|
142
|
+
ElseBlock = "lwc:else",
|
|
143
|
+
ForEach = "for:each",
|
|
144
|
+
ForOf = "for:of",
|
|
145
|
+
ScopedSlotFragment = "lwc:slot-data"
|
|
146
|
+
}
|
|
147
|
+
interface DirectiveParentNode<T extends keyof typeof TemplateDirectiveName> extends BaseParentNode {
|
|
133
148
|
directiveLocation: SourceLocation;
|
|
149
|
+
type: T;
|
|
134
150
|
}
|
|
135
151
|
/**
|
|
136
152
|
* Node representing the if:true and if:false directives
|
|
137
153
|
*/
|
|
138
|
-
export interface If extends DirectiveParentNode {
|
|
139
|
-
type: 'If';
|
|
154
|
+
export interface If extends DirectiveParentNode<'If'> {
|
|
140
155
|
modifier: string;
|
|
141
156
|
condition: Expression;
|
|
142
157
|
}
|
|
143
158
|
/**
|
|
144
159
|
* Node representing the lwc:if directive
|
|
145
160
|
*/
|
|
146
|
-
export interface IfBlock extends DirectiveParentNode {
|
|
147
|
-
type: 'IfBlock';
|
|
161
|
+
export interface IfBlock extends DirectiveParentNode<'IfBlock'> {
|
|
148
162
|
condition: Expression;
|
|
149
163
|
else?: ElseifBlock | ElseBlock;
|
|
150
164
|
}
|
|
151
165
|
/**
|
|
152
166
|
* Node representing the lwc:elseif directive
|
|
153
167
|
*/
|
|
154
|
-
export interface ElseifBlock extends DirectiveParentNode {
|
|
155
|
-
type: 'ElseifBlock';
|
|
168
|
+
export interface ElseifBlock extends DirectiveParentNode<'ElseifBlock'> {
|
|
156
169
|
condition: Expression;
|
|
157
170
|
else?: ElseifBlock | ElseBlock;
|
|
158
171
|
}
|
|
159
172
|
/**
|
|
160
173
|
* Node representing the lwc:else directive
|
|
161
174
|
*/
|
|
162
|
-
export interface ElseBlock extends DirectiveParentNode {
|
|
163
|
-
type: 'ElseBlock';
|
|
175
|
+
export interface ElseBlock extends DirectiveParentNode<'ElseBlock'> {
|
|
164
176
|
}
|
|
165
|
-
export interface ForEach extends DirectiveParentNode {
|
|
166
|
-
type: 'ForEach';
|
|
177
|
+
export interface ForEach extends DirectiveParentNode<'ForEach'> {
|
|
167
178
|
expression: Expression;
|
|
168
179
|
item: Identifier;
|
|
169
180
|
index?: Identifier;
|
|
170
181
|
}
|
|
171
|
-
export interface ForOf extends DirectiveParentNode {
|
|
172
|
-
type: 'ForOf';
|
|
182
|
+
export interface ForOf extends DirectiveParentNode<'ForOf'> {
|
|
173
183
|
expression: Expression;
|
|
174
184
|
iterator: Identifier;
|
|
175
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Node representing lwc:slot-data directive
|
|
188
|
+
*/
|
|
189
|
+
export interface ScopedSlotFragment extends DirectiveParentNode<'ScopedSlotFragment'> {
|
|
190
|
+
slotData: SlotDataDirective;
|
|
191
|
+
slotName: Literal;
|
|
192
|
+
}
|
|
176
193
|
export declare type ForBlock = ForEach | ForOf;
|
|
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;
|
|
194
|
+
export declare type ParentNode = Root | ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement | ScopedSlotFragment;
|
|
195
|
+
export declare type ChildNode = ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement | Comment | Text | ScopedSlotFragment;
|
|
196
|
+
export declare type Node = Root | ForBlock | If | IfBlock | ElseifBlock | ElseBlock | BaseElement | Comment | Text | ScopedSlotFragment;
|
|
180
197
|
export declare enum ElementDirectiveName {
|
|
181
198
|
Dom = "lwc:dom",
|
|
182
199
|
Dynamic = "lwc:dynamic",
|
|
183
200
|
InnerHTML = "lwc:inner-html",
|
|
184
201
|
Ref = "lwc:ref",
|
|
202
|
+
SlotBind = "lwc:slot-bind",
|
|
203
|
+
SlotData = "lwc:slot-data",
|
|
185
204
|
Spread = "lwc:spread",
|
|
186
205
|
Key = "key"
|
|
187
206
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/template-compiler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.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.
|
|
29
|
-
"@lwc/shared": "2.
|
|
28
|
+
"@lwc/errors": "2.27.0",
|
|
29
|
+
"@lwc/shared": "2.27.0",
|
|
30
30
|
"acorn": "~8.8.0",
|
|
31
31
|
"astring": "~1.8.3",
|
|
32
32
|
"estree-walker": "~2.0.2",
|