@markuplint/astro-parser 5.1.0 → 5.2.0

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,20 @@
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.2.0](https://github.com/markuplint/markuplint/compare/v5.1.1...v5.2.0) (2026-10-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - use caret ranges for third-party dependencies of published packages ([5fb5d2e](https://github.com/markuplint/markuplint/commit/5fb5d2ee81eaeea45fe7256a40dd41c95ff0d672))
11
+
12
+ ### Features
13
+
14
+ - **astro-parser:** report the namespace of a slot wrapper ([798c429](https://github.com/markuplint/markuplint/commit/798c429eceecf7bc2b2498c568116d91bcc79178))
15
+
16
+ ## [5.1.1](https://github.com/markuplint/markuplint/compare/v5.1.0...v5.1.1) (2026-10-09)
17
+
18
+ **Note:** Version bump only for package @markuplint/astro-parser
19
+
6
20
  # [5.1.0](https://github.com/markuplint/markuplint/compare/v5.0.1...v5.1.0) (2026-10-08)
7
21
 
8
22
  ### Bug Fixes
@@ -1,3 +1,4 @@
1
+ import type { NamespaceURI } from '@markuplint/ml-ast';
1
2
  /**
2
3
  * Result of scanning a single component file for its root element information.
3
4
  */
@@ -47,6 +48,8 @@ export interface ComponentScanSlotWrapper {
47
48
  readonly isRoot: boolean;
48
49
  readonly attrs: readonly ComponentScanAttr[];
49
50
  readonly contents: readonly ComponentScanContent[];
51
+ /** The namespace of the element when the elements between it and the root element decide it. */
52
+ readonly namespace?: NamespaceURI;
50
53
  }
51
54
  /**
52
55
  * A script/ESM source block extracted from a component file.
@@ -1,3 +1,4 @@
1
+ import { getNamespaceBelow } from '@markuplint/parser-utils';
1
2
  import { parser } from './parser.js';
2
3
  function extractComponentInfo(doc) {
3
4
  const root = findRoot(doc);
@@ -109,6 +110,24 @@ function findWrapper(n, nodes) {
109
110
  }
110
111
  return null;
111
112
  }
113
+ /**
114
+ * The names of the elements from the child of `root` down to `el`, for the namespace of `el`
115
+ * (`getNamespaceBelow`). A component is `null`, as it does not enter a namespace by its name.
116
+ */
117
+ function getNamesBelow(el, root, nodes) {
118
+ const names = [];
119
+ let current = el;
120
+ while (current && current.uuid !== root.uuid) {
121
+ if (isElement(current) && !current.isFragment && current.nodeName !== 'template') {
122
+ names.unshift(getNamespaceSubject(current));
123
+ }
124
+ current = current.parentNodeUuid ? nodes.get(current.parentNodeUuid) : undefined;
125
+ }
126
+ return names;
127
+ }
128
+ function getNamespaceSubject(el) {
129
+ return el.elementType === 'authored' ? null : el.nodeName;
130
+ }
112
131
  function isWithin(n, root, nodes) {
113
132
  let current = n;
114
133
  while (current) {
@@ -188,11 +207,15 @@ function scanSlotContent(doc) {
188
207
  return {
189
208
  slotWrappers: [...wrappers.values()].map(wrapper => {
190
209
  const isNative = wrapper.elementType === 'html';
210
+ const namespace = isNative
211
+ ? getNamespaceBelow(getNamespaceSubject(root), getNamesBelow(wrapper, root, nodes))
212
+ : null;
191
213
  return {
192
214
  element: wrapper.nodeName,
193
215
  isRoot: wrapper.uuid === root.uuid,
194
216
  attrs: isNative ? extractAttrs(wrapper) : [],
195
217
  contents: isNative ? extractContents(wrapper) : [],
218
+ ...(namespace ? { namespace } : {}),
196
219
  };
197
220
  }),
198
221
  rootContents: extractContents(root),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/astro-parser",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "astro parser for markuplint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,12 +32,12 @@
32
32
  "clean": "tsc --build --clean tsconfig.build.json"
33
33
  },
34
34
  "dependencies": {
35
- "@markuplint/ml-ast": "5.1.0",
36
- "@markuplint/parser-utils": "5.1.0",
37
- "astro-eslint-parser": "1.4.0"
35
+ "@markuplint/ml-ast": "5.1.1",
36
+ "@markuplint/parser-utils": "5.2.0",
37
+ "astro-eslint-parser": "^1.4.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@astrojs/compiler": "3.0.1"
41
41
  },
42
- "gitHead": "3a061784a8211034ad0c1cbd64798c0213414f65"
42
+ "gitHead": "d8b2feab77c9c862513615bea6b80d2817431878"
43
43
  }