@markuplint/svelte-parser 4.0.1 → 4.0.2
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/lib/parser.js +8 -1
- package/package.json +6 -6
package/lib/parser.js
CHANGED
|
@@ -223,7 +223,8 @@ class SvelteParser extends Parser {
|
|
|
223
223
|
nodeList.set(node, type);
|
|
224
224
|
}
|
|
225
225
|
let lastChild = null;
|
|
226
|
-
for (const [node,
|
|
226
|
+
for (const [node, _type] of nodeList.entries()) {
|
|
227
|
+
let type = _type;
|
|
227
228
|
let start = node.start;
|
|
228
229
|
let end = node.end;
|
|
229
230
|
if (type === 'await') {
|
|
@@ -237,9 +238,15 @@ class SvelteParser extends Parser {
|
|
|
237
238
|
start = lastChild?.end ?? start;
|
|
238
239
|
}
|
|
239
240
|
const tag = this.sliceFragment(start, end);
|
|
241
|
+
if (type === 'else' && node.type === 'ElseBlock' && node.children?.[0]?.type === 'IfBlock') {
|
|
242
|
+
type = 'elseif';
|
|
243
|
+
}
|
|
240
244
|
if (node.children && Array.isArray(node.children)) {
|
|
241
245
|
lastChild = node.children.at(-1) ?? null;
|
|
242
246
|
}
|
|
247
|
+
if (tag.raw === '') {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
243
250
|
const expression = this.visitPsBlock({
|
|
244
251
|
...tag,
|
|
245
252
|
depth: token.depth,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/svelte-parser",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Svelte parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"clean": "tsc --build --clean"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@markuplint/html-parser": "4.0.
|
|
28
|
-
"@markuplint/ml-ast": "4.0.
|
|
29
|
-
"@markuplint/parser-utils": "4.0.
|
|
30
|
-
"svelte": "^4.2.
|
|
27
|
+
"@markuplint/html-parser": "4.0.1",
|
|
28
|
+
"@markuplint/ml-ast": "4.0.1",
|
|
29
|
+
"@markuplint/parser-utils": "4.0.1",
|
|
30
|
+
"svelte": "^4.2.10"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "bf84b391b580a8586fa7acaf56eb2e8114c8e33e"
|
|
33
33
|
}
|