@markuplint/svelte-parser 4.0.0 → 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 +9 -1
- package/package.json +6 -6
package/lib/parser.js
CHANGED
|
@@ -145,6 +145,7 @@ class SvelteParser extends Parser {
|
|
|
145
145
|
{ start: '"', end: '"' },
|
|
146
146
|
{ start: "'", end: "'" },
|
|
147
147
|
{ start: '`', end: '`' },
|
|
148
|
+
{ start: '{', end: '}' },
|
|
148
149
|
{ start: '${', end: '}' },
|
|
149
150
|
],
|
|
150
151
|
startState:
|
|
@@ -222,7 +223,8 @@ class SvelteParser extends Parser {
|
|
|
222
223
|
nodeList.set(node, type);
|
|
223
224
|
}
|
|
224
225
|
let lastChild = null;
|
|
225
|
-
for (const [node,
|
|
226
|
+
for (const [node, _type] of nodeList.entries()) {
|
|
227
|
+
let type = _type;
|
|
226
228
|
let start = node.start;
|
|
227
229
|
let end = node.end;
|
|
228
230
|
if (type === 'await') {
|
|
@@ -236,9 +238,15 @@ class SvelteParser extends Parser {
|
|
|
236
238
|
start = lastChild?.end ?? start;
|
|
237
239
|
}
|
|
238
240
|
const tag = this.sliceFragment(start, end);
|
|
241
|
+
if (type === 'else' && node.type === 'ElseBlock' && node.children?.[0]?.type === 'IfBlock') {
|
|
242
|
+
type = 'elseif';
|
|
243
|
+
}
|
|
239
244
|
if (node.children && Array.isArray(node.children)) {
|
|
240
245
|
lastChild = node.children.at(-1) ?? null;
|
|
241
246
|
}
|
|
247
|
+
if (tag.raw === '') {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
242
250
|
const expression = this.visitPsBlock({
|
|
243
251
|
...tag,
|
|
244
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
|
}
|