Skip to content

Commit

Permalink
Update angular-html-parser (prettier#13578)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 authored and medikoo committed Feb 4, 2024
1 parent e58bd08 commit 81c81e0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
3 changes: 3 additions & 0 deletions changelog_unreleased/html/13578.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Update angular-html-parser (#13578 by @thorn0)

Prettier's fork of Angular's HTML parser was synced with the upstream.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"acorn": "8.8.1",
"acorn-jsx": "5.3.2",
"angular-estree-parser": "2.5.1",
"angular-html-parser": "1.8.0",
"angular-html-parser": "2.0.0",
"camelcase": "7.0.0",
"chalk": "5.0.1",
"ci-info": "3.4.0",
Expand Down
4 changes: 4 additions & 0 deletions src/language-html/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const ignoredProperties = new Set([
"endSourceSpan",
"nameSpan",
"valueSpan",
"keySpan",
"tagDefinition",
"tokens",
"valueTokens",
]);

function clean(ast, newNode) {
Expand Down
4 changes: 3 additions & 1 deletion src/language-html/print-preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ function addIsSelfClosing(ast /*, options */) {
(node.type === "element" &&
(node.tagDefinition.isVoid ||
// self-closing
node.startSourceSpan === node.endSourceSpan));
(node.endSourceSpan &&
node.startSourceSpan.start === node.endSourceSpan.start &&
node.startSourceSpan.end === node.endSourceSpan.end)));
});
}

Expand Down
9 changes: 5 additions & 4 deletions tests/format/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`unclosed_tag.vue [vue] format 1`] = `
"Unexpected character "EOF" (2:1)
1 | <div
"Opening tag "div" not terminated. (1:1)
> 1 | <div
| ^^^^
> 2 |
| ^"
`;
exports[`unclosed_tag_in_template.vue [vue] format 1`] = `
"Unexpected character "/" (4:2)
"Unexpected character "<" (4:1)
2 | <p>Templates are formatted as well...
3 | </
> 4 | </template>
| ^
| ^
5 |"
`;
Expand Down
2 changes: 1 addition & 1 deletion website/playground/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const astAutoFold = {
estree:
/^\s*"(loc|start|end|tokens|leadingComments|trailingComments|innerComments)":/,
postcss: /^\s*"(source|input|raws|file)":/,
html: /^\s*"(sourceSpan|valueSpan|nameSpan|startSourceSpan|endSourceSpan|tagDefinition)":/,
html: /^\s*"(\w+Span|valueTokens|tokens|file|tagDefinition)":/,
mdast: /^\s*"position":/,
yaml: /^\s*"position":/,
glimmer: /^\s*"loc":/,
Expand Down
19 changes: 13 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2366,12 +2366,12 @@ __metadata:
languageName: node
linkType: hard

"angular-html-parser@npm:1.8.0":
version: 1.8.0
resolution: "angular-html-parser@npm:1.8.0"
"angular-html-parser@npm:2.0.0":
version: 2.0.0
resolution: "angular-html-parser@npm:2.0.0"
dependencies:
tslib: ^1.9.3
checksum: 3f47a630500f76dcc36aded0d672da3de1de29e262c7bea06041d86653d00e36c1c1f133211095030e730ed9c4f0fe3415db2f2152e7135be963fd39908d69d6
tslib: 2.4.0
checksum: 28f815f65959202879c17f8b50287728936b18d8c0b59d48ec7d63943356cf7d9b098b36022f22dfa5baad645922ee86e4d20c7d8b88e9dd18b830f712d9db7b
languageName: node
linkType: hard

Expand Down Expand Up @@ -7731,7 +7731,7 @@ __metadata:
acorn: 8.8.1
acorn-jsx: 5.3.2
angular-estree-parser: 2.5.1
angular-html-parser: 1.8.0
angular-html-parser: 2.0.0
benchmark: 2.1.4
browserslist-to-esbuild: 1.2.0
c8: 7.12.0
Expand Down Expand Up @@ -9121,6 +9121,13 @@ __metadata:
languageName: node
linkType: hard

"tslib@npm:2.4.0":
version: 2.4.0
resolution: "tslib@npm:2.4.0"
checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113
languageName: node
linkType: hard

"tslib@npm:^1.10.0, tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3":
version: 1.14.1
resolution: "tslib@npm:1.14.1"
Expand Down

0 comments on commit 81c81e0

Please sign in to comment.