@lwc/template-compiler 8.21.6 → 8.22.3

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.
@@ -8,6 +8,7 @@ export declare function isFragmentOnlyUrl(url: string): boolean;
8
8
  export declare function normalizeAttributeValue(ctx: ParserCtx, raw: string, tag: string, attr: Token.Attribute, location: SourceLocation): {
9
9
  value: string;
10
10
  escapedExpression: boolean;
11
+ quotedExpression: boolean;
11
12
  };
12
13
  export declare function attributeName(attr: Token.Attribute): string;
13
14
  export declare function isProhibitedIsAttribute(attrName: string): boolean;
@@ -1,6 +1,10 @@
1
1
  import type ParserCtx from '../parser';
2
+ import type { Expression, SourceLocation } from '../../shared/types';
2
3
  export * from './types';
3
4
  export * from './validate';
4
- export * from './html';
5
5
  export declare function isComplexTemplateExpressionEnabled(ctx: ParserCtx): boolean;
6
+ export declare function parseComplexExpression(ctx: ParserCtx, source: string, templateSource: string, location: SourceLocation, expressionStart?: number): {
7
+ expression: Expression;
8
+ raw: string;
9
+ };
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,11 @@
1
- import type { BaseNode } from 'estree';
2
- export declare function validateExpressionAst(rootNode: BaseNode): void;
1
+ import { type Options, type Expression as AcornExpression } from 'acorn';
2
+ import type { Expression, SourceLocation } from '../../shared/types';
3
+ export declare const OPENING_CURLY_LEN = 1;
4
+ export declare const CLOSING_CURLY_LEN = 1;
5
+ export declare const CLOSING_CURLY_BRACKET = 125;
6
+ export declare const TRAILING_SPACES_AND_PARENS: RegExp;
7
+ export declare function validateComplexExpression(expression: AcornExpression, source: string, templateSource: string, expressionStart: number, options: Options, location: SourceLocation): {
8
+ expression: Expression;
9
+ raw: string;
10
+ };
3
11
  //# sourceMappingURL=validate.d.ts.map
@@ -1,10 +1,11 @@
1
1
  import type { Expression, Identifier, SourceLocation } from '../shared/types';
2
2
  import type ParserCtx from './parser';
3
+ import type { Node } from 'acorn';
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 validatePreparsedJsExpressions(ctx: ParserCtx): void;
8
+ export declare function validateSourceIsParsedExpression(source: string, parsedExpression: Node): void;
8
9
  export declare function parseExpression(ctx: ParserCtx, source: string, location: SourceLocation): Expression;
9
10
  export declare function parseIdentifier(ctx: ParserCtx, source: string, location: SourceLocation): Identifier;
10
11
  //# sourceMappingURL=expression.d.ts.map
@@ -4,7 +4,6 @@ import type { APIVersion } from '@lwc/shared';
4
4
  import type { NormalizedConfig } from '../config';
5
5
  import type { Root, SourceLocation, ParentNode, BaseNode, IfBlock, ElseifBlock, ElseBlock } from '../shared/types';
6
6
  import type { ecmaVersion as EcmaVersion } from 'acorn';
7
- import type { PreparsedExpressionMap } from './expression-complex';
8
7
  interface ParentWrapper {
9
8
  parent: ParentNode | null;
10
9
  current: ParentNode;
@@ -25,12 +24,6 @@ export default class ParserCtx {
25
24
  */
26
25
  readonly seenScopedSlots: Set<string>;
27
26
  readonly ecmaVersion: EcmaVersion;
28
- /**
29
- * Parsing of template expressions is deferred to acorn, in order to ensure that JavaScript expressions
30
- * are parsed correctly. As such, we should cache the ESTree AST for each expression, so that the
31
- * expression need not be re-parsed when the template compiler's AST is being created.
32
- */
33
- readonly preparsedJsExpressions?: PreparsedExpressionMap;
34
27
  /**
35
28
  * 'elementScopes' keeps track of the hierarchy of ParentNodes as the parser
36
29
  * traverses the parse5 AST. Each 'elementScope' is an array where each node in
@@ -52,7 +45,7 @@ export default class ParserCtx {
52
45
  preserveComments: boolean;
53
46
  apiVersion: APIVersion;
54
47
  constructor(source: string, config: NormalizedConfig);
55
- getSource(start: number, end: number): string;
48
+ getSource(start: number, end?: number): string;
56
49
  setRootDirective(root: Root): void;
57
50
  /**
58
51
  * This method flattens the scopes into a single array for traversal.
@@ -45,7 +45,7 @@ export declare function isText(node: BaseNode): node is Text;
45
45
  export declare function isComment(node: BaseNode): node is Comment;
46
46
  export declare function isExpression(node: BaseNode | Literal): node is Expression;
47
47
  export declare function isStringLiteral(node: Expression | Literal | ComplexExpression): node is Literal<string>;
48
- export declare function isBooleanLiteral(node: Expression | Literal): node is Literal<boolean>;
48
+ export declare function isBooleanLiteral(node: Expression | Literal | ComplexExpression): node is Literal<boolean>;
49
49
  export declare function isForOf(node: BaseNode): node is ForOf;
50
50
  export declare function isForEach(node: BaseNode): node is ForEach;
51
51
  export declare function isForBlock(node: BaseNode): node is ForBlock;
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": "8.21.6",
7
+ "version": "8.22.3",
8
8
  "description": "Template compiler package",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,8 +46,8 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/errors": "8.21.6",
50
- "@lwc/shared": "8.21.6",
49
+ "@lwc/errors": "8.22.3",
50
+ "@lwc/shared": "8.22.3",
51
51
  "acorn": "~8.15.0",
52
52
  "astring": "~1.9.0",
53
53
  "he": "~1.2.0"
@@ -1,18 +0,0 @@
1
- import type { DocumentFragment } from '@parse5/tools';
2
- import type { ParserError } from 'parse5';
3
- import type ParserCtx from '../parser';
4
- interface ParseFragmentConfig {
5
- ctx: ParserCtx;
6
- sourceCodeLocationInfo: boolean;
7
- onParseError: (err: ParserError) => void;
8
- }
9
- /**
10
- * Parse the LWC template using a customized parser & lexer that allow
11
- * for template expressions to be parsed correctly.
12
- * @param source raw template markup
13
- * @param config
14
- * @returns the parsed document
15
- */
16
- export declare function parseFragment(source: string, config: ParseFragmentConfig): DocumentFragment;
17
- export {};
18
- //# sourceMappingURL=html.d.ts.map