@markuplint/svelte-parser 4.0.0-alpha.7 → 4.0.0-alpha.8
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/README.md +12 -0
- package/lib/parse.js +1 -1
- package/lib/sveltekit-parser.d.ts +2 -0
- package/lib/sveltekit-parser.js +14 -0
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -23,3 +23,15 @@ Add `parser` option to your [configuration](https://markuplint.dev/configuration
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
|
+
|
|
27
|
+
### Use with [SvelteKit](https://kit.svelte.dev/)
|
|
28
|
+
|
|
29
|
+
```diff
|
|
30
|
+
{
|
|
31
|
+
"parser": {
|
|
32
|
+
-- ".svelte$": "@markuplint/svelte-parser"
|
|
33
|
+
++ ".svelte$": "@markuplint/svelte-parser",
|
|
34
|
+
++ ".html$": "@markuplint/svelte-parser/kit"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
package/lib/parse.js
CHANGED
|
@@ -39,7 +39,7 @@ export const parse = (rawCode, options) => {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
const nodes = traverse(ast, null, blocks.replaced, options);
|
|
42
|
-
const nodeList = restoreNode(flattenNodes(nodes, blocks.replaced), blocks);
|
|
42
|
+
const nodeList = restoreNode(flattenNodes(nodes, blocks.replaced), blocks, false);
|
|
43
43
|
return {
|
|
44
44
|
nodeList,
|
|
45
45
|
isFragment: true,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { parse as htmlParse } from '@markuplint/html-parser';
|
|
2
|
+
import { ignoreBlock, restoreNode } from '@markuplint/parser-utils';
|
|
3
|
+
export const parse = (rawCode, options) => {
|
|
4
|
+
const blocks = ignoreBlock(rawCode, [
|
|
5
|
+
{
|
|
6
|
+
type: 'sveltekit-placeholder',
|
|
7
|
+
start: '%sveltekit.',
|
|
8
|
+
end: '%',
|
|
9
|
+
},
|
|
10
|
+
]);
|
|
11
|
+
const doc = htmlParse(blocks.replaced, options);
|
|
12
|
+
doc.nodeList = restoreNode(doc.nodeList, blocks);
|
|
13
|
+
return doc;
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/svelte-parser",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"description": "Svelte parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./kit": {
|
|
15
|
+
"import": "./lib/sveltekit-parser.js"
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
18
|
"types": "lib/index.d.ts",
|
|
@@ -21,10 +24,10 @@
|
|
|
21
24
|
"clean": "tsc --build --clean"
|
|
22
25
|
},
|
|
23
26
|
"dependencies": {
|
|
24
|
-
"@markuplint/html-parser": "4.0.0-alpha.
|
|
25
|
-
"@markuplint/ml-ast": "4.0.0-alpha.
|
|
26
|
-
"@markuplint/parser-utils": "4.0.0-alpha.
|
|
27
|
+
"@markuplint/html-parser": "4.0.0-alpha.8",
|
|
28
|
+
"@markuplint/ml-ast": "4.0.0-alpha.8",
|
|
29
|
+
"@markuplint/parser-utils": "4.0.0-alpha.8",
|
|
27
30
|
"svelte": "^4.2.8"
|
|
28
31
|
},
|
|
29
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "5bcd25f13ff804af0d09aaabd87e495af668e6a8"
|
|
30
33
|
}
|