@markuplint/svelte-parser 4.6.7 → 4.6.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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [4.6.7](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.6...@markuplint/svelte-parser@4.6.7) (2024-09-23)
6
+ ## [4.6.8](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.7...@markuplint/svelte-parser@4.6.8) (2024-10-14)
7
7
 
8
8
  **Note:** Version bump only for package @markuplint/svelte-parser
9
9
 
@@ -11,13 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [4.6.6](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.5...@markuplint/svelte-parser@4.6.6) (2024-09-02)
14
+ ## [4.6.7](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.6...@markuplint/svelte-parser@4.6.7) (2024-09-23)
15
15
 
16
16
  **Note:** Version bump only for package @markuplint/svelte-parser
17
17
 
18
+ ## [4.6.6](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.5...@markuplint/svelte-parser@4.6.6) (2024-09-02)
18
19
 
19
-
20
-
20
+ **Note:** Version bump only for package @markuplint/svelte-parser
21
21
 
22
22
  ## [4.6.5](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.4...@markuplint/svelte-parser@4.6.5) (2024-06-25)
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/svelte-parser",
3
- "version": "4.6.7",
3
+ "version": "4.6.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>",
@@ -25,10 +25,10 @@
25
25
  "clean": "tsc --build --clean"
26
26
  },
27
27
  "dependencies": {
28
- "@markuplint/html-parser": "4.6.7",
29
- "@markuplint/ml-ast": "4.4.4",
30
- "@markuplint/parser-utils": "4.6.7",
28
+ "@markuplint/html-parser": "4.6.8",
29
+ "@markuplint/ml-ast": "4.4.5",
30
+ "@markuplint/parser-utils": "4.6.8",
31
31
  "svelte": "4.2.19"
32
32
  },
33
- "gitHead": "05d2eabfcc41b67847c24049f12dd2b9f5ca6485"
33
+ "gitHead": "e59d4e8b762c66c7e3fb8b0a0d9d99d5160b0afa"
34
34
  }
@@ -1,7 +0,0 @@
1
- import type { SvelteParser } from './parser.js';
2
- import type { ChildToken, Token } from '@markuplint/parser-utils';
3
- import type { Block } from 'svelte/compiler';
4
- export declare function parseBlock(parser: SvelteParser, token: ChildToken, originBlockNode: Block): {
5
- openToken: Token;
6
- closeToken: Token;
7
- };
@@ -1,47 +0,0 @@
1
- export function parseBlock(
2
- // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
3
- parser, token,
4
- // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
5
- originBlockNode) {
6
- const range = token.raw;
7
- /**
8
- * `{#xxx}...{:xxx}...{/xxx}`
9
- * find___^
10
- */
11
- // eslint-disable-next-line regexp/strict
12
- const eachCloseStartIndex = range.match(/{\s*\/[a-z]+\s*}$/)?.index;
13
- if (eachCloseStartIndex == null) {
14
- throw new SyntaxError('Block close tag not found');
15
- }
16
- /**
17
- * `{/xxx}`
18
- */
19
- const closeToken = parser.sliceFragment(token.startOffset + eachCloseStartIndex, originBlockNode.end);
20
- const fragment = originBlockNode.type === 'IfBlock'
21
- ? originBlockNode.consequent.nodes
22
- : originBlockNode.type === 'AwaitBlock'
23
- ? originBlockNode.pending?.nodes
24
- : originBlockNode.type === 'KeyBlock'
25
- ? originBlockNode.fragment.nodes
26
- : originBlockNode.body.nodes;
27
- const fragStart = fragment?.at(0)?.start;
28
- const fragEnd = fragment?.at(-1)?.end;
29
- /**
30
- * This token does not guarantee an open tag.
31
- * For example, it might include `:then` or `:else`.
32
- * Therefore, this variable is not used in
33
- * `EachBlock` or `AwaitBlock`.
34
- * It is only used in `KeyBlock` and `SnippetBlock`.
35
- */
36
- let openToken;
37
- if (fragStart != null && fragEnd != null) {
38
- openToken = parser.sliceFragment(token.startOffset, fragStart);
39
- }
40
- else {
41
- openToken = parser.sliceFragment(token.startOffset, eachCloseStartIndex);
42
- }
43
- return {
44
- openToken,
45
- closeToken,
46
- };
47
- }