@markuplint/vue-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 +14 -0
- package/lib/component-scanner.d.ts +3 -0
- package/lib/component-scanner.js +23 -0
- package/package.json +6 -6
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
|
+
- **vue-parser:** report the namespace of a slot wrapper ([9baec0b](https://github.com/markuplint/markuplint/commit/9baec0b3611bd8f378933d1d8e82de2384627252))
|
|
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/vue-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
|
*/
|
|
@@ -48,6 +49,8 @@ export interface ComponentScanSlotWrapper {
|
|
|
48
49
|
readonly isRoot: boolean;
|
|
49
50
|
readonly attrs: readonly ComponentScanAttr[];
|
|
50
51
|
readonly contents: readonly ComponentScanContent[];
|
|
52
|
+
/** The namespace of the element when the elements between it and the root element decide it. */
|
|
53
|
+
readonly namespace?: NamespaceURI;
|
|
51
54
|
}
|
|
52
55
|
/**
|
|
53
56
|
* A script/ESM source block extracted from a component file.
|
package/lib/component-scanner.js
CHANGED
|
@@ -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);
|
|
@@ -123,6 +124,24 @@ function findWrapper(n, nodes) {
|
|
|
123
124
|
}
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The names of the elements from the child of `root` down to `el`, for the namespace of `el`
|
|
129
|
+
* (`getNamespaceBelow`). A component is `null`, as it does not enter a namespace by its name.
|
|
130
|
+
*/
|
|
131
|
+
function getNamesBelow(el, root, nodes) {
|
|
132
|
+
const names = [];
|
|
133
|
+
let current = el;
|
|
134
|
+
while (current && current.uuid !== root.uuid) {
|
|
135
|
+
if (isElement(current) && !current.isFragment && current.nodeName !== 'template') {
|
|
136
|
+
names.unshift(getNamespaceSubject(current));
|
|
137
|
+
}
|
|
138
|
+
current = current.parentNodeUuid ? nodes.get(current.parentNodeUuid) : undefined;
|
|
139
|
+
}
|
|
140
|
+
return names;
|
|
141
|
+
}
|
|
142
|
+
function getNamespaceSubject(el) {
|
|
143
|
+
return el.elementType === 'authored' ? null : el.nodeName;
|
|
144
|
+
}
|
|
126
145
|
function isWithin(n, root, nodes) {
|
|
127
146
|
let current = n;
|
|
128
147
|
while (current) {
|
|
@@ -208,11 +227,15 @@ function scanSlotContent(doc) {
|
|
|
208
227
|
return {
|
|
209
228
|
slotWrappers: [...wrappers.values()].map(wrapper => {
|
|
210
229
|
const isNative = wrapper.elementType === 'html';
|
|
230
|
+
const namespace = isNative
|
|
231
|
+
? getNamespaceBelow(getNamespaceSubject(root), getNamesBelow(wrapper, root, nodes))
|
|
232
|
+
: null;
|
|
211
233
|
return {
|
|
212
234
|
element: wrapper.nodeName,
|
|
213
235
|
isRoot: wrapper.uuid === root.uuid,
|
|
214
236
|
attrs: isNative ? extractAttrs(wrapper) : [],
|
|
215
237
|
contents: isNative ? extractContents(wrapper) : [],
|
|
238
|
+
...(namespace ? { namespace } : {}),
|
|
216
239
|
};
|
|
217
240
|
}),
|
|
218
241
|
rootContents: extractContents(root),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/vue-parser",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Vue parser for markuplint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@markuplint/html-parser": "5.
|
|
36
|
-
"@markuplint/ml-ast": "5.1.
|
|
37
|
-
"@markuplint/parser-utils": "5.
|
|
38
|
-
"vue-eslint-parser": "10.4.
|
|
35
|
+
"@markuplint/html-parser": "5.2.0",
|
|
36
|
+
"@markuplint/ml-ast": "5.1.1",
|
|
37
|
+
"@markuplint/parser-utils": "5.2.0",
|
|
38
|
+
"vue-eslint-parser": "^10.4.1"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d8b2feab77c9c862513615bea6b80d2817431878"
|
|
41
41
|
}
|