@lwc/template-compiler 2.7.1 → 2.7.2
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/dist/commonjs/codegen/codegen.js +3 -73
- package/dist/commonjs/codegen/codegen.js.map +1 -1
- package/dist/commonjs/codegen/helpers.js +20 -34
- package/dist/commonjs/codegen/helpers.js.map +1 -1
- package/dist/commonjs/codegen/index.js +192 -183
- package/dist/commonjs/codegen/index.js.map +1 -1
- package/dist/commonjs/codegen/scope.js +61 -0
- package/dist/commonjs/codegen/scope.js.map +1 -0
- package/dist/commonjs/index.js +5 -12
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/parser/attribute.js +3 -3
- package/dist/commonjs/parser/attribute.js.map +1 -1
- package/dist/commonjs/parser/constants.js +7 -1
- package/dist/commonjs/parser/constants.js.map +1 -1
- package/dist/commonjs/parser/expression.js +2 -5
- package/dist/commonjs/parser/expression.js.map +1 -1
- package/dist/commonjs/parser/html.js +1 -2
- package/dist/commonjs/parser/html.js.map +1 -1
- package/dist/commonjs/parser/index.js +337 -355
- package/dist/commonjs/parser/index.js.map +1 -1
- package/dist/commonjs/parser/parser.js +30 -85
- package/dist/commonjs/parser/parser.js.map +1 -1
- package/dist/commonjs/shared/ir.js +90 -0
- package/dist/commonjs/shared/ir.js.map +1 -0
- package/dist/commonjs/shared/parse5.js +15 -1
- package/dist/commonjs/shared/parse5.js.map +1 -1
- package/dist/commonjs/shared/types.js +7 -1
- package/dist/commonjs/shared/types.js.map +1 -1
- package/dist/types/codegen/codegen.d.ts +3 -25
- package/dist/types/codegen/helpers.d.ts +5 -11
- package/dist/types/codegen/index.d.ts +2 -2
- package/dist/types/codegen/scope.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/parser/attribute.d.ts +7 -7
- package/dist/types/parser/constants.d.ts +6 -0
- package/dist/types/parser/expression.d.ts +4 -3
- package/dist/types/parser/parser.d.ts +28 -57
- package/dist/types/shared/estree.d.ts +2 -0
- package/dist/types/shared/ir.d.ts +15 -0
- package/dist/types/shared/parse5.d.ts +1 -0
- package/dist/types/shared/types.d.ts +86 -129
- package/package.json +5 -5
- package/dist/commonjs/shared/ast.js +0 -303
- package/dist/commonjs/shared/ast.js.map +0 -1
- package/dist/types/shared/ast.d.ts +0 -45
|
@@ -11,10 +11,16 @@ export declare const LWC_DIRECTIVES: {
|
|
|
11
11
|
INNER_HTML: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const LWC_DIRECTIVE_SET: Set<string>;
|
|
14
|
+
export declare const FOR_DIRECTIVES: {
|
|
15
|
+
FOR_EACH: string;
|
|
16
|
+
FOR_ITEM: string;
|
|
17
|
+
FOR_INDEX: string;
|
|
18
|
+
};
|
|
14
19
|
export declare const ROOT_TEMPLATE_DIRECTIVES: {
|
|
15
20
|
PRESERVE_COMMENTS: string;
|
|
16
21
|
RENDER_MODE: string;
|
|
17
22
|
};
|
|
23
|
+
export declare const ROOT_TEMPLATE_DIRECTIVES_SET: Set<string>;
|
|
18
24
|
export declare const ID_REFERENCING_ATTRIBUTES_SET: Set<string>;
|
|
19
25
|
export declare const DATA_RE: RegExp;
|
|
20
26
|
export declare const SUPPORTED_SVG_TAGS: Set<string>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Location } from 'parse5';
|
|
2
|
+
import { TemplateExpression, TemplateIdentifier } from '../shared/types';
|
|
1
3
|
import ParserCtx from './parser';
|
|
2
|
-
import { Expression, Identifier, SourceLocation } from '../shared/types';
|
|
3
4
|
export declare const EXPRESSION_SYMBOL_START = "{";
|
|
4
5
|
export declare const EXPRESSION_SYMBOL_END = "}";
|
|
5
6
|
export declare function isExpression(source: string): boolean;
|
|
6
7
|
export declare function isPotentialExpression(source: string): boolean;
|
|
7
|
-
export declare function parseExpression(ctx: ParserCtx, source: string, location:
|
|
8
|
-
export declare function parseIdentifier(ctx: ParserCtx, source: string, location:
|
|
8
|
+
export declare function parseExpression(ctx: ParserCtx, source: string, location: Location): TemplateExpression;
|
|
9
|
+
export declare function parseIdentifier(ctx: ParserCtx, source: string, location: Location): TemplateIdentifier;
|
|
@@ -1,59 +1,28 @@
|
|
|
1
|
+
import * as parse5 from 'parse5';
|
|
1
2
|
import { CompilerDiagnostic, LWCErrorInfo } from '@lwc/errors';
|
|
3
|
+
import { IRElement, LWCDirectiveRenderMode, IRBaseAttribute, IRNode } from '../shared/types';
|
|
2
4
|
import { ResolvedConfig } from '../config';
|
|
3
|
-
import { Root, SourceLocation, ParentNode, BaseNode, LWCDirectiveRenderMode } from '../shared/types';
|
|
4
|
-
interface ParentWrapper {
|
|
5
|
-
parent: ParentNode | null;
|
|
6
|
-
current: ParentNode;
|
|
7
|
-
}
|
|
8
5
|
export default class ParserCtx {
|
|
9
6
|
private readonly source;
|
|
10
7
|
readonly config: ResolvedConfig;
|
|
11
8
|
readonly warnings: CompilerDiagnostic[];
|
|
12
9
|
readonly seenIds: Set<string>;
|
|
13
10
|
readonly seenSlots: Set<string>;
|
|
14
|
-
|
|
15
|
-
* Scopes keep track of the hierarchy of ParentNodes as the parser traverses the parse5 AST.
|
|
16
|
-
* Each scope is represented by an array where each node in the array correspond to either
|
|
17
|
-
* a ForEach, ForOf, If, Element, Component, or Slot.
|
|
18
|
-
*
|
|
19
|
-
* Currently, each scope has a hierarchy of ForBlock > IfBlock > Element | Component | Slot.
|
|
20
|
-
* Note: Not all scopes will have all three, but when they do, they will appear in this order.
|
|
21
|
-
* We do not keep track of template nodes.
|
|
22
|
-
*
|
|
23
|
-
* Each scope corresponds to the original parse5.Element node.
|
|
24
|
-
*/
|
|
25
|
-
private readonly scopes;
|
|
26
|
-
renderMode: LWCDirectiveRenderMode;
|
|
27
|
-
preserveComments: boolean;
|
|
11
|
+
readonly parentStack: IRElement[];
|
|
28
12
|
constructor(source: String, config: ResolvedConfig);
|
|
29
13
|
getSource(start: number, end: number): string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* @param {function} traversalCond - This callback is called after predicate and will terminate the traversal if it returns false.
|
|
43
|
-
* traversalCond is ignored if no value is provided.
|
|
44
|
-
*/
|
|
45
|
-
findAncestor<A extends ParentNode>(predicate: (node: ParentNode) => node is A, traversalCond?: (nodes: ParentWrapper) => unknown, startNode?: ParentNode): A | null;
|
|
46
|
-
/**
|
|
47
|
-
* This method searchs the current scope and returns the value that satisfies the predicate.
|
|
48
|
-
*
|
|
49
|
-
* @param {function} predicate - This callback is called once for each sibling in the current scope
|
|
50
|
-
* until it finds one where predicate returns true.
|
|
51
|
-
*/
|
|
52
|
-
findSibling<A extends ParentNode>(predicate: (node: ParentNode) => node is A): A | null;
|
|
53
|
-
beginScope(): void;
|
|
54
|
-
endScope(): void;
|
|
55
|
-
addNodeCurrentScope(node: ParentNode): void;
|
|
56
|
-
private currentScope;
|
|
14
|
+
ancestors(element?: IRElement): Generator<{
|
|
15
|
+
current: IRElement;
|
|
16
|
+
index: number;
|
|
17
|
+
}, void, unknown>;
|
|
18
|
+
findAncestor(args: {
|
|
19
|
+
element?: IRElement;
|
|
20
|
+
predicate: (elm: IRElement) => unknown;
|
|
21
|
+
traversalCond?: (nodes: {
|
|
22
|
+
current: IRElement;
|
|
23
|
+
parent: IRElement | null;
|
|
24
|
+
}) => unknown;
|
|
25
|
+
}): IRElement | null;
|
|
57
26
|
/**
|
|
58
27
|
* This method recovers from diagnostic errors that are encountered when fn is invoked.
|
|
59
28
|
* All other errors are considered compiler errors and can not be recovered from.
|
|
@@ -61,32 +30,34 @@ export default class ParserCtx {
|
|
|
61
30
|
* @param fn - method to be invoked.
|
|
62
31
|
*/
|
|
63
32
|
withErrorRecovery<T>(fn: () => T): T | undefined;
|
|
64
|
-
withErrorWrapping<T>(fn: () => T, errorInfo: LWCErrorInfo, location:
|
|
65
|
-
throwOnError(errorInfo: LWCErrorInfo, error: any, location?:
|
|
33
|
+
withErrorWrapping<T>(fn: () => T, errorInfo: LWCErrorInfo, location: parse5.Location, msgFormatter?: (error: any) => string): T;
|
|
34
|
+
throwOnError(errorInfo: LWCErrorInfo, error: any, location?: parse5.Location): never;
|
|
66
35
|
/**
|
|
67
|
-
* This method throws a diagnostic error with the
|
|
36
|
+
* This method throws a diagnostic error with the IRNode's location.
|
|
68
37
|
*/
|
|
69
|
-
|
|
38
|
+
throwOnIRNode(errorInfo: LWCErrorInfo, irNode: IRNode | IRBaseAttribute, messageArgs?: any[]): never;
|
|
70
39
|
/**
|
|
71
40
|
* This method throws a diagnostic error with location information.
|
|
72
41
|
*/
|
|
73
|
-
throwAtLocation(errorInfo: LWCErrorInfo, location:
|
|
42
|
+
throwAtLocation(errorInfo: LWCErrorInfo, location: parse5.Location, messageArgs?: any[]): never;
|
|
74
43
|
/**
|
|
75
44
|
* This method throws a diagnostic error and will immediately exit the current routine.
|
|
76
45
|
*/
|
|
77
|
-
throw(errorInfo: LWCErrorInfo, messageArgs?: any[], location?:
|
|
46
|
+
throw(errorInfo: LWCErrorInfo, messageArgs?: any[], location?: parse5.Location): never;
|
|
78
47
|
/**
|
|
79
|
-
* This method logs a diagnostic warning with the
|
|
48
|
+
* This method logs a diagnostic warning with the IRNode's location.
|
|
80
49
|
*/
|
|
81
|
-
|
|
50
|
+
warnOnIRNode(errorInfo: LWCErrorInfo, irNode: IRNode | IRBaseAttribute, messageArgs?: any[]): void;
|
|
82
51
|
/**
|
|
83
52
|
* This method logs a diagnostic warning with location information.
|
|
84
53
|
*/
|
|
85
|
-
warnAtLocation(errorInfo: LWCErrorInfo, location:
|
|
54
|
+
warnAtLocation(errorInfo: LWCErrorInfo, location: parse5.Location, messageArgs?: any[]): void;
|
|
86
55
|
/**
|
|
87
56
|
* This method logs a diagnostic warning and will continue execution of the current routine.
|
|
88
57
|
*/
|
|
89
|
-
warn(errorInfo: LWCErrorInfo, messageArgs?: any[], location?:
|
|
58
|
+
warn(errorInfo: LWCErrorInfo, messageArgs?: any[], location?: parse5.Location): void;
|
|
90
59
|
private addDiagnostic;
|
|
60
|
+
getRoot(element: IRElement): IRElement;
|
|
61
|
+
getRenderMode(element: IRElement): LWCDirectiveRenderMode;
|
|
62
|
+
getPreserveComments(element: IRElement): boolean;
|
|
91
63
|
}
|
|
92
|
-
export {};
|
|
@@ -52,6 +52,8 @@ export declare type BlockStatement = t.BlockStatement;
|
|
|
52
52
|
export declare type ReturnStatement = t.ReturnStatement;
|
|
53
53
|
export declare type VariableDeclarator = t.VariableDeclarator;
|
|
54
54
|
export declare type VariableDeclaration = t.VariableDeclaration;
|
|
55
|
+
export declare type TemplateLiteral = t.TemplateLiteral;
|
|
56
|
+
export declare type TemplateElement = t.TemplateElement;
|
|
55
57
|
export declare type ImportDeclaration = t.ImportDeclaration;
|
|
56
58
|
export declare type ImportDefaultSpecifier = t.ImportDefaultSpecifier;
|
|
57
59
|
export declare type ImportSpecifier = t.ImportSpecifier;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as parse5 from 'parse5';
|
|
2
|
+
import { TemplateIdentifier, TemplateExpression, IRNode, IRText, IRElement, IRComment, IRAttribute, IRExpressionAttribute, IRStringAttribute, IRBooleanAttribute } from './types';
|
|
3
|
+
export declare function createElement(original: parse5.Element, location: parse5.ElementLocation): IRElement;
|
|
4
|
+
export declare function createText(value: string | TemplateExpression, location: parse5.Location): IRText;
|
|
5
|
+
export declare function createComment(value: string, location: parse5.Location): IRComment;
|
|
6
|
+
export declare function isElement(node: IRNode): node is IRElement;
|
|
7
|
+
export declare function isTextNode(node: IRNode): node is IRText;
|
|
8
|
+
export declare function isCommentNode(node: IRNode): node is IRComment;
|
|
9
|
+
export declare function isCustomElement(node: IRNode): boolean;
|
|
10
|
+
export declare function isTemplate(element: IRElement): boolean;
|
|
11
|
+
export declare function isSlot(element: IRElement): boolean;
|
|
12
|
+
export declare function isIRExpressionAttribute(attribute: IRAttribute): attribute is IRExpressionAttribute;
|
|
13
|
+
export declare function isIRStringAttribute(attribute: IRAttribute): attribute is IRStringAttribute;
|
|
14
|
+
export declare function isIRBooleanAttribute(attribute: IRAttribute): attribute is IRBooleanAttribute;
|
|
15
|
+
export declare function isComponentProp(identifier: TemplateIdentifier, root: IRNode, parentStack: IRNode[]): boolean;
|
|
@@ -3,3 +3,4 @@ export declare function isElementNode(node: parse5.Node): node is parse5.Element
|
|
|
3
3
|
export declare function isCommentNode(node: parse5.Node): node is parse5.CommentNode;
|
|
4
4
|
export declare function isTextNode(node: parse5.Node): node is parse5.TextNode;
|
|
5
5
|
export declare function getTemplateContent(templateElement: parse5.Element): parse5.DocumentFragment | undefined;
|
|
6
|
+
export declare function createEmptyElementLocation(): parse5.ElementLocation;
|
|
@@ -1,12 +1,36 @@
|
|
|
1
|
+
import * as parse5 from 'parse5';
|
|
1
2
|
import { CompilerDiagnostic } from '@lwc/errors';
|
|
3
|
+
export declare type TemplateIdentifier = {
|
|
4
|
+
type: 'Identifier';
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type TemplateExpression = {
|
|
8
|
+
type: 'MemberExpression';
|
|
9
|
+
object: TemplateExpression;
|
|
10
|
+
property: TemplateExpression;
|
|
11
|
+
computed: boolean;
|
|
12
|
+
optional: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'Literal';
|
|
15
|
+
value: string | number | boolean | null;
|
|
16
|
+
} | TemplateIdentifier;
|
|
2
17
|
export declare type TemplateCompileResult = {
|
|
3
18
|
code: string;
|
|
4
19
|
warnings: CompilerDiagnostic[];
|
|
5
20
|
};
|
|
6
21
|
export declare type TemplateParseResult = {
|
|
7
|
-
root?:
|
|
22
|
+
root?: IRElement | undefined;
|
|
8
23
|
warnings: CompilerDiagnostic[];
|
|
9
24
|
};
|
|
25
|
+
export interface ForEach {
|
|
26
|
+
expression: TemplateExpression;
|
|
27
|
+
item: TemplateIdentifier;
|
|
28
|
+
index?: TemplateIdentifier;
|
|
29
|
+
}
|
|
30
|
+
export interface ForIterator {
|
|
31
|
+
expression: TemplateExpression;
|
|
32
|
+
iterator: TemplateIdentifier;
|
|
33
|
+
}
|
|
10
34
|
export declare enum LWCDirectiveDomMode {
|
|
11
35
|
manual = "manual"
|
|
12
36
|
}
|
|
@@ -14,141 +38,74 @@ export declare enum LWCDirectiveRenderMode {
|
|
|
14
38
|
shadow = "shadow",
|
|
15
39
|
light = "light"
|
|
16
40
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
location: SourceLocation;
|
|
20
|
-
}
|
|
21
|
-
export interface SourceLocation {
|
|
22
|
-
startLine: number;
|
|
23
|
-
startColumn: number;
|
|
24
|
-
endLine: number;
|
|
25
|
-
endColumn: number;
|
|
26
|
-
start: number;
|
|
27
|
-
end: number;
|
|
28
|
-
}
|
|
29
|
-
export interface ElementSourceLocation extends SourceLocation {
|
|
30
|
-
startTag: SourceLocation;
|
|
31
|
-
endTag?: SourceLocation;
|
|
32
|
-
}
|
|
33
|
-
export interface Literal<Value = string | boolean> {
|
|
34
|
-
type: 'Literal';
|
|
35
|
-
value: Value;
|
|
36
|
-
}
|
|
37
|
-
export interface Identifier extends BaseNode {
|
|
38
|
-
type: 'Identifier';
|
|
39
|
-
name: string;
|
|
40
|
-
}
|
|
41
|
-
export interface MemberExpression extends BaseNode {
|
|
42
|
-
type: 'MemberExpression';
|
|
43
|
-
object: Expression;
|
|
44
|
-
property: Identifier;
|
|
45
|
-
}
|
|
46
|
-
export declare type Expression = Identifier | MemberExpression;
|
|
47
|
-
export interface Attribute extends BaseNode {
|
|
48
|
-
type: 'Attribute';
|
|
49
|
-
name: string;
|
|
50
|
-
value: Literal | Expression;
|
|
51
|
-
}
|
|
52
|
-
export interface Property extends BaseNode {
|
|
53
|
-
type: 'Property';
|
|
54
|
-
name: string;
|
|
55
|
-
attributeName: string;
|
|
56
|
-
value: Literal | Expression;
|
|
57
|
-
}
|
|
58
|
-
export interface EventListener extends BaseNode {
|
|
59
|
-
type: 'EventListener';
|
|
60
|
-
name: string;
|
|
61
|
-
handler: Expression;
|
|
62
|
-
}
|
|
63
|
-
export interface Directive extends BaseNode {
|
|
64
|
-
type: 'Directive';
|
|
65
|
-
name: string;
|
|
66
|
-
value: Expression | Literal;
|
|
67
|
-
}
|
|
68
|
-
export interface KeyDirective extends Directive {
|
|
69
|
-
name: 'Key';
|
|
70
|
-
value: Expression;
|
|
71
|
-
}
|
|
72
|
-
export interface DynamicDirective extends Directive {
|
|
73
|
-
name: 'Dynamic';
|
|
74
|
-
value: Expression;
|
|
75
|
-
}
|
|
76
|
-
export interface DomDirective extends Directive {
|
|
77
|
-
name: 'Dom';
|
|
78
|
-
value: Literal<'manual'>;
|
|
79
|
-
}
|
|
80
|
-
export interface InnerHTMLDirective extends Directive {
|
|
81
|
-
name: `InnerHTML`;
|
|
82
|
-
value: Expression | Literal<string>;
|
|
41
|
+
export interface LWCDirectiveDynamic {
|
|
42
|
+
prop: string;
|
|
83
43
|
}
|
|
84
|
-
export interface
|
|
85
|
-
|
|
86
|
-
|
|
44
|
+
export interface LWCDirectives {
|
|
45
|
+
dom?: LWCDirectiveDomMode;
|
|
46
|
+
dynamic?: TemplateExpression;
|
|
47
|
+
renderMode?: LWCDirectiveRenderMode;
|
|
48
|
+
preserveComments?: IRBooleanAttribute;
|
|
49
|
+
innerHTML?: TemplateExpression | string;
|
|
87
50
|
}
|
|
88
|
-
export interface
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
51
|
+
export interface IRBaseNode<N extends parse5.Node> {
|
|
52
|
+
type: string;
|
|
53
|
+
location: parse5.Location;
|
|
54
|
+
__original?: N;
|
|
55
|
+
}
|
|
56
|
+
export interface IRElement extends IRBaseNode<parse5.Element> {
|
|
57
|
+
type: 'element';
|
|
58
|
+
tag: string;
|
|
59
|
+
namespace: string;
|
|
60
|
+
children: IRNode[];
|
|
61
|
+
location: parse5.ElementLocation;
|
|
62
|
+
component?: string;
|
|
63
|
+
on?: {
|
|
64
|
+
[name: string]: TemplateExpression;
|
|
65
|
+
};
|
|
66
|
+
attrs?: {
|
|
67
|
+
[name: string]: IRAttribute;
|
|
68
|
+
};
|
|
69
|
+
props?: {
|
|
70
|
+
[name: string]: IRAttribute;
|
|
71
|
+
};
|
|
72
|
+
if?: TemplateExpression;
|
|
73
|
+
ifModifier?: string;
|
|
74
|
+
forEach?: ForEach;
|
|
75
|
+
forOf?: ForIterator;
|
|
76
|
+
forKey?: TemplateExpression;
|
|
77
|
+
lwc?: LWCDirectives;
|
|
78
|
+
slotName?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface IRText extends IRBaseNode<parse5.TextNode> {
|
|
81
|
+
type: 'text';
|
|
82
|
+
value: string | TemplateExpression;
|
|
83
|
+
}
|
|
84
|
+
export interface IRComment extends IRBaseNode<parse5.CommentNode> {
|
|
85
|
+
type: 'comment';
|
|
100
86
|
value: string;
|
|
101
87
|
}
|
|
102
|
-
export
|
|
103
|
-
|
|
88
|
+
export declare type IRNode = IRComment | IRElement | IRText;
|
|
89
|
+
export declare enum IRAttributeType {
|
|
90
|
+
Expression = 0,
|
|
91
|
+
String = 1,
|
|
92
|
+
Boolean = 2
|
|
104
93
|
}
|
|
105
|
-
export interface
|
|
94
|
+
export interface IRBaseAttribute {
|
|
106
95
|
name: string;
|
|
107
|
-
location:
|
|
108
|
-
|
|
109
|
-
attributes: Attribute[];
|
|
110
|
-
listeners: EventListener[];
|
|
111
|
-
directives: ElementDirective[];
|
|
112
|
-
namespace?: string;
|
|
113
|
-
}
|
|
114
|
-
export interface Element extends AbstractBaseElement {
|
|
115
|
-
type: 'Element';
|
|
116
|
-
}
|
|
117
|
-
export interface Component extends AbstractBaseElement {
|
|
118
|
-
type: 'Component';
|
|
96
|
+
location: parse5.Location;
|
|
97
|
+
type: IRAttributeType;
|
|
119
98
|
}
|
|
120
|
-
export interface
|
|
121
|
-
type:
|
|
122
|
-
|
|
123
|
-
slotName: string;
|
|
99
|
+
export interface IRExpressionAttribute extends IRBaseAttribute {
|
|
100
|
+
type: IRAttributeType.Expression;
|
|
101
|
+
value: TemplateExpression;
|
|
124
102
|
}
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
location: ElementSourceLocation;
|
|
129
|
-
directives: RootDirective[];
|
|
130
|
-
}
|
|
131
|
-
interface DirectiveParentNode extends BaseParentNode {
|
|
132
|
-
directiveLocation: SourceLocation;
|
|
133
|
-
}
|
|
134
|
-
export interface If extends DirectiveParentNode {
|
|
135
|
-
type: 'If';
|
|
136
|
-
modifier: string;
|
|
137
|
-
condition: Expression;
|
|
138
|
-
}
|
|
139
|
-
export interface ForEach extends DirectiveParentNode {
|
|
140
|
-
type: 'ForEach';
|
|
141
|
-
expression: Expression;
|
|
142
|
-
item: Identifier;
|
|
143
|
-
index?: Identifier;
|
|
103
|
+
export interface IRStringAttribute extends IRBaseAttribute {
|
|
104
|
+
type: IRAttributeType.String;
|
|
105
|
+
value: string;
|
|
144
106
|
}
|
|
145
|
-
export interface
|
|
146
|
-
type:
|
|
147
|
-
|
|
148
|
-
iterator: Identifier;
|
|
107
|
+
export interface IRBooleanAttribute extends IRBaseAttribute {
|
|
108
|
+
type: IRAttributeType.Boolean;
|
|
109
|
+
value: true;
|
|
149
110
|
}
|
|
150
|
-
export declare type
|
|
151
|
-
export declare type ParentNode = Root | ForBlock | If | BaseElement;
|
|
152
|
-
export declare type ChildNode = ForBlock | If | BaseElement | Comment | Text;
|
|
153
|
-
export declare type Node = Root | ForBlock | If | BaseElement | Comment | Text;
|
|
154
|
-
export {};
|
|
111
|
+
export declare type IRAttribute = IRStringAttribute | IRExpressionAttribute | IRBooleanAttribute;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/template-compiler",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Template compiler package",
|
|
5
5
|
"homepage": "https://lwc.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"//": "Currently can't upgrade estree-walker to v3.0.0 because it dropped CommonJS support: https://git.io/JXguS",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@lwc/errors": "2.7.
|
|
29
|
-
"@lwc/shared": "2.7.
|
|
30
|
-
"acorn": "~8.
|
|
28
|
+
"@lwc/errors": "2.7.2",
|
|
29
|
+
"@lwc/shared": "2.7.2",
|
|
30
|
+
"acorn": "~8.7.0",
|
|
31
31
|
"astring": "~1.8.1",
|
|
32
32
|
"estree-walker": "~2.0.2",
|
|
33
33
|
"he": "~1.2.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "f668a3ad36bbebbaa33a5863408a45bf4185d218"
|
|
43
43
|
}
|