@lwc/template-compiler 6.2.0 → 6.2.1
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/codegen/codegen.d.ts +8 -2
- package/dist/codegen/expression.d.ts +10 -8
- package/dist/codegen/formatters/module.d.ts +2 -1
- package/dist/codegen/helpers.d.ts +3 -0
- package/dist/codegen/optimize.d.ts +1 -0
- package/dist/config.d.ts +14 -13
- package/dist/index.cjs.js +88 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +88 -38
- package/dist/index.js.map +1 -1
- package/dist/parser/attribute.d.ts +1 -0
- package/dist/parser/expression-complex/html.d.ts +3 -5
- package/dist/parser/parser.d.ts +26 -8
- package/dist/shared/utils.d.ts +2 -0
- package/package.json +3 -3
|
@@ -18,6 +18,7 @@ export declare function isAttribute(element: BaseElement, attrName: string): boo
|
|
|
18
18
|
export declare function isValidHTMLAttribute(tagName: string, attrName: string): boolean;
|
|
19
19
|
/**
|
|
20
20
|
* Convert attribute name from kebab case to camel case property name
|
|
21
|
+
* @param attrName
|
|
21
22
|
*/
|
|
22
23
|
export declare function attributeToPropertyName(attrName: string): string;
|
|
23
24
|
export declare class ParsedAttribute {
|
|
@@ -9,11 +9,9 @@ interface ParseFragmentConfig {
|
|
|
9
9
|
/**
|
|
10
10
|
* Parse the LWC template using a customized parser & lexer that allow
|
|
11
11
|
* for template expressions to be parsed correctly.
|
|
12
|
-
*
|
|
13
|
-
* @param
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
16
|
-
* @return {DocumentFragment} the parsed document
|
|
12
|
+
* @param source raw template markup
|
|
13
|
+
* @param config
|
|
14
|
+
* @returns the parsed document
|
|
17
15
|
*/
|
|
18
16
|
export declare function parseFragment(source: string, config: ParseFragmentConfig): DocumentFragment;
|
|
19
17
|
export {};
|
package/dist/parser/parser.d.ts
CHANGED
|
@@ -55,23 +55,23 @@ export default class ParserCtx {
|
|
|
55
55
|
setRootDirective(root: Root): void;
|
|
56
56
|
/**
|
|
57
57
|
* This method flattens the scopes into a single array for traversal.
|
|
58
|
+
* @param element
|
|
59
|
+
* @yields Each node in the scope and its parent.
|
|
58
60
|
*/
|
|
59
61
|
ancestors(element?: ParentNode): IterableIterator<ParentWrapper>;
|
|
60
62
|
/**
|
|
61
63
|
* This method returns an iterator over ancestor nodes, starting at the parent and ending at the root node.
|
|
62
64
|
*
|
|
63
65
|
* Note: There are instances when we want to terminate the traversal early, such as searching for a ForBlock parent.
|
|
64
|
-
*
|
|
65
|
-
* @param
|
|
66
|
-
* @param {function} predicate - This callback is called once for each ancestor until it finds one where predicate returns true.
|
|
67
|
-
* @param {function} traversalCond - This callback is called after predicate and will terminate the traversal if it returns false.
|
|
66
|
+
* @param predicate This callback is called once for each ancestor until it finds one where predicate returns true.
|
|
67
|
+
* @param traversalCond This callback is called after predicate and will terminate the traversal if it returns false.
|
|
68
68
|
* traversalCond is ignored if no value is provided.
|
|
69
|
+
* @param startNode Starting node to begin search, defaults to the tail of the current scope.
|
|
69
70
|
*/
|
|
70
71
|
findAncestor<A extends ParentNode>(predicate: (node: ParentNode) => node is A, traversalCond?: (nodes: ParentWrapper) => unknown, startNode?: ParentNode): A | null;
|
|
71
72
|
/**
|
|
72
73
|
* This method searchs the current scope and returns the value that satisfies the predicate.
|
|
73
|
-
*
|
|
74
|
-
* @param {function} predicate - This callback is called once for each sibling in the current scope
|
|
74
|
+
* @param predicate This callback is called once for each sibling in the current scope
|
|
75
75
|
* until it finds one where predicate returns true.
|
|
76
76
|
*/
|
|
77
77
|
findInCurrentElementScope<A extends ParentNode>(predicate: (node: ParentNode) => node is A): A | null;
|
|
@@ -95,34 +95,52 @@ export default class ParserCtx {
|
|
|
95
95
|
/**
|
|
96
96
|
* This method recovers from diagnostic errors that are encountered when fn is invoked.
|
|
97
97
|
* All other errors are considered compiler errors and can not be recovered from.
|
|
98
|
-
*
|
|
99
|
-
* @param fn - method to be invoked.
|
|
98
|
+
* @param fn method to be invoked.
|
|
100
99
|
*/
|
|
101
100
|
withErrorRecovery<T>(fn: () => T): T | undefined;
|
|
102
101
|
withErrorWrapping<T>(fn: () => T, errorInfo: LWCErrorInfo, location: SourceLocation, msgFormatter?: (error: any) => string): T;
|
|
103
102
|
throwOnError(errorInfo: LWCErrorInfo, error: any, location?: SourceLocation): never;
|
|
104
103
|
/**
|
|
105
104
|
* This method throws a diagnostic error with the node's location.
|
|
105
|
+
* @param errorInfo
|
|
106
|
+
* @param node
|
|
107
|
+
* @param messageArgs
|
|
106
108
|
*/
|
|
107
109
|
throwOnNode(errorInfo: LWCErrorInfo, node: BaseNode, messageArgs?: any[]): never;
|
|
108
110
|
/**
|
|
109
111
|
* This method throws a diagnostic error with location information.
|
|
112
|
+
* @param errorInfo
|
|
113
|
+
* @param location
|
|
114
|
+
* @param messageArgs
|
|
110
115
|
*/
|
|
111
116
|
throwAtLocation(errorInfo: LWCErrorInfo, location: SourceLocation, messageArgs?: any[]): never;
|
|
112
117
|
/**
|
|
113
118
|
* This method throws a diagnostic error and will immediately exit the current routine.
|
|
119
|
+
* @param errorInfo
|
|
120
|
+
* @param messageArgs
|
|
121
|
+
* @param location
|
|
122
|
+
* @throws
|
|
114
123
|
*/
|
|
115
124
|
throw(errorInfo: LWCErrorInfo, messageArgs?: any[], location?: SourceLocation): never;
|
|
116
125
|
/**
|
|
117
126
|
* This method logs a diagnostic warning with the node's location.
|
|
127
|
+
* @param errorInfo
|
|
128
|
+
* @param node
|
|
129
|
+
* @param messageArgs
|
|
118
130
|
*/
|
|
119
131
|
warnOnNode(errorInfo: LWCErrorInfo, node: BaseNode, messageArgs?: any[]): void;
|
|
120
132
|
/**
|
|
121
133
|
* This method logs a diagnostic warning with location information.
|
|
134
|
+
* @param errorInfo
|
|
135
|
+
* @param location
|
|
136
|
+
* @param messageArgs
|
|
122
137
|
*/
|
|
123
138
|
warnAtLocation(errorInfo: LWCErrorInfo, location: SourceLocation, messageArgs?: any[]): void;
|
|
124
139
|
/**
|
|
125
140
|
* This method logs a diagnostic warning and will continue execution of the current routine.
|
|
141
|
+
* @param errorInfo
|
|
142
|
+
* @param messageArgs
|
|
143
|
+
* @param location
|
|
126
144
|
*/
|
|
127
145
|
warn(errorInfo: LWCErrorInfo, messageArgs?: any[], location?: SourceLocation): void;
|
|
128
146
|
private addDiagnostic;
|
package/dist/shared/utils.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export declare function toPropertyName(attr: string): string;
|
|
|
3
3
|
* Test if given tag name is a custom element.
|
|
4
4
|
* @param tagName element tag name to test
|
|
5
5
|
* @returns true if given tag name represents a custom element, false otherwise.
|
|
6
|
+
* @example isCustomElementTag("my-component") // true
|
|
6
7
|
*/
|
|
7
8
|
export declare function isCustomElementTag(tagName: string): boolean;
|
|
8
9
|
/**
|
|
9
10
|
* Test if given tag name is a custom LWC tag denoted lwc:*.
|
|
10
11
|
* @param tagName element tag name to test
|
|
11
12
|
* @returns true if given tag name represents a custom LWC tag, false otherwise.
|
|
13
|
+
* @example isLwcElementTag("my-component") // false
|
|
12
14
|
*/
|
|
13
15
|
export declare function isLwcElementTag(tagName: string): boolean;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
|
|
5
5
|
],
|
|
6
6
|
"name": "@lwc/template-compiler",
|
|
7
|
-
"version": "6.2.
|
|
7
|
+
"version": "6.2.1",
|
|
8
8
|
"description": "Template compiler package",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"lwc"
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lwc/errors": "6.2.
|
|
46
|
-
"@lwc/shared": "6.2.
|
|
45
|
+
"@lwc/errors": "6.2.1",
|
|
46
|
+
"@lwc/shared": "6.2.1",
|
|
47
47
|
"acorn": "8.10.0",
|
|
48
48
|
"astring": "~1.8.6",
|
|
49
49
|
"estree-walker": "~2.0.2",
|