@markuplint/svelte-parser 4.6.3 → 4.6.4-alpha.1

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,6 +3,21 @@
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.4-alpha.1](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.4-alpha.0...@markuplint/svelte-parser@4.6.4-alpha.1) (2024-06-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix to export type files ([eff4bbf](https://github.com/markuplint/markuplint/commit/eff4bbfd127574809dc5e15d7cafe87699758ee0))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.6.4-alpha.0](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.3...@markuplint/svelte-parser@4.6.4-alpha.0) (2024-06-02)
18
+
19
+ **Note:** Version bump only for package @markuplint/svelte-parser
20
+
6
21
  ## [4.6.3](https://github.com/markuplint/markuplint/compare/@markuplint/svelte-parser@4.6.2...@markuplint/svelte-parser@4.6.3) (2024-05-28)
7
22
 
8
23
  **Note:** Version bump only for package @markuplint/svelte-parser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/svelte-parser",
3
- "version": "4.6.3",
3
+ "version": "4.6.4-alpha.1",
4
4
  "description": "Svelte parser for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -9,13 +9,14 @@
9
9
  "type": "module",
10
10
  "exports": {
11
11
  ".": {
12
- "import": "./lib/index.js"
12
+ "import": "./lib/index.js",
13
+ "types": "./lib/index.d.ts"
13
14
  },
14
15
  "./kit": {
15
- "import": "./lib/sveltekit-parser.js"
16
+ "import": "./lib/sveltekit-parser.js",
17
+ "types": "./lib/sveltekit-parser.d.ts"
16
18
  }
17
19
  },
18
- "types": "lib/index.d.ts",
19
20
  "publishConfig": {
20
21
  "access": "public"
21
22
  },
@@ -24,10 +25,10 @@
24
25
  "clean": "tsc --build --clean"
25
26
  },
26
27
  "dependencies": {
27
- "@markuplint/html-parser": "4.6.3",
28
- "@markuplint/ml-ast": "4.4.0",
29
- "@markuplint/parser-utils": "4.6.3",
28
+ "@markuplint/html-parser": "4.6.4-alpha.1",
29
+ "@markuplint/ml-ast": "4.4.1-alpha.1",
30
+ "@markuplint/parser-utils": "4.6.4-alpha.1",
30
31
  "svelte": "4.2.17"
31
32
  },
32
- "gitHead": "bf70c41b1d2497e85b73c9ecd5551eb522e6bdfc"
33
+ "gitHead": "938c2164b55ad729da47a1851dc396c0033de3f7"
33
34
  }
@@ -1,8 +0,0 @@
1
- /// <reference types="svelte" />
2
- import type { SvelteParser } from './parser.js';
3
- import type { ChildToken, Token } from '@markuplint/parser-utils';
4
- import type { Block } from 'svelte/compiler';
5
- export declare function parseBlock(parser: SvelteParser, token: ChildToken, originBlockNode: Block): {
6
- openToken: Token;
7
- closeToken: Token;
8
- };
@@ -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
- }