@lwc/template-compiler 6.3.3 → 6.4.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/dist/codegen/codegen.d.ts +6 -3
- package/dist/codegen/expression.d.ts +2 -1
- package/dist/codegen/helpers.d.ts +1 -3
- package/dist/codegen/static-element-serializer.d.ts +3 -2
- package/dist/codegen/static-element.d.ts +5 -0
- package/dist/index.cjs.js +317 -131
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +318 -132
- package/dist/index.js.map +1 -1
- package/dist/shared/ast.d.ts +1 -0
- package/dist/shared/types.d.ts +2 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIVersion } from '@lwc/shared';
|
|
2
2
|
import * as t from '../shared/estree';
|
|
3
|
-
import { ChildNode, Expression, ComplexExpression, Literal, LWCDirectiveRenderMode, Root, EventListener, RefDirective, StaticElement } from '../shared/types';
|
|
3
|
+
import { ChildNode, Expression, ComplexExpression, Literal, LWCDirectiveRenderMode, Root, EventListener, RefDirective, Text, StaticElement, Attribute, KeyDirective } from '../shared/types';
|
|
4
4
|
import State from '../state';
|
|
5
5
|
export default class CodeGen {
|
|
6
6
|
/** The AST root. */
|
|
@@ -47,6 +47,7 @@ export default class CodeGen {
|
|
|
47
47
|
memorizedIds: t.Identifier[];
|
|
48
48
|
referencedComponents: Set<string>;
|
|
49
49
|
apiVersion: APIVersion;
|
|
50
|
+
staticExpressionMap: WeakMap<Attribute | Text, string>;
|
|
50
51
|
constructor({ root, state, scopeFragmentId, }: {
|
|
51
52
|
root: Root;
|
|
52
53
|
state: State;
|
|
@@ -58,13 +59,13 @@ export default class CodeGen {
|
|
|
58
59
|
genDynamicElement(ctor: t.Expression, data: t.ObjectExpression, children: t.Expression): import("estree").CallExpression;
|
|
59
60
|
genDeprecatedDynamicElement(tagName: string, ctor: t.Expression, data: t.ObjectExpression, children: t.Expression): import("estree").CallExpression;
|
|
60
61
|
genText(value: Array<string | t.Expression>): t.Expression;
|
|
62
|
+
genConcatenatedText(value: Array<string | t.Expression>): t.Expression;
|
|
61
63
|
genComment(value: string): t.Expression;
|
|
62
64
|
genSanitizeHtmlContent(content: t.Expression): t.Expression;
|
|
63
65
|
genFragment(key: t.Expression | t.SimpleLiteral, children: t.Expression, stable?: boolean): t.Expression;
|
|
64
66
|
genIterator(iterable: t.Expression, callback: t.FunctionExpression): import("estree").CallExpression;
|
|
65
67
|
genBind(handler: t.Expression): import("estree").CallExpression;
|
|
66
68
|
genFlatten(children: t.Expression[]): import("estree").CallExpression;
|
|
67
|
-
genKey(compilerKey: t.SimpleLiteral, value: t.Expression): import("estree").CallExpression;
|
|
68
69
|
genScopedId(id: string | t.Expression): t.CallExpression;
|
|
69
70
|
genScopedFragId(id: string | t.Expression): t.CallExpression;
|
|
70
71
|
/**
|
|
@@ -85,6 +86,7 @@ export default class CodeGen {
|
|
|
85
86
|
genBooleanAttributeExpr(bindExpr: t.Expression): import("estree").ConditionalExpression;
|
|
86
87
|
genEventListeners(listeners: EventListener[]): import("estree").Property;
|
|
87
88
|
genRef(ref: RefDirective): import("estree").Property;
|
|
89
|
+
genKeyExpression(ref: KeyDirective | undefined, slotParentName: string | undefined): import("estree").SimpleLiteral | import("estree").CallExpression;
|
|
88
90
|
/**
|
|
89
91
|
* This routine generates an expression that avoids
|
|
90
92
|
* computing the sanitized html of a raw html if it does not change
|
|
@@ -112,5 +114,6 @@ export default class CodeGen {
|
|
|
112
114
|
bindExpression(expression: Expression | Literal | ComplexExpression): t.Expression;
|
|
113
115
|
genStaticElement(element: StaticElement, slotParentName?: string): t.Expression;
|
|
114
116
|
genStaticParts(element: StaticElement): t.ArrayExpression | undefined;
|
|
115
|
-
genStaticPart(partId: number,
|
|
117
|
+
genStaticPart(partId: number, data: t.Expression, text: t.Expression): t.CallExpression;
|
|
118
|
+
getStaticExpressionToken(node: Attribute | Text): string;
|
|
116
119
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as t from '../shared/estree';
|
|
2
|
-
import { ComplexExpression } from '../shared/types';
|
|
2
|
+
import { Attribute, BaseElement, ComplexExpression, Property } from '../shared/types';
|
|
3
3
|
import type CodeGen from './codegen';
|
|
4
4
|
/**
|
|
5
5
|
* Bind the passed expression to the component instance. It applies the following
|
|
@@ -23,3 +23,4 @@ import type CodeGen from './codegen';
|
|
|
23
23
|
* @param codeGen
|
|
24
24
|
*/
|
|
25
25
|
export declare function bindComplexExpression(expression: ComplexExpression, codeGen: CodeGen): t.Expression;
|
|
26
|
+
export declare function bindAttributeExpression(attr: Attribute | Property, element: BaseElement, codeGen: CodeGen, addLegacySanitizationHook: boolean): import("estree").Identifier | import("estree").MemberExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").ArrowFunctionExpression | import("estree").UnaryExpression | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").BigIntLiteral | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").ChainExpression | import("estree").ClassExpression | import("estree").ConditionalExpression | import("estree").FunctionExpression | import("estree").ImportExpression | import("estree").LogicalExpression | import("estree").MetaProperty | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | import("estree").TemplateLiteral | import("estree").ThisExpression | import("estree").UpdateExpression | import("estree").YieldExpression;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as t from '../shared/estree';
|
|
2
|
-
import { ChildNode, Node
|
|
3
|
-
import State from '../state';
|
|
2
|
+
import { ChildNode, Node } from '../shared/types';
|
|
4
3
|
import CodeGen from './codegen';
|
|
5
4
|
export declare function identifierFromComponentName(name: string): t.Identifier;
|
|
6
5
|
export declare function getMemberExpressionRoot(expression: t.MemberExpression): t.Identifier;
|
|
@@ -28,4 +27,3 @@ export declare function styleMapToStyleDeclsAST(styleMap: {
|
|
|
28
27
|
[name: string]: string;
|
|
29
28
|
}): t.ArrayExpression;
|
|
30
29
|
export declare function parseClassNames(classNames: string): string[];
|
|
31
|
-
export declare function getStaticNodes(root: Root, state: State): Set<ChildNode>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { StaticElement } from '../shared/types';
|
|
2
|
+
import type CodeGen from './codegen';
|
|
3
|
+
export declare function serializeStaticElement(element: StaticElement, codeGen: CodeGen): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChildNode, Root, StaticElement, StaticChildNode, Text } from '../shared/types';
|
|
2
|
+
import State from '../state';
|
|
3
|
+
export declare function getStaticNodes(root: Root, state: State): Set<ChildNode>;
|
|
4
|
+
export declare function transformStaticChildren(elm: StaticElement): (StaticChildNode | Text[])[];
|
|
5
|
+
export declare const isDynamicText: (nodes: StaticChildNode | StaticChildNode[]) => nodes is Text[];
|