htmljs-parser 2.11.0 → 3.0.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/LICENSE +1 -1
- package/README.md +103 -106
- package/dist/core/Parser.d.ts +67 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +2034 -0
- package/dist/index.mjs +2013 -0
- package/dist/internal.d.ts +4 -0
- package/dist/states/ATTRIBUTE.d.ts +18 -0
- package/dist/states/BEGIN_DELIMITED_HTML_BLOCK.d.ts +7 -0
- package/dist/states/CDATA.d.ts +3 -0
- package/dist/states/CLOSE_TAG.d.ts +3 -0
- package/dist/states/CONCISE_HTML_CONTENT.d.ts +2 -0
- package/dist/states/DECLARATION.d.ts +2 -0
- package/dist/states/DTD.d.ts +2 -0
- package/dist/states/EXPRESSION.d.ts +9 -0
- package/dist/states/HTML_COMMENT.d.ts +2 -0
- package/dist/states/HTML_CONTENT.d.ts +7 -0
- package/dist/states/INLINE_SCRIPT.d.ts +7 -0
- package/dist/states/JS_COMMENT_BLOCK.d.ts +2 -0
- package/dist/states/JS_COMMENT_LINE.d.ts +2 -0
- package/dist/states/OPEN_TAG.d.ts +25 -0
- package/dist/states/PARSED_TEXT_CONTENT.d.ts +7 -0
- package/dist/states/PLACEHOLDER.d.ts +7 -0
- package/dist/states/REGULAR_EXPRESSION.d.ts +6 -0
- package/dist/states/STRING.d.ts +6 -0
- package/dist/states/TAG_NAME.d.ts +5 -0
- package/dist/states/TEMPLATE_STRING.d.ts +2 -0
- package/dist/states/index.d.ts +20 -0
- package/dist/util/constants.d.ts +131 -0
- package/dist/util/util.d.ts +7 -0
- package/package.json +67 -30
- package/.jshintrc +0 -29
- package/.travis.yml +0 -8
- package/BaseParser.js +0 -188
- package/Parser.js +0 -3315
- package/html-tags.js +0 -126
- package/index.js +0 -6
- package/notify-util.js +0 -319
- package/operators.js +0 -65
- package/test/.jshintrc +0 -43
- package/test/1.x-test.js +0 -6
- package/test/autotest/argument-and-params/expected.html +0 -17
- package/test/autotest/argument-and-params/input.htmljs +0 -6
- package/test/autotest/argument-attr/expected.html +0 -2
- package/test/autotest/argument-attr/input.htmljs +0 -1
- package/test/autotest/argument-attr-extra-whitespace/expected.html +0 -4
- package/test/autotest/argument-attr-extra-whitespace/input.htmljs +0 -2
- package/test/autotest/argument-attr-multiple/expected.html +0 -1
- package/test/autotest/argument-attr-multiple/input.htmljs +0 -1
- package/test/autotest/argument-tag/expected.html +0 -2
- package/test/autotest/argument-tag/input.htmljs +0 -1
- package/test/autotest/argument-tag-attr/expected.html +0 -2
- package/test/autotest/argument-tag-attr/input.htmljs +0 -1
- package/test/autotest/argument-tag-complex/expected.html +0 -2
- package/test/autotest/argument-tag-complex/input.htmljs +0 -1
- package/test/autotest/argument-tag-extra-whitespace/expected.html +0 -2
- package/test/autotest/argument-tag-extra-whitespace/input.htmljs +0 -1
- package/test/autotest/argument-tag-multiple/expected.html +0 -1
- package/test/autotest/argument-tag-multiple/input.htmljs +0 -1
- package/test/autotest/argument-tag-nested-parens/expected.html +0 -3
- package/test/autotest/argument-tag-nested-parens/input.htmljs +0 -4
- package/test/autotest/attr-bound/expected.html +0 -23
- package/test/autotest/attr-bound/input.htmljs +0 -6
- package/test/autotest/attr-comma-multiline/expected.html +0 -3
- package/test/autotest/attr-comma-multiline/input.htmljs +0 -6
- package/test/autotest/attr-complex/expected.html +0 -3
- package/test/autotest/attr-complex/input.htmljs +0 -1
- package/test/autotest/attr-complex-instanceof/expected.html +0 -2
- package/test/autotest/attr-complex-instanceof/input.htmljs +0 -1
- package/test/autotest/attr-escape-characters/expected.html +0 -3
- package/test/autotest/attr-escape-characters/input.htmljs +0 -3
- package/test/autotest/attr-escaped-dollar/expected.html +0 -1
- package/test/autotest/attr-escaped-dollar/input.htmljs +0 -1
- package/test/autotest/attr-escaped-dollar/test.js +0 -5
- package/test/autotest/attr-grouped/expected.html +0 -3
- package/test/autotest/attr-grouped/input.htmljs +0 -5
- package/test/autotest/attr-grouped-2/expected.html +0 -3
- package/test/autotest/attr-grouped-2/input.htmljs +0 -5
- package/test/autotest/attr-grouped-3/expected.html +0 -3
- package/test/autotest/attr-grouped-3/input.htmljs +0 -5
- package/test/autotest/attr-grouped-4/expected.html +0 -3
- package/test/autotest/attr-grouped-4/input.htmljs +0 -5
- package/test/autotest/attr-grouped-invalid/expected.html +0 -1
- package/test/autotest/attr-grouped-invalid/input.htmljs +0 -5
- package/test/autotest/attr-grouped-invalid-eof/expected.html +0 -1
- package/test/autotest/attr-grouped-invalid-eof/input.htmljs +0 -4
- package/test/autotest/attr-grouped-multiple/expected.html +0 -3
- package/test/autotest/attr-grouped-multiple/input.htmljs +0 -4
- package/test/autotest/attr-inc-and-dec/expected.html +0 -4
- package/test/autotest/attr-inc-and-dec/input.htmljs +0 -2
- package/test/autotest/attr-inconsistent-commas/expected.html +0 -1
- package/test/autotest/attr-inconsistent-commas/input.htmljs +0 -1
- package/test/autotest/attr-int-and-id/expected.html +0 -2
- package/test/autotest/attr-int-and-id/input.htmljs +0 -1
- package/test/autotest/attr-literal-false/expected.html +0 -2
- package/test/autotest/attr-literal-false/input.htmljs +0 -1
- package/test/autotest/attr-literal-false/test.js +0 -1
- package/test/autotest/attr-literal-null/expected.html +0 -2
- package/test/autotest/attr-literal-null/input.htmljs +0 -1
- package/test/autotest/attr-literal-null/test.js +0 -1
- package/test/autotest/attr-literal-numbers/expected.html +0 -2
- package/test/autotest/attr-literal-numbers/input.htmljs +0 -1
- package/test/autotest/attr-literal-numbers/test.js +0 -1
- package/test/autotest/attr-literal-regex/expected.html +0 -11
- package/test/autotest/attr-literal-regex/input.htmljs +0 -4
- package/test/autotest/attr-literal-string-double-quotes/expected.html +0 -2
- package/test/autotest/attr-literal-string-double-quotes/input.htmljs +0 -1
- package/test/autotest/attr-literal-string-double-quotes/test.js +0 -1
- package/test/autotest/attr-literal-string-single-quotes/expected.html +0 -2
- package/test/autotest/attr-literal-string-single-quotes/input.htmljs +0 -1
- package/test/autotest/attr-literal-string-single-quotes/test.js +0 -1
- package/test/autotest/attr-literal-true/expected.html +0 -2
- package/test/autotest/attr-literal-true/input.htmljs +0 -1
- package/test/autotest/attr-literal-true/test.js +0 -1
- package/test/autotest/attr-literal-undefined/expected.html +0 -2
- package/test/autotest/attr-literal-undefined/input.htmljs +0 -1
- package/test/autotest/attr-literal-undefined/test.js +0 -1
- package/test/autotest/attr-method-shorthand/expected.html +0 -40
- package/test/autotest/attr-method-shorthand/input.htmljs +0 -29
- package/test/autotest/attr-multi-line-comment/expected.html +0 -3
- package/test/autotest/attr-multi-line-comment/input.htmljs +0 -1
- package/test/autotest/attr-multi-line-string/expected.html +0 -2
- package/test/autotest/attr-multi-line-string/input.htmljs +0 -3
- package/test/autotest/attr-name-with-html-chars/expected.html +0 -1
- package/test/autotest/attr-name-with-html-chars/input.htmljs +0 -1
- package/test/autotest/attr-nested-literal-regex/expected.html +0 -2
- package/test/autotest/attr-nested-literal-regex/input.htmljs +0 -1
- package/test/autotest/attr-no-value/expected.html +0 -3
- package/test/autotest/attr-no-value/input.htmljs +0 -1
- package/test/autotest/attr-no-value-self-closed/expected.html +0 -2
- package/test/autotest/attr-no-value-self-closed/input.htmljs +0 -1
- package/test/autotest/attr-non-literal/expected.html +0 -5
- package/test/autotest/attr-non-literal/input.htmljs +0 -2
- package/test/autotest/attr-non-literal/test.js +0 -1
- package/test/autotest/attr-object-expressions/expected.html +0 -4
- package/test/autotest/attr-object-expressions/input.htmljs +0 -3
- package/test/autotest/attr-simple-expression/expected.html +0 -3
- package/test/autotest/attr-simple-expression/input.htmljs +0 -1
- package/test/autotest/attr-unenclosed-whitespace/expected.html +0 -2
- package/test/autotest/attr-unenclosed-whitespace/input.htmljs +0 -1
- package/test/autotest/attr-unenclosed-whitespace-minus/expected.html +0 -2
- package/test/autotest/attr-unenclosed-whitespace-minus/input.htmljs +0 -1
- package/test/autotest/attr-unenclosed-whitespace-multiple-attrs/expected.html +0 -5
- package/test/autotest/attr-unenclosed-whitespace-multiple-attrs/input.htmljs +0 -2
- package/test/autotest/attr-unenclosed-whitespace-odd/expected.html +0 -2
- package/test/autotest/attr-unenclosed-whitespace-odd/input.htmljs +0 -1
- package/test/autotest/attr-value-self-closed/expected.html +0 -2
- package/test/autotest/attr-value-self-closed/input.htmljs +0 -1
- package/test/autotest/attr-value-single-quote-escaped/expected.html +0 -2
- package/test/autotest/attr-value-single-quote-escaped/input.htmljs +0 -1
- package/test/autotest/attr-value-string-concat/expected.html +0 -2
- package/test/autotest/attr-value-string-concat/input.htmljs +0 -1
- package/test/autotest/attr-value-typeof/expected.html +0 -2
- package/test/autotest/attr-value-typeof/input.htmljs +0 -1
- package/test/autotest/attr-value-typeof-comma/expected.html +0 -2
- package/test/autotest/attr-value-typeof-comma/input.htmljs +0 -1
- package/test/autotest/attr-value-typeof-no-space-prefix/expected.html +0 -2
- package/test/autotest/attr-value-typeof-no-space-prefix/input.htmljs +0 -1
- package/test/autotest/attr-value-void/expected.html +0 -2
- package/test/autotest/attr-value-void/input.htmljs +0 -1
- package/test/autotest/attr-with-parens-and-double-quoted-strings/expected.html +0 -2
- package/test/autotest/attr-with-parens-and-double-quoted-strings/input.htmljs +0 -1
- package/test/autotest/attr-with-parens-and-single-quoted-strings/expected.html +0 -2
- package/test/autotest/attr-with-parens-and-single-quoted-strings/input.htmljs +0 -1
- package/test/autotest/attr-with-right-angle-bracket/expected.html +0 -3
- package/test/autotest/attr-with-right-angle-bracket/input.htmljs +0 -1
- package/test/autotest/attr-with-right-angle-bracket-parens/expected.html +0 -3
- package/test/autotest/attr-with-right-angle-bracket-parens/input.htmljs +0 -1
- package/test/autotest/attr-without-delimiters/expected.html +0 -2
- package/test/autotest/attr-without-delimiters/input.htmljs +0 -1
- package/test/autotest/backtick-string/expected.html +0 -3
- package/test/autotest/backtick-string/input.htmljs +0 -2
- package/test/autotest/backtick-string-eof/expected.html +0 -1
- package/test/autotest/backtick-string-eof/input.htmljs +0 -2
- package/test/autotest/backtick-string-nested-with-space/expected.html +0 -2
- package/test/autotest/backtick-string-nested-with-space/input.htmljs +0 -1
- package/test/autotest/backtick-string-placeholder-newline/expected.html +0 -4
- package/test/autotest/backtick-string-placeholder-newline/input.htmljs +0 -3
- package/test/autotest/bad-tag-indent/expected.html +0 -1
- package/test/autotest/bad-tag-indent/input.htmljs +0 -1
- package/test/autotest/cdata/expected.html +0 -3
- package/test/autotest/cdata/input.htmljs +0 -1
- package/test/autotest/cdata-2/expected.html +0 -5
- package/test/autotest/cdata-2/input.htmljs +0 -3
- package/test/autotest/cdata-pos/expected.html +0 -7
- package/test/autotest/cdata-pos/input.htmljs +0 -4
- package/test/autotest/cdata-pos/test.js +0 -1
- package/test/autotest/comma-ends-attr-operators/expected.html +0 -2
- package/test/autotest/comma-ends-attr-operators/input.htmljs +0 -1
- package/test/autotest/commas-relax/expected.html +0 -2
- package/test/autotest/commas-relax/input.htmljs +0 -1
- package/test/autotest/commas-relax/test.js +0 -7
- package/test/autotest/commas-require-all-attrs-first/expected.html +0 -1
- package/test/autotest/commas-require-all-attrs-first/input.htmljs +0 -1
- package/test/autotest/commas-require-all-attrs-last/expected.html +0 -1
- package/test/autotest/commas-require-all-attrs-last/input.htmljs +0 -1
- package/test/autotest/comment-concise-js-block/expected.html +0 -4
- package/test/autotest/comment-concise-js-block/input.htmljs +0 -6
- package/test/autotest/comment-concise-js-block-trailing/expected.html +0 -4
- package/test/autotest/comment-concise-js-block-trailing/input.htmljs +0 -6
- package/test/autotest/comment-concise-js-line/expected.html +0 -4
- package/test/autotest/comment-concise-js-line/input.htmljs +0 -3
- package/test/autotest/comments-within-open-tag/expected.html +0 -2
- package/test/autotest/comments-within-open-tag/input.htmljs +0 -1
- package/test/autotest/complex/expected.html +0 -24
- package/test/autotest/complex/input.htmljs +0 -22
- package/test/autotest/complex-attr-name/expected.html +0 -2
- package/test/autotest/complex-attr-name/input.htmljs +0 -1
- package/test/autotest/concise-complex-tag-name/expected.html +0 -2
- package/test/autotest/concise-complex-tag-name/input.htmljs +0 -1
- package/test/autotest/concise-contentplaceholder-html-start/expected.html +0 -5
- package/test/autotest/concise-contentplaceholder-html-start/input.htmljs +0 -1
- package/test/autotest/concise-contentplaceholder-start/expected.html +0 -1
- package/test/autotest/concise-contentplaceholder-start/input.htmljs +0 -1
- package/test/autotest/concise-hyphen-after-tag-name/expected.html +0 -1
- package/test/autotest/concise-hyphen-after-tag-name/input.htmljs +0 -1
- package/test/autotest/css-calc/expected.html +0 -6
- package/test/autotest/css-calc/input.htmljs +0 -5
- package/test/autotest/declaration/expected.html +0 -1
- package/test/autotest/declaration/input.htmljs +0 -1
- package/test/autotest/default-attr/expected.html +0 -2
- package/test/autotest/default-attr/input.htmljs +0 -1
- package/test/autotest/default-attr-comma/expected.html +0 -2
- package/test/autotest/default-attr-comma/input.htmljs +0 -1
- package/test/autotest/default-attr-no-space/expected.html +0 -6
- package/test/autotest/default-attr-no-space/input.htmljs +0 -3
- package/test/autotest/double-hyphen-block/expected.html +0 -12
- package/test/autotest/double-hyphen-block/input.htmljs +0 -8
- package/test/autotest/double-hyphen-line/expected.html +0 -12
- package/test/autotest/double-hyphen-line/input.htmljs +0 -5
- package/test/autotest/double-hyphen-line-start/expected.html +0 -12
- package/test/autotest/double-hyphen-line-start/input.htmljs +0 -6
- package/test/autotest/dtd/expected.html +0 -1
- package/test/autotest/dtd/input.htmljs +0 -1
- package/test/autotest/empty-closing-tag/expected.html +0 -8
- package/test/autotest/empty-closing-tag/input.htmljs +0 -6
- package/test/autotest/empty-closing-tag2/expected.html +0 -9
- package/test/autotest/empty-closing-tag2/input.htmljs +0 -5
- package/test/autotest/eof-attr-argument/expected.html +0 -1
- package/test/autotest/eof-attr-argument/input.htmljs +0 -1
- package/test/autotest/eof-attr-name/expected.html +0 -3
- package/test/autotest/eof-attr-name/input.htmljs +0 -1
- package/test/autotest/eof-attr-value/expected.html +0 -3
- package/test/autotest/eof-attr-value/input.htmljs +0 -1
- package/test/autotest/eof-attr-value-js-comment-comment/expected.html +0 -3
- package/test/autotest/eof-attr-value-js-comment-comment/input.htmljs +0 -1
- package/test/autotest/eof-attr-value-js-comment-comment-concise/expected.html +0 -1
- package/test/autotest/eof-attr-value-js-comment-comment-concise/input.htmljs +0 -1
- package/test/autotest/eof-attr-value-string/expected.html +0 -1
- package/test/autotest/eof-attr-value-string/input.htmljs +0 -1
- package/test/autotest/eof-doctype/expected.html +0 -1
- package/test/autotest/eof-doctype/input.htmljs +0 -1
- package/test/autotest/eof-placeholder-body-escaped/expected.html +0 -4
- package/test/autotest/eof-placeholder-body-escaped/input.htmljs +0 -1
- package/test/autotest/eof-placeholder-body-non-escaped/expected.html +0 -4
- package/test/autotest/eof-placeholder-body-non-escaped/input.htmljs +0 -4
- package/test/autotest/eof-placeholder-concise/expected.html +0 -3
- package/test/autotest/eof-placeholder-concise/input.htmljs +0 -2
- package/test/autotest/eof-placeholder-script-body-escaped/expected.html +0 -4
- package/test/autotest/eof-placeholder-script-body-escaped/input.htmljs +0 -1
- package/test/autotest/eof-placeholder-script-body-non-escaped/expected.html +0 -4
- package/test/autotest/eof-placeholder-script-body-non-escaped/input.htmljs +0 -1
- package/test/autotest/eof-placeholder-string/expected.html +0 -4
- package/test/autotest/eof-placeholder-string/input.htmljs +0 -1
- package/test/autotest/eof-script-body/expected.html +0 -4
- package/test/autotest/eof-script-body/input.htmljs +0 -2
- package/test/autotest/eof-style/expected.html +0 -4
- package/test/autotest/eof-style/input.htmljs +0 -1
- package/test/autotest/eof-tag-start/expected.html +0 -3
- package/test/autotest/eof-tag-start/input.htmljs +0 -1
- package/test/autotest/eof-xml-declaration/expected.html +0 -1
- package/test/autotest/eof-xml-declaration/input.htmljs +0 -1
- package/test/autotest/html-block-after-tag/expected.html +0 -6
- package/test/autotest/html-block-after-tag/input.htmljs +0 -1
- package/test/autotest/html-comments/expected.html +0 -3
- package/test/autotest/html-comments/input.htmljs +0 -1
- package/test/autotest/html-comments-ignore-placeholders/expected.html +0 -1
- package/test/autotest/html-comments-ignore-placeholders/input.htmljs +0 -1
- package/test/autotest/ignoreAttributes/expected.html +0 -2
- package/test/autotest/ignoreAttributes/input.htmljs +0 -1
- package/test/autotest/ignoreAttributes/test.js +0 -7
- package/test/autotest/ignoreNonstandardStringPlaceholders/expected.html +0 -2
- package/test/autotest/ignoreNonstandardStringPlaceholders/input.htmljs +0 -1
- package/test/autotest/ignoreNonstandardStringPlaceholders/test.js +0 -1
- package/test/autotest/ignorePlaceholders-attr-double-escaped-dollar-placeholder/expected.html +0 -2
- package/test/autotest/ignorePlaceholders-attr-double-escaped-dollar-placeholder/input.htmljs +0 -1
- package/test/autotest/ignorePlaceholders-attr-double-escaped-dollar-placeholder/test.js +0 -1
- package/test/autotest/ignorePlaceholders-attr-escaped-dollar-placeholder/expected.html +0 -2
- package/test/autotest/ignorePlaceholders-attr-escaped-dollar-placeholder/input.htmljs +0 -1
- package/test/autotest/ignorePlaceholders-attr-escaped-dollar-placeholder/test.js +0 -1
- package/test/autotest/ignorePlaceholders-attr-placeholder/expected.html +0 -2
- package/test/autotest/ignorePlaceholders-attr-placeholder/input.htmljs +0 -1
- package/test/autotest/ignorePlaceholders-attr-placeholder/test.js +0 -1
- package/test/autotest/invalid-closing-tag/expected.html +0 -4
- package/test/autotest/invalid-closing-tag/input.htmljs +0 -1
- package/test/autotest/mixed/expected.html +0 -21
- package/test/autotest/mixed/input.htmljs +0 -8
- package/test/autotest/mixed-bad-indentation/expected.html +0 -7
- package/test/autotest/mixed-bad-indentation/input.htmljs +0 -3
- package/test/autotest/mixed-cdata/expected.html +0 -7
- package/test/autotest/mixed-cdata/input.htmljs +0 -3
- package/test/autotest/mixed-comment/expected.html +0 -7
- package/test/autotest/mixed-comment/input.htmljs +0 -6
- package/test/autotest/mixed-invalid/expected.html +0 -16
- package/test/autotest/mixed-invalid/input.htmljs +0 -9
- package/test/autotest/mixed-open-tag-only/expected.html +0 -14
- package/test/autotest/mixed-open-tag-only/input.htmljs +0 -6
- package/test/autotest/multiline-html-block/expected.html +0 -5
- package/test/autotest/multiline-html-block/input.htmljs +0 -4
- package/test/autotest/multiline-html-block-empty/expected.html +0 -0
- package/test/autotest/multiline-html-block-empty/input.htmljs +0 -2
- package/test/autotest/multiline-html-block-missing-end/expected.html +0 -7
- package/test/autotest/multiline-html-block-missing-end/input.htmljs +0 -12
- package/test/autotest/multiline-html-block-nested/expected.html +0 -7
- package/test/autotest/multiline-html-block-nested/input.htmljs +0 -5
- package/test/autotest/multiline-html-block-nested-empty/expected.html +0 -2
- package/test/autotest/multiline-html-block-nested-empty/input.htmljs +0 -3
- package/test/autotest/multiline-html-block-same-line/expected.html +0 -6
- package/test/autotest/multiline-html-block-same-line/input.htmljs +0 -7
- package/test/autotest/multiline-text-block/expected.html +0 -1
- package/test/autotest/multiline-text-block/input.htmljs +0 -4
- package/test/autotest/multiline-text-block-bad/expected.html +0 -1
- package/test/autotest/multiline-text-block-bad/input.htmljs +0 -5
- package/test/autotest/multiline-text-block-with-hyphens/expected.html +0 -1
- package/test/autotest/multiline-text-block-with-hyphens/input.htmljs +0 -4
- package/test/autotest/multiple-tags-on-line-close-next/input.htmljs +0 -2
- package/test/autotest/multiple-tags-on-line-close-next/test.js +0 -1
- package/test/autotest/nested-pyramid/expected.html +0 -12
- package/test/autotest/nested-pyramid/input.htmljs +0 -6
- package/test/autotest/nested-siblings/expected.html +0 -6
- package/test/autotest/nested-siblings/input.htmljs +0 -3
- package/test/autotest/nested-tags/expected.html +0 -4
- package/test/autotest/nested-tags/input.htmljs +0 -2
- package/test/autotest/nested-text/expected.html +0 -8
- package/test/autotest/nested-text/input.htmljs +0 -8
- package/test/autotest/open-tag-only/expected.html +0 -12
- package/test/autotest/open-tag-only/input.htmljs +0 -1
- package/test/autotest/open-tag-only-custom/expected.html +0 -10
- package/test/autotest/open-tag-only-custom/input.htmljs +0 -4
- package/test/autotest/open-tag-only-custom/test.js +0 -9
- package/test/autotest/open-tag-only-with-body/expected.html +0 -4
- package/test/autotest/open-tag-only-with-body/input.htmljs +0 -5
- package/test/autotest/open-tag-only-with-body-concise/expected.html +0 -3
- package/test/autotest/open-tag-only-with-body-concise/input.htmljs +0 -2
- package/test/autotest/open-tag-parser-state/expected.html +0 -21
- package/test/autotest/open-tag-parser-state/input.htmljs +0 -11
- package/test/autotest/open-tag-parser-state/test.js +0 -21
- package/test/autotest/open-tag-parser-state-concise/expected.html +0 -19
- package/test/autotest/open-tag-parser-state-concise/input.htmljs +0 -17
- package/test/autotest/open-tag-parser-state-concise/test.js +0 -17
- package/test/autotest/param-tag/expected.html +0 -2
- package/test/autotest/param-tag/input.htmljs +0 -1
- package/test/autotest/parsed-text-placeholder-in-template-literal-string/expected.html +0 -4
- package/test/autotest/parsed-text-placeholder-in-template-literal-string/input.htmljs +0 -3
- package/test/autotest/parsed-text-placeholder-in-template-literal-string/test.js +0 -1
- package/test/autotest/parsed-text-style-tag/expected.html +0 -3
- package/test/autotest/parsed-text-style-tag/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-invalid/expected.html +0 -1
- package/test/autotest/placeholder-attr-invalid/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-string-value/expected.html +0 -3
- package/test/autotest/placeholder-attr-string-value/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-string-value-mixed-quotes/expected.html +0 -3
- package/test/autotest/placeholder-attr-string-value-mixed-quotes/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-string-value-parens/expected.html +0 -3
- package/test/autotest/placeholder-attr-string-value-parens/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-within-placeholder/expected.html +0 -2
- package/test/autotest/placeholder-attr-within-placeholder/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-within-string-complex/expected.html +0 -2
- package/test/autotest/placeholder-attr-within-string-complex/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-within-string-simple/expected.html +0 -2
- package/test/autotest/placeholder-attr-within-string-simple/input.htmljs +0 -1
- package/test/autotest/placeholder-attr-wrapped/expected.html +0 -2
- package/test/autotest/placeholder-attr-wrapped/input.htmljs +0 -1
- package/test/autotest/placeholder-backslash/expected.html +0 -23
- package/test/autotest/placeholder-backslash/input.htmljs +0 -15
- package/test/autotest/placeholder-body-multi-line-js-comment/expected.html +0 -3
- package/test/autotest/placeholder-body-multi-line-js-comment/input.htmljs +0 -1
- package/test/autotest/placeholder-body-single-line-js-comment/expected.html +0 -3
- package/test/autotest/placeholder-body-single-line-js-comment/input.htmljs +0 -2
- package/test/autotest/placeholder-body-text/expected.html +0 -5
- package/test/autotest/placeholder-body-text/input.htmljs +0 -1
- package/test/autotest/placeholder-escape/expected.html +0 -5
- package/test/autotest/placeholder-escape/input.htmljs +0 -3
- package/test/autotest/placeholder-no-escape/expected.html +0 -5
- package/test/autotest/placeholder-no-escape/input.htmljs +0 -3
- package/test/autotest/placeholder-tag-name-concise/expected.html +0 -2
- package/test/autotest/placeholder-tag-name-concise/input.htmljs +0 -1
- package/test/autotest/placeholder-tag-name-html/expected.html +0 -2
- package/test/autotest/placeholder-tag-name-html/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr/expected.html +0 -2
- package/test/autotest/placeholder-unnamed-attr/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr-escaped/expected.html +0 -2
- package/test/autotest/placeholder-unnamed-attr-escaped/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr-escaped-escaped/expected.html +0 -2
- package/test/autotest/placeholder-unnamed-attr-escaped-escaped/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr-last/expected.html +0 -2
- package/test/autotest/placeholder-unnamed-attr-last/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr-last-concise/expected.html +0 -4
- package/test/autotest/placeholder-unnamed-attr-last-concise/input.htmljs +0 -2
- package/test/autotest/placeholder-unnamed-attr-last-self-closed/expected.html +0 -2
- package/test/autotest/placeholder-unnamed-attr-last-self-closed/input.htmljs +0 -1
- package/test/autotest/placeholder-unnamed-attr-trailing-text/expected.html +0 -1
- package/test/autotest/placeholder-unnamed-attr-trailing-text/input.htmljs +0 -1
- package/test/autotest/placeholder-within-placeholder/expected.html +0 -1
- package/test/autotest/placeholder-within-placeholder/input.htmljs +0 -1
- package/test/autotest/placeholder-within-placeholder-escaping/expected.html +0 -1
- package/test/autotest/placeholder-within-placeholder-escaping/input.htmljs +0 -1
- package/test/autotest/placeholder-within-script-tag/expected.html +0 -5
- package/test/autotest/placeholder-within-script-tag/input.htmljs +0 -1
- package/test/autotest/placeholder-within-script-within-string/expected.html +0 -5
- package/test/autotest/placeholder-within-script-within-string/input.htmljs +0 -1
- package/test/autotest/placeholder-within-string-newlines/expected.html +0 -4
- package/test/autotest/placeholder-within-string-newlines/input.htmljs +0 -3
- package/test/autotest/root-el/expected.html +0 -2
- package/test/autotest/root-el/input.htmljs +0 -1
- package/test/autotest/root-els/expected.html +0 -4
- package/test/autotest/root-els/input.htmljs +0 -2
- package/test/autotest/script/expected.html +0 -3
- package/test/autotest/script/input.htmljs +0 -2
- package/test/autotest/script-concise/expected.html +0 -6
- package/test/autotest/script-concise/input.htmljs +0 -7
- package/test/autotest/script-concise-invalid-nested-tag/expected.html +0 -3
- package/test/autotest/script-concise-invalid-nested-tag/input.htmljs +0 -3
- package/test/autotest/script-empty-concise/expected.html +0 -6
- package/test/autotest/script-empty-concise/input.htmljs +0 -3
- package/test/autotest/script-escaped-placeholder/expected.html +0 -5
- package/test/autotest/script-escaped-placeholder/input.htmljs +0 -4
- package/test/autotest/script-self-closed/expected.html +0 -9
- package/test/autotest/script-self-closed/input.htmljs +0 -4
- package/test/autotest/script-single-line-comment/expected.html +0 -3
- package/test/autotest/script-single-line-comment/input.htmljs +0 -1
- package/test/autotest/scriptlet-block/expected.html +0 -1
- package/test/autotest/scriptlet-block/input.htmljs +0 -4
- package/test/autotest/scriptlet-block-division/expected.html +0 -1
- package/test/autotest/scriptlet-block-division/input.htmljs +0 -4
- package/test/autotest/scriptlet-block-html/expected.html +0 -1
- package/test/autotest/scriptlet-block-html/input.htmljs +0 -6
- package/test/autotest/scriptlet-block-invalid-comment/expected.html +0 -1
- package/test/autotest/scriptlet-block-invalid-comment/input.htmljs +0 -3
- package/test/autotest/scriptlet-block-multiline-comment/expected.html +0 -1
- package/test/autotest/scriptlet-block-multiline-comment/input.htmljs +0 -4
- package/test/autotest/scriptlet-block-nested/expected.html +0 -1
- package/test/autotest/scriptlet-block-nested/input.htmljs +0 -16
- package/test/autotest/scriptlet-block-regex/expected.html +0 -1
- package/test/autotest/scriptlet-block-regex/input.htmljs +0 -4
- package/test/autotest/scriptlet-block-single-line-comment/expected.html +0 -1
- package/test/autotest/scriptlet-block-single-line-comment/input.htmljs +0 -4
- package/test/autotest/scriptlet-block-template-literal-href/expected.html +0 -1
- package/test/autotest/scriptlet-block-template-literal-href/input.htmljs +0 -4
- package/test/autotest/scriptlet-line/expected.html +0 -1
- package/test/autotest/scriptlet-line/input.htmljs +0 -1
- package/test/autotest/scriptlet-line-continue/expected.html +0 -1
- package/test/autotest/scriptlet-line-continue/input.htmljs +0 -3
- package/test/autotest/scriptlet-line-continue-chain/expected.html +0 -3
- package/test/autotest/scriptlet-line-continue-chain/input.htmljs +0 -8
- package/test/autotest/scriptlet-line-html/expected.html +0 -1
- package/test/autotest/scriptlet-line-html/input.htmljs +0 -3
- package/test/autotest/scriptlet-line-multiline-comments/expected.html +0 -5
- package/test/autotest/scriptlet-line-multiline-comments/input.htmljs +0 -7
- package/test/autotest/scriptlet-line-no-middle/expected.html +0 -2
- package/test/autotest/scriptlet-line-no-middle/input.htmljs +0 -1
- package/test/autotest/scriptlet-line-no-middle-html/expected.html +0 -1
- package/test/autotest/scriptlet-line-no-middle-html/input.htmljs +0 -3
- package/test/autotest/scriptlet-line-regex-open-bracket/input.htmljs +0 -1
- package/test/autotest/scriptlet-line-regex-open-bracket/test.js +0 -1
- package/test/autotest/scriptlet-line-regex-open-curly/input.htmljs +0 -1
- package/test/autotest/scriptlet-line-regex-open-curly/test.js +0 -1
- package/test/autotest/scriptlet-line-template-literal/expected.html +0 -1
- package/test/autotest/scriptlet-line-template-literal/input.htmljs +0 -4
- package/test/autotest/scriptlet-line-trailing-line-comment/expected.html +0 -5
- package/test/autotest/scriptlet-line-trailing-line-comment/input.htmljs +0 -5
- package/test/autotest/scriptlet-tag/expected.html +0 -11
- package/test/autotest/scriptlet-tag/input.htmljs +0 -6
- package/test/autotest/scriptlet-tag-html/expected.html +0 -7
- package/test/autotest/scriptlet-tag-html/input.htmljs +0 -8
- package/test/autotest/self-closed-tag/expected.html +0 -2
- package/test/autotest/self-closed-tag/input.htmljs +0 -1
- package/test/autotest/self-closed-tag-attrs/expected.html +0 -2
- package/test/autotest/self-closed-tag-attrs/input.htmljs +0 -1
- package/test/autotest/self-closing-open-tag-only/expected.html +0 -3
- package/test/autotest/self-closing-open-tag-only/input.htmljs +0 -1
- package/test/autotest/semicolon-concise/expected.html +0 -4
- package/test/autotest/semicolon-concise/input.htmljs +0 -2
- package/test/autotest/shorthand-class-dynamic/expected.html +0 -2
- package/test/autotest/shorthand-class-dynamic/input.htmljs +0 -1
- package/test/autotest/shorthand-class-dynamic-literal-prefix/expected.html +0 -2
- package/test/autotest/shorthand-class-dynamic-literal-prefix/input.htmljs +0 -1
- package/test/autotest/shorthand-class-dynamic-literal-suffix/expected.html +0 -2
- package/test/autotest/shorthand-class-dynamic-literal-suffix/input.htmljs +0 -1
- package/test/autotest/shorthand-class-self-closed/expected.html +0 -6
- package/test/autotest/shorthand-class-self-closed/input.htmljs +0 -3
- package/test/autotest/shorthand-closing-html/expected.html +0 -9
- package/test/autotest/shorthand-closing-html/input.htmljs +0 -5
- package/test/autotest/shorthand-closing-html2/expected.html +0 -3
- package/test/autotest/shorthand-closing-html2/input.htmljs +0 -2
- package/test/autotest/shorthand-closing-html3/expected.html +0 -3
- package/test/autotest/shorthand-closing-html3/input.htmljs +0 -2
- package/test/autotest/shorthand-div-id/expected.html +0 -2
- package/test/autotest/shorthand-div-id/input.htmljs +0 -1
- package/test/autotest/shorthand-div-id-class/expected.html +0 -2
- package/test/autotest/shorthand-div-id-class/input.htmljs +0 -1
- package/test/autotest/shorthand-div-id-class-multiple/expected.html +0 -2
- package/test/autotest/shorthand-div-id-class-multiple/input.htmljs +0 -1
- package/test/autotest/shorthand-id/expected.html +0 -2
- package/test/autotest/shorthand-id/input.htmljs +0 -1
- package/test/autotest/shorthand-id-class/expected.html +0 -2
- package/test/autotest/shorthand-id-class/input.htmljs +0 -1
- package/test/autotest/shorthand-id-class-html/expected.html +0 -3
- package/test/autotest/shorthand-id-class-html/input.htmljs +0 -2
- package/test/autotest/shorthand-id-dup/expected.html +0 -1
- package/test/autotest/shorthand-id-dup/input.htmljs +0 -1
- package/test/autotest/shorthand-id-dynamic/expected.html +0 -2
- package/test/autotest/shorthand-id-dynamic/input.htmljs +0 -1
- package/test/autotest/shorthand-id-dynamic-literal-prefix/expected.html +0 -2
- package/test/autotest/shorthand-id-dynamic-literal-prefix/input.htmljs +0 -1
- package/test/autotest/shorthand-id-dynamic-literal-suffix/expected.html +0 -2
- package/test/autotest/shorthand-id-dynamic-literal-suffix/input.htmljs +0 -1
- package/test/autotest/shorthand-id-self-closed/expected.html +0 -6
- package/test/autotest/shorthand-id-self-closed/input.htmljs +0 -3
- package/test/autotest/shorthand-mixed/expected.html +0 -15
- package/test/autotest/shorthand-mixed/input.htmljs +0 -5
- package/test/autotest/shorthand-mixed-concise/expected.html +0 -11
- package/test/autotest/shorthand-mixed-concise/input.htmljs +0 -5
- package/test/autotest/simple-text-delimited/expected.html +0 -1
- package/test/autotest/simple-text-delimited/input.htmljs +0 -3
- package/test/autotest/single-line-text-block/expected.html +0 -2
- package/test/autotest/single-line-text-block/input.htmljs +0 -2
- package/test/autotest/single-line-text-block-nested/expected.html +0 -4
- package/test/autotest/single-line-text-block-nested/input.htmljs +0 -3
- package/test/autotest/single-line-text-block-sibling/expected.html +0 -6
- package/test/autotest/single-line-text-block-sibling/input.htmljs +0 -5
- package/test/autotest/stray-forward-slash-within-open-tag/expected.html +0 -3
- package/test/autotest/stray-forward-slash-within-open-tag/input.htmljs +0 -1
- package/test/autotest/stray-special-chars/expected.html +0 -3
- package/test/autotest/stray-special-chars/input.htmljs +0 -1
- package/test/autotest/strip-bom/expected.html +0 -3
- package/test/autotest/strip-bom/input-good.htmljs +0 -1
- package/test/autotest/strip-bom/input.htmljs +0 -1
- package/test/autotest/strip-bom/input.htmljs.txt +0 -60
- package/test/autotest/tag-name-expression-literal-prefix/expected.html +0 -3
- package/test/autotest/tag-name-expression-literal-prefix/input.htmljs +0 -2
- package/test/autotest/tag-name-expression-literal-prefix-attrs/expected.html +0 -3
- package/test/autotest/tag-name-expression-literal-prefix-attrs/input.htmljs +0 -2
- package/test/autotest/tag-name-expression-literal-prefix-suffix/expected.html +0 -3
- package/test/autotest/tag-name-expression-literal-prefix-suffix/input.htmljs +0 -2
- package/test/autotest/tag-name-expression-literal-suffix/expected.html +0 -3
- package/test/autotest/tag-name-expression-literal-suffix/input.htmljs +0 -2
- package/test/autotest/tag-name-expression-shorthand-id/expected.html +0 -2
- package/test/autotest/tag-name-expression-shorthand-id/input.htmljs +0 -1
- package/test/autotest/tag-name-expression-simple/expected.html +0 -3
- package/test/autotest/tag-name-expression-simple/input.htmljs +0 -2
- package/test/autotest/tag-name-expression-simple-empty-close/expected.html +0 -3
- package/test/autotest/tag-name-expression-simple-empty-close/input.htmljs +0 -2
- package/test/autotest/tag-var-declaration/expected.html +0 -38
- package/test/autotest/tag-var-declaration/input.htmljs +0 -19
- package/test/autotest/tag-var-with-params/expected.html +0 -5
- package/test/autotest/tag-var-with-params/input.htmljs +0 -3
- package/test/autotest/text-after-semicolon/expected.html +0 -15
- package/test/autotest/text-after-semicolon/input.htmljs +0 -8
- package/test/autotest/text-after-tag/expected.html +0 -3
- package/test/autotest/text-after-tag/input.htmljs +0 -1
- package/test/autotest/text-parse-mode-concise/expected.html +0 -5
- package/test/autotest/text-parse-mode-concise/input.htmljs +0 -3
- package/test/autotest/text-parse-mode-concise/test.js +0 -1
- package/test/autotest/text-parse-mode-delimited-block/expected.html +0 -8
- package/test/autotest/text-parse-mode-delimited-block/input.htmljs +0 -6
- package/test/autotest/text-parse-mode-delimited-block/test.js +0 -1
- package/test/autotest/text-parse-mode-html/expected.html +0 -7
- package/test/autotest/text-parse-mode-html/input.htmljs +0 -3
- package/test/autotest/text-parse-mode-html/test.js +0 -1
- package/test/autotest/text-parse-mode-parsed-text/expected.html +0 -11
- package/test/autotest/text-parse-mode-parsed-text/input.htmljs +0 -7
- package/test/autotest/text-parse-mode-parsed-text/test.js +0 -7
- package/test/autotest/text-parse-mode-static-text/expected.html +0 -11
- package/test/autotest/text-parse-mode-static-text/input.htmljs +0 -7
- package/test/autotest/text-parse-mode-static-text/test.js +0 -7
- package/test/autotest/textarea/expected.html +0 -5
- package/test/autotest/textarea/input.htmljs +0 -2
- package/test/autotest/textarea/test.js +0 -0
- package/test/autotest/var/expected.html +0 -9
- package/test/autotest/var/input.htmljs +0 -5
- package/test/autotest/var-new-Date/expected.html +0 -2
- package/test/autotest/var-new-Date/input.htmljs +0 -1
- package/test/autotest/whitespace-around-equals/expected.html +0 -2
- package/test/autotest/whitespace-around-equals/input.htmljs +0 -1
- package/test/autotest/whitespace-empty-lines/expected.html +0 -7
- package/test/autotest/whitespace-empty-lines/input.htmljs +0 -4
- package/test/autotest/whitespace-empty-lines-indent/expected.html +0 -8
- package/test/autotest/whitespace-empty-lines-indent/input.htmljs +0 -4
- package/test/autotest/whitespace-newline/expected.html +0 -7
- package/test/autotest/whitespace-newline/input.htmljs +0 -6
- package/test/autotest/whitespace-newline-indent/expected.html +0 -7
- package/test/autotest/whitespace-newline-indent/input.htmljs +0 -6
- package/test/autotest/whitespace-only-reset-indent/expected.html +0 -6
- package/test/autotest/whitespace-only-reset-indent/input.htmljs +0 -3
- package/test/autotest/windows-line-ending/expected.html +0 -10
- package/test/autotest/windows-line-ending/test.js +0 -11
- package/test/autotest/xml-declaration/expected.html +0 -5
- package/test/autotest/xml-declaration/input.htmljs +0 -2
- package/test/autotest/xml-declaration-ill-formed/expected.html +0 -5
- package/test/autotest/xml-declaration-ill-formed/input.htmljs +0 -2
- package/test/autotest-1.x/argument-attr/expected.html +0 -2
- package/test/autotest-1.x/argument-attr/input.htmljs +0 -1
- package/test/autotest-1.x/argument-attr-extra-whitespace/expected.html +0 -4
- package/test/autotest-1.x/argument-attr-extra-whitespace/input.htmljs +0 -2
- package/test/autotest-1.x/argument-attr-multiple/expected.html +0 -1
- package/test/autotest-1.x/argument-attr-multiple/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag/expected.html +0 -2
- package/test/autotest-1.x/argument-tag/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag-attr/expected.html +0 -2
- package/test/autotest-1.x/argument-tag-attr/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag-complex/expected.html +0 -2
- package/test/autotest-1.x/argument-tag-complex/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag-extra-whitespace/expected.html +0 -2
- package/test/autotest-1.x/argument-tag-extra-whitespace/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag-multiple/expected.html +0 -1
- package/test/autotest-1.x/argument-tag-multiple/input.htmljs +0 -1
- package/test/autotest-1.x/argument-tag-nested-parens/expected.html +0 -3
- package/test/autotest-1.x/argument-tag-nested-parens/input.htmljs +0 -4
- package/test/autotest-1.x/attr-complex/expected.html +0 -1
- package/test/autotest-1.x/attr-complex/input.htmljs +0 -1
- package/test/autotest-1.x/attr-escape-characters/expected.html +0 -3
- package/test/autotest-1.x/attr-escape-characters/input.htmljs +0 -3
- package/test/autotest-1.x/attr-escaped-dollar/expected.html +0 -1
- package/test/autotest-1.x/attr-escaped-dollar/input.htmljs +0 -1
- package/test/autotest-1.x/attr-escaped-dollar/test.js +0 -5
- package/test/autotest-1.x/attr-grouped/expected.html +0 -3
- package/test/autotest-1.x/attr-grouped/input.htmljs +0 -5
- package/test/autotest-1.x/attr-grouped-2/expected.html +0 -3
- package/test/autotest-1.x/attr-grouped-2/input.htmljs +0 -5
- package/test/autotest-1.x/attr-grouped-3/expected.html +0 -3
- package/test/autotest-1.x/attr-grouped-3/input.htmljs +0 -5
- package/test/autotest-1.x/attr-grouped-4/expected.html +0 -3
- package/test/autotest-1.x/attr-grouped-4/input.htmljs +0 -5
- package/test/autotest-1.x/attr-grouped-invalid/expected.html +0 -1
- package/test/autotest-1.x/attr-grouped-invalid/input.htmljs +0 -5
- package/test/autotest-1.x/attr-grouped-invalid-eof/expected.html +0 -1
- package/test/autotest-1.x/attr-grouped-invalid-eof/input.htmljs +0 -4
- package/test/autotest-1.x/attr-grouped-multiple/expected.html +0 -3
- package/test/autotest-1.x/attr-grouped-multiple/input.htmljs +0 -4
- package/test/autotest-1.x/attr-int-and-id/expected.html +0 -2
- package/test/autotest-1.x/attr-int-and-id/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-false/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-false/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-false/test.js +0 -1
- package/test/autotest-1.x/attr-literal-null/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-null/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-null/test.js +0 -1
- package/test/autotest-1.x/attr-literal-numbers/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-numbers/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-numbers/test.js +0 -1
- package/test/autotest-1.x/attr-literal-string-double-quotes/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-string-double-quotes/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-string-double-quotes/test.js +0 -1
- package/test/autotest-1.x/attr-literal-string-single-quotes/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-string-single-quotes/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-string-single-quotes/test.js +0 -1
- package/test/autotest-1.x/attr-literal-true/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-true/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-true/test.js +0 -1
- package/test/autotest-1.x/attr-literal-undefined/expected.html +0 -2
- package/test/autotest-1.x/attr-literal-undefined/input.htmljs +0 -1
- package/test/autotest-1.x/attr-literal-undefined/test.js +0 -1
- package/test/autotest-1.x/attr-multi-line-comment/expected.html +0 -3
- package/test/autotest-1.x/attr-multi-line-comment/input.htmljs +0 -1
- package/test/autotest-1.x/attr-multi-line-string/expected.html +0 -2
- package/test/autotest-1.x/attr-multi-line-string/input.htmljs +0 -3
- package/test/autotest-1.x/attr-name-with-html-chars/expected.html +0 -1
- package/test/autotest-1.x/attr-name-with-html-chars/input.htmljs +0 -1
- package/test/autotest-1.x/attr-no-value/expected.html +0 -3
- package/test/autotest-1.x/attr-no-value/input.htmljs +0 -1
- package/test/autotest-1.x/attr-no-value-self-closed/expected.html +0 -2
- package/test/autotest-1.x/attr-no-value-self-closed/input.htmljs +0 -1
- package/test/autotest-1.x/attr-non-literal/expected.html +0 -5
- package/test/autotest-1.x/attr-non-literal/input.htmljs +0 -2
- package/test/autotest-1.x/attr-non-literal/test.js +0 -1
- package/test/autotest-1.x/attr-object-expressions/expected.html +0 -4
- package/test/autotest-1.x/attr-object-expressions/input.htmljs +0 -3
- package/test/autotest-1.x/attr-simple-expression/expected.html +0 -3
- package/test/autotest-1.x/attr-simple-expression/input.htmljs +0 -1
- package/test/autotest-1.x/attr-value-self-closed/expected.html +0 -2
- package/test/autotest-1.x/attr-value-self-closed/input.htmljs +0 -1
- package/test/autotest-1.x/attr-with-parens-and-double-quoted-strings/expected.html +0 -2
- package/test/autotest-1.x/attr-with-parens-and-double-quoted-strings/input.htmljs +0 -1
- package/test/autotest-1.x/attr-with-parens-and-single-quoted-strings/expected.html +0 -2
- package/test/autotest-1.x/attr-with-parens-and-single-quoted-strings/input.htmljs +0 -1
- package/test/autotest-1.x/attr-with-right-angle-bracket/expected.html +0 -3
- package/test/autotest-1.x/attr-with-right-angle-bracket/input.htmljs +0 -1
- package/test/autotest-1.x/attr-with-right-angle-bracket-parens/expected.html +0 -3
- package/test/autotest-1.x/attr-with-right-angle-bracket-parens/input.htmljs +0 -1
- package/test/autotest-1.x/attr-without-delimiters/expected.html +0 -2
- package/test/autotest-1.x/attr-without-delimiters/input.htmljs +0 -1
- package/test/autotest-1.x/backtick-string/expected.html +0 -3
- package/test/autotest-1.x/backtick-string/input.htmljs +0 -2
- package/test/autotest-1.x/backtick-string-eof/expected.html +0 -1
- package/test/autotest-1.x/backtick-string-eof/input.htmljs +0 -2
- package/test/autotest-1.x/bad-tag-indent/expected.html +0 -1
- package/test/autotest-1.x/bad-tag-indent/input.htmljs +0 -1
- package/test/autotest-1.x/cdata/expected.html +0 -3
- package/test/autotest-1.x/cdata/input.htmljs +0 -1
- package/test/autotest-1.x/cdata-2/expected.html +0 -5
- package/test/autotest-1.x/cdata-2/input.htmljs +0 -3
- package/test/autotest-1.x/cdata-pos/expected.html +0 -7
- package/test/autotest-1.x/cdata-pos/input.htmljs +0 -4
- package/test/autotest-1.x/cdata-pos/test.js +0 -1
- package/test/autotest-1.x/comment-concise-js-block/expected.html +0 -4
- package/test/autotest-1.x/comment-concise-js-block/input.htmljs +0 -6
- package/test/autotest-1.x/comment-concise-js-block-trailing/expected.html +0 -4
- package/test/autotest-1.x/comment-concise-js-block-trailing/input.htmljs +0 -6
- package/test/autotest-1.x/comment-concise-js-line/expected.html +0 -4
- package/test/autotest-1.x/comment-concise-js-line/input.htmljs +0 -3
- package/test/autotest-1.x/comments-within-open-tag/expected.html +0 -2
- package/test/autotest-1.x/comments-within-open-tag/input.htmljs +0 -1
- package/test/autotest-1.x/complex/expected.html +0 -24
- package/test/autotest-1.x/complex/input.htmljs +0 -22
- package/test/autotest-1.x/complex-attr-name/expected.html +0 -2
- package/test/autotest-1.x/complex-attr-name/input.htmljs +0 -1
- package/test/autotest-1.x/concise-complex-tag-name/expected.html +0 -2
- package/test/autotest-1.x/concise-complex-tag-name/input.htmljs +0 -1
- package/test/autotest-1.x/concise-contentplaceholder-html-start/expected.html +0 -5
- package/test/autotest-1.x/concise-contentplaceholder-html-start/input.htmljs +0 -1
- package/test/autotest-1.x/concise-contentplaceholder-start/expected.html +0 -1
- package/test/autotest-1.x/concise-contentplaceholder-start/input.htmljs +0 -1
- package/test/autotest-1.x/declaration/expected.html +0 -1
- package/test/autotest-1.x/declaration/input.htmljs +0 -1
- package/test/autotest-1.x/double-hyphen-block/expected.html +0 -12
- package/test/autotest-1.x/double-hyphen-block/input.htmljs +0 -8
- package/test/autotest-1.x/double-hyphen-line/expected.html +0 -12
- package/test/autotest-1.x/double-hyphen-line/input.htmljs +0 -5
- package/test/autotest-1.x/double-hyphen-line-start/expected.html +0 -12
- package/test/autotest-1.x/double-hyphen-line-start/input.htmljs +0 -6
- package/test/autotest-1.x/dtd/expected.html +0 -1
- package/test/autotest-1.x/dtd/input.htmljs +0 -1
- package/test/autotest-1.x/empty-closing-tag/expected.html +0 -8
- package/test/autotest-1.x/empty-closing-tag/input.htmljs +0 -6
- package/test/autotest-1.x/empty-closing-tag2/expected.html +0 -9
- package/test/autotest-1.x/empty-closing-tag2/input.htmljs +0 -5
- package/test/autotest-1.x/eof-attr-argument/expected.html +0 -1
- package/test/autotest-1.x/eof-attr-argument/input.htmljs +0 -1
- package/test/autotest-1.x/eof-attr-name/expected.html +0 -3
- package/test/autotest-1.x/eof-attr-name/input.htmljs +0 -1
- package/test/autotest-1.x/eof-attr-value/expected.html +0 -3
- package/test/autotest-1.x/eof-attr-value/input.htmljs +0 -1
- package/test/autotest-1.x/eof-attr-value-js-comment-comment/expected.html +0 -3
- package/test/autotest-1.x/eof-attr-value-js-comment-comment/input.htmljs +0 -1
- package/test/autotest-1.x/eof-attr-value-js-comment-comment-concise/expected.html +0 -1
- package/test/autotest-1.x/eof-attr-value-js-comment-comment-concise/input.htmljs +0 -1
- package/test/autotest-1.x/eof-attr-value-string/expected.html +0 -1
- package/test/autotest-1.x/eof-attr-value-string/input.htmljs +0 -1
- package/test/autotest-1.x/eof-doctype/expected.html +0 -1
- package/test/autotest-1.x/eof-doctype/input.htmljs +0 -1
- package/test/autotest-1.x/eof-placeholder-body-escaped/expected.html +0 -4
- package/test/autotest-1.x/eof-placeholder-body-escaped/input.htmljs +0 -1
- package/test/autotest-1.x/eof-placeholder-body-non-escaped/expected.html +0 -4
- package/test/autotest-1.x/eof-placeholder-body-non-escaped/input.htmljs +0 -4
- package/test/autotest-1.x/eof-placeholder-concise/expected.html +0 -3
- package/test/autotest-1.x/eof-placeholder-concise/input.htmljs +0 -2
- package/test/autotest-1.x/eof-placeholder-script-body-escaped/expected.html +0 -4
- package/test/autotest-1.x/eof-placeholder-script-body-escaped/input.htmljs +0 -1
- package/test/autotest-1.x/eof-placeholder-script-body-non-escaped/expected.html +0 -4
- package/test/autotest-1.x/eof-placeholder-script-body-non-escaped/input.htmljs +0 -1
- package/test/autotest-1.x/eof-placeholder-string/expected.html +0 -4
- package/test/autotest-1.x/eof-placeholder-string/input.htmljs +0 -1
- package/test/autotest-1.x/eof-script-body/expected.html +0 -4
- package/test/autotest-1.x/eof-script-body/input.htmljs +0 -2
- package/test/autotest-1.x/eof-style/expected.html +0 -4
- package/test/autotest-1.x/eof-style/input.htmljs +0 -1
- package/test/autotest-1.x/eof-tag-start/expected.html +0 -3
- package/test/autotest-1.x/eof-tag-start/input.htmljs +0 -1
- package/test/autotest-1.x/eof-xml-declaration/expected.html +0 -1
- package/test/autotest-1.x/eof-xml-declaration/input.htmljs +0 -1
- package/test/autotest-1.x/html-block-after-tag/expected.html +0 -6
- package/test/autotest-1.x/html-block-after-tag/input.htmljs +0 -1
- package/test/autotest-1.x/html-comments/expected.html +0 -3
- package/test/autotest-1.x/html-comments/input.htmljs +0 -1
- package/test/autotest-1.x/html-comments-ignore-placeholders/expected.html +0 -1
- package/test/autotest-1.x/html-comments-ignore-placeholders/input.htmljs +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-double-escaped-dollar-placeholder/expected.html +0 -2
- package/test/autotest-1.x/ignorePlaceholders-attr-double-escaped-dollar-placeholder/input.htmljs +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-double-escaped-dollar-placeholder/test.js +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-escaped-dollar-placeholder/expected.html +0 -2
- package/test/autotest-1.x/ignorePlaceholders-attr-escaped-dollar-placeholder/input.htmljs +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-escaped-dollar-placeholder/test.js +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-placeholder/expected.html +0 -2
- package/test/autotest-1.x/ignorePlaceholders-attr-placeholder/input.htmljs +0 -1
- package/test/autotest-1.x/ignorePlaceholders-attr-placeholder/test.js +0 -1
- package/test/autotest-1.x/invalid-closing-tag/expected.html +0 -4
- package/test/autotest-1.x/invalid-closing-tag/input.htmljs +0 -1
- package/test/autotest-1.x/mixed/expected.html +0 -21
- package/test/autotest-1.x/mixed/input.htmljs +0 -8
- package/test/autotest-1.x/mixed-bad-indentation/expected.html +0 -7
- package/test/autotest-1.x/mixed-bad-indentation/input.htmljs +0 -3
- package/test/autotest-1.x/mixed-cdata/expected.html +0 -7
- package/test/autotest-1.x/mixed-cdata/input.htmljs +0 -3
- package/test/autotest-1.x/mixed-comment/expected.html +0 -7
- package/test/autotest-1.x/mixed-comment/input.htmljs +0 -6
- package/test/autotest-1.x/mixed-invalid/expected.html +0 -16
- package/test/autotest-1.x/mixed-invalid/input.htmljs +0 -9
- package/test/autotest-1.x/mixed-open-tag-only/expected.html +0 -14
- package/test/autotest-1.x/mixed-open-tag-only/input.htmljs +0 -6
- package/test/autotest-1.x/multiline-html-block/expected.html +0 -5
- package/test/autotest-1.x/multiline-html-block/input.htmljs +0 -4
- package/test/autotest-1.x/multiline-html-block-empty/expected.html +0 -0
- package/test/autotest-1.x/multiline-html-block-empty/input.htmljs +0 -2
- package/test/autotest-1.x/multiline-html-block-missing-end/expected.html +0 -1
- package/test/autotest-1.x/multiline-html-block-missing-end/input.htmljs +0 -3
- package/test/autotest-1.x/multiline-html-block-nested/expected.html +0 -7
- package/test/autotest-1.x/multiline-html-block-nested/input.htmljs +0 -5
- package/test/autotest-1.x/multiline-html-block-nested-empty/expected.html +0 -2
- package/test/autotest-1.x/multiline-html-block-nested-empty/input.htmljs +0 -3
- package/test/autotest-1.x/multiline-text-block/expected.html +0 -1
- package/test/autotest-1.x/multiline-text-block/input.htmljs +0 -4
- package/test/autotest-1.x/multiline-text-block-bad/expected.html +0 -1
- package/test/autotest-1.x/multiline-text-block-bad/input.htmljs +0 -5
- package/test/autotest-1.x/multiline-text-block-with-hyphens/expected.html +0 -1
- package/test/autotest-1.x/multiline-text-block-with-hyphens/input.htmljs +0 -4
- package/test/autotest-1.x/nested-pyramid/expected.html +0 -12
- package/test/autotest-1.x/nested-pyramid/input.htmljs +0 -6
- package/test/autotest-1.x/nested-siblings/expected.html +0 -6
- package/test/autotest-1.x/nested-siblings/input.htmljs +0 -3
- package/test/autotest-1.x/nested-tags/expected.html +0 -4
- package/test/autotest-1.x/nested-tags/input.htmljs +0 -2
- package/test/autotest-1.x/nested-text/expected.html +0 -8
- package/test/autotest-1.x/nested-text/input.htmljs +0 -8
- package/test/autotest-1.x/new-attr-prefix/expected.html +0 -3
- package/test/autotest-1.x/new-attr-prefix/input.htmljs +0 -1
- package/test/autotest-1.x/open-tag-only/expected.html +0 -12
- package/test/autotest-1.x/open-tag-only/input.htmljs +0 -1
- package/test/autotest-1.x/open-tag-only-custom/expected.html +0 -10
- package/test/autotest-1.x/open-tag-only-custom/input.htmljs +0 -4
- package/test/autotest-1.x/open-tag-only-custom/test.js +0 -9
- package/test/autotest-1.x/open-tag-only-with-body/expected.html +0 -4
- package/test/autotest-1.x/open-tag-only-with-body/input.htmljs +0 -5
- package/test/autotest-1.x/open-tag-only-with-body-concise/expected.html +0 -3
- package/test/autotest-1.x/open-tag-only-with-body-concise/input.htmljs +0 -2
- package/test/autotest-1.x/open-tag-parser-state/expected.html +0 -21
- package/test/autotest-1.x/open-tag-parser-state/input.htmljs +0 -11
- package/test/autotest-1.x/open-tag-parser-state/test.js +0 -21
- package/test/autotest-1.x/open-tag-parser-state-concise/expected.html +0 -19
- package/test/autotest-1.x/open-tag-parser-state-concise/input.htmljs +0 -17
- package/test/autotest-1.x/open-tag-parser-state-concise/test.js +0 -17
- package/test/autotest-1.x/parsed-text-style-tag/expected.html +0 -3
- package/test/autotest-1.x/parsed-text-style-tag/input.htmljs +0 -1
- package/test/autotest-1.x/parsed-text-style-tag-class/expected.html +0 -12
- package/test/autotest-1.x/parsed-text-style-tag-class/input.htmljs +0 -3
- package/test/autotest-1.x/placeholder-attr-invalid/expected.html +0 -1
- package/test/autotest-1.x/placeholder-attr-invalid/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-string-value/expected.html +0 -3
- package/test/autotest-1.x/placeholder-attr-string-value/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-string-value-mixed-quotes/expected.html +0 -3
- package/test/autotest-1.x/placeholder-attr-string-value-mixed-quotes/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-string-value-parens/expected.html +0 -3
- package/test/autotest-1.x/placeholder-attr-string-value-parens/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-within-placeholder/expected.html +0 -2
- package/test/autotest-1.x/placeholder-attr-within-placeholder/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-within-string-complex/expected.html +0 -2
- package/test/autotest-1.x/placeholder-attr-within-string-complex/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-within-string-simple/expected.html +0 -2
- package/test/autotest-1.x/placeholder-attr-within-string-simple/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-attr-wrapped/expected.html +0 -2
- package/test/autotest-1.x/placeholder-attr-wrapped/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-backslash/expected.html +0 -23
- package/test/autotest-1.x/placeholder-backslash/input.htmljs +0 -15
- package/test/autotest-1.x/placeholder-body-multi-line-js-comment/expected.html +0 -3
- package/test/autotest-1.x/placeholder-body-multi-line-js-comment/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-body-single-line-js-comment/expected.html +0 -3
- package/test/autotest-1.x/placeholder-body-single-line-js-comment/input.htmljs +0 -2
- package/test/autotest-1.x/placeholder-body-text/expected.html +0 -5
- package/test/autotest-1.x/placeholder-body-text/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-escape/expected.html +0 -5
- package/test/autotest-1.x/placeholder-escape/input.htmljs +0 -3
- package/test/autotest-1.x/placeholder-no-escape/expected.html +0 -5
- package/test/autotest-1.x/placeholder-no-escape/input.htmljs +0 -3
- package/test/autotest-1.x/placeholder-unnamed-attr/expected.html +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-escaped/expected.html +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr-escaped/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-escaped-escaped/expected.html +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr-escaped-escaped/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-last/expected.html +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr-last/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-last-concise/expected.html +0 -4
- package/test/autotest-1.x/placeholder-unnamed-attr-last-concise/input.htmljs +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr-last-self-closed/expected.html +0 -2
- package/test/autotest-1.x/placeholder-unnamed-attr-last-self-closed/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-trailing-text/expected.html +0 -1
- package/test/autotest-1.x/placeholder-unnamed-attr-trailing-text/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-within-placeholder/expected.html +0 -1
- package/test/autotest-1.x/placeholder-within-placeholder/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-within-placeholder-escaping/expected.html +0 -1
- package/test/autotest-1.x/placeholder-within-placeholder-escaping/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-within-script-tag/expected.html +0 -5
- package/test/autotest-1.x/placeholder-within-script-tag/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-within-script-within-string/expected.html +0 -5
- package/test/autotest-1.x/placeholder-within-script-within-string/input.htmljs +0 -1
- package/test/autotest-1.x/placeholder-within-string-newlines/expected.html +0 -4
- package/test/autotest-1.x/placeholder-within-string-newlines/input.htmljs +0 -3
- package/test/autotest-1.x/root-el/expected.html +0 -2
- package/test/autotest-1.x/root-el/input.htmljs +0 -1
- package/test/autotest-1.x/root-els/expected.html +0 -4
- package/test/autotest-1.x/root-els/input.htmljs +0 -2
- package/test/autotest-1.x/script/expected.html +0 -3
- package/test/autotest-1.x/script/input.htmljs +0 -2
- package/test/autotest-1.x/script-concise/expected.html +0 -6
- package/test/autotest-1.x/script-concise/input.htmljs +0 -7
- package/test/autotest-1.x/script-concise-invalid-nested-tag/expected.html +0 -3
- package/test/autotest-1.x/script-concise-invalid-nested-tag/input.htmljs +0 -3
- package/test/autotest-1.x/script-empty-concise/expected.html +0 -6
- package/test/autotest-1.x/script-empty-concise/input.htmljs +0 -3
- package/test/autotest-1.x/script-self-closed/expected.html +0 -9
- package/test/autotest-1.x/script-self-closed/input.htmljs +0 -4
- package/test/autotest-1.x/script-single-line-comment/expected.html +0 -3
- package/test/autotest-1.x/script-single-line-comment/input.htmljs +0 -1
- package/test/autotest-1.x/scriptlet/expected.html +0 -11
- package/test/autotest-1.x/scriptlet/input.htmljs +0 -6
- package/test/autotest-1.x/scriptlet-html-block/expected.html +0 -7
- package/test/autotest-1.x/scriptlet-html-block/input.htmljs +0 -8
- package/test/autotest-1.x/self-closed-tag/expected.html +0 -2
- package/test/autotest-1.x/self-closed-tag/input.htmljs +0 -1
- package/test/autotest-1.x/self-closed-tag-attrs/expected.html +0 -2
- package/test/autotest-1.x/self-closed-tag-attrs/input.htmljs +0 -1
- package/test/autotest-1.x/self-closing-open-tag-only/expected.html +0 -3
- package/test/autotest-1.x/self-closing-open-tag-only/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-class-dynamic/expected.html +0 -2
- package/test/autotest-1.x/shorthand-class-dynamic/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-class-dynamic-literal-prefix/expected.html +0 -2
- package/test/autotest-1.x/shorthand-class-dynamic-literal-prefix/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-class-dynamic-literal-suffix/expected.html +0 -2
- package/test/autotest-1.x/shorthand-class-dynamic-literal-suffix/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-class-self-closed/expected.html +0 -6
- package/test/autotest-1.x/shorthand-class-self-closed/input.htmljs +0 -3
- package/test/autotest-1.x/shorthand-closing-html/expected.html +0 -9
- package/test/autotest-1.x/shorthand-closing-html/input.htmljs +0 -5
- package/test/autotest-1.x/shorthand-closing-html2/expected.html +0 -3
- package/test/autotest-1.x/shorthand-closing-html2/input.htmljs +0 -2
- package/test/autotest-1.x/shorthand-closing-html3/expected.html +0 -3
- package/test/autotest-1.x/shorthand-closing-html3/input.htmljs +0 -2
- package/test/autotest-1.x/shorthand-div-id/expected.html +0 -2
- package/test/autotest-1.x/shorthand-div-id/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-div-id-class/expected.html +0 -2
- package/test/autotest-1.x/shorthand-div-id-class/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-div-id-class-multiple/expected.html +0 -2
- package/test/autotest-1.x/shorthand-div-id-class-multiple/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id/expected.html +0 -2
- package/test/autotest-1.x/shorthand-id/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-class/expected.html +0 -2
- package/test/autotest-1.x/shorthand-id-class/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-class-html/expected.html +0 -3
- package/test/autotest-1.x/shorthand-id-class-html/input.htmljs +0 -2
- package/test/autotest-1.x/shorthand-id-dup/expected.html +0 -1
- package/test/autotest-1.x/shorthand-id-dup/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-dynamic/expected.html +0 -2
- package/test/autotest-1.x/shorthand-id-dynamic/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-dynamic-literal-prefix/expected.html +0 -2
- package/test/autotest-1.x/shorthand-id-dynamic-literal-prefix/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-dynamic-literal-suffix/expected.html +0 -2
- package/test/autotest-1.x/shorthand-id-dynamic-literal-suffix/input.htmljs +0 -1
- package/test/autotest-1.x/shorthand-id-self-closed/expected.html +0 -6
- package/test/autotest-1.x/shorthand-id-self-closed/input.htmljs +0 -3
- package/test/autotest-1.x/shorthand-mixed/expected.html +0 -15
- package/test/autotest-1.x/shorthand-mixed/input.htmljs +0 -5
- package/test/autotest-1.x/shorthand-mixed-concise/expected.html +0 -11
- package/test/autotest-1.x/shorthand-mixed-concise/input.htmljs +0 -5
- package/test/autotest-1.x/simple-text-delimited/expected.html +0 -1
- package/test/autotest-1.x/simple-text-delimited/input.htmljs +0 -3
- package/test/autotest-1.x/single-hyphen-after-attr/expected.html +0 -3
- package/test/autotest-1.x/single-hyphen-after-attr/input.htmljs +0 -1
- package/test/autotest-1.x/single-line-text-block/expected.html +0 -2
- package/test/autotest-1.x/single-line-text-block/input.htmljs +0 -2
- package/test/autotest-1.x/single-line-text-block-nested/expected.html +0 -4
- package/test/autotest-1.x/single-line-text-block-nested/input.htmljs +0 -3
- package/test/autotest-1.x/single-line-text-block-sibling/expected.html +0 -6
- package/test/autotest-1.x/single-line-text-block-sibling/input.htmljs +0 -5
- package/test/autotest-1.x/stray-forward-slash-within-open-tag/expected.html +0 -3
- package/test/autotest-1.x/stray-forward-slash-within-open-tag/input.htmljs +0 -1
- package/test/autotest-1.x/stray-special-chars/expected.html +0 -3
- package/test/autotest-1.x/stray-special-chars/input.htmljs +0 -1
- package/test/autotest-1.x/strip-bom/expected.html +0 -3
- package/test/autotest-1.x/strip-bom/input-good.htmljs +0 -1
- package/test/autotest-1.x/strip-bom/input.htmljs +0 -1
- package/test/autotest-1.x/strip-bom/input.htmljs.txt +0 -60
- package/test/autotest-1.x/tag-name-expression-literal-prefix/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-literal-prefix/input.htmljs +0 -2
- package/test/autotest-1.x/tag-name-expression-literal-prefix-attrs/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-literal-prefix-attrs/input.htmljs +0 -2
- package/test/autotest-1.x/tag-name-expression-literal-prefix-suffix/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-literal-prefix-suffix/input.htmljs +0 -2
- package/test/autotest-1.x/tag-name-expression-literal-suffix/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-literal-suffix/input.htmljs +0 -2
- package/test/autotest-1.x/tag-name-expression-shorthand-id/expected.html +0 -2
- package/test/autotest-1.x/tag-name-expression-shorthand-id/input.htmljs +0 -1
- package/test/autotest-1.x/tag-name-expression-simple/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-simple/input.htmljs +0 -2
- package/test/autotest-1.x/tag-name-expression-simple-empty-close/expected.html +0 -3
- package/test/autotest-1.x/tag-name-expression-simple-empty-close/input.htmljs +0 -2
- package/test/autotest-1.x/text-after-tag/expected.html +0 -3
- package/test/autotest-1.x/text-after-tag/input.htmljs +0 -1
- package/test/autotest-1.x/text-parse-mode-concise/expected.html +0 -5
- package/test/autotest-1.x/text-parse-mode-concise/input.htmljs +0 -3
- package/test/autotest-1.x/text-parse-mode-concise/test.js +0 -1
- package/test/autotest-1.x/text-parse-mode-delimited-block/expected.html +0 -8
- package/test/autotest-1.x/text-parse-mode-delimited-block/input.htmljs +0 -6
- package/test/autotest-1.x/text-parse-mode-delimited-block/test.js +0 -1
- package/test/autotest-1.x/text-parse-mode-html/expected.html +0 -7
- package/test/autotest-1.x/text-parse-mode-html/input.htmljs +0 -3
- package/test/autotest-1.x/text-parse-mode-html/test.js +0 -1
- package/test/autotest-1.x/text-parse-mode-parsed-text/expected.html +0 -11
- package/test/autotest-1.x/text-parse-mode-parsed-text/input.htmljs +0 -7
- package/test/autotest-1.x/text-parse-mode-parsed-text/test.js +0 -7
- package/test/autotest-1.x/text-parse-mode-static-text/expected.html +0 -11
- package/test/autotest-1.x/text-parse-mode-static-text/input.htmljs +0 -7
- package/test/autotest-1.x/text-parse-mode-static-text/test.js +0 -7
- package/test/autotest-1.x/var/expected.html +0 -9
- package/test/autotest-1.x/var/input.htmljs +0 -5
- package/test/autotest-1.x/whitespace-empty-lines/expected.html +0 -7
- package/test/autotest-1.x/whitespace-empty-lines/input.htmljs +0 -4
- package/test/autotest-1.x/whitespace-empty-lines-indent/expected.html +0 -8
- package/test/autotest-1.x/whitespace-empty-lines-indent/input.htmljs +0 -4
- package/test/autotest-1.x/whitespace-newline/expected.html +0 -7
- package/test/autotest-1.x/whitespace-newline/input.htmljs +0 -6
- package/test/autotest-1.x/whitespace-newline-indent/expected.html +0 -7
- package/test/autotest-1.x/whitespace-newline-indent/input.htmljs +0 -6
- package/test/autotest-1.x/windows-line-ending/expected.html +0 -10
- package/test/autotest-1.x/windows-line-ending/test.js +0 -11
- package/test/autotest-1.x/xml-declaration/expected.html +0 -5
- package/test/autotest-1.x/xml-declaration/input.htmljs +0 -2
- package/test/autotest-1.x/xml-declaration-ill-formed/expected.html +0 -5
- package/test/autotest-1.x/xml-declaration-ill-formed/input.htmljs +0 -2
- package/test/test.js +0 -6
- package/test/util/TreeBuilder.js +0 -417
- package/test/util/runDirTest.js +0 -76
package/dist/index.js
ADDED
|
@@ -0,0 +1,2034 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
OpenTagEnding: () => OpenTagEnding,
|
|
23
|
+
createParser: () => createParser
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/util/constants.ts
|
|
28
|
+
var OpenTagEnding = /* @__PURE__ */ ((OpenTagEnding2) => {
|
|
29
|
+
OpenTagEnding2[OpenTagEnding2["tag"] = 0] = "tag";
|
|
30
|
+
OpenTagEnding2[OpenTagEnding2["self"] = 1] = "self";
|
|
31
|
+
OpenTagEnding2[OpenTagEnding2["void"] = 2] = "void";
|
|
32
|
+
OpenTagEnding2[OpenTagEnding2["code"] = 4] = "code";
|
|
33
|
+
return OpenTagEnding2;
|
|
34
|
+
})(OpenTagEnding || {});
|
|
35
|
+
|
|
36
|
+
// src/util/util.ts
|
|
37
|
+
function isWhitespaceCode(code) {
|
|
38
|
+
return code <= 32 /* SPACE */;
|
|
39
|
+
}
|
|
40
|
+
function getLoc(lines, range) {
|
|
41
|
+
const start = getPos(lines, 0, range.start);
|
|
42
|
+
const end = range.start === range.end ? start : getPos(lines, start.line, range.end);
|
|
43
|
+
return { start, end };
|
|
44
|
+
}
|
|
45
|
+
function getPos(lines, startLine, index) {
|
|
46
|
+
let max = lines.length - 1;
|
|
47
|
+
let line = startLine;
|
|
48
|
+
while (line < max) {
|
|
49
|
+
const mid = 1 + line + max >>> 1;
|
|
50
|
+
if (lines[mid] <= index) {
|
|
51
|
+
line = mid;
|
|
52
|
+
} else {
|
|
53
|
+
max = mid - 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
line,
|
|
58
|
+
character: index - lines[line]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function getLines(src) {
|
|
62
|
+
const lines = [-1];
|
|
63
|
+
for (let i = 0; i < src.length; i++) {
|
|
64
|
+
if (src.charCodeAt(i) === 10 /* NEWLINE */) {
|
|
65
|
+
lines.push(i);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return lines;
|
|
69
|
+
}
|
|
70
|
+
function htmlEOF() {
|
|
71
|
+
this.endText();
|
|
72
|
+
while (this.activeTag) {
|
|
73
|
+
if (this.activeTag.concise) {
|
|
74
|
+
this.closeTag(this.pos, this.pos, void 0);
|
|
75
|
+
} else {
|
|
76
|
+
return this.emitError(this.activeTag, "MISSING_END_TAG", 'Missing ending "' + this.read(this.activeTag.tagName) + '" tag');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/core/Parser.ts
|
|
82
|
+
var Parser = class {
|
|
83
|
+
constructor(handlers) {
|
|
84
|
+
this.handlers = handlers;
|
|
85
|
+
this.handlers = handlers;
|
|
86
|
+
}
|
|
87
|
+
pos;
|
|
88
|
+
maxPos;
|
|
89
|
+
data;
|
|
90
|
+
activeState;
|
|
91
|
+
activeRange;
|
|
92
|
+
forward;
|
|
93
|
+
activeTag;
|
|
94
|
+
activeAttr;
|
|
95
|
+
indent;
|
|
96
|
+
isConcise;
|
|
97
|
+
beginMixedMode;
|
|
98
|
+
endingMixedModeAtEOL;
|
|
99
|
+
textPos;
|
|
100
|
+
lines;
|
|
101
|
+
read(range) {
|
|
102
|
+
return this.data.slice(range.start, range.end);
|
|
103
|
+
}
|
|
104
|
+
positionAt(index) {
|
|
105
|
+
return getPos(this.lines || (this.lines = getLines(this.data)), 0, index);
|
|
106
|
+
}
|
|
107
|
+
locationAt(range) {
|
|
108
|
+
return getLoc(this.lines || (this.lines = getLines(this.data)), range);
|
|
109
|
+
}
|
|
110
|
+
enterState(state) {
|
|
111
|
+
this.activeState = state;
|
|
112
|
+
return this.activeRange = state.enter.call(this, this.activeRange, this.pos);
|
|
113
|
+
}
|
|
114
|
+
exitState() {
|
|
115
|
+
const { activeRange, activeState } = this;
|
|
116
|
+
const parent = this.activeRange = activeRange.parent;
|
|
117
|
+
this.activeState = parent.state;
|
|
118
|
+
this.forward = 0;
|
|
119
|
+
activeRange.end = this.pos;
|
|
120
|
+
activeState.exit.call(this, activeRange);
|
|
121
|
+
this.activeState.return.call(this, activeRange, parent);
|
|
122
|
+
}
|
|
123
|
+
matchAtPos(a, b) {
|
|
124
|
+
const aPos = a.start;
|
|
125
|
+
const aLen = a.end - aPos;
|
|
126
|
+
let bPos = 0;
|
|
127
|
+
let bLen = 0;
|
|
128
|
+
let bSource = this.data;
|
|
129
|
+
if (typeof b === "string") {
|
|
130
|
+
bLen = b.length;
|
|
131
|
+
bSource = b;
|
|
132
|
+
} else {
|
|
133
|
+
bPos = b.start;
|
|
134
|
+
bLen = b.end - bPos;
|
|
135
|
+
}
|
|
136
|
+
if (aLen !== bLen)
|
|
137
|
+
return false;
|
|
138
|
+
for (let i = 0; i < aLen; i++) {
|
|
139
|
+
if (this.data.charAt(aPos + i) !== bSource.charAt(bPos + i)) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
matchAnyAtPos(a, list) {
|
|
146
|
+
for (const item of list) {
|
|
147
|
+
if (this.matchAtPos(a, item))
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
lookAheadFor(str, startPos = this.pos + 1) {
|
|
153
|
+
let i = str.length;
|
|
154
|
+
if (startPos + i <= this.maxPos) {
|
|
155
|
+
const { data } = this;
|
|
156
|
+
for (; i--; ) {
|
|
157
|
+
if (str[i] !== data[startPos + i]) {
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return str;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
lookAtCharCodeAhead(offset, startPos = this.pos) {
|
|
165
|
+
return this.data.charCodeAt(startPos + offset);
|
|
166
|
+
}
|
|
167
|
+
startText() {
|
|
168
|
+
if (this.textPos === -1) {
|
|
169
|
+
this.textPos = this.pos;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
endText() {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
const start = this.textPos;
|
|
175
|
+
if (start !== -1) {
|
|
176
|
+
(_b = (_a = this.handlers).onText) == null ? void 0 : _b.call(_a, { start, end: this.pos });
|
|
177
|
+
this.textPos = -1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
beginHtmlBlock(delimiter, singleLine) {
|
|
181
|
+
var _a;
|
|
182
|
+
const content = this.enterState(((_a = this.activeTag) == null ? void 0 : _a.bodyMode) === 1 /* PARSED_TEXT */ ? states_exports.PARSED_TEXT_CONTENT : states_exports.HTML_CONTENT);
|
|
183
|
+
content.singleLine = singleLine;
|
|
184
|
+
content.delimiter = delimiter;
|
|
185
|
+
content.indent = this.indent;
|
|
186
|
+
}
|
|
187
|
+
emitError(range, code, message) {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
let start, end;
|
|
190
|
+
if (typeof range === "number") {
|
|
191
|
+
start = end = range;
|
|
192
|
+
} else {
|
|
193
|
+
start = range.start;
|
|
194
|
+
end = range.end;
|
|
195
|
+
}
|
|
196
|
+
(_b = (_a = this.handlers).onError) == null ? void 0 : _b.call(_a, {
|
|
197
|
+
start,
|
|
198
|
+
end,
|
|
199
|
+
code,
|
|
200
|
+
message
|
|
201
|
+
});
|
|
202
|
+
this.pos = this.maxPos + 1;
|
|
203
|
+
}
|
|
204
|
+
closeTag(start, end, value) {
|
|
205
|
+
var _a, _b;
|
|
206
|
+
const { beginMixedMode, parentTag } = this.activeTag;
|
|
207
|
+
if (beginMixedMode)
|
|
208
|
+
this.endingMixedModeAtEOL = true;
|
|
209
|
+
this.activeTag = parentTag;
|
|
210
|
+
(_b = (_a = this.handlers).onCloseTag) == null ? void 0 : _b.call(_a, {
|
|
211
|
+
start,
|
|
212
|
+
end,
|
|
213
|
+
value
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
consumeWhitespaceIfBefore(str, start = 0) {
|
|
217
|
+
const { pos, data } = this;
|
|
218
|
+
let cur = pos + start;
|
|
219
|
+
while (isWhitespaceCode(data.charCodeAt(cur)))
|
|
220
|
+
cur++;
|
|
221
|
+
if (this.lookAheadFor(str, cur)) {
|
|
222
|
+
this.pos = cur;
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
getPreviousNonWhitespaceCharCode(start = -1) {
|
|
228
|
+
let behind = start;
|
|
229
|
+
while (isWhitespaceCode(this.lookAtCharCodeAhead(behind)))
|
|
230
|
+
behind--;
|
|
231
|
+
return this.lookAtCharCodeAhead(behind);
|
|
232
|
+
}
|
|
233
|
+
onlyWhitespaceRemainsOnLine(start = 1) {
|
|
234
|
+
const maxOffset = this.maxPos - this.pos;
|
|
235
|
+
let ahead = start;
|
|
236
|
+
while (ahead < maxOffset) {
|
|
237
|
+
const code = this.lookAtCharCodeAhead(ahead);
|
|
238
|
+
if (isWhitespaceCode(code)) {
|
|
239
|
+
switch (code) {
|
|
240
|
+
case 13 /* CARRIAGE_RETURN */:
|
|
241
|
+
case 10 /* NEWLINE */:
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
ahead++;
|
|
248
|
+
}
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
consumeWhitespaceOnLine(start = 1) {
|
|
252
|
+
const maxOffset = this.maxPos - this.pos;
|
|
253
|
+
let ahead = start;
|
|
254
|
+
while (ahead < maxOffset) {
|
|
255
|
+
const code = this.lookAtCharCodeAhead(ahead);
|
|
256
|
+
if (isWhitespaceCode(code)) {
|
|
257
|
+
switch (code) {
|
|
258
|
+
case 13 /* CARRIAGE_RETURN */:
|
|
259
|
+
case 10 /* NEWLINE */:
|
|
260
|
+
this.pos += ahead;
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
this.pos += ahead;
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
ahead++;
|
|
268
|
+
}
|
|
269
|
+
this.pos = this.maxPos;
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
consumeWhitespace() {
|
|
273
|
+
const maxOffset = this.maxPos - this.pos;
|
|
274
|
+
let ahead = 0;
|
|
275
|
+
while (ahead < maxOffset && isWhitespaceCode(this.lookAtCharCodeAhead(ahead))) {
|
|
276
|
+
ahead++;
|
|
277
|
+
}
|
|
278
|
+
this.pos += ahead;
|
|
279
|
+
}
|
|
280
|
+
parse(data) {
|
|
281
|
+
const maxPos = this.maxPos = data.length;
|
|
282
|
+
this.data = data;
|
|
283
|
+
this.indent = "";
|
|
284
|
+
this.textPos = -1;
|
|
285
|
+
this.forward = 1;
|
|
286
|
+
this.isConcise = true;
|
|
287
|
+
this.beginMixedMode = this.endingMixedModeAtEOL = false;
|
|
288
|
+
this.lines = this.activeTag = this.activeAttr = void 0;
|
|
289
|
+
this.pos = data.charCodeAt(0) === 65279 ? 1 : 0;
|
|
290
|
+
this.enterState(states_exports.CONCISE_HTML_CONTENT);
|
|
291
|
+
while (this.pos < maxPos) {
|
|
292
|
+
const code = data.charCodeAt(this.pos);
|
|
293
|
+
if (code === 10 /* NEWLINE */) {
|
|
294
|
+
this.forward = 1;
|
|
295
|
+
this.activeState.eol.call(this, 1, this.activeRange);
|
|
296
|
+
} else if (code === 13 /* CARRIAGE_RETURN */ && data.charCodeAt(this.pos + 1) === 10 /* NEWLINE */) {
|
|
297
|
+
this.forward = 2;
|
|
298
|
+
this.activeState.eol.call(this, 2, this.activeRange);
|
|
299
|
+
} else {
|
|
300
|
+
this.forward = 1;
|
|
301
|
+
this.activeState.char.call(this, code, this.activeRange);
|
|
302
|
+
}
|
|
303
|
+
this.pos += this.forward;
|
|
304
|
+
}
|
|
305
|
+
while (this.pos === this.maxPos) {
|
|
306
|
+
this.forward = 1;
|
|
307
|
+
this.activeState.eof.call(this, this.activeRange);
|
|
308
|
+
if (this.forward !== 0)
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/states/index.ts
|
|
315
|
+
var states_exports = {};
|
|
316
|
+
__export(states_exports, {
|
|
317
|
+
ATTRIBUTE: () => ATTRIBUTE,
|
|
318
|
+
BEGIN_DELIMITED_HTML_BLOCK: () => BEGIN_DELIMITED_HTML_BLOCK,
|
|
319
|
+
CDATA: () => CDATA,
|
|
320
|
+
CLOSE_TAG: () => CLOSE_TAG,
|
|
321
|
+
CONCISE_HTML_CONTENT: () => CONCISE_HTML_CONTENT,
|
|
322
|
+
DECLARATION: () => DECLARATION,
|
|
323
|
+
DTD: () => DTD,
|
|
324
|
+
EXPRESSION: () => EXPRESSION,
|
|
325
|
+
HTML_COMMENT: () => HTML_COMMENT,
|
|
326
|
+
HTML_CONTENT: () => HTML_CONTENT,
|
|
327
|
+
INLINE_SCRIPT: () => INLINE_SCRIPT,
|
|
328
|
+
JS_COMMENT_BLOCK: () => JS_COMMENT_BLOCK,
|
|
329
|
+
JS_COMMENT_LINE: () => JS_COMMENT_LINE,
|
|
330
|
+
OPEN_TAG: () => OPEN_TAG,
|
|
331
|
+
PARSED_TEXT_CONTENT: () => PARSED_TEXT_CONTENT,
|
|
332
|
+
PLACEHOLDER: () => PLACEHOLDER,
|
|
333
|
+
REGULAR_EXPRESSION: () => REGULAR_EXPRESSION,
|
|
334
|
+
STRING: () => STRING,
|
|
335
|
+
TAG_NAME: () => TAG_NAME,
|
|
336
|
+
TEMPLATE_STRING: () => TEMPLATE_STRING,
|
|
337
|
+
checkForCDATA: () => checkForCDATA,
|
|
338
|
+
checkForClosingTag: () => checkForClosingTag,
|
|
339
|
+
checkForPlaceholder: () => checkForPlaceholder,
|
|
340
|
+
handleDelimitedEOL: () => handleDelimitedEOL
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// src/states/ATTRIBUTE.ts
|
|
344
|
+
var HTML_VALUE_TERMINATORS = [
|
|
345
|
+
62 /* CLOSE_ANGLE_BRACKET */,
|
|
346
|
+
44 /* COMMA */,
|
|
347
|
+
[47 /* FORWARD_SLASH */, 62 /* CLOSE_ANGLE_BRACKET */]
|
|
348
|
+
];
|
|
349
|
+
var CONCISE_VALUE_TERMINATORS = [
|
|
350
|
+
93 /* CLOSE_SQUARE_BRACKET */,
|
|
351
|
+
59 /* SEMICOLON */,
|
|
352
|
+
44 /* COMMA */
|
|
353
|
+
];
|
|
354
|
+
var HTML_NAME_TERMINATORS = [
|
|
355
|
+
62 /* CLOSE_ANGLE_BRACKET */,
|
|
356
|
+
44 /* COMMA */,
|
|
357
|
+
40 /* OPEN_PAREN */,
|
|
358
|
+
61 /* EQUAL */,
|
|
359
|
+
[58 /* COLON */, 61 /* EQUAL */],
|
|
360
|
+
[47 /* FORWARD_SLASH */, 62 /* CLOSE_ANGLE_BRACKET */]
|
|
361
|
+
];
|
|
362
|
+
var CONCISE_NAME_TERMINATORS = [
|
|
363
|
+
93 /* CLOSE_SQUARE_BRACKET */,
|
|
364
|
+
59 /* SEMICOLON */,
|
|
365
|
+
61 /* EQUAL */,
|
|
366
|
+
44 /* COMMA */,
|
|
367
|
+
40 /* OPEN_PAREN */,
|
|
368
|
+
[58 /* COLON */, 61 /* EQUAL */]
|
|
369
|
+
];
|
|
370
|
+
var ATTRIBUTE = {
|
|
371
|
+
name: "ATTRIBUTE",
|
|
372
|
+
enter(parent, start) {
|
|
373
|
+
return this.activeAttr = {
|
|
374
|
+
state: ATTRIBUTE,
|
|
375
|
+
parent,
|
|
376
|
+
start,
|
|
377
|
+
end: start,
|
|
378
|
+
valueStart: start,
|
|
379
|
+
stage: 0 /* UNKNOWN */,
|
|
380
|
+
name: void 0,
|
|
381
|
+
args: false,
|
|
382
|
+
bound: false,
|
|
383
|
+
spread: false
|
|
384
|
+
};
|
|
385
|
+
},
|
|
386
|
+
exit() {
|
|
387
|
+
this.activeAttr = void 0;
|
|
388
|
+
},
|
|
389
|
+
char(code, attr) {
|
|
390
|
+
if (isWhitespaceCode(code)) {
|
|
391
|
+
return;
|
|
392
|
+
} else if (code === 61 /* EQUAL */ || code === 58 /* COLON */ && this.lookAtCharCodeAhead(1) === 61 /* EQUAL */ || code === 46 /* PERIOD */ && this.lookAheadFor("..")) {
|
|
393
|
+
attr.valueStart = this.pos;
|
|
394
|
+
if (code === 58 /* COLON */) {
|
|
395
|
+
ensureAttrName(this, attr);
|
|
396
|
+
attr.bound = true;
|
|
397
|
+
this.pos += 2;
|
|
398
|
+
this.consumeWhitespace();
|
|
399
|
+
} else if (code === 46 /* PERIOD */) {
|
|
400
|
+
attr.spread = true;
|
|
401
|
+
this.pos += 3;
|
|
402
|
+
} else {
|
|
403
|
+
ensureAttrName(this, attr);
|
|
404
|
+
this.pos++;
|
|
405
|
+
this.consumeWhitespace();
|
|
406
|
+
}
|
|
407
|
+
attr.stage = 2 /* VALUE */;
|
|
408
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
409
|
+
expr.terminatedByWhitespace = true;
|
|
410
|
+
expr.terminator = this.isConcise ? CONCISE_VALUE_TERMINATORS : HTML_VALUE_TERMINATORS;
|
|
411
|
+
this.pos--;
|
|
412
|
+
} else if (code === 40 /* OPEN_PAREN */) {
|
|
413
|
+
ensureAttrName(this, attr);
|
|
414
|
+
attr.stage = 3 /* ARGUMENT */;
|
|
415
|
+
this.pos++;
|
|
416
|
+
this.enterState(states_exports.EXPRESSION).terminator = 41 /* CLOSE_PAREN */;
|
|
417
|
+
this.pos--;
|
|
418
|
+
} else if (code === 123 /* OPEN_CURLY_BRACE */ && attr.args) {
|
|
419
|
+
ensureAttrName(this, attr);
|
|
420
|
+
attr.stage = 4 /* BLOCK */;
|
|
421
|
+
this.pos++;
|
|
422
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
423
|
+
expr.terminatedByWhitespace = false;
|
|
424
|
+
expr.terminator = 125 /* CLOSE_CURLY_BRACE */;
|
|
425
|
+
this.pos--;
|
|
426
|
+
} else if (attr.stage === 0 /* UNKNOWN */) {
|
|
427
|
+
attr.stage = 1 /* NAME */;
|
|
428
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
429
|
+
expr.terminatedByWhitespace = true;
|
|
430
|
+
expr.skipOperators = true;
|
|
431
|
+
expr.terminator = this.isConcise ? CONCISE_NAME_TERMINATORS : HTML_NAME_TERMINATORS;
|
|
432
|
+
this.pos--;
|
|
433
|
+
} else {
|
|
434
|
+
this.exitState();
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
eol() {
|
|
438
|
+
if (this.isConcise) {
|
|
439
|
+
this.exitState();
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
eof(attr) {
|
|
443
|
+
if (this.isConcise) {
|
|
444
|
+
this.exitState();
|
|
445
|
+
} else {
|
|
446
|
+
this.emitError(attr, "MALFORMED_OPEN_TAG", 'EOF reached while parsing attribute "' + (attr.name ? this.read(attr.name) : "default") + '" for the "' + this.read(this.activeTag.tagName) + '" tag');
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
return(child, attr) {
|
|
450
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
451
|
+
switch (attr.stage) {
|
|
452
|
+
case 1 /* NAME */: {
|
|
453
|
+
attr.name = {
|
|
454
|
+
start: child.start,
|
|
455
|
+
end: child.end
|
|
456
|
+
};
|
|
457
|
+
(_b = (_a = this.handlers).onAttrName) == null ? void 0 : _b.call(_a, attr.name);
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
case 3 /* ARGUMENT */: {
|
|
461
|
+
if (attr.args) {
|
|
462
|
+
this.emitError(child, "ILLEGAL_ATTRIBUTE_ARGUMENT", "An attribute can only have one set of arguments");
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const start = child.start - 1;
|
|
466
|
+
const end = ++this.pos;
|
|
467
|
+
const value = {
|
|
468
|
+
start: child.start,
|
|
469
|
+
end: child.end
|
|
470
|
+
};
|
|
471
|
+
if (this.consumeWhitespaceIfBefore("{")) {
|
|
472
|
+
attr.args = {
|
|
473
|
+
start,
|
|
474
|
+
end,
|
|
475
|
+
value
|
|
476
|
+
};
|
|
477
|
+
} else {
|
|
478
|
+
attr.args = true;
|
|
479
|
+
(_d = (_c = this.handlers).onAttrArgs) == null ? void 0 : _d.call(_c, {
|
|
480
|
+
start,
|
|
481
|
+
end,
|
|
482
|
+
value
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
case 4 /* BLOCK */: {
|
|
488
|
+
const params = attr.args;
|
|
489
|
+
const start = params.start;
|
|
490
|
+
const end = ++this.pos;
|
|
491
|
+
(_f = (_e = this.handlers).onAttrMethod) == null ? void 0 : _f.call(_e, {
|
|
492
|
+
start,
|
|
493
|
+
end,
|
|
494
|
+
params,
|
|
495
|
+
body: {
|
|
496
|
+
start: child.start - 1,
|
|
497
|
+
end,
|
|
498
|
+
value: {
|
|
499
|
+
start: child.start,
|
|
500
|
+
end: child.end
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
this.exitState();
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
case 2 /* VALUE */: {
|
|
508
|
+
if (child.start === child.end) {
|
|
509
|
+
return this.emitError(child, "ILLEGAL_ATTRIBUTE_VALUE", "Missing value for attribute");
|
|
510
|
+
}
|
|
511
|
+
if (attr.spread) {
|
|
512
|
+
(_h = (_g = this.handlers).onAttrSpread) == null ? void 0 : _h.call(_g, {
|
|
513
|
+
start: attr.valueStart,
|
|
514
|
+
end: child.end,
|
|
515
|
+
value: {
|
|
516
|
+
start: child.start,
|
|
517
|
+
end: child.end
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
(_j = (_i = this.handlers).onAttrValue) == null ? void 0 : _j.call(_i, {
|
|
522
|
+
start: attr.valueStart,
|
|
523
|
+
end: child.end,
|
|
524
|
+
bound: attr.bound,
|
|
525
|
+
value: {
|
|
526
|
+
start: child.start,
|
|
527
|
+
end: child.end
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
this.exitState();
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
function ensureAttrName(parser, attr) {
|
|
538
|
+
var _a, _b;
|
|
539
|
+
if (!attr.name) {
|
|
540
|
+
(_b = (_a = parser.handlers).onAttrName) == null ? void 0 : _b.call(_a, {
|
|
541
|
+
start: attr.start,
|
|
542
|
+
end: attr.start
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// src/states/BEGIN_DELIMITED_HTML_BLOCK.ts
|
|
548
|
+
var BEGIN_DELIMITED_HTML_BLOCK = {
|
|
549
|
+
name: "BEGIN_DELIMITED_HTML_BLOCK",
|
|
550
|
+
enter(parent, start) {
|
|
551
|
+
return {
|
|
552
|
+
state: BEGIN_DELIMITED_HTML_BLOCK,
|
|
553
|
+
parent,
|
|
554
|
+
start,
|
|
555
|
+
end: start,
|
|
556
|
+
indent: this.indent,
|
|
557
|
+
delimiter: ""
|
|
558
|
+
};
|
|
559
|
+
},
|
|
560
|
+
exit() {
|
|
561
|
+
},
|
|
562
|
+
char(code, block) {
|
|
563
|
+
if (code === 45 /* HTML_BLOCK_DELIMITER */) {
|
|
564
|
+
block.delimiter += "-";
|
|
565
|
+
} else {
|
|
566
|
+
const startPos = this.pos;
|
|
567
|
+
if (!this.consumeWhitespaceOnLine()) {
|
|
568
|
+
this.pos = startPos + 1;
|
|
569
|
+
this.beginHtmlBlock(void 0, true);
|
|
570
|
+
this.pos--;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
eol(len, block) {
|
|
575
|
+
this.beginHtmlBlock(block.delimiter, false);
|
|
576
|
+
handleDelimitedBlockEOL(this, len, block);
|
|
577
|
+
},
|
|
578
|
+
eof: htmlEOF,
|
|
579
|
+
return() {
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
function handleDelimitedEOL(parser, newLineLength, content) {
|
|
583
|
+
if (content.singleLine) {
|
|
584
|
+
parser.endText();
|
|
585
|
+
parser.exitState();
|
|
586
|
+
parser.exitState();
|
|
587
|
+
return true;
|
|
588
|
+
}
|
|
589
|
+
if (content.delimiter) {
|
|
590
|
+
handleDelimitedBlockEOL(parser, newLineLength, content);
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
function handleDelimitedBlockEOL(parser, newLineLength, {
|
|
596
|
+
indent,
|
|
597
|
+
delimiter
|
|
598
|
+
}) {
|
|
599
|
+
const endHtmlBlockLookahead = indent + delimiter;
|
|
600
|
+
if (parser.lookAheadFor(endHtmlBlockLookahead, parser.pos + newLineLength)) {
|
|
601
|
+
parser.startText();
|
|
602
|
+
parser.pos += newLineLength;
|
|
603
|
+
parser.endText();
|
|
604
|
+
parser.pos += endHtmlBlockLookahead.length;
|
|
605
|
+
if (parser.consumeWhitespaceOnLine(0)) {
|
|
606
|
+
parser.endText();
|
|
607
|
+
parser.exitState();
|
|
608
|
+
parser.exitState();
|
|
609
|
+
} else {
|
|
610
|
+
parser.emitError(parser.pos, "INVALID_CHARACTER", "A concise mode closing block delimiter can only be followed by whitespace.");
|
|
611
|
+
}
|
|
612
|
+
} else if (parser.lookAheadFor(indent, parser.pos + newLineLength)) {
|
|
613
|
+
parser.startText();
|
|
614
|
+
parser.pos += indent.length;
|
|
615
|
+
} else if (indent && !parser.onlyWhitespaceRemainsOnLine(newLineLength)) {
|
|
616
|
+
parser.endText();
|
|
617
|
+
parser.exitState();
|
|
618
|
+
parser.exitState();
|
|
619
|
+
} else {
|
|
620
|
+
parser.startText();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// src/states/CDATA.ts
|
|
625
|
+
var CDATA = {
|
|
626
|
+
name: "CDATA",
|
|
627
|
+
enter(parent, start) {
|
|
628
|
+
return {
|
|
629
|
+
state: CDATA,
|
|
630
|
+
parent,
|
|
631
|
+
start,
|
|
632
|
+
end: start
|
|
633
|
+
};
|
|
634
|
+
},
|
|
635
|
+
exit(cdata) {
|
|
636
|
+
var _a, _b;
|
|
637
|
+
(_b = (_a = this.handlers).onCDATA) == null ? void 0 : _b.call(_a, {
|
|
638
|
+
start: cdata.start,
|
|
639
|
+
end: cdata.end,
|
|
640
|
+
value: {
|
|
641
|
+
start: cdata.start + 9,
|
|
642
|
+
end: cdata.end - 3
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
},
|
|
646
|
+
char(code) {
|
|
647
|
+
if (code === 93 /* CLOSE_SQUARE_BRACKET */ && this.lookAheadFor("]>")) {
|
|
648
|
+
this.pos += 3;
|
|
649
|
+
this.exitState();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
eol() {
|
|
654
|
+
},
|
|
655
|
+
eof(cdata) {
|
|
656
|
+
this.emitError(cdata, "MALFORMED_CDATA", "EOF reached while parsing CDATA");
|
|
657
|
+
},
|
|
658
|
+
return() {
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
function checkForCDATA(parser) {
|
|
662
|
+
if (parser.lookAheadFor("![CDATA[")) {
|
|
663
|
+
parser.endText();
|
|
664
|
+
parser.enterState(CDATA);
|
|
665
|
+
parser.pos += 8;
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// src/states/CLOSE_TAG.ts
|
|
672
|
+
var CLOSE_TAG = {
|
|
673
|
+
name: "CLOSE_TAG",
|
|
674
|
+
enter(parent, start) {
|
|
675
|
+
this.endText();
|
|
676
|
+
return {
|
|
677
|
+
state: CLOSE_TAG,
|
|
678
|
+
parent,
|
|
679
|
+
start,
|
|
680
|
+
end: start
|
|
681
|
+
};
|
|
682
|
+
},
|
|
683
|
+
exit() {
|
|
684
|
+
},
|
|
685
|
+
char(code, closeTag) {
|
|
686
|
+
if (code === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
687
|
+
this.pos++;
|
|
688
|
+
this.exitState();
|
|
689
|
+
ensureExpectedCloseTag(this, closeTag);
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
eol() {
|
|
693
|
+
},
|
|
694
|
+
eof(closeTag) {
|
|
695
|
+
this.emitError(closeTag, "MALFORMED_CLOSE_TAG", "EOF reached while parsing closing tag");
|
|
696
|
+
},
|
|
697
|
+
return() {
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
function checkForClosingTag(parser) {
|
|
701
|
+
const curPos = parser.pos + 1;
|
|
702
|
+
let match = !!parser.lookAheadFor("/>");
|
|
703
|
+
let skip = 3;
|
|
704
|
+
if (!match) {
|
|
705
|
+
const { tagName } = parser.activeTag;
|
|
706
|
+
const tagNameLen = tagName.end - tagName.start;
|
|
707
|
+
if (tagNameLen) {
|
|
708
|
+
skip += tagNameLen;
|
|
709
|
+
match = parser.lookAheadFor("/", curPos) && parser.lookAheadFor(">", 1 + curPos + tagNameLen) && parser.matchAtPos(tagName, {
|
|
710
|
+
start: 1 + curPos,
|
|
711
|
+
end: 1 + curPos + tagNameLen
|
|
712
|
+
}) || false;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (match) {
|
|
716
|
+
parser.endText();
|
|
717
|
+
if (ensureExpectedCloseTag(parser, {
|
|
718
|
+
start: parser.pos,
|
|
719
|
+
end: parser.pos += skip
|
|
720
|
+
})) {
|
|
721
|
+
parser.exitState();
|
|
722
|
+
}
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
function ensureExpectedCloseTag(parser, closeTag) {
|
|
728
|
+
const activeTag = parser.activeTag;
|
|
729
|
+
const closeTagNameStart = closeTag.start + 2;
|
|
730
|
+
const closeTagNameEnd = closeTag.end - 1;
|
|
731
|
+
if (!activeTag) {
|
|
732
|
+
parser.emitError(closeTag, "EXTRA_CLOSING_TAG", 'The closing "' + parser.read({ start: closeTagNameStart, end: closeTagNameEnd }) + '" tag was not expected');
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
const closeTagNamePos = {
|
|
736
|
+
start: closeTagNameStart,
|
|
737
|
+
end: closeTagNameEnd
|
|
738
|
+
};
|
|
739
|
+
if (closeTagNameStart < closeTagNameEnd) {
|
|
740
|
+
if (!parser.matchAtPos(closeTagNamePos, activeTag.tagName.end > activeTag.tagName.start ? activeTag.tagName : "div")) {
|
|
741
|
+
if (activeTag.shorthandEnd === void 0 || !parser.matchAtPos(closeTagNamePos, {
|
|
742
|
+
start: activeTag.tagName.start,
|
|
743
|
+
end: activeTag.shorthandEnd
|
|
744
|
+
})) {
|
|
745
|
+
parser.emitError(closeTag, "MISMATCHED_CLOSING_TAG", 'The closing "' + parser.read(closeTagNamePos) + '" tag does not match the corresponding opening "' + (parser.read(activeTag.tagName) || "div") + '" tag');
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
parser.closeTag(closeTag.start, closeTag.end, closeTagNamePos);
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/states/CONCISE_HTML_CONTENT.ts
|
|
755
|
+
var CONCISE_HTML_CONTENT = {
|
|
756
|
+
name: "CONCISE_HTML_CONTENT",
|
|
757
|
+
enter(parent, start) {
|
|
758
|
+
this.isConcise = true;
|
|
759
|
+
this.indent = "";
|
|
760
|
+
return {
|
|
761
|
+
state: CONCISE_HTML_CONTENT,
|
|
762
|
+
parent,
|
|
763
|
+
start,
|
|
764
|
+
end: start
|
|
765
|
+
};
|
|
766
|
+
},
|
|
767
|
+
exit() {
|
|
768
|
+
},
|
|
769
|
+
char(code) {
|
|
770
|
+
if (isWhitespaceCode(code)) {
|
|
771
|
+
this.indent += this.data[this.pos];
|
|
772
|
+
} else {
|
|
773
|
+
const curIndent = this.indent.length;
|
|
774
|
+
const indentStart = this.pos - curIndent - 1;
|
|
775
|
+
let parentTag = this.activeTag;
|
|
776
|
+
while (parentTag && parentTag.indent.length >= curIndent) {
|
|
777
|
+
this.closeTag(indentStart, indentStart, void 0);
|
|
778
|
+
parentTag = this.activeTag;
|
|
779
|
+
}
|
|
780
|
+
if (!parentTag && curIndent) {
|
|
781
|
+
this.emitError(this.pos, "BAD_INDENTATION", "Line has extra indentation at the beginning");
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
if (parentTag) {
|
|
785
|
+
if (parentTag.ending !== 0 /* tag */) {
|
|
786
|
+
this.emitError(this.pos, "INVALID_BODY", `The "${this.read(parentTag.tagName)}" tag does not allow nested body content`);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
if (parentTag.bodyMode === 1 /* PARSED_TEXT */ && code !== 45 /* HTML_BLOCK_DELIMITER */) {
|
|
790
|
+
this.emitError(this.pos, "ILLEGAL_LINE_START", 'A line within a tag that only allows text content must begin with a "-" character');
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
if (parentTag.nestedIndent === void 0) {
|
|
794
|
+
parentTag.nestedIndent = this.indent;
|
|
795
|
+
} else if (parentTag.nestedIndent !== this.indent) {
|
|
796
|
+
this.emitError(this.pos, "BAD_INDENTATION", "Line indentation does match indentation of previous line");
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
switch (code) {
|
|
801
|
+
case 60 /* OPEN_ANGLE_BRACKET */:
|
|
802
|
+
this.beginMixedMode = true;
|
|
803
|
+
this.pos--;
|
|
804
|
+
this.beginHtmlBlock(void 0, false);
|
|
805
|
+
return;
|
|
806
|
+
case 36 /* DOLLAR */:
|
|
807
|
+
if (isWhitespaceCode(this.lookAtCharCodeAhead(1))) {
|
|
808
|
+
this.pos++;
|
|
809
|
+
this.enterState(states_exports.INLINE_SCRIPT);
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
break;
|
|
813
|
+
case 45 /* HTML_BLOCK_DELIMITER */:
|
|
814
|
+
if (this.lookAtCharCodeAhead(1) === 45 /* HTML_BLOCK_DELIMITER */) {
|
|
815
|
+
this.enterState(states_exports.BEGIN_DELIMITED_HTML_BLOCK);
|
|
816
|
+
this.pos--;
|
|
817
|
+
} else {
|
|
818
|
+
this.emitError(this.pos, "ILLEGAL_LINE_START", 'A line in concise mode cannot start with a single hyphen. Use "--" instead. See: https://github.com/marko-js/htmljs-parser/issues/43');
|
|
819
|
+
}
|
|
820
|
+
return;
|
|
821
|
+
case 47 /* FORWARD_SLASH */:
|
|
822
|
+
switch (this.lookAtCharCodeAhead(1)) {
|
|
823
|
+
case 47 /* FORWARD_SLASH */:
|
|
824
|
+
this.enterState(states_exports.JS_COMMENT_LINE);
|
|
825
|
+
this.pos++;
|
|
826
|
+
return;
|
|
827
|
+
case 42 /* ASTERISK */:
|
|
828
|
+
this.enterState(states_exports.JS_COMMENT_BLOCK);
|
|
829
|
+
this.pos++;
|
|
830
|
+
return;
|
|
831
|
+
default:
|
|
832
|
+
this.emitError(this.pos, "ILLEGAL_LINE_START", 'A line in concise mode cannot start with "/" unless it starts a "//" or "/*" comment');
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
this.enterState(states_exports.OPEN_TAG);
|
|
837
|
+
this.pos--;
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
eol() {
|
|
841
|
+
this.indent = "";
|
|
842
|
+
},
|
|
843
|
+
eof: htmlEOF,
|
|
844
|
+
return(child) {
|
|
845
|
+
var _a, _b, _c, _d;
|
|
846
|
+
this.indent = "";
|
|
847
|
+
this.isConcise = true;
|
|
848
|
+
switch (child.state) {
|
|
849
|
+
case states_exports.JS_COMMENT_LINE:
|
|
850
|
+
(_b = (_a = this.handlers).onComment) == null ? void 0 : _b.call(_a, {
|
|
851
|
+
start: child.start,
|
|
852
|
+
end: child.end,
|
|
853
|
+
value: {
|
|
854
|
+
start: child.start + 2,
|
|
855
|
+
end: child.end
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
break;
|
|
859
|
+
case states_exports.JS_COMMENT_BLOCK: {
|
|
860
|
+
(_d = (_c = this.handlers).onComment) == null ? void 0 : _d.call(_c, {
|
|
861
|
+
start: child.start,
|
|
862
|
+
end: child.end,
|
|
863
|
+
value: {
|
|
864
|
+
start: child.start + 2,
|
|
865
|
+
end: child.end - 2
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
if (!this.consumeWhitespaceOnLine(0)) {
|
|
869
|
+
this.emitError(this.pos, "INVALID_CHARACTER", "In concise mode a javascript comment block can only be followed by whitespace characters and a newline.");
|
|
870
|
+
}
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/states/DECLARATION.ts
|
|
878
|
+
var DECLARATION = {
|
|
879
|
+
name: "DECLARATION",
|
|
880
|
+
enter(parent, start) {
|
|
881
|
+
this.endText();
|
|
882
|
+
return {
|
|
883
|
+
state: DECLARATION,
|
|
884
|
+
parent,
|
|
885
|
+
start,
|
|
886
|
+
end: start
|
|
887
|
+
};
|
|
888
|
+
},
|
|
889
|
+
exit() {
|
|
890
|
+
},
|
|
891
|
+
char(code, declaration) {
|
|
892
|
+
if (code === 63 /* QUESTION */) {
|
|
893
|
+
if (this.lookAtCharCodeAhead(1) === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
894
|
+
exitDeclaration(this, declaration, 2);
|
|
895
|
+
}
|
|
896
|
+
} else if (code === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
897
|
+
exitDeclaration(this, declaration, 1);
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
eol() {
|
|
901
|
+
},
|
|
902
|
+
eof(declaration) {
|
|
903
|
+
this.emitError(declaration, "MALFORMED_DECLARATION", "EOF reached while parsing declaration");
|
|
904
|
+
},
|
|
905
|
+
return() {
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
function exitDeclaration(parser, declaration, closeOffset) {
|
|
909
|
+
var _a, _b;
|
|
910
|
+
parser.pos += closeOffset;
|
|
911
|
+
parser.exitState();
|
|
912
|
+
(_b = (_a = parser.handlers).onDeclaration) == null ? void 0 : _b.call(_a, {
|
|
913
|
+
start: declaration.start,
|
|
914
|
+
end: declaration.end,
|
|
915
|
+
value: {
|
|
916
|
+
start: declaration.start + 2,
|
|
917
|
+
end: declaration.end - closeOffset
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// src/states/DTD.ts
|
|
923
|
+
var DTD = {
|
|
924
|
+
name: "DTD",
|
|
925
|
+
enter(parent, start) {
|
|
926
|
+
this.endText();
|
|
927
|
+
return {
|
|
928
|
+
state: DTD,
|
|
929
|
+
parent,
|
|
930
|
+
start,
|
|
931
|
+
end: start
|
|
932
|
+
};
|
|
933
|
+
},
|
|
934
|
+
exit(documentType) {
|
|
935
|
+
var _a, _b;
|
|
936
|
+
(_b = (_a = this.handlers).onDoctype) == null ? void 0 : _b.call(_a, {
|
|
937
|
+
start: documentType.start,
|
|
938
|
+
end: documentType.end,
|
|
939
|
+
value: {
|
|
940
|
+
start: documentType.start + 2,
|
|
941
|
+
end: documentType.end - 1
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
},
|
|
945
|
+
char(code) {
|
|
946
|
+
if (code === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
947
|
+
this.pos++;
|
|
948
|
+
this.exitState();
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
eol() {
|
|
952
|
+
},
|
|
953
|
+
eof(documentType) {
|
|
954
|
+
this.emitError(documentType, "MALFORMED_DOCUMENT_TYPE", "EOF reached while parsing document type");
|
|
955
|
+
},
|
|
956
|
+
return() {
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
// src/states/EXPRESSION.ts
|
|
961
|
+
var conciseOperatorPattern = buildOperatorPattern(true);
|
|
962
|
+
var htmlOperatorPattern = buildOperatorPattern(false);
|
|
963
|
+
var EXPRESSION = {
|
|
964
|
+
name: "EXPRESSION",
|
|
965
|
+
enter(parent, start) {
|
|
966
|
+
return {
|
|
967
|
+
state: EXPRESSION,
|
|
968
|
+
parent,
|
|
969
|
+
start,
|
|
970
|
+
end: start,
|
|
971
|
+
groupStack: [],
|
|
972
|
+
terminator: -1,
|
|
973
|
+
skipOperators: false,
|
|
974
|
+
terminatedByEOL: false,
|
|
975
|
+
terminatedByWhitespace: false
|
|
976
|
+
};
|
|
977
|
+
},
|
|
978
|
+
exit() {
|
|
979
|
+
},
|
|
980
|
+
char(code, expression) {
|
|
981
|
+
if (!expression.groupStack.length) {
|
|
982
|
+
if (expression.terminatedByWhitespace && isWhitespaceCode(code)) {
|
|
983
|
+
if (!checkForOperators(this, expression)) {
|
|
984
|
+
this.exitState();
|
|
985
|
+
}
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
if (typeof expression.terminator === "number" ? expression.terminator === code : checkForTerminators(this, code, expression.terminator)) {
|
|
989
|
+
this.exitState();
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
switch (code) {
|
|
994
|
+
case 34 /* DOUBLE_QUOTE */:
|
|
995
|
+
this.enterState(states_exports.STRING);
|
|
996
|
+
break;
|
|
997
|
+
case 39 /* SINGLE_QUOTE */:
|
|
998
|
+
this.enterState(states_exports.STRING).quoteCharCode = code;
|
|
999
|
+
break;
|
|
1000
|
+
case 96 /* BACKTICK */:
|
|
1001
|
+
this.enterState(states_exports.TEMPLATE_STRING);
|
|
1002
|
+
break;
|
|
1003
|
+
case 47 /* FORWARD_SLASH */:
|
|
1004
|
+
switch (this.lookAtCharCodeAhead(1)) {
|
|
1005
|
+
case 47 /* FORWARD_SLASH */:
|
|
1006
|
+
this.enterState(states_exports.JS_COMMENT_LINE);
|
|
1007
|
+
this.pos++;
|
|
1008
|
+
break;
|
|
1009
|
+
case 42 /* ASTERISK */:
|
|
1010
|
+
this.enterState(states_exports.JS_COMMENT_BLOCK);
|
|
1011
|
+
this.pos++;
|
|
1012
|
+
break;
|
|
1013
|
+
default: {
|
|
1014
|
+
if (!canCharCodeBeFollowedByDivision(this.getPreviousNonWhitespaceCharCode())) {
|
|
1015
|
+
this.enterState(states_exports.REGULAR_EXPRESSION);
|
|
1016
|
+
}
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
break;
|
|
1021
|
+
case 40 /* OPEN_PAREN */:
|
|
1022
|
+
expression.groupStack.push(41 /* CLOSE_PAREN */);
|
|
1023
|
+
break;
|
|
1024
|
+
case 91 /* OPEN_SQUARE_BRACKET */:
|
|
1025
|
+
expression.groupStack.push(93 /* CLOSE_SQUARE_BRACKET */);
|
|
1026
|
+
break;
|
|
1027
|
+
case 123 /* OPEN_CURLY_BRACE */:
|
|
1028
|
+
expression.groupStack.push(125 /* CLOSE_CURLY_BRACE */);
|
|
1029
|
+
break;
|
|
1030
|
+
case 41 /* CLOSE_PAREN */:
|
|
1031
|
+
case 93 /* CLOSE_SQUARE_BRACKET */:
|
|
1032
|
+
case 125 /* CLOSE_CURLY_BRACE */: {
|
|
1033
|
+
if (!expression.groupStack.length) {
|
|
1034
|
+
return this.emitError(expression, "INVALID_EXPRESSION", 'Mismatched group. A closing "' + String.fromCharCode(code) + '" character was found but it is not matched with a corresponding opening character.');
|
|
1035
|
+
}
|
|
1036
|
+
const expectedCode = expression.groupStack.pop();
|
|
1037
|
+
if (expectedCode !== code) {
|
|
1038
|
+
return this.emitError(expression, "INVALID_EXPRESSION", 'Mismatched group. A "' + String.fromCharCode(code) + '" character was found when "' + String.fromCharCode(expectedCode) + '" was expected.');
|
|
1039
|
+
}
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
eol(_, expression) {
|
|
1045
|
+
if (!expression.groupStack.length && (expression.terminatedByWhitespace || expression.terminatedByEOL)) {
|
|
1046
|
+
this.exitState();
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
eof(expression) {
|
|
1050
|
+
if (!expression.groupStack.length && (this.isConcise || expression.terminatedByEOL)) {
|
|
1051
|
+
this.exitState();
|
|
1052
|
+
} else {
|
|
1053
|
+
const { parent } = expression;
|
|
1054
|
+
switch (parent.state) {
|
|
1055
|
+
case states_exports.ATTRIBUTE: {
|
|
1056
|
+
const attr = parent;
|
|
1057
|
+
if (!attr.spread && !attr.name) {
|
|
1058
|
+
return this.emitError(expression, "MALFORMED_OPEN_TAG", 'EOF reached while parsing attribute name for the "' + this.read(this.activeTag.tagName) + '" tag');
|
|
1059
|
+
}
|
|
1060
|
+
return this.emitError(expression, "MALFORMED_OPEN_TAG", `EOF reached while parsing attribute value for the ${attr.spread ? "..." : attr.name ? `"${this.read(attr.name)}"` : `"default"`} attribute`);
|
|
1061
|
+
}
|
|
1062
|
+
case states_exports.TAG_NAME:
|
|
1063
|
+
return this.emitError(expression, "MALFORMED_OPEN_TAG", "EOF reached while parsing tag name");
|
|
1064
|
+
case states_exports.PLACEHOLDER:
|
|
1065
|
+
return this.emitError(expression, "MALFORMED_PLACEHOLDER", "EOF reached while parsing placeholder");
|
|
1066
|
+
}
|
|
1067
|
+
return this.emitError(expression, "INVALID_EXPRESSION", "EOF reached while parsing expression");
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
return() {
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
function buildOperatorPattern(isConcise) {
|
|
1074
|
+
const binary = `[!~*%&^|?:]+|(?<=[!=<>&^~|/*?%+-])=|=(?=[!=<>&^~|/*?%+-])|(?<!\\+)\\s*\\+(?:\\s*\\+\\s*\\+)*\\s*(?!\\+)|(?<!-)${isConcise ? "-" : "\\s*-(?:\\s*-\\s*-)*\\s*"}(?!-)|(?<![/*])/(?![/*${isConcise ? "" : ">"}])|(?<!${isConcise ? "^\\s*|" : ""}\\.)\\.(?!\\.)|<${isConcise ? "{2,}|(?<!^\\s*)<" : "+"}|>${isConcise ? "+" : "{2,}"}|\\bin(?:stanceof)?(?=\\s+[^=/,;:>])`;
|
|
1075
|
+
const unary = "\\b(?:a(?:sync|wait)|class|function|new|typeof|void)\\b";
|
|
1076
|
+
const lookAheadPattern = "\\s*(?:" + binary + `)\\s*|\\s+(?=[${isConcise ? "" : "["}{(])`;
|
|
1077
|
+
const lookBehindPattern = `(?<=${unary}|${binary})`;
|
|
1078
|
+
return new RegExp(`${lookAheadPattern}|${lookBehindPattern}`, "ym");
|
|
1079
|
+
}
|
|
1080
|
+
function checkForOperators(parser, expression) {
|
|
1081
|
+
if (expression.skipOperators) {
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
const pattern = parser.isConcise ? conciseOperatorPattern : htmlOperatorPattern;
|
|
1085
|
+
pattern.lastIndex = parser.pos;
|
|
1086
|
+
const matches = pattern.exec(parser.data);
|
|
1087
|
+
if (matches) {
|
|
1088
|
+
const [match] = matches;
|
|
1089
|
+
if (match.length === 0) {
|
|
1090
|
+
parser.consumeWhitespace();
|
|
1091
|
+
parser.pos--;
|
|
1092
|
+
} else {
|
|
1093
|
+
parser.pos += match.length - 1;
|
|
1094
|
+
}
|
|
1095
|
+
} else {
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1098
|
+
return true;
|
|
1099
|
+
}
|
|
1100
|
+
function checkForTerminators(parser, code, terminators) {
|
|
1101
|
+
outer:
|
|
1102
|
+
for (const terminator of terminators) {
|
|
1103
|
+
if (typeof terminator === "number") {
|
|
1104
|
+
if (code === terminator)
|
|
1105
|
+
return true;
|
|
1106
|
+
} else {
|
|
1107
|
+
if (terminator[0] === code) {
|
|
1108
|
+
for (let i = terminator.length; i-- > 1; ) {
|
|
1109
|
+
if (parser.data.charCodeAt(parser.pos + i) !== terminator[i])
|
|
1110
|
+
continue outer;
|
|
1111
|
+
}
|
|
1112
|
+
return true;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
function canCharCodeBeFollowedByDivision(code) {
|
|
1118
|
+
return code >= 48 /* NUMBER_0 */ && code <= 57 /* NUMBER_9 */ || code >= 65 /* UPPER_A */ && code <= 90 /* UPPER_Z */ || code >= 97 /* LOWER_A */ && code <= 122 /* LOWER_Z */ || code === 37 /* PERCENT */ || code === 41 /* CLOSE_PAREN */ || code === 46 /* PERIOD */ || code === 60 /* OPEN_ANGLE_BRACKET */ || code === 93 /* CLOSE_SQUARE_BRACKET */ || code === 125 /* CLOSE_CURLY_BRACE */;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// src/states/HTML_COMMENT.ts
|
|
1122
|
+
var HTML_COMMENT = {
|
|
1123
|
+
name: "HTML_COMMENT",
|
|
1124
|
+
enter(parent, start) {
|
|
1125
|
+
this.endText();
|
|
1126
|
+
return {
|
|
1127
|
+
state: HTML_COMMENT,
|
|
1128
|
+
parent,
|
|
1129
|
+
start,
|
|
1130
|
+
end: start
|
|
1131
|
+
};
|
|
1132
|
+
},
|
|
1133
|
+
exit(comment) {
|
|
1134
|
+
var _a, _b;
|
|
1135
|
+
(_b = (_a = this.handlers).onComment) == null ? void 0 : _b.call(_a, {
|
|
1136
|
+
start: comment.start,
|
|
1137
|
+
end: comment.end,
|
|
1138
|
+
value: {
|
|
1139
|
+
start: comment.start + 4,
|
|
1140
|
+
end: comment.end - 3
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
},
|
|
1144
|
+
char(code) {
|
|
1145
|
+
if (code === 45 /* HYPHEN */) {
|
|
1146
|
+
let offset = 1;
|
|
1147
|
+
let next;
|
|
1148
|
+
while ((next = this.lookAtCharCodeAhead(offset++)) === 45 /* HYPHEN */)
|
|
1149
|
+
;
|
|
1150
|
+
this.pos += offset;
|
|
1151
|
+
if (next === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
1152
|
+
this.exitState();
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
eol() {
|
|
1157
|
+
},
|
|
1158
|
+
eof(comment) {
|
|
1159
|
+
this.emitError(comment, "MALFORMED_COMMENT", "EOF reached while parsing comment");
|
|
1160
|
+
},
|
|
1161
|
+
return() {
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
// src/states/HTML_CONTENT.ts
|
|
1166
|
+
var HTML_CONTENT = {
|
|
1167
|
+
name: "HTML_CONTENT",
|
|
1168
|
+
enter(parent, start) {
|
|
1169
|
+
this.isConcise = false;
|
|
1170
|
+
return {
|
|
1171
|
+
state: HTML_CONTENT,
|
|
1172
|
+
parent,
|
|
1173
|
+
start,
|
|
1174
|
+
end: start,
|
|
1175
|
+
indent: "",
|
|
1176
|
+
singleLine: false,
|
|
1177
|
+
delimiter: void 0
|
|
1178
|
+
};
|
|
1179
|
+
},
|
|
1180
|
+
exit() {
|
|
1181
|
+
},
|
|
1182
|
+
char(code) {
|
|
1183
|
+
if (code === 60 /* OPEN_ANGLE_BRACKET */) {
|
|
1184
|
+
if (states_exports.checkForCDATA(this))
|
|
1185
|
+
return;
|
|
1186
|
+
const nextCode = this.lookAtCharCodeAhead(1);
|
|
1187
|
+
if (nextCode === 33 /* EXCLAMATION */) {
|
|
1188
|
+
if (this.lookAtCharCodeAhead(2) === 45 /* HYPHEN */ && this.lookAtCharCodeAhead(3) === 45 /* HYPHEN */) {
|
|
1189
|
+
this.enterState(states_exports.HTML_COMMENT);
|
|
1190
|
+
this.pos += 3;
|
|
1191
|
+
} else {
|
|
1192
|
+
this.enterState(states_exports.DTD);
|
|
1193
|
+
this.pos++;
|
|
1194
|
+
}
|
|
1195
|
+
} else if (nextCode === 63 /* QUESTION */) {
|
|
1196
|
+
this.enterState(states_exports.DECLARATION);
|
|
1197
|
+
this.pos++;
|
|
1198
|
+
} else if (nextCode === 47 /* FORWARD_SLASH */) {
|
|
1199
|
+
this.enterState(states_exports.CLOSE_TAG);
|
|
1200
|
+
this.pos++;
|
|
1201
|
+
} else if (nextCode === 62 /* CLOSE_ANGLE_BRACKET */ || nextCode === 60 /* OPEN_ANGLE_BRACKET */ || isWhitespaceCode(nextCode)) {
|
|
1202
|
+
this.startText();
|
|
1203
|
+
} else {
|
|
1204
|
+
this.enterState(states_exports.OPEN_TAG);
|
|
1205
|
+
}
|
|
1206
|
+
} else if (code === 36 /* DOLLAR */ && isWhitespaceCode(this.lookAtCharCodeAhead(1)) && isBeginningOfLine(this)) {
|
|
1207
|
+
this.endText();
|
|
1208
|
+
this.enterState(states_exports.INLINE_SCRIPT);
|
|
1209
|
+
this.pos++;
|
|
1210
|
+
} else if (!states_exports.checkForPlaceholder(this, code)) {
|
|
1211
|
+
this.startText();
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
eol(len, content) {
|
|
1215
|
+
if (this.beginMixedMode) {
|
|
1216
|
+
this.beginMixedMode = false;
|
|
1217
|
+
this.endText();
|
|
1218
|
+
this.exitState();
|
|
1219
|
+
} else if (this.endingMixedModeAtEOL) {
|
|
1220
|
+
this.endingMixedModeAtEOL = false;
|
|
1221
|
+
this.endText();
|
|
1222
|
+
this.exitState();
|
|
1223
|
+
} else if (!states_exports.handleDelimitedEOL(this, len, content)) {
|
|
1224
|
+
this.startText();
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
eof: htmlEOF,
|
|
1228
|
+
return() {
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
function isBeginningOfLine(parser) {
|
|
1232
|
+
let pos = parser.pos;
|
|
1233
|
+
do {
|
|
1234
|
+
const code = parser.data.charCodeAt(--pos);
|
|
1235
|
+
if (isWhitespaceCode(code)) {
|
|
1236
|
+
if (code === 10 /* NEWLINE */) {
|
|
1237
|
+
return true;
|
|
1238
|
+
}
|
|
1239
|
+
} else {
|
|
1240
|
+
return false;
|
|
1241
|
+
}
|
|
1242
|
+
} while (pos > 0);
|
|
1243
|
+
return true;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// src/states/INLINE_SCRIPT.ts
|
|
1247
|
+
var INLINE_SCRIPT = {
|
|
1248
|
+
name: "INLINE_SCRIPT",
|
|
1249
|
+
enter(parent, start) {
|
|
1250
|
+
this.endText();
|
|
1251
|
+
return {
|
|
1252
|
+
state: INLINE_SCRIPT,
|
|
1253
|
+
parent,
|
|
1254
|
+
start,
|
|
1255
|
+
end: start,
|
|
1256
|
+
block: false,
|
|
1257
|
+
value: {
|
|
1258
|
+
start,
|
|
1259
|
+
end: start
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
},
|
|
1263
|
+
exit(inlineScript) {
|
|
1264
|
+
var _a, _b;
|
|
1265
|
+
(_b = (_a = this.handlers).onScriptlet) == null ? void 0 : _b.call(_a, {
|
|
1266
|
+
start: inlineScript.start,
|
|
1267
|
+
end: inlineScript.end,
|
|
1268
|
+
block: inlineScript.block,
|
|
1269
|
+
value: {
|
|
1270
|
+
start: inlineScript.value.start,
|
|
1271
|
+
end: inlineScript.value.end
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
},
|
|
1275
|
+
eol() {
|
|
1276
|
+
},
|
|
1277
|
+
eof() {
|
|
1278
|
+
},
|
|
1279
|
+
char(code, inlineScript) {
|
|
1280
|
+
if (code === 123 /* OPEN_CURLY_BRACE */) {
|
|
1281
|
+
inlineScript.block = true;
|
|
1282
|
+
this.pos++;
|
|
1283
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1284
|
+
expr.terminator = 125 /* CLOSE_CURLY_BRACE */;
|
|
1285
|
+
expr.skipOperators = true;
|
|
1286
|
+
this.pos--;
|
|
1287
|
+
} else {
|
|
1288
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1289
|
+
expr.terminatedByEOL = true;
|
|
1290
|
+
this.pos--;
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
return(child, inlineScript) {
|
|
1294
|
+
if (inlineScript.block)
|
|
1295
|
+
this.pos++;
|
|
1296
|
+
inlineScript.value.start = child.start;
|
|
1297
|
+
inlineScript.value.end = child.end;
|
|
1298
|
+
this.exitState();
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
// src/states/JS_COMMENT_BLOCK.ts
|
|
1303
|
+
var JS_COMMENT_BLOCK = {
|
|
1304
|
+
name: "JS_COMMENT_BLOCK",
|
|
1305
|
+
enter(parent, start) {
|
|
1306
|
+
return {
|
|
1307
|
+
state: JS_COMMENT_BLOCK,
|
|
1308
|
+
parent,
|
|
1309
|
+
start,
|
|
1310
|
+
end: start
|
|
1311
|
+
};
|
|
1312
|
+
},
|
|
1313
|
+
exit() {
|
|
1314
|
+
},
|
|
1315
|
+
char(code) {
|
|
1316
|
+
if (code === 42 /* ASTERISK */ && this.lookAtCharCodeAhead(1) === 47 /* FORWARD_SLASH */) {
|
|
1317
|
+
this.pos += 2;
|
|
1318
|
+
this.exitState();
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
eol() {
|
|
1322
|
+
},
|
|
1323
|
+
eof(comment) {
|
|
1324
|
+
this.emitError(comment, "MALFORMED_COMMENT", "EOF reached while parsing multi-line JavaScript comment");
|
|
1325
|
+
},
|
|
1326
|
+
return() {
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
// src/states/JS_COMMENT_LINE.ts
|
|
1331
|
+
var JS_COMMENT_LINE = {
|
|
1332
|
+
name: "JS_COMMENT_LINE",
|
|
1333
|
+
enter(parent, start) {
|
|
1334
|
+
return {
|
|
1335
|
+
state: JS_COMMENT_LINE,
|
|
1336
|
+
parent,
|
|
1337
|
+
start,
|
|
1338
|
+
end: start
|
|
1339
|
+
};
|
|
1340
|
+
},
|
|
1341
|
+
exit() {
|
|
1342
|
+
},
|
|
1343
|
+
char(code) {
|
|
1344
|
+
var _a;
|
|
1345
|
+
if (!this.isConcise && code === 60 /* OPEN_ANGLE_BRACKET */ && ((_a = this.activeTag) == null ? void 0 : _a.bodyMode) === 1 /* PARSED_TEXT */) {
|
|
1346
|
+
states_exports.checkForClosingTag(this);
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
eol() {
|
|
1350
|
+
this.exitState();
|
|
1351
|
+
},
|
|
1352
|
+
eof() {
|
|
1353
|
+
this.exitState();
|
|
1354
|
+
},
|
|
1355
|
+
return() {
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
// src/states/PARSED_TEXT_CONTENT.ts
|
|
1360
|
+
var PARSED_TEXT_CONTENT = {
|
|
1361
|
+
name: "PARSED_TEXT_CONTENT",
|
|
1362
|
+
enter(parent, start) {
|
|
1363
|
+
return {
|
|
1364
|
+
state: PARSED_TEXT_CONTENT,
|
|
1365
|
+
parent,
|
|
1366
|
+
start,
|
|
1367
|
+
end: start,
|
|
1368
|
+
indent: "",
|
|
1369
|
+
singleLine: false,
|
|
1370
|
+
delimiter: void 0
|
|
1371
|
+
};
|
|
1372
|
+
},
|
|
1373
|
+
exit() {
|
|
1374
|
+
},
|
|
1375
|
+
char(code) {
|
|
1376
|
+
switch (code) {
|
|
1377
|
+
case 60 /* OPEN_ANGLE_BRACKET */:
|
|
1378
|
+
if (this.isConcise || !(states_exports.checkForClosingTag(this) || states_exports.checkForCDATA(this))) {
|
|
1379
|
+
this.startText();
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
case 47 /* FORWARD_SLASH */:
|
|
1383
|
+
this.startText();
|
|
1384
|
+
switch (this.lookAtCharCodeAhead(1)) {
|
|
1385
|
+
case 42 /* ASTERISK */:
|
|
1386
|
+
this.enterState(states_exports.JS_COMMENT_BLOCK);
|
|
1387
|
+
this.pos++;
|
|
1388
|
+
break;
|
|
1389
|
+
case 47 /* FORWARD_SLASH */:
|
|
1390
|
+
this.enterState(states_exports.JS_COMMENT_LINE);
|
|
1391
|
+
this.pos++;
|
|
1392
|
+
break;
|
|
1393
|
+
}
|
|
1394
|
+
break;
|
|
1395
|
+
case 96 /* BACKTICK */:
|
|
1396
|
+
this.startText();
|
|
1397
|
+
this.enterState(states_exports.TEMPLATE_STRING);
|
|
1398
|
+
break;
|
|
1399
|
+
default:
|
|
1400
|
+
if (!states_exports.checkForPlaceholder(this, code))
|
|
1401
|
+
this.startText();
|
|
1402
|
+
break;
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
eol(len, content) {
|
|
1406
|
+
if (!states_exports.handleDelimitedEOL(this, len, content)) {
|
|
1407
|
+
this.startText();
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
eof: htmlEOF,
|
|
1411
|
+
return() {
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// src/states/PLACEHOLDER.ts
|
|
1416
|
+
var PLACEHOLDER = {
|
|
1417
|
+
name: "PLACEHOLDER",
|
|
1418
|
+
enter(parent, start) {
|
|
1419
|
+
return {
|
|
1420
|
+
state: PLACEHOLDER,
|
|
1421
|
+
parent,
|
|
1422
|
+
start,
|
|
1423
|
+
end: start,
|
|
1424
|
+
escape: false
|
|
1425
|
+
};
|
|
1426
|
+
},
|
|
1427
|
+
exit(placeholder) {
|
|
1428
|
+
var _a, _b;
|
|
1429
|
+
(_b = (_a = this.handlers).onPlaceholder) == null ? void 0 : _b.call(_a, {
|
|
1430
|
+
start: placeholder.start,
|
|
1431
|
+
end: placeholder.end,
|
|
1432
|
+
escape: placeholder.escape,
|
|
1433
|
+
value: {
|
|
1434
|
+
start: placeholder.start + (placeholder.escape ? 2 : 3),
|
|
1435
|
+
end: placeholder.end - 1
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
},
|
|
1439
|
+
char() {
|
|
1440
|
+
},
|
|
1441
|
+
eol() {
|
|
1442
|
+
},
|
|
1443
|
+
eof() {
|
|
1444
|
+
},
|
|
1445
|
+
return(child) {
|
|
1446
|
+
if (child.start === child.end) {
|
|
1447
|
+
this.emitError(child, "PLACEHOLDER_EXPRESSION_REQUIRED", "Invalid placeholder, the expression cannot be missing");
|
|
1448
|
+
}
|
|
1449
|
+
this.pos++;
|
|
1450
|
+
this.exitState();
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
function checkForPlaceholder(parser, code) {
|
|
1454
|
+
let ahead = 0;
|
|
1455
|
+
let curCode = code;
|
|
1456
|
+
while (curCode === 92 /* BACK_SLASH */) {
|
|
1457
|
+
curCode = parser.lookAtCharCodeAhead(++ahead);
|
|
1458
|
+
}
|
|
1459
|
+
if (curCode === 36 /* DOLLAR */) {
|
|
1460
|
+
let escape = true;
|
|
1461
|
+
curCode = parser.lookAtCharCodeAhead(ahead + 1);
|
|
1462
|
+
if (curCode === 33 /* EXCLAMATION */) {
|
|
1463
|
+
escape = false;
|
|
1464
|
+
curCode = parser.lookAtCharCodeAhead(ahead + 2);
|
|
1465
|
+
}
|
|
1466
|
+
if (curCode === 123 /* OPEN_CURLY_BRACE */) {
|
|
1467
|
+
if (ahead) {
|
|
1468
|
+
const remainder = ahead % 2;
|
|
1469
|
+
const extra = (ahead + remainder) / 2;
|
|
1470
|
+
if (remainder) {
|
|
1471
|
+
parser.endText();
|
|
1472
|
+
parser.pos += extra;
|
|
1473
|
+
parser.startText();
|
|
1474
|
+
parser.pos += escape ? 2 : 3;
|
|
1475
|
+
return true;
|
|
1476
|
+
} else {
|
|
1477
|
+
parser.startText();
|
|
1478
|
+
parser.pos += extra;
|
|
1479
|
+
parser.endText();
|
|
1480
|
+
parser.pos += extra;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
parser.endText();
|
|
1484
|
+
parser.enterState(PLACEHOLDER).escape = escape;
|
|
1485
|
+
parser.pos += escape ? 2 : 3;
|
|
1486
|
+
parser.enterState(states_exports.EXPRESSION).terminator = 125 /* CLOSE_CURLY_BRACE */;
|
|
1487
|
+
parser.pos--;
|
|
1488
|
+
return true;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
return false;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// src/states/REGULAR_EXPRESSION.ts
|
|
1495
|
+
var REGULAR_EXPRESSION = {
|
|
1496
|
+
name: "REGULAR_EXPRESSION",
|
|
1497
|
+
enter(parent, start) {
|
|
1498
|
+
return {
|
|
1499
|
+
state: REGULAR_EXPRESSION,
|
|
1500
|
+
parent,
|
|
1501
|
+
start,
|
|
1502
|
+
end: start,
|
|
1503
|
+
isInCharSet: false
|
|
1504
|
+
};
|
|
1505
|
+
},
|
|
1506
|
+
exit() {
|
|
1507
|
+
},
|
|
1508
|
+
char(code, regExp) {
|
|
1509
|
+
if (code === 92 /* BACK_SLASH */) {
|
|
1510
|
+
this.pos++;
|
|
1511
|
+
} else if (code === 91 /* OPEN_SQUARE_BRACKET */ && regExp.isInCharSet) {
|
|
1512
|
+
regExp.isInCharSet = true;
|
|
1513
|
+
} else if (code === 93 /* CLOSE_SQUARE_BRACKET */ && regExp.isInCharSet) {
|
|
1514
|
+
regExp.isInCharSet = false;
|
|
1515
|
+
} else if (code === 47 /* FORWARD_SLASH */ && !regExp.isInCharSet) {
|
|
1516
|
+
this.pos++;
|
|
1517
|
+
this.exitState();
|
|
1518
|
+
}
|
|
1519
|
+
},
|
|
1520
|
+
eol(_, regExp) {
|
|
1521
|
+
this.emitError(regExp, "INVALID_REGULAR_EXPRESSION", "EOL reached while parsing regular expression");
|
|
1522
|
+
},
|
|
1523
|
+
eof(regExp) {
|
|
1524
|
+
this.emitError(regExp, "INVALID_REGULAR_EXPRESSION", "EOF reached while parsing regular expression");
|
|
1525
|
+
},
|
|
1526
|
+
return() {
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
// src/states/STRING.ts
|
|
1531
|
+
var STRING = {
|
|
1532
|
+
name: "STRING",
|
|
1533
|
+
enter(parent, start) {
|
|
1534
|
+
return {
|
|
1535
|
+
state: STRING,
|
|
1536
|
+
parent,
|
|
1537
|
+
start,
|
|
1538
|
+
end: start,
|
|
1539
|
+
quoteCharCode: 34 /* DOUBLE_QUOTE */
|
|
1540
|
+
};
|
|
1541
|
+
},
|
|
1542
|
+
exit() {
|
|
1543
|
+
},
|
|
1544
|
+
char(code, string) {
|
|
1545
|
+
switch (code) {
|
|
1546
|
+
case 92 /* BACK_SLASH */:
|
|
1547
|
+
this.pos++;
|
|
1548
|
+
break;
|
|
1549
|
+
case string.quoteCharCode:
|
|
1550
|
+
this.pos++;
|
|
1551
|
+
this.exitState();
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
},
|
|
1555
|
+
eol() {
|
|
1556
|
+
},
|
|
1557
|
+
eof(string) {
|
|
1558
|
+
this.emitError(string, "INVALID_STRING", "EOF reached while parsing string expression");
|
|
1559
|
+
},
|
|
1560
|
+
return() {
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
// src/states/TAG_NAME.ts
|
|
1565
|
+
var VOID_TAGS = [
|
|
1566
|
+
"area",
|
|
1567
|
+
"base",
|
|
1568
|
+
"br",
|
|
1569
|
+
"col",
|
|
1570
|
+
"hr",
|
|
1571
|
+
"embed",
|
|
1572
|
+
"img",
|
|
1573
|
+
"input",
|
|
1574
|
+
"link",
|
|
1575
|
+
"meta",
|
|
1576
|
+
"param",
|
|
1577
|
+
"source",
|
|
1578
|
+
"track",
|
|
1579
|
+
"wbr"
|
|
1580
|
+
];
|
|
1581
|
+
var CODE_TAGS = ["import", "export", "static", "class"];
|
|
1582
|
+
var TAG_NAME = {
|
|
1583
|
+
name: "TAG_NAME",
|
|
1584
|
+
enter(parent, start) {
|
|
1585
|
+
return {
|
|
1586
|
+
state: TAG_NAME,
|
|
1587
|
+
parent,
|
|
1588
|
+
start,
|
|
1589
|
+
end: start,
|
|
1590
|
+
expressions: [],
|
|
1591
|
+
quasis: [{ start, end: start }]
|
|
1592
|
+
};
|
|
1593
|
+
},
|
|
1594
|
+
exit(tagName) {
|
|
1595
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1596
|
+
const { start, end, quasis, expressions } = tagName;
|
|
1597
|
+
const last = quasis[quasis.length - 1];
|
|
1598
|
+
if (last.end < end)
|
|
1599
|
+
last.end = end;
|
|
1600
|
+
switch (tagName.shorthandCode) {
|
|
1601
|
+
case 35 /* NUMBER_SIGN */:
|
|
1602
|
+
if (this.activeTag.hasShorthandId) {
|
|
1603
|
+
return this.emitError(tagName, "INVALID_TAG_SHORTHAND", "Multiple shorthand ID parts are not allowed on the same tag");
|
|
1604
|
+
}
|
|
1605
|
+
this.activeTag.hasShorthandId = true;
|
|
1606
|
+
(_b = (_a = this.handlers).onTagShorthandId) == null ? void 0 : _b.call(_a, {
|
|
1607
|
+
start,
|
|
1608
|
+
end,
|
|
1609
|
+
quasis,
|
|
1610
|
+
expressions
|
|
1611
|
+
});
|
|
1612
|
+
break;
|
|
1613
|
+
case 46 /* PERIOD */:
|
|
1614
|
+
(_d = (_c = this.handlers).onTagShorthandClass) == null ? void 0 : _d.call(_c, {
|
|
1615
|
+
start,
|
|
1616
|
+
end,
|
|
1617
|
+
quasis,
|
|
1618
|
+
expressions
|
|
1619
|
+
});
|
|
1620
|
+
break;
|
|
1621
|
+
default: {
|
|
1622
|
+
const tag = this.activeTag;
|
|
1623
|
+
tag.tagName = tagName;
|
|
1624
|
+
if (tagName.expressions.length === 0) {
|
|
1625
|
+
if (this.matchAnyAtPos(tagName, VOID_TAGS)) {
|
|
1626
|
+
tag.ending |= 2 /* void */;
|
|
1627
|
+
} else if (this.matchAnyAtPos(tagName, CODE_TAGS)) {
|
|
1628
|
+
if (!tag.concise) {
|
|
1629
|
+
return this.emitError(tagName, "RESERVED_TAG_NAME", `The "${this.read(tagName)}" tag is reserved and cannot be used as an HTML tag.`);
|
|
1630
|
+
}
|
|
1631
|
+
if (tag.parentTag) {
|
|
1632
|
+
return this.emitError(tagName, "ROOT_TAG_ONLY", `"${this.read(tagName)}" can only be used at the root of the template.`);
|
|
1633
|
+
}
|
|
1634
|
+
tag.ending |= 4 /* code */;
|
|
1635
|
+
this.enterState(states_exports.EXPRESSION).terminatedByEOL = true;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
(_f = (_e = this.handlers).onTagName) == null ? void 0 : _f.call(_e, {
|
|
1639
|
+
start,
|
|
1640
|
+
end,
|
|
1641
|
+
quasis,
|
|
1642
|
+
expressions,
|
|
1643
|
+
concise: this.isConcise
|
|
1644
|
+
});
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
},
|
|
1649
|
+
char(code) {
|
|
1650
|
+
if (code === 36 /* DOLLAR */ && this.lookAtCharCodeAhead(1) === 123 /* OPEN_CURLY_BRACE */) {
|
|
1651
|
+
this.pos += 2;
|
|
1652
|
+
this.enterState(states_exports.EXPRESSION).terminator = 125 /* CLOSE_CURLY_BRACE */;
|
|
1653
|
+
this.pos--;
|
|
1654
|
+
} else if (isWhitespaceCode(code) || code === 61 /* EQUAL */ || code === 58 /* COLON */ && this.lookAtCharCodeAhead(1) === 61 /* EQUAL */ || code === 40 /* OPEN_PAREN */ || code === 47 /* FORWARD_SLASH */ || code === 124 /* PIPE */ || (this.isConcise ? code === 59 /* SEMICOLON */ : code === 62 /* CLOSE_ANGLE_BRACKET */)) {
|
|
1655
|
+
this.activeTag.shorthandEnd = this.pos;
|
|
1656
|
+
this.exitState();
|
|
1657
|
+
} else if (code === 46 /* PERIOD */ || code === 35 /* NUMBER_SIGN */) {
|
|
1658
|
+
this.exitState();
|
|
1659
|
+
const shorthand = this.enterState(TAG_NAME);
|
|
1660
|
+
shorthand.shorthandCode = code;
|
|
1661
|
+
shorthand.quasis[0].start = ++this.pos;
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
eol() {
|
|
1665
|
+
this.activeTag.shorthandEnd = this.pos;
|
|
1666
|
+
this.exitState();
|
|
1667
|
+
},
|
|
1668
|
+
eof() {
|
|
1669
|
+
this.exitState();
|
|
1670
|
+
},
|
|
1671
|
+
return(child, tagName) {
|
|
1672
|
+
if (child.terminatedByEOL)
|
|
1673
|
+
return;
|
|
1674
|
+
if (child.start === child.end) {
|
|
1675
|
+
this.emitError(child, "PLACEHOLDER_EXPRESSION_REQUIRED", "Invalid placeholder, the expression cannot be missing");
|
|
1676
|
+
}
|
|
1677
|
+
const { quasis, expressions } = tagName;
|
|
1678
|
+
const start = child.start - 2;
|
|
1679
|
+
const end = ++this.pos;
|
|
1680
|
+
const nextStart = end + 1;
|
|
1681
|
+
expressions.push({
|
|
1682
|
+
start,
|
|
1683
|
+
end,
|
|
1684
|
+
value: {
|
|
1685
|
+
start: child.start,
|
|
1686
|
+
end: child.end
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
quasis[quasis.length - 1].end = start;
|
|
1690
|
+
quasis.push({ start: nextStart, end: nextStart });
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
// src/states/TEMPLATE_STRING.ts
|
|
1695
|
+
var TEMPLATE_STRING = {
|
|
1696
|
+
name: "TEMPLATE_STRING",
|
|
1697
|
+
enter(parent, start) {
|
|
1698
|
+
return {
|
|
1699
|
+
state: TEMPLATE_STRING,
|
|
1700
|
+
parent,
|
|
1701
|
+
start,
|
|
1702
|
+
end: start
|
|
1703
|
+
};
|
|
1704
|
+
},
|
|
1705
|
+
exit() {
|
|
1706
|
+
},
|
|
1707
|
+
char(code) {
|
|
1708
|
+
if (code === 36 /* DOLLAR */ && this.lookAtCharCodeAhead(1) === 123 /* OPEN_CURLY_BRACE */) {
|
|
1709
|
+
this.pos++;
|
|
1710
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1711
|
+
expr.skipOperators = true;
|
|
1712
|
+
expr.terminator = 125 /* CLOSE_CURLY_BRACE */;
|
|
1713
|
+
} else {
|
|
1714
|
+
if (code === 92 /* BACK_SLASH */) {
|
|
1715
|
+
this.pos++;
|
|
1716
|
+
} else if (code === 96 /* BACKTICK */) {
|
|
1717
|
+
this.pos++;
|
|
1718
|
+
this.exitState();
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
eof(templateString) {
|
|
1723
|
+
this.emitError(templateString, "INVALID_TEMPLATE_STRING", "EOF reached while parsing template string expression");
|
|
1724
|
+
},
|
|
1725
|
+
eol() {
|
|
1726
|
+
},
|
|
1727
|
+
return(child) {
|
|
1728
|
+
if (child.start === child.end) {
|
|
1729
|
+
this.emitError(child, "PLACEHOLDER_EXPRESSION_REQUIRED", "Invalid placeholder, the expression cannot be missing");
|
|
1730
|
+
}
|
|
1731
|
+
this.pos++;
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
// src/states/OPEN_TAG.ts
|
|
1736
|
+
var PARSED_TEXT_TAGS = ["script", "style", "textarea", "html-comment"];
|
|
1737
|
+
var CONCISE_TAG_VAR_TERMINATORS = [
|
|
1738
|
+
59 /* SEMICOLON */,
|
|
1739
|
+
40 /* OPEN_PAREN */,
|
|
1740
|
+
124 /* PIPE */,
|
|
1741
|
+
61 /* EQUAL */,
|
|
1742
|
+
[58 /* COLON */, 61 /* EQUAL */]
|
|
1743
|
+
];
|
|
1744
|
+
var HTML_TAG_VAR_TERMINATORS = [
|
|
1745
|
+
62 /* CLOSE_ANGLE_BRACKET */,
|
|
1746
|
+
40 /* OPEN_PAREN */,
|
|
1747
|
+
124 /* PIPE */,
|
|
1748
|
+
61 /* EQUAL */,
|
|
1749
|
+
[58 /* COLON */, 61 /* EQUAL */],
|
|
1750
|
+
[47 /* FORWARD_SLASH */, 62 /* CLOSE_ANGLE_BRACKET */]
|
|
1751
|
+
];
|
|
1752
|
+
var OPEN_TAG = {
|
|
1753
|
+
name: "OPEN_TAG",
|
|
1754
|
+
enter(parent, start) {
|
|
1755
|
+
const tag = this.activeTag = {
|
|
1756
|
+
state: OPEN_TAG,
|
|
1757
|
+
parent,
|
|
1758
|
+
start,
|
|
1759
|
+
end: start,
|
|
1760
|
+
stage: 0 /* UNKNOWN */,
|
|
1761
|
+
parentTag: this.activeTag,
|
|
1762
|
+
nestedIndent: void 0,
|
|
1763
|
+
indent: this.indent,
|
|
1764
|
+
hasShorthandId: false,
|
|
1765
|
+
hasArgs: false,
|
|
1766
|
+
hasAttrs: false,
|
|
1767
|
+
shorthandEnd: -1,
|
|
1768
|
+
tagName: void 0,
|
|
1769
|
+
ending: 0 /* tag */,
|
|
1770
|
+
concise: this.isConcise,
|
|
1771
|
+
bodyMode: 0 /* HTML */,
|
|
1772
|
+
beginMixedMode: this.beginMixedMode || this.endingMixedModeAtEOL
|
|
1773
|
+
};
|
|
1774
|
+
this.beginMixedMode = false;
|
|
1775
|
+
this.endingMixedModeAtEOL = false;
|
|
1776
|
+
this.endText();
|
|
1777
|
+
return tag;
|
|
1778
|
+
},
|
|
1779
|
+
exit(tag) {
|
|
1780
|
+
var _a, _b;
|
|
1781
|
+
const { tagName, ending } = tag;
|
|
1782
|
+
(_b = (_a = this.handlers).onOpenTagEnd) == null ? void 0 : _b.call(_a, {
|
|
1783
|
+
start: this.pos - (this.isConcise ? 0 : ending & 1 /* self */ ? 2 : 1),
|
|
1784
|
+
end: this.pos,
|
|
1785
|
+
ending
|
|
1786
|
+
});
|
|
1787
|
+
if (!this.isConcise && ending !== 0 /* tag */) {
|
|
1788
|
+
this.closeTag(this.pos, this.pos, void 0);
|
|
1789
|
+
} else if (tagName.expressions.length === 0 && this.matchAnyAtPos(tagName, PARSED_TEXT_TAGS)) {
|
|
1790
|
+
tag.bodyMode = 1 /* PARSED_TEXT */;
|
|
1791
|
+
if (this.isConcise) {
|
|
1792
|
+
this.enterState(states_exports.CONCISE_HTML_CONTENT);
|
|
1793
|
+
} else {
|
|
1794
|
+
this.enterState(states_exports.PARSED_TEXT_CONTENT);
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
},
|
|
1798
|
+
eol(_, tag) {
|
|
1799
|
+
if (this.isConcise && tag.stage !== 4 /* ATTR_GROUP */) {
|
|
1800
|
+
this.exitState();
|
|
1801
|
+
}
|
|
1802
|
+
},
|
|
1803
|
+
eof(tag) {
|
|
1804
|
+
if (this.isConcise) {
|
|
1805
|
+
if (tag.stage === 4 /* ATTR_GROUP */) {
|
|
1806
|
+
this.emitError(tag, "MALFORMED_OPEN_TAG", 'EOF reached while within an attribute group (e.g. "[ ... ]").');
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
this.exitState();
|
|
1810
|
+
} else {
|
|
1811
|
+
this.emitError(tag, "MALFORMED_OPEN_TAG", "EOF reached while parsing open tag");
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
char(code, tag) {
|
|
1815
|
+
if (this.isConcise) {
|
|
1816
|
+
if (code === 59 /* SEMICOLON */) {
|
|
1817
|
+
this.pos++;
|
|
1818
|
+
this.exitState();
|
|
1819
|
+
if (!this.consumeWhitespaceOnLine(0)) {
|
|
1820
|
+
switch (this.lookAtCharCodeAhead(0)) {
|
|
1821
|
+
case 47 /* FORWARD_SLASH */:
|
|
1822
|
+
switch (this.lookAtCharCodeAhead(1)) {
|
|
1823
|
+
case 47 /* FORWARD_SLASH */:
|
|
1824
|
+
this.enterState(states_exports.JS_COMMENT_LINE);
|
|
1825
|
+
this.pos += 2;
|
|
1826
|
+
return;
|
|
1827
|
+
case 42 /* ASTERISK */:
|
|
1828
|
+
this.enterState(states_exports.JS_COMMENT_BLOCK);
|
|
1829
|
+
this.pos += 2;
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
break;
|
|
1833
|
+
case 60 /* OPEN_ANGLE_BRACKET */:
|
|
1834
|
+
if (this.lookAheadFor("!--")) {
|
|
1835
|
+
this.enterState(states_exports.HTML_COMMENT);
|
|
1836
|
+
this.pos += 4;
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
break;
|
|
1840
|
+
}
|
|
1841
|
+
this.emitError(this.pos, "INVALID_CODE_AFTER_SEMICOLON", "A semicolon indicates the end of a line. Only comments may follow it.");
|
|
1842
|
+
}
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
if (code === 45 /* HTML_BLOCK_DELIMITER */) {
|
|
1846
|
+
if (this.lookAtCharCodeAhead(1) !== 45 /* HTML_BLOCK_DELIMITER */) {
|
|
1847
|
+
this.emitError(tag, "MALFORMED_OPEN_TAG", '"-" not allowed as first character of attribute name');
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
if (tag.stage === 4 /* ATTR_GROUP */) {
|
|
1851
|
+
this.emitError(this.pos, "MALFORMED_OPEN_TAG", "Attribute group was not properly ended");
|
|
1852
|
+
return;
|
|
1853
|
+
}
|
|
1854
|
+
this.exitState();
|
|
1855
|
+
const maxPos = this.maxPos;
|
|
1856
|
+
let curPos = this.pos + 1;
|
|
1857
|
+
while (curPos < maxPos && this.data.charCodeAt(++curPos) !== 10 /* NEWLINE */)
|
|
1858
|
+
;
|
|
1859
|
+
const indentStart = ++curPos;
|
|
1860
|
+
while (curPos < maxPos) {
|
|
1861
|
+
const nextCode = this.data.charCodeAt(curPos);
|
|
1862
|
+
if (nextCode === 32 /* SPACE */ || nextCode === 9 /* TAB */) {
|
|
1863
|
+
curPos++;
|
|
1864
|
+
} else {
|
|
1865
|
+
break;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
const indentSize = curPos - indentStart;
|
|
1869
|
+
if (indentSize > this.indent.length) {
|
|
1870
|
+
this.indent = this.data.slice(indentStart, curPos);
|
|
1871
|
+
}
|
|
1872
|
+
this.enterState(states_exports.BEGIN_DELIMITED_HTML_BLOCK);
|
|
1873
|
+
return;
|
|
1874
|
+
} else if (code === 91 /* OPEN_SQUARE_BRACKET */) {
|
|
1875
|
+
if (tag.stage === 4 /* ATTR_GROUP */) {
|
|
1876
|
+
this.emitError(this.pos, "MALFORMED_OPEN_TAG", 'Unexpected "[" character within open tag.');
|
|
1877
|
+
return;
|
|
1878
|
+
}
|
|
1879
|
+
tag.stage = 4 /* ATTR_GROUP */;
|
|
1880
|
+
return;
|
|
1881
|
+
} else if (code === 93 /* CLOSE_SQUARE_BRACKET */) {
|
|
1882
|
+
if (tag.stage !== 4 /* ATTR_GROUP */) {
|
|
1883
|
+
this.emitError(this.pos, "MALFORMED_OPEN_TAG", 'Unexpected "]" character within open tag.');
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
tag.stage = 0 /* UNKNOWN */;
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
} else if (code === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
1890
|
+
this.pos++;
|
|
1891
|
+
this.exitState();
|
|
1892
|
+
return;
|
|
1893
|
+
} else if (code === 47 /* FORWARD_SLASH */ && this.lookAtCharCodeAhead(1) === 62 /* CLOSE_ANGLE_BRACKET */) {
|
|
1894
|
+
tag.ending |= 1 /* self */;
|
|
1895
|
+
this.pos += 2;
|
|
1896
|
+
this.exitState();
|
|
1897
|
+
return;
|
|
1898
|
+
}
|
|
1899
|
+
if (code === 60 /* OPEN_ANGLE_BRACKET */) {
|
|
1900
|
+
return this.emitError(this.pos, "ILLEGAL_ATTRIBUTE_NAME", 'Invalid attribute name. Attribute name cannot begin with the "<" character.');
|
|
1901
|
+
}
|
|
1902
|
+
if (code === 47 /* FORWARD_SLASH */ && this.lookAtCharCodeAhead(1) === 42 /* ASTERISK */) {
|
|
1903
|
+
this.enterState(states_exports.JS_COMMENT_BLOCK);
|
|
1904
|
+
this.pos++;
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
if (isWhitespaceCode(code)) {
|
|
1908
|
+
} else if (code === 44 /* COMMA */) {
|
|
1909
|
+
this.pos++;
|
|
1910
|
+
this.consumeWhitespace();
|
|
1911
|
+
this.pos--;
|
|
1912
|
+
} else if (code === 47 /* FORWARD_SLASH */ && !tag.hasAttrs) {
|
|
1913
|
+
tag.stage = 1 /* VAR */;
|
|
1914
|
+
this.pos++;
|
|
1915
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1916
|
+
expr.skipOperators = true;
|
|
1917
|
+
expr.terminatedByWhitespace = true;
|
|
1918
|
+
expr.terminator = this.isConcise ? CONCISE_TAG_VAR_TERMINATORS : HTML_TAG_VAR_TERMINATORS;
|
|
1919
|
+
this.pos--;
|
|
1920
|
+
} else if (code === 40 /* OPEN_PAREN */ && !tag.hasAttrs) {
|
|
1921
|
+
if (tag.hasArgs) {
|
|
1922
|
+
this.emitError(this.pos, "ILLEGAL_TAG_ARGUMENT", "A tag can only have one argument");
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
tag.stage = 2 /* ARGUMENT */;
|
|
1926
|
+
this.pos++;
|
|
1927
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1928
|
+
expr.skipOperators = true;
|
|
1929
|
+
expr.terminator = 41 /* CLOSE_PAREN */;
|
|
1930
|
+
this.pos--;
|
|
1931
|
+
} else if (code === 124 /* PIPE */ && !tag.hasAttrs) {
|
|
1932
|
+
tag.stage = 3 /* PARAMS */;
|
|
1933
|
+
this.pos++;
|
|
1934
|
+
const expr = this.enterState(states_exports.EXPRESSION);
|
|
1935
|
+
expr.skipOperators = true;
|
|
1936
|
+
expr.terminator = 124 /* PIPE */;
|
|
1937
|
+
this.pos--;
|
|
1938
|
+
} else {
|
|
1939
|
+
if (tag.tagName) {
|
|
1940
|
+
this.enterState(states_exports.ATTRIBUTE);
|
|
1941
|
+
tag.hasAttrs = true;
|
|
1942
|
+
} else {
|
|
1943
|
+
this.enterState(states_exports.TAG_NAME);
|
|
1944
|
+
}
|
|
1945
|
+
this.pos--;
|
|
1946
|
+
}
|
|
1947
|
+
},
|
|
1948
|
+
return(child, tag) {
|
|
1949
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1950
|
+
switch (child.state) {
|
|
1951
|
+
case states_exports.JS_COMMENT_BLOCK: {
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
case states_exports.EXPRESSION: {
|
|
1955
|
+
switch (tag.stage) {
|
|
1956
|
+
case 1 /* VAR */: {
|
|
1957
|
+
if (child.start === child.end) {
|
|
1958
|
+
return this.emitError(child, "MISSING_TAG_VARIABLE", "A slash was found that was not followed by a variable name or lhs expression");
|
|
1959
|
+
}
|
|
1960
|
+
(_b = (_a = this.handlers).onTagVar) == null ? void 0 : _b.call(_a, {
|
|
1961
|
+
start: child.start - 1,
|
|
1962
|
+
end: child.end,
|
|
1963
|
+
value: {
|
|
1964
|
+
start: child.start,
|
|
1965
|
+
end: child.end
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
case 2 /* ARGUMENT */: {
|
|
1971
|
+
const start = child.start - 1;
|
|
1972
|
+
const end = ++this.pos;
|
|
1973
|
+
const value = {
|
|
1974
|
+
start: child.start,
|
|
1975
|
+
end: child.end
|
|
1976
|
+
};
|
|
1977
|
+
if (this.consumeWhitespaceIfBefore("{")) {
|
|
1978
|
+
const attr = this.enterState(states_exports.ATTRIBUTE);
|
|
1979
|
+
attr.start = start;
|
|
1980
|
+
attr.args = { start, end, value };
|
|
1981
|
+
tag.hasAttrs = true;
|
|
1982
|
+
this.pos--;
|
|
1983
|
+
} else {
|
|
1984
|
+
tag.hasArgs = true;
|
|
1985
|
+
(_d = (_c = this.handlers).onTagArgs) == null ? void 0 : _d.call(_c, {
|
|
1986
|
+
start,
|
|
1987
|
+
end,
|
|
1988
|
+
value
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
break;
|
|
1992
|
+
}
|
|
1993
|
+
case 3 /* PARAMS */: {
|
|
1994
|
+
const end = ++this.pos;
|
|
1995
|
+
(_f = (_e = this.handlers).onTagParams) == null ? void 0 : _f.call(_e, {
|
|
1996
|
+
start: child.start - 1,
|
|
1997
|
+
end,
|
|
1998
|
+
value: {
|
|
1999
|
+
start: child.start,
|
|
2000
|
+
end: child.end
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
break;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
break;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
// src/index.ts
|
|
2013
|
+
function createParser(handlers) {
|
|
2014
|
+
const parser = new Parser(handlers);
|
|
2015
|
+
return {
|
|
2016
|
+
parse(code) {
|
|
2017
|
+
return parser.parse(code);
|
|
2018
|
+
},
|
|
2019
|
+
read(range) {
|
|
2020
|
+
return parser.read(range);
|
|
2021
|
+
},
|
|
2022
|
+
positionAt(index) {
|
|
2023
|
+
return parser.positionAt(index);
|
|
2024
|
+
},
|
|
2025
|
+
locationAt(range) {
|
|
2026
|
+
return parser.locationAt(range);
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
}
|
|
2030
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2031
|
+
0 && (module.exports = {
|
|
2032
|
+
OpenTagEnding,
|
|
2033
|
+
createParser
|
|
2034
|
+
});
|