angular-html-parser
Advanced tools
| //#region \0rolldown/runtime.js | ||
| var __defProp = Object.defineProperty; | ||
| var __exportAll = (all, no_symbols) => { | ||
| let target = {}; | ||
| for (var name in all) __defProp(target, name, { | ||
| get: all[name], | ||
| enumerable: true | ||
| }); | ||
| if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); | ||
| return target; | ||
| }; | ||
| //#endregion | ||
| export { __exportAll }; |
@@ -1,82 +0,23 @@ | ||
| //#region ../compiler/src/chars.ts | ||
| /** | ||
| * @license | ||
| * Copyright Google LLC All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.dev/license | ||
| */ | ||
| const $EOF = 0; | ||
| const $BSPACE = 8; | ||
| const $TAB = 9; | ||
| const $LF = 10; | ||
| const $VTAB = 11; | ||
| const $FF = 12; | ||
| const $CR = 13; | ||
| const $SPACE = 32; | ||
| const $BANG = 33; | ||
| const $DQ = 34; | ||
| const $HASH = 35; | ||
| const $$ = 36; | ||
| const $AMPERSAND = 38; | ||
| const $SQ = 39; | ||
| const $LPAREN = 40; | ||
| const $RPAREN = 41; | ||
| const $COMMA = 44; | ||
| const $SLASH = 47; | ||
| const $COLON = 58; | ||
| const $SEMICOLON = 59; | ||
| const $LT = 60; | ||
| const $EQ = 61; | ||
| const $GT = 62; | ||
| const $QUESTION = 63; | ||
| const $0 = 48; | ||
| const $7 = 55; | ||
| const $9 = 57; | ||
| const $A = 65; | ||
| const $F = 70; | ||
| const $X = 88; | ||
| const $Z = 90; | ||
| const $LBRACKET = 91; | ||
| const $BACKSLASH = 92; | ||
| const $RBRACKET = 93; | ||
| const $_ = 95; | ||
| const $a = 97; | ||
| const $b = 98; | ||
| const $f = 102; | ||
| const $n = 110; | ||
| const $r = 114; | ||
| const $t = 116; | ||
| const $u = 117; | ||
| const $v = 118; | ||
| const $x = 120; | ||
| const $z = 122; | ||
| const $LBRACE = 123; | ||
| const $RBRACE = 125; | ||
| const $NBSP = 160; | ||
| const $AT = 64; | ||
| const $BT = 96; | ||
| function isWhitespace(code) { | ||
| return code >= $TAB && code <= $SPACE || code == $NBSP; | ||
| return code >= 9 && code <= 32 || code == 160; | ||
| } | ||
| function isDigit(code) { | ||
| return $0 <= code && code <= $9; | ||
| return 48 <= code && code <= 57; | ||
| } | ||
| function isAsciiLetter(code) { | ||
| return code >= $a && code <= $z || code >= $A && code <= $Z; | ||
| return code >= 97 && code <= 122 || code >= 65 && code <= 90; | ||
| } | ||
| function isAsciiHexDigit(code) { | ||
| return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code); | ||
| return code >= 97 && code <= 102 || code >= 65 && code <= 70 || isDigit(code); | ||
| } | ||
| function isNewLine(code) { | ||
| return code === $LF || code === $CR; | ||
| return code === 10 || code === 13; | ||
| } | ||
| function isOctalDigit(code) { | ||
| return $0 <= code && code <= $7; | ||
| return 48 <= code && code <= 55; | ||
| } | ||
| function isQuote(code) { | ||
| return code === $SQ || code === $DQ || code === $BT; | ||
| return code === 39 || code === 34 || code === 96; | ||
| } | ||
| //#endregion | ||
| export { $$, $0, $9, $A, $AMPERSAND, $AT, $BACKSLASH, $BANG, $BSPACE, $COLON, $COMMA, $CR, $DQ, $EOF, $EQ, $FF, $GT, $HASH, $LBRACE, $LBRACKET, $LF, $LPAREN, $LT, $QUESTION, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, $SQ, $TAB, $VTAB, $X, $Z, $_, $a, $b, $f, $n, $r, $t, $u, $v, $x, $z, isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace }; | ||
| export { isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace }; |
@@ -14,4 +14,3 @@ //#region ../compiler/src/core.ts | ||
| }({}); | ||
| //#endregion | ||
| export { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext }; | ||
| export { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext }; |
@@ -38,9 +38,9 @@ import { ParseSourceSpan } from "../parse_util.mjs"; | ||
| /** | ||
| * @param nodes message AST | ||
| * @param placeholders maps placeholder names to static content and their source spans | ||
| * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages) | ||
| * @param meaning | ||
| * @param description | ||
| * @param customId | ||
| */ | ||
| * @param nodes message AST | ||
| * @param placeholders maps placeholder names to static content and their source spans | ||
| * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages) | ||
| * @param meaning | ||
| * @param description | ||
| * @param customId | ||
| */ | ||
| constructor(nodes: Node[], placeholders: { | ||
@@ -82,6 +82,6 @@ [phName: string]: MessagePlaceholder; | ||
| sourceSpan: ParseSourceSpan; | ||
| expressionPlaceholder?: string; | ||
| expressionPlaceholder?: string | undefined; | ||
| constructor(expression: string, type: string, cases: { | ||
| [k: string]: Node; | ||
| }, sourceSpan: ParseSourceSpan, expressionPlaceholder?: string); | ||
| }, sourceSpan: ParseSourceSpan, expressionPlaceholder?: string | undefined); | ||
| visit(visitor: Visitor, context?: any): any; | ||
@@ -88,0 +88,0 @@ } |
@@ -23,4 +23,4 @@ import { ParseSourceSpan } from "../parse_util.mjs"; | ||
| sourceSpan: ParseSourceSpan; | ||
| i18n?: I18nMeta; | ||
| constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta); | ||
| i18n?: I18nMeta | undefined; | ||
| constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta | undefined); | ||
| abstract visit(visitor: Visitor, context: any): any; | ||
@@ -70,3 +70,3 @@ } | ||
| readonly kind = "attribute"; | ||
| get nameSpan(): ParseSourceSpan; | ||
| get nameSpan(): ParseSourceSpan | undefined; | ||
| } | ||
@@ -83,3 +83,3 @@ declare class Element extends NodeWithI18n { | ||
| readonly isVoid: boolean; | ||
| constructor(name: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null, nameSpan: ParseSourceSpan | null, isVoid: boolean, i18n?: I18nMeta); | ||
| constructor(name: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: (ParseSourceSpan | null) | undefined, nameSpan: (ParseSourceSpan | null) | undefined, isVoid: boolean, i18n?: I18nMeta); | ||
| visit(visitor: Visitor, context: any): any; | ||
@@ -86,0 +86,0 @@ readonly kind = "element"; |
@@ -242,4 +242,3 @@ //#region ../compiler/src/ml_parser/ast.ts | ||
| }; | ||
| //#endregion | ||
| export { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, RecursiveVisitor, Text, visitAll }; | ||
| export { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, RecursiveVisitor, Text, visitAll }; |
@@ -2136,6 +2136,4 @@ //#region ../compiler/src/ml_parser/entities.ts | ||
| }; | ||
| const NGSP_UNICODE = ""; | ||
| NAMED_ENTITIES["ngsp"] = NGSP_UNICODE; | ||
| NAMED_ENTITIES["ngsp"] = ""; | ||
| //#endregion | ||
| export { NAMED_ENTITIES }; | ||
| export { NAMED_ENTITIES }; |
| import { getHtmlTagDefinition } from "./html_tags.mjs"; | ||
| import { Parser } from "./parser.mjs"; | ||
| //#region ../compiler/src/ml_parser/html_parser.ts | ||
@@ -20,4 +19,3 @@ /** | ||
| }; | ||
| //#endregion | ||
| export { HtmlParser }; | ||
| export { HtmlParser }; |
| import { TagContentType, getNsPrefix } from "./tags.mjs"; | ||
| import { DomElementSchemaRegistry } from "../schema/dom_element_schema_registry.mjs"; | ||
| //#region ../compiler/src/ml_parser/html_tags.ts | ||
@@ -188,4 +187,3 @@ /** | ||
| } | ||
| //#endregion | ||
| export { getHtmlTagDefinition }; | ||
| export { getHtmlTagDefinition }; |
| import { TagContentType, mergeNsAndName } from "./tags.mjs"; | ||
| import { $$, $0, $9, $A, $AMPERSAND, $AT, $BACKSLASH, $BANG, $BSPACE, $COLON, $COMMA, $CR, $DQ, $EOF, $EQ, $FF, $GT, $HASH, $LBRACE, $LBRACKET, $LF, $LPAREN, $LT, $QUESTION, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, $SQ, $TAB, $VTAB, $X, $Z, $_, $a, $b, $f, $n, $r, $t, $u, $v, $x, $z, isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace } from "../chars.mjs"; | ||
| import { isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace } from "../chars.mjs"; | ||
| import { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan } from "../parse_util.mjs"; | ||
| import { NAMED_ENTITIES } from "./entities.mjs"; | ||
| import { TokenType } from "./tokens.mjs"; | ||
| //#region ../compiler/src/ml_parser/lexer.ts | ||
@@ -29,3 +28,3 @@ /** | ||
| function _unexpectedCharacterErrorMsg(charCode) { | ||
| return `Unexpected character "${charCode === $EOF ? "EOF" : String.fromCharCode(charCode)}"`; | ||
| return `Unexpected character "${charCode === 0 ? "EOF" : String.fromCharCode(charCode)}"`; | ||
| } | ||
@@ -115,13 +114,13 @@ function _unknownEntityErrorMsg(entitySrc) { | ||
| tokenize() { | ||
| while (this._cursor.peek() !== $EOF) { | ||
| while (this._cursor.peek() !== 0) { | ||
| const start = this._cursor.clone(); | ||
| try { | ||
| if (this._attemptCharCode($LT)) if (this._attemptCharCode($BANG)) if (this._attemptStr("[CDATA[")) this._consumeCdata(start); | ||
| if (this._attemptCharCode(60)) if (this._attemptCharCode(33)) if (this._attemptStr("[CDATA[")) this._consumeCdata(start); | ||
| else if (this._attemptStr("--")) this._consumeComment(start); | ||
| else if (this._attemptStrCaseInsensitive("doctype")) this._consumeDocType(start); | ||
| else this._consumeBogusComment(start); | ||
| else if (this._attemptCharCode($SLASH)) this._consumeTagClose(start); | ||
| else if (this._attemptCharCode(47)) this._consumeTagClose(start); | ||
| else { | ||
| const savedPos = this._cursor.clone(); | ||
| if (this._attemptCharCode($QUESTION)) { | ||
| if (this._attemptCharCode(63)) { | ||
| this._cursor = savedPos; | ||
@@ -131,5 +130,5 @@ this._consumeBogusComment(start); | ||
| } | ||
| else if (this._tokenizeLet && this._cursor.peek() === $AT && !this._inInterpolation && this._isLetStart()) this._consumeLetDeclaration(start); | ||
| else if (this._tokenizeLet && this._cursor.peek() === 64 && !this._inInterpolation && this._isLetStart()) this._consumeLetDeclaration(start); | ||
| else if (this._tokenizeBlocks && this._isBlockStart()) this._consumeBlockStart(start); | ||
| else if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansionCase() && !this._isInExpansionForm() && this._attemptCharCode($RBRACE)) this._consumeBlockEnd(start); | ||
| else if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansionCase() && !this._isInExpansionForm() && this._attemptCharCode(125)) this._consumeBlockEnd(start); | ||
| else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) this._consumeWithInterpolation(TokenType.TEXT, TokenType.INTERPOLATION, () => this._isTextEnd(), () => this._isTagStart()); | ||
@@ -157,10 +156,10 @@ } catch (e) { | ||
| _consumeBlockStart(start) { | ||
| this._requireCharCode($AT); | ||
| this._requireCharCode(64); | ||
| this._beginToken(TokenType.BLOCK_OPEN_START, start); | ||
| const startToken = this._endToken([this._getBlockName()]); | ||
| if (this._cursor.peek() === $LPAREN) { | ||
| if (this._cursor.peek() === 40) { | ||
| this._cursor.advance(); | ||
| this._consumeBlockParameters(); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (this._attemptCharCode($RPAREN)) this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (this._attemptCharCode(41)) this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| else { | ||
@@ -171,5 +170,12 @@ startToken.type = TokenType.INCOMPLETE_BLOCK_OPEN; | ||
| } | ||
| if (this._attemptCharCode($LBRACE)) { | ||
| if (startToken.parts[0] === "default never" && this._attemptCharCode(59)) { | ||
| this._beginToken(TokenType.BLOCK_OPEN_END); | ||
| this._endToken([]); | ||
| this._beginToken(TokenType.BLOCK_CLOSE); | ||
| this._endToken([]); | ||
| return; | ||
| } | ||
| if (this._attemptCharCode(123)) { | ||
| this._beginToken(TokenType.BLOCK_OPEN_END); | ||
| this._endToken([]); | ||
| } else if (this._isBlockStart() && (startToken.parts[0] === "case" || startToken.parts[0] === "default")) { | ||
@@ -188,3 +194,3 @@ this._beginToken(TokenType.BLOCK_OPEN_END); | ||
| this._attemptCharCodeUntilFn(isBlockParameterChar); | ||
| while (this._cursor.peek() !== $RPAREN && this._cursor.peek() !== $EOF) { | ||
| while (this._cursor.peek() !== 41 && this._cursor.peek() !== 0) { | ||
| this._beginToken(TokenType.BLOCK_PARAMETER); | ||
@@ -194,9 +200,9 @@ const start = this._cursor.clone(); | ||
| let openParens = 0; | ||
| while (this._cursor.peek() !== $SEMICOLON && this._cursor.peek() !== $EOF || inQuote !== null) { | ||
| while (this._cursor.peek() !== 59 && this._cursor.peek() !== 0 || inQuote !== null) { | ||
| const char = this._cursor.peek(); | ||
| if (char === $BACKSLASH) this._cursor.advance(); | ||
| if (char === 92) this._cursor.advance(); | ||
| else if (char === inQuote) inQuote = null; | ||
| else if (inQuote === null && isQuote(char)) inQuote = char; | ||
| else if (char === $LPAREN && inQuote === null) openParens++; | ||
| else if (char === $RPAREN && inQuote === null) { | ||
| else if (char === 40 && inQuote === null) openParens++; | ||
| else if (char === 41 && inQuote === null) { | ||
| if (openParens === 0) break; | ||
@@ -222,3 +228,3 @@ else if (openParens > 0) openParens--; | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (!this._attemptCharCode($EQ)) { | ||
| if (!this._attemptCharCode(61)) { | ||
| startToken.type = TokenType.INCOMPLETE_LET; | ||
@@ -229,3 +235,3 @@ return; | ||
| this._consumeLetDeclarationValue(); | ||
| if (this._cursor.peek() === $SEMICOLON) { | ||
| if (this._cursor.peek() === 59) { | ||
| this._beginToken(TokenType.LET_END); | ||
@@ -243,3 +249,3 @@ this._endToken([]); | ||
| this._attemptCharCodeUntilFn((code) => { | ||
| if (isAsciiLetter(code) || code === $$ || code === $_ || allowDigit && isDigit(code)) { | ||
| if (isAsciiLetter(code) || code === 36 || code === 95 || allowDigit && isDigit(code)) { | ||
| allowDigit = true; | ||
@@ -255,9 +261,9 @@ return false; | ||
| this._beginToken(TokenType.LET_VALUE, start); | ||
| while (this._cursor.peek() !== $EOF) { | ||
| while (this._cursor.peek() !== 0) { | ||
| const char = this._cursor.peek(); | ||
| if (char === $SEMICOLON) break; | ||
| if (char === 59) break; | ||
| if (isQuote(char)) { | ||
| this._cursor.advance(); | ||
| this._attemptCharCodeUntilFn((inner) => { | ||
| if (inner === $BACKSLASH) { | ||
| if (inner === 92) { | ||
| this._cursor.advance(); | ||
@@ -286,3 +292,3 @@ return false; | ||
| } | ||
| if (this._cursor.peek() === $RBRACE) { | ||
| if (this._cursor.peek() === 125) { | ||
| if (this._isInExpansionCase()) { | ||
@@ -395,6 +401,6 @@ this._consumeExpansionCaseEnd(); | ||
| _isBlockStart() { | ||
| return this._cursor.peek() === $AT && SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName)); | ||
| return this._cursor.peek() === 64 && SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName)); | ||
| } | ||
| _isLetStart() { | ||
| return this._cursor.peek() === $AT && this._peekStr("@let"); | ||
| return this._cursor.peek() === 64 && this._peekStr("@let"); | ||
| } | ||
@@ -405,7 +411,7 @@ _consumeEntity(textTokenType) { | ||
| this._cursor.advance(); | ||
| if (this._attemptCharCode($HASH)) { | ||
| const isHex = this._attemptCharCode($x) || this._attemptCharCode($X); | ||
| if (this._attemptCharCode(35)) { | ||
| const isHex = this._attemptCharCode(120) || this._attemptCharCode(88); | ||
| const codeStart = this._cursor.clone(); | ||
| this._attemptCharCodeUntilFn(isDigitEntityEnd); | ||
| if (this._cursor.peek() != $SEMICOLON) { | ||
| if (this._cursor.peek() != 59) { | ||
| this._cursor.advance(); | ||
@@ -426,3 +432,3 @@ const entityType = isHex ? CharacterReferenceType.HEX : CharacterReferenceType.DEC; | ||
| this._attemptCharCodeUntilFn(isNamedEntityEnd); | ||
| if (this._cursor.peek() != $SEMICOLON) { | ||
| if (this._cursor.peek() != 59) { | ||
| this._beginToken(textTokenType, start); | ||
@@ -448,3 +454,3 @@ this._cursor = nameStart; | ||
| if (foundEndMarker) break; | ||
| if (consumeEntities && this._cursor.peek() === $AMPERSAND) { | ||
| if (consumeEntities && this._cursor.peek() === 38) { | ||
| this._endToken([this._processCarriageReturns(parts.join(""))]); | ||
@@ -469,3 +475,3 @@ parts.length = 0; | ||
| this._endToken([]); | ||
| this._consumeRawText(false, () => this._cursor.peek() === $GT); | ||
| this._consumeRawText(false, () => this._cursor.peek() === 62); | ||
| this._beginToken(TokenType.COMMENT_END); | ||
@@ -486,3 +492,3 @@ this._cursor.advance(); | ||
| this._endToken([]); | ||
| this._consumeRawText(false, () => this._cursor.peek() === $GT); | ||
| this._consumeRawText(false, () => this._cursor.peek() === 62); | ||
| this._beginToken(TokenType.DOC_TYPE_END); | ||
@@ -495,5 +501,5 @@ this._cursor.advance(); | ||
| let prefix = ""; | ||
| while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) this._cursor.advance(); | ||
| while (this._cursor.peek() !== 58 && !isPrefixEnd(this._cursor.peek())) this._cursor.advance(); | ||
| let nameStart; | ||
| if (this._cursor.peek() === $COLON) { | ||
| if (this._cursor.peek() === 58) { | ||
| prefix = this._cursor.getChars(nameOrPrefixStart); | ||
@@ -507,2 +513,18 @@ this._cursor.advance(); | ||
| } | ||
| _consumeSingleLineComment() { | ||
| this._attemptCharCodeUntilFn((code) => isNewLine(code) || code === 0); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| } | ||
| _consumeMultiLineComment() { | ||
| this._attemptCharCodeUntilFn((code) => { | ||
| if (code === 0) return true; | ||
| if (code === 42) { | ||
| const next = this._cursor.clone(); | ||
| next.advance(); | ||
| return next.peek() === 47; | ||
| } | ||
| return false; | ||
| }); | ||
| if (this._attemptStr("*/")) this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| } | ||
| _consumeTagOpen(start) { | ||
@@ -528,10 +550,21 @@ let tagName; | ||
| } | ||
| while (!isAttributeTerminator(this._cursor.peek())) if (this._selectorlessEnabled && this._cursor.peek() === $AT) { | ||
| const start$1 = this._cursor.clone(); | ||
| const nameStart = start$1.clone(); | ||
| nameStart.advance(); | ||
| if (isSelectorlessNameStart(nameStart.peek())) this._consumeDirective(start$1, nameStart); | ||
| } else { | ||
| const attr = this._consumeAttribute(); | ||
| attrs.push(attr); | ||
| while (true) { | ||
| if (this._attemptStr("//")) { | ||
| this._consumeSingleLineComment(); | ||
| continue; | ||
| } | ||
| if (this._attemptStr("/*")) { | ||
| this._consumeMultiLineComment(); | ||
| continue; | ||
| } | ||
| if (isAttributeTerminator(this._cursor.peek())) break; | ||
| if (this._selectorlessEnabled && this._cursor.peek() === 64) { | ||
| const start = this._cursor.clone(); | ||
| const nameStart = start.clone(); | ||
| nameStart.advance(); | ||
| if (isSelectorlessNameStart(nameStart.peek())) this._consumeDirective(start, nameStart); | ||
| } else { | ||
| const attr = this._consumeAttribute(); | ||
| attrs.push(attr); | ||
| } | ||
| } | ||
@@ -559,11 +592,11 @@ if (openToken.type === TokenType.COMPONENT_OPEN_START) this._consumeComponentOpenEnd(); | ||
| this._consumeRawText(consumeEntities, () => { | ||
| if (!this._attemptCharCode($LT)) return false; | ||
| if (!this._attemptCharCode($SLASH)) return false; | ||
| if (!this._attemptCharCode(60)) return false; | ||
| if (!this._attemptCharCode(47)) return false; | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (!this._attemptStrCaseInsensitive(prefix && openToken.type !== TokenType.COMPONENT_OPEN_START ? `${prefix}:${tagName}` : tagName)) return false; | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| return this._attemptCharCode($GT); | ||
| return this._attemptCharCode(62); | ||
| }); | ||
| this._beginToken(openToken.type === TokenType.COMPONENT_OPEN_START ? TokenType.COMPONENT_CLOSE : TokenType.TAG_CLOSE); | ||
| this._requireCharCodeUntilFn((code) => code === $GT, 3); | ||
| this._requireCharCodeUntilFn((code) => code === 62, 3); | ||
| this._cursor.advance(); | ||
@@ -589,3 +622,3 @@ this._endToken(openToken.parts); | ||
| let tagName = ""; | ||
| if (this._cursor.peek() === $COLON) { | ||
| if (this._cursor.peek() === 58) { | ||
| this._cursor.advance(); | ||
@@ -604,3 +637,3 @@ [prefix, tagName] = this._consumePrefixAndName(isNameEnd); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (this._attemptCharCode($EQ)) { | ||
| if (this._attemptCharCode(61)) { | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
@@ -618,3 +651,3 @@ value = this._consumeAttributeValue(); | ||
| const attrNameStart = this._cursor.peek(); | ||
| if (attrNameStart === $SQ || attrNameStart === $DQ) throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan()); | ||
| if (attrNameStart === 39 || attrNameStart === 34) throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan()); | ||
| this._beginToken(TokenType.ATTR_NAME); | ||
@@ -626,4 +659,4 @@ let nameEndPredicate; | ||
| if (this._openDirectiveCount > 0) { | ||
| if (code === $LPAREN) openParens++; | ||
| else if (code === $RPAREN) { | ||
| if (code === 40) openParens++; | ||
| else if (code === 41) { | ||
| if (openParens === 0) return true; | ||
@@ -635,7 +668,7 @@ openParens--; | ||
| }; | ||
| } else if (attrNameStart === $LBRACKET) { | ||
| } else if (attrNameStart === 91) { | ||
| let openBrackets = 0; | ||
| nameEndPredicate = (code) => { | ||
| if (code === $LBRACKET) openBrackets++; | ||
| else if (code === $RBRACKET) openBrackets--; | ||
| if (code === 91) openBrackets++; | ||
| else if (code === 93) openBrackets--; | ||
| return openBrackets <= 0 ? isNameEnd(code) : isNewLine(code); | ||
@@ -650,3 +683,3 @@ }; | ||
| let value; | ||
| if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) { | ||
| if (this._cursor.peek() === 39 || this._cursor.peek() === 34) { | ||
| const quoteChar = this._cursor.peek(); | ||
@@ -669,11 +702,11 @@ this._consumeQuote(quoteChar); | ||
| _consumeTagOpenEnd() { | ||
| const tokenType = this._attemptCharCode($SLASH) ? TokenType.TAG_OPEN_END_VOID : TokenType.TAG_OPEN_END; | ||
| const tokenType = this._attemptCharCode(47) ? TokenType.TAG_OPEN_END_VOID : TokenType.TAG_OPEN_END; | ||
| this._beginToken(tokenType); | ||
| this._requireCharCode($GT); | ||
| this._requireCharCode(62); | ||
| this._endToken([]); | ||
| } | ||
| _consumeComponentOpenEnd() { | ||
| const tokenType = this._attemptCharCode($SLASH) ? TokenType.COMPONENT_OPEN_END_VOID : TokenType.COMPONENT_OPEN_END; | ||
| const tokenType = this._attemptCharCode(47) ? TokenType.COMPONENT_OPEN_END_VOID : TokenType.COMPONENT_OPEN_END; | ||
| this._beginToken(tokenType); | ||
| this._requireCharCode($GT); | ||
| this._requireCharCode(62); | ||
| this._endToken([]); | ||
@@ -684,3 +717,3 @@ } | ||
| const clone = start.clone(); | ||
| while (clone.peek() !== $GT && !isSelectorlessNameStart(clone.peek())) clone.advance(); | ||
| while (clone.peek() !== 62 && !isSelectorlessNameStart(clone.peek())) clone.advance(); | ||
| if (isSelectorlessNameStart(clone.peek())) { | ||
@@ -690,3 +723,3 @@ this._beginToken(TokenType.COMPONENT_CLOSE, start); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._requireCharCode($GT); | ||
| this._requireCharCode(62); | ||
| this._endToken(parts); | ||
@@ -698,5 +731,5 @@ return; | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (this._allowHtmComponentClosingTags && this._attemptCharCode($SLASH)) { | ||
| if (this._allowHtmComponentClosingTags && this._attemptCharCode(47)) { | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._requireCharCode($GT); | ||
| this._requireCharCode(62); | ||
| this._endToken([]); | ||
@@ -706,3 +739,3 @@ } else { | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._requireCharCode($GT); | ||
| this._requireCharCode(62); | ||
| this._endToken([prefix, name]); | ||
@@ -714,7 +747,7 @@ this._handleFullNameStackForTagClose(prefix, name); | ||
| this._beginToken(TokenType.EXPANSION_FORM_START); | ||
| this._requireCharCode($LBRACE); | ||
| this._requireCharCode(123); | ||
| this._endToken([]); | ||
| this._expansionCaseStack.push(TokenType.EXPANSION_FORM_START); | ||
| this._beginToken(TokenType.RAW_TEXT); | ||
| const condition = this._readUntil($COMMA); | ||
| const condition = this._readUntil(44); | ||
| const normalizedCondition = this._processCarriageReturns(condition); | ||
@@ -726,8 +759,8 @@ if (this._i18nNormalizeLineEndingsInICUs) this._endToken([normalizedCondition]); | ||
| } | ||
| this._requireCharCode($COMMA); | ||
| this._requireCharCode(44); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._beginToken(TokenType.RAW_TEXT); | ||
| const type = this._readUntil($COMMA); | ||
| const type = this._readUntil(44); | ||
| this._endToken([type]); | ||
| this._requireCharCode($COMMA); | ||
| this._requireCharCode(44); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
@@ -737,7 +770,7 @@ } | ||
| this._beginToken(TokenType.EXPANSION_CASE_VALUE); | ||
| const value = this._readUntil($LBRACE).trim(); | ||
| const value = this._readUntil(123).trim(); | ||
| this._endToken([value]); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._beginToken(TokenType.EXPANSION_CASE_EXP_START); | ||
| this._requireCharCode($LBRACE); | ||
| this._requireCharCode(123); | ||
| this._endToken([]); | ||
@@ -749,3 +782,3 @@ this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._beginToken(TokenType.EXPANSION_CASE_EXP_END); | ||
| this._requireCharCode($RBRACE); | ||
| this._requireCharCode(125); | ||
| this._endToken([]); | ||
@@ -757,3 +790,3 @@ this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._beginToken(TokenType.EXPANSION_FORM_END); | ||
| this._requireCharCode($RBRACE); | ||
| this._requireCharCode(125); | ||
| this._endToken([]); | ||
@@ -786,3 +819,3 @@ this._expansionCaseStack.pop(); | ||
| this._beginToken(textTokenType); | ||
| } else if (this._cursor.peek() === $AMPERSAND) { | ||
| } else if (this._cursor.peek() === 38) { | ||
| this._endToken([this._processCarriageReturns(parts.join(""))]); | ||
@@ -814,3 +847,3 @@ parts.length = 0; | ||
| let inComment = false; | ||
| while (this._cursor.peek() !== $EOF && (prematureEndPredicate === null || !prematureEndPredicate())) { | ||
| while (this._cursor.peek() !== 0 && (prematureEndPredicate === null || !prematureEndPredicate())) { | ||
| const current = this._cursor.clone(); | ||
@@ -833,3 +866,3 @@ if (this._isTagStart()) { | ||
| this._cursor.advance(); | ||
| if (char === $BACKSLASH) this._cursor.advance(); | ||
| if (char === 92) this._cursor.advance(); | ||
| else if (char === inQuote) inQuote = null; | ||
@@ -842,3 +875,3 @@ else if (!inComment && inQuote === null && isQuote(char)) inQuote = char; | ||
| _consumeDirective(start, nameStart) { | ||
| this._requireCharCode($AT); | ||
| this._requireCharCode(64); | ||
| this._cursor.advance(); | ||
@@ -850,3 +883,3 @@ while (isSelectorlessNameChar(this._cursor.peek())) this._cursor.advance(); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| if (this._cursor.peek() !== $LPAREN) return; | ||
| if (this._cursor.peek() !== 40) return; | ||
| this._openDirectiveCount++; | ||
@@ -857,7 +890,7 @@ this._beginToken(TokenType.DIRECTIVE_OPEN); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| while (!isAttributeTerminator(this._cursor.peek()) && this._cursor.peek() !== $RPAREN) this._consumeAttribute(); | ||
| while (!isAttributeTerminator(this._cursor.peek()) && this._cursor.peek() !== 41) this._consumeAttribute(); | ||
| this._attemptCharCodeUntilFn(isNotWhitespace); | ||
| this._openDirectiveCount--; | ||
| if (this._cursor.peek() !== $RPAREN) { | ||
| if (this._cursor.peek() === $GT || this._cursor.peek() === $SLASH) return; | ||
| if (this._cursor.peek() !== 41) { | ||
| if (this._cursor.peek() === 62 || this._cursor.peek() === 47) return; | ||
| throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start)); | ||
@@ -874,8 +907,8 @@ } | ||
| _isTextEnd() { | ||
| if (this._isTagStart() || this._cursor.peek() === $EOF) return true; | ||
| if (this._isTagStart() || this._cursor.peek() === 0) return true; | ||
| if (this._tokenizeIcu && !this._inInterpolation) { | ||
| if (this.isExpansionFormStart()) return true; | ||
| if (this._cursor.peek() === $RBRACE && this._isInExpansionCase()) return true; | ||
| if (this._cursor.peek() === 125 && this._isInExpansionCase()) return true; | ||
| } | ||
| if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._isBlockStart() || this._isLetStart() || this._cursor.peek() === $RBRACE)) return true; | ||
| if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._isBlockStart() || this._isLetStart() || this._cursor.peek() === 125)) return true; | ||
| return false; | ||
@@ -888,7 +921,7 @@ } | ||
| _isTagStart() { | ||
| if (this._cursor.peek() === $LT) { | ||
| if (this._cursor.peek() === 60) { | ||
| const tmp = this._cursor.clone(); | ||
| tmp.advance(); | ||
| const code = tmp.peek(); | ||
| if ($a <= code && code <= $z || $A <= code && code <= $Z || code === $SLASH || code === $BANG) return true; | ||
| if (97 <= code && code <= 122 || 65 <= code && code <= 90 || code === 47 || code === 33) return true; | ||
| } | ||
@@ -912,3 +945,3 @@ return false; | ||
| isExpansionFormStart() { | ||
| if (this._cursor.peek() !== $LBRACE) return false; | ||
| if (this._cursor.peek() !== 123) return false; | ||
| const start = this._cursor.clone(); | ||
@@ -929,18 +962,18 @@ const isInterpolation = this._attemptStr(INTERPOLATION.start); | ||
| function isNotWhitespace(code) { | ||
| return !isWhitespace(code) || code === $EOF; | ||
| return !isWhitespace(code) || code === 0; | ||
| } | ||
| function isNameEnd(code) { | ||
| return isWhitespace(code) || code === $GT || code === $LT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ || code === $EOF; | ||
| return isWhitespace(code) || code === 62 || code === 60 || code === 47 || code === 39 || code === 34 || code === 61 || code === 0; | ||
| } | ||
| function isPrefixEnd(code) { | ||
| return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9); | ||
| return (code < 97 || 122 < code) && (code < 65 || 90 < code) && (code < 48 || code > 57); | ||
| } | ||
| function isDigitEntityEnd(code) { | ||
| return code === $SEMICOLON || code === $EOF || !isAsciiHexDigit(code); | ||
| return code === 59 || code === 0 || !isAsciiHexDigit(code); | ||
| } | ||
| function isNamedEntityEnd(code) { | ||
| return code === $SEMICOLON || code === $EOF || !isAsciiLetter(code); | ||
| return code === 59 || code === 0 || !(isAsciiLetter(code) || isDigit(code)); | ||
| } | ||
| function isExpansionCaseStart(peek) { | ||
| return peek !== $RBRACE; | ||
| return peek !== 125; | ||
| } | ||
@@ -951,18 +984,18 @@ function compareCharCodeCaseInsensitive(code1, code2) { | ||
| function toUpperCaseCharCode(code) { | ||
| return code >= $a && code <= $z ? code - $a + $A : code; | ||
| return code >= 97 && code <= 122 ? code - 97 + 65 : code; | ||
| } | ||
| function isBlockNameChar(code) { | ||
| return isAsciiLetter(code) || isDigit(code) || code === $_; | ||
| return isAsciiLetter(code) || isDigit(code) || code === 95; | ||
| } | ||
| function isBlockParameterChar(code) { | ||
| return code !== $SEMICOLON && isNotWhitespace(code); | ||
| return code !== 59 && isNotWhitespace(code); | ||
| } | ||
| function isSelectorlessNameStart(code) { | ||
| return code === $_ || code >= $A && code <= $Z; | ||
| return code === 95 || code >= 65 && code <= 90; | ||
| } | ||
| function isSelectorlessNameChar(code) { | ||
| return isAsciiLetter(code) || isDigit(code) || code === $_; | ||
| return isAsciiLetter(code) || isDigit(code) || code === 95; | ||
| } | ||
| function isAttributeTerminator(code) { | ||
| return code === $SLASH || code === $GT || code === $LT || code === $EOF; | ||
| return code === 47 || code === 62 || code === 60 || code === 0; | ||
| } | ||
@@ -1054,3 +1087,3 @@ function mergeTextTokens(srcTokens) { | ||
| const currentChar = this.charAt(state.offset); | ||
| if (currentChar === $LF) { | ||
| if (currentChar === 10) { | ||
| state.line++; | ||
@@ -1063,3 +1096,3 @@ state.column = 0; | ||
| updatePeek(state) { | ||
| state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset); | ||
| state.peek = state.offset >= this.end ? 0 : this.charAt(state.offset); | ||
| } | ||
@@ -1109,18 +1142,18 @@ locationFromCursor(cursor) { | ||
| const peek = () => this.internalState.peek; | ||
| if (peek() === $BACKSLASH) { | ||
| if (peek() === 92) { | ||
| this.internalState = { ...this.state }; | ||
| this.advanceState(this.internalState); | ||
| if (peek() === $n) this.state.peek = $LF; | ||
| else if (peek() === $r) this.state.peek = $CR; | ||
| else if (peek() === $v) this.state.peek = $VTAB; | ||
| else if (peek() === $t) this.state.peek = $TAB; | ||
| else if (peek() === $b) this.state.peek = $BSPACE; | ||
| else if (peek() === $f) this.state.peek = $FF; | ||
| else if (peek() === $u) { | ||
| if (peek() === 110) this.state.peek = 10; | ||
| else if (peek() === 114) this.state.peek = 13; | ||
| else if (peek() === 118) this.state.peek = 11; | ||
| else if (peek() === 116) this.state.peek = 9; | ||
| else if (peek() === 98) this.state.peek = 8; | ||
| else if (peek() === 102) this.state.peek = 12; | ||
| else if (peek() === 117) { | ||
| this.advanceState(this.internalState); | ||
| if (peek() === $LBRACE) { | ||
| if (peek() === 123) { | ||
| this.advanceState(this.internalState); | ||
| const digitStart = this.clone(); | ||
| let length = 0; | ||
| while (peek() !== $RBRACE) { | ||
| while (peek() !== 125) { | ||
| this.advanceState(this.internalState); | ||
@@ -1137,3 +1170,3 @@ length++; | ||
| } | ||
| } else if (peek() === $x) { | ||
| } else if (peek() === 120) { | ||
| this.advanceState(this.internalState); | ||
@@ -1179,4 +1212,3 @@ const digitStart = this.clone(); | ||
| }; | ||
| //#endregion | ||
| export { tokenize }; | ||
| export { tokenize }; |
@@ -7,3 +7,2 @@ import { getNsPrefix, mergeNsAndName, splitNsName } from "./tags.mjs"; | ||
| import { tokenize } from "./lexer.mjs"; | ||
| //#region ../compiler/src/ml_parser/parser.ts | ||
@@ -251,4 +250,4 @@ /** | ||
| selfClosing = true; | ||
| const tagDef$1 = this._getTagDefinition(fullName); | ||
| if (!(this.canSelfClose || (tagDef$1 === null || tagDef$1 === void 0 ? void 0 : tagDef$1.canSelfClose) || getNsPrefix(fullName) !== null || (tagDef$1 === null || tagDef$1 === void 0 ? void 0 : tagDef$1.isVoid))) this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`)); | ||
| const tagDef = this._getTagDefinition(fullName); | ||
| if (!(this.canSelfClose || (tagDef === null || tagDef === void 0 ? void 0 : tagDef.canSelfClose) || getNsPrefix(fullName) !== null || (tagDef === null || tagDef === void 0 ? void 0 : tagDef.isVoid))) this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`)); | ||
| } else if (this._peek.type === TokenType.TAG_OPEN_END) { | ||
@@ -285,4 +284,3 @@ this._advance(); | ||
| const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart); | ||
| const startSpan = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart); | ||
| const node = new Component(componentName, tagName, fullName, attrs, directives, [], selfClosing, span, startSpan, void 0); | ||
| const node = new Component(componentName, tagName, fullName, attrs, directives, [], selfClosing, span, new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart), void 0); | ||
| const parent = this._getContainer(); | ||
@@ -411,3 +409,12 @@ const isClosedByChild = parent !== null && node.tagName !== null && !!((_this$_getTagDefiniti5 = this._getTagDefinition(parent)) === null || _this$_getTagDefiniti5 === void 0 ? void 0 : _this$_getTagDefiniti5.isClosedByChild(node.tagName)); | ||
| _consumeBlockClose(token) { | ||
| if (!this._popContainer(null, Block, token.sourceSpan)) this.errors.push(TreeError.create(null, token.sourceSpan, "Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the \"}\" HTML entity instead.")); | ||
| const initialStackLength = this._containerStack.length; | ||
| const topNode = this._containerStack[initialStackLength - 1]; | ||
| if (!this._popContainer(null, Block, token.sourceSpan)) { | ||
| if (this._containerStack.length < initialStackLength) { | ||
| const nodeName = topNode instanceof Component ? topNode.fullName : topNode.name; | ||
| this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. Did you forget to close the <${nodeName}> element? If you meant to write the \`}\` character, you should use the "}" HTML entity instead.`)); | ||
| return; | ||
| } | ||
| this.errors.push(TreeError.create(null, token.sourceSpan, "Unexpected closing block. The block may have been closed earlier. If you meant to write the `}` character, you should use the \"}\" HTML entity instead.")); | ||
| } | ||
| } | ||
@@ -527,4 +534,3 @@ _consumeIncompleteBlock(token) { | ||
| } | ||
| //#endregion | ||
| export { Parser }; | ||
| export { Parser }; |
@@ -12,3 +12,3 @@ //#region ../compiler/src/ml_parser/tags.d.ts | ||
| ESCAPABLE_RAW_TEXT = 1, | ||
| PARSABLE_DATA = 2, | ||
| PARSABLE_DATA = 2 | ||
| } | ||
@@ -15,0 +15,0 @@ interface TagDefinition { |
@@ -34,4 +34,3 @@ //#region ../compiler/src/ml_parser/tags.ts | ||
| } | ||
| //#endregion | ||
| export { TagContentType, getNsPrefix, isNgContainer, isNgContent, mergeNsAndName, splitNsName }; | ||
| export { TagContentType, getNsPrefix, isNgContainer, isNgContent, mergeNsAndName, splitNsName }; |
@@ -54,3 +54,3 @@ import { ParseSourceSpan } from "../parse_util.mjs"; | ||
| DIRECTIVE_CLOSE = 41, | ||
| EOF = 42, | ||
| EOF = 42 | ||
| } | ||
@@ -57,0 +57,0 @@ type InterpolatedTextToken = TextToken | InterpolationToken | EncodedEntityToken; |
@@ -48,4 +48,3 @@ //#region ../compiler/src/ml_parser/tokens.ts | ||
| }({}); | ||
| //#endregion | ||
| export { TokenType }; | ||
| export { TokenType }; |
| import { Parser } from "./parser.mjs"; | ||
| import { getXmlTagDefinition } from "./xml_tags.mjs"; | ||
| //#region ../compiler/src/ml_parser/xml_parser.ts | ||
@@ -18,4 +17,3 @@ var XmlParser = class extends Parser { | ||
| }; | ||
| //#endregion | ||
| export { XmlParser }; | ||
| export { XmlParser }; |
| import { TagContentType } from "./tags.mjs"; | ||
| //#region ../compiler/src/ml_parser/xml_tags.ts | ||
@@ -32,4 +31,3 @@ /** | ||
| } | ||
| //#endregion | ||
| export { getXmlTagDefinition }; | ||
| export { getXmlTagDefinition }; |
@@ -26,24 +26,24 @@ //#region ../compiler/src/parse_util.d.ts | ||
| /** | ||
| * Create an object that holds information about spans of tokens/nodes captured during | ||
| * lexing/parsing of text. | ||
| * | ||
| * @param start | ||
| * The location of the start of the span (having skipped leading trivia). | ||
| * Skipping leading trivia makes source-spans more "user friendly", since things like HTML | ||
| * elements will appear to begin at the start of the opening tag, rather than at the start of any | ||
| * leading trivia, which could include newlines. | ||
| * | ||
| * @param end | ||
| * The location of the end of the span. | ||
| * | ||
| * @param fullStart | ||
| * The start of the token without skipping the leading trivia. | ||
| * This is used by tooling that splits tokens further, such as extracting Angular interpolations | ||
| * from text tokens. Such tooling creates new source-spans relative to the original token's | ||
| * source-span. If leading trivia characters have been skipped then the new source-spans may be | ||
| * incorrectly offset. | ||
| * | ||
| * @param details | ||
| * Additional information (such as identifier names) that should be associated with the span. | ||
| */ | ||
| * Create an object that holds information about spans of tokens/nodes captured during | ||
| * lexing/parsing of text. | ||
| * | ||
| * @param start | ||
| * The location of the start of the span (having skipped leading trivia). | ||
| * Skipping leading trivia makes source-spans more "user friendly", since things like HTML | ||
| * elements will appear to begin at the start of the opening tag, rather than at the start of any | ||
| * leading trivia, which could include newlines. | ||
| * | ||
| * @param end | ||
| * The location of the end of the span. | ||
| * | ||
| * @param fullStart | ||
| * The start of the token without skipping the leading trivia. | ||
| * This is used by tooling that splits tokens further, such as extracting Angular interpolations | ||
| * from text tokens. Such tooling creates new source-spans relative to the original token's | ||
| * source-span. If leading trivia characters have been skipped then the new source-spans may be | ||
| * incorrectly offset. | ||
| * | ||
| * @param details | ||
| * Additional information (such as identifier names) that should be associated with the span. | ||
| */ | ||
| constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null); | ||
@@ -54,3 +54,3 @@ toString(): string; | ||
| WARNING = 0, | ||
| ERROR = 1, | ||
| ERROR = 1 | ||
| } | ||
@@ -65,12 +65,19 @@ declare class ParseError extends Error { | ||
| /** | ||
| * Error that caused the error to be surfaced. For example, an error in a sub-expression that | ||
| * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. | ||
| */ | ||
| readonly relatedError?: unknown; | ||
| constructor(/** Location of the error. */span: ParseSourceSpan, /** Error message. */msg: string, /** Severity level of the error. */level?: ParseErrorLevel, | ||
| * Error that caused the error to be surfaced. For example, an error in a sub-expression that | ||
| * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. | ||
| */ | ||
| readonly relatedError?: unknown | undefined; | ||
| constructor(/** Location of the error. */ | ||
| span: ParseSourceSpan, /** Error message. */ | ||
| msg: string, /** Severity level of the error. */ | ||
| level?: ParseErrorLevel, | ||
| /** | ||
| * Error that caused the error to be surfaced. For example, an error in a sub-expression that | ||
| * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. | ||
| */ | ||
| relatedError?: unknown); | ||
| * Error that caused the error to be surfaced. For example, an error in a sub-expression that | ||
| * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. | ||
| */ | ||
| relatedError?: unknown | undefined); | ||
| contextualMessage(): string; | ||
@@ -77,0 +84,0 @@ toString(): string; |
@@ -1,3 +0,1 @@ | ||
| import { $LF } from "./chars.mjs"; | ||
| //#region ../compiler/src/parse_util.ts | ||
@@ -30,5 +28,5 @@ /** | ||
| delta++; | ||
| if (source.charCodeAt(offset) == $LF) { | ||
| if (source.charCodeAt(offset) == 10) { | ||
| line--; | ||
| const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF)); | ||
| const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode(10)); | ||
| col = priorLine > 0 ? offset - priorLine : offset; | ||
@@ -41,3 +39,3 @@ } else col--; | ||
| delta--; | ||
| if (ch == $LF) { | ||
| if (ch == 10) { | ||
| line++; | ||
@@ -144,4 +142,3 @@ col = 0; | ||
| }; | ||
| //#endregion | ||
| export { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan }; | ||
| export { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan }; |
@@ -6,3 +6,2 @@ import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext } from "../core.mjs"; | ||
| import { ElementSchemaRegistry } from "./element_schema_registry.mjs"; | ||
| //#region ../compiler/src/schema/dom_element_schema_registry.ts | ||
@@ -97,2 +96,3 @@ /** | ||
| "frameset^[HTMLElement]|cols,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows", | ||
| "geolocation^[HTMLElement]|accuracymode,!autolocate,*location,*promptaction,*promptdismiss,*validationstatuschange,!watch", | ||
| "hr^[HTMLElement]|align,color,!noShade,size,width", | ||
@@ -464,4 +464,3 @@ "head^[HTMLElement]|", | ||
| } | ||
| //#endregion | ||
| export { DomElementSchemaRegistry }; | ||
| export { DomElementSchemaRegistry }; |
| import { SecurityContext } from "../core.mjs"; | ||
| //#region ../compiler/src/schema/dom_security_schema.ts | ||
@@ -111,2 +110,6 @@ /** | ||
| "animate|attributeName", | ||
| "animate|values", | ||
| "animate|to", | ||
| "animate|from", | ||
| "set|to", | ||
| "set|attributeName", | ||
@@ -116,2 +119,5 @@ "animateMotion|attributeName", | ||
| "unknown|attributeName", | ||
| "unknown|values", | ||
| "unknown|to", | ||
| "unknown|from", | ||
| "iframe|sandbox", | ||
@@ -136,4 +142,3 @@ "iframe|allow", | ||
| } | ||
| //#endregion | ||
| export { SECURITY_SCHEMA }; | ||
| export { SECURITY_SCHEMA }; |
| //#region ../compiler/src/schema/element_schema_registry.ts | ||
| var ElementSchemaRegistry = class {}; | ||
| //#endregion | ||
| export { ElementSchemaRegistry }; | ||
| export { ElementSchemaRegistry }; |
@@ -13,4 +13,3 @@ //#region ../compiler/src/util.ts | ||
| } | ||
| //#endregion | ||
| export { dashCaseToCamelCase }; | ||
| export { dashCaseToCamelCase }; |
+22
-22
@@ -10,24 +10,24 @@ import { TagContentType } from "./compiler/src/ml_parser/tags.mjs"; | ||
| /** | ||
| * any element can self close | ||
| * | ||
| * defaults to false | ||
| */ | ||
| * any element can self close | ||
| * | ||
| * defaults to false | ||
| */ | ||
| canSelfClose?: boolean; | ||
| /** | ||
| * support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`) | ||
| * | ||
| * defaults to false | ||
| */ | ||
| * support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`) | ||
| * | ||
| * defaults to false | ||
| */ | ||
| allowHtmComponentClosingTags?: boolean; | ||
| /** | ||
| * do not lowercase tag names before querying their tag definitions | ||
| * | ||
| * defaults to false | ||
| */ | ||
| * do not lowercase tag names before querying their tag definitions | ||
| * | ||
| * defaults to false | ||
| */ | ||
| isTagNameCaseSensitive?: boolean; | ||
| /** | ||
| * customize tag content type | ||
| * | ||
| * defaults to the content type defined in the HTML spec | ||
| */ | ||
| * customize tag content type | ||
| * | ||
| * defaults to the content type defined in the HTML spec | ||
| */ | ||
| getTagContentType?: (tagName: string, prefix: string, hasParent: boolean, attrs: Array<{ | ||
@@ -39,12 +39,12 @@ prefix: string; | ||
| /** | ||
| * tokenize angular control flow block syntax | ||
| */ | ||
| * tokenize angular control flow block syntax | ||
| */ | ||
| tokenizeAngularBlocks?: boolean; | ||
| /** | ||
| * tokenize angular let declaration syntax | ||
| */ | ||
| * tokenize angular let declaration syntax | ||
| */ | ||
| tokenizeAngularLetDeclaration?: boolean; | ||
| /** | ||
| * enable angular selectorless syntax | ||
| */ | ||
| * enable angular selectorless syntax | ||
| */ | ||
| enableAngularSelectorlessSyntax?: boolean; | ||
@@ -51,0 +51,0 @@ } |
+1
-3
@@ -7,3 +7,2 @@ import { TagContentType } from "./compiler/src/ml_parser/tags.mjs"; | ||
| import { XmlParser } from "./compiler/src/ml_parser/xml_parser.mjs"; | ||
| //#region src/index.ts | ||
@@ -28,4 +27,3 @@ let htmlParser; | ||
| } | ||
| //#endregion | ||
| export { ParseLocation, ParseSourceFile, ParseSourceSpan, RecursiveVisitor, TagContentType, getHtmlTagDefinition, parseHtml as parse, parseHtml, parseXml, visitAll }; | ||
| export { ParseLocation, ParseSourceFile, ParseSourceSpan, RecursiveVisitor, TagContentType, getHtmlTagDefinition, parseHtml as parse, parseHtml, parseXml, visitAll }; |
+1
-1
| { | ||
| "name": "angular-html-parser", | ||
| "version": "10.4.0", | ||
| "version": "10.5.0", | ||
| "description": "A HTML parser extracted from Angular with some modifications", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/prettier/angular-html-parser", |
| //#region rolldown:runtime | ||
| var __defProp = Object.defineProperty; | ||
| var __exportAll = (all, symbols) => { | ||
| let target = {}; | ||
| for (var name in all) { | ||
| __defProp(target, name, { | ||
| get: all[name], | ||
| enumerable: true | ||
| }); | ||
| } | ||
| if (symbols) { | ||
| __defProp(target, Symbol.toStringTag, { value: "Module" }); | ||
| } | ||
| return target; | ||
| }; | ||
| //#endregion | ||
| export { __exportAll }; |
5282
0.08%195051
-0.28%