@markuplint/parser-utils 5.0.0-alpha.2 → 5.0.0-alpha.3

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,10 @@
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
+ # [5.0.0-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
7
+
8
+ **Note:** Version bump only for package @markuplint/parser-utils
9
+
6
10
  # [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
7
11
 
8
12
  ### Features
@@ -1,3 +1,4 @@
1
+ export { getPosition } from '@markuplint/shared';
1
2
  /**
2
3
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
3
4
  */
@@ -6,17 +7,6 @@ export declare function getLine(rawCodeFragment: string, startOffset: number): n
6
7
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
7
8
  */
8
9
  export declare function getCol(rawCodeFragment: string, startOffset: number): number;
9
- /**
10
- * Computes the line and column of a position within a code fragment.
11
- *
12
- * @param rawCodeFragment - The full raw source text
13
- * @param startOffset - The zero-based byte offset to compute the position of
14
- * @returns An object containing one-based `line` and `column`
15
- */
16
- export declare function getPosition(rawCodeFragment: string, startOffset: number): {
17
- readonly line: number;
18
- readonly column: number;
19
- };
20
10
  export declare function getEndLine(rawCodeFragment: string, startLine: number): number;
21
11
  export declare function getEndCol(rawCodeFragment: string, startCol: number): number;
22
12
  /**
@@ -1,3 +1,4 @@
1
+ export { getPosition } from '@markuplint/shared';
1
2
  const LINE_BREAK = '\n';
2
3
  /**
3
4
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
@@ -12,19 +13,6 @@ export function getCol(rawCodeFragment, startOffset) {
12
13
  const lines = rawCodeFragment.slice(0, startOffset).split(LINE_BREAK);
13
14
  return (lines.at(-1) ?? '').length + 1;
14
15
  }
15
- /**
16
- * Computes the line and column of a position within a code fragment.
17
- *
18
- * @param rawCodeFragment - The full raw source text
19
- * @param startOffset - The zero-based byte offset to compute the position of
20
- * @returns An object containing one-based `line` and `column`
21
- */
22
- export function getPosition(rawCodeFragment, startOffset) {
23
- const lines = rawCodeFragment.slice(0, startOffset).split(LINE_BREAK);
24
- const line = lines.length;
25
- const column = (lines.at(-1) ?? '').length + 1;
26
- return { line, column };
27
- }
28
16
  export function getEndLine(rawCodeFragment, startLine) {
29
17
  return rawCodeFragment.split(LINE_BREAK).length - 1 + startLine;
30
18
  }
@@ -79,7 +79,7 @@ ignoreBlock, throwErrorWhenTagHasUnresolved = true) {
79
79
  childNodes: [],
80
80
  blockBehavior: null,
81
81
  isBogus: false,
82
- isFragment: false, // TODO: Case by case
82
+ isFragment: false, // Whether this block is a fragment depends on the preprocessor directive type, but defaults to false as a safe assumption for ignore-block replacements.
83
83
  };
84
84
  replacementChildNodes.push(psNode);
85
85
  }
@@ -110,7 +110,7 @@ ignoreBlock, throwErrorWhenTagHasUnresolved = true) {
110
110
  childNodes: [],
111
111
  blockBehavior: null,
112
112
  isBogus: false,
113
- isFragment: false, // TODO: Case by case
113
+ isFragment: false, // Whether this block is a fragment depends on the preprocessor directive type, but defaults to false as a safe assumption for ignore-block replacements.
114
114
  };
115
115
  replacementChildNodes.push(psNode);
116
116
  if (below) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/parser-utils",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.3",
4
4
  "description": "Utility module for markuplint parser plugin",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -31,15 +31,16 @@
31
31
  "clean": "tsc --build --clean tsconfig.build.json"
32
32
  },
33
33
  "dependencies": {
34
- "@markuplint/ml-ast": "5.0.0-alpha.2",
35
- "@markuplint/ml-spec": "5.0.0-alpha.2",
36
- "@markuplint/types": "5.0.0-alpha.2",
34
+ "@markuplint/ml-ast": "5.0.0-alpha.3",
35
+ "@markuplint/ml-spec": "5.0.0-alpha.3",
36
+ "@markuplint/shared": "5.0.0-alpha.3",
37
+ "@markuplint/types": "5.0.0-alpha.3",
37
38
  "debug": "4.4.3",
38
39
  "espree": "11.1.1",
39
40
  "type-fest": "5.4.4"
40
41
  },
41
42
  "devDependencies": {
42
- "@typescript-eslint/typescript-estree": "8.56.0"
43
+ "@typescript-eslint/typescript-estree": "8.56.1"
43
44
  },
44
- "gitHead": "31ccf1e81443ea3f93597d287595211f1823ddcf"
45
+ "gitHead": "2fbdf26daa3d021ac628ccc2f59f0eeae6ddd53d"
45
46
  }